hazo_auth 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +398 -773
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +5 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +23 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.js +44 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts +31 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +222 -0
- package/dist/components/layouts/email_verification/index.d.ts +23 -0
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -0
- package/dist/components/layouts/email_verification/index.js +61 -0
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +10 -0
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -0
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +33 -0
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts +22 -0
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -0
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +127 -0
- package/dist/components/layouts/forgot_password/index.d.ts +18 -0
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -0
- package/dist/components/layouts/forgot_password/index.js +43 -0
- package/dist/components/layouts/index.d.ts +16 -0
- package/dist/components/layouts/index.d.ts.map +1 -0
- package/dist/components/layouts/index.js +11 -0
- package/dist/components/layouts/login/config/login_field_config.d.ts +11 -0
- package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -0
- package/dist/components/layouts/login/config/login_field_config.js +42 -0
- package/dist/components/layouts/login/hooks/use_login_form.d.ts +34 -0
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -0
- package/dist/components/layouts/login/hooks/use_login_form.js +196 -0
- package/dist/components/layouts/login/index.d.ts +31 -0
- package/dist/components/layouts/login/index.d.ts.map +1 -0
- package/dist/components/layouts/login/index.js +58 -0
- package/dist/components/layouts/my_settings/components/editable_field.d.ts +19 -0
- package/dist/components/layouts/my_settings/components/editable_field.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/editable_field.js +73 -0
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts +28 -0
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/password_change_dialog.js +138 -0
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts +42 -0
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +198 -0
- package/dist/components/layouts/my_settings/components/profile_picture_display.d.ts +16 -0
- package/dist/components/layouts/my_settings/components/profile_picture_display.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_display.js +33 -0
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts +17 -0
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +48 -0
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts +21 -0
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +144 -0
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts +23 -0
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +169 -0
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +19 -0
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/config/my_settings_field_config.js +26 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +46 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +354 -0
- package/dist/components/layouts/my_settings/index.d.ts +64 -0
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/index.js +65 -0
- package/dist/components/layouts/register/config/register_field_config.d.ts +14 -0
- package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -0
- package/dist/components/layouts/register/config/register_field_config.js +69 -0
- package/dist/components/layouts/register/hooks/use_register_form.d.ts +30 -0
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -0
- package/dist/components/layouts/register/hooks/use_register_form.js +184 -0
- package/dist/components/layouts/register/index.d.ts +23 -0
- package/dist/components/layouts/register/index.d.ts.map +1 -0
- package/dist/components/layouts/register/index.js +58 -0
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +13 -0
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -0
- package/dist/components/layouts/reset_password/config/reset_password_field_config.js +53 -0
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts +28 -0
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -0
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +201 -0
- package/dist/components/layouts/reset_password/index.d.ts +23 -0
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -0
- package/dist/components/layouts/reset_password/index.js +53 -0
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +20 -0
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +32 -0
- package/dist/components/layouts/shared/components/auth_page_shell.d.ts +7 -0
- package/dist/components/layouts/shared/components/auth_page_shell.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/auth_page_shell.js +12 -0
- package/dist/components/layouts/shared/components/field_error_message.d.ts +7 -0
- package/dist/components/layouts/shared/components/field_error_message.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/field_error_message.js +6 -0
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts +14 -0
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/form_action_buttons.js +15 -0
- package/dist/components/layouts/shared/components/form_field_wrapper.d.ts +11 -0
- package/dist/components/layouts/shared/components/form_field_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/form_field_wrapper.js +9 -0
- package/dist/components/layouts/shared/components/form_header.d.ts +10 -0
- package/dist/components/layouts/shared/components/form_header.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/form_header.js +5 -0
- package/dist/components/layouts/shared/components/logout_button.d.ts +7 -0
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/logout_button.js +44 -0
- package/dist/components/layouts/shared/components/password_field.d.ts +13 -0
- package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/password_field.js +13 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +22 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.js +169 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts +12 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +16 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts +6 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +15 -0
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts +11 -0
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +10 -0
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +12 -0
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/two_column_auth_layout.js +8 -0
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts +14 -0
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/unauthorized_guard.js +30 -0
- package/dist/components/layouts/shared/components/visual_panel.d.ts +9 -0
- package/dist/components/layouts/shared/components/visual_panel.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/visual_panel.js +10 -0
- package/dist/components/layouts/shared/config/layout_customization.d.ts +38 -0
- package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -0
- package/dist/components/layouts/shared/config/layout_customization.js +19 -0
- package/dist/components/layouts/shared/data/layout_data_client.d.ts +6 -0
- package/dist/components/layouts/shared/data/layout_data_client.d.ts.map +1 -0
- package/dist/components/layouts/shared/data/layout_data_client.js +9 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts +20 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.js +71 -0
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts +48 -0
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -0
- package/dist/components/layouts/shared/hooks/use_hazo_auth.js +90 -0
- package/dist/components/layouts/shared/index.d.ts +24 -0
- package/dist/components/layouts/shared/index.d.ts.map +1 -0
- package/dist/components/layouts/shared/index.js +27 -0
- package/dist/components/layouts/shared/utils/ip_address.d.ts +7 -0
- package/dist/components/layouts/shared/utils/ip_address.d.ts.map +1 -0
- package/dist/components/layouts/shared/utils/ip_address.js +34 -0
- package/dist/components/layouts/shared/utils/validation.d.ts +15 -0
- package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -0
- package/dist/components/layouts/shared/utils/validation.js +45 -0
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts +29 -0
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -0
- package/dist/components/layouts/user_management/components/roles_matrix.js +287 -0
- package/dist/components/layouts/user_management/index.d.ts +13 -0
- package/dist/components/layouts/user_management/index.d.ts.map +1 -0
- package/dist/components/layouts/user_management/index.js +495 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +62 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +32 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +45 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +23 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +52 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +72 -0
- package/dist/components/ui/hazo_ui_tooltip.d.ts +26 -0
- package/dist/components/ui/hazo_ui_tooltip.d.ts.map +1 -0
- package/dist/components/ui/hazo_ui_tooltip.js +17 -0
- package/dist/components/ui/index.d.ts +20 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +21 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +20 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +24 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +22 -0
- package/dist/components/ui/sheet.d.ts +23 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +66 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +267 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +18 -0
- package/dist/components/ui/sonner.d.ts +5 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +28 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +22 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +55 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +33 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +25 -0
- package/dist/components/ui/vertical-tabs.d.ts +8 -0
- package/dist/components/ui/vertical-tabs.d.ts.map +1 -0
- package/dist/components/ui/vertical-tabs.js +37 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/lib/already_logged_in_config.server.d.ts +14 -0
- package/dist/lib/already_logged_in_config.server.d.ts.map +1 -0
- package/dist/lib/already_logged_in_config.server.js +29 -0
- package/dist/lib/app_logger.d.ts +12 -0
- package/dist/lib/app_logger.d.ts.map +1 -0
- package/dist/lib/app_logger.js +14 -0
- package/dist/lib/auth/auth_cache.d.ts +83 -0
- package/dist/lib/auth/auth_cache.d.ts.map +1 -0
- package/dist/lib/auth/auth_cache.js +158 -0
- package/dist/lib/auth/auth_rate_limiter.d.ts +39 -0
- package/dist/lib/auth/auth_rate_limiter.d.ts.map +1 -0
- package/dist/lib/auth/auth_rate_limiter.js +95 -0
- package/dist/lib/auth/auth_types.d.ts +53 -0
- package/dist/lib/auth/auth_types.d.ts.map +1 -0
- package/dist/lib/auth/auth_types.js +16 -0
- package/dist/lib/auth/auth_utils.server.d.ts +47 -0
- package/dist/lib/auth/auth_utils.server.d.ts.map +1 -0
- package/dist/lib/auth/auth_utils.server.js +150 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts +12 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -0
- package/dist/lib/auth/hazo_get_auth.server.js +256 -0
- package/dist/lib/auth/index.d.ts +9 -0
- package/dist/lib/auth/index.d.ts.map +1 -0
- package/dist/lib/auth/index.js +12 -0
- package/dist/lib/auth/server_auth.d.ts +26 -0
- package/dist/lib/auth/server_auth.d.ts.map +1 -0
- package/dist/lib/auth/server_auth.js +62 -0
- package/dist/lib/auth_utility_config.server.d.ts +20 -0
- package/dist/lib/auth_utility_config.server.d.ts.map +1 -0
- package/dist/lib/auth_utility_config.server.js +64 -0
- package/dist/lib/config/config_loader.server.d.ts +44 -0
- package/dist/lib/config/config_loader.server.d.ts.map +1 -0
- package/dist/lib/config/config_loader.server.js +122 -0
- package/dist/lib/email_verification_config.server.d.ts +14 -0
- package/dist/lib/email_verification_config.server.d.ts.map +1 -0
- package/dist/lib/email_verification_config.server.js +20 -0
- package/dist/lib/file_types_config.server.d.ts +11 -0
- package/dist/lib/file_types_config.server.d.ts.map +1 -0
- package/dist/lib/file_types_config.server.js +16 -0
- package/dist/lib/forgot_password_config.server.d.ts +14 -0
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -0
- package/dist/lib/forgot_password_config.server.js +20 -0
- package/dist/lib/hazo_connect_instance.server.d.ts +17 -0
- package/dist/lib/hazo_connect_instance.server.d.ts.map +1 -0
- package/dist/lib/hazo_connect_instance.server.js +88 -0
- package/dist/lib/hazo_connect_setup.d.ts +2 -0
- package/dist/lib/hazo_connect_setup.d.ts.map +1 -0
- package/dist/lib/hazo_connect_setup.js +49 -0
- package/dist/lib/hazo_connect_setup.server.d.ts +20 -0
- package/dist/lib/hazo_connect_setup.server.d.ts.map +1 -0
- package/dist/lib/hazo_connect_setup.server.js +138 -0
- package/dist/lib/index.d.ts +28 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +35 -0
- package/dist/lib/login_config.server.d.ts +20 -0
- package/dist/lib/login_config.server.d.ts.map +1 -0
- package/dist/lib/login_config.server.js +37 -0
- package/dist/lib/messages_config.server.d.ts +13 -0
- package/dist/lib/messages_config.server.d.ts.map +1 -0
- package/dist/lib/messages_config.server.js +18 -0
- package/dist/lib/migrations/apply_migration.d.ts +22 -0
- package/dist/lib/migrations/apply_migration.d.ts.map +1 -0
- package/dist/lib/migrations/apply_migration.js +78 -0
- package/dist/lib/my_settings_config.server.d.ts +65 -0
- package/dist/lib/my_settings_config.server.d.ts.map +1 -0
- package/dist/lib/my_settings_config.server.js +67 -0
- package/dist/lib/password_requirements_config.server.d.ts +15 -0
- package/dist/lib/password_requirements_config.server.d.ts.map +1 -0
- package/dist/lib/password_requirements_config.server.js +26 -0
- package/dist/lib/profile_pic_menu_config.server.d.ts +26 -0
- package/dist/lib/profile_pic_menu_config.server.d.ts.map +1 -0
- package/dist/lib/profile_pic_menu_config.server.js +95 -0
- package/dist/lib/profile_picture_config.server.d.ts +16 -0
- package/dist/lib/profile_picture_config.server.d.ts.map +1 -0
- package/dist/lib/profile_picture_config.server.js +40 -0
- package/dist/lib/register_config.server.d.ts +24 -0
- package/dist/lib/register_config.server.d.ts.map +1 -0
- package/dist/lib/register_config.server.js +39 -0
- package/dist/lib/reset_password_config.server.d.ts +25 -0
- package/dist/lib/reset_password_config.server.d.ts.map +1 -0
- package/dist/lib/reset_password_config.server.js +38 -0
- package/dist/lib/services/email_service.d.ts +44 -0
- package/dist/lib/services/email_service.d.ts.map +1 -0
- package/dist/lib/services/email_service.js +480 -0
- package/dist/lib/services/email_verification_service.d.ts +35 -0
- package/dist/lib/services/email_verification_service.d.ts.map +1 -0
- package/dist/lib/services/email_verification_service.js +208 -0
- package/dist/lib/services/index.d.ts +13 -0
- package/dist/lib/services/index.d.ts.map +1 -0
- package/dist/lib/services/index.js +14 -0
- package/dist/lib/services/login_service.d.ts +20 -0
- package/dist/lib/services/login_service.d.ts.map +1 -0
- package/dist/lib/services/login_service.js +94 -0
- package/dist/lib/services/password_change_service.d.ts +19 -0
- package/dist/lib/services/password_change_service.d.ts.map +1 -0
- package/dist/lib/services/password_change_service.js +118 -0
- package/dist/lib/services/password_reset_service.d.ts +52 -0
- package/dist/lib/services/password_reset_service.d.ts.map +1 -0
- package/dist/lib/services/password_reset_service.js +318 -0
- package/dist/lib/services/profile_picture_remove_service.d.ts +15 -0
- package/dist/lib/services/profile_picture_remove_service.d.ts.map +1 -0
- package/dist/lib/services/profile_picture_remove_service.js +94 -0
- package/dist/lib/services/profile_picture_service.d.ts +45 -0
- package/dist/lib/services/profile_picture_service.d.ts.map +1 -0
- package/dist/lib/services/profile_picture_service.js +183 -0
- package/dist/lib/services/profile_picture_source_mapper.d.ts +23 -0
- package/dist/lib/services/profile_picture_source_mapper.d.ts.map +1 -0
- package/dist/lib/services/profile_picture_source_mapper.js +45 -0
- package/dist/lib/services/registration_service.d.ts +20 -0
- package/dist/lib/services/registration_service.d.ts.map +1 -0
- package/dist/lib/services/registration_service.js +147 -0
- package/dist/lib/services/token_service.d.ts +20 -0
- package/dist/lib/services/token_service.d.ts.map +1 -0
- package/dist/lib/services/token_service.js +201 -0
- package/dist/lib/services/user_profiles_service.d.ts +31 -0
- package/dist/lib/services/user_profiles_service.d.ts.map +1 -0
- package/dist/lib/services/user_profiles_service.js +99 -0
- package/dist/lib/services/user_update_service.d.ts +23 -0
- package/dist/lib/services/user_update_service.d.ts.map +1 -0
- package/dist/lib/services/user_update_service.js +103 -0
- package/dist/lib/ui_shell_config.server.d.ts +16 -0
- package/dist/lib/ui_shell_config.server.d.ts.map +1 -0
- package/dist/lib/ui_shell_config.server.js +28 -0
- package/dist/lib/ui_sizes_config.server.d.ts +17 -0
- package/dist/lib/ui_sizes_config.server.d.ts.map +1 -0
- package/dist/lib/ui_sizes_config.server.js +22 -0
- package/dist/lib/user_fields_config.server.d.ts +13 -0
- package/dist/lib/user_fields_config.server.d.ts.map +1 -0
- package/dist/lib/user_fields_config.server.js +21 -0
- package/dist/lib/user_management_config.server.d.ts +10 -0
- package/dist/lib/user_management_config.server.d.ts.map +1 -0
- package/dist/lib/user_management_config.server.js +26 -0
- package/dist/lib/utils/api_route_helpers.d.ts +13 -0
- package/dist/lib/utils/api_route_helpers.d.ts.map +1 -0
- package/dist/lib/utils/api_route_helpers.js +58 -0
- package/dist/lib/utils/error_sanitizer.d.ts +16 -0
- package/dist/lib/utils/error_sanitizer.d.ts.map +1 -0
- package/dist/lib/utils/error_sanitizer.js +39 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/server/config/config_loader.d.ts +26 -0
- package/dist/server/config/config_loader.d.ts.map +1 -0
- package/dist/server/config/config_loader.js +329 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +32 -0
- package/dist/server/logging/logger_service.d.ts +3 -0
- package/dist/server/logging/logger_service.d.ts.map +1 -0
- package/dist/server/logging/logger_service.js +37 -0
- package/dist/server/routes/root_router.d.ts +3 -0
- package/dist/server/routes/root_router.d.ts.map +1 -0
- package/dist/server/routes/root_router.js +14 -0
- package/dist/server/server.d.ts +3 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +25 -0
- package/dist/server/types/app_types.d.ts +53 -0
- package/dist/server/types/app_types.d.ts.map +1 -0
- package/dist/server/types/app_types.js +1 -0
- package/migrations/003_add_url_on_logon_to_hazo_users.sql +8 -0
- package/next.config.mjs +12 -0
- package/package.json +150 -1
- package/src/components/index.ts +7 -0
- package/src/components/layouts/email_verification/config/email_verification_field_config.ts +2 -2
- package/src/components/layouts/email_verification/hooks/use_email_verification.ts +3 -3
- package/src/components/layouts/email_verification/index.tsx +11 -11
- package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +2 -2
- package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +3 -3
- package/src/components/layouts/forgot_password/index.tsx +10 -10
- package/src/components/layouts/index.ts +26 -0
- package/src/components/layouts/login/config/login_field_config.ts +2 -2
- package/src/components/layouts/login/hooks/use_login_form.ts +5 -5
- package/src/components/layouts/login/index.tsx +11 -11
- package/src/components/layouts/my_settings/components/editable_field.tsx +3 -3
- package/src/components/layouts/my_settings/components/password_change_dialog.tsx +5 -5
- package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +7 -7
- package/src/components/layouts/my_settings/components/profile_picture_display.tsx +2 -2
- package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +3 -3
- package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +5 -5
- package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +4 -4
- package/src/components/layouts/my_settings/config/my_settings_field_config.ts +2 -2
- package/src/components/layouts/my_settings/hooks/use_my_settings.ts +2 -2
- package/src/components/layouts/my_settings/index.tsx +10 -10
- package/src/components/layouts/register/config/register_field_config.ts +2 -2
- package/src/components/layouts/register/hooks/use_register_form.ts +4 -4
- package/src/components/layouts/register/index.tsx +11 -11
- package/src/components/layouts/reset_password/config/reset_password_field_config.ts +2 -2
- package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +4 -4
- package/src/components/layouts/reset_password/index.tsx +10 -10
- package/src/components/layouts/shared/components/already_logged_in_guard.tsx +4 -4
- package/src/components/layouts/shared/components/auth_page_shell.tsx +3 -3
- package/src/components/layouts/shared/components/form_action_buttons.tsx +2 -2
- package/src/components/layouts/shared/components/form_field_wrapper.tsx +2 -2
- package/src/components/layouts/shared/components/logout_button.tsx +2 -2
- package/src/components/layouts/shared/components/password_field.tsx +3 -3
- package/src/components/layouts/shared/components/profile_pic_menu.tsx +5 -5
- package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +2 -2
- package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +3 -3
- package/src/components/layouts/shared/components/standalone_layout_wrapper.tsx +1 -1
- package/src/components/layouts/shared/components/two_column_auth_layout.tsx +1 -1
- package/src/components/layouts/shared/components/unauthorized_guard.tsx +2 -2
- package/src/components/layouts/shared/hooks/use_hazo_auth.ts +1 -1
- package/src/components/layouts/shared/index.ts +34 -0
- package/src/components/layouts/shared/utils/validation.ts +1 -1
- package/src/components/layouts/user_management/components/roles_matrix.tsx +7 -7
- package/src/components/layouts/user_management/index.tsx +11 -11
- package/src/components/ui/alert-dialog.tsx +2 -2
- package/src/components/ui/avatar.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/dialog.tsx +1 -1
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/components/ui/hazo_ui_tooltip.tsx +1 -1
- package/src/components/ui/index.ts +22 -0
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +8 -8
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/components/ui/vertical-tabs.tsx +1 -1
- package/src/index.ts +7 -0
- package/src/lib/already_logged_in_config.server.ts +1 -1
- package/src/lib/app_logger.ts +1 -1
- package/src/lib/auth/auth_cache.ts +1 -1
- package/src/lib/auth/auth_utils.server.ts +2 -2
- package/src/lib/auth/hazo_get_auth.server.ts +8 -8
- package/src/lib/auth/index.ts +23 -0
- package/src/lib/auth/server_auth.ts +2 -2
- package/src/lib/auth_utility_config.server.ts +1 -1
- package/src/lib/config/config_loader.server.ts +1 -1
- package/src/lib/email_verification_config.server.ts +1 -1
- package/src/lib/file_types_config.server.ts +1 -1
- package/src/lib/forgot_password_config.server.ts +1 -1
- package/src/lib/hazo_connect_instance.server.ts +2 -2
- package/src/lib/hazo_connect_setup.server.ts +2 -2
- package/src/lib/index.ts +44 -0
- package/src/lib/login_config.server.ts +2 -2
- package/src/lib/messages_config.server.ts +1 -1
- package/src/lib/my_settings_config.server.ts +7 -7
- package/src/lib/password_requirements_config.server.ts +1 -1
- package/src/lib/profile_pic_menu_config.server.ts +1 -1
- package/src/lib/profile_picture_config.server.ts +2 -2
- package/src/lib/register_config.server.ts +4 -4
- package/src/lib/reset_password_config.server.ts +3 -3
- package/src/lib/services/email_service.ts +2 -2
- package/src/lib/services/email_verification_service.ts +3 -3
- package/src/lib/services/index.ts +15 -0
- package/src/lib/services/login_service.ts +3 -3
- package/src/lib/services/password_change_service.ts +3 -3
- package/src/lib/services/password_reset_service.ts +3 -3
- package/src/lib/services/profile_picture_remove_service.ts +3 -3
- package/src/lib/services/profile_picture_service.ts +5 -5
- package/src/lib/services/registration_service.ts +8 -8
- package/src/lib/services/token_service.ts +2 -2
- package/src/lib/services/user_profiles_service.ts +2 -2
- package/src/lib/services/user_update_service.ts +4 -4
- package/src/lib/ui_shell_config.server.ts +1 -1
- package/src/lib/ui_sizes_config.server.ts +1 -1
- package/src/lib/user_fields_config.server.ts +1 -1
- package/src/lib/user_management_config.server.ts +1 -2
- package/src/lib/utils/error_sanitizer.ts +1 -1
- package/src/routes/index.ts +34 -0
- package/src/server/config/config_loader.ts +2 -2
- package/src/server/index.ts +2 -2
- package/src/server/logging/logger_service.ts +1 -1
- package/src/server/server.ts +2 -2
- package/src/server/types/express.d.ts +1 -1
- package/tsconfig.build.json +39 -0
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// file_description: reset password layout component built atop shared layout utilities
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
// section: imports
|
|
6
|
+
import { PasswordField } from "hazo_auth/components/layouts/shared/components/password_field";
|
|
7
|
+
import { FormFieldWrapper } from "hazo_auth/components/layouts/shared/components/form_field_wrapper";
|
|
8
|
+
import { FormHeader } from "hazo_auth/components/layouts/shared/components/form_header";
|
|
9
|
+
import { FormActionButtons } from "hazo_auth/components/layouts/shared/components/form_action_buttons";
|
|
10
|
+
import { TwoColumnAuthLayout } from "hazo_auth/components/layouts/shared/components/two_column_auth_layout";
|
|
11
|
+
import { CheckCircle, XCircle, Loader2 } from "lucide-react";
|
|
12
|
+
import { AlreadyLoggedInGuard } from "hazo_auth/components/layouts/shared/components/already_logged_in_guard";
|
|
13
|
+
import { RESET_PASSWORD_FIELD_IDS, createResetPasswordFieldDefinitions, resolveResetPasswordButtonPalette, resolveResetPasswordLabels, resolveResetPasswordPasswordRequirements, } from "hazo_auth/components/layouts/reset_password/config/reset_password_field_config";
|
|
14
|
+
import { use_reset_password_form, } from "hazo_auth/components/layouts/reset_password/hooks/use_reset_password_form";
|
|
15
|
+
import Link from "next/link";
|
|
16
|
+
const ORDERED_FIELDS = [
|
|
17
|
+
RESET_PASSWORD_FIELD_IDS.PASSWORD,
|
|
18
|
+
RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD,
|
|
19
|
+
];
|
|
20
|
+
// section: component
|
|
21
|
+
export default function reset_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", errorMessage = "Reset password link invalid or has expired. Please go to Reset Password page to get a new link.", successMessage = "Password reset successfully. Redirecting to login...", loginPath = "/hazo_auth/login", forgotPasswordPath = "/hazo_auth/forgot_password", }) {
|
|
22
|
+
const fieldDefinitions = createResetPasswordFieldDefinitions(field_overrides);
|
|
23
|
+
const resolvedLabels = resolveResetPasswordLabels(labels);
|
|
24
|
+
const resolvedButtonPalette = resolveResetPasswordButtonPalette(button_colors);
|
|
25
|
+
const resolvedPasswordRequirements = resolveResetPasswordPasswordRequirements(password_requirements);
|
|
26
|
+
const form = use_reset_password_form({
|
|
27
|
+
passwordRequirements: resolvedPasswordRequirements,
|
|
28
|
+
dataClient: data_client,
|
|
29
|
+
loginPath,
|
|
30
|
+
});
|
|
31
|
+
const renderFields = (formState) => {
|
|
32
|
+
return ORDERED_FIELDS.map((fieldId) => {
|
|
33
|
+
const fieldDefinition = fieldDefinitions[fieldId];
|
|
34
|
+
const fieldValue = formState.values[fieldId];
|
|
35
|
+
const fieldError = formState.errors[fieldId];
|
|
36
|
+
const inputElement = (_jsx(PasswordField, { inputId: fieldDefinition.id, ariaLabel: fieldDefinition.ariaLabel, value: fieldValue, placeholder: fieldDefinition.placeholder, autoComplete: fieldDefinition.autoComplete, isVisible: formState.passwordVisibility[fieldDefinition.id], onChange: (nextValue) => formState.handleFieldChange(fieldId, nextValue), onToggleVisibility: () => formState.togglePasswordVisibility(fieldDefinition.id), errorMessage: fieldError }));
|
|
37
|
+
return (_jsx(FormFieldWrapper, { fieldId: fieldDefinition.id, label: fieldDefinition.label, input: inputElement, errorMessage: fieldError }, fieldId));
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
// Show success message if password reset was successful
|
|
41
|
+
if (form.isSuccess) {
|
|
42
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("div", { className: "cls_reset_password_layout_success flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(CheckCircle, { className: "cls_reset_password_layout_success_icon h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsx("p", { className: "cls_reset_password_layout_success_message text-lg font-medium text-slate-900", children: successMessage })] })] }) }) }));
|
|
43
|
+
}
|
|
44
|
+
// Show loading state while validating token
|
|
45
|
+
if (form.isValidatingToken) {
|
|
46
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_validating flex flex-col items-center justify-center gap-4 py-8", children: [_jsx(Loader2, { className: "h-12 w-12 animate-spin text-slate-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_validating_text text-center", children: [_jsx("h1", { className: "cls_reset_password_layout_validating_heading text-2xl font-semibold text-slate-900", children: resolvedLabels.heading }), _jsx("p", { className: "cls_reset_password_layout_validating_subheading mt-2 text-sm text-slate-600", children: "Validating reset token..." })] })] }) }) }));
|
|
47
|
+
}
|
|
48
|
+
// Show error message if token is invalid or missing
|
|
49
|
+
if (form.tokenError || !form.token) {
|
|
50
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_error flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(XCircle, { className: "cls_reset_password_layout_error_icon h-16 w-16 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_error_text", children: [_jsx("h1", { className: "cls_reset_password_layout_error_heading text-2xl font-semibold text-slate-900", children: "Invalid Reset Link" }), _jsx("p", { className: "cls_reset_password_layout_error_message mt-2 text-sm text-slate-600", children: form.tokenError || errorMessage })] }), _jsx(Link, { href: forgotPasswordPath, className: "cls_reset_password_layout_forgot_password_link mt-4 text-sm text-blue-600 hover:text-blue-800 underline", children: "Go to Reset Password page" })] }) }) }));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_reset_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "Reset password form", children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: "Submit reset password form", cancelAriaLabel: "Cancel reset password form" }), form.isSubmitting && (_jsx("div", { className: "cls_reset_password_layout_submitting_indicator text-sm text-slate-600 text-center", children: "Resetting password..." }))] })] }) }) }));
|
|
53
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AlreadyLoggedInGuardProps = {
|
|
2
|
+
image_src: string;
|
|
3
|
+
image_alt: string;
|
|
4
|
+
image_background_color?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
showLogoutButton?: boolean;
|
|
7
|
+
showReturnHomeButton?: boolean;
|
|
8
|
+
returnHomeButtonLabel?: string;
|
|
9
|
+
returnHomePath?: string;
|
|
10
|
+
requireEmailVerified?: boolean;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Guard component that shows "already logged in" message if user is authenticated
|
|
15
|
+
* Otherwise renders children
|
|
16
|
+
* @param props - Component props including layout config and message customization
|
|
17
|
+
* @returns Either the "already logged in" UI or the children
|
|
18
|
+
*/
|
|
19
|
+
export declare function AlreadyLoggedInGuard({ image_src, image_alt, image_background_color, message, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, requireEmailVerified, children, }: AlreadyLoggedInGuardProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=already_logged_in_guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,OAAqC,EACrC,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,oBAA4B,EAC5B,QAAQ,GACT,EAAE,yBAAyB,2CAiD3B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// file_description: reusable component to show "already logged in" message when user is authenticated
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
// section: imports
|
|
6
|
+
import { use_auth_status } from "hazo_auth/components/layouts/shared/hooks/use_auth_status";
|
|
7
|
+
import { LogoutButton } from "hazo_auth/components/layouts/shared/components/logout_button";
|
|
8
|
+
import { Button } from "hazo_auth/components/ui/button";
|
|
9
|
+
import { TwoColumnAuthLayout } from "hazo_auth/components/layouts/shared/components/two_column_auth_layout";
|
|
10
|
+
import { useRouter } from "next/navigation";
|
|
11
|
+
import { Home } from "lucide-react";
|
|
12
|
+
// section: component
|
|
13
|
+
/**
|
|
14
|
+
* Guard component that shows "already logged in" message if user is authenticated
|
|
15
|
+
* Otherwise renders children
|
|
16
|
+
* @param props - Component props including layout config and message customization
|
|
17
|
+
* @returns Either the "already logged in" UI or the children
|
|
18
|
+
*/
|
|
19
|
+
export function AlreadyLoggedInGuard({ image_src, image_alt, image_background_color = "#f1f5f9", message = "You're already logged in.", showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", requireEmailVerified = false, children, }) {
|
|
20
|
+
const router = useRouter();
|
|
21
|
+
const authStatus = use_auth_status();
|
|
22
|
+
// Check if user should see "already logged in" message
|
|
23
|
+
// If requireEmailVerified is true, only show if email is verified
|
|
24
|
+
// If requireEmailVerified is false, show if authenticated
|
|
25
|
+
const shouldShowAlreadyLoggedIn = authStatus.authenticated &&
|
|
26
|
+
!authStatus.loading &&
|
|
27
|
+
(!requireEmailVerified || authStatus.email_verified === true);
|
|
28
|
+
if (shouldShowAlreadyLoggedIn) {
|
|
29
|
+
return (_jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_already_logged_in_guard flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx("p", { className: "cls_already_logged_in_guard_message text-lg font-medium text-slate-900", children: message }), _jsxs("div", { className: "cls_already_logged_in_guard_actions flex flex-col gap-3 items-center mt-4", children: [showLogoutButton && (_jsx(LogoutButton, { className: "cls_already_logged_in_guard_logout_button", variant: "default" })), showReturnHomeButton && (_jsxs(Button, { onClick: () => router.push(returnHomePath), variant: "outline", className: "cls_already_logged_in_guard_return_home_button", "aria-label": returnHomeButtonLabel, children: [_jsx(Home, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), returnHomeButtonLabel] }))] })] }) }));
|
|
30
|
+
}
|
|
31
|
+
return _jsx(_Fragment, { children: children });
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type AuthPageShellProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare function AuthPageShell({ children }: AuthPageShellProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=auth_page_shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_page_shell.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/auth_page_shell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAGF,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAmB7D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SidebarLayoutWrapper } from "hazo_auth/components/layouts/shared/components/sidebar_layout_wrapper";
|
|
3
|
+
import { StandaloneLayoutWrapper } from "hazo_auth/components/layouts/shared/components/standalone_layout_wrapper";
|
|
4
|
+
import { get_ui_shell_config } from "hazo_auth/lib/ui_shell_config.server";
|
|
5
|
+
// section: component
|
|
6
|
+
export function AuthPageShell({ children }) {
|
|
7
|
+
const uiShellConfig = get_ui_shell_config();
|
|
8
|
+
if (uiShellConfig.layout_mode === "standalone") {
|
|
9
|
+
return (_jsx(StandaloneLayoutWrapper, { heading: uiShellConfig.standalone_heading, description: uiShellConfig.standalone_description, wrapperClassName: uiShellConfig.standalone_wrapper_class, contentClassName: uiShellConfig.standalone_content_class, showHeading: uiShellConfig.standalone_show_heading, showDescription: uiShellConfig.standalone_show_description, children: children }));
|
|
10
|
+
}
|
|
11
|
+
return _jsx(SidebarLayoutWrapper, { children: children });
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type FieldErrorMessageProps = {
|
|
2
|
+
message: string | string[];
|
|
3
|
+
className?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function FieldErrorMessage({ message, className, }: FieldErrorMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=field_error_message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field_error_message.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/field_error_message.tsx"],"names":[],"mappings":"AAEA,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,SAAS,GACV,EAAE,sBAAsB,2CAgBxB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// section: component
|
|
3
|
+
export function FieldErrorMessage({ message, className, }) {
|
|
4
|
+
const messages = Array.isArray(message) ? message : [message];
|
|
5
|
+
return (_jsx("div", { className: `cls_field_error_message flex flex-col gap-1 text-sm text-red-600 ${className !== null && className !== void 0 ? className : ""}`, role: "alert", "aria-live": "polite", children: messages.map((msg, index) => (_jsx("p", { className: "break-words leading-relaxed", children: msg }, index))) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ButtonPaletteDefaults } from "hazo_auth/components/layouts/shared/config/layout_customization";
|
|
2
|
+
type FormActionButtonsProps = {
|
|
3
|
+
submitLabel: string;
|
|
4
|
+
cancelLabel: string;
|
|
5
|
+
buttonPalette: ButtonPaletteDefaults;
|
|
6
|
+
isSubmitDisabled: boolean;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
submitAriaLabel?: string;
|
|
9
|
+
cancelAriaLabel?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function FormActionButtons({ submitLabel, cancelLabel, buttonPalette, isSubmitDisabled, onCancel, submitAriaLabel, cancelAriaLabel, className, }: FormActionButtonsProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=form_action_buttons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form_action_buttons.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_action_buttons.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAC;AAG7G,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,qBAAqB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,eAA+B,EAC/B,eAA+B,EAC/B,SAAS,GACV,EAAE,sBAAsB,2CAkCxB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// file_description: reusable form action buttons component with submit (positive, left) and cancel (negative, right) buttons
|
|
3
|
+
// section: imports
|
|
4
|
+
import { CircleCheckBig, CircleX } from "lucide-react";
|
|
5
|
+
import { Button } from "hazo_auth/components/ui/button";
|
|
6
|
+
// section: component
|
|
7
|
+
export function FormActionButtons({ submitLabel, cancelLabel, buttonPalette, isSubmitDisabled, onCancel, submitAriaLabel = "Submit form", cancelAriaLabel = "Cancel form", className, }) {
|
|
8
|
+
return (_jsxs("div", { className: `cls_form_action_buttons mt-2 flex items-center justify-end gap-4 ${className !== null && className !== void 0 ? className : ""}`, children: [_jsxs(Button, { type: "submit", disabled: isSubmitDisabled, className: "cls_form_action_submit_button flex items-center gap-2", "aria-label": submitAriaLabel, style: {
|
|
9
|
+
backgroundColor: buttonPalette.submitBackground,
|
|
10
|
+
color: buttonPalette.submitText,
|
|
11
|
+
}, children: [_jsx(CircleCheckBig, { className: "h-4 w-4", "aria-hidden": "true" }), _jsx("span", { children: submitLabel })] }), _jsxs(Button, { type: "button", variant: "outline", onClick: onCancel, className: "cls_form_action_cancel_button flex items-center gap-2", "aria-label": cancelAriaLabel, style: {
|
|
12
|
+
borderColor: buttonPalette.cancelBorder,
|
|
13
|
+
color: buttonPalette.cancelText,
|
|
14
|
+
}, children: [_jsx(CircleX, { className: "h-4 w-4", "aria-hidden": "true" }), _jsx("span", { children: cancelLabel })] })] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type FormFieldWrapperProps = {
|
|
2
|
+
fieldId: string;
|
|
3
|
+
label: string;
|
|
4
|
+
input: React.ReactNode;
|
|
5
|
+
errorMessage?: string | string[];
|
|
6
|
+
className?: string;
|
|
7
|
+
labelClassName?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function FormFieldWrapper({ fieldId, label, input, errorMessage, className, labelClassName, }: FormFieldWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=form_field_wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form_field_wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_field_wrapper.tsx"],"names":[],"mappings":"AAMA,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAGF,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,KAAK,EACL,KAAK,EACL,YAAY,EACZ,SAAS,EACT,cAAc,GACf,EAAE,qBAAqB,2CAmBvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// file_description: reusable wrapper component for form fields that standardizes label, input, and error message structure
|
|
3
|
+
// section: imports
|
|
4
|
+
import { Label } from "hazo_auth/components/ui/label";
|
|
5
|
+
import { FieldErrorMessage } from "hazo_auth/components/layouts/shared/components/field_error_message";
|
|
6
|
+
// section: component
|
|
7
|
+
export function FormFieldWrapper({ fieldId, label, input, errorMessage, className, labelClassName, }) {
|
|
8
|
+
return (_jsxs("div", { className: `cls_form_field_wrapper flex flex-col gap-2 ${className !== null && className !== void 0 ? className : ""}`, children: [_jsx(Label, { htmlFor: fieldId, className: `cls_form_field_label text-sm font-medium text-slate-800 ${labelClassName !== null && labelClassName !== void 0 ? labelClassName : ""}`, children: label }), input, errorMessage ? (_jsx("div", { className: "mt-1 min-h-0", children: _jsx(FieldErrorMessage, { message: errorMessage }) })) : null] }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type FormHeaderProps = {
|
|
2
|
+
heading: string;
|
|
3
|
+
subHeading: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
headingClassName?: string;
|
|
6
|
+
subHeadingClassName?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function FormHeader({ heading, subHeading, className, headingClassName, subHeadingClassName, }: FormHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=form_header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form_header.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_header.tsx"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,mBAAmB,GACpB,EAAE,eAAe,2CAiBjB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// section: component
|
|
3
|
+
export function FormHeader({ heading, subHeading, className, headingClassName, subHeadingClassName, }) {
|
|
4
|
+
return (_jsxs("header", { className: `cls_form_header flex flex-col gap-2 text-center md:text-left ${className !== null && className !== void 0 ? className : ""}`, children: [_jsx("h1", { className: `cls_form_header_title text-2xl font-semibold text-slate-900 ${headingClassName !== null && headingClassName !== void 0 ? headingClassName : ""}`, children: heading }), _jsx("p", { className: `cls_form_header_subtitle text-sm text-slate-600 ${subHeadingClassName !== null && subHeadingClassName !== void 0 ? subHeadingClassName : ""}`, children: subHeading })] }));
|
|
5
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type LogoutButtonProps = {
|
|
2
|
+
className?: string;
|
|
3
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
4
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
5
|
+
};
|
|
6
|
+
export declare function LogoutButton({ className, variant, size, }: LogoutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=logout_button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/logout_button.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;CACzC,CAAC;AAGF,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,OAAmB,EACnB,IAAgB,GACjB,EAAE,iBAAiB,2CAkDnB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// file_description: logout button component for user logout functionality
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
// section: imports
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { useRouter } from "next/navigation";
|
|
8
|
+
import { Button } from "hazo_auth/components/ui/button";
|
|
9
|
+
import { LogOut } from "lucide-react";
|
|
10
|
+
import { toast } from "sonner";
|
|
11
|
+
import { trigger_auth_status_refresh } from "hazo_auth/components/layouts/shared/hooks/use_auth_status";
|
|
12
|
+
// section: component
|
|
13
|
+
export function LogoutButton({ className, variant = "outline", size = "default", }) {
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
16
|
+
const handleLogout = async () => {
|
|
17
|
+
setIsLoggingOut(true);
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch("/api/hazo_auth/logout", {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: {
|
|
22
|
+
"Content-Type": "application/json",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const data = await response.json();
|
|
26
|
+
if (!response.ok || !data.success) {
|
|
27
|
+
throw new Error(data.error || "Logout failed");
|
|
28
|
+
}
|
|
29
|
+
toast.success("Logged out successfully");
|
|
30
|
+
// Trigger auth status refresh in all components (navbar, sidebar, etc.)
|
|
31
|
+
trigger_auth_status_refresh();
|
|
32
|
+
// Refresh the page to update authentication state (cookies are cleared server-side)
|
|
33
|
+
router.refresh();
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const errorMessage = error instanceof Error ? error.message : "Logout failed. Please try again.";
|
|
37
|
+
toast.error(errorMessage);
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
setIsLoggingOut(false);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (_jsxs(Button, { onClick: handleLogout, disabled: isLoggingOut, variant: variant, size: size, className: className, "aria-label": "Logout", children: [_jsx(LogOut, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), isLoggingOut ? "Logging out..." : "Logout"] }));
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type PasswordFieldProps = {
|
|
2
|
+
inputId: string;
|
|
3
|
+
ariaLabel: string;
|
|
4
|
+
value: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
autoComplete?: string;
|
|
7
|
+
isVisible: boolean;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
onToggleVisibility: () => void;
|
|
10
|
+
errorMessage?: string | string[];
|
|
11
|
+
};
|
|
12
|
+
export declare function PasswordField({ inputId, ariaLabel, value, placeholder, autoComplete, isVisible, onChange, onToggleVisibility, errorMessage, }: PasswordFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=password_field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password_field.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/password_field.tsx"],"names":[],"mappings":"AAWA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC;AAGF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,YAAY,GACb,EAAE,kBAAkB,2CAoCpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// file_description: reusable password input with visibility toggle and error messaging
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
// section: imports
|
|
6
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
7
|
+
import { Button } from "hazo_auth/components/ui/button";
|
|
8
|
+
import { Input } from "hazo_auth/components/ui/input";
|
|
9
|
+
import { FieldErrorMessage } from "hazo_auth/components/layouts/shared/components/field_error_message";
|
|
10
|
+
// section: component
|
|
11
|
+
export function PasswordField({ inputId, ariaLabel, value, placeholder, autoComplete, isVisible, onChange, onToggleVisibility, errorMessage, }) {
|
|
12
|
+
return (_jsxs("div", { className: "cls_password_field_wrapper", children: [_jsxs("div", { className: "relative", children: [_jsx(Input, { id: inputId, type: isVisible ? "text" : "password", value: value, onChange: (event) => onChange(event.target.value), autoComplete: autoComplete, placeholder: placeholder, "aria-label": ariaLabel, className: "cls_password_field_input pr-11" }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": `${isVisible ? "Hide" : "Show"} ${ariaLabel.toLowerCase()}`, onClick: onToggleVisibility, className: "cls_password_field_toggle absolute right-1 top-1/2 -translate-y-1/2 text-slate-600 hover:text-slate-900", children: isVisible ? (_jsx(EyeOff, { className: "h-4 w-4", "aria-hidden": "true" })) : (_jsx(Eye, { className: "h-4 w-4", "aria-hidden": "true" })) })] }), errorMessage ? (_jsx("div", { className: "mt-1 min-h-0", children: _jsx(FieldErrorMessage, { message: errorMessage }) })) : null] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ProfilePicMenuMenuItem } from "hazo_auth/lib/profile_pic_menu_config.server";
|
|
2
|
+
export type ProfilePicMenuProps = {
|
|
3
|
+
show_single_button?: boolean;
|
|
4
|
+
sign_up_label?: string;
|
|
5
|
+
sign_in_label?: string;
|
|
6
|
+
register_path?: string;
|
|
7
|
+
login_path?: string;
|
|
8
|
+
settings_path?: string;
|
|
9
|
+
logout_path?: string;
|
|
10
|
+
custom_menu_items?: ProfilePicMenuMenuItem[];
|
|
11
|
+
className?: string;
|
|
12
|
+
avatar_size?: "default" | "sm" | "lg";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Profile picture menu component
|
|
16
|
+
* Shows user profile picture when authenticated, or sign up/sign in buttons when not authenticated
|
|
17
|
+
* Clicking profile picture opens dropdown menu with user info and actions
|
|
18
|
+
* @param props - Component props including configuration options
|
|
19
|
+
* @returns Profile picture menu component
|
|
20
|
+
*/
|
|
21
|
+
export declare function ProfilePicMenu({ show_single_button, sign_up_label, sign_in_label, register_path, login_path, settings_path, logout_path, custom_menu_items, className, avatar_size, }: ProfilePicMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=profile_pic_menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile_pic_menu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/profile_pic_menu.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAG3F,MAAM,MAAM,mBAAmB,GAAG;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CACvC,CAAC;AAGF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,kBAA0B,EAC1B,aAAyB,EACzB,aAAyB,EACzB,aAAqC,EACrC,UAA+B,EAC/B,aAAwC,EACxC,WAAqC,EACrC,iBAAsB,EACtB,SAAS,EACT,WAAuB,GACxB,EAAE,mBAAmB,2CAuQrB"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// file_description: profile picture menu component for navbar or sidebar - shows profile picture when logged in, or sign up/sign in buttons when not logged in
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
// section: imports
|
|
6
|
+
import { useState, useMemo } from "react";
|
|
7
|
+
import { useRouter } from "next/navigation";
|
|
8
|
+
import Link from "next/link";
|
|
9
|
+
import { Avatar, AvatarImage, AvatarFallback } from "hazo_auth/components/ui/avatar";
|
|
10
|
+
import { Button } from "hazo_auth/components/ui/button";
|
|
11
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "hazo_auth/components/ui/dropdown-menu";
|
|
12
|
+
import { Settings, LogOut } from "lucide-react";
|
|
13
|
+
import { toast } from "sonner";
|
|
14
|
+
import { use_auth_status, trigger_auth_status_refresh } from "hazo_auth/components/layouts/shared/hooks/use_auth_status";
|
|
15
|
+
// section: component
|
|
16
|
+
/**
|
|
17
|
+
* Profile picture menu component
|
|
18
|
+
* Shows user profile picture when authenticated, or sign up/sign in buttons when not authenticated
|
|
19
|
+
* Clicking profile picture opens dropdown menu with user info and actions
|
|
20
|
+
* @param props - Component props including configuration options
|
|
21
|
+
* @returns Profile picture menu component
|
|
22
|
+
*/
|
|
23
|
+
export function ProfilePicMenu({ show_single_button = false, sign_up_label = "Sign Up", sign_in_label = "Sign In", register_path = "/hazo_auth/register", login_path = "/hazo_auth/login", settings_path = "/hazo_auth/my_settings", logout_path = "/api/hazo_auth/logout", custom_menu_items = [], className, avatar_size = "default", }) {
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
const authStatus = use_auth_status();
|
|
26
|
+
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
27
|
+
// Get initials from name or email
|
|
28
|
+
const getInitials = () => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (authStatus.name) {
|
|
31
|
+
const parts = authStatus.name.trim().split(" ");
|
|
32
|
+
if (parts.length >= 2) {
|
|
33
|
+
return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
|
|
34
|
+
}
|
|
35
|
+
return ((_a = authStatus.name[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || "";
|
|
36
|
+
}
|
|
37
|
+
if (authStatus.email) {
|
|
38
|
+
return ((_b = authStatus.email[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) || "";
|
|
39
|
+
}
|
|
40
|
+
return "?";
|
|
41
|
+
};
|
|
42
|
+
// Handle logout
|
|
43
|
+
const handleLogout = async () => {
|
|
44
|
+
setIsLoggingOut(true);
|
|
45
|
+
try {
|
|
46
|
+
const response = await fetch(logout_path, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: {
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const data = await response.json();
|
|
53
|
+
if (!response.ok || !data.success) {
|
|
54
|
+
throw new Error(data.error || "Logout failed");
|
|
55
|
+
}
|
|
56
|
+
toast.success("Logged out successfully");
|
|
57
|
+
// Trigger auth status refresh in all components
|
|
58
|
+
trigger_auth_status_refresh();
|
|
59
|
+
// Refresh the page to update authentication state
|
|
60
|
+
router.refresh();
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const errorMessage = error instanceof Error ? error.message : "Logout failed. Please try again.";
|
|
64
|
+
toast.error(errorMessage);
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
setIsLoggingOut(false);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// Build menu items with default items and custom items
|
|
71
|
+
const menuItems = useMemo(() => {
|
|
72
|
+
const items = [];
|
|
73
|
+
// Add default info items (only if authenticated)
|
|
74
|
+
if (authStatus.authenticated) {
|
|
75
|
+
// User name (info, order: 1)
|
|
76
|
+
if (authStatus.name) {
|
|
77
|
+
items.push({
|
|
78
|
+
type: "info",
|
|
79
|
+
value: authStatus.name,
|
|
80
|
+
order: 1,
|
|
81
|
+
id: "default_name",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// Email address (info, order: 2)
|
|
85
|
+
if (authStatus.email) {
|
|
86
|
+
items.push({
|
|
87
|
+
type: "info",
|
|
88
|
+
value: authStatus.email,
|
|
89
|
+
order: 2,
|
|
90
|
+
id: "default_email",
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// Separator (order: 1)
|
|
94
|
+
items.push({
|
|
95
|
+
type: "separator",
|
|
96
|
+
order: 1,
|
|
97
|
+
id: "default_separator",
|
|
98
|
+
});
|
|
99
|
+
// Settings (link, order: 1)
|
|
100
|
+
items.push({
|
|
101
|
+
type: "link",
|
|
102
|
+
label: "Settings",
|
|
103
|
+
href: settings_path,
|
|
104
|
+
order: 1,
|
|
105
|
+
id: "default_settings",
|
|
106
|
+
});
|
|
107
|
+
// Logout (link, order: 2)
|
|
108
|
+
items.push({
|
|
109
|
+
type: "link",
|
|
110
|
+
label: "Logout",
|
|
111
|
+
href: logout_path,
|
|
112
|
+
order: 2,
|
|
113
|
+
id: "default_logout",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// Add custom menu items
|
|
117
|
+
items.push(...custom_menu_items);
|
|
118
|
+
// Sort items by type group and order
|
|
119
|
+
// Order: info items first, then separators, then links
|
|
120
|
+
items.sort((a, b) => {
|
|
121
|
+
// Define type priority: info = 0, separator = 1, link = 2
|
|
122
|
+
const typePriority = { info: 0, separator: 1, link: 2 };
|
|
123
|
+
const aPriority = typePriority[a.type];
|
|
124
|
+
const bPriority = typePriority[b.type];
|
|
125
|
+
if (aPriority !== bPriority) {
|
|
126
|
+
return aPriority - bPriority;
|
|
127
|
+
}
|
|
128
|
+
// Within same type, sort by order
|
|
129
|
+
return a.order - b.order;
|
|
130
|
+
});
|
|
131
|
+
return items;
|
|
132
|
+
}, [authStatus.authenticated, authStatus.name, authStatus.email, settings_path, logout_path, custom_menu_items]);
|
|
133
|
+
// Avatar size classes
|
|
134
|
+
const avatarSizeClasses = {
|
|
135
|
+
sm: "h-8 w-8",
|
|
136
|
+
default: "h-10 w-10",
|
|
137
|
+
lg: "h-12 w-12",
|
|
138
|
+
};
|
|
139
|
+
// Show loading state
|
|
140
|
+
if (authStatus.loading) {
|
|
141
|
+
return (_jsx("div", { className: `cls_profile_pic_menu ${className || ""}`, children: _jsx("div", { className: "h-10 w-10 rounded-full bg-slate-200 animate-pulse" }) }));
|
|
142
|
+
}
|
|
143
|
+
// Not authenticated - show sign up/sign in buttons
|
|
144
|
+
if (!authStatus.authenticated) {
|
|
145
|
+
return (_jsx("div", { className: `cls_profile_pic_menu flex items-center gap-2 ${className || ""}`, children: show_single_button ? (_jsx(Button, { asChild: true, variant: "default", size: "sm", children: _jsx(Link, { href: register_path, className: "cls_profile_pic_menu_sign_up", children: sign_up_label }) })) : (_jsxs(_Fragment, { children: [_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: register_path, className: "cls_profile_pic_menu_sign_up", children: sign_up_label }) }), _jsx(Button, { asChild: true, variant: "default", size: "sm", children: _jsx(Link, { href: login_path, className: "cls_profile_pic_menu_sign_in", children: sign_in_label }) })] })) }));
|
|
146
|
+
}
|
|
147
|
+
// Authenticated - show profile picture with dropdown menu
|
|
148
|
+
return (_jsx("div", { className: `cls_profile_pic_menu ${className || ""}`, children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { className: "cls_profile_pic_menu_trigger focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary rounded-full", "aria-label": "Profile menu", children: _jsxs(Avatar, { className: `cls_profile_pic_menu_avatar ${avatarSizeClasses[avatar_size]} cursor-pointer`, children: [_jsx(AvatarImage, { src: authStatus.profile_picture_url, alt: authStatus.name ? `Profile picture of ${authStatus.name}` : "Profile picture", className: "cls_profile_pic_menu_image" }), _jsx(AvatarFallback, { className: "cls_profile_pic_menu_fallback bg-slate-200 text-slate-600", children: getInitials() })] }) }) }), _jsx(DropdownMenuContent, { align: "end", className: "cls_profile_pic_menu_dropdown w-56", children: menuItems.map((item) => {
|
|
149
|
+
if (item.type === "separator") {
|
|
150
|
+
return _jsx(DropdownMenuSeparator, { className: "cls_profile_pic_menu_separator" }, item.id);
|
|
151
|
+
}
|
|
152
|
+
if (item.type === "info") {
|
|
153
|
+
return (_jsx("div", { className: "cls_profile_pic_menu_info", children: item.value && (_jsx("div", { className: "cls_profile_pic_menu_info_value px-2 py-1.5 text-sm text-foreground", children: item.value })) }, item.id));
|
|
154
|
+
}
|
|
155
|
+
if (item.type === "link") {
|
|
156
|
+
// Special handling for logout
|
|
157
|
+
if (item.id === "default_logout") {
|
|
158
|
+
return (_jsxs(DropdownMenuItem, { onClick: handleLogout, disabled: isLoggingOut, className: "cls_profile_pic_menu_logout cursor-pointer text-destructive focus:text-destructive", children: [_jsx(LogOut, { className: "mr-2 h-4 w-4" }), isLoggingOut ? "Logging out..." : item.label] }, item.id));
|
|
159
|
+
}
|
|
160
|
+
// Special handling for settings
|
|
161
|
+
if (item.id === "default_settings") {
|
|
162
|
+
return (_jsx(DropdownMenuItem, { asChild: true, className: "cls_profile_pic_menu_settings cursor-pointer", children: _jsxs(Link, { href: item.href || settings_path, children: [_jsx(Settings, { className: "mr-2 h-4 w-4" }), item.label] }) }, item.id));
|
|
163
|
+
}
|
|
164
|
+
// Generic link handling
|
|
165
|
+
return (_jsx(DropdownMenuItem, { asChild: true, className: "cls_profile_pic_menu_link cursor-pointer", children: _jsx(Link, { href: item.href || "#", children: item.label }) }, item.id));
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}) })] }) }));
|
|
169
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ProfilePicMenuWrapperProps = {
|
|
2
|
+
className?: string;
|
|
3
|
+
avatar_size?: "default" | "sm" | "lg";
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Server wrapper component that loads profile picture menu configuration from hazo_auth_config.ini
|
|
7
|
+
* and passes it to the client ProfilePicMenu component
|
|
8
|
+
* @param props - Component props including className and avatar_size
|
|
9
|
+
* @returns ProfilePicMenu component with loaded configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare function ProfilePicMenuWrapper({ className, avatar_size, }: ProfilePicMenuWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=profile_pic_menu_wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile_pic_menu_wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CACvC,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,WAAW,GACZ,EAAE,0BAA0B,2CAiB5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// file_description: server wrapper component that loads profile picture menu configuration and passes to client component
|
|
3
|
+
// section: imports
|
|
4
|
+
import { ProfilePicMenu } from "hazo_auth/components/layouts/shared/components/profile_pic_menu";
|
|
5
|
+
import { get_profile_pic_menu_config } from "hazo_auth/lib/profile_pic_menu_config.server";
|
|
6
|
+
// section: component
|
|
7
|
+
/**
|
|
8
|
+
* Server wrapper component that loads profile picture menu configuration from hazo_auth_config.ini
|
|
9
|
+
* and passes it to the client ProfilePicMenu component
|
|
10
|
+
* @param props - Component props including className and avatar_size
|
|
11
|
+
* @returns ProfilePicMenu component with loaded configuration
|
|
12
|
+
*/
|
|
13
|
+
export function ProfilePicMenuWrapper({ className, avatar_size, }) {
|
|
14
|
+
const config = get_profile_pic_menu_config();
|
|
15
|
+
return (_jsx(ProfilePicMenu, { show_single_button: config.show_single_button, sign_up_label: config.sign_up_label, sign_in_label: config.sign_in_label, register_path: config.register_path, login_path: config.login_path, settings_path: config.settings_path, logout_path: config.logout_path, custom_menu_items: config.custom_menu_items, className: className, avatar_size: avatar_size }));
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar_layout_wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/sidebar_layout_wrapper.tsx"],"names":[],"mappings":"AAwBA,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,2CAuL3E"}
|