@mohasinac/appkit 2.1.3 → 2.3.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 (820) hide show
  1. package/README.md +80 -30
  2. package/dist/index.d.ts +3124 -0
  3. package/dist/index.js +5836 -0
  4. package/package.json +67 -383
  5. package/src/cli/index.ts +0 -221
  6. package/src/contracts/auth.ts +0 -63
  7. package/src/contracts/config.ts +0 -58
  8. package/src/contracts/email.ts +0 -37
  9. package/src/contracts/extend.ts +0 -195
  10. package/src/contracts/feature.ts +0 -60
  11. package/src/contracts/index.ts +0 -122
  12. package/src/contracts/infra.ts +0 -50
  13. package/src/contracts/payment.ts +0 -50
  14. package/src/contracts/registry.ts +0 -44
  15. package/src/contracts/repository.ts +0 -87
  16. package/src/contracts/search.ts +0 -49
  17. package/src/contracts/shipping.ts +0 -77
  18. package/src/contracts/storage.ts +0 -37
  19. package/src/contracts/style.ts +0 -25
  20. package/src/contracts/table.ts +0 -148
  21. package/src/core/CacheManager.ts +0 -85
  22. package/src/core/EventBus.ts +0 -89
  23. package/src/core/Logger.ts +0 -209
  24. package/src/core/Queue.ts +0 -126
  25. package/src/core/StorageManager.ts +0 -167
  26. package/src/core/copilot-log.repository.ts +0 -106
  27. package/src/core/index.ts +0 -39
  28. package/src/core/newsletter.repository.ts +0 -193
  29. package/src/core/site-config.ts +0 -109
  30. package/src/errors/api-error.ts +0 -7
  31. package/src/errors/authentication-error.ts +0 -7
  32. package/src/errors/authorization-error.ts +0 -7
  33. package/src/errors/base-error.ts +0 -30
  34. package/src/errors/database-error.ts +0 -7
  35. package/src/errors/error-codes.ts +0 -106
  36. package/src/errors/error-handler.ts +0 -74
  37. package/src/errors/index.ts +0 -11
  38. package/src/errors/not-found-error.ts +0 -7
  39. package/src/errors/validation-error.ts +0 -7
  40. package/src/features/about/components/AboutView.tsx +0 -142
  41. package/src/features/about/components/index.ts +0 -7
  42. package/src/features/about/index.ts +0 -7
  43. package/src/features/account/api/[userId]/addresses/route.ts +0 -131
  44. package/src/features/account/api/[userId]/route.ts +0 -107
  45. package/src/features/account/columns/index.ts +0 -61
  46. package/src/features/account/components/AddressBook.tsx +0 -109
  47. package/src/features/account/components/BecomeSellerView.tsx +0 -44
  48. package/src/features/account/components/ChatList.tsx +0 -43
  49. package/src/features/account/components/ChatWindow.tsx +0 -52
  50. package/src/features/account/components/MessagesView.tsx +0 -60
  51. package/src/features/account/components/OrderDetailView.tsx +0 -50
  52. package/src/features/account/components/ProfileView.tsx +0 -40
  53. package/src/features/account/components/UserAccountHubView.tsx +0 -40
  54. package/src/features/account/components/UserAddressesView.tsx +0 -44
  55. package/src/features/account/components/UserNotificationsView.tsx +0 -52
  56. package/src/features/account/components/UserOffersView.tsx +0 -37
  57. package/src/features/account/components/UserOrderTrackView.tsx +0 -36
  58. package/src/features/account/components/UserOrdersView.tsx +0 -45
  59. package/src/features/account/components/UserSettingsView.tsx +0 -48
  60. package/src/features/account/components/index.ts +0 -54
  61. package/src/features/account/hooks/useAccount.ts +0 -25
  62. package/src/features/account/index.ts +0 -7
  63. package/src/features/account/manifest.ts +0 -29
  64. package/src/features/account/messages/en.json +0 -12
  65. package/src/features/account/repository/account.repository.ts +0 -28
  66. package/src/features/account/schemas/index.ts +0 -56
  67. package/src/features/account/types/index.ts +0 -124
  68. package/src/features/admin/api/bids/route.ts +0 -63
  69. package/src/features/admin/api/coupons/route.ts +0 -63
  70. package/src/features/admin/api/products/route.ts +0 -64
  71. package/src/features/admin/api/reviews/route.ts +0 -63
  72. package/src/features/admin/components/AdminAnalyticsView.tsx +0 -124
  73. package/src/features/admin/components/AdminBidsView.tsx +0 -29
  74. package/src/features/admin/components/AdminBlogView.tsx +0 -32
  75. package/src/features/admin/components/AdminCarouselView.tsx +0 -57
  76. package/src/features/admin/components/AdminCategoriesView.tsx +0 -57
  77. package/src/features/admin/components/AdminCouponsView.tsx +0 -32
  78. package/src/features/admin/components/AdminDashboardView.tsx +0 -50
  79. package/src/features/admin/components/AdminFaqsView.tsx +0 -29
  80. package/src/features/admin/components/AdminFeatureFlagsView.tsx +0 -33
  81. package/src/features/admin/components/AdminMediaView.tsx +0 -57
  82. package/src/features/admin/components/AdminNavigationView.tsx +0 -57
  83. package/src/features/admin/components/AdminOrdersView.tsx +0 -29
  84. package/src/features/admin/components/AdminPayoutsView.tsx +0 -29
  85. package/src/features/admin/components/AdminProductsView.tsx +0 -32
  86. package/src/features/admin/components/AdminReviewsView.tsx +0 -38
  87. package/src/features/admin/components/AdminSectionsView.tsx +0 -57
  88. package/src/features/admin/components/AdminSessionsManager.tsx +0 -28
  89. package/src/features/admin/components/AdminSidebar.tsx +0 -28
  90. package/src/features/admin/components/AdminSiteView.tsx +0 -34
  91. package/src/features/admin/components/AdminStoresView.tsx +0 -29
  92. package/src/features/admin/components/AdminTopBar.tsx +0 -22
  93. package/src/features/admin/components/AdminUsersView.tsx +0 -32
  94. package/src/features/admin/components/DashboardStats.tsx +0 -95
  95. package/src/features/admin/components/DataTable.tsx +0 -115
  96. package/src/features/admin/components/DemoSeedView.tsx +0 -22
  97. package/src/features/admin/components/QuickActionsPanel.tsx +0 -62
  98. package/src/features/admin/components/analytics/AdminAnalyticsCharts.tsx +0 -114
  99. package/src/features/admin/components/analytics/AdminStatCard.tsx +0 -36
  100. package/src/features/admin/components/analytics/AdminTopProductsTable.tsx +0 -61
  101. package/src/features/admin/components/analytics/index.ts +0 -3
  102. package/src/features/admin/components/index.ts +0 -71
  103. package/src/features/admin/hooks/useAdmin.ts +0 -19
  104. package/src/features/admin/index.ts +0 -5
  105. package/src/features/admin/manifest.ts +0 -15
  106. package/src/features/admin/messages/en.json +0 -13
  107. package/src/features/admin/permission-map.ts +0 -27
  108. package/src/features/admin/server.ts +0 -10
  109. package/src/features/admin/types/index.ts +0 -75
  110. package/src/features/auctions/api/route.ts +0 -83
  111. package/src/features/auctions/columns/index.ts +0 -91
  112. package/src/features/auctions/components/AuctionCard.tsx +0 -149
  113. package/src/features/auctions/components/index.ts +0 -1
  114. package/src/features/auctions/hooks/useAuctions.ts +0 -145
  115. package/src/features/auctions/hooks/usePlaceBid.ts +0 -48
  116. package/src/features/auctions/hooks/useRealtimeBids.ts +0 -100
  117. package/src/features/auctions/index.ts +0 -9
  118. package/src/features/auctions/manifest.ts +0 -19
  119. package/src/features/auctions/messages/en.json +0 -18
  120. package/src/features/auctions/repository/auctions.repository.ts +0 -57
  121. package/src/features/auctions/schemas/index.ts +0 -69
  122. package/src/features/auctions/server.ts +0 -7
  123. package/src/features/auctions/types/index.ts +0 -90
  124. package/src/features/auth/api/route.ts +0 -63
  125. package/src/features/auth/components/AuthStatusPanel.tsx +0 -67
  126. package/src/features/auth/components/ForgotPasswordView.tsx +0 -114
  127. package/src/features/auth/components/Guards.tsx +0 -60
  128. package/src/features/auth/components/LoginForm.tsx +0 -180
  129. package/src/features/auth/components/RegisterForm.tsx +0 -232
  130. package/src/features/auth/components/ResetPasswordView.tsx +0 -144
  131. package/src/features/auth/components/SocialAuthButtons.tsx +0 -60
  132. package/src/features/auth/components/VerifyEmailView.tsx +0 -118
  133. package/src/features/auth/components/index.ts +0 -13
  134. package/src/features/auth/hooks/useAuth.ts +0 -33
  135. package/src/features/auth/index.ts +0 -5
  136. package/src/features/auth/manifest.ts +0 -23
  137. package/src/features/auth/messages/en.json +0 -13
  138. package/src/features/auth/schemas/index.ts +0 -48
  139. package/src/features/auth/server.ts +0 -17
  140. package/src/features/auth/types/index.ts +0 -36
  141. package/src/features/before-after/api/[id]/route.ts +0 -143
  142. package/src/features/before-after/api/route.ts +0 -104
  143. package/src/features/before-after/columns/index.ts +0 -72
  144. package/src/features/before-after/components/BeforeAfterGallery.tsx +0 -41
  145. package/src/features/before-after/components/BeforeAfterSlider.tsx +0 -89
  146. package/src/features/before-after/components/index.ts +0 -2
  147. package/src/features/before-after/hooks/useBeforeAfter.ts +0 -33
  148. package/src/features/before-after/index.ts +0 -7
  149. package/src/features/before-after/manifest.ts +0 -12
  150. package/src/features/before-after/messages/en.json +0 -8
  151. package/src/features/before-after/repository/before-after.repository.ts +0 -44
  152. package/src/features/before-after/schemas/index.ts +0 -25
  153. package/src/features/before-after/types/index.ts +0 -19
  154. package/src/features/blog/api/[slug]/route.ts +0 -73
  155. package/src/features/blog/api/route.ts +0 -81
  156. package/src/features/blog/columns/index.ts +0 -68
  157. package/src/features/blog/components/BlogFeaturedCard.tsx +0 -108
  158. package/src/features/blog/components/BlogListView.tsx +0 -219
  159. package/src/features/blog/components/BlogPostForm.tsx +0 -254
  160. package/src/features/blog/components/BlogPostView.tsx +0 -221
  161. package/src/features/blog/components/index.ts +0 -12
  162. package/src/features/blog/hooks/useBlog.ts +0 -67
  163. package/src/features/blog/index.ts +0 -7
  164. package/src/features/blog/manifest.ts +0 -16
  165. package/src/features/blog/messages/en.json +0 -14
  166. package/src/features/blog/repository/blog.repository.ts +0 -73
  167. package/src/features/blog/schemas/index.ts +0 -74
  168. package/src/features/blog/server.ts +0 -9
  169. package/src/features/blog/types/index.ts +0 -58
  170. package/src/features/cart/api/[id]/route.ts +0 -98
  171. package/src/features/cart/api/route.ts +0 -104
  172. package/src/features/cart/columns/index.ts +0 -73
  173. package/src/features/cart/components/CartDrawer.tsx +0 -183
  174. package/src/features/cart/components/CartSummary.tsx +0 -43
  175. package/src/features/cart/components/CartView.tsx +0 -47
  176. package/src/features/cart/components/CheckoutAddressStep.tsx +0 -68
  177. package/src/features/cart/components/CheckoutOtpModal.tsx +0 -39
  178. package/src/features/cart/components/CheckoutSuccessView.tsx +0 -31
  179. package/src/features/cart/components/CheckoutView.tsx +0 -70
  180. package/src/features/cart/components/index.ts +0 -16
  181. package/src/features/cart/hooks/useCart.ts +0 -30
  182. package/src/features/cart/hooks/useCartQuery.ts +0 -22
  183. package/src/features/cart/hooks/useCheckoutReadQueries.ts +0 -34
  184. package/src/features/cart/hooks/useOrder.ts +0 -35
  185. package/src/features/cart/index.ts +0 -11
  186. package/src/features/cart/manifest.ts +0 -12
  187. package/src/features/cart/messages/en.json +0 -10
  188. package/src/features/cart/repository/cart.repository.ts +0 -50
  189. package/src/features/cart/schemas/index.ts +0 -36
  190. package/src/features/cart/types/index.ts +0 -29
  191. package/src/features/cart/utils/guest-cart.ts +0 -149
  192. package/src/features/categories/api/[id]/route.ts +0 -144
  193. package/src/features/categories/api/route.ts +0 -253
  194. package/src/features/categories/columns/index.ts +0 -51
  195. package/src/features/categories/components/BreadcrumbTrail.tsx +0 -80
  196. package/src/features/categories/components/CategoriesListView.tsx +0 -77
  197. package/src/features/categories/components/CategoryGrid.tsx +0 -93
  198. package/src/features/categories/components/CategoryProductsView.tsx +0 -116
  199. package/src/features/categories/components/CategoryTree.tsx +0 -156
  200. package/src/features/categories/components/ConcernCard.tsx +0 -45
  201. package/src/features/categories/components/ConcernGrid.tsx +0 -25
  202. package/src/features/categories/components/index.ts +0 -17
  203. package/src/features/categories/hooks/useCategories.ts +0 -72
  204. package/src/features/categories/index.ts +0 -7
  205. package/src/features/categories/manifest.ts +0 -22
  206. package/src/features/categories/messages/en.json +0 -14
  207. package/src/features/categories/repository/categories.repository.ts +0 -76
  208. package/src/features/categories/schemas/index.ts +0 -74
  209. package/src/features/categories/server.ts +0 -12
  210. package/src/features/categories/types/index.ts +0 -60
  211. package/src/features/checkout/components/CheckoutStepper.tsx +0 -45
  212. package/src/features/checkout/components/index.ts +0 -1
  213. package/src/features/checkout/hooks/useCheckout.ts +0 -38
  214. package/src/features/checkout/index.ts +0 -4
  215. package/src/features/checkout/manifest.ts +0 -19
  216. package/src/features/checkout/messages/en.json +0 -10
  217. package/src/features/checkout/types/index.ts +0 -62
  218. package/src/features/cms/index.ts +0 -6
  219. package/src/features/collections/api/[slug]/route.ts +0 -167
  220. package/src/features/collections/api/route.ts +0 -104
  221. package/src/features/collections/columns/index.ts +0 -77
  222. package/src/features/collections/components/CollectionCard.tsx +0 -61
  223. package/src/features/collections/components/index.ts +0 -1
  224. package/src/features/collections/hooks/useCollections.ts +0 -31
  225. package/src/features/collections/index.ts +0 -7
  226. package/src/features/collections/manifest.ts +0 -18
  227. package/src/features/collections/messages/en.json +0 -10
  228. package/src/features/collections/repository/collections.repository.ts +0 -19
  229. package/src/features/collections/schemas/index.ts +0 -36
  230. package/src/features/collections/types/index.ts +0 -26
  231. package/src/features/consultation/api/[id]/route.ts +0 -143
  232. package/src/features/consultation/api/route.ts +0 -104
  233. package/src/features/consultation/columns/index.ts +0 -76
  234. package/src/features/consultation/components/ConsultationForm.tsx +0 -161
  235. package/src/features/consultation/components/index.ts +0 -1
  236. package/src/features/consultation/hooks/useBookConsultation.ts +0 -19
  237. package/src/features/consultation/index.ts +0 -7
  238. package/src/features/consultation/manifest.ts +0 -14
  239. package/src/features/consultation/messages/en.json +0 -25
  240. package/src/features/consultation/repository/consultations.repository.ts +0 -35
  241. package/src/features/consultation/schemas/index.ts +0 -51
  242. package/src/features/consultation/types/index.ts +0 -36
  243. package/src/features/contact/components/ContactForm.tsx +0 -202
  244. package/src/features/contact/components/ContactInfoSidebar.tsx +0 -85
  245. package/src/features/contact/components/index.ts +0 -7
  246. package/src/features/contact/index.ts +0 -1
  247. package/src/features/copilot/components/AdminCopilotView.tsx +0 -157
  248. package/src/features/copilot/components/index.ts +0 -2
  249. package/src/features/copilot/hooks/useCopilotChat.ts +0 -86
  250. package/src/features/copilot/index.ts +0 -2
  251. package/src/features/corporate/api/[id]/route.ts +0 -149
  252. package/src/features/corporate/api/route.ts +0 -108
  253. package/src/features/corporate/columns/index.ts +0 -76
  254. package/src/features/corporate/components/CorporateInquiryForm.tsx +0 -155
  255. package/src/features/corporate/components/index.ts +0 -1
  256. package/src/features/corporate/hooks/useSubmitCorporateInquiry.ts +0 -19
  257. package/src/features/corporate/index.ts +0 -7
  258. package/src/features/corporate/manifest.ts +0 -14
  259. package/src/features/corporate/messages/en.json +0 -26
  260. package/src/features/corporate/repository/corporate.repository.ts +0 -39
  261. package/src/features/corporate/schemas/index.ts +0 -53
  262. package/src/features/corporate/types/index.ts +0 -40
  263. package/src/features/cron/firebase-adapters.ts +0 -117
  264. package/src/features/cron/index.ts +0 -28
  265. package/src/features/cron/jobs/auction-expiry.job.ts +0 -76
  266. package/src/features/cron/jobs/preorder-reminder.job.ts +0 -64
  267. package/src/features/cron/registry.ts +0 -115
  268. package/src/features/cron/types.ts +0 -83
  269. package/src/features/events/api/[id]/route.ts +0 -123
  270. package/src/features/events/api/route.ts +0 -110
  271. package/src/features/events/columns/index.ts +0 -54
  272. package/src/features/events/components/AdminEventEntriesView.tsx +0 -39
  273. package/src/features/events/components/AdminEventsView.tsx +0 -47
  274. package/src/features/events/components/EventCard.tsx +0 -88
  275. package/src/features/events/components/EventDetailView.tsx +0 -51
  276. package/src/features/events/components/EventFormDrawer.tsx +0 -47
  277. package/src/features/events/components/EventLeaderboard.tsx +0 -76
  278. package/src/features/events/components/EventParticipateView.tsx +0 -48
  279. package/src/features/events/components/EventStatusBadge.tsx +0 -28
  280. package/src/features/events/components/EventsListView.tsx +0 -100
  281. package/src/features/events/components/index.ts +0 -15
  282. package/src/features/events/hooks/useEvent.ts +0 -94
  283. package/src/features/events/hooks/useEvents.ts +0 -59
  284. package/src/features/events/index.ts +0 -11
  285. package/src/features/events/manifest.ts +0 -26
  286. package/src/features/events/messages/en.json +0 -28
  287. package/src/features/events/repository/events.repository.ts +0 -110
  288. package/src/features/events/schemas/index.ts +0 -98
  289. package/src/features/events/server.ts +0 -8
  290. package/src/features/events/types/index.ts +0 -185
  291. package/src/features/faq/api/route.ts +0 -61
  292. package/src/features/faq/columns/index.ts +0 -60
  293. package/src/features/faq/components/ContactCTA.tsx +0 -115
  294. package/src/features/faq/components/FAQAccordion.tsx +0 -150
  295. package/src/features/faq/components/FAQCategorySidebar.tsx +0 -124
  296. package/src/features/faq/components/FAQHelpfulButtons.tsx +0 -110
  297. package/src/features/faq/components/FAQPageContent.tsx +0 -217
  298. package/src/features/faq/components/FAQSortDropdown.tsx +0 -43
  299. package/src/features/faq/components/RelatedFAQs.tsx +0 -74
  300. package/src/features/faq/components/index.ts +0 -9
  301. package/src/features/faq/hooks/useFAQs.ts +0 -50
  302. package/src/features/faq/hooks/useFaqList.ts +0 -53
  303. package/src/features/faq/index.ts +0 -8
  304. package/src/features/faq/manifest.ts +0 -12
  305. package/src/features/faq/messages/en.json +0 -14
  306. package/src/features/faq/repository/faqs.repository.ts +0 -61
  307. package/src/features/faq/schemas/index.ts +0 -69
  308. package/src/features/faq/server.ts +0 -7
  309. package/src/features/faq/types/index.ts +0 -63
  310. package/src/features/filters/FilterFacetSection.tsx +0 -205
  311. package/src/features/filters/FilterPanel.tsx +0 -227
  312. package/src/features/filters/RangeFilter.tsx +0 -291
  313. package/src/features/filters/SwitchFilter.tsx +0 -143
  314. package/src/features/filters/filterUtils.ts +0 -24
  315. package/src/features/filters/index.ts +0 -28
  316. package/src/features/forms/Checkbox.tsx +0 -100
  317. package/src/features/forms/Form.tsx +0 -105
  318. package/src/features/forms/Input.tsx +0 -127
  319. package/src/features/forms/Radio.tsx +0 -126
  320. package/src/features/forms/Select.tsx +0 -101
  321. package/src/features/forms/Slider.tsx +0 -119
  322. package/src/features/forms/Textarea.tsx +0 -99
  323. package/src/features/forms/Toggle.tsx +0 -110
  324. package/src/features/forms/index.ts +0 -34
  325. package/src/features/forms/utils.ts +0 -25
  326. package/src/features/homepage/api/[id]/route.ts +0 -145
  327. package/src/features/homepage/api/carousel/[id]/route.ts +0 -169
  328. package/src/features/homepage/api/carousel/route.ts +0 -188
  329. package/src/features/homepage/api/route.ts +0 -167
  330. package/src/features/homepage/api/sections/[id]/route.ts +0 -143
  331. package/src/features/homepage/api/sections/route.ts +0 -104
  332. package/src/features/homepage/components/AdvertisementBanner.tsx +0 -202
  333. package/src/features/homepage/components/BeforeAfterCard.tsx +0 -147
  334. package/src/features/homepage/components/CharacterHotspot.tsx +0 -742
  335. package/src/features/homepage/components/CharacterHotspotForm.tsx +0 -1002
  336. package/src/features/homepage/components/CustomerReviewsSection.tsx +0 -108
  337. package/src/features/homepage/components/FAQSection.tsx +0 -154
  338. package/src/features/homepage/components/FeaturedResultsSection.tsx +0 -97
  339. package/src/features/homepage/components/HeroBanner.tsx +0 -283
  340. package/src/features/homepage/components/HeroCarousel.tsx +0 -442
  341. package/src/features/homepage/components/HeroSection.tsx +0 -50
  342. package/src/features/homepage/components/HomepageSkeleton.tsx +0 -88
  343. package/src/features/homepage/components/HomepageView.tsx +0 -77
  344. package/src/features/homepage/components/HowItWorksInfoView.tsx +0 -161
  345. package/src/features/homepage/components/HowItWorksSection.tsx +0 -194
  346. package/src/features/homepage/components/NewsletterBanner.tsx +0 -130
  347. package/src/features/homepage/components/NewsletterSection.tsx +0 -85
  348. package/src/features/homepage/components/PromoGrid.tsx +0 -130
  349. package/src/features/homepage/components/SectionCarousel.tsx +0 -284
  350. package/src/features/homepage/components/SecurityHighlightsSection.tsx +0 -149
  351. package/src/features/homepage/components/SiteFeaturesSection.tsx +0 -86
  352. package/src/features/homepage/components/StatsCounterSection.tsx +0 -118
  353. package/src/features/homepage/components/TestimonialsCarousel.tsx +0 -96
  354. package/src/features/homepage/components/TrustBadges.tsx +0 -155
  355. package/src/features/homepage/components/TrustFeaturesSection.tsx +0 -168
  356. package/src/features/homepage/components/TrustIndicatorsSection.tsx +0 -59
  357. package/src/features/homepage/components/WelcomeSection.tsx +0 -178
  358. package/src/features/homepage/components/WhatsAppCommunitySection.tsx +0 -187
  359. package/src/features/homepage/components/index.ts +0 -91
  360. package/src/features/homepage/hooks/useBlogArticles.ts +0 -46
  361. package/src/features/homepage/hooks/useFeaturedAuctions.ts +0 -39
  362. package/src/features/homepage/hooks/useFeaturedPreOrders.ts +0 -39
  363. package/src/features/homepage/hooks/useFeaturedProducts.ts +0 -44
  364. package/src/features/homepage/hooks/useHeroCarousel.ts +0 -19
  365. package/src/features/homepage/hooks/useHomepage.ts +0 -25
  366. package/src/features/homepage/hooks/useTopBrands.ts +0 -17
  367. package/src/features/homepage/hooks/useTopCategories.ts +0 -19
  368. package/src/features/homepage/index.ts +0 -10
  369. package/src/features/homepage/manifest.ts +0 -16
  370. package/src/features/homepage/messages/en.json +0 -6
  371. package/src/features/homepage/repository/homepage.repository.ts +0 -38
  372. package/src/features/homepage/server.ts +0 -14
  373. package/src/features/homepage/types/index.ts +0 -183
  374. package/src/features/layout/AutoBreadcrumbs.tsx +0 -143
  375. package/src/features/layout/BackToTop.tsx +0 -58
  376. package/src/features/layout/BottomNavItem.tsx +0 -71
  377. package/src/features/layout/BottomNavLayout.tsx +0 -34
  378. package/src/features/layout/BottomSheet.tsx +0 -120
  379. package/src/features/layout/Breadcrumbs.tsx +0 -83
  380. package/src/features/layout/FooterLayout.tsx +0 -215
  381. package/src/features/layout/ListingLayout.tsx +0 -383
  382. package/src/features/layout/LocaleSwitcher.tsx +0 -44
  383. package/src/features/layout/NavbarLayout.tsx +0 -108
  384. package/src/features/layout/SidebarLayout.tsx +0 -75
  385. package/src/features/layout/TitleBarLayout.tsx +0 -285
  386. package/src/features/layout/index.ts +0 -46
  387. package/src/features/loyalty/api/admin/loyalty/grant/route.ts +0 -51
  388. package/src/features/loyalty/api/balance/route.ts +0 -53
  389. package/src/features/loyalty/api/earn/route.ts +0 -51
  390. package/src/features/loyalty/api/history/route.ts +0 -74
  391. package/src/features/loyalty/api/redeem/route.ts +0 -51
  392. package/src/features/loyalty/columns/index.ts +0 -61
  393. package/src/features/loyalty/components/CoinsDisplay.tsx +0 -36
  394. package/src/features/loyalty/components/index.ts +0 -1
  395. package/src/features/loyalty/hooks/useLoyaltyBalance.ts +0 -17
  396. package/src/features/loyalty/index.ts +0 -7
  397. package/src/features/loyalty/manifest.ts +0 -18
  398. package/src/features/loyalty/messages/en.json +0 -19
  399. package/src/features/loyalty/repository/loyalty.repository.ts +0 -29
  400. package/src/features/loyalty/schemas/index.ts +0 -44
  401. package/src/features/loyalty/types/index.ts +0 -43
  402. package/src/features/loyalty/types/loyalty-math.ts +0 -36
  403. package/src/features/media/MediaAvatar.tsx +0 -37
  404. package/src/features/media/MediaImage.tsx +0 -119
  405. package/src/features/media/MediaLightbox.tsx +0 -520
  406. package/src/features/media/MediaVideo.tsx +0 -94
  407. package/src/features/media/components/MediaSlider.tsx +0 -53
  408. package/src/features/media/hooks/useMedia.ts +0 -118
  409. package/src/features/media/index.ts +0 -74
  410. package/src/features/media/messages/en.json +0 -63
  411. package/src/features/media/modals/ImageCropModal.tsx +0 -270
  412. package/src/features/media/modals/VideoThumbnailSelector.tsx +0 -117
  413. package/src/features/media/modals/VideoTrimModal.tsx +0 -193
  414. package/src/features/media/types/index.ts +0 -69
  415. package/src/features/media/upload/CameraCapture.tsx +0 -150
  416. package/src/features/media/upload/ImageUpload.tsx +0 -358
  417. package/src/features/media/upload/MediaUploadField.tsx +0 -442
  418. package/src/features/media/upload/MediaUploadList.tsx +0 -255
  419. package/src/features/orders/columns/index.ts +0 -47
  420. package/src/features/orders/components/OrdersList.tsx +0 -168
  421. package/src/features/orders/components/index.ts +0 -1
  422. package/src/features/orders/hooks/useOrders.ts +0 -53
  423. package/src/features/orders/index.ts +0 -8
  424. package/src/features/orders/manifest.ts +0 -20
  425. package/src/features/orders/messages/en.json +0 -15
  426. package/src/features/orders/repository/orders.repository.ts +0 -47
  427. package/src/features/orders/schemas/index.ts +0 -82
  428. package/src/features/orders/types/index.ts +0 -97
  429. package/src/features/orders/utils/order-splitter.ts +0 -48
  430. package/src/features/payments/columns/index.ts +0 -67
  431. package/src/features/payments/components/index.ts +0 -1
  432. package/src/features/payments/hooks/usePayments.ts +0 -23
  433. package/src/features/payments/index.ts +0 -6
  434. package/src/features/payments/manifest.ts +0 -14
  435. package/src/features/payments/messages/en.json +0 -11
  436. package/src/features/payments/repository/payments.repository.ts +0 -57
  437. package/src/features/payments/schemas/index.ts +0 -47
  438. package/src/features/payments/types/index.ts +0 -50
  439. package/src/features/pre-orders/api/[id]/route.ts +0 -143
  440. package/src/features/pre-orders/api/[slug]/route.ts +0 -61
  441. package/src/features/pre-orders/api/admin/[id]/route.ts +0 -105
  442. package/src/features/pre-orders/api/admin/route.ts +0 -69
  443. package/src/features/pre-orders/api/route.ts +0 -96
  444. package/src/features/pre-orders/columns/index.ts +0 -90
  445. package/src/features/pre-orders/components/PreOrderBadge.tsx +0 -52
  446. package/src/features/pre-orders/components/PreorderCard.tsx +0 -90
  447. package/src/features/pre-orders/components/index.ts +0 -1
  448. package/src/features/pre-orders/hooks/usePreOrders.ts +0 -31
  449. package/src/features/pre-orders/index.ts +0 -7
  450. package/src/features/pre-orders/manifest.ts +0 -19
  451. package/src/features/pre-orders/messages/en.json +0 -13
  452. package/src/features/pre-orders/repository/pre-orders.repository.ts +0 -75
  453. package/src/features/pre-orders/repository/preorders.repository.ts +0 -24
  454. package/src/features/pre-orders/schemas/index.ts +0 -28
  455. package/src/features/pre-orders/server.ts +0 -12
  456. package/src/features/pre-orders/types/index.ts +0 -49
  457. package/src/features/products/api/[id]/route.ts +0 -200
  458. package/src/features/products/api/route.ts +0 -242
  459. package/src/features/products/columns/index.ts +0 -90
  460. package/src/features/products/components/AuctionDetailView.tsx +0 -58
  461. package/src/features/products/components/AuctionsView.tsx +0 -48
  462. package/src/features/products/components/BidHistory.tsx +0 -83
  463. package/src/features/products/components/BuyBar.tsx +0 -36
  464. package/src/features/products/components/MakeOfferForm.tsx +0 -43
  465. package/src/features/products/components/PlaceBidForm.tsx +0 -42
  466. package/src/features/products/components/PreOrderDetailView.tsx +0 -50
  467. package/src/features/products/components/PreOrdersView.tsx +0 -39
  468. package/src/features/products/components/ProductDetailView.tsx +0 -52
  469. package/src/features/products/components/ProductFeatureBadges.tsx +0 -192
  470. package/src/features/products/components/ProductGrid.tsx +0 -424
  471. package/src/features/products/components/ProductInfo.tsx +0 -44
  472. package/src/features/products/components/ProductTabs.tsx +0 -84
  473. package/src/features/products/components/ProductsView.tsx +0 -48
  474. package/src/features/products/components/RelatedProducts.tsx +0 -51
  475. package/src/features/products/components/index.ts +0 -28
  476. package/src/features/products/hooks/useProductDetail.ts +0 -44
  477. package/src/features/products/hooks/useProducts.ts +0 -112
  478. package/src/features/products/index.ts +0 -9
  479. package/src/features/products/manifest.ts +0 -18
  480. package/src/features/products/messages/en.json +0 -11
  481. package/src/features/products/repository/products.repository.ts +0 -83
  482. package/src/features/products/schemas/index.ts +0 -185
  483. package/src/features/products/server.ts +0 -12
  484. package/src/features/products/types/index.ts +0 -142
  485. package/src/features/products/utils/listing-type.ts +0 -12
  486. package/src/features/promotions/api/route.ts +0 -105
  487. package/src/features/promotions/columns/index.ts +0 -60
  488. package/src/features/promotions/components/CouponCard.tsx +0 -79
  489. package/src/features/promotions/components/PromotionsView.tsx +0 -129
  490. package/src/features/promotions/components/index.ts +0 -7
  491. package/src/features/promotions/hooks/usePromotions.ts +0 -59
  492. package/src/features/promotions/index.ts +0 -7
  493. package/src/features/promotions/manifest.ts +0 -16
  494. package/src/features/promotions/messages/en.json +0 -20
  495. package/src/features/promotions/repository/promotions.repository.ts +0 -62
  496. package/src/features/promotions/schemas/index.ts +0 -63
  497. package/src/features/promotions/server.ts +0 -7
  498. package/src/features/promotions/types/index.ts +0 -65
  499. package/src/features/reviews/api/[id]/route.ts +0 -163
  500. package/src/features/reviews/api/route.ts +0 -216
  501. package/src/features/reviews/columns/index.ts +0 -57
  502. package/src/features/reviews/components/ReviewModal.tsx +0 -133
  503. package/src/features/reviews/components/ReviewSummary.tsx +0 -82
  504. package/src/features/reviews/components/ReviewsList.tsx +0 -182
  505. package/src/features/reviews/components/ReviewsListView.tsx +0 -100
  506. package/src/features/reviews/components/index.ts +0 -11
  507. package/src/features/reviews/hooks/useReviews.ts +0 -67
  508. package/src/features/reviews/index.ts +0 -7
  509. package/src/features/reviews/manifest.ts +0 -12
  510. package/src/features/reviews/messages/en.json +0 -10
  511. package/src/features/reviews/repository/reviews.repository.ts +0 -69
  512. package/src/features/reviews/schemas/index.ts +0 -74
  513. package/src/features/reviews/server.ts +0 -12
  514. package/src/features/reviews/types/index.ts +0 -68
  515. package/src/features/search/api/route.ts +0 -100
  516. package/src/features/search/columns/index.ts +0 -70
  517. package/src/features/search/components/SearchFiltersRow.tsx +0 -118
  518. package/src/features/search/components/SearchResultsSection.tsx +0 -195
  519. package/src/features/search/components/SearchView.tsx +0 -99
  520. package/src/features/search/components/index.ts +0 -6
  521. package/src/features/search/hooks/useSearch.ts +0 -41
  522. package/src/features/search/index.ts +0 -7
  523. package/src/features/search/manifest.ts +0 -12
  524. package/src/features/search/messages/en.json +0 -15
  525. package/src/features/search/repository/search.repository.ts +0 -64
  526. package/src/features/search/schemas/index.ts +0 -36
  527. package/src/features/search/server.ts +0 -3
  528. package/src/features/search/types/index.ts +0 -59
  529. package/src/features/seller/api/coupons/route.ts +0 -57
  530. package/src/features/seller/api/offers/route.ts +0 -73
  531. package/src/features/seller/api/products/route.ts +0 -75
  532. package/src/features/seller/api/store/route.ts +0 -41
  533. package/src/features/seller/columns/index.ts +0 -103
  534. package/src/features/seller/components/SellerAddressesView.tsx +0 -32
  535. package/src/features/seller/components/SellerAnalyticsView.tsx +0 -38
  536. package/src/features/seller/components/SellerAuctionsView.tsx +0 -48
  537. package/src/features/seller/components/SellerCouponsView.tsx +0 -48
  538. package/src/features/seller/components/SellerCreateProductView.tsx +0 -27
  539. package/src/features/seller/components/SellerDashboardView.tsx +0 -41
  540. package/src/features/seller/components/SellerEditProductView.tsx +0 -27
  541. package/src/features/seller/components/SellerGuideView.tsx +0 -34
  542. package/src/features/seller/components/SellerOffersView.tsx +0 -46
  543. package/src/features/seller/components/SellerOrdersView.tsx +0 -46
  544. package/src/features/seller/components/SellerPayoutHistoryTable.tsx +0 -44
  545. package/src/features/seller/components/SellerPayoutSettingsView.tsx +0 -27
  546. package/src/features/seller/components/SellerPayoutStats.tsx +0 -24
  547. package/src/features/seller/components/SellerPayoutsView.tsx +0 -46
  548. package/src/features/seller/components/SellerProductsView.tsx +0 -51
  549. package/src/features/seller/components/SellerShippingView.tsx +0 -30
  550. package/src/features/seller/components/SellerSidebar.tsx +0 -84
  551. package/src/features/seller/components/SellerStatCard.tsx +0 -44
  552. package/src/features/seller/components/SellerStoreSetupView.tsx +0 -31
  553. package/src/features/seller/components/SellerStoreView.tsx +0 -27
  554. package/src/features/seller/components/SellerStorefrontView.tsx +0 -49
  555. package/src/features/seller/components/SellersListView.tsx +0 -43
  556. package/src/features/seller/components/analytics/SellerAnalyticsStats.tsx +0 -87
  557. package/src/features/seller/components/analytics/SellerRevenueChart.tsx +0 -99
  558. package/src/features/seller/components/analytics/SellerTopProducts.tsx +0 -76
  559. package/src/features/seller/components/analytics/index.ts +0 -3
  560. package/src/features/seller/components/index.ts +0 -47
  561. package/src/features/seller/hooks/useSellerPayouts.ts +0 -51
  562. package/src/features/seller/hooks/useSellerStore.ts +0 -60
  563. package/src/features/seller/index.ts +0 -12
  564. package/src/features/seller/manifest.ts +0 -76
  565. package/src/features/seller/messages/en.json +0 -32
  566. package/src/features/seller/permission-map.ts +0 -18
  567. package/src/features/seller/repository/seller.repository.ts +0 -100
  568. package/src/features/seller/schemas/index.ts +0 -113
  569. package/src/features/seller/server.ts +0 -10
  570. package/src/features/seller/types/index.ts +0 -185
  571. package/src/features/stores/api/[storeSlug]/auctions/route.ts +0 -134
  572. package/src/features/stores/api/[storeSlug]/products/route.ts +0 -139
  573. package/src/features/stores/api/[storeSlug]/reviews/route.ts +0 -155
  574. package/src/features/stores/api/[storeSlug]/route.ts +0 -120
  575. package/src/features/stores/api/route.ts +0 -128
  576. package/src/features/stores/columns/index.ts +0 -58
  577. package/src/features/stores/components/StoreAboutView.tsx +0 -134
  578. package/src/features/stores/components/StoreAuctionsView.tsx +0 -46
  579. package/src/features/stores/components/StoreHeader.tsx +0 -115
  580. package/src/features/stores/components/StoreNavTabs.tsx +0 -77
  581. package/src/features/stores/components/StoreProductsView.tsx +0 -77
  582. package/src/features/stores/components/StoreReviewsView.tsx +0 -45
  583. package/src/features/stores/components/StoresListView.tsx +0 -142
  584. package/src/features/stores/components/index.ts +0 -12
  585. package/src/features/stores/hooks/useStores.ts +0 -130
  586. package/src/features/stores/index.ts +0 -7
  587. package/src/features/stores/manifest.ts +0 -37
  588. package/src/features/stores/messages/en.json +0 -21
  589. package/src/features/stores/repository/stores.repository.ts +0 -51
  590. package/src/features/stores/schemas/index.ts +0 -42
  591. package/src/features/stores/server.ts +0 -11
  592. package/src/features/stores/types/index.ts +0 -123
  593. package/src/features/user/components/BecomeSellerView.tsx +0 -36
  594. package/src/features/user/components/MessagesView.tsx +0 -37
  595. package/src/features/user/components/OrderDetailView.tsx +0 -36
  596. package/src/features/user/components/ProfileView.tsx +0 -33
  597. package/src/features/user/components/UserAccountHub.tsx +0 -30
  598. package/src/features/user/components/UserAddressesView.tsx +0 -32
  599. package/src/features/user/components/UserNotificationsView.tsx +0 -38
  600. package/src/features/user/components/UserOffersView.tsx +0 -35
  601. package/src/features/user/components/UserOrdersView.tsx +0 -39
  602. package/src/features/user/components/UserSettingsView.tsx +0 -31
  603. package/src/features/user/components/UserSidebar.tsx +0 -27
  604. package/src/features/user/components/index.ts +0 -22
  605. package/src/features/user/index.ts +0 -1
  606. package/src/features/whatsapp-bot/api/send-status/route.ts +0 -48
  607. package/src/features/whatsapp-bot/api/webhook/route.ts +0 -55
  608. package/src/features/whatsapp-bot/components/WhatsAppChatButton.tsx +0 -38
  609. package/src/features/whatsapp-bot/components/index.ts +0 -1
  610. package/src/features/whatsapp-bot/helpers/whatsapp.ts +0 -137
  611. package/src/features/whatsapp-bot/index.ts +0 -4
  612. package/src/features/whatsapp-bot/manifest.ts +0 -15
  613. package/src/features/whatsapp-bot/messages/en.json +0 -7
  614. package/src/features/whatsapp-bot/types/index.ts +0 -61
  615. package/src/features/wishlist/columns/index.ts +0 -65
  616. package/src/features/wishlist/components/WishlistPage.tsx +0 -118
  617. package/src/features/wishlist/components/WishlistToggleButton.tsx +0 -68
  618. package/src/features/wishlist/components/WishlistView.tsx +0 -150
  619. package/src/features/wishlist/components/index.ts +0 -4
  620. package/src/features/wishlist/hooks/useUserWishlist.ts +0 -39
  621. package/src/features/wishlist/hooks/useWishlist.ts +0 -31
  622. package/src/features/wishlist/index.ts +0 -8
  623. package/src/features/wishlist/manifest.ts +0 -14
  624. package/src/features/wishlist/messages/en.json +0 -7
  625. package/src/features/wishlist/repository/wishlist.repository.ts +0 -43
  626. package/src/features/wishlist/schemas/index.ts +0 -25
  627. package/src/features/wishlist/types/index.ts +0 -17
  628. package/src/http/ApiClient.ts +0 -247
  629. package/src/http/index.ts +0 -10
  630. package/src/index.ts +0 -22
  631. package/src/instrumentation/index.ts +0 -77
  632. package/src/monitoring/cache-metrics.ts +0 -105
  633. package/src/monitoring/client-logger.ts +0 -83
  634. package/src/monitoring/error-tracking.ts +0 -115
  635. package/src/monitoring/index.ts +0 -52
  636. package/src/monitoring/performance.ts +0 -64
  637. package/src/monitoring/runtime.ts +0 -33
  638. package/src/monitoring/server-logger.ts +0 -93
  639. package/src/next/IAuthVerifier.ts +0 -56
  640. package/src/next/api/api-response.ts +0 -72
  641. package/src/next/api/apiHandler.ts +0 -178
  642. package/src/next/api/errorHandler.ts +0 -125
  643. package/src/next/api/routeHandler.ts +0 -175
  644. package/src/next/cache-middleware.ts +0 -112
  645. package/src/next/components/ErrorView.tsx +0 -73
  646. package/src/next/components/GlobalError.tsx +0 -75
  647. package/src/next/components/NotFoundView.tsx +0 -56
  648. package/src/next/components/UnauthorizedView.tsx +0 -61
  649. package/src/next/index.ts +0 -82
  650. package/src/next/middleware/chain.ts +0 -117
  651. package/src/next/middleware/index.ts +0 -14
  652. package/src/next/middleware/pii-redactor.ts +0 -112
  653. package/src/next/middleware/pii-scrubber.ts +0 -56
  654. package/src/next/middleware/types.ts +0 -26
  655. package/src/next/request-helpers.ts +0 -76
  656. package/src/next/routing/route-map.ts +0 -221
  657. package/src/providers/auth-firebase/browser-stub.ts +0 -32
  658. package/src/providers/auth-firebase/helpers.ts +0 -150
  659. package/src/providers/auth-firebase/index.ts +0 -26
  660. package/src/providers/auth-firebase/provider.ts +0 -163
  661. package/src/providers/auth-firebase/session.ts +0 -111
  662. package/src/providers/db-firebase/admin-app-lite.ts +0 -66
  663. package/src/providers/db-firebase/admin-auth-lite.ts +0 -16
  664. package/src/providers/db-firebase/admin-storage-lite.ts +0 -19
  665. package/src/providers/db-firebase/admin.ts +0 -217
  666. package/src/providers/db-firebase/base.ts +0 -243
  667. package/src/providers/db-firebase/browser-stub.ts +0 -47
  668. package/src/providers/db-firebase/helpers.ts +0 -88
  669. package/src/providers/db-firebase/index.ts +0 -60
  670. package/src/providers/db-firebase/realtime.ts +0 -185
  671. package/src/providers/db-firebase/sieve.ts +0 -136
  672. package/src/providers/email-resend/index.ts +0 -16
  673. package/src/providers/email-resend/provider.ts +0 -103
  674. package/src/providers/payment-razorpay/index.ts +0 -165
  675. package/src/providers/shipping-shiprocket/index.ts +0 -402
  676. package/src/providers/storage-firebase/index.ts +0 -17
  677. package/src/providers/storage-firebase/provider.ts +0 -131
  678. package/src/react/ErrorBoundary.tsx +0 -130
  679. package/src/react/hooks/useBreakpoint.ts +0 -41
  680. package/src/react/hooks/useBulkAction.ts +0 -161
  681. package/src/react/hooks/useBulkSelection.ts +0 -119
  682. package/src/react/hooks/useCamera.ts +0 -191
  683. package/src/react/hooks/useClickOutside.ts +0 -87
  684. package/src/react/hooks/useContainerGrid.ts +0 -77
  685. package/src/react/hooks/useCountdown.ts +0 -73
  686. package/src/react/hooks/useGesture.ts +0 -255
  687. package/src/react/hooks/useKeyPress.ts +0 -113
  688. package/src/react/hooks/useLongPress.ts +0 -62
  689. package/src/react/hooks/useMediaQuery.ts +0 -40
  690. package/src/react/hooks/usePendingFilters.ts +0 -138
  691. package/src/react/hooks/usePendingTable.ts +0 -84
  692. package/src/react/hooks/usePullToRefresh.ts +0 -111
  693. package/src/react/hooks/useSwipe.ts +0 -240
  694. package/src/react/hooks/useUnsavedChanges.ts +0 -104
  695. package/src/react/hooks/useUrlTable.ts +0 -189
  696. package/src/react/hooks/useVisibleItems.ts +0 -110
  697. package/src/react/index.ts +0 -99
  698. package/src/react/useModalStack.ts +0 -86
  699. package/src/security/authorization.ts +0 -92
  700. package/src/security/csp.ts +0 -44
  701. package/src/security/index.ts +0 -50
  702. package/src/security/pii-encrypt.ts +0 -117
  703. package/src/security/pii-redact.ts +0 -133
  704. package/src/security/rate-limit.ts +0 -170
  705. package/src/security/rbac/Can.tsx +0 -50
  706. package/src/security/rbac/default-roles.ts +0 -86
  707. package/src/security/rbac/hook.ts +0 -55
  708. package/src/security/rbac/index.ts +0 -14
  709. package/src/security/rbac/middleware.ts +0 -103
  710. package/src/security/rbac/resolver.ts +0 -69
  711. package/src/security/rbac/server.ts +0 -52
  712. package/src/security/rbac/types.ts +0 -27
  713. package/src/seed/defaults/categories.ts +0 -13
  714. package/src/seed/defaults/faqs.ts +0 -40
  715. package/src/seed/defaults/homepage-sections.ts +0 -63
  716. package/src/seed/factories/address.factory.ts +0 -106
  717. package/src/seed/factories/bid.factory.ts +0 -50
  718. package/src/seed/factories/blog-post.factory.ts +0 -40
  719. package/src/seed/factories/carousel.factory.ts +0 -30
  720. package/src/seed/factories/cart.factory.ts +0 -66
  721. package/src/seed/factories/category.factory.ts +0 -30
  722. package/src/seed/factories/coupon.factory.ts +0 -67
  723. package/src/seed/factories/faq.factory.ts +0 -28
  724. package/src/seed/factories/homepage-section.factory.ts +0 -35
  725. package/src/seed/factories/notification.factory.ts +0 -68
  726. package/src/seed/factories/order.factory.ts +0 -43
  727. package/src/seed/factories/payout.factory.ts +0 -62
  728. package/src/seed/factories/product.factory.ts +0 -120
  729. package/src/seed/factories/review.factory.ts +0 -67
  730. package/src/seed/factories/session.factory.ts +0 -49
  731. package/src/seed/factories/store.factory.ts +0 -69
  732. package/src/seed/factories/user.factory.ts +0 -88
  733. package/src/seed/index.ts +0 -84
  734. package/src/seed/runner.ts +0 -57
  735. package/src/seed/test-utils.ts +0 -155
  736. package/src/seed/types.ts +0 -40
  737. package/src/seo/index.ts +0 -2
  738. package/src/seo/json-ld.ts +0 -241
  739. package/src/seo/metadata.ts +0 -302
  740. package/src/style/tailwind/index.ts +0 -66
  741. package/src/style/vanilla/index.ts +0 -57
  742. package/src/tokens/index.ts +0 -864
  743. package/src/tokens/tokens.css +0 -221
  744. package/src/ui/DataTable.tsx +0 -655
  745. package/src/ui/animation.helper.ts +0 -20
  746. package/src/ui/color.helper.ts +0 -37
  747. package/src/ui/components/Accordion.tsx +0 -189
  748. package/src/ui/components/ActiveFilterChips.tsx +0 -81
  749. package/src/ui/components/Alert.tsx +0 -167
  750. package/src/ui/components/Badge.tsx +0 -65
  751. package/src/ui/components/Breadcrumb.tsx +0 -61
  752. package/src/ui/components/BulkActionBar.tsx +0 -246
  753. package/src/ui/components/Button.tsx +0 -75
  754. package/src/ui/components/CountdownDisplay.tsx +0 -87
  755. package/src/ui/components/DescriptionField.tsx +0 -55
  756. package/src/ui/components/Div.tsx +0 -29
  757. package/src/ui/components/Divider.tsx +0 -52
  758. package/src/ui/components/Drawer.tsx +0 -178
  759. package/src/ui/components/Form.tsx +0 -25
  760. package/src/ui/components/FormGrid.tsx +0 -82
  761. package/src/ui/components/HorizontalScroller.tsx +0 -183
  762. package/src/ui/components/IconButton.tsx +0 -71
  763. package/src/ui/components/ImageLightbox.tsx +0 -187
  764. package/src/ui/components/Input.tsx +0 -17
  765. package/src/ui/components/ItemRow.tsx +0 -38
  766. package/src/ui/components/Layout.tsx +0 -391
  767. package/src/ui/components/ListingLayout.tsx +0 -514
  768. package/src/ui/components/Modal.tsx +0 -162
  769. package/src/ui/components/Pagination.tsx +0 -182
  770. package/src/ui/components/PriceDisplay.tsx +0 -63
  771. package/src/ui/components/Progress.tsx +0 -154
  772. package/src/ui/components/RatingDisplay.tsx +0 -56
  773. package/src/ui/components/Select.tsx +0 -221
  774. package/src/ui/components/Semantic.tsx +0 -257
  775. package/src/ui/components/SideModal.tsx +0 -137
  776. package/src/ui/components/Skeleton.tsx +0 -82
  777. package/src/ui/components/Slider.tsx +0 -35
  778. package/src/ui/components/SortDropdown.tsx +0 -43
  779. package/src/ui/components/Spinner.tsx +0 -48
  780. package/src/ui/components/StarRating.tsx +0 -85
  781. package/src/ui/components/StatsGrid.tsx +0 -56
  782. package/src/ui/components/StatusBadge.tsx +0 -130
  783. package/src/ui/components/StepperNav.tsx +0 -89
  784. package/src/ui/components/SummaryCard.tsx +0 -66
  785. package/src/ui/components/TabStrip.tsx +0 -142
  786. package/src/ui/components/TablePagination.tsx +0 -134
  787. package/src/ui/components/TagInput.tsx +0 -133
  788. package/src/ui/components/TextLink.tsx +0 -68
  789. package/src/ui/components/Textarea.tsx +0 -17
  790. package/src/ui/components/Tooltip.tsx +0 -190
  791. package/src/ui/components/Typography.tsx +0 -270
  792. package/src/ui/components/ViewToggle.tsx +0 -133
  793. package/src/ui/index.ts +0 -248
  794. package/src/ui/rich-text/RichText.tsx +0 -243
  795. package/src/ui/rich-text/index.ts +0 -2
  796. package/src/ui/style.helper.ts +0 -18
  797. package/src/utils/animation.helper.ts +0 -22
  798. package/src/utils/array.helper.ts +0 -73
  799. package/src/utils/color.helper.ts +0 -57
  800. package/src/utils/cookie.converter.ts +0 -32
  801. package/src/utils/date.formatter.ts +0 -228
  802. package/src/utils/event-manager.ts +0 -168
  803. package/src/utils/filter.helper.ts +0 -24
  804. package/src/utils/id-generators.ts +0 -629
  805. package/src/utils/index.ts +0 -31
  806. package/src/utils/media-field.ts +0 -13
  807. package/src/utils/number.formatter.ts +0 -107
  808. package/src/utils/object.helper.ts +0 -111
  809. package/src/utils/pagination.helper.ts +0 -46
  810. package/src/utils/sorting.helper.ts +0 -21
  811. package/src/utils/string.formatter.ts +0 -178
  812. package/src/utils/type.converter.ts +0 -86
  813. package/src/validation/email.validator.ts +0 -37
  814. package/src/validation/index.ts +0 -17
  815. package/src/validation/input.validator.ts +0 -38
  816. package/src/validation/password.validator.ts +0 -97
  817. package/src/validation/phone.validator.ts +0 -38
  818. package/src/validation/schemas.ts +0 -106
  819. package/src/validation/url.validator.ts +0 -46
  820. package/src/validation/zod-error-map.ts +0 -96
@@ -1,138 +0,0 @@
1
- "use client";
2
-
3
- import { useCallback, useMemo, useState } from "react";
4
- import type { useUrlTable } from "./useUrlTable";
5
-
6
- type UrlTable = ReturnType<typeof useUrlTable>;
7
-
8
- export interface UsePendingFiltersOptions {
9
- /** The page's useUrlTable instance */
10
- table: UrlTable;
11
- /** URL param keys to manage (e.g. ['status', 'category', 'role']) */
12
- keys: string[];
13
- }
14
-
15
- export interface UsePendingFiltersReturn {
16
- /** Current uncommitted selections per key (string[] per key) */
17
- pending: Record<string, string[]>;
18
- /** Values currently in the URL (committed) per key */
19
- applied: Record<string, string[]>;
20
- /** true when pending differs from applied */
21
- isDirty: boolean;
22
- /** Total number of selected values across all pending keys */
23
- pendingCount: number;
24
- /** Total number of selected values in the URL (for badge display) */
25
- appliedCount: number;
26
- /** Update one key in pending state (does NOT write to URL) */
27
- set: (key: string, values: string[]) => void;
28
- /** Write all pending keys to the URL (resets page to 1) */
29
- apply: () => void;
30
- /** Discard pending, revert to applied (URL) state */
31
- reset: () => void;
32
- /** Clear all keys in both pending state and the URL */
33
- clear: () => void;
34
- }
35
-
36
- /**
37
- * usePendingFilters
38
- *
39
- * Manages local (uncommitted) filter state for a FilterDrawer or any deferred
40
- * filter panel. Values are only written to the URL when `apply()` is called.
41
- *
42
- * Initialised from the current URL params on mount, so opening a drawer
43
- * pre-fills any already-applied filters.
44
- *
45
- * @example
46
- * ```ts
47
- * const table = useUrlTable({ defaults: { pageSize: '25' } });
48
- * const filters = usePendingFilters({ table, keys: ['status', 'category'] });
49
- *
50
- * <FilterDrawer
51
- * onApply={() => { filters.apply(); setDrawerOpen(false); }}
52
- * onReset={() => filters.clear()}
53
- * activeCount={filters.appliedCount}
54
- * >
55
- * <FilterFacetSection
56
- * title="Status"
57
- * options={STATUS_OPTIONS}
58
- * selected={filters.pending['status'] ?? []}
59
- * onChange={(v) => filters.set('status', v)}
60
- * />
61
- * </FilterDrawer>
62
- * ```
63
- */
64
- export function usePendingFilters({
65
- table,
66
- keys,
67
- }: UsePendingFiltersOptions): UsePendingFiltersReturn {
68
- const parseValues = useCallback(
69
- (key: string): string[] => {
70
- const raw = table.get(key);
71
- return raw ? raw.split(",").filter(Boolean) : [];
72
- },
73
- [table],
74
- );
75
-
76
- const [pending, setPending] = useState<Record<string, string[]>>(() =>
77
- Object.fromEntries(keys.map((k) => [k, parseValues(k)])),
78
- );
79
-
80
- const applied = useMemo<Record<string, string[]>>(
81
- () => Object.fromEntries(keys.map((k) => [k, parseValues(k)])),
82
- [keys, parseValues],
83
- );
84
-
85
- const pendingCount = useMemo(
86
- () => Object.values(pending).reduce((sum, arr) => sum + arr.length, 0),
87
- [pending],
88
- );
89
-
90
- const appliedCount = useMemo(
91
- () => Object.values(applied).reduce((sum, arr) => sum + arr.length, 0),
92
- [applied],
93
- );
94
-
95
- const isDirty = useMemo(() => {
96
- return keys.some((k) => {
97
- const p = (pending[k] ?? []).slice().sort();
98
- const a = (applied[k] ?? []).slice().sort();
99
- return p.length !== a.length || p.some((v, i) => v !== a[i]);
100
- });
101
- }, [keys, pending, applied]);
102
-
103
- const set = useCallback((key: string, values: string[]) => {
104
- setPending((prev) => ({ ...prev, [key]: values }));
105
- }, []);
106
-
107
- const apply = useCallback(() => {
108
- const updates: Record<string, string> = { page: "1" };
109
- for (const k of keys) {
110
- updates[k] = (pending[k] ?? []).join(",");
111
- }
112
- table.setMany(updates);
113
- }, [keys, pending, table]);
114
-
115
- const reset = useCallback(() => {
116
- setPending(Object.fromEntries(keys.map((k) => [k, parseValues(k)])));
117
- }, [keys, parseValues]);
118
-
119
- const clear = useCallback(() => {
120
- const empty = Object.fromEntries(keys.map((k) => [k, [] as string[]]));
121
- setPending(empty);
122
- const updates: Record<string, string> = { page: "1" };
123
- for (const k of keys) updates[k] = "";
124
- table.setMany(updates);
125
- }, [keys, table]);
126
-
127
- return {
128
- pending,
129
- applied,
130
- isDirty,
131
- pendingCount,
132
- appliedCount,
133
- set,
134
- apply,
135
- reset,
136
- clear,
137
- };
138
- }
@@ -1,84 +0,0 @@
1
- "use client";
2
-
3
- import { useMemo } from "react";
4
- import { usePendingFilters } from "./usePendingFilters";
5
- import type { useUrlTable } from "./useUrlTable";
6
-
7
- type UrlTable = ReturnType<typeof useUrlTable>;
8
-
9
- /**
10
- * Minimal UrlTable-compatible interface consumed by *Filters components.
11
- */
12
- export interface PendingTable {
13
- get: (key: string) => string;
14
- set: (key: string, value: string) => void;
15
- setMany: (updates: Record<string, string>) => void;
16
- }
17
-
18
- export interface UsePendingTableReturn {
19
- /** Drop-in UrlTable replacement that reads/writes to pending state */
20
- pendingTable: PendingTable;
21
- /** Count of applied (URL) filter values — use for the filter badge */
22
- filterActiveCount: number;
23
- /** Commit all pending changes to the URL (resets page to 1) */
24
- onFilterApply: () => void;
25
- /** Clear all filter keys from pending state and URL */
26
- onFilterClear: () => void;
27
- /**
28
- * Revert pending state to the current URL values without clearing them.
29
- * Call this when opening a filter drawer to ensure it shows the last
30
- * committed state, even if the URL changed externally (e.g. a status tab).
31
- */
32
- onFilterReset: () => void;
33
- }
34
-
35
- /**
36
- * usePendingTable
37
- *
38
- * A thin wrapper around `usePendingFilters` that exposes a `pendingTable`
39
- * object matching the `UrlTable` interface (`get`, `set`, `setMany`).
40
- *
41
- * Drop this into any listing view to replace the per-filter `useState` +
42
- * `handleFilterApply` + `handleFilterClear` boilerplate.
43
- *
44
- * @example
45
- * ```tsx
46
- * const { pendingTable, filterActiveCount, onFilterApply, onFilterClear } =
47
- * usePendingTable(table, ['status', 'category', 'minPrice', 'maxPrice']);
48
- *
49
- * // Pass pendingTable directly to any *Filters component:
50
- * filterContent={<ProductFilters table={pendingTable} showStatus />}
51
- * filterActiveCount={filterActiveCount}
52
- * onFilterApply={onFilterApply}
53
- * onFilterClear={onFilterClear}
54
- * ```
55
- */
56
- export function usePendingTable(
57
- table: UrlTable,
58
- keys: string[],
59
- ): UsePendingTableReturn {
60
- const filters = usePendingFilters({ table, keys });
61
-
62
- const pendingTable = useMemo<PendingTable>(
63
- () => ({
64
- get: (key: string): string => filters.pending[key]?.[0] ?? "",
65
- set: (key: string, value: string): void => {
66
- filters.set(key, value ? [value] : []);
67
- },
68
- setMany: (updates: Record<string, string>): void => {
69
- for (const [k, v] of Object.entries(updates)) {
70
- filters.set(k, v ? [v] : []);
71
- }
72
- },
73
- }),
74
- [filters.pending, filters.set],
75
- );
76
-
77
- return {
78
- pendingTable,
79
- filterActiveCount: filters.appliedCount,
80
- onFilterApply: filters.apply,
81
- onFilterClear: filters.clear,
82
- onFilterReset: filters.reset,
83
- };
84
- }
@@ -1,111 +0,0 @@
1
- "use client";
2
-
3
- import { useRef, useState, useCallback, useEffect, RefObject } from "react";
4
-
5
- export interface UsePullToRefreshOptions {
6
- /** Distance in px the user must pull before onRefresh triggers (default: 80) */
7
- threshold?: number;
8
- }
9
-
10
- export interface UsePullToRefreshReturn {
11
- /** Attach to the scrollable container element */
12
- containerRef: RefObject<HTMLDivElement | null>;
13
- /** `true` while the user is actively pulling */
14
- isPulling: boolean;
15
- /** Pull progress from 0 (not started) to 1 (threshold reached) */
16
- progress: number;
17
- }
18
-
19
- /**
20
- * usePullToRefresh Hook
21
- *
22
- * Attaches touch event listeners to `containerRef`.
23
- * When the user overscrolls from the very top and pulls down past `threshold`,
24
- * `onRefresh` is called. Progress (0–1) can be used to render a loading indicator.
25
- *
26
- * @param onRefresh - Async function called when pull threshold is reached
27
- * @param options - Configuration: `threshold` in px (default 80)
28
- *
29
- * @example
30
- * ```tsx
31
- * const { containerRef, isPulling, progress } = usePullToRefresh(async () => {
32
- * await refetchOrders();
33
- * });
34
- *
35
- * return (
36
- * <div ref={containerRef} className="overflow-y-auto">
37
- * {isPulling && <PullIndicator progress={progress} />}
38
- * {…}
39
- * </div>
40
- * );
41
- * ```
42
- */
43
- export function usePullToRefresh(
44
- onRefresh: () => Promise<void>,
45
- options: UsePullToRefreshOptions = {},
46
- ): UsePullToRefreshReturn {
47
- const { threshold = 80 } = options;
48
-
49
- const containerRef = useRef<HTMLDivElement>(null);
50
- const [isPulling, setIsPulling] = useState(false);
51
- const [progress, setProgress] = useState(0);
52
-
53
- const startYRef = useRef<number | null>(null);
54
- const thresholdReachedRef = useRef(false);
55
- const onRefreshRef = useRef(onRefresh);
56
-
57
- useEffect(() => {
58
- onRefreshRef.current = onRefresh;
59
- }, [onRefresh]);
60
-
61
- const handleTouchStart = useCallback((e: TouchEvent) => {
62
- const el = containerRef.current;
63
- if (!el || el.scrollTop > 0) return;
64
- startYRef.current = e.touches[0].clientY;
65
- thresholdReachedRef.current = false;
66
- }, []);
67
-
68
- const handleTouchMove = useCallback(
69
- (e: TouchEvent) => {
70
- if (startYRef.current === null) return;
71
- const delta = e.touches[0].clientY - startYRef.current;
72
- if (delta <= 0) {
73
- setProgress(0);
74
- setIsPulling(false);
75
- return;
76
- }
77
- const prog = Math.min(delta / threshold, 1);
78
- setProgress(prog);
79
- setIsPulling(true);
80
- thresholdReachedRef.current = prog >= 1;
81
- },
82
- [threshold],
83
- );
84
-
85
- const handleTouchEnd = useCallback(async () => {
86
- setIsPulling(false);
87
- setProgress(0);
88
- startYRef.current = null;
89
- if (thresholdReachedRef.current) {
90
- thresholdReachedRef.current = false;
91
- await onRefreshRef.current();
92
- }
93
- }, []);
94
-
95
- useEffect(() => {
96
- const el = containerRef.current;
97
- if (!el) return;
98
-
99
- el.addEventListener("touchstart", handleTouchStart, { passive: true });
100
- el.addEventListener("touchmove", handleTouchMove, { passive: true });
101
- el.addEventListener("touchend", handleTouchEnd);
102
-
103
- return () => {
104
- el.removeEventListener("touchstart", handleTouchStart);
105
- el.removeEventListener("touchmove", handleTouchMove);
106
- el.removeEventListener("touchend", handleTouchEnd);
107
- };
108
- }, [handleTouchStart, handleTouchMove, handleTouchEnd]);
109
-
110
- return { containerRef, isPulling, progress };
111
- }
@@ -1,240 +0,0 @@
1
- "use client";
2
-
3
- import { useRef, useEffect, RefObject } from "react";
4
-
5
- /**
6
- * Swipe direction types
7
- */
8
- export type SwipeDirection = "left" | "right" | "up" | "down";
9
-
10
- /**
11
- * Configuration options for useSwipe hook
12
- */
13
- export interface UseSwipeOptions {
14
- /** Minimum distance in pixels to register as a swipe (default: 50) */
15
- minSwipeDistance?: number;
16
- /** Maximum time in ms for a swipe gesture (default: 300) */
17
- maxSwipeTime?: number;
18
- /** Threshold for swipe velocity (pixels/ms, default: 0.3) */
19
- velocityThreshold?: number;
20
- /** Callback when swipe is detected */
21
- onSwipe?: (
22
- direction: SwipeDirection,
23
- distance: number,
24
- velocity: number,
25
- ) => void;
26
- /** Callback for specific directions */
27
- onSwipeLeft?: (distance: number, velocity: number) => void;
28
- onSwipeRight?: (distance: number, velocity: number) => void;
29
- onSwipeUp?: (distance: number, velocity: number) => void;
30
- onSwipeDown?: (distance: number, velocity: number) => void;
31
- /** Callback during swipe (for dragging effect) */
32
- onSwiping?: (deltaX: number, deltaY: number) => void;
33
- /** Callback when swipe starts */
34
- onSwipeStart?: () => void;
35
- /** Callback when swipe ends (regardless of direction detected) */
36
- onSwipeEnd?: () => void;
37
- /** Prevent default behavior during touch */
38
- preventDefault?: boolean;
39
- }
40
-
41
- /**
42
- * useSwipe Hook
43
- *
44
- * Detects swipe gestures on touch and mouse events.
45
- * Works on both mobile (touch) and desktop (mouse drag).
46
- *
47
- * @param ref - Reference to the element to attach swipe handlers
48
- * @param options - Configuration options for swipe detection
49
- *
50
- * @example
51
- * ```tsx
52
- * const ref = useRef<HTMLDivElement>(null);
53
- *
54
- * useSwipe(ref, {
55
- * onSwipeLeft: () => console.log('Swiped left'),
56
- * onSwipeRight: () => console.log('Swiped right'),
57
- * minSwipeDistance: 100,
58
- * });
59
- *
60
- * return <div ref={ref}>Swipe me!</div>;
61
- * ```
62
- */
63
- export function useSwipe<T extends HTMLElement = HTMLElement>(
64
- ref: RefObject<T | null>,
65
- options: UseSwipeOptions = {},
66
- ) {
67
- const {
68
- minSwipeDistance = 50,
69
- maxSwipeTime = 300,
70
- velocityThreshold = 0.3,
71
- onSwipe,
72
- onSwipeLeft,
73
- onSwipeRight,
74
- onSwipeUp,
75
- onSwipeDown,
76
- onSwiping,
77
- onSwipeStart,
78
- onSwipeEnd,
79
- preventDefault = false,
80
- } = options;
81
-
82
- const touchStartRef = useRef<{ x: number; y: number; time: number } | null>(
83
- null,
84
- );
85
- const isSwiping = useRef(false);
86
-
87
- const onSwipeRef = useRef(onSwipe);
88
- const onSwipeLeftRef = useRef(onSwipeLeft);
89
- const onSwipeRightRef = useRef(onSwipeRight);
90
- const onSwipeUpRef = useRef(onSwipeUp);
91
- const onSwipeDownRef = useRef(onSwipeDown);
92
- const onSwipingRef = useRef(onSwiping);
93
- const onSwipeStartRef = useRef(onSwipeStart);
94
- const onSwipeEndRef = useRef(onSwipeEnd);
95
-
96
- useEffect(() => {
97
- onSwipeRef.current = onSwipe;
98
- }, [onSwipe]);
99
- useEffect(() => {
100
- onSwipeLeftRef.current = onSwipeLeft;
101
- }, [onSwipeLeft]);
102
- useEffect(() => {
103
- onSwipeRightRef.current = onSwipeRight;
104
- }, [onSwipeRight]);
105
- useEffect(() => {
106
- onSwipeUpRef.current = onSwipeUp;
107
- }, [onSwipeUp]);
108
- useEffect(() => {
109
- onSwipeDownRef.current = onSwipeDown;
110
- }, [onSwipeDown]);
111
- useEffect(() => {
112
- onSwipingRef.current = onSwiping;
113
- }, [onSwiping]);
114
- useEffect(() => {
115
- onSwipeStartRef.current = onSwipeStart;
116
- }, [onSwipeStart]);
117
- useEffect(() => {
118
- onSwipeEndRef.current = onSwipeEnd;
119
- }, [onSwipeEnd]);
120
-
121
- useEffect(() => {
122
- const element = ref.current;
123
- if (!element) return;
124
-
125
- const processSwipe = (
126
- deltaX: number,
127
- deltaY: number,
128
- deltaTime: number,
129
- ) => {
130
- const absX = Math.abs(deltaX);
131
- const absY = Math.abs(deltaY);
132
- const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
133
- const velocity = distance / deltaTime;
134
-
135
- if (
136
- distance < minSwipeDistance ||
137
- deltaTime > maxSwipeTime ||
138
- velocity < velocityThreshold
139
- )
140
- return;
141
-
142
- let direction: SwipeDirection;
143
- if (absX > absY) {
144
- direction = deltaX > 0 ? "right" : "left";
145
- if (direction === "left") onSwipeLeftRef.current?.(distance, velocity);
146
- else onSwipeRightRef.current?.(distance, velocity);
147
- } else {
148
- direction = deltaY > 0 ? "down" : "up";
149
- if (direction === "up") onSwipeUpRef.current?.(distance, velocity);
150
- else onSwipeDownRef.current?.(distance, velocity);
151
- }
152
- onSwipeRef.current?.(direction, distance, velocity);
153
- };
154
-
155
- const handleTouchStart = (e: TouchEvent) => {
156
- if (preventDefault) e.preventDefault();
157
- const touch = e.touches[0];
158
- touchStartRef.current = {
159
- x: touch.clientX,
160
- y: touch.clientY,
161
- time: Date.now(),
162
- };
163
- isSwiping.current = true;
164
- onSwipeStartRef.current?.();
165
- };
166
-
167
- const handleTouchMove = (e: TouchEvent) => {
168
- if (!touchStartRef.current || !isSwiping.current) return;
169
- if (preventDefault) e.preventDefault();
170
- onSwipingRef.current?.(
171
- e.touches[0].clientX - touchStartRef.current.x,
172
- e.touches[0].clientY - touchStartRef.current.y,
173
- );
174
- };
175
-
176
- const handleTouchEnd = (e: TouchEvent) => {
177
- if (!touchStartRef.current || !isSwiping.current) return;
178
- if (preventDefault) e.preventDefault();
179
- const touch = e.changedTouches[0];
180
- processSwipe(
181
- touch.clientX - touchStartRef.current.x,
182
- touch.clientY - touchStartRef.current.y,
183
- Date.now() - touchStartRef.current.time,
184
- );
185
- touchStartRef.current = null;
186
- isSwiping.current = false;
187
- onSwipeEndRef.current?.();
188
- };
189
-
190
- const handleMouseDown = (e: MouseEvent) => {
191
- if (preventDefault) e.preventDefault();
192
- touchStartRef.current = { x: e.clientX, y: e.clientY, time: Date.now() };
193
- isSwiping.current = true;
194
- onSwipeStartRef.current?.();
195
- };
196
-
197
- const handleMouseMove = (e: MouseEvent) => {
198
- if (!touchStartRef.current || !isSwiping.current) return;
199
- onSwipingRef.current?.(
200
- e.clientX - touchStartRef.current.x,
201
- e.clientY - touchStartRef.current.y,
202
- );
203
- };
204
-
205
- const handleMouseUp = (e: MouseEvent) => {
206
- if (!touchStartRef.current || !isSwiping.current) return;
207
- if (preventDefault) e.preventDefault();
208
- processSwipe(
209
- e.clientX - touchStartRef.current.x,
210
- e.clientY - touchStartRef.current.y,
211
- Date.now() - touchStartRef.current.time,
212
- );
213
- touchStartRef.current = null;
214
- isSwiping.current = false;
215
- onSwipeEndRef.current?.();
216
- };
217
-
218
- element.addEventListener("touchstart", handleTouchStart, {
219
- passive: !preventDefault,
220
- });
221
- element.addEventListener("touchmove", handleTouchMove, {
222
- passive: !preventDefault,
223
- });
224
- element.addEventListener("touchend", handleTouchEnd, {
225
- passive: !preventDefault,
226
- });
227
- element.addEventListener("mousedown", handleMouseDown);
228
- document.addEventListener("mousemove", handleMouseMove);
229
- document.addEventListener("mouseup", handleMouseUp);
230
-
231
- return () => {
232
- element.removeEventListener("touchstart", handleTouchStart);
233
- element.removeEventListener("touchmove", handleTouchMove);
234
- element.removeEventListener("touchend", handleTouchEnd);
235
- element.removeEventListener("mousedown", handleMouseDown);
236
- document.removeEventListener("mousemove", handleMouseMove);
237
- document.removeEventListener("mouseup", handleMouseUp);
238
- };
239
- }, [ref, minSwipeDistance, maxSwipeTime, velocityThreshold, preventDefault]);
240
- }
@@ -1,104 +0,0 @@
1
- "use client";
2
-
3
- import { useState, useEffect, useCallback, useRef } from "react";
4
-
5
- export const UNSAVED_CHANGES_EVENT = "unsaved-changes:confirm";
6
-
7
- export interface UseUnsavedChangesOptions {
8
- /** Current form values to compare against initial */
9
- formValues: Record<string, string>;
10
- /** Initial form values snapshot (taken when data loads) */
11
- initialValues: Record<string, string> | null;
12
- /** Additional dirty flag from outside the form (e.g. pending avatar upload) */
13
- extraDirty?: boolean;
14
- /**
15
- * Called when the user attempts to navigate away with unsaved changes.
16
- * Must return a Promise that resolves to `true` (continue) or `false` (stay).
17
- * Defaults to `window.confirm` with a generic message.
18
- */
19
- confirmFn?: () => Promise<boolean>;
20
- /**
21
- * Message shown in the browser-native `beforeunload` dialog.
22
- * Most modern browsers ignore custom messages and show their own text.
23
- */
24
- beforeUnloadWarning?: string;
25
- }
26
-
27
- export interface UseUnsavedChangesReturn {
28
- /** Whether there are any unsaved changes (form or extra) */
29
- isDirty: boolean;
30
- /** Whether the form fields specifically have changed */
31
- isFormDirty: boolean;
32
- /** Call after a successful save to reset initial values to current */
33
- markClean: () => void;
34
- /** Prompt the user and return true if they confirmed leaving, false otherwise */
35
- confirmLeave: () => Promise<boolean>;
36
- }
37
-
38
- /**
39
- * useUnsavedChanges
40
- *
41
- * Tracks unsaved form changes and warns users before navigating away.
42
- *
43
- * - Compares `formValues` to `initialValues` to detect form dirtiness
44
- * - Accepts an optional `extraDirty` flag (e.g. pending file upload)
45
- * - Registers a `beforeunload` handler while dirty
46
- * - Exposes `confirmLeave()` which calls the provided `confirmFn` (or falls back
47
- * to `window.confirm`) to handle navigation guards
48
- * - `markClean()` resets the snapshot after a successful save
49
- */
50
- export function useUnsavedChanges({
51
- formValues,
52
- initialValues,
53
- extraDirty = false,
54
- confirmFn,
55
- beforeUnloadWarning = "You have unsaved changes. Leave?",
56
- }: UseUnsavedChangesOptions): UseUnsavedChangesReturn {
57
- const [savedSnapshot, setSavedSnapshot] = useState<Record<
58
- string,
59
- string
60
- > | null>(initialValues);
61
- const savedSnapshotRef = useRef(savedSnapshot);
62
- savedSnapshotRef.current = savedSnapshot;
63
-
64
- // Sync snapshot when initialValues first arrives (data load)
65
- useEffect(() => {
66
- if (initialValues && !savedSnapshotRef.current) {
67
- setSavedSnapshot(initialValues);
68
- }
69
- }, [initialValues]);
70
-
71
- const isFormDirty = (() => {
72
- if (!savedSnapshot) return false;
73
- return Object.keys(formValues).some(
74
- (key) => (formValues[key] ?? "") !== (savedSnapshot[key] ?? ""),
75
- );
76
- })();
77
-
78
- const isDirty = isFormDirty || extraDirty;
79
-
80
- useEffect(() => {
81
- if (!isDirty) return;
82
- const handler = (e: BeforeUnloadEvent) => {
83
- e.preventDefault();
84
- e.returnValue = beforeUnloadWarning;
85
- return beforeUnloadWarning;
86
- };
87
- window.addEventListener("beforeunload", handler);
88
- return () => window.removeEventListener("beforeunload", handler);
89
- }, [isDirty, beforeUnloadWarning]);
90
-
91
- const markClean = useCallback(() => {
92
- setSavedSnapshot({ ...formValues });
93
- }, [formValues]);
94
-
95
- const confirmLeave = useCallback((): Promise<boolean> => {
96
- if (!isDirty) return Promise.resolve(true);
97
- if (confirmFn) return confirmFn();
98
- return Promise.resolve(
99
- window.confirm("You have unsaved changes. Leave without saving?"),
100
- );
101
- }, [isDirty, confirmFn]);
102
-
103
- return { isDirty, isFormDirty, markClean, confirmLeave };
104
- }