hazo_auth 10.18.4 → 10.22.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.
- package/README.md +6 -0
- package/SETUP_CHECKLIST.md +27 -0
- package/cli-src/lib/already_logged_in_config.server.ts +11 -7
- package/cli-src/lib/auth_hooks.ts +52 -0
- package/cli-src/lib/config/config_loader.server.ts +34 -0
- package/cli-src/lib/email_verification_config.server.ts +2 -2
- package/cli-src/lib/forgot_password_config.server.ts +2 -2
- package/cli-src/lib/login_config.server.ts +25 -19
- package/cli-src/lib/my_settings_config.server.ts +22 -15
- package/cli-src/lib/navbar_config.server.ts +12 -8
- package/cli-src/lib/oauth_config.server.ts +14 -22
- package/cli-src/lib/otp_config.server.ts +11 -4
- package/cli-src/lib/profile_pic_menu_config.server.ts +16 -5
- package/cli-src/lib/register_config.server.ts +21 -16
- package/cli-src/lib/reset_password_config.server.ts +11 -17
- package/cli-src/lib/services/oauth_service.ts +16 -0
- package/cli-src/lib/services/otp_service.ts +7 -0
- package/cli-src/lib/services/registration_service.ts +8 -0
- package/cli-src/lib/ui_shell_config.server.ts +11 -13
- package/cli-src/lib/utils/password_validator.ts +12 -5
- package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
- package/dist/components/layouts/create_firm/index.js +4 -3
- package/dist/components/layouts/dev_lock/index.d.ts.map +1 -1
- package/dist/components/layouts/dev_lock/index.js +4 -2
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +5 -4
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/config/email_verification_field_config.js +32 -29
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +14 -13
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/index.js +13 -9
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +3 -2
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +21 -18
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +10 -9
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/index.js +15 -6
- package/dist/components/layouts/legal/legal_acceptance_gate.d.ts.map +1 -1
- package/dist/components/layouts/legal/legal_acceptance_gate.js +5 -3
- package/dist/components/layouts/legal/legal_doc_checkbox_list.d.ts.map +1 -1
- package/dist/components/layouts/legal/legal_doc_checkbox_list.js +3 -1
- package/dist/components/layouts/legal/legal_doc_combined_view.d.ts.map +1 -1
- package/dist/components/layouts/legal/legal_doc_combined_view.js +3 -1
- package/dist/components/layouts/login/config/login_field_config.d.ts +3 -2
- package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
- package/dist/components/layouts/login/config/login_field_config.js +29 -26
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +8 -7
- package/dist/components/layouts/login/index.d.ts +4 -4
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/login/index.js +33 -22
- package/dist/components/layouts/my_settings/components/connected_accounts_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/connected_accounts_section.js +7 -4
- package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/danger_zone_section.js +15 -6
- package/dist/components/layouts/my_settings/components/editable_field.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/editable_field.js +4 -2
- package/dist/components/layouts/my_settings/components/language_picker_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/language_picker_section.js +7 -3
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/password_change_dialog.js +28 -21
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +12 -9
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +3 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +14 -11
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +26 -15
- package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/set_password_section.js +24 -14
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +2 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.js +10 -10
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +35 -27
- package/dist/components/layouts/otp/index.d.ts.map +1 -1
- package/dist/components/layouts/otp/index.js +8 -3
- package/dist/components/layouts/register/config/register_field_config.d.ts +3 -2
- package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
- package/dist/components/layouts/register/config/register_field_config.js +45 -42
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +12 -11
- package/dist/components/layouts/register/index.d.ts +4 -4
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +25 -19
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +4 -3
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/config/reset_password_field_config.js +17 -17
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +14 -13
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/index.js +12 -7
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +6 -2
- package/dist/components/layouts/shared/components/auth_navbar.d.ts +1 -1
- package/dist/components/layouts/shared/components/auth_navbar.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/auth_navbar.js +7 -2
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/facebook_sign_in_button.js +5 -2
- package/dist/components/layouts/shared/components/floating_home_link.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/floating_home_link.js +6 -3
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/form_action_buttons.js +9 -4
- package/dist/components/layouts/shared/components/google_sign_in_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/google_sign_in_button.js +5 -2
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.js +6 -5
- package/dist/components/layouts/shared/components/oauth_divider.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/oauth_divider.js +8 -3
- package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/password_field.js +3 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +4 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.js +26 -18
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts +1 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +1 -1
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -1
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +6 -2
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/unauthorized_guard.js +7 -3
- package/dist/components/layouts/shared/config/layout_customization.d.ts +6 -0
- package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -1
- package/dist/components/layouts/shared/config/layout_customization.js +26 -1
- package/dist/components/layouts/shared/utils/validation.d.ts +9 -2
- package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
- package/dist/components/layouts/shared/utils/validation.js +16 -8
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +21 -18
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +32 -31
- package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/user_scopes_tab.js +26 -20
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +47 -43
- package/dist/components/otp/OTPRequestForm.d.ts.map +1 -1
- package/dist/components/otp/OTPRequestForm.js +10 -5
- package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -1
- package/dist/components/otp/OTPVerifyForm.js +12 -7
- package/dist/components/permission_denied_dialog.client.d.ts.map +1 -1
- package/dist/components/permission_denied_dialog.client.js +12 -9
- package/dist/components/ui/sheet.d.ts +1 -1
- package/dist/components/ui/sidebar.js +5 -5
- package/dist/contexts/hazo_auth_config.d.ts +13 -0
- package/dist/contexts/hazo_auth_config.d.ts.map +1 -1
- package/dist/contexts/hazo_auth_config.js +4 -1
- package/dist/contexts/hazo_auth_provider.d.ts +22 -2
- package/dist/contexts/hazo_auth_provider.d.ts.map +1 -1
- package/dist/contexts/hazo_auth_provider.js +18 -2
- package/dist/lib/already_logged_in_config.server.d.ts +4 -2
- package/dist/lib/already_logged_in_config.server.d.ts.map +1 -1
- package/dist/lib/already_logged_in_config.server.js +7 -5
- package/dist/lib/auth_hooks.d.ts +20 -0
- package/dist/lib/auth_hooks.d.ts.map +1 -0
- package/dist/lib/auth_hooks.js +32 -0
- package/dist/lib/config/config_loader.server.d.ts +23 -0
- package/dist/lib/config/config_loader.server.d.ts.map +1 -1
- package/dist/lib/config/config_loader.server.js +29 -0
- package/dist/lib/email_verification_config.server.d.ts +2 -2
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.d.ts +2 -2
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.d.ts +8 -5
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +13 -6
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +22 -15
- package/dist/lib/navbar_config.server.d.ts +3 -2
- package/dist/lib/navbar_config.server.d.ts.map +1 -1
- package/dist/lib/navbar_config.server.js +4 -2
- package/dist/lib/oauth_config.server.d.ts +6 -6
- package/dist/lib/oauth_config.server.d.ts.map +1 -1
- package/dist/lib/oauth_config.server.js +8 -4
- package/dist/lib/otp_config.server.d.ts +2 -2
- package/dist/lib/otp_config.server.d.ts.map +1 -1
- package/dist/lib/otp_config.server.js +4 -2
- package/dist/lib/profile_pic_menu_config.server.d.ts +6 -2
- package/dist/lib/profile_pic_menu_config.server.d.ts.map +1 -1
- package/dist/lib/profile_pic_menu_config.server.js +5 -3
- package/dist/lib/register_config.server.d.ts +7 -6
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +8 -4
- package/dist/lib/reset_password_config.server.d.ts +6 -4
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +5 -5
- package/dist/lib/services/oauth_service.d.ts.map +1 -1
- package/dist/lib/services/oauth_service.js +13 -0
- package/dist/lib/services/otp_service.d.ts.map +1 -1
- package/dist/lib/services/otp_service.js +6 -0
- package/dist/lib/services/registration_service.d.ts.map +1 -1
- package/dist/lib/services/registration_service.js +7 -0
- package/dist/lib/ui_shell_config.server.d.ts +6 -2
- package/dist/lib/ui_shell_config.server.d.ts.map +1 -1
- package/dist/lib/ui_shell_config.server.js +5 -3
- package/dist/lib/utils/password_validator.d.ts.map +1 -1
- package/dist/lib/utils/password_validator.js +5 -5
- package/dist/locales/en.json +517 -0
- package/dist/server/routes/library_photos.d.ts +2 -2
- package/dist/server/routes/set_password.js +1 -1
- package/dist/server-lib.d.ts +2 -0
- package/dist/server-lib.d.ts.map +1 -1
- package/dist/server-lib.js +2 -0
- package/dist/server_pages/forgot_password.d.ts +3 -2
- package/dist/server_pages/forgot_password.d.ts.map +1 -1
- package/dist/server_pages/forgot_password.js +8 -7
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +2 -1
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/forgot_password_client_wrapper.js +3 -1
- package/dist/server_pages/login.d.ts.map +1 -1
- package/dist/server_pages/login.js +9 -7
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/login_client_wrapper.js +3 -1
- package/dist/server_pages/otp.d.ts +6 -3
- package/dist/server_pages/otp.d.ts.map +1 -1
- package/dist/server_pages/otp.js +11 -8
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +7 -6
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/register_client_wrapper.js +3 -1
- package/dist/server_pages/reset_password.d.ts.map +1 -1
- package/dist/server_pages/reset_password.js +7 -6
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/reset_password_client_wrapper.js +3 -1
- package/dist/server_pages/verify_email.d.ts.map +1 -1
- package/dist/server_pages/verify_email.js +6 -5
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/verify_email_client_wrapper.js +4 -2
- package/dist/strings/default_strings.d.ts +15 -0
- package/dist/strings/default_strings.d.ts.map +1 -1
- package/dist/strings/default_strings.js +67 -11
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.d.ts.map +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/strings/strings_context.d.ts +20 -3
- package/dist/strings/strings_context.d.ts.map +1 -1
- package/dist/strings/strings_context.js +39 -5
- package/dist/strings/strings_provider.d.ts +1 -5
- package/dist/strings/strings_provider.d.ts.map +1 -1
- package/dist/strings/strings_provider.js +5 -1
- package/package.json +27 -19
|
@@ -93,22 +93,22 @@ const Sidebar = React.forwardRef((_a, ref) => {
|
|
|
93
93
|
var { side = "left", variant = "sidebar", collapsible = "offcanvas", className, children } = _a, props = __rest(_a, ["side", "variant", "collapsible", "className", "children"]);
|
|
94
94
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
95
95
|
if (collapsible === "none") {
|
|
96
|
-
return (_jsx("div", Object.assign({ className: cn("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground", className), ref: ref }, props, { children: children })));
|
|
96
|
+
return (_jsx("div", Object.assign({ className: cn("flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground", className), ref: ref }, props, { children: children })));
|
|
97
97
|
}
|
|
98
98
|
if (isMobile) {
|
|
99
|
-
return (_jsx(Sheet, Object.assign({ open: openMobile, onOpenChange: setOpenMobile }, props, { children: _jsxs(SheetContent, { "data-sidebar": "sidebar", "data-mobile": "true", className: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", style: {
|
|
99
|
+
return (_jsx(Sheet, Object.assign({ open: openMobile, onOpenChange: setOpenMobile }, props, { children: _jsxs(SheetContent, { "data-sidebar": "sidebar", "data-mobile": "true", className: "w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", style: {
|
|
100
100
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
101
101
|
}, side: side, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: "Sidebar" }), _jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) })));
|
|
102
102
|
}
|
|
103
|
-
return (_jsxs("div", { ref: ref, className: "group peer hidden text-sidebar-foreground md:block", "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : "", "data-variant": variant, "data-side": side, children: [_jsx("div", { className: cn("relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
|
|
103
|
+
return (_jsxs("div", { ref: ref, className: "group peer hidden text-sidebar-foreground md:block", "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : "", "data-variant": variant, "data-side": side, children: [_jsx("div", { className: cn("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
|
|
104
104
|
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
|
|
105
|
-
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon]") }), _jsx("div", Object.assign({ className: cn("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex", side === "left"
|
|
105
|
+
: "group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]") }), _jsx("div", Object.assign({ className: cn("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex", side === "left"
|
|
106
106
|
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
107
107
|
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
108
108
|
// Adjust the padding for floating and inset variants.
|
|
109
109
|
variant === "floating" || variant === "inset"
|
|
110
110
|
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
|
|
111
|
-
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l", className) }, props, { children: _jsx("div", { "data-sidebar": "sidebar", className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow", children: children }) }))] }));
|
|
111
|
+
: "group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l", className) }, props, { children: _jsx("div", { "data-sidebar": "sidebar", className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow", children: children }) }))] }));
|
|
112
112
|
});
|
|
113
113
|
Sidebar.displayName = "Sidebar";
|
|
114
114
|
const SidebarTrigger = React.forwardRef((_a, ref) => {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware translation function threaded through HazoAuthProvider.
|
|
3
|
+
* Defaults to the package's bundled English catalog (locale-blind) via
|
|
4
|
+
* `createPackageT("hazo_auth", en)` — consuming apps that mount hazo_i18n
|
|
5
|
+
* can supply a locale-aware `t` (e.g. via `useTranslations("hazo_auth")`)
|
|
6
|
+
* as the `t` prop on `HazoAuthProvider` instead.
|
|
7
|
+
*/
|
|
8
|
+
export type AuthTFunction = (key: string, values?: Record<string, string | number>) => string;
|
|
1
9
|
/**
|
|
2
10
|
* Runtime configuration for hazo_auth components
|
|
3
11
|
* Controls API paths and other runtime settings
|
|
@@ -9,6 +17,11 @@ export type HazoAuthConfig = {
|
|
|
9
17
|
* @example "/api/v1/auth"
|
|
10
18
|
*/
|
|
11
19
|
apiBasePath: string;
|
|
20
|
+
/**
|
|
21
|
+
* Locale-aware translation function for hazo_auth components.
|
|
22
|
+
* @default createPackageT("hazo_auth", en) — English-only fallback
|
|
23
|
+
*/
|
|
24
|
+
t: AuthTFunction;
|
|
12
25
|
};
|
|
13
26
|
/**
|
|
14
27
|
* Default configuration values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hazo_auth_config.d.ts","sourceRoot":"","sources":["../../src/contexts/hazo_auth_config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hazo_auth_config.d.ts","sourceRoot":"","sources":["../../src/contexts/hazo_auth_config.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAAC;AAEZ;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,CAAC,EAAE,aAAa,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,cAGtC,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// file_description: Type definitions for HazoAuth runtime configuration
|
|
2
2
|
// This file defines the configuration structure for the HazoAuthProvider context
|
|
3
|
-
// section:
|
|
3
|
+
// section: imports
|
|
4
|
+
import en from "../locales/en.json" with { type: "json" };
|
|
5
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
4
6
|
/**
|
|
5
7
|
* Default configuration values
|
|
6
8
|
* Used when no provider is present or when values are not specified
|
|
7
9
|
*/
|
|
8
10
|
export const DEFAULT_HAZO_AUTH_CONFIG = {
|
|
9
11
|
apiBasePath: "/api/hazo_auth",
|
|
12
|
+
t: createPackageT("hazo_auth", en),
|
|
10
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode } from "react";
|
|
2
|
-
import { type HazoAuthConfig } from "./hazo_auth_config.js";
|
|
2
|
+
import { type HazoAuthConfig, type AuthTFunction } from "./hazo_auth_config.js";
|
|
3
3
|
/**
|
|
4
4
|
* Props for HazoAuthProvider component
|
|
5
5
|
*/
|
|
@@ -10,6 +10,13 @@ export type HazoAuthProviderProps = {
|
|
|
10
10
|
* @example "/api/v1/auth" - Custom API path
|
|
11
11
|
*/
|
|
12
12
|
apiBasePath?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Locale-aware translation function for hazo_auth components.
|
|
15
|
+
* @default createPackageT("hazo_auth", en) — English-only fallback.
|
|
16
|
+
* Pass a locale-aware `t` (e.g. `useTranslations("hazo_auth")` from
|
|
17
|
+
* `hazo_i18n/client`) to make descendant components translate.
|
|
18
|
+
*/
|
|
19
|
+
t?: AuthTFunction;
|
|
13
20
|
/**
|
|
14
21
|
* Child components that will have access to the configuration
|
|
15
22
|
*/
|
|
@@ -48,7 +55,7 @@ export type HazoAuthProviderProps = {
|
|
|
48
55
|
* }
|
|
49
56
|
* ```
|
|
50
57
|
*/
|
|
51
|
-
export declare function HazoAuthProvider({ apiBasePath, children }: HazoAuthProviderProps): React.JSX.Element;
|
|
58
|
+
export declare function HazoAuthProvider({ apiBasePath, t, children }: HazoAuthProviderProps): React.JSX.Element;
|
|
52
59
|
/**
|
|
53
60
|
* Hook to access hazo_auth runtime configuration
|
|
54
61
|
*
|
|
@@ -70,4 +77,17 @@ export declare function HazoAuthProvider({ apiBasePath, children }: HazoAuthProv
|
|
|
70
77
|
* @returns Current HazoAuthConfig
|
|
71
78
|
*/
|
|
72
79
|
export declare function useHazoAuthConfig(): HazoAuthConfig;
|
|
80
|
+
/**
|
|
81
|
+
* Convenience hook returning the locale-aware `t` function from the nearest
|
|
82
|
+
* `HazoAuthProvider` (or the English-only default if no provider is mounted).
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* function MyComponent() {
|
|
87
|
+
* const t = useAuthT();
|
|
88
|
+
* return <button>{t("shared.cancel_button")}</button>;
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function useAuthT(): AuthTFunction;
|
|
73
93
|
//# sourceMappingURL=hazo_auth_provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hazo_auth_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/hazo_auth_provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"hazo_auth_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/hazo_auth_provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAA4B,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAYvG;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,CAAC,CAAC,EAAE,aAAa,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,WAAkD,EAClD,CAA8B,EAC9B,QAAQ,EACT,EAAE,qBAAqB,qBAevB;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,IAAI,aAAa,CAExC"}
|
|
@@ -46,11 +46,12 @@ const HazoAuthConfigContext = createContext(DEFAULT_HAZO_AUTH_CONFIG);
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
export function HazoAuthProvider({ apiBasePath = DEFAULT_HAZO_AUTH_CONFIG.apiBasePath, children }) {
|
|
49
|
+
export function HazoAuthProvider({ apiBasePath = DEFAULT_HAZO_AUTH_CONFIG.apiBasePath, t = DEFAULT_HAZO_AUTH_CONFIG.t, children }) {
|
|
50
50
|
// Memoize config to avoid unnecessary re-renders
|
|
51
51
|
const config = useMemo(() => ({
|
|
52
52
|
apiBasePath,
|
|
53
|
-
|
|
53
|
+
t,
|
|
54
|
+
}), [apiBasePath, t]);
|
|
54
55
|
return (_jsx(HazoAuthConfigContext.Provider, { value: config, children: children }));
|
|
55
56
|
}
|
|
56
57
|
// section: hook
|
|
@@ -80,3 +81,18 @@ export function useHazoAuthConfig() {
|
|
|
80
81
|
// No need to check for undefined
|
|
81
82
|
return context;
|
|
82
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Convenience hook returning the locale-aware `t` function from the nearest
|
|
86
|
+
* `HazoAuthProvider` (or the English-only default if no provider is mounted).
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* function MyComponent() {
|
|
91
|
+
* const t = useAuthT();
|
|
92
|
+
* return <button>{t("shared.cancel_button")}</button>;
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export function useAuthT() {
|
|
97
|
+
return useHazoAuthConfig().t;
|
|
98
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
export type AlreadyLoggedInConfig = {
|
|
3
|
-
|
|
3
|
+
/** Undefined when not configured — components fall back to their own i18n `t()` default. */
|
|
4
|
+
message: string | undefined;
|
|
4
5
|
showLogoutButton: boolean;
|
|
5
6
|
showReturnHomeButton: boolean;
|
|
6
|
-
|
|
7
|
+
/** Undefined when not configured — components fall back to their own i18n `t()` default. */
|
|
8
|
+
returnHomeButtonLabel: string | undefined;
|
|
7
9
|
returnHomePath: string;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"already_logged_in_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/already_logged_in_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAMrB,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"already_logged_in_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/already_logged_in_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAMrB,MAAM,MAAM,qBAAqB,GAAG;IAClC,4FAA4F;IAC5F,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4FAA4F;IAC5F,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,qBAAqB,CA2BpE"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// section: server-only-guard
|
|
3
3
|
import "server-only";
|
|
4
4
|
// section: imports
|
|
5
|
-
import { get_config_value, get_config_boolean } from "./config/config_loader.server.js";
|
|
5
|
+
import { get_config_value, get_config_value_optional, get_config_boolean } from "./config/config_loader.server.js";
|
|
6
6
|
// section: helpers
|
|
7
7
|
/**
|
|
8
8
|
* Reads already logged in configuration from hazo_auth_config.ini file
|
|
@@ -11,14 +11,16 @@ import { get_config_value, get_config_boolean } from "./config/config_loader.ser
|
|
|
11
11
|
*/
|
|
12
12
|
export function get_already_logged_in_config() {
|
|
13
13
|
const section = "hazo_auth__already_logged_in";
|
|
14
|
-
// Read message
|
|
15
|
-
|
|
14
|
+
// Read message — undefined when not configured, so the consuming component's
|
|
15
|
+
// own `message ?? t(...)` i18n fallback resolves it instead of a hardcoded
|
|
16
|
+
// English string.
|
|
17
|
+
const message = get_config_value_optional(section, "message");
|
|
16
18
|
// Read show logout button (defaults to true)
|
|
17
19
|
const showLogoutButton = get_config_boolean(section, "show_logout_button", true);
|
|
18
20
|
// Read show return home button (defaults to false)
|
|
19
21
|
const showReturnHomeButton = get_config_boolean(section, "show_return_home_button", false);
|
|
20
|
-
// Read return home button label
|
|
21
|
-
const returnHomeButtonLabel =
|
|
22
|
+
// Read return home button label — undefined when not configured, see `message` above.
|
|
23
|
+
const returnHomeButtonLabel = get_config_value_optional(section, "return_home_button_label");
|
|
22
24
|
// Read return home path (defaults to "/")
|
|
23
25
|
const returnHomePath = get_config_value(section, "return_home_path", "/");
|
|
24
26
|
return {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface AuthHookContext {
|
|
2
|
+
user_id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
auth_provider: 'email' | 'google' | 'facebook' | 'otp';
|
|
6
|
+
}
|
|
7
|
+
export interface AuthHooks {
|
|
8
|
+
on_user_created?: (ctx: AuthHookContext) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Registers hooks. Additive merge — only overwrites the keys passed in, so
|
|
12
|
+
* multiple call sites can each register different hooks without clobbering each other.
|
|
13
|
+
*/
|
|
14
|
+
export declare function register_auth_hooks(hooks: AuthHooks): void;
|
|
15
|
+
/**
|
|
16
|
+
* Fires a registered hook by name, best-effort. Never throws or rejects to the
|
|
17
|
+
* caller — signup must succeed even if the hook fails.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fire_auth_hook<K extends keyof AuthHooks>(name: K, ctx: AuthHookContext): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=auth_hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_hooks.d.ts","sourceRoot":"","sources":["../../src/lib/auth_hooks.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;CACxD;AAED,MAAM,WAAW,SAAS;IACxB,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D;AAUD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAE1D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAC5D,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// file_description: Fire-and-forget hook registry fired on user signup, so consuming apps
|
|
2
|
+
// (e.g. GoTimer's lifecycle email scheduler) can react without hazo_auth depending on them.
|
|
3
|
+
import { create_app_logger } from './app_logger.js';
|
|
4
|
+
const log = create_app_logger();
|
|
5
|
+
// section: registry
|
|
6
|
+
/**
|
|
7
|
+
* Module-level registry, set once at app boot by the consuming app.
|
|
8
|
+
* DI: hazo_auth does NOT import the consuming app — the app registers its own callbacks here.
|
|
9
|
+
*/
|
|
10
|
+
let _hooks = {};
|
|
11
|
+
/**
|
|
12
|
+
* Registers hooks. Additive merge — only overwrites the keys passed in, so
|
|
13
|
+
* multiple call sites can each register different hooks without clobbering each other.
|
|
14
|
+
*/
|
|
15
|
+
export function register_auth_hooks(hooks) {
|
|
16
|
+
_hooks = Object.assign(Object.assign({}, _hooks), hooks);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fires a registered hook by name, best-effort. Never throws or rejects to the
|
|
20
|
+
* caller — signup must succeed even if the hook fails.
|
|
21
|
+
*/
|
|
22
|
+
export async function fire_auth_hook(name, ctx) {
|
|
23
|
+
const hook = _hooks[name];
|
|
24
|
+
if (!hook)
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
await hook(ctx);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
log.warn(`${name} hook failed`, { error: err, user_id: ctx.user_id });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -27,6 +27,29 @@ export declare function get_config_value(section_name: string, key: string, defa
|
|
|
27
27
|
* @returns Config value as string, or "" if key exists but empty, or default_value if key missing
|
|
28
28
|
*/
|
|
29
29
|
export declare function get_config_value_allow_empty(section_name: string, key: string, default_value: string, file_path?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Gets a single config value from a section with no forced default — returns
|
|
32
|
+
* `undefined` when the section or key is absent instead of substituting a
|
|
33
|
+
* hardcoded fallback string.
|
|
34
|
+
*
|
|
35
|
+
* Use this for user-visible label/text config keys whose component consumes
|
|
36
|
+
* them with its own `prop ?? t(key)` i18n fallback (e.g. FormHeader labels,
|
|
37
|
+
* OAuth button text). Returning a hardcoded English default here would
|
|
38
|
+
* short-circuit that fallback and defeat locale-aware translation — this
|
|
39
|
+
* helper lets "not configured" flow all the way through the config layer as
|
|
40
|
+
* `undefined` so the component's own `t()` call is what ultimately resolves
|
|
41
|
+
* the text.
|
|
42
|
+
*
|
|
43
|
+
* Preserves get_config_value_allow_empty's "" semantics: a key explicitly set
|
|
44
|
+
* to an empty string in the INI is returned as "" (intentionally empty, e.g.
|
|
45
|
+
* to hide a link), while an absent key returns `undefined` (not configured —
|
|
46
|
+
* defer to the caller's own i18n-aware default).
|
|
47
|
+
* @param section_name - Name of the section
|
|
48
|
+
* @param key - Key name within the section
|
|
49
|
+
* @param file_path - Optional custom config file path
|
|
50
|
+
* @returns Config value as string, "" if key exists but empty, or undefined if key is missing
|
|
51
|
+
*/
|
|
52
|
+
export declare function get_config_value_optional(section_name: string, key: string, file_path?: string): string | undefined;
|
|
30
53
|
/**
|
|
31
54
|
* Gets a boolean config value from a section
|
|
32
55
|
* @param section_name - Name of the section
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config_loader.server.d.ts","sourceRoot":"","sources":["../../../src/lib/config/config_loader.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AA8DrB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAwBpC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAQR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAMR;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,OAAO,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAeR;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,EAAE,CAcV"}
|
|
1
|
+
{"version":3,"file":"config_loader.server.d.ts","sourceRoot":"","sources":["../../../src/lib/config/config_loader.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AA8DrB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAwBpC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAQR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAMR;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAMpB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,OAAO,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAeR;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,EAAE,CAcV"}
|
|
@@ -120,6 +120,35 @@ export function get_config_value_allow_empty(section_name, key, default_value, f
|
|
|
120
120
|
}
|
|
121
121
|
return section[key].trim();
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Gets a single config value from a section with no forced default — returns
|
|
125
|
+
* `undefined` when the section or key is absent instead of substituting a
|
|
126
|
+
* hardcoded fallback string.
|
|
127
|
+
*
|
|
128
|
+
* Use this for user-visible label/text config keys whose component consumes
|
|
129
|
+
* them with its own `prop ?? t(key)` i18n fallback (e.g. FormHeader labels,
|
|
130
|
+
* OAuth button text). Returning a hardcoded English default here would
|
|
131
|
+
* short-circuit that fallback and defeat locale-aware translation — this
|
|
132
|
+
* helper lets "not configured" flow all the way through the config layer as
|
|
133
|
+
* `undefined` so the component's own `t()` call is what ultimately resolves
|
|
134
|
+
* the text.
|
|
135
|
+
*
|
|
136
|
+
* Preserves get_config_value_allow_empty's "" semantics: a key explicitly set
|
|
137
|
+
* to an empty string in the INI is returned as "" (intentionally empty, e.g.
|
|
138
|
+
* to hide a link), while an absent key returns `undefined` (not configured —
|
|
139
|
+
* defer to the caller's own i18n-aware default).
|
|
140
|
+
* @param section_name - Name of the section
|
|
141
|
+
* @param key - Key name within the section
|
|
142
|
+
* @param file_path - Optional custom config file path
|
|
143
|
+
* @returns Config value as string, "" if key exists but empty, or undefined if key is missing
|
|
144
|
+
*/
|
|
145
|
+
export function get_config_value_optional(section_name, key, file_path) {
|
|
146
|
+
const section = read_config_section(section_name, file_path);
|
|
147
|
+
if (!section || section[key] === undefined) {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
return section[key].trim();
|
|
151
|
+
}
|
|
123
152
|
/**
|
|
124
153
|
* Gets a boolean config value from a section
|
|
125
154
|
* @param section_name - Name of the section
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
export type EmailVerificationConfig = {
|
|
3
|
-
alreadyLoggedInMessage: string;
|
|
3
|
+
alreadyLoggedInMessage: string | undefined;
|
|
4
4
|
showLogoutButton: boolean;
|
|
5
5
|
showReturnHomeButton: boolean;
|
|
6
|
-
returnHomeButtonLabel: string;
|
|
6
|
+
returnHomeButtonLabel: string | undefined;
|
|
7
7
|
returnHomePath: string;
|
|
8
8
|
imageSrc: string;
|
|
9
9
|
imageAlt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email_verification_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/email_verification_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"email_verification_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/email_verification_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAoCvE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
export type ForgotPasswordConfig = {
|
|
3
|
-
alreadyLoggedInMessage: string;
|
|
3
|
+
alreadyLoggedInMessage: string | undefined;
|
|
4
4
|
showLogoutButton: boolean;
|
|
5
5
|
showReturnHomeButton: boolean;
|
|
6
|
-
returnHomeButtonLabel: string;
|
|
6
|
+
returnHomeButtonLabel: string | undefined;
|
|
7
7
|
returnHomePath: string;
|
|
8
8
|
imageSrc: string;
|
|
9
9
|
imageAlt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/forgot_password_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,oBAAoB,GAAG;IACjC,sBAAsB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"forgot_password_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/forgot_password_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,oBAAoB,GAAG;IACjC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAoCjE"}
|
|
@@ -2,16 +2,19 @@ import "server-only";
|
|
|
2
2
|
import { type OAuthConfig } from "./oauth_config.server.js";
|
|
3
3
|
export type LoginConfig = {
|
|
4
4
|
redirectRoute?: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** Undefined when not configured — the login component falls back to `t("login.success_message_default")`. */
|
|
6
|
+
successMessage: string | undefined;
|
|
7
|
+
alreadyLoggedInMessage: string | undefined;
|
|
7
8
|
showLogoutButton: boolean;
|
|
8
9
|
showReturnHomeButton: boolean;
|
|
9
|
-
returnHomeButtonLabel: string;
|
|
10
|
+
returnHomeButtonLabel: string | undefined;
|
|
10
11
|
returnHomePath: string;
|
|
11
12
|
forgotPasswordPath: string;
|
|
12
|
-
|
|
13
|
+
/** Undefined when not configured — falls back to `t("login.forgot_password_link_default")`. "" hides the link. */
|
|
14
|
+
forgotPasswordLabel: string | undefined;
|
|
13
15
|
createAccountPath: string;
|
|
14
|
-
|
|
16
|
+
/** Undefined when not configured — falls back to `t("login.create_account_link_default")`. "" hides the link. */
|
|
17
|
+
createAccountLabel: string | undefined;
|
|
15
18
|
showCreateAccountLink: boolean;
|
|
16
19
|
imageSrc: string;
|
|
17
20
|
imageAlt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/login_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"login_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/login_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAM3E,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8GAA8G;IAC9G,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kHAAkH;IAClH,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iHAAiH;IACjH,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,0BAA0B;IAC1B,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAwE9C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// section: server-only-guard
|
|
3
3
|
import "server-only";
|
|
4
4
|
// section: imports
|
|
5
|
-
import { get_config_value, get_config_value_allow_empty } from "./config/config_loader.server.js";
|
|
5
|
+
import { get_config_value, get_config_value_allow_empty, get_config_value_optional, } from "./config/config_loader.server.js";
|
|
6
6
|
import { get_already_logged_in_config } from "./already_logged_in_config.server.js";
|
|
7
7
|
import { get_oauth_config } from "./oauth_config.server.js";
|
|
8
8
|
// Assets served via the package's own API route — no manual copy needed.
|
|
@@ -18,13 +18,20 @@ export function get_login_config() {
|
|
|
18
18
|
// Read redirect route (optional)
|
|
19
19
|
const redirectRouteValue = get_config_value(section, "redirect_route_on_successful_login", "");
|
|
20
20
|
const redirectRoute = redirectRouteValue || undefined;
|
|
21
|
-
// Read success message
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Read success message — undefined when not configured, so LoginLayout's own
|
|
22
|
+
// `successMessage ?? t("login.success_message_default")` fallback applies.
|
|
23
|
+
const successMessage = get_config_value_optional(section, "success_message");
|
|
24
|
+
// Path keeps its allow_empty semantics unchanged: "" in the INI hides the
|
|
25
|
+
// link, an unset key falls back to the default path (not an i18n concern).
|
|
24
26
|
const forgotPasswordPath = get_config_value_allow_empty(section, "forgot_password_path", "/hazo_auth/forgot_password");
|
|
25
|
-
|
|
27
|
+
// Undefined when not configured — LoginLayout falls back to
|
|
28
|
+
// `t("login.forgot_password_link_default")`. Explicitly set to "" in the
|
|
29
|
+
// INI still hides the link (get_config_value_optional preserves that).
|
|
30
|
+
const forgotPasswordLabel = get_config_value_optional(section, "forgot_password_label");
|
|
26
31
|
const createAccountPath = get_config_value_allow_empty(section, "create_account_path", "/hazo_auth/register");
|
|
27
|
-
|
|
32
|
+
// Undefined when not configured — LoginLayout falls back to
|
|
33
|
+
// `t("login.create_account_link_default")`. "" still hides the link.
|
|
34
|
+
const createAccountLabel = get_config_value_optional(section, "create_account_label");
|
|
28
35
|
const showCreateAccountLink = get_config_value(section, "show_create_account_link", "true") === "true";
|
|
29
36
|
// Get shared already logged in config
|
|
30
37
|
const alreadyLoggedInConfig = get_already_logged_in_config();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/my_settings_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE;QACV,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,oBAAoB,EAAE;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,iBAAiB,EAAE,OAAO,CAAC;QAC3B,cAAc,EAAE,OAAO,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,cAAc,EAAE;QACd,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,4BAA4B,EAAE,UAAU,GAAG,SAAS,CAAC;QACrD,4BAA4B,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE;QACR,6BAA6B,EAAE,MAAM,CAAC;QACtC,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2BAA2B,EAAE,MAAM,CAAC;QACpC,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,yBAAyB,EAAE,MAAM,CAAC;QAClC,uBAAuB,EAAE,MAAM,CAAC;QAChC,0BAA0B,EAAE,MAAM,CAAC;QACnC,0BAA0B,EAAE,MAAM,CAAC;QACnC,+BAA+B,EAAE,MAAM,CAAC;QACxC,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,wBAAwB,EAAE,MAAM,EAAE,CAAC;QACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,
|
|
1
|
+
{"version":3,"file":"my_settings_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/my_settings_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE;QACV,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,oBAAoB,EAAE;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,iBAAiB,EAAE,OAAO,CAAC;QAC3B,cAAc,EAAE,OAAO,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,cAAc,EAAE;QACd,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,4BAA4B,EAAE,UAAU,GAAG,SAAS,CAAC;QACrD,4BAA4B,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE;QACR,6BAA6B,EAAE,MAAM,CAAC;QACtC,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2BAA2B,EAAE,MAAM,CAAC;QACpC,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,yBAAyB,EAAE,MAAM,CAAC;QAClC,uBAAuB,EAAE,MAAM,CAAC;QAChC,0BAA0B,EAAE,MAAM,CAAC;QACnC,0BAA0B,EAAE,MAAM,CAAC;QACnC,+BAA+B,EAAE,MAAM,CAAC;QACxC,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,wBAAwB,EAAE,MAAM,EAAE,CAAC;QACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAkEzD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// section: server-only-guard
|
|
3
3
|
import "server-only";
|
|
4
4
|
// section: imports
|
|
5
|
-
import { get_config_value, get_config_boolean } from "./config/config_loader.server.js";
|
|
5
|
+
import { get_config_value, get_config_value_optional, get_config_boolean } from "./config/config_loader.server.js";
|
|
6
6
|
import { get_user_fields_config } from "./user_fields_config.server.js";
|
|
7
7
|
import { get_password_requirements_config } from "./password_requirements_config.server.js";
|
|
8
8
|
import { get_profile_picture_config } from "./profile_picture_config.server.js";
|
|
@@ -27,21 +27,28 @@ export function get_my_settings_config() {
|
|
|
27
27
|
const messages = get_messages_config();
|
|
28
28
|
const uiSizes = get_ui_sizes_config();
|
|
29
29
|
const fileTypes = get_file_types_config();
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
30
|
+
// Undefined when not configured — MySettingsLayout resolves each of these
|
|
31
|
+
// via its own `prop ?? t(key)` fallback (my_settings.page_title,
|
|
32
|
+
// my_settings.sub_heading_default, my_settings.profile_photo_label_default,
|
|
33
|
+
// etc.), so a hardcoded default here would defeat locale-aware translation.
|
|
34
|
+
const heading = get_config_value_optional(section, "heading");
|
|
35
|
+
const subHeading = get_config_value_optional(section, "sub_heading");
|
|
36
|
+
const profilePhotoLabel = get_config_value_optional(section, "profile_photo_label");
|
|
37
|
+
const profilePhotoRecommendation = get_config_value_optional(section, "profile_photo_recommendation");
|
|
38
|
+
const uploadPhotoButtonLabel = get_config_value_optional(section, "upload_photo_button_label");
|
|
39
|
+
const removePhotoButtonLabel = get_config_value_optional(section, "remove_photo_button_label");
|
|
40
|
+
const profileInformationLabel = get_config_value_optional(section, "profile_information_label");
|
|
41
|
+
const passwordLabel = get_config_value_optional(section, "password_label");
|
|
42
|
+
const currentPasswordLabel = get_config_value_optional(section, "current_password_label");
|
|
43
|
+
const newPasswordLabel = get_config_value_optional(section, "new_password_label");
|
|
44
|
+
const confirmPasswordLabel = get_config_value_optional(section, "confirm_password_label");
|
|
45
|
+
// NOTE: savePasswordButtonLabel is read here but is not currently consumed
|
|
46
|
+
// by MySettingsLayout (the save-password button renders `t(...)` directly,
|
|
47
|
+
// ignoring this prop) — left as a hardcoded default since there is no
|
|
48
|
+
// fallback to defeat; out of scope for this fix.
|
|
42
49
|
const savePasswordButtonLabel = get_config_value(section, "save_password_button_label", "Save Password");
|
|
43
|
-
const unauthorizedMessage =
|
|
44
|
-
const loginButtonLabel =
|
|
50
|
+
const unauthorizedMessage = get_config_value_optional(section, "unauthorized_message");
|
|
51
|
+
const loginButtonLabel = get_config_value_optional(section, "login_button_label");
|
|
45
52
|
const loginPath = get_config_value(section, "login_path", "/hazo_auth/login");
|
|
46
53
|
const enableAccountDeletion = get_config_boolean(section, "enable_account_deletion", false);
|
|
47
54
|
return {
|
|
@@ -12,8 +12,9 @@ export type NavbarConfig = {
|
|
|
12
12
|
company_name: string;
|
|
13
13
|
/** Home link path */
|
|
14
14
|
home_path: string;
|
|
15
|
-
/** Home link label
|
|
16
|
-
|
|
15
|
+
/** Home link label. Undefined when not configured — the navbar component
|
|
16
|
+
* falls back to `t("navbar.home_label_default")`. */
|
|
17
|
+
home_label: string | undefined;
|
|
17
18
|
/** Show home link */
|
|
18
19
|
show_home_link: boolean;
|
|
19
20
|
/** Navbar background color (empty = inherit) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/navbar_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"navbar_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/navbar_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAYrB,MAAM,MAAM,YAAY,GAAG;IACzB,kCAAkC;IAClC,aAAa,EAAE,OAAO,CAAC;IACvB,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB;0DACsD;IACtD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,qBAAqB;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CA8EhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// section: server-only-guard
|
|
3
3
|
import "server-only";
|
|
4
4
|
// section: imports
|
|
5
|
-
import { get_config_value, get_config_boolean, get_config_number } from "./config/config_loader.server.js";
|
|
5
|
+
import { get_config_value, get_config_boolean, get_config_number, get_config_value_optional, } from "./config/config_loader.server.js";
|
|
6
6
|
import { DEFAULT_NAVBAR } from "./config/default_config.js";
|
|
7
7
|
// section: constants
|
|
8
8
|
const SECTION_NAME = "hazo_auth__navbar";
|
|
@@ -19,7 +19,9 @@ export function get_navbar_config() {
|
|
|
19
19
|
const logo_height = get_config_number(SECTION_NAME, "logo_height", DEFAULT_NAVBAR.logo_height);
|
|
20
20
|
const company_name = get_config_value(SECTION_NAME, "company_name", DEFAULT_NAVBAR.company_name);
|
|
21
21
|
const home_path = get_config_value(SECTION_NAME, "home_path", DEFAULT_NAVBAR.home_path);
|
|
22
|
-
|
|
22
|
+
// Undefined when not configured — AuthNavbar falls back to
|
|
23
|
+
// `t("navbar.home_label_default")`.
|
|
24
|
+
const home_label = get_config_value_optional(SECTION_NAME, "home_label");
|
|
23
25
|
const show_home_link = get_config_boolean(SECTION_NAME, "show_home_link", DEFAULT_NAVBAR.show_home_link);
|
|
24
26
|
const background_color = get_config_value(SECTION_NAME, "background_color", DEFAULT_NAVBAR.background_color);
|
|
25
27
|
const text_color = get_config_value(SECTION_NAME, "text_color", DEFAULT_NAVBAR.text_color);
|
|
@@ -6,10 +6,10 @@ export type OAuthConfig = {
|
|
|
6
6
|
enable_email_password: boolean;
|
|
7
7
|
/** Auto-link Google login to existing unverified email/password accounts */
|
|
8
8
|
auto_link_unverified_accounts: boolean;
|
|
9
|
-
/** Text displayed on the Google sign-in button */
|
|
10
|
-
google_button_text: string;
|
|
11
|
-
/** Text displayed on the divider between OAuth and email/password form */
|
|
12
|
-
oauth_divider_text: string;
|
|
9
|
+
/** Text displayed on the Google sign-in button. Undefined when not configured — the login/register components fall back to their own `t()` default. */
|
|
10
|
+
google_button_text: string | undefined;
|
|
11
|
+
/** Text displayed on the divider between OAuth and email/password form. Undefined when not configured — falls back to `t("shared.oauth_divider_default")`. */
|
|
12
|
+
oauth_divider_text: string | undefined;
|
|
13
13
|
/** NextAuth signIn page path */
|
|
14
14
|
sign_in_page: string;
|
|
15
15
|
/** NextAuth error page path */
|
|
@@ -28,8 +28,8 @@ export type OAuthConfig = {
|
|
|
28
28
|
facebook_app_id: string;
|
|
29
29
|
/** Facebook App Secret (env: HAZO_AUTH_FACEBOOK_APP_SECRET overrides config) */
|
|
30
30
|
facebook_app_secret: string;
|
|
31
|
-
/** Text displayed on the Facebook sign-in button */
|
|
32
|
-
facebook_button_text: string;
|
|
31
|
+
/** Text displayed on the Facebook sign-in button. Undefined when not configured — falls back to `t("shared.oauth.facebook_button_default")`. */
|
|
32
|
+
facebook_button_text: string | undefined;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* Reads OAuth configuration from hazo_auth_config.ini file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/oauth_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAOrB,MAAM,MAAM,WAAW,GAAG;IACxB,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,6BAA6B,EAAE,OAAO,CAAC;IACvC,
|
|
1
|
+
{"version":3,"file":"oauth_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/oauth_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAOrB,MAAM,MAAM,WAAW,GAAG;IACxB,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,6BAA6B,EAAE,OAAO,CAAC;IACvC,uJAAuJ;IACvJ,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,8JAA8J;IAC9J,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,eAAe,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qEAAqE;IACrE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wEAAwE;IACxE,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gJAAgJ;IAChJ,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAgG9C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAMnD"}
|