hazo_auth 10.24.0 → 10.25.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/cli-src/lib/auth/auth_types.ts +6 -0
- package/cli-src/lib/auth/hazo_get_auth.server.ts +3 -0
- package/cli-src/lib/location_fields_config.server.ts +42 -0
- package/cli-src/lib/my_settings_config.server.ts +6 -0
- package/cli-src/lib/register_config.server.ts +16 -0
- package/cli-src/lib/services/location_fields_helper.ts +30 -0
- package/cli-src/lib/services/registration_service.ts +21 -0
- package/cli-src/lib/services/user_update_service.ts +7 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +8 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +37 -0
- package/dist/components/layouts/my_settings/index.d.ts +6 -1
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +3 -3
- package/dist/components/layouts/register/hooks/use_register_form.d.ts +15 -1
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +69 -4
- package/dist/components/layouts/register/index.d.ts +7 -1
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +24 -3
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts +3 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.js +5 -2
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/lib/auth/auth_types.d.ts +3 -0
- package/dist/lib/auth/auth_types.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +3 -0
- package/dist/lib/location_fields_config.server.d.ts +22 -0
- package/dist/lib/location_fields_config.server.d.ts.map +1 -0
- package/dist/lib/location_fields_config.server.js +31 -0
- package/dist/lib/my_settings_config.server.d.ts +4 -0
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +3 -0
- package/dist/lib/register_config.server.d.ts +10 -0
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +7 -0
- package/dist/lib/services/location_fields_helper.d.ts +13 -0
- package/dist/lib/services/location_fields_helper.d.ts.map +1 -0
- package/dist/lib/services/location_fields_helper.js +24 -0
- package/dist/lib/services/registration_service.d.ts +9 -0
- package/dist/lib/services/registration_service.d.ts.map +1 -1
- package/dist/lib/services/registration_service.js +11 -0
- package/dist/lib/services/user_update_service.d.ts +5 -0
- package/dist/lib/services/user_update_service.d.ts.map +1 -1
- package/dist/lib/services/user_update_service.js +2 -0
- package/dist/locales/en.json +9 -0
- package/dist/page_components/my_settings.d.ts +9 -1
- package/dist/page_components/my_settings.d.ts.map +1 -1
- package/dist/page_components/my_settings.js +8 -2
- package/dist/server/routes/me.d.ts.map +1 -1
- package/dist/server/routes/me.js +5 -1
- package/dist/server/routes/register.d.ts.map +1 -1
- package/dist/server/routes/register.js +46 -0
- package/dist/server/routes/update_user.d.ts.map +1 -1
- package/dist/server/routes/update_user.js +24 -1
- package/dist/server_pages/my_settings.d.ts.map +1 -1
- package/dist/server_pages/my_settings.js +1 -1
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +1 -1
- package/dist/server_pages/register_client_wrapper.d.ts +4 -2
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/register_client_wrapper.js +2 -2
- package/package.json +4 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides, type PasswordRequirementOverrides } from "../shared/config/layout_customization.js";
|
|
2
2
|
import { type LayoutDataClient } from "../shared/data/layout_data_client.js";
|
|
3
3
|
import type { StaticImageData } from "next/image";
|
|
4
|
+
import type { LocationFieldsConfig } from "../../../lib/location_fields_config.server";
|
|
5
|
+
import type { AppUserDataSchema } from "../../../lib/app_user_data_config.server";
|
|
4
6
|
export type OAuthLayoutConfig = {
|
|
5
7
|
/** Enable Google OAuth login */
|
|
6
8
|
enable_google: boolean;
|
|
@@ -39,6 +41,10 @@ export type RegisterLayoutProps<TClient = unknown> = {
|
|
|
39
41
|
oauth?: OAuthLayoutConfig;
|
|
40
42
|
/** Layout mode (default: `"two_column"`). See `LoginLayoutProps.layout` for the full description. */
|
|
41
43
|
layout?: "two_column" | "form_only";
|
|
44
|
+
/** Which indexed location fields to render — see [hazo_auth__custom_fields]. */
|
|
45
|
+
locationFields?: LocationFieldsConfig;
|
|
46
|
+
/** Arbitrary custom fields, reusing the existing app_user_data JSON Schema config. */
|
|
47
|
+
customFieldsSchema?: AppUserDataSchema | null;
|
|
42
48
|
};
|
|
43
|
-
export default function register_layout<TClient>({ image_src, image_alt, image_background_color, field_overrides, labels, button_colors, password_requirements, show_name_field, data_client, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, signInPath, signInLabel, urlOnLogon, oauth, layout, }: RegisterLayoutProps<TClient>): import("react").JSX.Element;
|
|
49
|
+
export default function register_layout<TClient>({ image_src, image_alt, image_background_color, field_overrides, labels, button_colors, password_requirements, show_name_field, data_client, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, signInPath, signInLabel, urlOnLogon, oauth, layout, locationFields, customFieldsSchema, }: RegisterLayoutProps<TClient>): import("react").JSX.Element;
|
|
44
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;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BAAsB,CAAC;IACvC,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,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,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,qGAAqG;IACrG,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC,gFAAgF;IAChF,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC/C,CAAC;AAkBF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,EAC/C,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,eAAsB,EACtB,WAAW,EACX,sBAAsB,EACtB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqB,EACrB,cAAoB,EACpB,UAA+B,EAC/B,WAAW,EACX,UAAU,EACV,KAAK,EACL,MAAqB,EACrB,cAAc,EACd,kBAAkB,GACnB,EAAE,mBAAmB,CAAC,OAAO,CAAC,+BA+V9B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// file_description: register layout component built atop shared layout utilities
|
|
2
2
|
// section: client_directive
|
|
3
3
|
"use client";
|
|
4
|
-
import { jsx as _jsx,
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
// section: imports
|
|
6
6
|
import { useState, useEffect } from "react";
|
|
7
7
|
import Link from "next/link";
|
|
@@ -22,6 +22,11 @@ import { use_register_form, } from "./hooks/use_register_form.js";
|
|
|
22
22
|
import { LegalDocCheckboxList } from "../legal/legal_doc_checkbox_list.js";
|
|
23
23
|
import { LegalDocCombinedView } from "../legal/legal_doc_combined_view.js";
|
|
24
24
|
import { useHazoAuthConfig, useAuthT } from "../../../contexts/hazo_auth_provider.js";
|
|
25
|
+
const LOCATION_FIELD_LABELS = {
|
|
26
|
+
country: "register.field.location_country.label",
|
|
27
|
+
state_province: "register.field.location_state_province.label",
|
|
28
|
+
suburb: "register.field.location_suburb.label",
|
|
29
|
+
};
|
|
25
30
|
const ORDERED_FIELDS = [
|
|
26
31
|
REGISTER_FIELD_IDS.NAME,
|
|
27
32
|
REGISTER_FIELD_IDS.EMAIL,
|
|
@@ -29,7 +34,7 @@ const ORDERED_FIELDS = [
|
|
|
29
34
|
REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
|
|
30
35
|
];
|
|
31
36
|
// section: component
|
|
32
|
-
export default function register_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, show_name_field = true, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel, returnHomePath = "/", signInPath = "/hazo_auth/login", signInLabel, urlOnLogon, oauth, layout = "two_column", }) {
|
|
37
|
+
export default function register_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, show_name_field = true, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel, returnHomePath = "/", signInPath = "/hazo_auth/login", signInLabel, urlOnLogon, oauth, layout = "two_column", locationFields, customFieldsSchema, }) {
|
|
33
38
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
34
39
|
const t = useAuthT();
|
|
35
40
|
const resolvedAlreadyLoggedInMessage = alreadyLoggedInMessage !== null && alreadyLoggedInMessage !== void 0 ? alreadyLoggedInMessage : t("shared.guard.already_logged_in_prop_default");
|
|
@@ -97,7 +102,23 @@ export default function register_layout({ image_src, image_alt, image_background
|
|
|
97
102
|
dataClient: data_client,
|
|
98
103
|
urlOnLogon: effectiveUrlOnLogon,
|
|
99
104
|
legalDocs: legal_docs,
|
|
105
|
+
locationFields,
|
|
106
|
+
customFieldsSchema,
|
|
100
107
|
});
|
|
108
|
+
// Additive, below the fixed name/email/password fields — never merged into
|
|
109
|
+
// REGISTER_FIELD_IDS's closed union (see use_register_form.ts's doc comment).
|
|
110
|
+
const renderLocationAndCustomFields = () => {
|
|
111
|
+
const enabledLocationKeys = ["country", "state_province", "suburb"].filter((key) => locationFields === null || locationFields === void 0 ? void 0 : locationFields[key]);
|
|
112
|
+
const customEntries = customFieldsSchema
|
|
113
|
+
? Object.entries(customFieldsSchema.properties).filter(([, def]) => def.type !== "object")
|
|
114
|
+
: [];
|
|
115
|
+
if (enabledLocationKeys.length === 0 && customEntries.length === 0)
|
|
116
|
+
return null;
|
|
117
|
+
return (_jsxs(_Fragment, { children: [enabledLocationKeys.map((key) => (_jsx(FormFieldWrapper, { fieldId: `register_location_${key}`, label: t(LOCATION_FIELD_LABELS[key]), input: _jsx(Input, { id: `register_location_${key}`, type: "text", value: form.locationValues[key], onChange: (event) => form.handleLocationFieldChange(key, event.target.value), className: "cls_register_layout_field_input" }) }, key))), customEntries.map(([key, def]) => {
|
|
118
|
+
var _a;
|
|
119
|
+
return (_jsx(FormFieldWrapper, { fieldId: `register_custom_${key}`, label: key, input: def.type === "boolean" ? (_jsx("input", { id: `register_custom_${key}`, type: "checkbox", checked: form.customFieldValues[key] === "true", onChange: (event) => form.handleCustomFieldChange(key, event.target.checked ? "true" : "false"), className: "cls_register_layout_custom_field_checkbox" })) : (_jsx(Input, { id: `register_custom_${key}`, type: def.type === "number" ? "number" : "text", value: (_a = form.customFieldValues[key]) !== null && _a !== void 0 ? _a : "", onChange: (event) => form.handleCustomFieldChange(key, event.target.value), className: "cls_register_layout_field_input" })) }, key));
|
|
120
|
+
})] }));
|
|
121
|
+
};
|
|
101
122
|
const renderFields = (formState) => {
|
|
102
123
|
const renderOrder = ORDERED_FIELDS.filter((fieldId) => show_name_field || fieldId !== REGISTER_FIELD_IDS.NAME);
|
|
103
124
|
return renderOrder.map((fieldId) => {
|
|
@@ -124,7 +145,7 @@ export default function register_layout({ image_src, image_alt, image_background
|
|
|
124
145
|
// Form content — used in both layout modes. See `login_layout` for the
|
|
125
146
|
// rationale: keeps the form independent of TwoColumnAuthLayout / AuthPageShell
|
|
126
147
|
// so consumers can compose it into their own brand chrome.
|
|
127
|
-
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_register_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_register_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_facebook_oauth && (_jsx("div", { className: "cls_register_layout_facebook_section", children: _jsx(FacebookSignInButton, { label: oauthConfig.facebook_button_text || t("shared.oauth.facebook_button_default"), callbackUrl: "/api/hazo_auth/oauth/facebook/callback" }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_register_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("register.aria.form"), children: [renderFields(form), legal_docs.length > 0 && (_jsx("div", { className: "space-y-2", children: legal_display_mode === 'combined' ? (_jsx(LegalDocCombinedView, { docs: legal_docs, accepted: legal_docs.every(doc => form.legal_accepted[doc.key]), onAcceptedChange: (value) => legal_docs.forEach(doc => form.handleLegalAcceptedChange(doc.key, value)) })) : (_jsx(LegalDocCheckboxList, { docs: legal_docs, accepted: form.legal_accepted, onAcceptedChange: form.handleLegalAcceptedChange })) })), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("register.aria.submit"), cancelAriaLabel: t("register.aria.cancel") }), _jsxs("div", { className: "cls_register_layout_sign_in_link flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: t("register.sign_in_prompt") }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": t("register.aria.sign_in_link"), children: resolvedSignInLabel })] }), form.isSubmitting && (_jsx("div", { className: "cls_register_submitting_indicator text-sm text-slate-600 text-center", children: t("register.submitting_indicator") }))] })), !oauthConfig.enable_email_password && (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && (_jsxs("div", { className: "cls_register_layout_sign_in_link mt-4 flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: t("register.sign_in_prompt") }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": t("register.aria.sign_in_link"), children: resolvedSignInLabel })] }))] }));
|
|
148
|
+
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_register_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_register_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_facebook_oauth && (_jsx("div", { className: "cls_register_layout_facebook_section", children: _jsx(FacebookSignInButton, { label: oauthConfig.facebook_button_text || t("shared.oauth.facebook_button_default"), callbackUrl: "/api/hazo_auth/oauth/facebook/callback" }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_register_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("register.aria.form"), children: [renderFields(form), renderLocationAndCustomFields(), legal_docs.length > 0 && (_jsx("div", { className: "space-y-2", children: legal_display_mode === 'combined' ? (_jsx(LegalDocCombinedView, { docs: legal_docs, accepted: legal_docs.every(doc => form.legal_accepted[doc.key]), onAcceptedChange: (value) => legal_docs.forEach(doc => form.handleLegalAcceptedChange(doc.key, value)) })) : (_jsx(LegalDocCheckboxList, { docs: legal_docs, accepted: form.legal_accepted, onAcceptedChange: form.handleLegalAcceptedChange })) })), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("register.aria.submit"), cancelAriaLabel: t("register.aria.cancel") }), _jsxs("div", { className: "cls_register_layout_sign_in_link flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: t("register.sign_in_prompt") }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": t("register.aria.sign_in_link"), children: resolvedSignInLabel })] }), form.isSubmitting && (_jsx("div", { className: "cls_register_submitting_indicator text-sm text-slate-600 text-center", children: t("register.submitting_indicator") }))] })), !oauthConfig.enable_email_password && (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && (_jsxs("div", { className: "cls_register_layout_sign_in_link mt-4 flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: t("register.sign_in_prompt") }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": t("register.aria.sign_in_link"), children: resolvedSignInLabel })] }))] }));
|
|
128
149
|
// form_only mode: emit just the form content. See login_layout for the
|
|
129
150
|
// rationale; AlreadyLoggedInGuard is intentionally skipped here.
|
|
130
151
|
if (layout === "form_only") {
|
|
@@ -11,6 +11,9 @@ export type AuthStatusData = {
|
|
|
11
11
|
image?: string;
|
|
12
12
|
profile_source?: "upload" | "library" | "gravatar" | "custom";
|
|
13
13
|
preferred_locale?: string | null;
|
|
14
|
+
country?: string | null;
|
|
15
|
+
state_province?: string | null;
|
|
16
|
+
suburb?: string | null;
|
|
14
17
|
permissions?: string[];
|
|
15
18
|
permission_ok?: boolean;
|
|
16
19
|
missing_permissions?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_auth_status.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/hooks/use_auth_status.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAE9D,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"use_auth_status.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/hooks/use_auth_status.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAE9D,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAMF;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAIlD;AAGD,wBAAgB,eAAe,IAAI,UAAU,CA+E5C"}
|
|
@@ -23,7 +23,7 @@ export function use_auth_status() {
|
|
|
23
23
|
loading: true,
|
|
24
24
|
});
|
|
25
25
|
const checkAuth = useCallback(async () => {
|
|
26
|
-
var _a, _b;
|
|
26
|
+
var _a, _b, _c, _d, _e;
|
|
27
27
|
setAuthStatus((prev) => (Object.assign(Object.assign({}, prev), { loading: true })));
|
|
28
28
|
try {
|
|
29
29
|
const response = await fetch(`${apiBasePath}/me`, {
|
|
@@ -46,8 +46,11 @@ export function use_auth_status() {
|
|
|
46
46
|
image: data.image,
|
|
47
47
|
profile_source: data.profile_source,
|
|
48
48
|
preferred_locale: (_a = data.preferred_locale) !== null && _a !== void 0 ? _a : null,
|
|
49
|
+
country: (_b = data.country) !== null && _b !== void 0 ? _b : null,
|
|
50
|
+
state_province: (_c = data.state_province) !== null && _c !== void 0 ? _c : null,
|
|
51
|
+
suburb: (_d = data.suburb) !== null && _d !== void 0 ? _d : null,
|
|
49
52
|
permissions: data.permissions || [],
|
|
50
|
-
permission_ok: (
|
|
53
|
+
permission_ok: (_e = data.permission_ok) !== null && _e !== void 0 ? _e : true,
|
|
51
54
|
missing_permissions: data.missing_permissions,
|
|
52
55
|
// OAuth-related fields
|
|
53
56
|
auth_providers: data.auth_providers,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -12,6 +12,9 @@ export type HazoAuthUser = {
|
|
|
12
12
|
app_user_data: Record<string, unknown> | null;
|
|
13
13
|
legal_acceptance: LegalAcceptanceMap | null;
|
|
14
14
|
preferred_locale: string | null;
|
|
15
|
+
country: string | null;
|
|
16
|
+
state_province: string | null;
|
|
17
|
+
suburb: string | null;
|
|
15
18
|
};
|
|
16
19
|
/**
|
|
17
20
|
* Scope access information returned when scope checking is used
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_types.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/auth_types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE9C,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAG5C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"auth_types.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/auth_types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,MAAM,GAAG,I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AAC;CAClB,CAAC;AAEN;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IACxD,aAAa,EAAE,IAAI,CAAC;IACpB,YAAY,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAIF;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;aAGpB,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,MAAM;gBAFnC,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM;CAKtC;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,aAAa;gBAChD,OAAO,GAAE,MAAkC;CAIxD;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;aAGlC,WAAW,EAAE,YAAY,EAAE;gBAD3C,OAAO,GAAE,MAAkC,EAC3B,WAAW,GAAE,YAAY,EAAO;CAKnD;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;aAEtC,QAAQ,EAAE,MAAM;aAChB,WAAW,EAAE,YAAY,EAAE;gBAD3B,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,YAAY,EAAO;CAKnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hazo_get_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAGhB,MAAM,cAAc,CAAC;AAgEtB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAU1D;
|
|
1
|
+
{"version":3,"file":"hazo_get_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAGhB,MAAM,cAAc,CAAC;AAgEtB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAU1D;AAgTD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CA+NzB"}
|
|
@@ -154,6 +154,9 @@ async function fetch_user_data_from_db(user_id) {
|
|
|
154
154
|
app_user_data: parse_app_user_data(user_db.app_user_data),
|
|
155
155
|
legal_acceptance: parse_legal_acceptance(user_db.legal_acceptance),
|
|
156
156
|
preferred_locale: user_db.preferred_locale || null,
|
|
157
|
+
country: user_db.country || null,
|
|
158
|
+
state_province: user_db.state_province || null,
|
|
159
|
+
suburb: user_db.suburb || null,
|
|
157
160
|
};
|
|
158
161
|
// v5.x: Fetch user's roles from hazo_user_scopes (scope-based role assignments)
|
|
159
162
|
// Each scope assignment has a role_id (string UUID)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
export type LocationFieldsConfig = {
|
|
3
|
+
country: boolean;
|
|
4
|
+
state_province: boolean;
|
|
5
|
+
suburb: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Reads the indexed location field toggles (country / state_province / suburb)
|
|
9
|
+
* from `[hazo_auth__custom_fields]` in hazo_auth_config.ini. All default to
|
|
10
|
+
* `false` — registration is unchanged for apps that don't opt in. These three
|
|
11
|
+
* columns are indexed (migration 025) for cohort benchmarking (GROUP BY
|
|
12
|
+
* country, state_province); arbitrary free-form fields go through the
|
|
13
|
+
* existing app_user_data schema (`get_app_user_data_schema()`) instead.
|
|
14
|
+
* @returns Which location fields are enabled
|
|
15
|
+
*/
|
|
16
|
+
export declare function get_location_fields_config(): LocationFieldsConfig;
|
|
17
|
+
/**
|
|
18
|
+
* True if at least one location field is enabled — lets a consumer skip
|
|
19
|
+
* rendering an empty "Location" section entirely.
|
|
20
|
+
*/
|
|
21
|
+
export declare function is_any_location_field_enabled(config: LocationFieldsConfig): boolean;
|
|
22
|
+
//# sourceMappingURL=location_fields_config.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location_fields_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/location_fields_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAMjE;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAEnF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// file_description: server-only helper to read location field toggles from hazo_auth_config.ini
|
|
2
|
+
// section: server-only-guard
|
|
3
|
+
import "server-only";
|
|
4
|
+
// section: imports
|
|
5
|
+
import { get_config_boolean } from "./config/config_loader.server.js";
|
|
6
|
+
// section: constants
|
|
7
|
+
const SECTION_NAME = "hazo_auth__custom_fields";
|
|
8
|
+
// section: helpers
|
|
9
|
+
/**
|
|
10
|
+
* Reads the indexed location field toggles (country / state_province / suburb)
|
|
11
|
+
* from `[hazo_auth__custom_fields]` in hazo_auth_config.ini. All default to
|
|
12
|
+
* `false` — registration is unchanged for apps that don't opt in. These three
|
|
13
|
+
* columns are indexed (migration 025) for cohort benchmarking (GROUP BY
|
|
14
|
+
* country, state_province); arbitrary free-form fields go through the
|
|
15
|
+
* existing app_user_data schema (`get_app_user_data_schema()`) instead.
|
|
16
|
+
* @returns Which location fields are enabled
|
|
17
|
+
*/
|
|
18
|
+
export function get_location_fields_config() {
|
|
19
|
+
return {
|
|
20
|
+
country: get_config_boolean(SECTION_NAME, "location_country", false),
|
|
21
|
+
state_province: get_config_boolean(SECTION_NAME, "location_state_province", false),
|
|
22
|
+
suburb: get_config_boolean(SECTION_NAME, "location_suburb", false),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* True if at least one location field is enabled — lets a consumer skip
|
|
27
|
+
* rendering an empty "Location" section entirely.
|
|
28
|
+
*/
|
|
29
|
+
export function is_any_location_field_enabled(config) {
|
|
30
|
+
return config.country || config.state_province || config.suburb;
|
|
31
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { type LocationFieldsConfig } from "./location_fields_config.server.js";
|
|
2
3
|
export type MySettingsConfig = {
|
|
3
4
|
userFields: {
|
|
4
5
|
show_name_field: boolean;
|
|
5
6
|
show_email_field: boolean;
|
|
6
7
|
show_password_field: boolean;
|
|
7
8
|
};
|
|
9
|
+
/** Which indexed location fields to show as an editable "Location" card —
|
|
10
|
+
* see [hazo_auth__custom_fields] in hazo_auth_config.ini. */
|
|
11
|
+
locationFields: LocationFieldsConfig;
|
|
8
12
|
passwordRequirements: {
|
|
9
13
|
minimum_length: number;
|
|
10
14
|
require_uppercase: boolean;
|
|
@@ -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;
|
|
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;AAUrB,OAAO,EAA8B,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGxG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE;QACV,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE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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,CAoEzD"}
|
|
@@ -9,6 +9,7 @@ import { get_profile_picture_config } from "./profile_picture_config.server.js";
|
|
|
9
9
|
import { get_messages_config } from "./messages_config.server.js";
|
|
10
10
|
import { get_ui_sizes_config } from "./ui_sizes_config.server.js";
|
|
11
11
|
import { get_file_types_config } from "./file_types_config.server.js";
|
|
12
|
+
import { get_location_fields_config } from "./location_fields_config.server.js";
|
|
12
13
|
// section: helpers
|
|
13
14
|
/**
|
|
14
15
|
* Reads my settings layout configuration from hazo_auth_config.ini file
|
|
@@ -51,8 +52,10 @@ export function get_my_settings_config() {
|
|
|
51
52
|
const loginButtonLabel = get_config_value_optional(section, "login_button_label");
|
|
52
53
|
const loginPath = get_config_value(section, "login_path", "/hazo_auth/login");
|
|
53
54
|
const enableAccountDeletion = get_config_boolean(section, "enable_account_deletion", false);
|
|
55
|
+
const locationFields = get_location_fields_config();
|
|
54
56
|
return {
|
|
55
57
|
userFields,
|
|
58
|
+
locationFields,
|
|
56
59
|
passwordRequirements,
|
|
57
60
|
profilePicture,
|
|
58
61
|
heading,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { type LocationFieldsConfig } from "./location_fields_config.server.js";
|
|
3
|
+
import { type AppUserDataSchema } from "./app_user_data_config.server.js";
|
|
2
4
|
export type RegisterConfig = {
|
|
3
5
|
showNameField: boolean;
|
|
4
6
|
passwordRequirements: {
|
|
@@ -28,6 +30,14 @@ export type RegisterConfig = {
|
|
|
28
30
|
enable_facebook_oauth: boolean;
|
|
29
31
|
facebook_button_text: string | undefined;
|
|
30
32
|
};
|
|
33
|
+
/** Which indexed location fields to render on the registration form — see
|
|
34
|
+
* [hazo_auth__custom_fields] in hazo_auth_config.ini. */
|
|
35
|
+
locationFields: LocationFieldsConfig;
|
|
36
|
+
/** Arbitrary custom fields to render on the registration form, reusing the
|
|
37
|
+
* EXISTING [hazo_auth__app_user_data] JSON Schema config (ticket 09 does NOT
|
|
38
|
+
* introduce a second, parallel custom-field config format). Null when
|
|
39
|
+
* schema-based app_user_data editing isn't enabled. */
|
|
40
|
+
customFieldsSchema: AppUserDataSchema | null;
|
|
31
41
|
};
|
|
32
42
|
/**
|
|
33
43
|
* Reads register layout configuration from hazo_auth_config.ini file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/register_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"register_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/register_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAarB,OAAO,EAA8B,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQjG,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,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,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,UAAU,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,0BAA0B;IAC1B,KAAK,EAAE;QACL,aAAa,EAAE,OAAO,CAAC;QACvB,qBAAqB,EAAE,OAAO,CAAC;QAC/B,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;QACvC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;QACvC,qBAAqB,EAAE,OAAO,CAAC;QAC/B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1C,CAAC;IACF;8DAC0D;IAC1D,cAAc,EAAE,oBAAoB,CAAC;IACrC;;;4DAGwD;IACxD,kBAAkB,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC9C,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAqFpD"}
|
|
@@ -7,6 +7,8 @@ import { get_password_requirements_config } from "./password_requirements_config
|
|
|
7
7
|
import { get_already_logged_in_config } from "./already_logged_in_config.server.js";
|
|
8
8
|
import { get_user_fields_config } from "./user_fields_config.server.js";
|
|
9
9
|
import { get_oauth_config } from "./oauth_config.server.js";
|
|
10
|
+
import { get_location_fields_config } from "./location_fields_config.server.js";
|
|
11
|
+
import { get_app_user_data_schema } from "./app_user_data_config.server.js";
|
|
10
12
|
// Default image path - consuming apps should either:
|
|
11
13
|
// 1. Configure their own image_src in hazo_auth_config.ini
|
|
12
14
|
// 2. Copy the default images from node_modules/hazo_auth/public/hazo_auth/images/ to their public folder
|
|
@@ -42,6 +44,9 @@ export function get_register_config() {
|
|
|
42
44
|
const imageBackgroundColor = get_config_value("hazo_auth__register_layout", "image_background_color", "#e2e8f0");
|
|
43
45
|
// Get OAuth configuration (shared with login)
|
|
44
46
|
const oauthConfig = get_oauth_config();
|
|
47
|
+
// Location + arbitrary custom fields (ticket 09)
|
|
48
|
+
const locationFields = get_location_fields_config();
|
|
49
|
+
const customFieldsSchema = get_app_user_data_schema();
|
|
45
50
|
// For the register page, the Google button text is undefined unless the
|
|
46
51
|
// consumer explicitly overrides it — RegisterLayout falls back to
|
|
47
52
|
// `t("register.oauth.google_button_default")` ("Sign up with Google").
|
|
@@ -67,5 +72,7 @@ export function get_register_config() {
|
|
|
67
72
|
enable_facebook_oauth: oauthConfig.enable_facebook_oauth,
|
|
68
73
|
facebook_button_text: oauthConfig.facebook_button_text,
|
|
69
74
|
},
|
|
75
|
+
locationFields,
|
|
76
|
+
customFieldsSchema,
|
|
70
77
|
};
|
|
71
78
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type LocationFieldsInput = {
|
|
2
|
+
country?: string;
|
|
3
|
+
state_province?: string;
|
|
4
|
+
suburb?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Returns only the location fields that were actually provided and non-blank,
|
|
8
|
+
* trimmed — ready to spread straight into an `insert`/`updateById` data object.
|
|
9
|
+
* @param location - Raw location input (e.g. from a registration or settings PATCH body)
|
|
10
|
+
* @returns A sparse object with only the fields worth persisting
|
|
11
|
+
*/
|
|
12
|
+
export declare function build_location_fields(location: LocationFieldsInput | undefined): Record<string, string>;
|
|
13
|
+
//# sourceMappingURL=location_fields_helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location_fields_helper.d.ts","sourceRoot":"","sources":["../../../src/lib/services/location_fields_helper.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWvG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// file_description: pure helper shared by registration_service and user_update_service —
|
|
2
|
+
// picks and trims the three indexed location columns (country / state_province / suburb)
|
|
3
|
+
// from caller-supplied data, dropping anything undefined or blank after trimming.
|
|
4
|
+
// section: helpers
|
|
5
|
+
/**
|
|
6
|
+
* Returns only the location fields that were actually provided and non-blank,
|
|
7
|
+
* trimmed — ready to spread straight into an `insert`/`updateById` data object.
|
|
8
|
+
* @param location - Raw location input (e.g. from a registration or settings PATCH body)
|
|
9
|
+
* @returns A sparse object with only the fields worth persisting
|
|
10
|
+
*/
|
|
11
|
+
export function build_location_fields(location) {
|
|
12
|
+
if (!location)
|
|
13
|
+
return {};
|
|
14
|
+
const result = {};
|
|
15
|
+
for (const key of ["country", "state_province", "suburb"]) {
|
|
16
|
+
const value = location[key];
|
|
17
|
+
if (value === undefined)
|
|
18
|
+
continue;
|
|
19
|
+
const trimmed = value.trim();
|
|
20
|
+
if (trimmed)
|
|
21
|
+
result[key] = trimmed;
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HazoConnectAdapter } from "hazo_connect";
|
|
2
|
+
import { type LocationFieldsInput } from "./location_fields_helper.js";
|
|
2
3
|
export type RegistrationData = {
|
|
3
4
|
email: string;
|
|
4
5
|
password: string;
|
|
@@ -9,6 +10,14 @@ export type RegistrationData = {
|
|
|
9
10
|
}>;
|
|
10
11
|
ip?: string | null;
|
|
11
12
|
user_agent?: string | null;
|
|
13
|
+
/** Indexed location columns — only persisted for fields enabled via
|
|
14
|
+
* `[hazo_auth__custom_fields]` (the route handler is responsible for
|
|
15
|
+
* stripping anything not enabled before calling here; see register.ts). */
|
|
16
|
+
location?: LocationFieldsInput;
|
|
17
|
+
/** Arbitrary custom fields (ticket 09's `custom_field_*` config), merged into the
|
|
18
|
+
* existing `app_user_data` JSONB column via `update_app_user_data()` — no new
|
|
19
|
+
* column or config parser for these; see register_config.server.ts. */
|
|
20
|
+
custom_fields?: Record<string, unknown>;
|
|
12
21
|
};
|
|
13
22
|
export type RegistrationResult = {
|
|
14
23
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/registration_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"registration_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/registration_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAkBvD,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI3F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;gFAE4E;IAC5E,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;4EAEwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAqL7B"}
|
|
@@ -12,6 +12,8 @@ import { get_line_number } from "../utils/api_route_helpers.js";
|
|
|
12
12
|
import { is_user_types_enabled, get_default_user_type, } from "../user_types_config.server.js";
|
|
13
13
|
import { write_legal_acceptance } from "../legal/legal_docs_service.js";
|
|
14
14
|
import { fire_auth_hook } from "../auth_hooks.js";
|
|
15
|
+
import { build_location_fields } from "./location_fields_helper.js";
|
|
16
|
+
import { update_app_user_data } from "./app_user_data_service.js";
|
|
15
17
|
// section: helpers
|
|
16
18
|
/**
|
|
17
19
|
* Registers a new user in the database using hazo_connect
|
|
@@ -63,6 +65,9 @@ export async function register_user(adapter, data) {
|
|
|
63
65
|
insert_data.url_on_logon = url_on_logon;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
68
|
+
// Indexed location columns (country / state_province / suburb) — additive,
|
|
69
|
+
// no-op when `data.location` is omitted (every pre-ticket-09 caller).
|
|
70
|
+
Object.assign(insert_data, build_location_fields(data.location));
|
|
66
71
|
// Set default profile picture if enabled
|
|
67
72
|
const profile_picture_config = get_profile_picture_config();
|
|
68
73
|
if (profile_picture_config.user_photo_default) {
|
|
@@ -88,6 +93,12 @@ export async function register_user(adapter, data) {
|
|
|
88
93
|
error: "Failed to create user account",
|
|
89
94
|
};
|
|
90
95
|
}
|
|
96
|
+
// Arbitrary custom fields (JSON Schema-driven, [hazo_auth__app_user_data]) —
|
|
97
|
+
// merge mode is a no-op concern here (brand new user, nothing to merge over),
|
|
98
|
+
// kept consistent with update_app_user_data()'s only mode of operation elsewhere.
|
|
99
|
+
if (data.custom_fields && Object.keys(data.custom_fields).length > 0) {
|
|
100
|
+
await update_app_user_data(adapter, user_id, data.custom_fields, { merge: true });
|
|
101
|
+
}
|
|
91
102
|
void fire_auth_hook("on_user_created", {
|
|
92
103
|
user_id,
|
|
93
104
|
email,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { HazoConnectAdapter } from "hazo_connect";
|
|
2
2
|
import { type ProfilePictureSourceUI } from "./profile_picture_source_mapper.js";
|
|
3
|
+
import { type LocationFieldsInput } from "./location_fields_helper.js";
|
|
3
4
|
export type UserUpdateData = {
|
|
4
5
|
name?: string;
|
|
5
6
|
email?: string;
|
|
6
7
|
profile_picture_url?: string;
|
|
7
8
|
profile_source?: ProfilePictureSourceUI;
|
|
8
9
|
preferred_locale?: string | null;
|
|
10
|
+
/** Indexed location columns (My Settings' "Location" card). Only non-blank,
|
|
11
|
+
* provided fields are persisted — omitted or blank fields are left unchanged
|
|
12
|
+
* (see build_location_fields; it has no "clear" semantics). */
|
|
13
|
+
location?: LocationFieldsInput;
|
|
9
14
|
};
|
|
10
15
|
export type UserUpdateResult = {
|
|
11
16
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user_update_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/user_update_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"user_update_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/user_update_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAInG,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG3F,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,sBAAsB,CAAC;IAIxC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;oEAEgE;IAChE,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,gBAAgB,CAAC,CA8G3B"}
|
|
@@ -3,6 +3,7 @@ import { map_ui_source_to_db } from "./profile_picture_source_mapper.js";
|
|
|
3
3
|
import { create_app_logger } from "../app_logger.js";
|
|
4
4
|
import { sanitize_error_for_user } from "../utils/error_sanitizer.js";
|
|
5
5
|
import { get_line_number } from "../utils/api_route_helpers.js";
|
|
6
|
+
import { build_location_fields } from "./location_fields_helper.js";
|
|
6
7
|
// section: helpers
|
|
7
8
|
/**
|
|
8
9
|
* Updates user profile information (name, email)
|
|
@@ -75,6 +76,7 @@ export async function update_user_profile(adapter, user_id, data) {
|
|
|
75
76
|
// null explicitly clears the preference (falls back to detection elsewhere)
|
|
76
77
|
update_data.preferred_locale = data.preferred_locale;
|
|
77
78
|
}
|
|
79
|
+
Object.assign(update_data, build_location_fields(data.location));
|
|
78
80
|
// If email changed, set email_verified to false
|
|
79
81
|
if (email_changed) {
|
|
80
82
|
update_data.email_verified = false;
|
package/dist/locales/en.json
CHANGED
|
@@ -162,6 +162,9 @@
|
|
|
162
162
|
"register.field.name.label": "Full name",
|
|
163
163
|
"register.field.name.placeholder": "Enter your full name",
|
|
164
164
|
"register.field.name.aria_label": "Full name input field",
|
|
165
|
+
"register.field.location_country.label": "Country",
|
|
166
|
+
"register.field.location_state_province.label": "State / Province",
|
|
167
|
+
"register.field.location_suburb.label": "Suburb",
|
|
165
168
|
"register.field.password.label": "Password",
|
|
166
169
|
"register.field.password.placeholder": "Enter your password",
|
|
167
170
|
"register.field.password.aria_label": "Password input field",
|
|
@@ -608,6 +611,12 @@
|
|
|
608
611
|
"my_settings.toast.password_error": "Failed to change password",
|
|
609
612
|
"my_settings.toast.profile_picture_success": "Profile picture updated successfully",
|
|
610
613
|
"my_settings.toast.profile_picture_error": "Failed to update profile picture",
|
|
614
|
+
"my_settings.toast.location_success": "Location updated successfully",
|
|
615
|
+
"my_settings.toast.location_error": "Failed to update location",
|
|
616
|
+
"my_settings.location_label_default": "Location",
|
|
617
|
+
"my_settings.location.country_label": "Country",
|
|
618
|
+
"my_settings.location.state_province_label": "State / Province",
|
|
619
|
+
"my_settings.location.suburb_label": "Suburb",
|
|
611
620
|
"my_settings.toast.profile_picture_removed": "Profile picture removed successfully",
|
|
612
621
|
"my_settings.toast.profile_picture_remove_error": "Failed to remove profile picture",
|
|
613
622
|
"user_management.table.photo": "Photo",
|
|
@@ -21,6 +21,14 @@ export type MySettingsPageProps = {
|
|
|
21
21
|
show_email_field?: boolean;
|
|
22
22
|
show_password_field?: boolean;
|
|
23
23
|
};
|
|
24
|
+
/** Which indexed location fields to show as an editable "Location" card.
|
|
25
|
+
* All default to false — this manual-config entry point has no INI file to
|
|
26
|
+
* read, unlike the zero-config `server_pages/my_settings.tsx`. */
|
|
27
|
+
locationFields?: {
|
|
28
|
+
country?: boolean;
|
|
29
|
+
state_province?: boolean;
|
|
30
|
+
suburb?: boolean;
|
|
31
|
+
};
|
|
24
32
|
passwordRequirements?: Partial<PasswordRequirementOptions>;
|
|
25
33
|
profilePicture?: {
|
|
26
34
|
allow_photo_upload?: boolean;
|
|
@@ -64,6 +72,6 @@ export type MySettingsPageProps = {
|
|
|
64
72
|
* @param props - Optional configuration overrides
|
|
65
73
|
* @returns My settings page component
|
|
66
74
|
*/
|
|
67
|
-
export declare function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading: headingProp, subHeading: subHeadingProp, profilePhotoLabel: profilePhotoLabelProp, profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabelProp, removePhotoButtonLabel: removePhotoButtonLabelProp, profileInformationLabel: profileInformationLabelProp, passwordLabel: passwordLabelProp, currentPasswordLabel: currentPasswordLabelProp, newPasswordLabel: newPasswordLabelProp, confirmPasswordLabel: confirmPasswordLabelProp, savePasswordButtonLabel, unauthorizedMessage: unauthorizedMessageProp, loginButtonLabel: loginButtonLabelProp, loginPath, enableAccountDeletion, messages, uiSizes, fileTypes, }?: MySettingsPageProps): import("react").JSX.Element;
|
|
75
|
+
export declare function MySettingsPage({ userFields, locationFields, passwordRequirements, profilePicture, heading: headingProp, subHeading: subHeadingProp, profilePhotoLabel: profilePhotoLabelProp, profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabelProp, removePhotoButtonLabel: removePhotoButtonLabelProp, profileInformationLabel: profileInformationLabelProp, passwordLabel: passwordLabelProp, currentPasswordLabel: currentPasswordLabelProp, newPasswordLabel: newPasswordLabelProp, confirmPasswordLabel: confirmPasswordLabelProp, savePasswordButtonLabel, unauthorizedMessage: unauthorizedMessageProp, loginButtonLabel: loginButtonLabelProp, loginPath, enableAccountDeletion, messages, uiSizes, fileTypes, }?: MySettingsPageProps): import("react").JSX.Element;
|
|
68
76
|
export default MySettingsPage;
|
|
69
77
|
//# sourceMappingURL=my_settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/page_components/my_settings.tsx"],"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