hazo_auth 10.23.3 → 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.
Files changed (73) hide show
  1. package/README.md +8 -0
  2. package/cli-src/lib/auth/auth_types.ts +6 -0
  3. package/cli-src/lib/auth/hazo_get_auth.server.ts +3 -0
  4. package/cli-src/lib/location_fields_config.server.ts +42 -0
  5. package/cli-src/lib/my_settings_config.server.ts +6 -0
  6. package/cli-src/lib/register_config.server.ts +16 -0
  7. package/cli-src/lib/services/group_service.ts +380 -0
  8. package/cli-src/lib/services/index.ts +1 -0
  9. package/cli-src/lib/services/location_fields_helper.ts +30 -0
  10. package/cli-src/lib/services/registration_service.ts +21 -0
  11. package/cli-src/lib/services/user_update_service.ts +7 -0
  12. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +8 -0
  13. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
  14. package/dist/components/layouts/my_settings/hooks/use_my_settings.js +37 -0
  15. package/dist/components/layouts/my_settings/index.d.ts +6 -1
  16. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  17. package/dist/components/layouts/my_settings/index.js +3 -3
  18. package/dist/components/layouts/register/hooks/use_register_form.d.ts +15 -1
  19. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  20. package/dist/components/layouts/register/hooks/use_register_form.js +69 -4
  21. package/dist/components/layouts/register/index.d.ts +7 -1
  22. package/dist/components/layouts/register/index.d.ts.map +1 -1
  23. package/dist/components/layouts/register/index.js +24 -3
  24. package/dist/components/layouts/shared/hooks/use_auth_status.d.ts +3 -0
  25. package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
  26. package/dist/components/layouts/shared/hooks/use_auth_status.js +5 -2
  27. package/dist/lib/auth/auth_types.d.ts +3 -0
  28. package/dist/lib/auth/auth_types.d.ts.map +1 -1
  29. package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
  30. package/dist/lib/auth/hazo_get_auth.server.js +3 -0
  31. package/dist/lib/location_fields_config.server.d.ts +22 -0
  32. package/dist/lib/location_fields_config.server.d.ts.map +1 -0
  33. package/dist/lib/location_fields_config.server.js +31 -0
  34. package/dist/lib/my_settings_config.server.d.ts +4 -0
  35. package/dist/lib/my_settings_config.server.d.ts.map +1 -1
  36. package/dist/lib/my_settings_config.server.js +3 -0
  37. package/dist/lib/register_config.server.d.ts +10 -0
  38. package/dist/lib/register_config.server.d.ts.map +1 -1
  39. package/dist/lib/register_config.server.js +7 -0
  40. package/dist/lib/services/group_service.d.ts +66 -0
  41. package/dist/lib/services/group_service.d.ts.map +1 -0
  42. package/dist/lib/services/group_service.js +266 -0
  43. package/dist/lib/services/index.d.ts +1 -0
  44. package/dist/lib/services/index.d.ts.map +1 -1
  45. package/dist/lib/services/index.js +1 -0
  46. package/dist/lib/services/location_fields_helper.d.ts +13 -0
  47. package/dist/lib/services/location_fields_helper.d.ts.map +1 -0
  48. package/dist/lib/services/location_fields_helper.js +24 -0
  49. package/dist/lib/services/registration_service.d.ts +9 -0
  50. package/dist/lib/services/registration_service.d.ts.map +1 -1
  51. package/dist/lib/services/registration_service.js +11 -0
  52. package/dist/lib/services/user_update_service.d.ts +5 -0
  53. package/dist/lib/services/user_update_service.d.ts.map +1 -1
  54. package/dist/lib/services/user_update_service.js +2 -0
  55. package/dist/locales/en.json +9 -0
  56. package/dist/page_components/my_settings.d.ts +9 -1
  57. package/dist/page_components/my_settings.d.ts.map +1 -1
  58. package/dist/page_components/my_settings.js +8 -2
  59. package/dist/server/routes/me.d.ts.map +1 -1
  60. package/dist/server/routes/me.js +5 -1
  61. package/dist/server/routes/register.d.ts.map +1 -1
  62. package/dist/server/routes/register.js +46 -0
  63. package/dist/server/routes/update_user.d.ts.map +1 -1
  64. package/dist/server/routes/update_user.js +24 -1
  65. package/dist/server/routes/user_management_users.d.ts +1 -1
  66. package/dist/server_pages/my_settings.d.ts.map +1 -1
  67. package/dist/server_pages/my_settings.js +1 -1
  68. package/dist/server_pages/register.d.ts.map +1 -1
  69. package/dist/server_pages/register.js +1 -1
  70. package/dist/server_pages/register_client_wrapper.d.ts +4 -2
  71. package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
  72. package/dist/server_pages/register_client_wrapper.js +2 -2
  73. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"use_my_settings.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/hooks/use_my_settings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAE3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAI3E,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sBAAsB,EAAE,OAAO,CAAC;IAChC,MAAM,EAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAChC,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAEhC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC7D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IAGjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,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AG,mBAAmB,CAka3C"}
@@ -56,6 +56,9 @@ export function use_my_settings({ passwordRequirements, t, }) {
56
56
  const profilePictureUrl = authStatus.profile_picture_url;
57
57
  const profileSource = authStatus.profile_source;
58
58
  const preferredLocale = authStatus.preferred_locale;
59
+ const country = authStatus.country;
60
+ const stateProvince = authStatus.state_province;
61
+ const suburb = authStatus.suburb;
59
62
  const lastLogon = authStatus.last_logon;
60
63
  const loading = authStatus.loading;
61
64
  // OAuth-related data
@@ -169,6 +172,36 @@ export function use_my_settings({ passwordRequirements, t, }) {
169
172
  throw error;
170
173
  }
171
174
  }, [apiBasePath, refreshUserData, t]);
175
+ /**
176
+ * Updates the user's location fields (country / state_province / suburb).
177
+ * Only sends the fields present in `location` — the server re-validates against
178
+ * [hazo_auth__custom_fields] regardless (see update_user.ts).
179
+ */
180
+ const handleLocationSave = useCallback(async (location) => {
181
+ try {
182
+ const response = await fetch(`${apiBasePath}/update_user`, {
183
+ method: "PATCH",
184
+ headers: {
185
+ "Content-Type": "application/json",
186
+ },
187
+ credentials: "include",
188
+ body: JSON.stringify({ location }),
189
+ });
190
+ const data = await response.json();
191
+ if (!response.ok || !data.success) {
192
+ const errorMessage = data.error || t("my_settings.toast.location_error");
193
+ toast.error(errorMessage);
194
+ throw new Error(errorMessage);
195
+ }
196
+ toast.success(t("my_settings.toast.location_success"));
197
+ await refreshUserData();
198
+ }
199
+ catch (error) {
200
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.location_error");
201
+ toast.error(errorMessage);
202
+ throw error;
203
+ }
204
+ }, [apiBasePath, refreshUserData, t]);
172
205
  /**
173
206
  * Handles password field change
174
207
  */
@@ -352,6 +385,9 @@ export function use_my_settings({ passwordRequirements, t, }) {
352
385
  profilePictureUrl,
353
386
  profileSource,
354
387
  preferredLocale,
388
+ country,
389
+ stateProvince,
390
+ suburb,
355
391
  lastLogon,
356
392
  loading,
357
393
  // OAuth-related data
@@ -372,6 +408,7 @@ export function use_my_settings({ passwordRequirements, t, }) {
372
408
  handleNameSave,
373
409
  handleEmailSave,
374
410
  handlePreferredLocaleSave,
411
+ handleLocationSave,
375
412
  refreshUserData,
376
413
  };
377
414
  }
@@ -1,6 +1,7 @@
1
1
  import { type AvailableLocale } from "./components/language_picker_section.js";
2
2
  import { type MySettingsLabelOverrides } from "./config/my_settings_field_config.js";
3
3
  import type { PasswordRequirementOptions, ButtonPaletteOverrides } from "../shared/config/layout_customization";
4
+ import type { LocationFieldsConfig } from "../../../lib/location_fields_config.server";
4
5
  export type MySettingsLayoutProps = {
5
6
  className?: string;
6
7
  labels?: MySettingsLabelOverrides;
@@ -20,6 +21,10 @@ export type MySettingsLayoutProps = {
20
21
  show_email_field: boolean;
21
22
  show_password_field: boolean;
22
23
  };
24
+ /** Which indexed location fields to show as an editable "Location" card.
25
+ * Optional — defaults to all-off, so existing callers that don't pass it
26
+ * (and existing tests) are unaffected. */
27
+ locationFields?: LocationFieldsConfig;
23
28
  unauthorizedMessage?: string;
24
29
  loginButtonLabel?: string;
25
30
  loginPath?: string;
@@ -74,5 +79,5 @@ export type MySettingsLayoutProps = {
74
79
  * @param props - Component props including labels, button colors, password requirements, etc.
75
80
  * @returns My settings layout component
76
81
  */
77
- export default function my_settings_layout({ className, labels, button_colors, password_requirements, profilePicture, userFields, unauthorizedMessage, loginButtonLabel, loginPath, availableLocales, enableAccountDeletion, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, messages, uiSizes, fileTypes, }: MySettingsLayoutProps): import("react").JSX.Element;
82
+ export default function my_settings_layout({ className, labels, button_colors, password_requirements, profilePicture, userFields, locationFields, unauthorizedMessage, loginButtonLabel, loginPath, availableLocales, enableAccountDeletion, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, messages, uiSizes, fileTypes, }: MySettingsLayoutProps): import("react").JSX.Element;
78
83
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/my_settings/index.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGnG,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAS/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,EAAE,0BAA0B,CAAC;IAClD,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,UAAU,EAAE;QACV,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,M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cAAc,EACd,UAAU,EACV,cAAyE,EACzE,mBAAmB,EACnB,gBAAgB,EAChB,SAA8B,EAC9B,gBAAgB,EAChB,qBAA6B,EAC7B,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,qBAAqB,+BA2TvB"}
@@ -27,8 +27,8 @@ import { useAuthT } from "../../../contexts/hazo_auth_provider.js";
27
27
  * @param props - Component props including labels, button colors, password requirements, etc.
28
28
  * @returns My settings layout component
29
29
  */
30
- export default function my_settings_layout({ className, labels, button_colors, password_requirements, profilePicture, userFields, unauthorizedMessage, loginButtonLabel, loginPath = "/hazo_auth/login", availableLocales, enableAccountDeletion = false, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, messages, uiSizes, fileTypes, }) {
31
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
30
+ export default function my_settings_layout({ className, labels, button_colors, password_requirements, profilePicture, userFields, locationFields = { country: false, state_province: false, suburb: false }, unauthorizedMessage, loginButtonLabel, loginPath = "/hazo_auth/login", availableLocales, enableAccountDeletion = false, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, messages, uiSizes, fileTypes, }) {
31
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
32
32
  const t = useAuthT();
33
33
  const resolvedLabels = resolveMySettingsLabels(t, labels);
34
34
  const resolvedButtonPalette = resolveMySettingsButtonPalette(button_colors);
@@ -65,7 +65,7 @@ export default function my_settings_layout({ className, labels, button_colors, p
65
65
  passwordRequirements: password_requirements,
66
66
  t,
67
67
  });
68
- return (_jsx(UnauthorizedGuard, { message: resolvedUnauthorizedMessage, loginButtonLabel: resolvedLoginButtonLabel, loginPath: loginPath, children: _jsxs("div", { className: cn("cls_my_settings_layout flex flex-col gap-6 p-6 w-full", className), children: [_jsxs("div", { className: "cls_my_settings_layout_header flex flex-col gap-2", children: [_jsx("h1", { className: "cls_my_settings_layout_heading text-3xl font-bold text-[var(--hazo-text-primary)]", children: resolvedHeading }), _jsx("p", { className: "cls_my_settings_layout_subheading text-[var(--hazo-text-muted)]", children: resolvedSubHeading })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedProfilePhotoLabel }), _jsx("div", { className: "cls_my_settings_layout_profile_photo_content flex flex-col items-center", children: _jsxs("div", { className: "cls_my_settings_layout_profile_photo_display relative", children: [_jsx(ProfilePictureDisplay, { profilePictureUrl: settings.profilePictureUrl, name: settings.name, email: settings.email, onEdit: settings.handleProfilePictureEdit }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_actions absolute left-0 right-0 flex items-center justify-between px-2", style: { bottom: '-20px' }, children: [_jsx(Button, { type: "button", onClick: settings.handleProfilePictureEdit, disabled: settings.loading, variant: "ghost", size: "icon", className: "cls_my_settings_layout_upload_photo_button", "aria-label": resolvedUploadPhotoButtonLabel, children: _jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", onClick: settings.handleProfilePictureRemove, disabled: settings.loading || !settings.profilePictureUrl, variant: "ghost", size: "icon", className: "cls_my_settings_layout_remove_photo_button text-red-600 hover:text-red-700 hover:bg-red-50", "aria-label": resolvedRemovePhotoButtonLabel, children: _jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" }) })] })] }) })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedProfileInformationLabel }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_fields grid grid-cols-1 md:grid-cols-2 gap-6", children: [userFields.show_name_field && (_jsx(EditableField, { label: t("my_settings.name_field.label_default"), value: settings.name, type: "text", placeholder: t("my_settings.name_field.placeholder_default"), onSave: settings.handleNameSave, validation: validateName, disabled: settings.loading, ariaLabel: t("my_settings.name_field.aria_label_default") })), userFields.show_email_field && (_jsx(EditableField, { label: t("shared.field.email.label"), value: settings.email, type: "email", placeholder: t("shared.field.email.placeholder"), onSave: settings.handleEmailSave, validation: validateEmail, disabled: settings.loading, ariaLabel: t("shared.field.email.aria_label") })), _jsx(LanguagePickerSection, { availableLocales: availableLocales, currentLocale: settings.preferredLocale, onLocaleChange: settings.handlePreferredLocaleSave, disabled: settings.loading })] })] }), userFields.show_password_field && settings.hasPassword && (_jsxs("div", { className: "cls_my_settings_layout_password_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedPasswordLabel }), _jsxs("div", { className: "cls_my_settings_layout_password_fields flex flex-col gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "current-password", label: resolvedCurrentPasswordLabel, input: _jsx(PasswordField, { inputId: "current-password", ariaLabel: resolvedCurrentPasswordLabel, value: ((_a = settings.passwordFields) === null || _a === void 0 ? void 0 : _a.currentPassword) || "", placeholder: t("my_settings.current_password_placeholder_default"), autoComplete: "current-password", isVisible: ((_b = settings.passwordFields) === null || _b === void 0 ? void 0 : _b.currentPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("currentPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("currentPassword"), errorMessage: (_d = (_c = settings.passwordFields) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d.currentPassword }) }), _jsxs("div", { className: "cls_my_settings_layout_password_fields_row grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "new-password", label: resolvedNewPasswordLabel, input: _jsx(PasswordField, { inputId: "new-password", ariaLabel: resolvedNewPasswordLabel, value: ((_e = settings.passwordFields) === null || _e === void 0 ? void 0 : _e.newPassword) || "", placeholder: t("my_settings.set_password.new_password_placeholder"), autoComplete: "new-password", isVisible: ((_f = settings.passwordFields) === null || _f === void 0 ? void 0 : _f.newPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("newPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("newPassword"), errorMessage: (_h = (_g = settings.passwordFields) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h.newPassword }) }), _jsx(FormFieldWrapper, { fieldId: "confirm-password", label: resolvedConfirmPasswordLabel, input: _jsx(PasswordField, { inputId: "confirm-password", ariaLabel: resolvedConfirmPasswordLabel, value: ((_j = settings.passwordFields) === null || _j === void 0 ? void 0 : _j.confirmPassword) || "", placeholder: t("my_settings.set_password.confirm_password_placeholder"), autoComplete: "new-password", isVisible: ((_k = settings.passwordFields) === null || _k === void 0 ? void 0 : _k.confirmPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("confirmPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("confirmPassword"), errorMessage: (_m = (_l = settings.passwordFields) === null || _l === void 0 ? void 0 : _l.errors) === null || _m === void 0 ? void 0 : _m.confirmPassword }) })] })] }), _jsx("div", { className: "cls_my_settings_layout_password_actions flex justify-end mt-4", children: _jsx(Button, { type: "button", onClick: settings.handlePasswordSave, disabled: settings.loading || settings.isPasswordSaveDisabled, className: "cls_my_settings_layout_save_password_button", style: {
68
+ return (_jsx(UnauthorizedGuard, { message: resolvedUnauthorizedMessage, loginButtonLabel: resolvedLoginButtonLabel, loginPath: loginPath, children: _jsxs("div", { className: cn("cls_my_settings_layout flex flex-col gap-6 p-6 w-full", className), children: [_jsxs("div", { className: "cls_my_settings_layout_header flex flex-col gap-2", children: [_jsx("h1", { className: "cls_my_settings_layout_heading text-3xl font-bold text-[var(--hazo-text-primary)]", children: resolvedHeading }), _jsx("p", { className: "cls_my_settings_layout_subheading text-[var(--hazo-text-muted)]", children: resolvedSubHeading })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedProfilePhotoLabel }), _jsx("div", { className: "cls_my_settings_layout_profile_photo_content flex flex-col items-center", children: _jsxs("div", { className: "cls_my_settings_layout_profile_photo_display relative", children: [_jsx(ProfilePictureDisplay, { profilePictureUrl: settings.profilePictureUrl, name: settings.name, email: settings.email, onEdit: settings.handleProfilePictureEdit }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_actions absolute left-0 right-0 flex items-center justify-between px-2", style: { bottom: '-20px' }, children: [_jsx(Button, { type: "button", onClick: settings.handleProfilePictureEdit, disabled: settings.loading, variant: "ghost", size: "icon", className: "cls_my_settings_layout_upload_photo_button", "aria-label": resolvedUploadPhotoButtonLabel, children: _jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", onClick: settings.handleProfilePictureRemove, disabled: settings.loading || !settings.profilePictureUrl, variant: "ghost", size: "icon", className: "cls_my_settings_layout_remove_photo_button text-red-600 hover:text-red-700 hover:bg-red-50", "aria-label": resolvedRemovePhotoButtonLabel, children: _jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" }) })] })] }) })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedProfileInformationLabel }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_fields grid grid-cols-1 md:grid-cols-2 gap-6", children: [userFields.show_name_field && (_jsx(EditableField, { label: t("my_settings.name_field.label_default"), value: settings.name, type: "text", placeholder: t("my_settings.name_field.placeholder_default"), onSave: settings.handleNameSave, validation: validateName, disabled: settings.loading, ariaLabel: t("my_settings.name_field.aria_label_default") })), userFields.show_email_field && (_jsx(EditableField, { label: t("shared.field.email.label"), value: settings.email, type: "email", placeholder: t("shared.field.email.placeholder"), onSave: settings.handleEmailSave, validation: validateEmail, disabled: settings.loading, ariaLabel: t("shared.field.email.aria_label") })), _jsx(LanguagePickerSection, { availableLocales: availableLocales, currentLocale: settings.preferredLocale, onLocaleChange: settings.handlePreferredLocaleSave, disabled: settings.loading })] })] }), (locationFields.country || locationFields.state_province || locationFields.suburb) && (_jsxs("div", { className: "cls_my_settings_layout_location_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: t("my_settings.location_label_default") }), _jsxs("div", { className: "cls_my_settings_layout_location_fields grid grid-cols-1 md:grid-cols-2 gap-6", children: [locationFields.country && (_jsx(EditableField, { label: t("my_settings.location.country_label"), value: (_a = settings.country) !== null && _a !== void 0 ? _a : "", type: "text", onSave: (value) => settings.handleLocationSave({ country: value }), disabled: settings.loading, ariaLabel: t("my_settings.location.country_label") })), locationFields.state_province && (_jsx(EditableField, { label: t("my_settings.location.state_province_label"), value: (_b = settings.stateProvince) !== null && _b !== void 0 ? _b : "", type: "text", onSave: (value) => settings.handleLocationSave({ state_province: value }), disabled: settings.loading, ariaLabel: t("my_settings.location.state_province_label") })), locationFields.suburb && (_jsx(EditableField, { label: t("my_settings.location.suburb_label"), value: (_c = settings.suburb) !== null && _c !== void 0 ? _c : "", type: "text", onSave: (value) => settings.handleLocationSave({ suburb: value }), disabled: settings.loading, ariaLabel: t("my_settings.location.suburb_label") }))] })] })), userFields.show_password_field && settings.hasPassword && (_jsxs("div", { className: "cls_my_settings_layout_password_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedPasswordLabel }), _jsxs("div", { className: "cls_my_settings_layout_password_fields flex flex-col gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "current-password", label: resolvedCurrentPasswordLabel, input: _jsx(PasswordField, { inputId: "current-password", ariaLabel: resolvedCurrentPasswordLabel, value: ((_d = settings.passwordFields) === null || _d === void 0 ? void 0 : _d.currentPassword) || "", placeholder: t("my_settings.current_password_placeholder_default"), autoComplete: "current-password", isVisible: ((_e = settings.passwordFields) === null || _e === void 0 ? void 0 : _e.currentPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("currentPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("currentPassword"), errorMessage: (_g = (_f = settings.passwordFields) === null || _f === void 0 ? void 0 : _f.errors) === null || _g === void 0 ? void 0 : _g.currentPassword }) }), _jsxs("div", { className: "cls_my_settings_layout_password_fields_row grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "new-password", label: resolvedNewPasswordLabel, input: _jsx(PasswordField, { inputId: "new-password", ariaLabel: resolvedNewPasswordLabel, value: ((_h = settings.passwordFields) === null || _h === void 0 ? void 0 : _h.newPassword) || "", placeholder: t("my_settings.set_password.new_password_placeholder"), autoComplete: "new-password", isVisible: ((_j = settings.passwordFields) === null || _j === void 0 ? void 0 : _j.newPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("newPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("newPassword"), errorMessage: (_l = (_k = settings.passwordFields) === null || _k === void 0 ? void 0 : _k.errors) === null || _l === void 0 ? void 0 : _l.newPassword }) }), _jsx(FormFieldWrapper, { fieldId: "confirm-password", label: resolvedConfirmPasswordLabel, input: _jsx(PasswordField, { inputId: "confirm-password", ariaLabel: resolvedConfirmPasswordLabel, value: ((_m = settings.passwordFields) === null || _m === void 0 ? void 0 : _m.confirmPassword) || "", placeholder: t("my_settings.set_password.confirm_password_placeholder"), autoComplete: "new-password", isVisible: ((_o = settings.passwordFields) === null || _o === void 0 ? void 0 : _o.confirmPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("confirmPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("confirmPassword"), errorMessage: (_q = (_p = settings.passwordFields) === null || _p === void 0 ? void 0 : _p.errors) === null || _q === void 0 ? void 0 : _q.confirmPassword }) })] })] }), _jsx("div", { className: "cls_my_settings_layout_password_actions flex justify-end mt-4", children: _jsx(Button, { type: "button", onClick: settings.handlePasswordSave, disabled: settings.loading || settings.isPasswordSaveDisabled, className: "cls_my_settings_layout_save_password_button", style: {
69
69
  backgroundColor: resolvedButtonPalette.submitBackground,
70
70
  color: resolvedButtonPalette.submitText,
71
71
  }, "aria-label": t("my_settings.save_password_aria_default"), children: t("my_settings.save_password_button_default") }) })] })), !settings.hasPassword && settings.googleConnected && (_jsx(SetPasswordSection, { passwordRequirements: password_requirements, onPasswordSet: settings.refreshUserData, parentLoading: settings.loading })), _jsx(ConnectedAccountsSection, { googleConnected: settings.googleConnected || false, email: settings.email, loading: settings.loading }), _jsx(DangerZoneSection, { enabled: enableAccountDeletion, email: settings.email }), _jsx(ProfilePictureDialog, { open: settings.profilePictureDialogOpen, onOpenChange: (open) => {
@@ -2,6 +2,8 @@ import type { LayoutDataClient } from "../../shared/data/layout_data_client";
2
2
  import type { PasswordRequirementOptions, PasswordRequirementOverrides } from "../../shared/config/layout_customization";
3
3
  import { type RegisterFieldId } from "../config/register_field_config.js";
4
4
  import type { LegalDoc } from "../../../../lib/legal/legal_docs_types";
5
+ import type { LocationFieldsConfig } from "../../../../lib/location_fields_config.server";
6
+ import type { AppUserDataSchema } from "../../../../lib/app_user_data_config.server";
5
7
  export type RegisterFormValues = Record<RegisterFieldId, string>;
6
8
  export type RegisterFormErrors = Partial<Record<RegisterFieldId, string | string[]>> & {
7
9
  submit?: string;
@@ -14,7 +16,15 @@ export type UseRegisterFormParams<TClient = unknown> = {
14
16
  dataClient: LayoutDataClient<TClient>;
15
17
  urlOnLogon?: string;
16
18
  legalDocs?: LegalDoc[];
19
+ /** Which indexed location fields to collect — see [hazo_auth__custom_fields]. */
20
+ locationFields?: LocationFieldsConfig;
21
+ /** Arbitrary custom fields, reusing the existing app_user_data JSON Schema config.
22
+ * Only flat `string` | `number` | `boolean` top-level properties are rendered at
23
+ * registration time — nested `object` properties are edited later via User
24
+ * Management's schema editor, not at signup. */
25
+ customFieldsSchema?: AppUserDataSchema | null;
17
26
  };
27
+ export type LocationFieldKey = "country" | "state_province" | "suburb";
18
28
  export type UseRegisterFormResult = {
19
29
  values: RegisterFormValues;
20
30
  errors: RegisterFormErrors;
@@ -29,6 +39,10 @@ export type UseRegisterFormResult = {
29
39
  handleCancel: () => void;
30
40
  legal_accepted: Record<string, boolean>;
31
41
  handleLegalAcceptedChange: (key: string, value: boolean) => void;
42
+ locationValues: Record<LocationFieldKey, string>;
43
+ handleLocationFieldChange: (field: LocationFieldKey, value: string) => void;
44
+ customFieldValues: Record<string, string>;
45
+ handleCustomFieldChange: (key: string, value: string) => void;
32
46
  };
33
- export declare const use_register_form: <TClient>({ showNameField, passwordRequirements, dataClient, urlOnLogon, legalDocs, }: UseRegisterFormParams<TClient>) => UseRegisterFormResult;
47
+ export declare const use_register_form: <TClient>({ showNameField, passwordRequirements, dataClient, urlOnLogon, legalDocs, locationFields, customFieldsSchema, }: UseRegisterFormParams<TClient>) => UseRegisterFormResult;
34
48
  //# sourceMappingURL=use_register_form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_register_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/register/hooks/use_register_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E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E,UAAU,GAAG,kBAAkB,KAAK,IAAI,CAAC;IAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,yBAAyB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClE,CAAC;AAYF,eAAO,MAAM,iBAAiB,GAAI,OAAO,EAAG,6EAMzC,qBAAqB,CAAC,OAAO,CAAC,KAAG,qBAgRnC,CAAC"}
1
+ {"version":3,"file":"use_register_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/register/hooks/use_register_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACzH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAGvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AASrF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,CAAC,eAAe,EAAE,UAAU,GAAG,kBAAkB,CAAC,EACzD,OA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c,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACjD,yBAAyB,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D,CAAC;AAYF,eAAO,MAAM,iBAAiB,GAAI,OAAO,EAAG,iHAQzC,qBAAqB,CAAC,OAAO,CAAC,KAAG,qBAmVnC,CAAC"}
@@ -18,7 +18,7 @@ const buildInitialValues = () => ({
18
18
  [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: "",
19
19
  });
20
20
  // section: hook
21
- export const use_register_form = ({ showNameField, passwordRequirements, dataClient, urlOnLogon, legalDocs, }) => {
21
+ export const use_register_form = ({ showNameField, passwordRequirements, dataClient, urlOnLogon, legalDocs, locationFields, customFieldsSchema, }) => {
22
22
  const { apiBasePath } = useHazoAuthConfig();
23
23
  const t = useAuthT();
24
24
  const initialValues = useMemo(() => buildInitialValues(), []);
@@ -31,6 +31,18 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
31
31
  const [emailTouched, setEmailTouched] = useState(false);
32
32
  const [isSubmitting, setIsSubmitting] = useState(false);
33
33
  const [legal_accepted, set_legal_accepted] = useState({});
34
+ const [locationValues, setLocationValues] = useState({
35
+ country: "",
36
+ state_province: "",
37
+ suburb: "",
38
+ });
39
+ const [customFieldValues, setCustomFieldValues] = useState({});
40
+ const handleLocationFieldChange = useCallback((field, value) => {
41
+ setLocationValues((prev) => (Object.assign(Object.assign({}, prev), { [field]: value })));
42
+ }, []);
43
+ const handleCustomFieldChange = useCallback((key, value) => {
44
+ setCustomFieldValues((prev) => (Object.assign(Object.assign({}, prev), { [key]: value })));
45
+ }, []);
34
46
  // Check if form has been edited (changed from initial state)
35
47
  const isFormEdited = useMemo(() => {
36
48
  return Object.entries(values).some(([fieldId, fieldValue]) => {
@@ -158,14 +170,48 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
158
170
  .filter(doc => legal_accepted[doc.key])
159
171
  .map(doc => [doc.key, { hash: doc.hash }]))
160
172
  : undefined;
173
+ // Only send fields the app actually enabled, and only non-blank ones —
174
+ // mirrors the server-side re-validation in register.ts (never trust the
175
+ // client alone, but no point sending what the server would strip anyway).
176
+ const location_payload = {};
177
+ if ((locationFields === null || locationFields === void 0 ? void 0 : locationFields.country) && locationValues.country.trim()) {
178
+ location_payload.country = locationValues.country.trim();
179
+ }
180
+ if ((locationFields === null || locationFields === void 0 ? void 0 : locationFields.state_province) && locationValues.state_province.trim()) {
181
+ location_payload.state_province = locationValues.state_province.trim();
182
+ }
183
+ if ((locationFields === null || locationFields === void 0 ? void 0 : locationFields.suburb) && locationValues.suburb.trim()) {
184
+ location_payload.suburb = locationValues.suburb.trim();
185
+ }
186
+ const custom_fields_payload = {};
187
+ if (customFieldsSchema) {
188
+ for (const [key, propertySchema] of Object.entries(customFieldsSchema.properties)) {
189
+ const raw = customFieldValues[key];
190
+ if (raw === undefined || raw === "")
191
+ continue;
192
+ if (propertySchema.type === "number") {
193
+ const parsed = Number(raw);
194
+ if (!Number.isNaN(parsed))
195
+ custom_fields_payload[key] = parsed;
196
+ }
197
+ else if (propertySchema.type === "boolean") {
198
+ custom_fields_payload[key] = raw === "true";
199
+ }
200
+ else if (propertySchema.type === "string") {
201
+ custom_fields_payload[key] = raw;
202
+ }
203
+ // "object"-typed top-level properties aren't rendered at registration
204
+ // time (see UseRegisterFormParams.customFieldsSchema doc) — skipped.
205
+ }
206
+ }
161
207
  const response = await fetch(`${apiBasePath}/register`, {
162
208
  method: "POST",
163
209
  headers: {
164
210
  "Content-Type": "application/json",
165
211
  },
166
- body: JSON.stringify(Object.assign({ name: values[REGISTER_FIELD_IDS.NAME] || undefined, email: values[REGISTER_FIELD_IDS.EMAIL], password: values[REGISTER_FIELD_IDS.PASSWORD], url_on_logon: urlOnLogon }, (legal_accepted_payload && Object.keys(legal_accepted_payload).length > 0
212
+ body: JSON.stringify(Object.assign(Object.assign(Object.assign({ name: values[REGISTER_FIELD_IDS.NAME] || undefined, email: values[REGISTER_FIELD_IDS.EMAIL], password: values[REGISTER_FIELD_IDS.PASSWORD], url_on_logon: urlOnLogon }, (legal_accepted_payload && Object.keys(legal_accepted_payload).length > 0
167
213
  ? { legal_accepted: legal_accepted_payload }
168
- : {}))),
214
+ : {})), (Object.keys(location_payload).length > 0 ? { location: location_payload } : {})), (Object.keys(custom_fields_payload).length > 0 ? { custom_fields: custom_fields_payload } : {}))),
169
215
  });
170
216
  const data = await response.json();
171
217
  if (!response.ok) {
@@ -185,6 +231,8 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
185
231
  });
186
232
  setEmailTouched(false);
187
233
  set_legal_accepted({});
234
+ setLocationValues({ country: "", state_province: "", suburb: "" });
235
+ setCustomFieldValues({});
188
236
  }
189
237
  catch (error) {
190
238
  const errorMessage = error instanceof Error ? error.message : t("register.error.failed_retry_message");
@@ -200,7 +248,18 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
200
248
  finally {
201
249
  setIsSubmitting(false);
202
250
  }
203
- }, [values, passwordRequirements, dataClient, urlOnLogon, legalDocs, legal_accepted]);
251
+ }, [
252
+ values,
253
+ passwordRequirements,
254
+ dataClient,
255
+ urlOnLogon,
256
+ legalDocs,
257
+ legal_accepted,
258
+ locationFields,
259
+ locationValues,
260
+ customFieldsSchema,
261
+ customFieldValues,
262
+ ]);
204
263
  const handleCancel = useCallback(() => {
205
264
  const resetValues = buildInitialValues();
206
265
  setValues(resetValues);
@@ -211,6 +270,8 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
211
270
  });
212
271
  setEmailTouched(false);
213
272
  set_legal_accepted({});
273
+ setLocationValues({ country: "", state_province: "", suburb: "" });
274
+ setCustomFieldValues({});
214
275
  }, []);
215
276
  return {
216
277
  values,
@@ -226,5 +287,9 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
226
287
  handleCancel,
227
288
  legal_accepted,
228
289
  handleLegalAcceptedChange,
290
+ locationValues,
291
+ handleLocationFieldChange,
292
+ customFieldValues,
293
+ handleCustomFieldChange,
229
294
  };
230
295
  };
@@ -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;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wHAAwH;IACxH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wIAAwI;IACxI,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kCAAkC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,OAAO,GAAG,OAAO,IAAI;IACnD,6HAA6H;IAC7H,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IACrC,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,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;CACrC,CAAC;AAYF,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,GACtB,EAAE,mBAAmB,CAAC,OAAO,CAAC,+BA8R9B"}
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;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAGlF,MAAM,MAAM,iBAAi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c,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, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
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;IACjC,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,CA4E5C"}
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: (_b = data.permission_ok) !== null && _b !== void 0 ? _b : true,
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,
@@ -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;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE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":"","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;AA6SD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CA+NzB"}
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"}