hazo_auth 1.4.2 → 1.6.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 (320) hide show
  1. package/SETUP_CHECKLIST.md +708 -0
  2. package/dist/app/api/hazo_auth/change_password/route.d.ts +8 -0
  3. package/dist/app/api/hazo_auth/change_password/route.d.ts.map +1 -0
  4. package/dist/app/api/hazo_auth/change_password/route.js +98 -0
  5. package/dist/app/api/hazo_auth/forgot_password/route.d.ts +8 -0
  6. package/dist/app/api/hazo_auth/forgot_password/route.d.ts.map +1 -0
  7. package/dist/app/api/hazo_auth/forgot_password/route.js +78 -0
  8. package/dist/app/api/hazo_auth/get_auth/route.d.ts +10 -0
  9. package/dist/app/api/hazo_auth/get_auth/route.d.ts.map +1 -0
  10. package/dist/app/api/hazo_auth/get_auth/route.js +63 -0
  11. package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts +14 -0
  12. package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts.map +1 -0
  13. package/dist/app/api/hazo_auth/invalidate_cache/route.js +96 -0
  14. package/dist/app/api/hazo_auth/library_photos/route.d.ts +13 -0
  15. package/dist/app/api/hazo_auth/library_photos/route.d.ts.map +1 -0
  16. package/dist/app/api/hazo_auth/library_photos/route.js +55 -0
  17. package/dist/app/api/hazo_auth/login/route.d.ts +12 -0
  18. package/dist/app/api/hazo_auth/login/route.d.ts.map +1 -0
  19. package/dist/app/api/hazo_auth/login/route.js +140 -0
  20. package/dist/app/api/hazo_auth/logout/route.d.ts +8 -0
  21. package/dist/app/api/hazo_auth/logout/route.d.ts.map +1 -0
  22. package/dist/app/api/hazo_auth/logout/route.js +71 -0
  23. package/dist/app/api/hazo_auth/me/route.d.ts +3 -0
  24. package/dist/app/api/hazo_auth/me/route.d.ts.map +1 -0
  25. package/dist/app/api/hazo_auth/me/route.js +34 -0
  26. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts +7 -0
  27. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts.map +1 -0
  28. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.js +43 -0
  29. package/dist/app/api/hazo_auth/register/route.d.ts +9 -0
  30. package/dist/app/api/hazo_auth/register/route.d.ts.map +1 -0
  31. package/dist/app/api/hazo_auth/register/route.js +80 -0
  32. package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts +8 -0
  33. package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts.map +1 -0
  34. package/dist/app/api/hazo_auth/remove_profile_picture/route.js +64 -0
  35. package/dist/app/api/hazo_auth/resend_verification/route.d.ts +8 -0
  36. package/dist/app/api/hazo_auth/resend_verification/route.d.ts.map +1 -0
  37. package/dist/app/api/hazo_auth/resend_verification/route.js +79 -0
  38. package/dist/app/api/hazo_auth/reset_password/route.d.ts +8 -0
  39. package/dist/app/api/hazo_auth/reset_password/route.d.ts.map +1 -0
  40. package/dist/app/api/hazo_auth/reset_password/route.js +76 -0
  41. package/dist/app/api/hazo_auth/update_user/route.d.ts +9 -0
  42. package/dist/app/api/hazo_auth/update_user/route.d.ts.map +1 -0
  43. package/dist/app/api/hazo_auth/update_user/route.js +95 -0
  44. package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts +9 -0
  45. package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts.map +1 -0
  46. package/dist/app/api/hazo_auth/upload_profile_picture/route.js +204 -0
  47. package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts +6 -0
  48. package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts.map +1 -0
  49. package/dist/app/api/hazo_auth/validate_reset_token/route.js +58 -0
  50. package/dist/app/api/hazo_auth/verify_email/route.d.ts +11 -0
  51. package/dist/app/api/hazo_auth/verify_email/route.d.ts.map +1 -0
  52. package/dist/app/api/hazo_auth/verify_email/route.js +63 -0
  53. package/dist/cli/generate.d.ts +2 -0
  54. package/dist/cli/generate.d.ts.map +1 -0
  55. package/dist/cli/generate.js +117 -0
  56. package/dist/cli/index.d.ts +3 -0
  57. package/dist/cli/index.d.ts.map +1 -0
  58. package/dist/cli/index.js +120 -0
  59. package/dist/cli/validate.d.ts +15 -0
  60. package/dist/cli/validate.d.ts.map +1 -0
  61. package/dist/cli/validate.js +509 -0
  62. package/dist/components/ui/card.d.ts +9 -0
  63. package/dist/components/ui/card.d.ts.map +1 -0
  64. package/dist/components/ui/card.js +45 -0
  65. package/dist/hooks/use-mobile.d.ts.map +1 -1
  66. package/dist/hooks/use-mobile.js +17 -3
  67. package/dist/server/routes/change_password.d.ts +2 -0
  68. package/dist/server/routes/change_password.d.ts.map +1 -0
  69. package/dist/server/routes/change_password.js +2 -0
  70. package/dist/server/routes/forgot_password.d.ts +2 -0
  71. package/dist/server/routes/forgot_password.d.ts.map +1 -0
  72. package/dist/server/routes/forgot_password.js +2 -0
  73. package/dist/server/routes/get_auth.d.ts +2 -0
  74. package/dist/server/routes/get_auth.d.ts.map +1 -0
  75. package/dist/server/routes/get_auth.js +2 -0
  76. package/dist/server/routes/index.d.ts +18 -0
  77. package/dist/server/routes/index.d.ts.map +1 -0
  78. package/dist/server/routes/index.js +24 -0
  79. package/dist/server/routes/invalidate_cache.d.ts +2 -0
  80. package/dist/server/routes/invalidate_cache.d.ts.map +1 -0
  81. package/dist/server/routes/invalidate_cache.js +2 -0
  82. package/dist/server/routes/library_photos.d.ts +2 -0
  83. package/dist/server/routes/library_photos.d.ts.map +1 -0
  84. package/dist/server/routes/library_photos.js +2 -0
  85. package/dist/server/routes/login.d.ts +2 -0
  86. package/dist/server/routes/login.d.ts.map +1 -0
  87. package/dist/server/routes/login.js +2 -0
  88. package/dist/server/routes/logout.d.ts +2 -0
  89. package/dist/server/routes/logout.d.ts.map +1 -0
  90. package/dist/server/routes/logout.js +2 -0
  91. package/dist/server/routes/me.d.ts +2 -0
  92. package/dist/server/routes/me.d.ts.map +1 -0
  93. package/dist/server/routes/me.js +2 -0
  94. package/dist/server/routes/profile_picture_filename.d.ts +2 -0
  95. package/dist/server/routes/profile_picture_filename.d.ts.map +1 -0
  96. package/dist/server/routes/profile_picture_filename.js +3 -0
  97. package/dist/server/routes/register.d.ts +2 -0
  98. package/dist/server/routes/register.d.ts.map +1 -0
  99. package/dist/server/routes/register.js +2 -0
  100. package/dist/server/routes/remove_profile_picture.d.ts +2 -0
  101. package/dist/server/routes/remove_profile_picture.d.ts.map +1 -0
  102. package/dist/server/routes/remove_profile_picture.js +2 -0
  103. package/dist/server/routes/resend_verification.d.ts +2 -0
  104. package/dist/server/routes/resend_verification.d.ts.map +1 -0
  105. package/dist/server/routes/resend_verification.js +2 -0
  106. package/dist/server/routes/reset_password.d.ts +2 -0
  107. package/dist/server/routes/reset_password.d.ts.map +1 -0
  108. package/dist/server/routes/reset_password.js +2 -0
  109. package/dist/server/routes/update_user.d.ts +2 -0
  110. package/dist/server/routes/update_user.d.ts.map +1 -0
  111. package/dist/server/routes/update_user.js +2 -0
  112. package/dist/server/routes/upload_profile_picture.d.ts +2 -0
  113. package/dist/server/routes/upload_profile_picture.d.ts.map +1 -0
  114. package/dist/server/routes/upload_profile_picture.js +2 -0
  115. package/dist/server/routes/validate_reset_token.d.ts +2 -0
  116. package/dist/server/routes/validate_reset_token.d.ts.map +1 -0
  117. package/dist/server/routes/validate_reset_token.js +2 -0
  118. package/dist/server/routes/verify_email.d.ts +2 -0
  119. package/dist/server/routes/verify_email.d.ts.map +1 -0
  120. package/dist/server/routes/verify_email.js +2 -0
  121. package/package.json +12 -17
  122. package/components.json +0 -22
  123. package/instrumentation.ts +0 -32
  124. package/migrations/001_add_token_type_to_refresh_tokens.sql +0 -14
  125. package/migrations/002_add_name_to_hazo_users.sql +0 -7
  126. package/migrations/003_add_url_on_logon_to_hazo_users.sql +0 -8
  127. package/next.config.mjs +0 -67
  128. package/postcss.config.mjs +0 -8
  129. package/public/file.svg +0 -1
  130. package/public/globe.svg +0 -1
  131. package/public/next.svg +0 -1
  132. package/public/vercel.svg +0 -1
  133. package/public/window.svg +0 -1
  134. package/scripts/apply_migration.ts +0 -118
  135. package/scripts/init_users.ts +0 -378
  136. package/src/app/api/hazo_auth/auth/upload_profile_picture/route.ts +0 -268
  137. package/src/app/api/hazo_auth/change_password/route.ts +0 -132
  138. package/src/app/api/hazo_auth/forgot_password/route.ts +0 -107
  139. package/src/app/api/hazo_auth/get_auth/route.ts +0 -89
  140. package/src/app/api/hazo_auth/invalidate_cache/route.ts +0 -139
  141. package/src/app/api/hazo_auth/library_photos/route.ts +0 -73
  142. package/src/app/api/hazo_auth/login/route.ts +0 -181
  143. package/src/app/api/hazo_auth/logout/route.ts +0 -89
  144. package/src/app/api/hazo_auth/me/route.ts +0 -47
  145. package/src/app/api/hazo_auth/profile_picture/[filename]/route.ts +0 -67
  146. package/src/app/api/hazo_auth/register/route.ts +0 -109
  147. package/src/app/api/hazo_auth/remove_profile_picture/route.ts +0 -86
  148. package/src/app/api/hazo_auth/resend_verification/route.ts +0 -108
  149. package/src/app/api/hazo_auth/reset_password/route.ts +0 -107
  150. package/src/app/api/hazo_auth/update_user/route.ts +0 -126
  151. package/src/app/api/hazo_auth/upload_profile_picture/route.ts +0 -268
  152. package/src/app/api/hazo_auth/user_management/permissions/route.ts +0 -367
  153. package/src/app/api/hazo_auth/user_management/roles/route.ts +0 -442
  154. package/src/app/api/hazo_auth/user_management/users/roles/route.ts +0 -367
  155. package/src/app/api/hazo_auth/user_management/users/route.ts +0 -239
  156. package/src/app/api/hazo_auth/validate_reset_token/route.ts +0 -83
  157. package/src/app/api/hazo_auth/verify_email/route.ts +0 -88
  158. package/src/app/api/migrations/apply/route.ts +0 -91
  159. package/src/app/favicon.ico +0 -0
  160. package/src/app/fonts/GeistMonoVF.woff +0 -0
  161. package/src/app/fonts/GeistVF.woff +0 -0
  162. package/src/app/globals.css +0 -89
  163. package/src/app/hazo_auth/forgot_password/forgot_password_page_client.tsx +0 -60
  164. package/src/app/hazo_auth/forgot_password/page.tsx +0 -24
  165. package/src/app/hazo_auth/login/login_page_client.tsx +0 -86
  166. package/src/app/hazo_auth/login/page.tsx +0 -38
  167. package/src/app/hazo_auth/my_settings/my_settings_page_client.tsx +0 -120
  168. package/src/app/hazo_auth/my_settings/page.tsx +0 -40
  169. package/src/app/hazo_auth/register/page.tsx +0 -36
  170. package/src/app/hazo_auth/register/register_page_client.tsx +0 -81
  171. package/src/app/hazo_auth/reset_password/page.tsx +0 -29
  172. package/src/app/hazo_auth/reset_password/reset_password_page_client.tsx +0 -81
  173. package/src/app/hazo_auth/user_management/page.tsx +0 -14
  174. package/src/app/hazo_auth/user_management/user_management_page_client.tsx +0 -16
  175. package/src/app/hazo_auth/verify_email/page.tsx +0 -24
  176. package/src/app/hazo_auth/verify_email/verify_email_page_client.tsx +0 -60
  177. package/src/app/hazo_connect/api/sqlite/data/route.ts +0 -203
  178. package/src/app/hazo_connect/api/sqlite/schema/route.ts +0 -45
  179. package/src/app/hazo_connect/api/sqlite/tables/route.ts +0 -36
  180. package/src/app/hazo_connect/sqlite_admin/page.tsx +0 -51
  181. package/src/app/hazo_connect/sqlite_admin/sqlite-admin-client.tsx +0 -984
  182. package/src/app/layout.tsx +0 -43
  183. package/src/app/page.tsx +0 -170
  184. package/src/components/index.ts +0 -7
  185. package/src/components/layouts/email_verification/config/email_verification_field_config.ts +0 -86
  186. package/src/components/layouts/email_verification/hooks/use_email_verification.ts +0 -297
  187. package/src/components/layouts/email_verification/index.tsx +0 -297
  188. package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +0 -58
  189. package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +0 -179
  190. package/src/components/layouts/forgot_password/index.tsx +0 -168
  191. package/src/components/layouts/index.ts +0 -26
  192. package/src/components/layouts/login/config/login_field_config.ts +0 -67
  193. package/src/components/layouts/login/hooks/use_login_form.ts +0 -286
  194. package/src/components/layouts/login/index.tsx +0 -252
  195. package/src/components/layouts/my_settings/components/editable_field.tsx +0 -177
  196. package/src/components/layouts/my_settings/components/password_change_dialog.tsx +0 -301
  197. package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +0 -385
  198. package/src/components/layouts/my_settings/components/profile_picture_display.tsx +0 -66
  199. package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +0 -143
  200. package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +0 -311
  201. package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +0 -341
  202. package/src/components/layouts/my_settings/config/my_settings_field_config.ts +0 -61
  203. package/src/components/layouts/my_settings/hooks/use_my_settings.ts +0 -458
  204. package/src/components/layouts/my_settings/index.tsx +0 -351
  205. package/src/components/layouts/register/config/register_field_config.ts +0 -101
  206. package/src/components/layouts/register/hooks/use_register_form.ts +0 -275
  207. package/src/components/layouts/register/index.tsx +0 -226
  208. package/src/components/layouts/reset_password/config/reset_password_field_config.ts +0 -86
  209. package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +0 -276
  210. package/src/components/layouts/reset_password/index.tsx +0 -294
  211. package/src/components/layouts/shared/components/already_logged_in_guard.tsx +0 -95
  212. package/src/components/layouts/shared/components/auth_page_shell.tsx +0 -36
  213. package/src/components/layouts/shared/components/field_error_message.tsx +0 -29
  214. package/src/components/layouts/shared/components/form_action_buttons.tsx +0 -64
  215. package/src/components/layouts/shared/components/form_field_wrapper.tsx +0 -44
  216. package/src/components/layouts/shared/components/form_header.tsx +0 -36
  217. package/src/components/layouts/shared/components/logout_button.tsx +0 -76
  218. package/src/components/layouts/shared/components/password_field.tsx +0 -72
  219. package/src/components/layouts/shared/components/profile_pic_menu.tsx +0 -321
  220. package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +0 -40
  221. package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +0 -214
  222. package/src/components/layouts/shared/components/standalone_layout_wrapper.tsx +0 -53
  223. package/src/components/layouts/shared/components/two_column_auth_layout.tsx +0 -44
  224. package/src/components/layouts/shared/components/unauthorized_guard.tsx +0 -78
  225. package/src/components/layouts/shared/components/visual_panel.tsx +0 -41
  226. package/src/components/layouts/shared/config/layout_customization.ts +0 -95
  227. package/src/components/layouts/shared/data/layout_data_client.ts +0 -19
  228. package/src/components/layouts/shared/hooks/use_auth_status.ts +0 -103
  229. package/src/components/layouts/shared/hooks/use_hazo_auth.ts +0 -158
  230. package/src/components/layouts/shared/index.ts +0 -34
  231. package/src/components/layouts/shared/utils/ip_address.ts +0 -37
  232. package/src/components/layouts/shared/utils/validation.ts +0 -66
  233. package/src/components/layouts/user_management/components/roles_matrix.tsx +0 -607
  234. package/src/components/layouts/user_management/index.tsx +0 -1295
  235. package/src/components/ui/alert-dialog.tsx +0 -141
  236. package/src/components/ui/avatar.tsx +0 -50
  237. package/src/components/ui/button.tsx +0 -57
  238. package/src/components/ui/checkbox.tsx +0 -30
  239. package/src/components/ui/dialog.tsx +0 -122
  240. package/src/components/ui/dropdown-menu.tsx +0 -201
  241. package/src/components/ui/hazo_ui_tooltip.tsx +0 -67
  242. package/src/components/ui/index.ts +0 -22
  243. package/src/components/ui/input.tsx +0 -22
  244. package/src/components/ui/label.tsx +0 -26
  245. package/src/components/ui/separator.tsx +0 -31
  246. package/src/components/ui/sheet.tsx +0 -139
  247. package/src/components/ui/sidebar.tsx +0 -773
  248. package/src/components/ui/skeleton.tsx +0 -15
  249. package/src/components/ui/sonner.tsx +0 -31
  250. package/src/components/ui/switch.tsx +0 -29
  251. package/src/components/ui/table.tsx +0 -120
  252. package/src/components/ui/tabs.tsx +0 -55
  253. package/src/components/ui/tooltip.tsx +0 -32
  254. package/src/components/ui/vertical-tabs.tsx +0 -59
  255. package/src/hooks/use-mobile.tsx +0 -19
  256. package/src/index.ts +0 -7
  257. package/src/lib/already_logged_in_config.server.ts +0 -46
  258. package/src/lib/app_logger.ts +0 -24
  259. package/src/lib/auth/auth_cache.ts +0 -220
  260. package/src/lib/auth/auth_rate_limiter.ts +0 -121
  261. package/src/lib/auth/auth_types.ts +0 -65
  262. package/src/lib/auth/auth_utils.server.ts +0 -196
  263. package/src/lib/auth/hazo_get_auth.server.ts +0 -333
  264. package/src/lib/auth/index.ts +0 -23
  265. package/src/lib/auth/server_auth.ts +0 -88
  266. package/src/lib/auth_utility_config.server.ts +0 -136
  267. package/src/lib/config/config_loader.server.ts +0 -164
  268. package/src/lib/email_verification_config.server.ts +0 -32
  269. package/src/lib/file_types_config.server.ts +0 -25
  270. package/src/lib/forgot_password_config.server.ts +0 -32
  271. package/src/lib/hazo_connect_instance.server.ts +0 -101
  272. package/src/lib/hazo_connect_setup.server.ts +0 -194
  273. package/src/lib/hazo_connect_setup.ts +0 -54
  274. package/src/lib/index.ts +0 -44
  275. package/src/lib/login_config.server.ts +0 -71
  276. package/src/lib/messages_config.server.ts +0 -45
  277. package/src/lib/migrations/apply_migration.ts +0 -105
  278. package/src/lib/my_settings_config.server.ts +0 -135
  279. package/src/lib/password_requirements_config.server.ts +0 -39
  280. package/src/lib/profile_pic_menu_config.server.ts +0 -138
  281. package/src/lib/profile_picture_config.server.ts +0 -56
  282. package/src/lib/register_config.server.ts +0 -73
  283. package/src/lib/reset_password_config.server.ts +0 -75
  284. package/src/lib/services/email_service.ts +0 -581
  285. package/src/lib/services/email_verification_service.ts +0 -270
  286. package/src/lib/services/index.ts +0 -15
  287. package/src/lib/services/login_service.ts +0 -134
  288. package/src/lib/services/password_change_service.ts +0 -154
  289. package/src/lib/services/password_reset_service.ts +0 -405
  290. package/src/lib/services/profile_picture_remove_service.ts +0 -120
  291. package/src/lib/services/profile_picture_service.ts +0 -215
  292. package/src/lib/services/profile_picture_source_mapper.ts +0 -62
  293. package/src/lib/services/registration_service.ts +0 -184
  294. package/src/lib/services/token_service.ts +0 -240
  295. package/src/lib/services/user_profiles_service.ts +0 -143
  296. package/src/lib/services/user_update_service.ts +0 -141
  297. package/src/lib/ui_shell_config.server.ts +0 -73
  298. package/src/lib/ui_sizes_config.server.ts +0 -37
  299. package/src/lib/user_fields_config.server.ts +0 -31
  300. package/src/lib/user_management_config.server.ts +0 -39
  301. package/src/lib/utils/api_route_helpers.ts +0 -60
  302. package/src/lib/utils/error_sanitizer.ts +0 -75
  303. package/src/lib/utils.ts +0 -11
  304. package/src/middleware.ts +0 -94
  305. package/src/routes/index.ts +0 -34
  306. package/src/server/config/config_loader.ts +0 -496
  307. package/src/server/index.ts +0 -38
  308. package/src/server/logging/logger_service.ts +0 -56
  309. package/src/server/routes/root_router.ts +0 -16
  310. package/src/server/server.ts +0 -28
  311. package/src/server/types/app_types.ts +0 -74
  312. package/src/server/types/express.d.ts +0 -16
  313. package/src/stories/email_verification_layout.stories.tsx +0 -137
  314. package/src/stories/forgot_password_layout.stories.tsx +0 -85
  315. package/src/stories/login_layout.stories.tsx +0 -85
  316. package/src/stories/project_overview.stories.tsx +0 -33
  317. package/src/stories/register_layout.stories.tsx +0 -107
  318. package/tailwind.config.ts +0 -77
  319. package/tsconfig.build.json +0 -36
  320. package/tsconfig.json +0 -28
@@ -1,43 +0,0 @@
1
- // file_description: define the root layout wrapper for the hazo_auth project
2
- import type { Metadata } from "next";
3
- import local_font from "next/font/local";
4
- import { Toaster } from "../components/ui/sonner";
5
- import "./globals.css";
6
-
7
- // section: typography_setup
8
- const geist_sans = local_font({
9
- src: "./fonts/GeistVF.woff",
10
- variable: "--font-geist-sans",
11
- weight: "100 900",
12
- });
13
-
14
- const geist_mono = local_font({
15
- src: "./fonts/GeistMonoVF.woff",
16
- variable: "--font-geist-mono",
17
- weight: "100 900",
18
- });
19
-
20
- // section: metadata_definition
21
- export const metadata: Metadata = {
22
- title: "hazo reusable ui components",
23
- description:
24
- "Storybook-ready Next.js workspace for building reusable components powered by shadcn.",
25
- };
26
-
27
- // section: root_layout_component
28
- export default function root_layout({
29
- children,
30
- }: Readonly<{
31
- children: React.ReactNode;
32
- }>) {
33
- return (
34
- <html lang="en">
35
- <body
36
- className={`${geist_sans.variable} ${geist_mono.variable} antialiased`}
37
- >
38
- {children}
39
- <Toaster />
40
- </body>
41
- </html>
42
- );
43
- }
package/src/app/page.tsx DELETED
@@ -1,170 +0,0 @@
1
- // file_description: render the default landing page with sidebar navigation to test components
2
- // section: client_directive
3
- "use client";
4
-
5
- // section: imports
6
- import Link from "next/link";
7
- import {
8
- Sidebar,
9
- SidebarContent,
10
- SidebarGroup,
11
- SidebarGroupLabel,
12
- SidebarHeader,
13
- SidebarMenu,
14
- SidebarMenuButton,
15
- SidebarMenuItem,
16
- SidebarProvider,
17
- SidebarTrigger,
18
- SidebarInset,
19
- } from "../components/ui/sidebar";
20
- import { LogIn, UserPlus, BookOpen, ExternalLink, Database, KeyRound, MailCheck } from "lucide-react";
21
-
22
- // section: page_component
23
- export default function home_page() {
24
- return (
25
- <SidebarProvider>
26
- <div className="cls_home_wrapper flex min-h-screen w-full">
27
- <Sidebar>
28
- <SidebarHeader className="cls_home_sidebar_header">
29
- <div className="cls_home_sidebar_title flex items-center gap-2 px-2 py-4">
30
- <h1 className="cls_home_sidebar_title_text text-lg font-semibold text-sidebar-foreground">
31
- hazo auth
32
- </h1>
33
- </div>
34
- </SidebarHeader>
35
- <SidebarContent className="cls_home_sidebar_content">
36
- <SidebarGroup className="cls_home_sidebar_test_group">
37
- <SidebarGroupLabel className="cls_home_sidebar_group_label">
38
- Test components
39
- </SidebarGroupLabel>
40
- <SidebarMenu className="cls_home_sidebar_test_menu">
41
- <SidebarMenuItem className="cls_home_sidebar_test_login_item">
42
- <SidebarMenuButton asChild>
43
- <Link
44
- href="/hazo_auth/login"
45
- className="cls_home_sidebar_test_login_link flex items-center gap-2"
46
- aria-label="Test login layout component"
47
- >
48
- <LogIn className="h-4 w-4" aria-hidden="true" />
49
- <span>Test login</span>
50
- </Link>
51
- </SidebarMenuButton>
52
- </SidebarMenuItem>
53
- <SidebarMenuItem className="cls_home_sidebar_test_register_item">
54
- <SidebarMenuButton asChild>
55
- <Link
56
- href="/hazo_auth/register"
57
- className="cls_home_sidebar_test_register_link flex items-center gap-2"
58
- aria-label="Test register layout component"
59
- >
60
- <UserPlus className="h-4 w-4" aria-hidden="true" />
61
- <span>Test register</span>
62
- </Link>
63
- </SidebarMenuButton>
64
- </SidebarMenuItem>
65
- <SidebarMenuItem className="cls_home_sidebar_test_forgot_password_item">
66
- <SidebarMenuButton asChild>
67
- <Link
68
- href="/hazo_auth/forgot_password"
69
- className="cls_home_sidebar_test_forgot_password_link flex items-center gap-2"
70
- aria-label="Test forgot password layout component"
71
- >
72
- <KeyRound className="h-4 w-4" aria-hidden="true" />
73
- <span>Test forgot password</span>
74
- </Link>
75
- </SidebarMenuButton>
76
- </SidebarMenuItem>
77
- <SidebarMenuItem className="cls_home_sidebar_test_email_verification_item">
78
- <SidebarMenuButton asChild>
79
- <Link
80
- href="/hazo_auth/verify_email"
81
- className="cls_home_sidebar_test_email_verification_link flex items-center gap-2"
82
- aria-label="Test email verification layout component"
83
- >
84
- <MailCheck className="h-4 w-4" aria-hidden="true" />
85
- <span>Test email verification</span>
86
- </Link>
87
- </SidebarMenuButton>
88
- </SidebarMenuItem>
89
- <SidebarMenuItem className="cls_home_sidebar_sqlite_admin_item">
90
- <SidebarMenuButton asChild>
91
- <Link
92
- href="/hazo_connect/sqlite_admin"
93
- className="cls_home_sidebar_sqlite_admin_link flex items-center gap-2"
94
- aria-label="Open SQLite admin UI to browse and edit database"
95
- >
96
- <Database className="h-4 w-4" aria-hidden="true" />
97
- <span>SQLite Admin</span>
98
- </Link>
99
- </SidebarMenuButton>
100
- </SidebarMenuItem>
101
- </SidebarMenu>
102
- </SidebarGroup>
103
- <SidebarGroup className="cls_home_sidebar_resources_group">
104
- <SidebarGroupLabel className="cls_home_sidebar_group_label">
105
- Resources
106
- </SidebarGroupLabel>
107
- <SidebarMenu className="cls_home_sidebar_resources_menu">
108
- <SidebarMenuItem className="cls_home_sidebar_storybook_item">
109
- <SidebarMenuButton asChild>
110
- <a
111
- href="http://localhost:6006"
112
- target="_blank"
113
- rel="noopener noreferrer"
114
- className="cls_home_sidebar_storybook_link flex items-center gap-2"
115
- aria-label="Open Storybook preview for reusable components"
116
- >
117
- <BookOpen className="h-4 w-4" aria-hidden="true" />
118
- <span>Storybook</span>
119
- <ExternalLink className="ml-auto h-3 w-3" aria-hidden="true" />
120
- </a>
121
- </SidebarMenuButton>
122
- </SidebarMenuItem>
123
- <SidebarMenuItem className="cls_home_sidebar_docs_item">
124
- <SidebarMenuButton asChild>
125
- <a
126
- href="https://ui.shadcn.com/docs"
127
- target="_blank"
128
- rel="noopener noreferrer"
129
- className="cls_home_sidebar_docs_link flex items-center gap-2"
130
- aria-label="Review shadcn documentation for styling guidance"
131
- >
132
- <BookOpen className="h-4 w-4" aria-hidden="true" />
133
- <span>Shadcn docs</span>
134
- <ExternalLink className="ml-auto h-3 w-3" aria-hidden="true" />
135
- </a>
136
- </SidebarMenuButton>
137
- </SidebarMenuItem>
138
- </SidebarMenu>
139
- </SidebarGroup>
140
- </SidebarContent>
141
- </Sidebar>
142
- <SidebarInset className="cls_home_sidebar_inset">
143
- <header className="cls_home_main_header flex h-16 shrink-0 items-center gap-2 border-b px-4">
144
- <SidebarTrigger className="cls_home_sidebar_trigger" />
145
- <div className="cls_home_main_header_content flex flex-1 items-center gap-2">
146
- <h2 className="cls_home_main_title text-lg font-semibold text-foreground">
147
- hazo reusable ui library workspace
148
- </h2>
149
- </div>
150
- </header>
151
- <main className="cls_home_main_content flex flex-1 flex-col items-center justify-center gap-6 p-8 text-center">
152
- <div className="cls_home_welcome_content flex w-full max-w-3xl flex-col items-center justify-center gap-6">
153
- <h1 className="cls_home_welcome_title text-3xl font-semibold tracking-tight text-foreground md:text-4xl">
154
- Welcome to hazo auth
155
- </h1>
156
- <p className="cls_home_welcome_summary text-base leading-relaxed text-muted-foreground md:text-lg">
157
- Start shaping accessible, shadcn-powered components with integrated
158
- hazo_config and hazo_connect support. Storybook is pre-installed so
159
- you can document and iterate on each piece with confidence.
160
- </p>
161
- <p className="cls_home_welcome_instruction text-sm text-muted-foreground">
162
- Use the sidebar to navigate to test components or access resources.
163
- </p>
164
- </div>
165
- </main>
166
- </SidebarInset>
167
- </div>
168
- </SidebarProvider>
169
- );
170
- }
@@ -1,7 +0,0 @@
1
- // file_description: barrel export for all components (UI and layouts)
2
- // section: ui_exports
3
- export * from "./ui/index";
4
-
5
- // section: layout_exports
6
- export * from "./layouts/index";
7
-
@@ -1,86 +0,0 @@
1
- // file_description: email verification layout specific configuration helpers
2
- // section: imports
3
- import type { LayoutFieldMap, LayoutFieldMapOverrides } from "../../shared/config/layout_customization";
4
- import {
5
- resolveButtonPalette,
6
- resolveFieldDefinitions,
7
- resolveLabels,
8
- type ButtonPaletteDefaults,
9
- type ButtonPaletteOverrides,
10
- type LayoutLabelDefaults,
11
- type LayoutLabelOverrides,
12
- } from "../../shared/config/layout_customization";
13
-
14
- // section: field_identifiers
15
- export const EMAIL_VERIFICATION_FIELD_IDS = {
16
- EMAIL: "email_address",
17
- } as const;
18
-
19
- export type EmailVerificationFieldId = (typeof EMAIL_VERIFICATION_FIELD_IDS)[keyof typeof EMAIL_VERIFICATION_FIELD_IDS];
20
-
21
- // section: field_definitions
22
- const EMAIL_VERIFICATION_FIELD_DEFINITIONS: LayoutFieldMap = {
23
- [EMAIL_VERIFICATION_FIELD_IDS.EMAIL]: {
24
- id: EMAIL_VERIFICATION_FIELD_IDS.EMAIL,
25
- label: "Email address",
26
- type: "email",
27
- autoComplete: "email",
28
- placeholder: "Enter your email address",
29
- ariaLabel: "Email address input field",
30
- },
31
- };
32
-
33
- export const createEmailVerificationFieldDefinitions = (
34
- overrides?: LayoutFieldMapOverrides,
35
- ) => resolveFieldDefinitions(EMAIL_VERIFICATION_FIELD_DEFINITIONS, overrides);
36
-
37
- // section: label_defaults
38
- const EMAIL_VERIFICATION_LABEL_DEFAULTS: LayoutLabelDefaults = {
39
- heading: "Email verification",
40
- subHeading: "Verifying your email address...",
41
- submitButton: "Resend verification email",
42
- cancelButton: "Cancel",
43
- };
44
-
45
- export const resolveEmailVerificationLabels = (overrides?: LayoutLabelOverrides) =>
46
- resolveLabels(EMAIL_VERIFICATION_LABEL_DEFAULTS, overrides);
47
-
48
- // section: button_palette_defaults
49
- const EMAIL_VERIFICATION_BUTTON_PALETTE_DEFAULTS: ButtonPaletteDefaults = {
50
- submitBackground: "#0f172a",
51
- submitText: "#ffffff",
52
- cancelBorder: "#cbd5f5",
53
- cancelText: "#0f172a",
54
- };
55
-
56
- export const resolveEmailVerificationButtonPalette = (overrides?: ButtonPaletteOverrides) =>
57
- resolveButtonPalette(EMAIL_VERIFICATION_BUTTON_PALETTE_DEFAULTS, overrides);
58
-
59
- // section: success_labels
60
- export type EmailVerificationSuccessLabels = {
61
- heading: string;
62
- message: string;
63
- redirectMessage: string;
64
- goToLoginButton: string;
65
- };
66
-
67
- export const EMAIL_VERIFICATION_SUCCESS_LABEL_DEFAULTS: EmailVerificationSuccessLabels = {
68
- heading: "Email verified successfully",
69
- message: "Your email address has been verified. You can now log in to your account.",
70
- redirectMessage: "Redirecting to login page in",
71
- goToLoginButton: "Go to login",
72
- };
73
-
74
- // section: error_labels
75
- export type EmailVerificationErrorLabels = {
76
- heading: string;
77
- message: string;
78
- resendFormHeading: string;
79
- };
80
-
81
- export const EMAIL_VERIFICATION_ERROR_LABEL_DEFAULTS: EmailVerificationErrorLabels = {
82
- heading: "Verification failed",
83
- message: "The verification link is invalid or has expired.",
84
- resendFormHeading: "Resend verification email",
85
- };
86
-
@@ -1,297 +0,0 @@
1
- // file_description: encapsulate email verification state, validation, and data interactions
2
- // section: imports
3
- import { useCallback, useEffect, useMemo, useState } from "react";
4
- import { useRouter, useSearchParams } from "next/navigation";
5
- import { toast } from "sonner";
6
- import type { LayoutDataClient } from "../../shared/data/layout_data_client";
7
- import { EMAIL_VERIFICATION_FIELD_IDS, type EmailVerificationFieldId } from "../config/email_verification_field_config";
8
- import { validateEmail } from "../../shared/utils/validation";
9
-
10
- // section: types
11
- export type EmailVerificationFormValues = Record<EmailVerificationFieldId, string>;
12
- export type EmailVerificationFormErrors = Partial<Record<EmailVerificationFieldId, string>> & {
13
- submit?: string;
14
- };
15
-
16
- export type UseEmailVerificationParams<TClient = unknown> = {
17
- dataClient: LayoutDataClient<TClient>;
18
- redirectDelay?: number; // Delay in seconds before redirecting to login
19
- loginPath?: string; // Path to redirect to after successful verification
20
- };
21
-
22
- export type UseEmailVerificationResult = {
23
- isVerifying: boolean;
24
- isVerified: boolean;
25
- isError: boolean;
26
- errorMessage?: string;
27
- email?: string; // Email from token if available
28
- values: EmailVerificationFormValues;
29
- errors: EmailVerificationFormErrors;
30
- isSubmitDisabled: boolean;
31
- isSubmitting: boolean;
32
- emailTouched: boolean;
33
- redirectCountdown: number;
34
- handleFieldChange: (fieldId: EmailVerificationFieldId, value: string) => void;
35
- handleEmailBlur: () => void;
36
- handleResendSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
37
- handleCancel: () => void;
38
- handleGoToLogin: () => void;
39
- };
40
-
41
- // section: helpers
42
- const buildInitialValues = (initialEmail?: string): EmailVerificationFormValues => ({
43
- [EMAIL_VERIFICATION_FIELD_IDS.EMAIL]: initialEmail || "",
44
- });
45
-
46
- // section: hook
47
- export const use_email_verification = <TClient,>({
48
- dataClient,
49
- redirectDelay = 5,
50
- loginPath = "/hazo_auth/login",
51
- }: UseEmailVerificationParams<TClient>): UseEmailVerificationResult => {
52
- const router = useRouter();
53
- const searchParams = useSearchParams();
54
- const token = searchParams.get("token");
55
- const emailParam = searchParams.get("email");
56
- const messageParam = searchParams.get("message");
57
-
58
- const [isVerifying, setIsVerifying] = useState<boolean>(false);
59
- const [isVerified, setIsVerified] = useState<boolean>(false);
60
- const [isError, setIsError] = useState<boolean>(false);
61
- const [errorMessage, setErrorMessage] = useState<string | undefined>(messageParam || undefined);
62
- const [email, setEmail] = useState<string | undefined>(emailParam || undefined);
63
- const [values, setValues] = useState<EmailVerificationFormValues>(buildInitialValues(emailParam || undefined));
64
- const [errors, setErrors] = useState<EmailVerificationFormErrors>({});
65
- const [emailTouched, setEmailTouched] = useState<boolean>(false);
66
- const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
67
- const [redirectCountdown, setRedirectCountdown] = useState<number>(redirectDelay);
68
-
69
- // Verify token on mount if token exists, or show error if message is provided
70
- useEffect(() => {
71
- // If message is provided (from login redirect), show error state immediately
72
- if (messageParam && !token) {
73
- setIsError(true);
74
- setErrorMessage(messageParam);
75
- if (emailParam) {
76
- setEmail(emailParam);
77
- setValues(buildInitialValues(emailParam));
78
- }
79
- return;
80
- }
81
-
82
- if (!token) {
83
- setIsError(true);
84
- setErrorMessage("No verification token provided");
85
- return;
86
- }
87
-
88
- const verifyToken = async () => {
89
- setIsVerifying(true);
90
- setIsError(false);
91
- setErrorMessage(undefined);
92
-
93
- try {
94
- const response = await fetch(`/api/hazo_auth/verify_email?token=${encodeURIComponent(token)}`, {
95
- method: "GET",
96
- });
97
-
98
- const data = await response.json();
99
-
100
- if (!response.ok) {
101
- throw new Error(data.error || "Email verification failed");
102
- }
103
-
104
- // Success
105
- setIsVerified(true);
106
- setEmail(data.email);
107
- setValues(buildInitialValues(data.email));
108
-
109
- // Start countdown for redirect
110
- let countdown = redirectDelay;
111
- setRedirectCountdown(countdown);
112
-
113
- const countdownInterval = setInterval(() => {
114
- countdown -= 1;
115
- setRedirectCountdown(countdown);
116
-
117
- if (countdown <= 0) {
118
- clearInterval(countdownInterval);
119
- router.push(loginPath);
120
- }
121
- }, 1000);
122
-
123
- // Cleanup interval on unmount
124
- return () => clearInterval(countdownInterval);
125
- } catch (error) {
126
- const errorMessage =
127
- error instanceof Error ? error.message : "Email verification failed. Please try again.";
128
-
129
- setIsError(true);
130
- setErrorMessage(errorMessage);
131
-
132
- // Try to extract email from error response if available
133
- try {
134
- const response = await fetch(`/api/hazo_auth/verify_email?token=${encodeURIComponent(token)}`, {
135
- method: "GET",
136
- });
137
- const data = await response.json();
138
- if (data.email) {
139
- setEmail(data.email);
140
- setValues(buildInitialValues(data.email));
141
- }
142
- } catch {
143
- // Ignore errors when trying to get email
144
- }
145
- } finally {
146
- setIsVerifying(false);
147
- }
148
- };
149
-
150
- void verifyToken();
151
- }, [token, redirectDelay, loginPath, router]);
152
-
153
- const isSubmitDisabled = useMemo(() => {
154
- if (isSubmitting) {
155
- return true;
156
- }
157
-
158
- // Only disable if there are active errors
159
- const hasErrors = !!errors[EMAIL_VERIFICATION_FIELD_IDS.EMAIL];
160
- return hasErrors;
161
- }, [errors, isSubmitting]);
162
-
163
- const handleFieldChange = useCallback((fieldId: EmailVerificationFieldId, value: string) => {
164
- setValues((previousValues) => {
165
- const nextValues: EmailVerificationFormValues = {
166
- ...previousValues,
167
- [fieldId]: value,
168
- };
169
-
170
- setErrors((previousErrors) => {
171
- const updatedErrors: EmailVerificationFormErrors = { ...previousErrors };
172
-
173
- // Only validate email on change if it has been touched (blurred)
174
- if (fieldId === EMAIL_VERIFICATION_FIELD_IDS.EMAIL && emailTouched) {
175
- const emailError = validateEmail(value);
176
- if (emailError) {
177
- updatedErrors[EMAIL_VERIFICATION_FIELD_IDS.EMAIL] = emailError;
178
- } else {
179
- delete updatedErrors[EMAIL_VERIFICATION_FIELD_IDS.EMAIL];
180
- }
181
- }
182
-
183
- return updatedErrors;
184
- });
185
-
186
- return nextValues;
187
- });
188
- }, [emailTouched]);
189
-
190
- const handleEmailBlur = useCallback(() => {
191
- setEmailTouched(true);
192
- // Validate email on blur
193
- setErrors((previousErrors) => {
194
- const updatedErrors: EmailVerificationFormErrors = { ...previousErrors };
195
- const emailValue = values[EMAIL_VERIFICATION_FIELD_IDS.EMAIL];
196
- const emailError = validateEmail(emailValue);
197
- if (emailError) {
198
- updatedErrors[EMAIL_VERIFICATION_FIELD_IDS.EMAIL] = emailError;
199
- } else {
200
- delete updatedErrors[EMAIL_VERIFICATION_FIELD_IDS.EMAIL];
201
- }
202
- return updatedErrors;
203
- });
204
- }, [values]);
205
-
206
- const handleResendSubmit = useCallback(
207
- async (event: React.FormEvent<HTMLFormElement>) => {
208
- event.preventDefault();
209
-
210
- // Final validation
211
- const emailError = validateEmail(values[EMAIL_VERIFICATION_FIELD_IDS.EMAIL]);
212
-
213
- if (emailError) {
214
- setErrors({
215
- [EMAIL_VERIFICATION_FIELD_IDS.EMAIL]: emailError,
216
- });
217
- return;
218
- }
219
-
220
- setIsSubmitting(true);
221
- setErrors({});
222
-
223
- try {
224
- const response = await fetch("/api/hazo_auth/resend_verification", {
225
- method: "POST",
226
- headers: {
227
- "Content-Type": "application/json",
228
- },
229
- body: JSON.stringify({
230
- email: values[EMAIL_VERIFICATION_FIELD_IDS.EMAIL],
231
- }),
232
- });
233
-
234
- let data;
235
- try {
236
- data = await response.json();
237
- } catch (jsonError) {
238
- // If JSON parsing fails, the response is likely HTML (e.g., error page)
239
- throw new Error("Server returned an invalid response. Please try again later.");
240
- }
241
-
242
- if (!response.ok) {
243
- throw new Error(data.error || "Failed to resend verification email");
244
- }
245
-
246
- // Show success notification
247
- toast.success("Verification email sent", {
248
- description: data.message || "If an account with that email exists and is not verified, a verification link has been sent.",
249
- });
250
- } catch (error) {
251
- const errorMessage =
252
- error instanceof Error ? error.message : "Failed to resend verification email. Please try again.";
253
-
254
- // Show error notification
255
- toast.error("Failed to resend verification email", {
256
- description: errorMessage,
257
- });
258
-
259
- // Set error state
260
- setErrors({
261
- submit: errorMessage,
262
- });
263
- } finally {
264
- setIsSubmitting(false);
265
- }
266
- },
267
- [values, dataClient],
268
- );
269
-
270
- const handleCancel = useCallback(() => {
271
- router.push(loginPath);
272
- }, [router, loginPath]);
273
-
274
- const handleGoToLogin = useCallback(() => {
275
- router.push(loginPath);
276
- }, [router, loginPath]);
277
-
278
- return {
279
- isVerifying,
280
- isVerified,
281
- isError,
282
- errorMessage,
283
- email,
284
- values,
285
- errors,
286
- isSubmitDisabled,
287
- isSubmitting,
288
- emailTouched,
289
- redirectCountdown,
290
- handleFieldChange,
291
- handleEmailBlur,
292
- handleResendSubmit,
293
- handleCancel,
294
- handleGoToLogin,
295
- };
296
- };
297
-