@mohasinac/appkit 2.8.9 → 3.0.0

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 (1289) hide show
  1. package/dist/_internal/client/features/classified/ClassifiedDetailView.js +17 -4
  2. package/dist/_internal/client/features/digital-code/CodeRevealPanel.js +4 -2
  3. package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.js +2 -2
  4. package/dist/_internal/client/features/layout/SidebarCollapseToggle.js +1 -3
  5. package/dist/_internal/client/features/live/LiveItemDetailView.js +6 -6
  6. package/dist/_internal/client/features/maintenance/index.d.ts +7 -0
  7. package/dist/_internal/client/features/maintenance/index.js +4 -0
  8. package/dist/_internal/client/features/maintenance/views/AnalysisRunnerView.d.ts +2 -0
  9. package/dist/_internal/client/features/maintenance/views/AnalysisRunnerView.js +51 -0
  10. package/dist/_internal/client/features/maintenance/views/MaintenanceDashboardView.d.ts +7 -0
  11. package/dist/_internal/client/features/maintenance/views/MaintenanceDashboardView.js +14 -0
  12. package/dist/_internal/client/features/maintenance/views/ServerErrorDetailView.d.ts +8 -0
  13. package/dist/_internal/client/features/maintenance/views/ServerErrorDetailView.js +9 -0
  14. package/dist/_internal/client/features/maintenance/views/ServerErrorsListView.d.ts +10 -0
  15. package/dist/_internal/client/features/maintenance/views/ServerErrorsListView.js +44 -0
  16. package/dist/_internal/client/scaffolds/AppShell.js +2 -2
  17. package/dist/_internal/client/scaffolds/DashboardScaffold.js +2 -2
  18. package/dist/_internal/client/theme/ThemeProvider.d.ts +39 -0
  19. package/dist/_internal/client/theme/ThemeProvider.js +115 -0
  20. package/dist/_internal/client/theme/__tests__/ThemeProvider.test.d.ts +1 -0
  21. package/dist/_internal/client/theme/__tests__/ThemeProvider.test.js +109 -0
  22. package/dist/_internal/client/theme/buildRegistry.d.ts +29 -0
  23. package/dist/_internal/client/theme/buildRegistry.js +37 -0
  24. package/dist/_internal/client/theme/index.d.ts +4 -0
  25. package/dist/_internal/client/theme/index.js +2 -0
  26. package/dist/_internal/server/features/auctions/actions.d.ts +2 -1
  27. package/dist/_internal/server/features/auctions/actions.js +39 -35
  28. package/dist/_internal/server/features/auctions/og.js +1 -0
  29. package/dist/_internal/server/features/auctions/service.js +4 -0
  30. package/dist/_internal/server/features/auth/capabilities.js +1 -0
  31. package/dist/_internal/server/features/blog/actions.d.ts +6 -5
  32. package/dist/_internal/server/features/blog/actions.js +47 -34
  33. package/dist/_internal/server/features/brands/actions.d.ts +5 -4
  34. package/dist/_internal/server/features/brands/actions.js +63 -52
  35. package/dist/_internal/server/features/cart/actions.d.ts +5 -12
  36. package/dist/_internal/server/features/cart/actions.js +33 -21
  37. package/dist/_internal/server/features/checkout/actions.d.ts +0 -8
  38. package/dist/_internal/server/features/checkout/actions.js +41 -19
  39. package/dist/_internal/server/features/classified/actions.d.ts +2 -1
  40. package/dist/_internal/server/features/classified/actions.js +20 -17
  41. package/dist/_internal/server/features/digital-code/actions.d.ts +2 -1
  42. package/dist/_internal/server/features/digital-code/actions.js +20 -17
  43. package/dist/_internal/server/features/events/actions.d.ts +5 -4
  44. package/dist/_internal/server/features/events/actions.js +55 -43
  45. package/dist/_internal/server/features/events/og.js +1 -0
  46. package/dist/_internal/server/features/events/service.d.ts +3 -2
  47. package/dist/_internal/server/features/events/service.js +2 -0
  48. package/dist/_internal/server/features/grouped/data.js +2 -0
  49. package/dist/_internal/server/features/history/actions.d.ts +3 -2
  50. package/dist/_internal/server/features/history/actions.js +12 -7
  51. package/dist/_internal/server/features/live/actions.d.ts +2 -1
  52. package/dist/_internal/server/features/live/actions.js +20 -17
  53. package/dist/_internal/server/features/maintenance/analyze.d.ts +67 -0
  54. package/dist/_internal/server/features/maintenance/analyze.js +178 -0
  55. package/dist/_internal/server/features/maintenance/data.d.ts +35 -0
  56. package/dist/_internal/server/features/maintenance/data.js +86 -0
  57. package/dist/_internal/server/features/media/contextGuards.d.ts +2 -1
  58. package/dist/_internal/server/features/orders/actions.d.ts +5 -4
  59. package/dist/_internal/server/features/orders/actions.js +47 -33
  60. package/dist/_internal/server/features/payouts/actions.d.ts +2 -1
  61. package/dist/_internal/server/features/payouts/actions.js +22 -19
  62. package/dist/_internal/server/features/pre-orders/actions.d.ts +2 -7
  63. package/dist/_internal/server/features/pre-orders/actions.js +21 -17
  64. package/dist/_internal/server/features/pre-orders/og.js +1 -0
  65. package/dist/_internal/server/features/pre-orders/service.js +1 -0
  66. package/dist/_internal/server/features/products/actions.d.ts +8 -7
  67. package/dist/_internal/server/features/products/actions.js +80 -58
  68. package/dist/_internal/server/features/products/service.js +1 -0
  69. package/dist/_internal/server/features/promotions/actions.d.ts +5 -9
  70. package/dist/_internal/server/features/promotions/actions.js +37 -25
  71. package/dist/_internal/server/features/raffle/actions.d.ts +3 -2
  72. package/dist/_internal/server/features/raffle/actions.js +4 -3
  73. package/dist/_internal/server/features/refunds/actions.d.ts +3 -2
  74. package/dist/_internal/server/features/refunds/actions.js +109 -91
  75. package/dist/_internal/server/features/reviews/actions.d.ts +5 -4
  76. package/dist/_internal/server/features/reviews/actions.js +63 -50
  77. package/dist/_internal/server/features/scams/og.d.ts +2 -1
  78. package/dist/_internal/server/features/search/actions.d.ts +2 -10
  79. package/dist/_internal/server/features/search/actions.js +13 -10
  80. package/dist/_internal/server/features/seo/sitemap.js +8 -0
  81. package/dist/_internal/server/features/wishlist/actions.d.ts +4 -3
  82. package/dist/_internal/server/features/wishlist/actions.js +36 -27
  83. package/dist/_internal/server/functions/bind-all.d.ts +25 -0
  84. package/dist/_internal/server/functions/bind-all.js +85 -0
  85. package/dist/_internal/server/functions/define.d.ts +19 -0
  86. package/dist/_internal/server/functions/define.js +18 -0
  87. package/dist/_internal/server/functions/firestore.d.ts +30 -0
  88. package/dist/_internal/server/functions/firestore.js +117 -0
  89. package/dist/_internal/server/functions/https.d.ts +24 -0
  90. package/dist/_internal/server/functions/https.js +153 -0
  91. package/dist/_internal/server/functions/index.d.ts +11 -0
  92. package/dist/_internal/server/functions/index.js +10 -0
  93. package/dist/_internal/server/functions/manifest.d.ts +15 -0
  94. package/dist/_internal/server/functions/manifest.js +22 -0
  95. package/dist/_internal/server/functions/merge.d.ts +18 -0
  96. package/dist/_internal/server/functions/merge.js +37 -0
  97. package/dist/_internal/server/functions/scheduled.d.ts +22 -0
  98. package/dist/_internal/server/functions/scheduled.js +176 -0
  99. package/dist/_internal/server/functions/types.d.ts +96 -0
  100. package/dist/_internal/server/functions/types.js +17 -0
  101. package/dist/_internal/server/jobs/core/cleanupRtdbEvents.js +3 -0
  102. package/dist/_internal/server/jobs/core/countersReconcile.js +3 -1
  103. package/dist/_internal/server/jobs/core/listingProcessor.d.ts +2 -1
  104. package/dist/_internal/server/jobs/core/mediaTmpCleanup.d.ts +0 -12
  105. package/dist/_internal/server/jobs/core/mediaTmpCleanup.js +2 -0
  106. package/dist/_internal/server/jobs/core/offerExpiry.js +2 -0
  107. package/dist/_internal/server/jobs/core/onBidPlaced.js +2 -0
  108. package/dist/_internal/server/jobs/core/onCategoryWrite.d.ts +2 -7
  109. package/dist/_internal/server/jobs/core/onCategoryWrite.js +2 -0
  110. package/dist/_internal/server/jobs/core/onOrderCreate.js +3 -0
  111. package/dist/_internal/server/jobs/core/onOrderStatusChange.js +2 -0
  112. package/dist/_internal/server/jobs/core/onProductStockChange.js +2 -12
  113. package/dist/_internal/server/jobs/core/onProductWrite.d.ts +2 -5
  114. package/dist/_internal/server/jobs/core/onProductWrite.js +2 -0
  115. package/dist/_internal/server/jobs/core/onReviewWrite.d.ts +3 -2
  116. package/dist/_internal/server/jobs/core/onScamReportCreate.js +5 -2
  117. package/dist/_internal/server/jobs/core/onScamReportRejected.js +2 -0
  118. package/dist/_internal/server/jobs/core/onScamReportVerified.js +2 -0
  119. package/dist/_internal/server/jobs/core/onStoreWrite.d.ts +2 -1
  120. package/dist/_internal/server/jobs/core/onSupportTicketCreate.js +2 -0
  121. package/dist/_internal/server/jobs/core/onSupportTicketUpdate.js +3 -1
  122. package/dist/_internal/server/jobs/core/onUserBanChange.js +2 -0
  123. package/dist/_internal/server/jobs/core/payoutBatch.d.ts +0 -6
  124. package/dist/_internal/server/jobs/core/payoutBatch.js +2 -0
  125. package/dist/_internal/server/jobs/core/prizeRevealExpiry.js +3 -1
  126. package/dist/_internal/server/jobs/core/prizeRevealOpen.js +3 -1
  127. package/dist/_internal/server/jobs/core/prizeRevealReminder.js +3 -1
  128. package/dist/_internal/server/jobs/core/wrapJobHandler.d.ts +25 -0
  129. package/dist/_internal/server/jobs/core/wrapJobHandler.js +79 -0
  130. package/dist/_internal/server/jobs/handlers/onProductStockChange.d.ts +2 -1
  131. package/dist/_internal/server/jobs/handlers/onReviewWrite.d.ts +2 -1
  132. package/dist/_internal/server/jobs/handlers/onScamReportCreate.d.ts +2 -1
  133. package/dist/_internal/server/jobs/handlers/onScamReportUpdate.d.ts +2 -1
  134. package/dist/_internal/server/jobs/handlers/onSupportTicketCreate.d.ts +2 -1
  135. package/dist/_internal/server/jobs/handlers/onSupportTicketUpdate.d.ts +2 -1
  136. package/dist/_internal/server/jobs/handlers/onUserBanChange.d.ts +2 -1
  137. package/dist/_internal/server/jobs/runtime/adapters/firebase.js +2 -0
  138. package/dist/_internal/server/jobs/runtime/types.d.ts +4 -3
  139. package/dist/_internal/server/providers/index.d.ts +11 -0
  140. package/dist/_internal/server/providers/index.js +11 -0
  141. package/dist/_internal/server/providers/payment/razorpay-mock.d.ts +51 -0
  142. package/dist/_internal/server/providers/payment/razorpay-mock.js +116 -0
  143. package/dist/_internal/server/providers/resolve.d.ts +39 -0
  144. package/dist/_internal/server/providers/resolve.js +37 -0
  145. package/dist/_internal/server/providers/shipping/shiprocket-mock.d.ts +29 -0
  146. package/dist/_internal/server/providers/shipping/shiprocket-mock.js +152 -0
  147. package/dist/_internal/shared/checkout/rules/types.d.ts +3 -2
  148. package/dist/_internal/shared/config/schema.d.ts +7 -6
  149. package/dist/_internal/shared/features/layout/config.js +2 -2
  150. package/dist/_internal/shared/features/orders/schema.d.ts +2 -2
  151. package/dist/_internal/shared/features/promotions/schema.d.ts +6 -6
  152. package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
  153. package/dist/_internal/shared/listing-types/action-tracker.d.ts +3 -2
  154. package/dist/_internal/shared/listing-types/action-tracker.js +0 -18
  155. package/dist/_internal/shared/listing-types/cart-shipping.d.ts +1 -1
  156. package/dist/_internal/shared/listing-types/cart-shipping.js +1 -1
  157. package/dist/_internal/shared/serialization/index.js +4 -0
  158. package/dist/_internal/shared/styles/grid.d.ts +12 -0
  159. package/dist/_internal/shared/styles/grid.js +12 -0
  160. package/dist/_internal/shared/styles/page.d.ts +20 -0
  161. package/dist/_internal/shared/styles/page.js +20 -0
  162. package/dist/_internal/shared/styles/skeleton.d.ts +16 -0
  163. package/dist/_internal/shared/styles/skeleton.js +18 -0
  164. package/dist/_internal/shared/styles/themed.d.ts +26 -0
  165. package/dist/_internal/shared/styles/themed.js +29 -0
  166. package/dist/_internal/shared/tokens/index.d.ts +1 -1
  167. package/dist/_internal/shared/tokens/index.js +1 -1
  168. package/dist/_internal/shared/types/__tests__/action-result.test.d.ts +1 -0
  169. package/dist/_internal/shared/types/__tests__/action-result.test.js +65 -0
  170. package/dist/_internal/shared/types/action-result.d.ts +49 -0
  171. package/dist/_internal/shared/types/action-result.js +47 -0
  172. package/dist/cli/index.d.ts +2 -1
  173. package/dist/client/api/ApiError.d.ts +18 -0
  174. package/dist/client/api/ApiError.js +23 -0
  175. package/dist/client/api/surface-error.d.ts +30 -0
  176. package/dist/client/api/surface-error.js +39 -0
  177. package/dist/client/api/useApiMutation.d.ts +31 -0
  178. package/dist/client/api/useApiMutation.js +52 -0
  179. package/dist/client/api/useApiQuery.d.ts +20 -0
  180. package/dist/client/api/useApiQuery.js +56 -0
  181. package/dist/client/observability/installClientErrorReporter.d.ts +10 -0
  182. package/dist/client/observability/installClientErrorReporter.js +48 -0
  183. package/dist/client/observability/reportClientError.d.ts +16 -0
  184. package/dist/client/observability/reportClientError.js +70 -0
  185. package/dist/client.d.ts +31 -3
  186. package/dist/client.js +37 -5
  187. package/dist/configs/eslint.js +50 -8
  188. package/dist/configs/next.d.ts +4 -3
  189. package/dist/configs/next.js +2 -2
  190. package/dist/configs/tailwind.d.ts +1 -1
  191. package/dist/configs/tailwind.js +2 -1
  192. package/dist/constants/api-endpoint-resolver.d.ts +3 -3
  193. package/dist/constants/api-endpoint-resolver.js +3 -3
  194. package/dist/contracts/auth.d.ts +3 -2
  195. package/dist/contracts/extend.d.ts +26 -26
  196. package/dist/contracts/extend.js +6 -6
  197. package/dist/contracts/feature.d.ts +3 -3
  198. package/dist/contracts/field-ops.js +2 -0
  199. package/dist/contracts/form.d.ts +12 -12
  200. package/dist/contracts/form.js +12 -12
  201. package/dist/contracts/payment.d.ts +3 -2
  202. package/dist/contracts/repository.d.ts +13 -5
  203. package/dist/contracts/search.d.ts +1 -1
  204. package/dist/core/EventBus.d.ts +0 -6
  205. package/dist/core/EventBus.js +4 -0
  206. package/dist/core/Logger.js +6 -0
  207. package/dist/core/Queue.js +2 -0
  208. package/dist/core/StorageManager.d.ts +0 -7
  209. package/dist/core/StorageManager.js +5 -0
  210. package/dist/core/hooks/useSiteSettings.d.ts +1 -1
  211. package/dist/core/mutation-events.d.ts +1 -1
  212. package/dist/core/mutation-events.js +2 -1
  213. package/dist/core/newsletter.repository.js +6 -2
  214. package/dist/core/server-action.d.ts +0 -36
  215. package/dist/core/server-action.js +16 -11
  216. package/dist/core/unit-of-work.js +3 -0
  217. package/dist/errors/__tests__/error-mapping.test.d.ts +1 -0
  218. package/dist/errors/__tests__/error-mapping.test.js +122 -0
  219. package/dist/errors/__tests__/safe-read.test.d.ts +1 -0
  220. package/dist/errors/__tests__/safe-read.test.js +39 -0
  221. package/dist/errors/api-error.js +1 -0
  222. package/dist/errors/authentication-error.js +1 -0
  223. package/dist/errors/authorization-error.js +1 -0
  224. package/dist/errors/base-error.js +3 -1
  225. package/dist/errors/database-error.js +1 -0
  226. package/dist/errors/error-display-map.d.ts +14 -0
  227. package/dist/errors/error-display-map.js +233 -0
  228. package/dist/errors/error-handler.d.ts +2 -1
  229. package/dist/errors/error-handler.js +5 -1
  230. package/dist/errors/error-mapping.d.ts +49 -0
  231. package/dist/errors/error-mapping.js +213 -0
  232. package/dist/errors/index.d.ts +6 -0
  233. package/dist/errors/index.js +11 -0
  234. package/dist/errors/normalize.d.ts +81 -0
  235. package/dist/errors/normalize.js +206 -0
  236. package/dist/errors/not-found-error.js +1 -0
  237. package/dist/errors/razorpay-unreachable.d.ts +4 -0
  238. package/dist/errors/razorpay-unreachable.js +7 -0
  239. package/dist/errors/safe-read.d.ts +37 -0
  240. package/dist/errors/safe-read.js +39 -0
  241. package/dist/errors/validation-error.js +1 -0
  242. package/dist/features/_guide-cls.js +1 -1
  243. package/dist/features/about/components/AboutView.d.ts +2 -3
  244. package/dist/features/about/components/AboutView.js +3 -3
  245. package/dist/features/about/components/FAQPageView.d.ts +1 -2
  246. package/dist/features/about/components/FAQPageView.js +9 -10
  247. package/dist/features/about/components/FeesView.d.ts +1 -2
  248. package/dist/features/about/components/FeesView.js +12 -9
  249. package/dist/features/about/components/HelpPageView.d.ts +1 -2
  250. package/dist/features/about/components/HelpPageView.js +15 -12
  251. package/dist/features/about/components/HowAuctionsWorkView.d.ts +1 -2
  252. package/dist/features/about/components/HowAuctionsWorkView.js +11 -12
  253. package/dist/features/about/components/HowCheckoutWorksView.d.ts +1 -2
  254. package/dist/features/about/components/HowCheckoutWorksView.js +11 -12
  255. package/dist/features/about/components/HowOffersWorkView.d.ts +1 -2
  256. package/dist/features/about/components/HowOffersWorkView.js +11 -12
  257. package/dist/features/about/components/HowOrdersWorkView.d.ts +1 -2
  258. package/dist/features/about/components/HowOrdersWorkView.js +11 -12
  259. package/dist/features/about/components/HowPayoutsWorkView.d.ts +1 -2
  260. package/dist/features/about/components/HowPayoutsWorkView.js +11 -12
  261. package/dist/features/about/components/HowPreOrdersWorkView.d.ts +1 -2
  262. package/dist/features/about/components/HowPreOrdersWorkView.js +11 -12
  263. package/dist/features/about/components/HowReviewsWorkView.d.ts +1 -2
  264. package/dist/features/about/components/HowReviewsWorkView.js +11 -12
  265. package/dist/features/about/components/PolicyPageView.d.ts +1 -2
  266. package/dist/features/about/components/PolicyPageView.js +6 -6
  267. package/dist/features/about/components/PublicProfileView.d.ts +1 -2
  268. package/dist/features/about/components/PublicProfileView.js +31 -24
  269. package/dist/features/about/components/SecurityPrivacyView.d.ts +1 -2
  270. package/dist/features/about/components/SecurityPrivacyView.js +9 -10
  271. package/dist/features/about/components/ShippingPolicyView.d.ts +1 -2
  272. package/dist/features/about/components/ShippingPolicyView.js +4 -5
  273. package/dist/features/about/components/TrackOrderView.d.ts +1 -2
  274. package/dist/features/about/components/TrackOrderView.js +14 -6
  275. package/dist/features/about/components/UnauthorizedView.d.ts +1 -2
  276. package/dist/features/about/components/UnauthorizedView.js +6 -7
  277. package/dist/features/account/api/[userId]/addresses/route.js +3 -0
  278. package/dist/features/account/api/[userId]/route.js +3 -0
  279. package/dist/features/account/components/AddressBook.d.ts +2 -1
  280. package/dist/features/account/components/AddressBook.js +5 -4
  281. package/dist/features/account/components/AddressForm.js +25 -30
  282. package/dist/features/account/components/AddressesIndexListing.js +4 -3
  283. package/dist/features/account/components/BecomeSellerView.js +1 -1
  284. package/dist/features/account/components/BuyerAccountGuideView.js +9 -9
  285. package/dist/features/account/components/BuyerAuctionsGuideView.js +7 -7
  286. package/dist/features/account/components/BuyerOrdersGuideView.js +8 -8
  287. package/dist/features/account/components/BuyerShoppingGuideView.js +8 -8
  288. package/dist/features/account/components/ChatList.js +1 -1
  289. package/dist/features/account/components/ChatWindow.js +2 -3
  290. package/dist/features/account/components/MessagesView.js +4 -3
  291. package/dist/features/account/components/NotificationBell.js +18 -9
  292. package/dist/features/account/components/NotificationPreferencesPanel.js +9 -7
  293. package/dist/features/account/components/UserOffersPanel.js +8 -4
  294. package/dist/features/account/components/UserSidebar.js +7 -7
  295. package/dist/features/account/components/UserSupportView.js +12 -11
  296. package/dist/features/account/hooks/useAccount.d.ts +2 -2
  297. package/dist/features/account/hooks/useAddressSelector.d.ts +1 -1
  298. package/dist/features/account/hooks/useAddresses.d.ts +2 -2
  299. package/dist/features/account/hooks/useNotifications.d.ts +3 -2
  300. package/dist/features/account/hooks/useProfile.d.ts +4 -3
  301. package/dist/features/account/hooks/useProfile.js +3 -2
  302. package/dist/features/account/hooks/usePublicProfile.d.ts +2 -2
  303. package/dist/features/addresses/repository/addresses.repository.d.ts +0 -10
  304. package/dist/features/addresses/repository/addresses.repository.js +18 -4
  305. package/dist/features/addresses/schemas/index.d.ts +75 -0
  306. package/dist/features/addresses/schemas/index.js +22 -0
  307. package/dist/features/admin/actions/admin-actions.d.ts +0 -6
  308. package/dist/features/admin/actions/admin-actions.js +2 -0
  309. package/dist/features/admin/actions/notification-actions.js +4 -0
  310. package/dist/features/admin/actions/site-settings-actions.d.ts +2 -1
  311. package/dist/features/admin/components/AdminAdEditorView.js +8 -7
  312. package/dist/features/admin/components/AdminAddressEditorView.js +12 -10
  313. package/dist/features/admin/components/AdminAdsView.js +13 -12
  314. package/dist/features/admin/components/AdminAllEventEntriesView.js +3 -2
  315. package/dist/features/admin/components/AdminAnalyticsGuideView.js +7 -7
  316. package/dist/features/admin/components/AdminAnalyticsView.js +2 -2
  317. package/dist/features/admin/components/AdminBidsView.js +3 -2
  318. package/dist/features/admin/components/AdminBlogEditorView.js +12 -10
  319. package/dist/features/admin/components/AdminBrandEditorView.js +29 -18
  320. package/dist/features/admin/components/AdminBrandsView.js +6 -6
  321. package/dist/features/admin/components/AdminBundleEditorView.js +36 -33
  322. package/dist/features/admin/components/AdminBundlesView.js +7 -6
  323. package/dist/features/admin/components/AdminCarouselEditorView.js +35 -24
  324. package/dist/features/admin/components/AdminCarouselView.js +13 -9
  325. package/dist/features/admin/components/AdminCartsView.js +1 -0
  326. package/dist/features/admin/components/AdminCatalogGuideView.js +8 -8
  327. package/dist/features/admin/components/AdminCategoriesView.js +7 -7
  328. package/dist/features/admin/components/AdminCategoryEditorView.js +25 -18
  329. package/dist/features/admin/components/AdminContactEditorView.js +5 -4
  330. package/dist/features/admin/components/AdminContactView.js +4 -3
  331. package/dist/features/admin/components/AdminContentGuideView.js +10 -10
  332. package/dist/features/admin/components/AdminCouponEditorView.js +35 -24
  333. package/dist/features/admin/components/AdminCouponsView.js +2 -2
  334. package/dist/features/admin/components/AdminEmployeeEditorView.js +9 -8
  335. package/dist/features/admin/components/AdminFaqEditorView.js +29 -19
  336. package/dist/features/admin/components/AdminFaqsView.js +6 -6
  337. package/dist/features/admin/components/AdminFeatureEditorView.js +9 -7
  338. package/dist/features/admin/components/AdminFeatureFlagsView.js +7 -6
  339. package/dist/features/admin/components/AdminFilterBar.d.ts +8 -8
  340. package/dist/features/admin/components/AdminFilterBar.js +1 -1
  341. package/dist/features/admin/components/AdminGuideHubView.js +6 -6
  342. package/dist/features/admin/components/AdminMediaView.js +12 -6
  343. package/dist/features/admin/components/AdminNavEditorView.js +3 -3
  344. package/dist/features/admin/components/AdminNavigationView.js +10 -9
  345. package/dist/features/admin/components/AdminNewsletterView.js +3 -2
  346. package/dist/features/admin/components/AdminNotificationsView.js +7 -6
  347. package/dist/features/admin/components/AdminOrderEditorView.js +5 -4
  348. package/dist/features/admin/components/AdminOrdersGuideView.js +11 -11
  349. package/dist/features/admin/components/AdminPageHeader.d.ts +9 -9
  350. package/dist/features/admin/components/AdminPageHeader.js +3 -3
  351. package/dist/features/admin/components/AdminPayoutsView.js +6 -4
  352. package/dist/features/admin/components/AdminPrizeDrawsView.js +4 -4
  353. package/dist/features/admin/components/AdminProductEditorView.js +9 -7
  354. package/dist/features/admin/components/AdminProductsView.js +10 -6
  355. package/dist/features/admin/components/AdminReturnRequestsView.js +4 -3
  356. package/dist/features/admin/components/AdminReviewsView.js +7 -6
  357. package/dist/features/admin/components/AdminScammerEditorView.js +6 -5
  358. package/dist/features/admin/components/AdminScammersView.js +4 -4
  359. package/dist/features/admin/components/AdminSectionsView.js +45 -44
  360. package/dist/features/admin/components/AdminSessionsManager.js +2 -2
  361. package/dist/features/admin/components/AdminSessionsView.js +6 -5
  362. package/dist/features/admin/components/AdminSidebar.js +9 -9
  363. package/dist/features/admin/components/AdminSiteConfigGuideView.js +2 -2
  364. package/dist/features/admin/components/AdminSiteSettingsView.js +32 -4
  365. package/dist/features/admin/components/AdminSiteView.js +4 -3
  366. package/dist/features/admin/components/AdminStoreEditorView.js +9 -8
  367. package/dist/features/admin/components/AdminStoresGuideView.js +9 -9
  368. package/dist/features/admin/components/AdminStoresView.js +4 -3
  369. package/dist/features/admin/components/AdminSublistingCategoryEditorView.js +21 -15
  370. package/dist/features/admin/components/AdminSupportTicketDetailView.js +21 -16
  371. package/dist/features/admin/components/AdminSupportTicketsView.js +5 -5
  372. package/dist/features/admin/components/AdminTeamGuideView.js +7 -7
  373. package/dist/features/admin/components/AdminTeamView.js +1 -1
  374. package/dist/features/admin/components/AdminTrustGuideView.js +10 -10
  375. package/dist/features/admin/components/AdminUserEditorView.js +13 -12
  376. package/dist/features/admin/components/AdminUsersGuideView.js +9 -9
  377. package/dist/features/admin/components/AdminUsersView.js +4 -3
  378. package/dist/features/admin/components/AdminViewCards.js +7 -7
  379. package/dist/features/admin/components/BrandQuickCreateForm.js +5 -4
  380. package/dist/features/admin/components/CategoryQuickCreateForm.js +5 -4
  381. package/dist/features/admin/components/DashboardStats.js +9 -7
  382. package/dist/features/admin/components/DataListingView.js +8 -4
  383. package/dist/features/admin/components/DataTable.js +9 -7
  384. package/dist/features/admin/components/DrawerFormFooter.js +2 -2
  385. package/dist/features/admin/components/QuickActionsPanel.js +1 -1
  386. package/dist/features/admin/components/QuickEditMenu.d.ts +6 -2
  387. package/dist/features/admin/components/QuickEditMenu.js +2 -2
  388. package/dist/features/admin/components/analytics/AdminAnalyticsCharts.js +3 -3
  389. package/dist/features/admin/components/analytics/AdminStatCard.js +8 -6
  390. package/dist/features/admin/components/analytics/AdminTopProductsTable.js +4 -2
  391. package/dist/features/admin/components/sections/adminSectionsBuildParse.d.ts +51 -50
  392. package/dist/features/admin/components/sections/adminSectionsBuildParse.js +5 -0
  393. package/dist/features/admin/components/sections/adminSectionsTypes.d.ts +2 -1
  394. package/dist/features/admin/hooks/useAdmin.d.ts +1 -1
  395. package/dist/features/admin/hooks/useAdminListingData.d.ts +8 -2
  396. package/dist/features/admin/hooks/useAdminListingData.js +5 -0
  397. package/dist/features/admin/hooks/useAdminSectionsListing.d.ts +1 -1
  398. package/dist/features/admin/hooks/useChat.d.ts +3 -3
  399. package/dist/features/admin/hooks/useChat.js +8 -3
  400. package/dist/features/admin/repository/chat.repository.d.ts +0 -20
  401. package/dist/features/admin/repository/chat.repository.js +7 -0
  402. package/dist/features/admin/repository/notification.repository.js +6 -7
  403. package/dist/features/admin/repository/site-settings.repository.js +3 -0
  404. package/dist/features/admin/schemas/firestore.d.ts +53 -11
  405. package/dist/features/admin/schemas/firestore.js +21 -0
  406. package/dist/features/admin/types/index.d.ts +1 -1
  407. package/dist/features/auctions/actions/bid-actions.d.ts +0 -6
  408. package/dist/features/auctions/actions/bid-actions.js +2 -0
  409. package/dist/features/auctions/api/route.js +2 -0
  410. package/dist/features/auctions/components/AuctionBidsTable.js +8 -6
  411. package/dist/features/auctions/components/AuctionDetailPageView.js +13 -8
  412. package/dist/features/auctions/components/AuctionsListView.js +1 -1
  413. package/dist/features/auctions/components/CollapsibleBidHistory.js +1 -1
  414. package/dist/features/auctions/components/MarketplaceAuctionCard.js +21 -10
  415. package/dist/features/auctions/components/MarketplaceAuctionGrid.js +3 -3
  416. package/dist/features/auctions/components/PlaceBidFormClient.js +65 -45
  417. package/dist/features/auctions/hooks/useAuctions.d.ts +8 -8
  418. package/dist/features/auctions/hooks/usePlaceBid.d.ts +2 -1
  419. package/dist/features/auctions/repository/bid.repository.js +11 -0
  420. package/dist/features/auctions/schemas/bid-input.d.ts +17 -0
  421. package/dist/features/auctions/schemas/bid-input.js +16 -0
  422. package/dist/features/auctions/schemas/index.d.ts +2 -2
  423. package/dist/features/auth/actions/profile-actions.d.ts +2 -0
  424. package/dist/features/auth/actions/profile-actions.js +25 -0
  425. package/dist/features/auth/actions/realtime-token-actions.js +3 -0
  426. package/dist/features/auth/components/AuthStatusPanel.js +4 -4
  427. package/dist/features/auth/components/ForgotPasswordView.js +18 -11
  428. package/dist/features/auth/components/Guards.d.ts +11 -11
  429. package/dist/features/auth/components/Guards.js +3 -3
  430. package/dist/features/auth/components/LoginForm.d.ts +1 -6
  431. package/dist/features/auth/components/LoginForm.js +19 -11
  432. package/dist/features/auth/components/OAuthLoadingView.js +2 -2
  433. package/dist/features/auth/components/RegisterForm.js +28 -20
  434. package/dist/features/auth/components/ResetPasswordView.js +25 -18
  435. package/dist/features/auth/components/SocialAuthButtons.js +2 -2
  436. package/dist/features/auth/components/VerifyEmailView.js +8 -8
  437. package/dist/features/auth/consent-otp.d.ts +3 -2
  438. package/dist/features/auth/consent-otp.js +8 -8
  439. package/dist/features/auth/hooks/useAuth.d.ts +27 -26
  440. package/dist/features/auth/hooks/useAuth.js +3 -0
  441. package/dist/features/auth/permissions/constants.d.ts +2 -2
  442. package/dist/features/auth/permissions/constants.js +17 -0
  443. package/dist/features/auth/repository/session.repository.js +9 -0
  444. package/dist/features/auth/repository/token.repository.js +9 -0
  445. package/dist/features/auth/repository/user.repository.js +14 -6
  446. package/dist/features/auth/role-predicates.d.ts +20 -16
  447. package/dist/features/auth/role-predicates.js +1 -8
  448. package/dist/features/auth/schemas/index.d.ts +6 -6
  449. package/dist/features/auth/server/checkSoftBan.js +2 -1
  450. package/dist/features/before-after/api/[id]/route.js +4 -0
  451. package/dist/features/before-after/api/route.js +3 -0
  452. package/dist/features/before-after/components/BeforeAfterGallery.js +2 -2
  453. package/dist/features/before-after/components/BeforeAfterSlider.js +3 -3
  454. package/dist/features/blog/actions/blog-actions.d.ts +7 -7
  455. package/dist/features/blog/api/[slug]/route.d.ts +1 -1
  456. package/dist/features/blog/api/[slug]/route.js +3 -1
  457. package/dist/features/blog/api/route.js +2 -0
  458. package/dist/features/blog/columns/index.d.ts +2 -2
  459. package/dist/features/blog/columns/index.js +2 -2
  460. package/dist/features/blog/components/BlogFeaturedCard.js +9 -8
  461. package/dist/features/blog/components/BlogIndexListing.js +7 -6
  462. package/dist/features/blog/components/BlogIndexPageView.js +1 -1
  463. package/dist/features/blog/components/BlogListView.js +10 -11
  464. package/dist/features/blog/components/BlogPostForm.js +3 -3
  465. package/dist/features/blog/components/BlogPostView.js +10 -10
  466. package/dist/features/blog/repository/blog.repository.js +6 -0
  467. package/dist/features/blog/schemas/index.d.ts +210 -3
  468. package/dist/features/blog/schemas/index.js +27 -0
  469. package/dist/features/cart/api/[id]/route.js +3 -0
  470. package/dist/features/cart/api/route.js +3 -0
  471. package/dist/features/cart/components/CartDrawer.js +9 -8
  472. package/dist/features/cart/components/CartSummary.js +2 -2
  473. package/dist/features/cart/components/CartView.d.ts +2 -1
  474. package/dist/features/cart/components/CartView.js +2 -2
  475. package/dist/features/cart/components/CheckoutAddressStep.js +2 -2
  476. package/dist/features/cart/components/CheckoutView.js +2 -2
  477. package/dist/features/cart/components/ShippingPicker.js +1 -1
  478. package/dist/features/cart/hooks/useAddToCart.d.ts +2 -1
  479. package/dist/features/cart/hooks/useAddToCart.js +2 -0
  480. package/dist/features/cart/hooks/useCart.d.ts +1 -1
  481. package/dist/features/cart/hooks/useCartQuery.d.ts +3 -2
  482. package/dist/features/cart/hooks/useCheckoutReadQueries.d.ts +5 -4
  483. package/dist/features/cart/hooks/useOrder.d.ts +2 -2
  484. package/dist/features/cart/repository/cart.repository.js +3 -0
  485. package/dist/features/categories/api/[id]/route.d.ts +1 -1
  486. package/dist/features/categories/api/[id]/route.js +3 -1
  487. package/dist/features/categories/api/route.js +3 -0
  488. package/dist/features/categories/components/BrandDetailPageView.js +15 -4
  489. package/dist/features/categories/components/BrandDetailTabs.js +1 -1
  490. package/dist/features/categories/components/BreadcrumbTrail.d.ts +3 -3
  491. package/dist/features/categories/components/BreadcrumbTrail.js +3 -3
  492. package/dist/features/categories/components/BundleBuyNowCta.js +2 -0
  493. package/dist/features/categories/components/BundleCollage.js +4 -4
  494. package/dist/features/categories/components/BundleDetailView.d.ts +5 -6
  495. package/dist/features/categories/components/BundleDetailView.js +6 -3
  496. package/dist/features/categories/components/BundleDynamicRuleEditor.js +2 -2
  497. package/dist/features/categories/components/BundleItemsPicker.js +10 -6
  498. package/dist/features/categories/components/BundlesListView.js +1 -1
  499. package/dist/features/categories/components/CategoriesIndexListing.js +8 -7
  500. package/dist/features/categories/components/CategoriesIndexPageView.js +2 -1
  501. package/dist/features/categories/components/CategoryBundlesListing.js +6 -4
  502. package/dist/features/categories/components/CategoryDetailPageView.js +14 -3
  503. package/dist/features/categories/components/CategoryDetailTabs.js +1 -1
  504. package/dist/features/categories/components/CategoryForm.js +2 -2
  505. package/dist/features/categories/components/CategoryGrid.js +6 -7
  506. package/dist/features/categories/components/CategoryProductsListing.js +3 -5
  507. package/dist/features/categories/components/CategoryProductsView.js +2 -2
  508. package/dist/features/categories/components/CategorySelectorCreate.js +3 -2
  509. package/dist/features/categories/components/CategorySortSelect.js +1 -1
  510. package/dist/features/categories/components/CategoryStoresListing.js +3 -3
  511. package/dist/features/categories/components/CategoryTableColumns.js +6 -6
  512. package/dist/features/categories/components/CategoryTree.js +5 -5
  513. package/dist/features/categories/components/ConcernCard.js +2 -3
  514. package/dist/features/categories/hooks/useCategories.d.ts +3 -3
  515. package/dist/features/categories/hooks/useCategorySelector.d.ts +7 -6
  516. package/dist/features/categories/hooks/useCategoryTree.d.ts +1 -1
  517. package/dist/features/categories/hooks/useCategoryTree.js +1 -1
  518. package/dist/features/categories/repository/categories.repository.d.ts +2 -1
  519. package/dist/features/categories/repository/categories.repository.js +14 -0
  520. package/dist/features/categories/schemas/index.d.ts +555 -0
  521. package/dist/features/categories/schemas/index.js +96 -0
  522. package/dist/features/checkout/components/CheckoutStepper.js +2 -7
  523. package/dist/features/checkout/hooks/useCheckoutApi.d.ts +2 -2
  524. package/dist/features/checkout/hooks/usePaymentCheckout.js +6 -0
  525. package/dist/features/classified/components/ClassifiedFilters.js +1 -1
  526. package/dist/features/classified/components/ClassifiedIndexListing.js +2 -2
  527. package/dist/features/classified/components/ClassifiedListView.js +1 -1
  528. package/dist/features/collections/api/[slug]/route.js +4 -0
  529. package/dist/features/collections/api/route.js +3 -0
  530. package/dist/features/collections/components/CollectionCard.js +6 -4
  531. package/dist/features/collections/hooks/useCollections.d.ts +2 -2
  532. package/dist/features/consultation/api/[id]/route.js +4 -0
  533. package/dist/features/consultation/api/route.js +3 -0
  534. package/dist/features/consultation/components/ConsultationForm.js +7 -8
  535. package/dist/features/consultation/schemas/index.d.ts +2 -2
  536. package/dist/features/contact/components/ContactForm.js +5 -5
  537. package/dist/features/contact/components/ContactInfoSidebar.js +2 -2
  538. package/dist/features/contact/components/ContactPageView.js +3 -9
  539. package/dist/features/contact/email.d.ts +9 -8
  540. package/dist/features/contact/email.js +36 -196
  541. package/dist/features/copilot/components/AdminCopilotView.js +9 -12
  542. package/dist/features/copilot/hooks/useCopilotChat.d.ts +1 -1
  543. package/dist/features/copilot/hooks/useCopilotChat.js +2 -2
  544. package/dist/features/copilot/hooks/useCopilotFeedback.d.ts +1 -1
  545. package/dist/features/copilot/hooks/useCopilotFeedback.js +2 -2
  546. package/dist/features/corporate/api/[id]/route.js +4 -0
  547. package/dist/features/corporate/api/route.js +3 -0
  548. package/dist/features/corporate/components/CorporateInquiryForm.js +8 -15
  549. package/dist/features/cron/firebase-adapters.d.ts +1 -1
  550. package/dist/features/cron/firebase-adapters.js +1 -1
  551. package/dist/features/cron/jobs/auction-expiry.job.d.ts +1 -1
  552. package/dist/features/cron/registry.d.ts +11 -11
  553. package/dist/features/cron/registry.js +11 -11
  554. package/dist/features/cron/types.d.ts +2 -1
  555. package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +2 -2
  556. package/dist/features/digital-codes/components/DigitalCodesListView.js +1 -1
  557. package/dist/features/email/index.d.ts +9 -0
  558. package/dist/features/email/index.js +8 -0
  559. package/dist/features/email/primitives.d.ts +90 -0
  560. package/dist/features/email/primitives.js +122 -0
  561. package/dist/features/events/actions/event-actions.d.ts +7 -6
  562. package/dist/features/events/actions/event-actions.js +1 -0
  563. package/dist/features/events/api/[id]/route.js +3 -0
  564. package/dist/features/events/api/route.js +2 -0
  565. package/dist/features/events/components/AdminEventEditorView.js +13 -11
  566. package/dist/features/events/components/AdminEventEntriesView.js +11 -10
  567. package/dist/features/events/components/EventBanner.js +3 -3
  568. package/dist/features/events/components/EventCard.js +9 -5
  569. package/dist/features/events/components/EventFormDrawer.js +2 -2
  570. package/dist/features/events/components/EventLeaderboard.js +4 -4
  571. package/dist/features/events/components/EventOfferCard.js +2 -2
  572. package/dist/features/events/components/EventParticipateView.js +3 -3
  573. package/dist/features/events/components/EventPollWidget.js +8 -6
  574. package/dist/features/events/components/EventRaffleEntryForm.js +6 -2
  575. package/dist/features/events/components/EventRaffleWinnerView.js +7 -5
  576. package/dist/features/events/components/EventRafflesSection.js +2 -1
  577. package/dist/features/events/components/EventSaleBanner.js +2 -2
  578. package/dist/features/events/components/EventStatusBadge.js +1 -1
  579. package/dist/features/events/components/EventsIndexListing.js +3 -2
  580. package/dist/features/events/components/EventsListPageView.js +1 -1
  581. package/dist/features/events/components/EventsListView.js +6 -6
  582. package/dist/features/events/components/SpinWheelView.js +15 -13
  583. package/dist/features/events/hooks/useBulkEvent.d.ts +3 -3
  584. package/dist/features/events/hooks/useBulkEvent.js +1 -0
  585. package/dist/features/events/hooks/useEvent.d.ts +3 -3
  586. package/dist/features/events/hooks/useEvents.d.ts +1 -1
  587. package/dist/features/events/repository/event-entry.repository.js +7 -0
  588. package/dist/features/events/repository/events.repository.js +7 -0
  589. package/dist/features/events/schemas/firestore.d.ts +2 -1
  590. package/dist/features/events/schemas/index.d.ts +4 -4
  591. package/dist/features/events/types/index.d.ts +3 -2
  592. package/dist/features/faq/api/route.js +2 -0
  593. package/dist/features/faq/components/ContactCTA.js +4 -2
  594. package/dist/features/faq/components/FAQAccordion.js +5 -3
  595. package/dist/features/faq/components/FAQCategorySidebar.js +5 -7
  596. package/dist/features/faq/components/FAQHelpfulButtons.js +7 -4
  597. package/dist/features/faq/components/FAQPageContent.js +4 -4
  598. package/dist/features/faq/components/FAQSortDropdown.js +2 -2
  599. package/dist/features/faq/components/RelatedFAQs.js +6 -2
  600. package/dist/features/faq/hooks/useFAQs.d.ts +1 -1
  601. package/dist/features/faq/hooks/useFaqList.d.ts +15 -15
  602. package/dist/features/faq/schemas/index.d.ts +198 -0
  603. package/dist/features/faq/schemas/index.js +35 -0
  604. package/dist/features/filters/AsyncFacetSection.js +8 -6
  605. package/dist/features/filters/FilterFacetSection.js +22 -12
  606. package/dist/features/filters/RangeFilter.js +5 -5
  607. package/dist/features/filters/SwitchFilter.js +2 -2
  608. package/dist/features/forms/Checkbox.js +6 -4
  609. package/dist/features/forms/Radio.js +1 -1
  610. package/dist/features/forms/Slider.js +2 -2
  611. package/dist/features/forms/Textarea.js +2 -2
  612. package/dist/features/forms/index.d.ts +0 -2
  613. package/dist/features/forms/index.js +4 -1
  614. package/dist/features/grouped/schemas/index.d.ts +83 -0
  615. package/dist/features/grouped/schemas/index.js +34 -0
  616. package/dist/features/history/repository/user-history.repository.js +2 -0
  617. package/dist/features/homepage/actions/carousel-actions.d.ts +3 -2
  618. package/dist/features/homepage/actions/carousel-actions.js +1 -0
  619. package/dist/features/homepage/actions/homepage-section-actions.js +5 -3
  620. package/dist/features/homepage/api/[id]/route.d.ts +1 -1
  621. package/dist/features/homepage/api/[id]/route.js +3 -1
  622. package/dist/features/homepage/api/carousel/[id]/route.d.ts +1 -1
  623. package/dist/features/homepage/api/carousel/[id]/route.js +3 -1
  624. package/dist/features/homepage/api/carousel/route.js +3 -0
  625. package/dist/features/homepage/api/route.js +3 -0
  626. package/dist/features/homepage/api/sections/[id]/route.js +4 -0
  627. package/dist/features/homepage/api/sections/route.js +3 -0
  628. package/dist/features/homepage/components/AdSlot.js +3 -2
  629. package/dist/features/homepage/components/AdvertisementBanner.js +15 -7
  630. package/dist/features/homepage/components/AnnouncementBar.js +2 -1
  631. package/dist/features/homepage/components/BeforeAfterCard.js +4 -4
  632. package/dist/features/homepage/components/BlogArticlesSection.js +2 -2
  633. package/dist/features/homepage/components/BrandsSection.js +5 -5
  634. package/dist/features/homepage/components/CTABannerSection.js +2 -2
  635. package/dist/features/homepage/components/CharacterHotspot.js +12 -12
  636. package/dist/features/homepage/components/CharacterHotspotForm.d.ts +7 -7
  637. package/dist/features/homepage/components/CharacterHotspotForm.js +39 -31
  638. package/dist/features/homepage/components/CollectionCardsSection.js +3 -1
  639. package/dist/features/homepage/components/CustomCardsSection.js +11 -10
  640. package/dist/features/homepage/components/CustomerReviewsSection.js +6 -4
  641. package/dist/features/homepage/components/EventsSection.js +2 -2
  642. package/dist/features/homepage/components/FAQSection.js +7 -6
  643. package/dist/features/homepage/components/FeaturedAuctionsSection.js +2 -2
  644. package/dist/features/homepage/components/FeaturedBundlesSection.js +5 -5
  645. package/dist/features/homepage/components/FeaturedPreOrdersSection.js +2 -2
  646. package/dist/features/homepage/components/FeaturedProductsSection.js +2 -2
  647. package/dist/features/homepage/components/FeaturedResultsSection.js +6 -5
  648. package/dist/features/homepage/components/FeaturedStoresSection.js +2 -2
  649. package/dist/features/homepage/components/GoogleReviewsSection.js +11 -11
  650. package/dist/features/homepage/components/HeroBanner.js +8 -8
  651. package/dist/features/homepage/components/HeroCarousel.js +44 -24
  652. package/dist/features/homepage/components/HeroSection.js +6 -2
  653. package/dist/features/homepage/components/HomepageSkeleton.js +5 -3
  654. package/dist/features/homepage/components/HowItWorksInfoView.d.ts +2 -2
  655. package/dist/features/homepage/components/HowItWorksInfoView.js +7 -5
  656. package/dist/features/homepage/components/HowItWorksSection.js +9 -5
  657. package/dist/features/homepage/components/MarketplaceHomepageView.js +8 -0
  658. package/dist/features/homepage/components/NewsletterBanner.js +11 -5
  659. package/dist/features/homepage/components/NewsletterSection.js +1 -1
  660. package/dist/features/homepage/components/PromoGrid.js +6 -4
  661. package/dist/features/homepage/components/SectionCarousel.js +12 -11
  662. package/dist/features/homepage/components/SecurityHighlightsSection.js +7 -5
  663. package/dist/features/homepage/components/ShopByCategorySection.js +11 -6
  664. package/dist/features/homepage/components/SiteFeaturesSection.js +3 -3
  665. package/dist/features/homepage/components/SocialFeedSection.js +7 -7
  666. package/dist/features/homepage/components/SocialPostCard.js +10 -8
  667. package/dist/features/homepage/components/StatsCounterSection.js +5 -3
  668. package/dist/features/homepage/components/TestimonialsCarousel.js +4 -4
  669. package/dist/features/homepage/components/TrustBadges.js +5 -3
  670. package/dist/features/homepage/components/TrustFeaturesSection.js +5 -7
  671. package/dist/features/homepage/components/TrustIndicatorsSection.js +3 -3
  672. package/dist/features/homepage/components/WelcomeSection.js +19 -4
  673. package/dist/features/homepage/components/WhatsAppCommunitySection.js +7 -5
  674. package/dist/features/homepage/constants/carousel-per-view.d.ts +56 -0
  675. package/dist/features/homepage/constants/carousel-per-view.js +22 -0
  676. package/dist/features/homepage/constants/hero-carousel-styles.d.ts +15 -0
  677. package/dist/features/homepage/constants/hero-carousel-styles.js +15 -0
  678. package/dist/features/homepage/hooks/useBlogArticles.d.ts +1 -1
  679. package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +2 -2
  680. package/dist/features/homepage/hooks/useFeaturedPreOrders.d.ts +2 -2
  681. package/dist/features/homepage/hooks/useFeaturedProducts.d.ts +1 -1
  682. package/dist/features/homepage/hooks/useFeaturedStores.d.ts +1 -1
  683. package/dist/features/homepage/hooks/useHeroCarousel.d.ts +1 -1
  684. package/dist/features/homepage/hooks/useHomepageEvents.d.ts +1 -1
  685. package/dist/features/homepage/hooks/useHomepageReviews.d.ts +1 -1
  686. package/dist/features/homepage/hooks/useHomepageSections.d.ts +1 -1
  687. package/dist/features/homepage/hooks/useTopBrands.d.ts +1 -1
  688. package/dist/features/homepage/hooks/useTopCategories.d.ts +1 -1
  689. package/dist/features/homepage/lib/social-feed-fetcher.js +8 -0
  690. package/dist/features/homepage/repository/carousel.repository.js +10 -0
  691. package/dist/features/homepage/repository/carousels.repository.js +6 -0
  692. package/dist/features/homepage/repository/homepage-sections.repository.d.ts +3 -2
  693. package/dist/features/homepage/repository/homepage-sections.repository.js +11 -0
  694. package/dist/features/homepage/schemas/index.d.ts +932 -0
  695. package/dist/features/homepage/schemas/index.js +164 -0
  696. package/dist/features/layout/AppLayoutShell.js +40 -27
  697. package/dist/features/layout/AutoBreadcrumbs.js +2 -2
  698. package/dist/features/layout/BottomActions.js +4 -4
  699. package/dist/features/layout/BottomNavItem.d.ts +6 -6
  700. package/dist/features/layout/BottomNavItem.js +7 -7
  701. package/dist/features/layout/BottomNavbar.js +12 -2
  702. package/dist/features/layout/BottomSheet.d.ts +1 -1
  703. package/dist/features/layout/BottomSheet.js +3 -3
  704. package/dist/features/layout/Breadcrumbs.js +2 -2
  705. package/dist/features/layout/FooterLayout.js +3 -3
  706. package/dist/features/layout/NavItem.js +1 -1
  707. package/dist/features/layout/NavbarLayout.js +3 -3
  708. package/dist/features/layout/SidebarLayout.js +1 -10
  709. package/dist/features/layout/TitleBarLayout.js +4 -4
  710. package/dist/features/live/components/LiveItemFilters.js +1 -1
  711. package/dist/features/live/components/LiveItemsIndexListing.js +2 -2
  712. package/dist/features/live/components/LiveItemsListView.js +1 -1
  713. package/dist/features/loyalty/api/admin/loyalty/grant/route.js +2 -0
  714. package/dist/features/loyalty/api/balance/route.js +2 -0
  715. package/dist/features/loyalty/api/earn/route.js +2 -0
  716. package/dist/features/loyalty/api/history/route.js +2 -0
  717. package/dist/features/loyalty/api/redeem/route.js +2 -0
  718. package/dist/features/loyalty/components/CoinsDisplay.js +4 -4
  719. package/dist/features/loyalty/hooks/useLoyaltyBalance.d.ts +1 -1
  720. package/dist/features/media/AvatarUpload.js +5 -2
  721. package/dist/features/media/MediaAudio.d.ts +22 -0
  722. package/dist/features/media/MediaAudio.js +15 -0
  723. package/dist/features/media/MediaAvatar.js +1 -1
  724. package/dist/features/media/MediaImage.d.ts +17 -1
  725. package/dist/features/media/MediaImage.js +30 -4
  726. package/dist/features/media/MediaLightbox.js +5 -5
  727. package/dist/features/media/MediaPickerModal.d.ts +3 -3
  728. package/dist/features/media/MediaPickerModal.js +7 -7
  729. package/dist/features/media/MediaVideo.d.ts +27 -1
  730. package/dist/features/media/MediaVideo.js +47 -5
  731. package/dist/features/media/finalize.js +3 -2
  732. package/dist/features/media/hooks/useMedia.d.ts +6 -5
  733. package/dist/features/media/modals/ImageCropModal.js +3 -3
  734. package/dist/features/media/modals/ImageEditor.js +5 -3
  735. package/dist/features/media/modals/VideoThumbnailSelector.js +4 -2
  736. package/dist/features/media/modals/VideoTrimModal.js +3 -1
  737. package/dist/features/media/upload/CameraCapture.js +2 -2
  738. package/dist/features/media/upload/ImageUpload.js +5 -3
  739. package/dist/features/media/upload/MediaUploadField.d.ts +14 -1
  740. package/dist/features/media/upload/MediaUploadField.js +53 -15
  741. package/dist/features/media/upload/MediaUploadList.js +5 -3
  742. package/dist/features/media/upload/video-poster.d.ts +48 -0
  743. package/dist/features/media/upload/video-poster.js +116 -0
  744. package/dist/features/media/upload/video-poster.test.d.ts +1 -0
  745. package/dist/features/media/upload/video-poster.test.js +42 -0
  746. package/dist/features/messages/actions/ping-rtdb.js +2 -0
  747. package/dist/features/messages/hooks/useConversation.js +2 -0
  748. package/dist/features/messages/hooks/useConversations.js +2 -0
  749. package/dist/features/messages/repository/conversations.repository.js +17 -15
  750. package/dist/features/messages/schemas/index.d.ts +177 -0
  751. package/dist/features/messages/schemas/index.js +35 -0
  752. package/dist/features/orders/api/track/[trackingId]/route.js +3 -0
  753. package/dist/features/orders/components/MarketplaceOrderCard.js +2 -2
  754. package/dist/features/orders/components/OrderSiblingPayments.js +2 -2
  755. package/dist/features/orders/components/OrdersList.js +6 -7
  756. package/dist/features/orders/components/RefundHistoryTable.js +4 -2
  757. package/dist/features/orders/components/RefundRequestView.js +5 -3
  758. package/dist/features/orders/hooks/useOrders.d.ts +2 -2
  759. package/dist/features/orders/repository/orders.repository.js +4 -0
  760. package/dist/features/orders/schemas/index.d.ts +677 -10
  761. package/dist/features/orders/schemas/index.js +148 -1
  762. package/dist/features/payments/hooks/usePayments.d.ts +1 -1
  763. package/dist/features/payments/repository/payout.repository.js +4 -3
  764. package/dist/features/payments/schemas/index.d.ts +252 -2
  765. package/dist/features/payments/schemas/index.js +48 -0
  766. package/dist/features/payments/types/index.d.ts +2 -1
  767. package/dist/features/pre-orders/api/[id]/route.js +4 -0
  768. package/dist/features/pre-orders/api/[slug]/route.js +2 -0
  769. package/dist/features/pre-orders/api/admin/[id]/route.js +3 -0
  770. package/dist/features/pre-orders/api/admin/route.js +2 -0
  771. package/dist/features/pre-orders/api/route.js +3 -0
  772. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +11 -8
  773. package/dist/features/pre-orders/components/PreOrderActionsClient.js +6 -3
  774. package/dist/features/pre-orders/components/PreOrderBadge.js +4 -2
  775. package/dist/features/pre-orders/components/PreOrderDetailPageView.js +11 -9
  776. package/dist/features/pre-orders/components/PreOrdersIndexListing.js +2 -2
  777. package/dist/features/pre-orders/components/PreOrdersListView.js +1 -1
  778. package/dist/features/pre-orders/components/PreorderCard.js +1 -1
  779. package/dist/features/pre-orders/hooks/usePreOrders.d.ts +2 -2
  780. package/dist/features/products/api/[id]/route.d.ts +1 -1
  781. package/dist/features/products/api/[id]/route.js +9 -6
  782. package/dist/features/products/api/route.js +6 -2
  783. package/dist/features/products/columns/index.d.ts +11 -11
  784. package/dist/features/products/columns/index.js +11 -11
  785. package/dist/features/products/columns/productTableColumns.js +7 -7
  786. package/dist/features/products/components/AuctionsIndexListing.js +2 -2
  787. package/dist/features/products/components/BidHistory.js +4 -4
  788. package/dist/features/products/components/CompareOverlay.js +6 -5
  789. package/dist/features/products/components/CustomFieldsEditor.js +2 -2
  790. package/dist/features/products/components/CustomSectionTabContent.js +3 -2
  791. package/dist/features/products/components/CustomSectionsEditor.js +3 -3
  792. package/dist/features/products/components/GroupSettingsPanel.js +13 -5
  793. package/dist/features/products/components/MakeOfferButton.js +10 -6
  794. package/dist/features/products/components/MakeOfferForm.js +2 -2
  795. package/dist/features/products/components/MarketplaceBundleCard.js +7 -8
  796. package/dist/features/products/components/MarketplacePrizeDrawCard.js +8 -7
  797. package/dist/features/products/components/NonRefundableConsentModal.js +2 -2
  798. package/dist/features/products/components/PlaceBidForm.js +2 -2
  799. package/dist/features/products/components/PrizeDrawCollage.js +20 -5
  800. package/dist/features/products/components/PrizeDrawDetailPageView.js +4 -2
  801. package/dist/features/products/components/PrizeDrawEntryActions.js +1 -1
  802. package/dist/features/products/components/PrizeDrawItemsEditor.js +9 -7
  803. package/dist/features/products/components/PrizeDrawsIndexListing.js +2 -2
  804. package/dist/features/products/components/PrizeDrawsListingView.js +1 -1
  805. package/dist/features/products/components/PrizeDrawsSection.js +3 -1
  806. package/dist/features/products/components/PrizeRevealModal.js +5 -3
  807. package/dist/features/products/components/ProductCardMetadataSection.js +1 -1
  808. package/dist/features/products/components/ProductDetailActions.js +3 -1
  809. package/dist/features/products/components/ProductDetailPageView.js +30 -26
  810. package/dist/features/products/components/ProductDetailView.d.ts +4 -2
  811. package/dist/features/products/components/ProductDetailView.js +1 -1
  812. package/dist/features/products/components/ProductFeatureBadges.js +11 -9
  813. package/dist/features/products/components/ProductFeaturesSelector.js +4 -3
  814. package/dist/features/products/components/ProductForm.js +25 -6
  815. package/dist/features/products/components/ProductGalleryClient.js +6 -5
  816. package/dist/features/products/components/ProductGradingTab.js +3 -2
  817. package/dist/features/products/components/ProductGrid.js +35 -30
  818. package/dist/features/products/components/ProductInfo.js +2 -2
  819. package/dist/features/products/components/ProductTabs.js +2 -1
  820. package/dist/features/products/components/ProductTabsShell.js +2 -2
  821. package/dist/features/products/components/ProductsIndexListing.js +2 -2
  822. package/dist/features/products/components/ProductsIndexPageView.js +1 -1
  823. package/dist/features/products/components/RelatedProducts.js +3 -3
  824. package/dist/features/products/components/RelatedProductsCarousel.js +2 -2
  825. package/dist/features/products/components/ShowGroupSection.js +10 -9
  826. package/dist/features/products/components/SublistingCarouselSection.js +6 -4
  827. package/dist/features/products/components/SublistingCategorySelect.js +1 -1
  828. package/dist/features/products/hooks/useProductDetail.d.ts +1 -1
  829. package/dist/features/products/hooks/useRelatedProducts.d.ts +1 -1
  830. package/dist/features/products/repository/product-features.repository.d.ts +1 -1
  831. package/dist/features/products/repository/product-features.repository.js +6 -1
  832. package/dist/features/products/repository/products.repository.js +3 -0
  833. package/dist/features/products/schemas/index.d.ts +10 -10
  834. package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
  835. package/dist/features/products/utils/listing-badge-variant.d.ts +10 -0
  836. package/dist/features/products/utils/listing-badge-variant.js +15 -0
  837. package/dist/features/products/utils/sanitize.d.ts +2 -2
  838. package/dist/features/products/utils/sanitize.js +0 -9
  839. package/dist/features/promotions/api/route.js +2 -0
  840. package/dist/features/promotions/components/CouponCard.d.ts +2 -1
  841. package/dist/features/promotions/components/CouponCard.js +10 -9
  842. package/dist/features/promotions/components/CouponsIndexListing.js +3 -3
  843. package/dist/features/promotions/components/PromotionsView.js +5 -5
  844. package/dist/features/promotions/hooks/useCouponValidate.d.ts +2 -1
  845. package/dist/features/promotions/hooks/usePromotions.d.ts +2 -2
  846. package/dist/features/promotions/repository/claimed-coupons.repository.js +5 -0
  847. package/dist/features/promotions/repository/coupons.repository.d.ts +9 -8
  848. package/dist/features/promotions/repository/coupons.repository.js +24 -9
  849. package/dist/features/promotions/schemas/index.d.ts +726 -10
  850. package/dist/features/promotions/schemas/index.js +111 -1
  851. package/dist/features/reviews/api/[id]/route.d.ts +1 -1
  852. package/dist/features/reviews/api/[id]/route.js +3 -1
  853. package/dist/features/reviews/api/route.js +3 -0
  854. package/dist/features/reviews/components/ReviewDetailPageView.js +2 -2
  855. package/dist/features/reviews/components/ReviewDetailShell.js +13 -9
  856. package/dist/features/reviews/components/ReviewModal.js +5 -5
  857. package/dist/features/reviews/components/ReviewSummary.js +8 -6
  858. package/dist/features/reviews/components/ReviewsIndexListing.js +3 -2
  859. package/dist/features/reviews/components/ReviewsIndexPageView.js +1 -1
  860. package/dist/features/reviews/components/ReviewsList.js +8 -7
  861. package/dist/features/reviews/hooks/useReviews.d.ts +2 -2
  862. package/dist/features/reviews/repository/reviews.repository.d.ts +1 -0
  863. package/dist/features/reviews/repository/reviews.repository.js +13 -0
  864. package/dist/features/reviews/schemas/index.d.ts +194 -0
  865. package/dist/features/reviews/schemas/index.js +41 -0
  866. package/dist/features/scams/components/ScamAwarenessModal.js +4 -3
  867. package/dist/features/scams/components/ScamProfileView.js +12 -9
  868. package/dist/features/scams/components/ScamRegistryView.js +7 -7
  869. package/dist/features/scams/repository/scammer.repository.js +5 -0
  870. package/dist/features/scams/schemas/index.d.ts +375 -0
  871. package/dist/features/scams/schemas/index.js +139 -0
  872. package/dist/features/search/api/route.js +2 -0
  873. package/dist/features/search/components/Search.js +15 -11
  874. package/dist/features/search/components/SearchFiltersRow.js +5 -3
  875. package/dist/features/search/components/SearchResultsSection.js +6 -6
  876. package/dist/features/search/components/SearchView.js +3 -3
  877. package/dist/features/search/hooks/useNavSuggestions.js +2 -0
  878. package/dist/features/search/hooks/useSearch.d.ts +2 -2
  879. package/dist/features/search/schemas/index.d.ts +2 -2
  880. package/dist/features/seller/actions/seller-actions.d.ts +3 -2
  881. package/dist/features/seller/actions/seller-actions.js +2 -1
  882. package/dist/features/seller/components/PhysicalLocationModal.js +2 -0
  883. package/dist/features/seller/components/PrintCenterView.js +2 -2
  884. package/dist/features/seller/components/QuickProductForm.js +3 -2
  885. package/dist/features/seller/components/SellerAddressesView.js +14 -6
  886. package/dist/features/seller/components/SellerAnalyticsAlertsView.js +12 -8
  887. package/dist/features/seller/components/SellerAnalyticsView.js +1 -1
  888. package/dist/features/seller/components/SellerBidsView.js +10 -8
  889. package/dist/features/seller/components/SellerBundlesView.js +7 -8
  890. package/dist/features/seller/components/SellerClassifiedView.js +7 -11
  891. package/dist/features/seller/components/SellerCouponEditorView.js +7 -5
  892. package/dist/features/seller/components/SellerCouponsView.js +5 -3
  893. package/dist/features/seller/components/SellerDashboardView.js +2 -2
  894. package/dist/features/seller/components/SellerDigitalCodesView.js +8 -10
  895. package/dist/features/seller/components/SellerFeaturesView.js +5 -2
  896. package/dist/features/seller/components/SellerGoogleReviewsView.js +6 -3
  897. package/dist/features/seller/components/SellerGroupedListingsView.js +6 -6
  898. package/dist/features/seller/components/SellerLiveView.js +9 -11
  899. package/dist/features/seller/components/SellerOffersPanel.js +7 -3
  900. package/dist/features/seller/components/SellerOrdersView.js +18 -9
  901. package/dist/features/seller/components/SellerPayoutMethodsView.js +6 -6
  902. package/dist/features/seller/components/SellerPayoutRequestView.js +5 -3
  903. package/dist/features/seller/components/SellerPayoutSettingsView.js +7 -5
  904. package/dist/features/seller/components/SellerPreOrdersView.js +6 -6
  905. package/dist/features/seller/components/SellerPrizeDrawsView.js +6 -6
  906. package/dist/features/seller/components/SellerProductShell.js +20 -5
  907. package/dist/features/seller/components/SellerProductsCards.js +14 -5
  908. package/dist/features/seller/components/SellerProductsFilterDrawer.js +3 -4
  909. package/dist/features/seller/components/SellerProductsView.js +15 -11
  910. package/dist/features/seller/components/SellerReviewsView.js +10 -5
  911. package/dist/features/seller/components/SellerShippingConfigsView.js +11 -9
  912. package/dist/features/seller/components/SellerShippingView.js +5 -3
  913. package/dist/features/seller/components/SellerSidebar.js +12 -12
  914. package/dist/features/seller/components/SellerStoreCategoriesView.js +6 -7
  915. package/dist/features/seller/components/SellerStoreSetupView.js +1 -1
  916. package/dist/features/seller/components/SellerStorefrontView.js +1 -1
  917. package/dist/features/seller/components/SellerTemplatesView.d.ts +2 -1
  918. package/dist/features/seller/components/SellerTemplatesView.js +10 -7
  919. package/dist/features/seller/components/analytics/SellerAnalyticsStats.js +1 -1
  920. package/dist/features/seller/components/analytics/SellerRevenueChart.js +4 -2
  921. package/dist/features/seller/components/analytics/SellerTopProducts.js +4 -2
  922. package/dist/features/seller/hooks/useSellerListingData.d.ts +2 -1
  923. package/dist/features/seller/hooks/useSellerListingData.js +5 -0
  924. package/dist/features/seller/hooks/useSellerPayouts.d.ts +3 -3
  925. package/dist/features/seller/hooks/useSellerStore.d.ts +6 -6
  926. package/dist/features/seller/hooks/useSellerStorefront.d.ts +2 -2
  927. package/dist/features/seller/repository/offer.repository.js +1 -0
  928. package/dist/features/seller/schemas/index.d.ts +4 -4
  929. package/dist/features/server-errors/repository/server-errors.repository.d.ts +19 -0
  930. package/dist/features/server-errors/repository/server-errors.repository.js +80 -0
  931. package/dist/features/server-errors/schemas/firestore.d.ts +42 -0
  932. package/dist/features/server-errors/schemas/firestore.js +18 -0
  933. package/dist/features/server-errors/schemas/index.d.ts +47 -0
  934. package/dist/features/server-errors/schemas/index.js +22 -0
  935. package/dist/features/shell/FormShell.d.ts +7 -1
  936. package/dist/features/shell/FormShell.js +14 -7
  937. package/dist/features/shell/QuickFormDrawer.d.ts +14 -5
  938. package/dist/features/shell/QuickFormDrawer.js +25 -7
  939. package/dist/features/shell/StepForm.d.ts +4 -3
  940. package/dist/features/shell/StepForm.js +10 -8
  941. package/dist/features/site-settings/components/ActionPermissionsManager.js +11 -11
  942. package/dist/features/site-settings/components/NavPermissionsManager.js +5 -3
  943. package/dist/features/site-settings/components/ThemeManagerView.d.ts +17 -0
  944. package/dist/features/site-settings/components/ThemeManagerView.js +169 -0
  945. package/dist/features/site-settings/components/__tests__/ThemeManagerView.test.d.ts +1 -0
  946. package/dist/features/site-settings/components/__tests__/ThemeManagerView.test.js +37 -0
  947. package/dist/features/store-extensions/schemas/firestore.d.ts +3 -2
  948. package/dist/features/store-extensions/schemas/firestore.js +0 -20
  949. package/dist/features/stores/api/[storeSlug]/auctions/route.js +2 -0
  950. package/dist/features/stores/api/[storeSlug]/products/route.js +2 -0
  951. package/dist/features/stores/api/[storeSlug]/reviews/route.js +3 -0
  952. package/dist/features/stores/api/[storeSlug]/route.d.ts +1 -1
  953. package/dist/features/stores/api/[storeSlug]/route.js +3 -1
  954. package/dist/features/stores/api/route.js +2 -0
  955. package/dist/features/stores/components/InteractiveStoreCard.js +3 -4
  956. package/dist/features/stores/components/StoreAboutView.js +6 -5
  957. package/dist/features/stores/components/StoreAuctionsListing.js +3 -3
  958. package/dist/features/stores/components/StoreCapabilitiesGuideView.js +8 -8
  959. package/dist/features/stores/components/StoreDetailLayoutView.js +2 -2
  960. package/dist/features/stores/components/StoreFinanceGuideView.js +8 -7
  961. package/dist/features/stores/components/StoreGuideHubView.js +7 -7
  962. package/dist/features/stores/components/StoreHeader.js +9 -7
  963. package/dist/features/stores/components/StoreListingsGuideView.js +16 -15
  964. package/dist/features/stores/components/StoreNavTabs.js +1 -1
  965. package/dist/features/stores/components/StoreOrdersGuideView.js +14 -14
  966. package/dist/features/stores/components/StorePreOrdersListing.js +3 -3
  967. package/dist/features/stores/components/StoreProductsListing.js +3 -3
  968. package/dist/features/stores/components/StoreProductsView.js +1 -1
  969. package/dist/features/stores/components/StoreReviewsListing.js +3 -2
  970. package/dist/features/stores/components/StoreScopedSearch.js +3 -1
  971. package/dist/features/stores/components/StoreSettingsGuideView.js +9 -8
  972. package/dist/features/stores/components/StoresIndexListing.js +4 -3
  973. package/dist/features/stores/components/StoresIndexPageView.js +1 -1
  974. package/dist/features/stores/hooks/useStoreAddressSelector.d.ts +1 -1
  975. package/dist/features/stores/hooks/useStores.d.ts +6 -6
  976. package/dist/features/stores/repository/store.repository.js +3 -2
  977. package/dist/features/stores/schemas/index.d.ts +570 -0
  978. package/dist/features/stores/schemas/index.js +98 -0
  979. package/dist/features/support/repository/support.repository.js +4 -0
  980. package/dist/features/support/schemas/index.d.ts +238 -0
  981. package/dist/features/support/schemas/index.js +64 -0
  982. package/dist/features/whatsapp-bot/api/send-status/route.js +2 -0
  983. package/dist/features/whatsapp-bot/api/webhook/route.js +2 -0
  984. package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +12 -13
  985. package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +1 -1
  986. package/dist/features/whatsapp-bot/helpers/whatsapp.js +2 -0
  987. package/dist/features/wishlist/components/WishlistPage.js +6 -7
  988. package/dist/features/wishlist/components/WishlistToggleButton.js +11 -9
  989. package/dist/features/wishlist/components/WishlistView.js +2 -2
  990. package/dist/features/wishlist/hooks/useUserWishlist.d.ts +17 -16
  991. package/dist/features/wishlist/hooks/useWishlist.d.ts +1 -1
  992. package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
  993. package/dist/features/wishlist/repository/user-wishlist.repository.js +2 -0
  994. package/dist/http/ApiClient.d.ts +8 -7
  995. package/dist/http/ApiClient.js +12 -4
  996. package/dist/index.d.ts +50 -3
  997. package/dist/index.js +77 -5
  998. package/dist/instrumentation/index.d.ts +3 -3
  999. package/dist/instrumentation/index.js +3 -3
  1000. package/dist/jobs.d.ts +2 -0
  1001. package/dist/jobs.js +5 -0
  1002. package/dist/monitoring/analytics.d.ts +3 -2
  1003. package/dist/monitoring/analytics.js +5 -0
  1004. package/dist/monitoring/client-logger.d.ts +3 -2
  1005. package/dist/monitoring/client-logger.js +31 -11
  1006. package/dist/monitoring/error-tracking.d.ts +2 -1
  1007. package/dist/monitoring/error-tracking.js +1 -0
  1008. package/dist/monitoring/performance.js +1 -0
  1009. package/dist/monitoring/server-logger.d.ts +2 -1
  1010. package/dist/monitoring/server-logger.js +53 -28
  1011. package/dist/next/ErrorBoundary.js +1 -2
  1012. package/dist/next/IAuthVerifier.d.ts +6 -5
  1013. package/dist/next/IAuthVerifier.js +0 -22
  1014. package/dist/next/api/api-response.d.ts +4 -3
  1015. package/dist/next/api/api-response.js +4 -1
  1016. package/dist/next/api/apiHandler.js +7 -1
  1017. package/dist/next/api/errorHandler.d.ts +6 -6
  1018. package/dist/next/api/errorHandler.js +9 -6
  1019. package/dist/next/api/parseJsonBody.d.ts +16 -0
  1020. package/dist/next/api/parseJsonBody.js +36 -0
  1021. package/dist/next/api/routeHandler.d.ts +24 -41
  1022. package/dist/next/api/routeHandler.js +157 -44
  1023. package/dist/next/cache-middleware.d.ts +2 -2
  1024. package/dist/next/cache-middleware.js +5 -3
  1025. package/dist/next/components/ErrorView.js +3 -3
  1026. package/dist/next/components/GlobalError.js +3 -3
  1027. package/dist/next/components/NotFoundView.js +2 -19
  1028. package/dist/next/components/UnauthorizedView.js +2 -15
  1029. package/dist/next/middleware/chain.d.ts +5 -5
  1030. package/dist/next/middleware/chain.js +8 -5
  1031. package/dist/next/middleware/pii-redactor.d.ts +4 -4
  1032. package/dist/next/middleware/pii-redactor.js +4 -4
  1033. package/dist/next/middleware/pii-scrubber.js +2 -0
  1034. package/dist/providers/auth-firebase/browser-stub.js +0 -1
  1035. package/dist/providers/auth-firebase/helpers.js +3 -6
  1036. package/dist/providers/auth-firebase/provider.js +2 -1
  1037. package/dist/providers/auth-firebase/session.js +1 -1
  1038. package/dist/providers/db-firebase/admin-app-lite.js +0 -3
  1039. package/dist/providers/db-firebase/admin.js +1 -4
  1040. package/dist/providers/db-firebase/base.d.ts +1 -1
  1041. package/dist/providers/db-firebase/base.js +5 -1
  1042. package/dist/providers/db-firebase/base.repository.d.ts +6 -5
  1043. package/dist/providers/db-firebase/base.repository.js +14 -0
  1044. package/dist/providers/db-firebase/browser-stub.js +0 -1
  1045. package/dist/providers/db-firebase/field-ops.js +2 -0
  1046. package/dist/providers/db-firebase/helpers.d.ts +2 -2
  1047. package/dist/providers/db-firebase/helpers.js +7 -2
  1048. package/dist/providers/db-firebase/index.d.ts +1 -1
  1049. package/dist/providers/db-firebase/index.js +1 -1
  1050. package/dist/providers/db-firebase/realtime.d.ts +1 -1
  1051. package/dist/providers/db-firebase/realtime.js +16 -4
  1052. package/dist/providers/db-firebase/sieve.d.ts +5 -5
  1053. package/dist/providers/db-firebase/sieve.js +13 -7
  1054. package/dist/providers/email-resend/provider.d.ts +3 -3
  1055. package/dist/providers/email-resend/provider.js +3 -3
  1056. package/dist/providers/payment-razorpay/index.d.ts +7 -6
  1057. package/dist/providers/payment-razorpay/index.js +8 -5
  1058. package/dist/providers/shipping-shiprocket/index.d.ts +3 -3
  1059. package/dist/providers/shipping-shiprocket/index.js +4 -3
  1060. package/dist/providers/storage-firebase/client.js +9 -0
  1061. package/dist/providers/storage-firebase/index.d.ts +1 -1
  1062. package/dist/providers/storage-firebase/index.js +1 -1
  1063. package/dist/providers/storage-firebase/provider.d.ts +3 -3
  1064. package/dist/providers/storage-firebase/provider.js +3 -3
  1065. package/dist/react/contexts/SessionContext.d.ts +4 -3
  1066. package/dist/react/contexts/SessionContext.js +6 -0
  1067. package/dist/react/contexts/index.d.ts +0 -2
  1068. package/dist/react/contexts/index.js +2 -1
  1069. package/dist/react/hooks/use-action-dispatch.d.ts +2 -1
  1070. package/dist/react/hooks/use-action-dispatch.js +2 -0
  1071. package/dist/react/hooks/useBreakpoint.d.ts +1 -1
  1072. package/dist/react/hooks/useBreakpoint.js +1 -1
  1073. package/dist/react/hooks/useBulkAction.d.ts +4 -4
  1074. package/dist/react/hooks/useBulkAction.js +2 -0
  1075. package/dist/react/hooks/useCamera.js +2 -0
  1076. package/dist/react/hooks/useClickOutside.d.ts +3 -3
  1077. package/dist/react/hooks/useClickOutside.js +3 -3
  1078. package/dist/react/hooks/useContainerGrid.d.ts +5 -5
  1079. package/dist/react/hooks/useContainerGrid.js +5 -5
  1080. package/dist/react/hooks/useCountdown.js +1 -0
  1081. package/dist/react/hooks/useEntityDelete.js +2 -0
  1082. package/dist/react/hooks/useFormStatePreservation.d.ts +2 -1
  1083. package/dist/react/hooks/useGesture.d.ts +3 -3
  1084. package/dist/react/hooks/useGesture.js +3 -3
  1085. package/dist/react/hooks/useInlineRowEdit.js +3 -0
  1086. package/dist/react/hooks/useKeyPress.d.ts +2 -2
  1087. package/dist/react/hooks/useKeyPress.js +2 -2
  1088. package/dist/react/hooks/usePendingFilters.d.ts +10 -10
  1089. package/dist/react/hooks/usePendingFilters.js +10 -10
  1090. package/dist/react/hooks/usePendingTable.d.ts +1 -1
  1091. package/dist/react/hooks/usePendingTable.js +1 -1
  1092. package/dist/react/hooks/usePullToRefresh.d.ts +5 -5
  1093. package/dist/react/hooks/usePullToRefresh.js +5 -5
  1094. package/dist/react/hooks/useRealtimeEvent.d.ts +2 -1
  1095. package/dist/react/hooks/useRealtimeEvent.js +2 -0
  1096. package/dist/react/hooks/useSwipe.d.ts +3 -3
  1097. package/dist/react/hooks/useSwipe.js +3 -3
  1098. package/dist/react/hooks/useUrlTable.js +2 -2
  1099. package/dist/react/index.d.ts +0 -2
  1100. package/dist/react/index.js +2 -2
  1101. package/dist/react/useModalStack.d.ts +1 -1
  1102. package/dist/react/useModalStack.js +1 -1
  1103. package/dist/schemas/api-routes.d.ts +7 -0
  1104. package/dist/schemas/api-routes.js +66 -0
  1105. package/dist/schemas/firestore-helpers.d.ts +35 -0
  1106. package/dist/schemas/firestore-helpers.js +29 -0
  1107. package/dist/schemas/index.d.ts +3 -0
  1108. package/dist/schemas/index.js +6 -0
  1109. package/dist/schemas/registry.d.ts +6719 -0
  1110. package/dist/schemas/registry.js +174 -0
  1111. package/dist/schemas/sieve.d.ts +45 -0
  1112. package/dist/schemas/sieve.js +55 -0
  1113. package/dist/schemas/types.d.ts +61 -0
  1114. package/dist/schemas/types.js +10 -0
  1115. package/dist/schemas/webhooks/google-oauth.d.ts +83 -0
  1116. package/dist/schemas/webhooks/google-oauth.js +39 -0
  1117. package/dist/schemas/webhooks/razorpay.d.ts +2634 -0
  1118. package/dist/schemas/webhooks/razorpay.js +104 -0
  1119. package/dist/schemas/webhooks/shiprocket.d.ts +30 -0
  1120. package/dist/schemas/webhooks/shiprocket.js +22 -0
  1121. package/dist/security/authorization.d.ts +5 -4
  1122. package/dist/security/authorization.js +1 -0
  1123. package/dist/security/csp.d.ts +1 -1
  1124. package/dist/security/csp.js +1 -1
  1125. package/dist/security/pii-encrypt.d.ts +9 -9
  1126. package/dist/security/pii-encrypt.js +15 -10
  1127. package/dist/security/pii-redact.js +3 -0
  1128. package/dist/security/rate-limit.d.ts +4 -0
  1129. package/dist/security/rate-limit.js +1 -0
  1130. package/dist/security/settings-encryption.js +0 -2
  1131. package/dist/seed/cart-seed-data.js +1 -1
  1132. package/dist/seed/categories-seed-data.js +145 -201
  1133. package/dist/seed/factories/homepage-section.factory.d.ts +2 -1
  1134. package/dist/seed/grouped-listings-seed-data.js +2 -2
  1135. package/dist/seed/index.js +0 -2
  1136. package/dist/seed/manifest.js +6 -1
  1137. package/dist/seed/products-prize-draws-seed-data.js +38 -37
  1138. package/dist/seed/products-standard-seed-data.js +5 -122
  1139. package/dist/seed/runner.js +2 -0
  1140. package/dist/seed/stores-seed-data.js +0 -29
  1141. package/dist/seed/test-utils.d.ts +4 -3
  1142. package/dist/seed/test-utils.js +2 -2
  1143. package/dist/seed/users-seed-data.js +0 -30
  1144. package/dist/seo/json-ld.d.ts +20 -11
  1145. package/dist/seo/json-ld.js +2 -2
  1146. package/dist/server.d.ts +15 -0
  1147. package/dist/server.js +29 -0
  1148. package/dist/stores/panel-store.d.ts +3 -2
  1149. package/dist/styles.css +258 -7
  1150. package/dist/tailwind-utilities.css +1 -1
  1151. package/dist/theme/index.d.ts +14 -0
  1152. package/dist/theme/index.js +12 -0
  1153. package/dist/tokens/index.d.ts +2 -534
  1154. package/dist/tokens/index.js +16 -109
  1155. package/dist/tokens/themes/default-dark.d.ts +10 -0
  1156. package/dist/tokens/themes/default-dark.js +84 -0
  1157. package/dist/tokens/themes/default-light.d.ts +10 -0
  1158. package/dist/tokens/themes/default-light.js +87 -0
  1159. package/dist/tokens/themes/index.d.ts +15 -0
  1160. package/dist/tokens/themes/index.js +17 -0
  1161. package/dist/tokens/themes/required.d.ts +15 -0
  1162. package/dist/tokens/themes/required.js +89 -0
  1163. package/dist/tokens/themes/types.d.ts +37 -0
  1164. package/dist/tokens/themes/types.js +1 -0
  1165. package/dist/tokens/tokens.css +108 -6
  1166. package/dist/ui/DataTable.js +5 -5
  1167. package/dist/ui/components/Anchor.d.ts +40 -0
  1168. package/dist/ui/components/Anchor.js +40 -0
  1169. package/dist/ui/components/Badge.d.ts +5 -1
  1170. package/dist/ui/components/Badge.js +7 -2
  1171. package/dist/ui/components/BaseListingCard.js +2 -1
  1172. package/dist/ui/components/Button.d.ts +25 -1
  1173. package/dist/ui/components/Button.js +100 -8
  1174. package/dist/ui/components/Card.d.ts +5 -2
  1175. package/dist/ui/components/Card.js +13 -1
  1176. package/dist/ui/components/Card.style.css +33 -0
  1177. package/dist/ui/components/ConfirmDeleteModal.d.ts +5 -5
  1178. package/dist/ui/components/ConfirmDeleteModal.js +5 -5
  1179. package/dist/ui/components/DescriptionField.d.ts +2 -2
  1180. package/dist/ui/components/DescriptionField.js +2 -2
  1181. package/dist/ui/components/DetailViewShell.d.ts +4 -2
  1182. package/dist/ui/components/DetailViewShell.js +1 -1
  1183. package/dist/ui/components/Details.d.ts +29 -0
  1184. package/dist/ui/components/Details.js +28 -0
  1185. package/dist/ui/components/Dialog.d.ts +26 -0
  1186. package/dist/ui/components/Dialog.js +42 -0
  1187. package/dist/ui/components/Div.d.ts +24 -0
  1188. package/dist/ui/components/Div.js +82 -1
  1189. package/dist/ui/components/FallbackShell.d.ts +31 -0
  1190. package/dist/ui/components/FallbackShell.js +71 -0
  1191. package/dist/ui/components/Fieldset.d.ts +19 -0
  1192. package/dist/ui/components/Fieldset.js +26 -0
  1193. package/dist/ui/components/FilterChipGroup.d.ts +4 -4
  1194. package/dist/ui/components/FlowDiagram.js +6 -2
  1195. package/dist/ui/components/Form.d.ts +37 -4
  1196. package/dist/ui/components/Form.js +38 -3
  1197. package/dist/ui/components/FormGrid.d.ts +3 -3
  1198. package/dist/ui/components/FormGrid.js +3 -3
  1199. package/dist/ui/components/HorizontalRule.d.ts +21 -0
  1200. package/dist/ui/components/HorizontalRule.js +21 -0
  1201. package/dist/ui/components/HotspotMarker.d.ts +34 -0
  1202. package/dist/ui/components/HotspotMarker.js +80 -0
  1203. package/dist/ui/components/IconBox.d.ts +21 -0
  1204. package/dist/ui/components/IconBox.js +32 -0
  1205. package/dist/ui/components/IconButton.d.ts +1 -1
  1206. package/dist/ui/components/IconButton.js +1 -1
  1207. package/dist/ui/components/Iframe.d.ts +21 -0
  1208. package/dist/ui/components/Iframe.js +21 -0
  1209. package/dist/ui/components/ImageGallery.js +10 -2
  1210. package/dist/ui/components/ImageLightbox.js +4 -2
  1211. package/dist/ui/components/Input.js +2 -2
  1212. package/dist/ui/components/Kbd.d.ts +10 -0
  1213. package/dist/ui/components/Kbd.js +17 -0
  1214. package/dist/ui/components/Layout.d.ts +88 -18
  1215. package/dist/ui/components/Layout.js +80 -8
  1216. package/dist/ui/components/Layout.style.css +50 -0
  1217. package/dist/ui/components/ListingToolbar.js +3 -3
  1218. package/dist/ui/components/Motion.js +3 -1
  1219. package/dist/ui/components/NavbarChevron.d.ts +5 -0
  1220. package/dist/ui/components/NavbarChevron.js +20 -0
  1221. package/dist/ui/components/PaginatedSelect.d.ts +5 -2
  1222. package/dist/ui/components/PaginatedSelect.js +2 -2
  1223. package/dist/ui/components/PasswordStrengthIndicator.js +4 -4
  1224. package/dist/ui/components/Quote.d.ts +11 -0
  1225. package/dist/ui/components/Quote.js +18 -0
  1226. package/dist/ui/components/Responsive.d.ts +26 -0
  1227. package/dist/ui/components/Responsive.js +79 -0
  1228. package/dist/ui/components/Scrim.d.ts +25 -0
  1229. package/dist/ui/components/Scrim.js +27 -0
  1230. package/dist/ui/components/Semantic.d.ts +170 -29
  1231. package/dist/ui/components/Semantic.js +398 -31
  1232. package/dist/ui/components/SideDrawer.d.ts +1 -1
  1233. package/dist/ui/components/SideDrawer.js +1 -1
  1234. package/dist/ui/components/SideModal.js +1 -1
  1235. package/dist/ui/components/SiteLogo.d.ts +20 -19
  1236. package/dist/ui/components/SiteLogo.js +46 -16
  1237. package/dist/ui/components/SlottedListingView.js +1 -1
  1238. package/dist/ui/components/StackedViewShell.js +1 -1
  1239. package/dist/ui/components/StickyToolbar.d.ts +29 -0
  1240. package/dist/ui/components/StickyToolbar.js +34 -0
  1241. package/dist/ui/components/TabStrip.d.ts +7 -7
  1242. package/dist/ui/components/TabStrip.js +7 -7
  1243. package/dist/ui/components/TextLink.d.ts +19 -1
  1244. package/dist/ui/components/TextLink.js +47 -2
  1245. package/dist/ui/components/Textarea.js +1 -1
  1246. package/dist/ui/components/Toast.d.ts +15 -2
  1247. package/dist/ui/components/Toast.js +29 -5
  1248. package/dist/ui/components/Tooltip.d.ts +1 -1
  1249. package/dist/ui/components/Tooltip.js +5 -2
  1250. package/dist/ui/components/Typography.d.ts +119 -10
  1251. package/dist/ui/components/Typography.js +209 -7
  1252. package/dist/ui/components/Typography.style.css +66 -0
  1253. package/dist/ui/components/UnsavedChangesModal.js +3 -1
  1254. package/dist/ui/components/__tests__/new-primitives.test.d.ts +1 -0
  1255. package/dist/ui/components/__tests__/new-primitives.test.js +187 -0
  1256. package/dist/ui/components/surface-tokens.d.ts +166 -10
  1257. package/dist/ui/components/surface-tokens.js +170 -10
  1258. package/dist/ui/forms/ColorPickerField.d.ts +21 -0
  1259. package/dist/ui/forms/ColorPickerField.js +36 -0
  1260. package/dist/ui/forms/FieldTextarea.d.ts +13 -0
  1261. package/dist/ui/forms/FieldTextarea.js +25 -0
  1262. package/dist/ui/forms/FormShell.d.ts +28 -6
  1263. package/dist/ui/forms/FormShell.js +32 -2
  1264. package/dist/ui/forms/FormShell.style.css +7 -0
  1265. package/dist/ui/forms/index.d.ts +5 -1
  1266. package/dist/ui/forms/index.js +3 -1
  1267. package/dist/ui/index.d.ts +8 -0
  1268. package/dist/ui/index.js +5 -0
  1269. package/dist/ui/rich-text/RichText.d.ts +8 -8
  1270. package/dist/ui/rich-text/RichText.js +1 -0
  1271. package/dist/utils/action-response.js +1 -0
  1272. package/dist/utils/action-result.d.ts +11 -0
  1273. package/dist/utils/action-result.js +10 -0
  1274. package/dist/utils/auth-error.d.ts +1 -8
  1275. package/dist/utils/auth-error.js +5 -20
  1276. package/dist/utils/date.formatter.js +1 -0
  1277. package/dist/utils/event-manager.js +0 -2
  1278. package/dist/utils/filter.helper.d.ts +3 -3
  1279. package/dist/utils/filter.helper.js +3 -3
  1280. package/dist/utils/media-url.d.ts +9 -0
  1281. package/dist/utils/media-url.js +9 -1
  1282. package/dist/utils/object.helper.d.ts +5 -5
  1283. package/dist/utils/object.helper.js +2 -0
  1284. package/dist/utils/schema-ui.d.ts +2 -2
  1285. package/dist/utils/schema-ui.js +3 -35
  1286. package/dist/utils/type.converter.d.ts +2 -1
  1287. package/dist/validation/input.validator.js +1 -0
  1288. package/dist/validation/schemas.js +6 -3
  1289. package/package.json +4 -3
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { normalizeError } from "../../../../errors/normalize";
3
4
  import { useState } from "react";
4
5
  import Link from "next/link";
5
6
  import { Badge, Button, Container, Div, Heading, Row, Section, Stack, Text, } from "../../../../ui";
@@ -16,7 +17,7 @@ export function ClassifiedDetailView({ product, isLoading = false, onContactSell
16
17
  const [conversation, setConversation] = useState(null);
17
18
  const [error, setError] = useState(null);
18
19
  if (isLoading || !product) {
19
- return (_jsx(Container, { children: _jsx(Div, { className: "py-16 text-center", children: _jsx(Text, { className: "text-muted-foreground", children: isLoading ? "Loading…" : "Classified listing not found." }) }) }));
20
+ return (_jsx(Container, { children: _jsx(Div, { className: "text-center", padding: "y-4xl", children: _jsx(Text, { className: "text-muted-foreground", children: isLoading ? "Loading…" : "Classified listing not found." }) }) }));
20
21
  }
21
22
  const meta = product.classified;
22
23
  const price = formatCurrency(product.price, product.currency ?? "INR");
@@ -27,15 +28,27 @@ export function ClassifiedDetailView({ product, isLoading = false, onContactSell
27
28
  setPending(true);
28
29
  setError(null);
29
30
  try {
30
- const conv = await onContactSeller({ productId: product.id });
31
- setConversation(conv);
31
+ const result = await onContactSeller({ productId: product.id });
32
+ // ActionResult envelope — unwrap or surface
33
+ if (result && typeof result === "object" && "ok" in result) {
34
+ if (result.ok) {
35
+ setConversation(result.data);
36
+ }
37
+ else {
38
+ setError(result.error);
39
+ }
40
+ }
41
+ else {
42
+ setConversation(result);
43
+ }
32
44
  }
33
45
  catch (e) {
46
+ void normalizeError(e);
34
47
  setError(e instanceof Error ? e.message : "Something went wrong");
35
48
  }
36
49
  finally {
37
50
  setPending(false);
38
51
  }
39
52
  }
40
- return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: `${__O.hidden} rounded-lg bg-muted`, children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Classified" }), meta?.negotiable && _jsx(Badge, { variant: "secondary", children: "Negotiable" }), meta?.acceptsShipping && _jsx(Badge, { variant: "secondary", children: "Shipping available" })] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), location && (_jsx(Text, { className: "text-sm text-muted-foreground", children: location })), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), conversation ? (_jsxs(Div, { className: `rounded-lg border border-border bg-muted/40 ${__P.p4}`, children: [_jsx(Text, { className: "mb-2 font-medium", children: "Conversation started!" }), _jsx(Link, { href: ROUTES.USER.MESSAGES, className: "text-primary underline underline-offset-2", children: "Go to your messages \u2192" })] })) : (_jsxs(Stack, { gap: "sm", children: [error && (_jsx(Text, { className: "text-sm text-destructive", children: error })), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleContactSeller, className: "w-full", children: "Contact Seller" })] }))] }) }) }));
53
+ return (_jsx(Container, { children: _jsx(Section, { padding: "y-xl", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: `${__O.hidden} bg-muted`, rounded: "lg", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { gap: "sm", wrap: true, children: [_jsx(Badge, { variant: "secondary", children: "Classified" }), meta?.negotiable && _jsx(Badge, { variant: "secondary", children: "Negotiable" }), meta?.acceptsShipping && _jsx(Badge, { variant: "secondary", children: "Shipping available" })] }), _jsx(Heading, { level: 1, weight: "bold", size: "2xl", children: product.title }), _jsx(Text, { className: "text-primary", size: "2xl", weight: "semibold", children: price }), location && (_jsx(Text, { className: "text-muted-foreground", size: "sm", children: location })), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), conversation ? (_jsxs(Div, { className: `border border-border bg-muted/40 ${__P.p4}`, rounded: "lg", children: [_jsx(Text, { className: "mb-2", weight: "medium", children: "Conversation started!" }), _jsx(Link, { href: ROUTES.USER.MESSAGES, className: "text-primary underline underline-offset-2", children: "Go to your messages \u2192" })] })) : (_jsxs(Stack, { gap: "sm", children: [error && (_jsx(Text, { className: "text-destructive", size: "sm", children: error })), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleContactSeller, className: "w-full", children: "Contact Seller" })] }))] }) }) }));
41
54
  }
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { normalizeError } from "../../../../errors/normalize";
3
4
  import { useState } from "react";
4
- import { Button, Div, Span, Stack, Text } from "../../../../ui";
5
+ import { Button, Div, Row, Span, Stack, Text } from "../../../../ui";
5
6
  const __P = {
6
7
  p4: "p-4",
7
8
  };
@@ -18,6 +19,7 @@ export function CodeRevealPanel({ orderId, redemptionInstructions, fetchCode, })
18
19
  setRevealed(data);
19
20
  }
20
21
  catch (e) {
22
+ void normalizeError(e);
21
23
  setError(e instanceof Error ? e.message : "Could not retrieve code");
22
24
  }
23
25
  finally {
@@ -31,5 +33,5 @@ export function CodeRevealPanel({ orderId, redemptionInstructions, fetchCode, })
31
33
  setCopied(true);
32
34
  setTimeout(() => setCopied(false), 2000);
33
35
  }
34
- return (_jsx(Div, { className: `rounded-lg border border-border bg-muted/40 ${__P.p4}`, children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { className: "font-medium", children: "Your Digital Code" }), !revealed ? (_jsxs(Stack, { gap: "sm", children: [error && _jsx(Text, { className: "text-sm text-destructive", children: error }), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleReveal, className: "w-full", children: "Reveal Code" })] })) : (_jsxs(Stack, { gap: "sm", children: [_jsxs(Div, { className: "flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2 font-mono text-lg", children: [_jsx(Span, { className: "flex-1 select-all", children: revealed.code }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: handleCopy, className: "shrink-0", children: copied ? "Copied!" : "Copy" })] }), redemptionInstructions && (_jsx(Text, { className: "text-sm text-muted-foreground", children: redemptionInstructions }))] }))] }) }));
36
+ return (_jsx(Div, { className: `border border-border bg-muted/40 ${__P.p4}`, rounded: "lg", children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { weight: "medium", children: "Your Digital Code" }), !revealed ? (_jsxs(Stack, { gap: "sm", children: [error && _jsx(Text, { className: "text-destructive", size: "sm", children: error }), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleReveal, className: "w-full", children: "Reveal Code" })] })) : (_jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { textSize: "lg", className: "border border-border bg-background font-mono", padding: "inlineSm", align: "center", gap: "sm", rounded: "md", children: [_jsx(Span, { className: "flex-1 select-all", children: revealed.code }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: handleCopy, className: "shrink-0", children: copied ? "Copied!" : "Copy" })] }), redemptionInstructions && (_jsx(Text, { className: "text-muted-foreground", size: "sm", children: redemptionInstructions }))] }))] }) }));
35
37
  }
@@ -11,10 +11,10 @@ const __O = {
11
11
  };
12
12
  export function DigitalCodeDetailView({ product, isLoading = false, orderId, fetchCode, }) {
13
13
  if (isLoading || !product) {
14
- return (_jsx(Container, { children: _jsx(Div, { className: "py-16 text-center", children: _jsx(Text, { className: "text-muted-foreground", children: isLoading ? "Loading…" : "Digital code listing not found." }) }) }));
14
+ return (_jsx(Container, { children: _jsx(Div, { className: "text-center", padding: "y-4xl", children: _jsx(Text, { className: "text-muted-foreground", children: isLoading ? "Loading…" : "Digital code listing not found." }) }) }));
15
15
  }
16
16
  const meta = product.digitalCode;
17
17
  const price = formatCurrency(product.price, product.currency ?? "INR");
18
18
  const codesLeft = meta?.codesAvailable ?? 0;
19
- return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: `${__O.hidden} rounded-lg bg-muted`, children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Digital Code" }), codesLeft > 0 ? (_jsxs(Badge, { variant: "active", children: [codesLeft, " available"] })) : (_jsx(Badge, { variant: "danger", children: "Sold out" }))] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), orderId && fetchCode ? (_jsx(CodeRevealPanel, { orderId: orderId, redemptionInstructions: meta?.redemptionInstructions, fetchCode: fetchCode })) : (_jsxs(Div, { className: `rounded-lg border border-border bg-muted/40 ${__P.p4}`, children: [_jsx(Text, { className: "text-sm text-muted-foreground", children: "After purchase, return to your order to reveal the code instantly." }), meta?.redemptionInstructions && (_jsx(Text, { className: "mt-2 text-sm", children: meta.redemptionInstructions }))] }))] }) }) }));
19
+ return (_jsx(Container, { children: _jsx(Section, { padding: "y-xl", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: `${__O.hidden} bg-muted`, rounded: "lg", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { gap: "sm", wrap: true, children: [_jsx(Badge, { variant: "secondary", children: "Digital Code" }), codesLeft > 0 ? (_jsxs(Badge, { variant: "active", children: [codesLeft, " available"] })) : (_jsx(Badge, { variant: "danger", children: "Sold out" }))] }), _jsx(Heading, { level: 1, weight: "bold", size: "2xl", children: product.title }), _jsx(Text, { className: "text-primary", size: "2xl", weight: "semibold", children: price }), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), orderId && fetchCode ? (_jsx(CodeRevealPanel, { orderId: orderId, redemptionInstructions: meta?.redemptionInstructions, fetchCode: fetchCode })) : (_jsxs(Div, { className: `border border-border bg-muted/40 ${__P.p4}`, rounded: "lg", children: [_jsx(Text, { className: "text-muted-foreground", size: "sm", children: "After purchase, return to your order to reveal the code instantly." }), meta?.redemptionInstructions && (_jsx(Text, { className: "mt-2", size: "sm", children: meta.redemptionInstructions }))] }))] }) }) }));
20
20
  }
@@ -4,14 +4,12 @@ const HANDLE_STYLE = {
4
4
  background: "linear-gradient(to bottom, var(--appkit-color-primary-700, var(--appkit-color-primary)), var(--appkit-color-secondary-500, var(--appkit-color-secondary)))",
5
5
  };
6
6
  const CHEVRON_STYLE = {
7
- color: "var(--appkit-color-text-on-primary, #ffffff)",
7
+ color: "var(--appkit-color-text-on-primary)",
8
8
  };
9
9
  export function SidebarCollapseToggle({ expanded, onToggle, expandedLabel = "Collapse sidebar", collapsedLabel = "Expand sidebar", }) {
10
10
  return (_jsx("button", { type: "button", onClick: onToggle, "aria-label": expanded ? expandedLabel : collapsedLabel, "aria-expanded": expanded,
11
- // eslint-disable-next-line lir/no-inline-static-style
12
11
  // audit-inline-style-ok: pass-through style prop
13
12
  style: HANDLE_STYLE, className: "w-9 shrink-0 flex items-center justify-center cursor-pointer rounded-r-[1.25rem] shadow-lg transition-all duration-200 hover:shadow-xl hover:brightness-110 active:scale-[0.96]", children: _jsx("svg", { className: `w-4 h-4 drop-shadow-sm transition-transform duration-300 ${expanded ? "" : "rotate-180"}`,
14
- // eslint-disable-next-line lir/no-inline-static-style
15
13
  // audit-inline-style-ok: pass-through style prop
16
14
  style: CHEVRON_STYLE, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M15 19l-7-7 7-7" }) }) }));
17
15
  }
@@ -8,17 +8,17 @@ const __P = {
8
8
  const __O = {
9
9
  hidden: "overflow-hidden",
10
10
  };
11
- const CLS_WARN_BOX = "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm";
12
- const CLS_WARN_TITLE = "font-medium text-amber-900";
13
- const CLS_WARN_BODY = "mt-1 text-amber-800";
11
+ const CLS_WARN_BOX = "rounded-lg border border-warning bg-warning-surface p-4 text-sm";
12
+ const CLS_WARN_TITLE = "font-medium text-warning";
13
+ const CLS_WARN_BODY = "mt-1 text-warning";
14
14
  export function LiveItemDetailView({ product, isLoading = false, renderActions, }) {
15
15
  if (isLoading || !product) {
16
- return (_jsx(Container, { children: _jsx(Div, { className: "py-16 text-center", children: _jsx(Text, { className: "text-muted-foreground", children: isLoading ? "Loading…" : "Live listing not found." }) }) }));
16
+ return (_jsx(Container, { children: _jsx(Div, { className: "text-center", padding: "y-4xl", children: _jsx(Text, { className: "text-muted-foreground", children: isLoading ? "Loading…" : "Live listing not found." }) }) }));
17
17
  }
18
18
  const meta = product.liveItem;
19
19
  const price = formatCurrency(product.price, product.currency ?? "INR");
20
20
  const jurisdictions = meta?.jurisdictionAllowed ?? [];
21
21
  const transport = meta?.transport;
22
- return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: `${__O.hidden} rounded-lg bg-muted`, children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Live Item" }), meta?.vendorVerified && (_jsx(Badge, { variant: "active", children: "Verified Seller" })), meta?.cites && (_jsxs(Badge, { variant: "warning", children: ["CITES: ", meta.cites] }))] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), meta?.species && (_jsxs(Text, { className: "text-sm italic text-muted-foreground", children: [meta.species, meta.sex && meta.sex !== "n/a" && ` · ${meta.sex}`, meta.ageMonths !== undefined && ` · ${meta.ageMonths}mo`] })), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), jurisdictions.length > 0 && (_jsxs(Div, { className: CLS_WARN_BOX, children: [_jsx(Text, { className: CLS_WARN_TITLE, children: "Delivery restrictions" }), _jsxs(Text, { className: CLS_WARN_BODY, children: ["This item can only be shipped to: ", jurisdictions.join(", ")] })] })), transport && (_jsxs(Div, { className: `rounded-lg border border-border bg-muted/40 ${__P.p4} text-sm`, children: [_jsx(Text, { className: "font-medium", children: "Transport" }), _jsxs(Text, { className: "text-muted-foreground", children: ["Method: ", transport.method, transport.handlingFeeInPaise !== undefined &&
23
- ` · Handling: ${formatCurrency(transport.handlingFeeInPaise, "INR")}`, transport.insuranceIncluded && " · Insurance included"] })] })), meta?.careInfo && (_jsxs(Div, { className: `rounded-lg border border-border bg-muted/40 ${__P.p4} text-sm`, children: [_jsx(Text, { className: "font-medium", children: "Care information" }), _jsx(Text, { className: "mt-1 text-muted-foreground", children: meta.careInfo })] })), renderActions?.()] }) }) }));
22
+ return (_jsx(Container, { children: _jsx(Section, { padding: "y-xl", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: `${__O.hidden} bg-muted`, rounded: "lg", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { gap: "sm", wrap: true, children: [_jsx(Badge, { variant: "secondary", children: "Live Item" }), meta?.vendorVerified && (_jsx(Badge, { variant: "active", children: "Verified Seller" })), meta?.cites && (_jsxs(Badge, { variant: "warning", children: ["CITES: ", meta.cites] }))] }), _jsx(Heading, { level: 1, weight: "bold", size: "2xl", children: product.title }), meta?.species && (_jsxs(Text, { className: "italic text-muted-foreground", size: "sm", children: [meta.species, meta.sex && meta.sex !== "n/a" && ` · ${meta.sex}`, meta.ageMonths !== undefined && ` · ${meta.ageMonths}mo`] })), _jsx(Text, { className: "text-primary", size: "2xl", weight: "semibold", children: price }), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), jurisdictions.length > 0 && (_jsxs(Div, { className: CLS_WARN_BOX, children: [_jsx(Text, { className: CLS_WARN_TITLE, children: "Delivery restrictions" }), _jsxs(Text, { className: CLS_WARN_BODY, children: ["This item can only be shipped to: ", jurisdictions.join(", ")] })] })), transport && (_jsxs(Div, { textSize: "sm", className: `border border-border bg-muted/40 ${__P.p4}`, rounded: "lg", children: [_jsx(Text, { weight: "medium", children: "Transport" }), _jsxs(Text, { className: "text-muted-foreground", children: ["Method: ", transport.method, transport.handlingFeeInPaise !== undefined &&
23
+ ` · Handling: ${formatCurrency(transport.handlingFeeInPaise, "INR")}`, transport.insuranceIncluded && " · Insurance included"] })] })), meta?.careInfo && (_jsxs(Div, { textSize: "sm", className: `border border-border bg-muted/40 ${__P.p4}`, rounded: "lg", children: [_jsx(Text, { weight: "medium", children: "Care information" }), _jsx(Text, { className: "mt-1 text-muted-foreground", children: meta.careInfo })] })), renderActions?.()] }) }) }));
24
24
  }
@@ -0,0 +1,7 @@
1
+ export { ServerErrorsListView } from "./views/ServerErrorsListView";
2
+ export type { ServerErrorsListViewProps } from "./views/ServerErrorsListView";
3
+ export { ServerErrorDetailView } from "./views/ServerErrorDetailView";
4
+ export type { ServerErrorDetailViewProps } from "./views/ServerErrorDetailView";
5
+ export { MaintenanceDashboardView } from "./views/MaintenanceDashboardView";
6
+ export type { MaintenanceDashboardViewProps } from "./views/MaintenanceDashboardView";
7
+ export { AnalysisRunnerView } from "./views/AnalysisRunnerView";
@@ -0,0 +1,4 @@
1
+ export { ServerErrorsListView } from "./views/ServerErrorsListView";
2
+ export { ServerErrorDetailView } from "./views/ServerErrorDetailView";
3
+ export { MaintenanceDashboardView } from "./views/MaintenanceDashboardView";
4
+ export { AnalysisRunnerView } from "./views/AnalysisRunnerView";
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ export declare function AnalysisRunnerView(): React.JSX.Element;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { normalizeError } from "../../../../../errors/normalize";
4
+ import * as React from "react";
5
+ import { Div, Heading, Li, Section, Span, Table, Tbody, Td, Text, Th, Thead, Tr, Ul } from "@mohasinac/appkit";
6
+ export function AnalysisRunnerView() {
7
+ const [days, setDays] = React.useState(7);
8
+ const [source, setSource] = React.useState("all");
9
+ const [running, setRunning] = React.useState(false);
10
+ const [error, setError] = React.useState(null);
11
+ const [report, setReport] = React.useState(null);
12
+ async function run() {
13
+ setRunning(true);
14
+ setError(null);
15
+ try {
16
+ const res = await fetch("/api/admin/maintenance/analysis", {
17
+ method: "POST",
18
+ headers: { "Content-Type": "application/json" },
19
+ body: JSON.stringify({ days, source }),
20
+ });
21
+ const body = (await res.json());
22
+ if (!res.ok || !body.ok) {
23
+ setError(("error" in body && body.error) || `HTTP ${res.status}`);
24
+ setRunning(false);
25
+ return;
26
+ }
27
+ setReport(body.data);
28
+ }
29
+ catch (err) {
30
+ void normalizeError(err);
31
+ setError(err instanceof Error ? err.message : String(err));
32
+ }
33
+ finally {
34
+ setRunning(false);
35
+ }
36
+ }
37
+ return (_jsxs(Div, { style: { padding: "1.5rem", maxWidth: "1200px", margin: "0 auto" }, children: [_jsx(Heading, { level: 1, style: { fontSize: "1.5rem", fontWeight: 600 }, children: "Maintenance analysis" }), _jsxs(Div, { style: { display: "flex", gap: "1rem", alignItems: "center", margin: "1rem 0" }, children: [_jsxs("label", { children: ["Days back:\u00A0", _jsx("input", { type: "number", min: 1, max: 30, value: days, onChange: (e) => setDays(Math.max(1, Math.min(30, Number(e.target.value) || 7))), style: { width: 80, padding: "0.35rem 0.5rem", border: "1px solid var(--appkit-color-border)", borderRadius: 4 } })] }), _jsxs("label", { children: ["Source:\u00A0", _jsxs("select", { value: source, onChange: (e) => setSource(e.target.value), style: { padding: "0.35rem 0.5rem", border: "1px solid var(--appkit-color-border)", borderRadius: 4 }, children: [_jsx("option", { value: "all", children: "all" }), _jsx("option", { value: "vercel", children: "server (vercel)" }), _jsx("option", { value: "client", children: "client" }), _jsx("option", { value: "function", children: "function" })] })] }), _jsx("button", { type: "button", onClick: run, disabled: running, style: {
38
+ padding: "0.5rem 1rem",
39
+ background: "var(--appkit-color-primary)",
40
+ color: "var(--appkit-color-surface)",
41
+ border: 0,
42
+ borderRadius: 4,
43
+ cursor: running ? "wait" : "pointer",
44
+ }, children: running ? "Running…" : "Run analysis" })] }), error ? _jsx(Text, { as: "p", style: { color: "var(--appkit-color-error)" }, children: error }) : null, report ? _jsx(ReportView, { report: report }) : null] }));
45
+ }
46
+ function ReportView({ report }) {
47
+ return (_jsxs(Div, { children: [_jsxs(Text, { as: "p", style: { color: "var(--appkit-color-text-muted)" }, children: ["Generated ", report.generatedAt, ". Window: ", report.window.days, "d. Total: ", report.totalErrors, ". Unique users: ", report.uniqueUsers, "."] }), _jsx(ReportSection, { title: "Top codes", children: _jsxs(Table, { style: { width: "100%", fontSize: "0.85rem" }, children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { align: "left", children: "Code" }), _jsx(Th, { align: "right", children: "Count" }), _jsx(Th, { align: "right", children: "User impact" })] }) }), _jsx(Tbody, { children: report.topCodes.map((c) => (_jsxs(Tr, { children: [_jsx(Td, { style: { fontFamily: "monospace" }, children: c.code }), _jsx(Td, { align: "right", children: c.count }), _jsx(Td, { align: "right", children: c.userImpact })] }, c.code))) })] }) }), _jsx(ReportSection, { title: "Top routes", children: _jsxs(Table, { style: { width: "100%", fontSize: "0.85rem" }, children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { align: "left", children: "Route" }), _jsx(Th, { align: "left", children: "Source" }), _jsx(Th, { align: "right", children: "Count" })] }) }), _jsx(Tbody, { children: report.topRoutes.map((r) => (_jsxs(Tr, { children: [_jsx(Td, { style: { fontFamily: "monospace" }, children: r.route }), _jsx(Td, { children: r.source }), _jsx(Td, { align: "right", children: r.count })] }, `${r.source}:${r.route}`))) })] }) }), report.stackClusters.length > 0 ? (_jsx(ReportSection, { title: `Stack clusters (≥5)`, children: _jsx(Ul, { children: report.stackClusters.map((c) => (_jsxs(Li, { style: { marginBottom: "0.5rem", fontSize: "0.82rem" }, children: [_jsxs(Span, { weight: "bold", children: [c.count, "\u00D7"] }), " ", _jsx(Span, { style: { fontFamily: "monospace" }, children: c.signature }), _jsxs(Div, { style: { color: "var(--appkit-color-text-muted)" }, children: ["sample: ", c.sampleMessage] })] }, c.signature))) }) })) : null, report.burstWindows.length > 0 ? (_jsx(ReportSection, { title: "5xx burst windows", children: _jsx(Ul, { children: report.burstWindows.map((b) => (_jsxs(Li, { children: [b.start, " \u2014 ", b.count, " errors (", b.multiplier, "\u00D7 avg)"] }, b.start))) }) })) : null, _jsx(ReportSection, { title: "Recommendations", children: _jsx(Ul, { children: report.recommendations.map((r, i) => _jsx(Li, { children: r }, i)) }) })] }));
48
+ }
49
+ function ReportSection({ title, children }) {
50
+ return (_jsxs(Section, { style: { marginTop: "1.5rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600, marginBottom: "0.5rem" }, children: title }), children] }));
51
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import type { MaintenanceDashboardCounts } from "../../../../server/features/maintenance/data";
3
+ export interface MaintenanceDashboardViewProps {
4
+ counts: MaintenanceDashboardCounts;
5
+ basePath: string;
6
+ }
7
+ export declare function MaintenanceDashboardView({ counts, basePath, }: MaintenanceDashboardViewProps): React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Anchor, Div, Heading, Li, Nav, Section, Span, Text, Ul } from "@mohasinac/appkit";
4
+ const card = {
5
+ padding: "1rem 1.25rem",
6
+ border: "1px solid var(--appkit-color-border)",
7
+ borderRadius: 8,
8
+ background: "var(--appkit-color-surface)",
9
+ };
10
+ export function MaintenanceDashboardView({ counts, basePath, }) {
11
+ return (_jsxs(Div, { style: { padding: "1.5rem", maxWidth: "1200px", margin: "0 auto" }, children: [_jsx(Heading, { level: 1, style: { fontSize: "1.5rem", fontWeight: 600 }, children: "Maintenance" }), _jsx(Text, { as: "p", style: { color: "var(--appkit-color-text-muted)", marginBottom: "1.25rem" }, children: "Errors and failures across the platform \u2014 server, client, and Cloud Functions." }), _jsxs(Div, { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(170px, 1fr))", gap: "0.75rem", marginBottom: "1.5rem" }, children: [_jsxs(Div, { style: card, children: [_jsx(Div, { style: { fontSize: "0.78rem", color: "var(--appkit-color-text-muted)" }, children: "Last 24 hours" }), _jsx(Div, { style: { fontSize: "1.75rem", fontWeight: 700 }, children: counts.last24h })] }), _jsxs(Div, { style: card, children: [_jsx(Div, { style: { fontSize: "0.78rem", color: "var(--appkit-color-text-muted)" }, children: "Last 7 days" }), _jsx(Div, { style: { fontSize: "1.75rem", fontWeight: 700 }, children: counts.last7d })] }), _jsxs(Div, { style: card, children: [_jsx(Div, { style: { fontSize: "0.78rem", color: "var(--appkit-color-text-muted)" }, children: "Last 30 days" }), _jsx(Div, { style: { fontSize: "1.75rem", fontWeight: 700 }, children: counts.last30d })] }), _jsxs(Div, { style: card, children: [_jsx(Div, { style: { fontSize: "0.78rem", color: "var(--appkit-color-text-muted)" }, children: "Server (Vercel)" }), _jsx(Div, { style: { fontSize: "1.5rem", fontWeight: 700 }, children: counts.bySource.vercel })] }), _jsxs(Div, { style: card, children: [_jsx(Div, { style: { fontSize: "0.78rem", color: "var(--appkit-color-text-muted)" }, children: "Client" }), _jsx(Div, { style: { fontSize: "1.5rem", fontWeight: 700 }, children: counts.bySource.client })] }), _jsxs(Div, { style: card, children: [_jsx(Div, { style: { fontSize: "0.78rem", color: "var(--appkit-color-text-muted)" }, children: "Cloud Functions" }), _jsx(Div, { style: { fontSize: "1.5rem", fontWeight: 700 }, children: counts.bySource.function })] })] }), _jsxs(Section, { style: { marginBottom: "1.5rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600 }, children: "Top codes (30d)" }), _jsx(Ul, { style: { listStyle: "none", padding: 0 }, children: counts.topCodes.length === 0 ? _jsx(Li, { style: { color: "var(--appkit-color-text-muted)" }, children: "No errors recorded." }) :
12
+ counts.topCodes.map((c) => (_jsxs(Li, { style: { display: "flex", justifyContent: "space-between", padding: "0.25rem 0", borderBottom: "1px solid var(--appkit-color-border-subtle)" }, children: [_jsx(Span, { style: { fontFamily: "monospace" }, children: c.code }), _jsx(Span, { children: c.count })] }, c.code))) })] }), _jsxs(Section, { style: { marginBottom: "1.5rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600 }, children: "Top routes (30d)" }), _jsx(Ul, { style: { listStyle: "none", padding: 0 }, children: counts.topRoutes.length === 0 ? _jsx(Li, { style: { color: "var(--appkit-color-text-muted)" }, children: "No errors recorded." }) :
13
+ counts.topRoutes.map((r) => (_jsxs(Li, { style: { display: "flex", justifyContent: "space-between", padding: "0.25rem 0", borderBottom: "1px solid var(--appkit-color-border-subtle)" }, children: [_jsxs(Span, { style: { fontFamily: "monospace" }, children: ["[", r.source, "] ", r.route] }), _jsx(Span, { children: r.count })] }, `${r.source}:${r.route}`))) })] }), _jsxs(Nav, { "aria-label": "Maintenance sections", style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))", gap: "0.5rem" }, children: [_jsxs(Anchor, { href: `${basePath}/server-errors`, tone: "default", underline: "none", style: { ...card }, children: [_jsx(Span, { weight: "bold", children: "Server errors" }), _jsx(Div, { style: { color: "var(--appkit-color-text-muted)", fontSize: "0.85rem" }, children: "Vercel function failures" })] }), _jsxs(Anchor, { href: `${basePath}/client-errors`, tone: "default", underline: "none", style: { ...card }, children: [_jsx(Span, { weight: "bold", children: "Client errors" }), _jsx(Div, { style: { color: "var(--appkit-color-text-muted)", fontSize: "0.85rem" }, children: "window.onerror + unhandledrejection + boundaries" })] }), _jsxs(Anchor, { href: `${basePath}/function-errors`, tone: "default", underline: "none", style: { ...card }, children: [_jsx(Span, { weight: "bold", children: "Function errors" }), _jsx(Div, { style: { color: "var(--appkit-color-text-muted)", fontSize: "0.85rem" }, children: "Cloud Functions handler exceptions" })] }), _jsxs(Anchor, { href: `${basePath}/cloud-logs`, tone: "default", underline: "none", style: { ...card }, children: [_jsx(Span, { weight: "bold", children: "Cloud Logging" }), _jsx(Div, { style: { color: "var(--appkit-color-text-muted)", fontSize: "0.85rem" }, children: "Live stream from Cloud Logging API" })] }), _jsxs(Anchor, { href: `${basePath}/payment-rollbacks`, tone: "default", underline: "none", style: { ...card }, children: [_jsx(Span, { weight: "bold", children: "Payment rollbacks" }), _jsx(Div, { style: { color: "var(--appkit-color-text-muted)", fontSize: "0.85rem" }, children: "Razorpay refund + upstream-unavailable rows" })] }), _jsxs(Anchor, { href: `${basePath}/analysis`, tone: "default", underline: "none", style: { ...card }, children: [_jsx(Span, { weight: "bold", children: "Analysis" }), _jsx(Div, { style: { color: "var(--appkit-color-text-muted)", fontSize: "0.85rem" }, children: "Run the maintenance analyzer + recommendations" })] })] })] }));
14
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import type { ServerErrorDocument } from "../../../../../features/server-errors/schemas/firestore";
3
+ export interface ServerErrorDetailViewProps {
4
+ doc: ServerErrorDocument;
5
+ related: ServerErrorDocument[];
6
+ backHref: string;
7
+ }
8
+ export declare function ServerErrorDetailView({ doc, related, backHref, }: ServerErrorDetailViewProps): React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Anchor, Div, Heading, Li, Pre, Section, Text, Ul } from "@mohasinac/appkit";
4
+ function fmt(t) {
5
+ return new Date(t).toISOString().replace("T", " ").slice(0, 19);
6
+ }
7
+ export function ServerErrorDetailView({ doc, related, backHref, }) {
8
+ return (_jsxs(Div, { style: { padding: "1.5rem", maxWidth: "1200px", margin: "0 auto" }, children: [_jsx(Text, { as: "p", children: _jsx(Anchor, { href: backHref, external: false, children: "\u2190 Back to list" }) }), _jsxs(Heading, { level: 1, style: { fontSize: "1.5rem", fontWeight: 600 }, children: [doc.code, " ", _jsx(Text, { size: "xs", style: { fontSize: "1rem", color: "var(--appkit-color-text-muted)" }, children: doc.source })] }), _jsxs(Text, { as: "p", style: { color: "var(--appkit-color-text-muted)" }, children: [fmt(doc.occurredAt), " \u2014 ", doc.method ?? "—", " ", doc.route] }), _jsxs(Section, { style: { marginTop: "1.25rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600, marginBottom: "0.5rem" }, children: "Message" }), _jsx(Text, { as: "p", style: { fontFamily: "monospace", whiteSpace: "pre-wrap" }, children: doc.message })] }), _jsxs(Section, { style: { marginTop: "1.25rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600, marginBottom: "0.5rem" }, children: "Metadata" }), _jsxs("dl", { style: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "0.25rem 1rem", fontSize: "0.85rem" }, children: [_jsx("dt", { children: "request ID" }), _jsx("dd", { style: { fontFamily: "monospace" }, children: doc.requestId }), doc.userId ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "user ID" }), _jsx("dd", { style: { fontFamily: "monospace" }, children: doc.userId })] })) : null, doc.userAgent ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "user agent" }), _jsx("dd", { children: doc.userAgent })] })) : null, doc.bodyDigest ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "body digest" }), _jsx("dd", { style: { fontFamily: "monospace" }, children: doc.bodyDigest })] })) : null] })] }), doc.stack ? (_jsxs(Section, { style: { marginTop: "1.25rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600, marginBottom: "0.5rem" }, children: "Stack" }), _jsx(Pre, { style: { fontFamily: "monospace", fontSize: "0.78rem", background: "var(--appkit-color-text)", color: "var(--appkit-color-border)", padding: "0.75rem", borderRadius: 4, overflowX: "auto" }, children: doc.stack })] })) : null, doc.componentStack ? (_jsxs(Section, { style: { marginTop: "1.25rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600, marginBottom: "0.5rem" }, children: "Component stack" }), _jsx(Pre, { style: { fontFamily: "monospace", fontSize: "0.78rem", background: "var(--appkit-color-text)", color: "var(--appkit-color-border)", padding: "0.75rem", borderRadius: 4, overflowX: "auto" }, children: doc.componentStack })] })) : null, related.length > 0 ? (_jsxs(Section, { style: { marginTop: "1.25rem" }, children: [_jsx(Heading, { level: 2, style: { fontSize: "1rem", fontWeight: 600, marginBottom: "0.5rem" }, children: "Related client errors (same requestId)" }), _jsx(Ul, { children: related.map((r) => (_jsxs(Li, { style: { fontFamily: "monospace", fontSize: "0.82rem" }, children: [fmt(r.occurredAt), " \u2014 ", r.code, " \u2014 ", r.message.slice(0, 100)] }, r.id))) })] })) : null] }));
9
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import type { ServerErrorDocument, ServerErrorSource } from "../../../../../features/server-errors/schemas/firestore";
3
+ export interface ServerErrorsListViewProps {
4
+ title: string;
5
+ subtitle?: string;
6
+ source: ServerErrorSource | "all";
7
+ rows: ServerErrorDocument[];
8
+ detailHrefBase: string;
9
+ }
10
+ export declare function ServerErrorsListView({ title, subtitle, source, rows, detailHrefBase, }: ServerErrorsListViewProps): React.JSX.Element;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Anchor, Div, Heading, Label, Span, Table, Tbody, Td, Text, Th, Thead, Tr } from "@mohasinac/appkit";
5
+ const BORDER_STYLE = "1px solid var(--appkit-color-border)";
6
+ const COLUMNS = [
7
+ { key: "occurredAtFmt", label: "When", width: "180px" },
8
+ { key: "route", label: "Route" },
9
+ { key: "method", label: "Method", width: "70px" },
10
+ { key: "code", label: "Code", width: "180px" },
11
+ { key: "userId", label: "User", width: "120px" },
12
+ { key: "messagePreview", label: "Message" },
13
+ { key: "requestId", label: "Request ID", width: "160px" },
14
+ ];
15
+ function fmt(occurredAt) {
16
+ return new Date(occurredAt).toISOString().replace("T", " ").slice(0, 19);
17
+ }
18
+ function preview(message, max = 100) {
19
+ return message.length > max ? message.slice(0, max) + "…" : message;
20
+ }
21
+ export function ServerErrorsListView({ title, subtitle, source, rows, detailHrefBase, }) {
22
+ const [codeFilter, setCodeFilter] = React.useState("");
23
+ const [routeFilter, setRouteFilter] = React.useState("");
24
+ const filtered = React.useMemo(() => {
25
+ return rows.filter((r) => (!codeFilter || r.code.toLowerCase().includes(codeFilter.toLowerCase())) &&
26
+ (!routeFilter || r.route.toLowerCase().includes(routeFilter.toLowerCase())));
27
+ }, [rows, codeFilter, routeFilter]);
28
+ return (_jsxs(Div, { style: { padding: "1.5rem", maxWidth: "1400px", margin: "0 auto" }, children: [_jsx(Heading, { level: 1, style: { fontSize: "1.5rem", fontWeight: 600 }, children: title }), subtitle ? (_jsx(Text, { as: "p", style: { color: "var(--appkit-color-text-muted)", marginBottom: "1rem" }, children: subtitle })) : null, _jsxs(Div, { style: { display: "flex", gap: "0.75rem", marginBottom: "1rem", alignItems: "center" }, children: [_jsxs(Label, { style: { fontSize: "0.85rem" }, children: ["Code", _jsx("input", { type: "search", value: codeFilter, onChange: (e) => setCodeFilter(e.target.value), placeholder: "e.g. NOT_FOUND", style: { marginLeft: "0.5rem", padding: "0.35rem 0.5rem", border: BORDER_STYLE, borderRadius: 4 } })] }), _jsxs(Label, { style: { fontSize: "0.85rem" }, children: ["Route", _jsx("input", { type: "search", value: routeFilter, onChange: (e) => setRouteFilter(e.target.value), placeholder: "e.g. /api/orders", style: { marginLeft: "0.5rem", padding: "0.35rem 0.5rem", border: BORDER_STYLE, borderRadius: 4 } })] }), _jsxs(Span, { style: { marginLeft: "auto", fontSize: "0.85rem", color: "var(--appkit-color-text-muted)" }, children: [filtered.length, " of ", rows.length, " (source=", source, ")"] })] }), _jsx(Div, { style: { overflowX: "auto", border: BORDER_STYLE, borderRadius: 6 }, children: _jsxs(Table, { style: { width: "100%", borderCollapse: "collapse", fontSize: "0.85rem" }, children: [_jsx(Thead, { style: { background: "var(--appkit-color-bg)" }, children: _jsx(Tr, { children: COLUMNS.map((c) => (_jsx(Th, { style: {
29
+ textAlign: "left",
30
+ padding: "0.5rem 0.75rem",
31
+ borderBottom: BORDER_STYLE,
32
+ width: c.width,
33
+ whiteSpace: "nowrap",
34
+ }, children: c.label }, c.key))) }) }), _jsx(Tbody, { children: filtered.length === 0 ? (_jsx(Tr, { children: _jsx(Td, { colSpan: COLUMNS.length, style: { padding: "2rem", textAlign: "center", color: "var(--appkit-color-text-muted)" }, children: "No errors in the selected window." }) })) : (filtered.map((r) => (_jsx(Tr, { style: { borderBottom: "1px solid var(--appkit-color-border-subtle)" }, children: COLUMNS.map((c) => {
35
+ let cell;
36
+ if (c.key === "occurredAtFmt")
37
+ cell = fmt(r.occurredAt);
38
+ else if (c.key === "messagePreview")
39
+ cell = preview(r.message);
40
+ else
41
+ cell = (r[c.key] ?? "");
42
+ return (_jsx(Td, { style: { padding: "0.5rem 0.75rem", verticalAlign: "top" }, children: c.key === "code" ? (_jsx(Anchor, { href: `${detailHrefBase}/${r.id}`, external: false, children: String(cell) })) : (String(cell ?? "")) }, c.key));
43
+ }) }, r.id)))) })] }) })] }));
44
+ }
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Div } from "../../../ui";
3
+ import { Aside, BlockFooter, BlockHeader, Div, Main, Stack } from "../../../ui";
4
4
  export function AppShell({ children, slotHeader, slotFooter, slotSidebar, renderHeader, renderFooter, renderSidebar, path, className, }) {
5
5
  const ctx = { path };
6
6
  const header = renderHeader ? renderHeader(ctx) : slotHeader;
7
7
  const footer = renderFooter ? renderFooter(ctx) : slotFooter;
8
8
  const sidebar = renderSidebar ? renderSidebar(ctx) : slotSidebar;
9
- return (_jsxs(Div, { className: `appkit-app-shell flex min-h-screen flex-col ${className ?? ""}`, children: [header ? (_jsx("header", { className: "sticky top-0 z-30 w-full", "data-appshell-slot": "header", children: header })) : null, _jsxs(Div, { className: "flex flex-1", children: [sidebar ? (_jsx("aside", { className: "hidden lg:block lg:w-64 lg:shrink-0", "data-appshell-slot": "sidebar", children: sidebar })) : null, _jsx("main", { className: "min-w-0 flex-1", "data-appshell-slot": "main", children: children })] }), footer ? (_jsx("footer", { className: "w-full", "data-appshell-slot": "footer", children: footer })) : null] }));
9
+ return (_jsxs(Stack, { className: `appkit-app-shell min-h-screen ${className ?? ""}`, children: [header ? (_jsx(BlockHeader, { className: "sticky top-0 z-30 w-full", "data-appshell-slot": "header", children: header })) : null, _jsxs(Div, { layout: "flex", className: "flex-1", children: [sidebar ? (_jsx(Aside, { className: "hidden lg:block lg:w-64 lg:shrink-0", "data-appshell-slot": "sidebar", children: sidebar })) : null, _jsx(Main, { className: "min-w-0 flex-1", "data-appshell-slot": "main", children: children })] }), footer ? (_jsx(BlockFooter, { className: "w-full", "data-appshell-slot": "footer", children: footer })) : null] }));
10
10
  }
@@ -13,12 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  * placement; the consumer owns the items.
14
14
  */
15
15
  import * as React from "react";
16
- import { Div } from "../../../ui";
16
+ import { Div, Main, Nav, Span, Stack } from "../../../ui";
17
17
  export function DashboardScaffold({ children, slotPageHeader, renderNav, renderBottomNav, slotMenuToggle, initialDrawerOpen = false, className, }) {
18
18
  const [drawerOpen, setDrawerOpen] = React.useState(initialDrawerOpen);
19
19
  const toggleDrawer = React.useCallback(() => setDrawerOpen((v) => !v), []);
20
20
  const ctx = { drawerOpen, toggleDrawer };
21
21
  const nav = renderNav ? renderNav(ctx) : null;
22
22
  const bottomNav = renderBottomNav ? renderBottomNav(ctx) : nav;
23
- return (_jsxs(Div, { className: `appkit-dashboard-scaffold flex min-h-screen ${className ?? ""}`, children: [nav ? (_jsx("aside", { className: "sticky top-0 hidden h-screen w-64 shrink-0 overflow-y-auto border-r border-[var(--appkit-color-border,#e5e7eb)] lg:block", "data-dashboard-slot": "sidebar", children: nav })) : null, nav ? (_jsxs("div", { className: `fixed inset-0 z-40 transition-transform md:block lg:hidden ${drawerOpen ? "translate-x-0" : "-translate-x-full"}`, "data-dashboard-slot": "drawer", "aria-hidden": !drawerOpen, children: [_jsx("div", { className: "absolute inset-0 bg-black/40", onClick: () => setDrawerOpen(false), role: "presentation" }), _jsx("nav", { className: "relative h-full w-64 overflow-y-auto bg-[var(--appkit-color-surface,#ffffff)] shadow-xl", children: nav })] })) : null, _jsxs(Div, { className: "flex min-w-0 flex-1 flex-col", children: [(slotPageHeader || slotMenuToggle) && (_jsxs("div", { className: "sticky top-0 z-20 flex items-center gap-3 border-b border-[var(--appkit-color-border,#e5e7eb)] bg-[var(--appkit-color-surface,#ffffff)] px-4 py-2", "data-dashboard-slot": "page-header", children: [slotMenuToggle ? (_jsx("span", { className: "lg:hidden", onClick: toggleDrawer, role: "presentation", children: slotMenuToggle })) : null, _jsx(Div, { className: "min-w-0 flex-1", children: slotPageHeader })] })), _jsx("main", { className: "min-w-0 flex-1 pb-20 lg:pb-0", "data-dashboard-slot": "main", children: children }), bottomNav ? (_jsx("nav", { className: "fixed bottom-0 left-0 right-0 z-30 border-t border-[var(--appkit-color-border,#e5e7eb)] bg-[var(--appkit-color-surface,#ffffff)] lg:hidden", "data-dashboard-slot": "bottom-nav", children: bottomNav })) : null] })] }));
23
+ return (_jsxs(Div, { layout: "flex", className: `appkit-dashboard-scaffold min-h-screen ${className ?? ""}`, children: [nav ? (_jsx("aside", { className: "sticky top-0 hidden h-screen w-64 shrink-0 overflow-y-auto border-r border-[var(--appkit-color-border)] lg:block", "data-dashboard-slot": "sidebar", children: nav })) : null, nav ? (_jsxs("div", { className: `fixed inset-0 z-40 transition-transform md:block lg:hidden ${drawerOpen ? "translate-x-0" : "-translate-x-full"}`, "data-dashboard-slot": "drawer", "aria-hidden": !drawerOpen, children: [_jsx("div", { className: "absolute inset-0 bg-black/40", onClick: () => setDrawerOpen(false), role: "presentation" }), _jsx(Nav, { "aria-label": "Dashboard sidebar", className: "relative h-full w-64 overflow-y-auto bg-[var(--appkit-color-surface)] shadow-xl", children: nav })] })) : null, _jsxs(Stack, { className: "min-w-0 flex-1", children: [(slotPageHeader || slotMenuToggle) && (_jsxs("div", { className: "sticky top-0 z-20 flex items-center gap-3 border-b border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] px-4 py-2", "data-dashboard-slot": "page-header", children: [slotMenuToggle ? (_jsx(Span, { className: "lg:hidden", onClick: toggleDrawer, role: "presentation", children: slotMenuToggle })) : null, _jsx(Div, { className: "min-w-0 flex-1", children: slotPageHeader })] })), _jsx(Main, { className: "min-w-0 flex-1 pb-20 lg:pb-0", "data-dashboard-slot": "main", children: children }), bottomNav ? (_jsx(Nav, { "aria-label": "Bottom navigation", className: "fixed bottom-0 left-0 right-0 z-30 border-t border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] lg:hidden", "data-dashboard-slot": "bottom-nav", children: bottomNav })) : null] })] }));
24
24
  }
@@ -0,0 +1,39 @@
1
+ import { type ReactNode } from "react";
2
+ import { type ThemeMode, type ThemeRecord } from "../../../tokens/themes";
3
+ export type ModePreference = "light" | "dark" | "auto";
4
+ export interface ThemeRegistry {
5
+ /** Built-ins + admin-created themes, indexed by id. */
6
+ themes: ReadonlyArray<ThemeRecord>;
7
+ /** Theme id used when effective mode is `"light"`. */
8
+ defaultLightThemeId: string;
9
+ /** Theme id used when effective mode is `"dark"`. */
10
+ defaultDarkThemeId: string;
11
+ }
12
+ export interface ThemeContextValue {
13
+ /** The theme record currently applied to `<html>`. */
14
+ activeTheme: ThemeRecord;
15
+ /** Effective mode after auto-resolution (`"light"` | `"dark"`). */
16
+ effectiveMode: ThemeMode;
17
+ /** Alias for `effectiveMode` — convenience for consumers that just need the mode. */
18
+ theme: ThemeMode;
19
+ /** User's stored preference (`"light"` | `"dark"` | `"auto"`). */
20
+ preference: ModePreference;
21
+ /** Persist a new mode preference and re-render the active theme. */
22
+ setPreference: (next: ModePreference) => void;
23
+ /** Set preference directly to a concrete mode (skips `"auto"`). */
24
+ setTheme: (mode: ThemeMode) => void;
25
+ /** Flip preference between light ↔ dark. Sets preference to a concrete mode. */
26
+ toggleTheme: () => void;
27
+ }
28
+ export interface ThemeProviderProps {
29
+ /**
30
+ * Theme registry — typically `{ themes: [...BUILT_IN_THEMES, ...siteSettings.theme.themes],
31
+ * defaultLightThemeId, defaultDarkThemeId }`.
32
+ *
33
+ * If omitted, ships with just the two built-ins.
34
+ */
35
+ registry?: ThemeRegistry;
36
+ children: ReactNode;
37
+ }
38
+ export declare function ThemeProvider({ registry, children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function useTheme(): ThemeContextValue;
@@ -0,0 +1,115 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
4
+ import { BUILT_IN_THEMES, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, } from "../../../tokens/themes";
5
+ // Brand-neutral localStorage namespace so consumers other than letitrip can
6
+ // adopt appkit without the key leaking the LetItRip brand. The audit
7
+ // audit-ssr-in-appkit blocks any hardcoded brand string inside `_internal/`.
8
+ const MODE_STORAGE_KEY = "appkit:theme-mode";
9
+ const DARK_MEDIA_QUERY = "(prefers-color-scheme: dark)";
10
+ const ThemeContext = createContext(null);
11
+ function readModePreference() {
12
+ if (typeof window === "undefined")
13
+ return "auto";
14
+ try {
15
+ const stored = window.localStorage.getItem(MODE_STORAGE_KEY);
16
+ if (stored === "light" || stored === "dark" || stored === "auto")
17
+ return stored;
18
+ }
19
+ catch {
20
+ /* localStorage may be unavailable (privacy mode, embedded iframe). */
21
+ }
22
+ return "auto";
23
+ }
24
+ function resolveEffectiveMode(preference) {
25
+ if (preference === "light" || preference === "dark")
26
+ return preference;
27
+ if (typeof window === "undefined")
28
+ return "light";
29
+ return window.matchMedia(DARK_MEDIA_QUERY).matches ? "dark" : "light";
30
+ }
31
+ function pickTheme(registry, mode) {
32
+ const wanted = mode === "dark" ? registry.defaultDarkThemeId : registry.defaultLightThemeId;
33
+ const hit = registry.themes.find((t) => t.id === wanted);
34
+ if (hit && hit.mode === mode)
35
+ return hit;
36
+ // Fall back to the matching built-in if the configured id is missing or
37
+ // its mode mismatches (e.g. admin pointed defaultLightThemeId at a dark theme).
38
+ return mode === "dark" ? DEFAULT_DARK_THEME : DEFAULT_LIGHT_THEME;
39
+ }
40
+ /** Apply a theme record to `<html>` by setting `data-theme` and inline CSS variables. */
41
+ function applyTheme(theme) {
42
+ if (typeof document === "undefined")
43
+ return;
44
+ const root = document.documentElement;
45
+ root.setAttribute("data-theme", theme.id);
46
+ // Mode class kept in sync for any legacy `.dark` selectors that still exist.
47
+ if (theme.mode === "dark")
48
+ root.classList.add("dark");
49
+ else
50
+ root.classList.remove("dark");
51
+ for (const [name, value] of Object.entries(theme.tokens)) {
52
+ root.style.setProperty(`--${name}`, value);
53
+ }
54
+ for (const [key, value] of Object.entries(theme.gradients)) {
55
+ root.style.setProperty(`--appkit-gradient-${key}`, value);
56
+ }
57
+ }
58
+ const FALLBACK_REGISTRY = {
59
+ themes: BUILT_IN_THEMES,
60
+ defaultLightThemeId: DEFAULT_LIGHT_THEME.id,
61
+ defaultDarkThemeId: DEFAULT_DARK_THEME.id,
62
+ };
63
+ export function ThemeProvider({ registry, children }) {
64
+ const effectiveRegistry = registry ?? FALLBACK_REGISTRY;
65
+ const [preference, setPreferenceState] = useState(readModePreference);
66
+ const [effectiveMode, setEffectiveMode] = useState(() => resolveEffectiveMode(preference));
67
+ // Subscribe to `prefers-color-scheme` so `"auto"` follows the OS in real time.
68
+ useEffect(() => {
69
+ if (typeof window === "undefined" || preference !== "auto")
70
+ return;
71
+ const media = window.matchMedia(DARK_MEDIA_QUERY);
72
+ const onChange = () => setEffectiveMode(media.matches ? "dark" : "light");
73
+ media.addEventListener("change", onChange);
74
+ return () => media.removeEventListener("change", onChange);
75
+ }, [preference]);
76
+ // Recompute effective mode whenever preference changes.
77
+ useEffect(() => {
78
+ setEffectiveMode(resolveEffectiveMode(preference));
79
+ }, [preference]);
80
+ // Apply the active theme to the DOM whenever it changes.
81
+ const activeTheme = useMemo(() => pickTheme(effectiveRegistry, effectiveMode), [effectiveRegistry, effectiveMode]);
82
+ useEffect(() => {
83
+ applyTheme(activeTheme);
84
+ }, [activeTheme]);
85
+ const setPreference = useCallback((next) => {
86
+ setPreferenceState(next);
87
+ try {
88
+ window.localStorage.setItem(MODE_STORAGE_KEY, next);
89
+ }
90
+ catch {
91
+ /* ignore; preference applies for the session at minimum. */
92
+ }
93
+ }, []);
94
+ const setTheme = useCallback((mode) => setPreference(mode), [setPreference]);
95
+ const toggleTheme = useCallback(() => {
96
+ setPreference(effectiveMode === "dark" ? "light" : "dark");
97
+ }, [effectiveMode, setPreference]);
98
+ const value = useMemo(() => ({
99
+ activeTheme,
100
+ effectiveMode,
101
+ theme: effectiveMode,
102
+ preference,
103
+ setPreference,
104
+ setTheme,
105
+ toggleTheme,
106
+ }), [activeTheme, effectiveMode, preference, setPreference, setTheme, toggleTheme]);
107
+ return _jsx(ThemeContext.Provider, { value: value, children: children });
108
+ }
109
+ export function useTheme() {
110
+ const ctx = useContext(ThemeContext);
111
+ if (!ctx) {
112
+ throw new Error("useTheme must be used inside <ThemeProvider>");
113
+ }
114
+ return ctx;
115
+ }