hazo_auth 6.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/README.md +233 -8
  2. package/SETUP_CHECKLIST.md +240 -0
  3. package/cli-src/cli/validate.ts +4 -0
  4. package/cli-src/lib/auth/nextauth_config.ts +101 -1
  5. package/cli-src/lib/cookies_config.server.ts +1 -0
  6. package/cli-src/lib/email_verification_config.server.ts +0 -34
  7. package/cli-src/lib/forgot_password_config.server.ts +0 -34
  8. package/cli-src/lib/login_config.server.ts +14 -31
  9. package/cli-src/lib/my_settings_config.server.ts +0 -3
  10. package/cli-src/lib/oauth_config.server.ts +58 -0
  11. package/cli-src/lib/otp_config.server.ts +91 -0
  12. package/cli-src/lib/register_config.server.ts +11 -31
  13. package/cli-src/lib/reset_password_config.server.ts +0 -31
  14. package/cli-src/lib/services/email_service.ts +3 -1
  15. package/cli-src/lib/services/email_template_manifest.ts +17 -0
  16. package/cli-src/lib/services/email_templates/otp_signin_code.html +13 -0
  17. package/cli-src/lib/services/email_templates/otp_signin_code.txt +5 -0
  18. package/cli-src/lib/services/index.ts +8 -2
  19. package/cli-src/lib/services/oauth_service.ts +197 -0
  20. package/cli-src/lib/services/otp_service.ts +295 -0
  21. package/cli-src/lib/services/session_token_service.ts +4 -1
  22. package/config/hazo_auth_config.example.ini +76 -41
  23. package/dist/cli/validate.d.ts.map +1 -1
  24. package/dist/cli/validate.js +4 -0
  25. package/dist/client.d.ts +2 -0
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +1 -0
  28. package/dist/components/layouts/create_firm/index.d.ts +4 -8
  29. package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
  30. package/dist/components/layouts/create_firm/index.js +3 -3
  31. package/dist/components/layouts/email_verification/index.d.ts +4 -5
  32. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  33. package/dist/components/layouts/email_verification/index.js +4 -4
  34. package/dist/components/layouts/forgot_password/index.d.ts +4 -5
  35. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  36. package/dist/components/layouts/forgot_password/index.js +2 -2
  37. package/dist/components/layouts/login/index.d.ts +19 -9
  38. package/dist/components/layouts/login/index.d.ts.map +1 -1
  39. package/dist/components/layouts/login/index.js +12 -6
  40. package/dist/components/layouts/otp/index.d.ts +17 -0
  41. package/dist/components/layouts/otp/index.d.ts.map +1 -0
  42. package/dist/components/layouts/otp/index.js +16 -0
  43. package/dist/components/layouts/register/index.d.ts +11 -7
  44. package/dist/components/layouts/register/index.d.ts.map +1 -1
  45. package/dist/components/layouts/register/index.js +8 -4
  46. package/dist/components/layouts/reset_password/index.d.ts +4 -5
  47. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  48. package/dist/components/layouts/reset_password/index.js +5 -5
  49. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +3 -5
  50. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
  51. package/dist/components/layouts/shared/components/already_logged_in_guard.js +2 -2
  52. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts +25 -0
  53. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -0
  54. package/dist/components/layouts/shared/components/facebook_sign_in_button.js +49 -0
  55. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
  56. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +8 -3
  57. package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +3 -6
  58. package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
  59. package/dist/components/layouts/shared/components/two_column_auth_layout.js +8 -5
  60. package/dist/components/otp/OTPRequestForm.d.ts +11 -0
  61. package/dist/components/otp/OTPRequestForm.d.ts.map +1 -0
  62. package/dist/components/otp/OTPRequestForm.js +42 -0
  63. package/dist/components/otp/OTPVerifyForm.d.ts +16 -0
  64. package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -0
  65. package/dist/components/otp/OTPVerifyForm.js +75 -0
  66. package/dist/components/otp/index.d.ts +5 -0
  67. package/dist/components/otp/index.d.ts.map +1 -0
  68. package/dist/components/otp/index.js +2 -0
  69. package/dist/components/ui/input-otp.d.ts +35 -0
  70. package/dist/components/ui/input-otp.d.ts.map +1 -0
  71. package/dist/components/ui/input-otp.js +44 -0
  72. package/dist/consent/consent_state.d.ts +18 -0
  73. package/dist/consent/consent_state.d.ts.map +1 -0
  74. package/dist/consent/consent_state.js +29 -0
  75. package/dist/consent/cookie_consent_banner.d.ts +11 -0
  76. package/dist/consent/cookie_consent_banner.d.ts.map +1 -0
  77. package/dist/consent/cookie_consent_banner.js +40 -0
  78. package/dist/consent/gtm_mapping.d.ts +13 -0
  79. package/dist/consent/gtm_mapping.d.ts.map +1 -0
  80. package/dist/consent/gtm_mapping.js +30 -0
  81. package/dist/consent/index.d.ts +7 -0
  82. package/dist/consent/index.d.ts.map +1 -0
  83. package/dist/consent/index.js +7 -0
  84. package/dist/consent/manage_modal.d.ts +2 -0
  85. package/dist/consent/manage_modal.d.ts.map +1 -0
  86. package/dist/consent/manage_modal.js +33 -0
  87. package/dist/consent/read_consent.d.ts +15 -0
  88. package/dist/consent/read_consent.d.ts.map +1 -0
  89. package/dist/consent/read_consent.js +23 -0
  90. package/dist/consent/use_consent.d.ts +7 -0
  91. package/dist/consent/use_consent.d.ts.map +1 -0
  92. package/dist/consent/use_consent.js +55 -0
  93. package/dist/lib/auth/nextauth_config.d.ts +10 -0
  94. package/dist/lib/auth/nextauth_config.d.ts.map +1 -1
  95. package/dist/lib/auth/nextauth_config.js +80 -2
  96. package/dist/lib/cookies_config.server.d.ts +1 -0
  97. package/dist/lib/cookies_config.server.d.ts.map +1 -1
  98. package/dist/lib/cookies_config.server.js +1 -0
  99. package/dist/lib/email_verification_config.server.d.ts +0 -3
  100. package/dist/lib/email_verification_config.server.d.ts.map +1 -1
  101. package/dist/lib/email_verification_config.server.js +0 -15
  102. package/dist/lib/forgot_password_config.server.d.ts +0 -3
  103. package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
  104. package/dist/lib/forgot_password_config.server.js +0 -15
  105. package/dist/lib/login_config.server.d.ts +6 -3
  106. package/dist/lib/login_config.server.d.ts.map +1 -1
  107. package/dist/lib/login_config.server.js +7 -13
  108. package/dist/lib/my_settings_config.server.d.ts +0 -1
  109. package/dist/lib/my_settings_config.server.d.ts.map +1 -1
  110. package/dist/lib/my_settings_config.server.js +0 -2
  111. package/dist/lib/oauth_config.server.d.ts +17 -0
  112. package/dist/lib/oauth_config.server.d.ts.map +1 -1
  113. package/dist/lib/oauth_config.server.js +25 -0
  114. package/dist/lib/otp_config.server.d.ts +49 -0
  115. package/dist/lib/otp_config.server.d.ts.map +1 -0
  116. package/dist/lib/otp_config.server.js +48 -0
  117. package/dist/lib/register_config.server.d.ts +2 -3
  118. package/dist/lib/register_config.server.d.ts.map +1 -1
  119. package/dist/lib/register_config.server.js +4 -13
  120. package/dist/lib/reset_password_config.server.d.ts +0 -3
  121. package/dist/lib/reset_password_config.server.d.ts.map +1 -1
  122. package/dist/lib/reset_password_config.server.js +0 -13
  123. package/dist/lib/services/email_service.d.ts +1 -1
  124. package/dist/lib/services/email_service.d.ts.map +1 -1
  125. package/dist/lib/services/email_service.js +2 -0
  126. package/dist/lib/services/email_template_manifest.d.ts.map +1 -1
  127. package/dist/lib/services/email_template_manifest.js +17 -0
  128. package/dist/lib/services/email_templates/otp_signin_code.html +13 -0
  129. package/dist/lib/services/email_templates/otp_signin_code.txt +5 -0
  130. package/dist/lib/services/index.d.ts +2 -0
  131. package/dist/lib/services/index.d.ts.map +1 -1
  132. package/dist/lib/services/index.js +1 -0
  133. package/dist/lib/services/oauth_service.d.ts +24 -0
  134. package/dist/lib/services/oauth_service.d.ts.map +1 -1
  135. package/dist/lib/services/oauth_service.js +155 -0
  136. package/dist/lib/services/otp_service.d.ts +46 -0
  137. package/dist/lib/services/otp_service.d.ts.map +1 -0
  138. package/dist/lib/services/otp_service.js +238 -0
  139. package/dist/lib/services/session_token_service.d.ts +3 -1
  140. package/dist/lib/services/session_token_service.d.ts.map +1 -1
  141. package/dist/lib/services/session_token_service.js +4 -2
  142. package/dist/page_components/create_firm.d.ts +13 -1
  143. package/dist/page_components/create_firm.d.ts.map +1 -1
  144. package/dist/page_components/create_firm.js +10 -6
  145. package/dist/page_components/forgot_password.d.ts +1 -4
  146. package/dist/page_components/forgot_password.d.ts.map +1 -1
  147. package/dist/page_components/forgot_password.js +2 -6
  148. package/dist/page_components/login.d.ts +1 -4
  149. package/dist/page_components/login.d.ts.map +1 -1
  150. package/dist/page_components/login.js +2 -6
  151. package/dist/page_components/otp.d.ts +4 -0
  152. package/dist/page_components/otp.d.ts.map +1 -0
  153. package/dist/page_components/otp.js +5 -0
  154. package/dist/page_components/register.d.ts +1 -4
  155. package/dist/page_components/register.d.ts.map +1 -1
  156. package/dist/page_components/register.js +2 -6
  157. package/dist/page_components/reset_password.d.ts +1 -4
  158. package/dist/page_components/reset_password.d.ts.map +1 -1
  159. package/dist/page_components/reset_password.js +2 -6
  160. package/dist/page_components/verify_email.d.ts +1 -4
  161. package/dist/page_components/verify_email.d.ts.map +1 -1
  162. package/dist/page_components/verify_email.js +2 -6
  163. package/dist/server/routes/index.d.ts +3 -0
  164. package/dist/server/routes/index.d.ts.map +1 -1
  165. package/dist/server/routes/index.js +4 -0
  166. package/dist/server/routes/me.d.ts.map +1 -1
  167. package/dist/server/routes/me.js +43 -1
  168. package/dist/server/routes/oauth_facebook_callback.d.ts +8 -0
  169. package/dist/server/routes/oauth_facebook_callback.d.ts.map +1 -0
  170. package/dist/server/routes/oauth_facebook_callback.js +157 -0
  171. package/dist/server/routes/oauth_google_callback.js +1 -1
  172. package/dist/server/routes/otp/request.d.ts +3 -0
  173. package/dist/server/routes/otp/request.d.ts.map +1 -0
  174. package/dist/server/routes/otp/request.js +33 -0
  175. package/dist/server/routes/otp/verify.d.ts +3 -0
  176. package/dist/server/routes/otp/verify.d.ts.map +1 -0
  177. package/dist/server/routes/otp/verify.js +58 -0
  178. package/dist/server-lib.d.ts +3 -0
  179. package/dist/server-lib.d.ts.map +1 -1
  180. package/dist/server-lib.js +2 -0
  181. package/dist/server_pages/forgot_password.d.ts +13 -17
  182. package/dist/server_pages/forgot_password.d.ts.map +1 -1
  183. package/dist/server_pages/forgot_password.js +12 -8
  184. package/dist/server_pages/forgot_password_client_wrapper.d.ts +7 -6
  185. package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
  186. package/dist/server_pages/forgot_password_client_wrapper.js +2 -2
  187. package/dist/server_pages/login.d.ts +22 -21
  188. package/dist/server_pages/login.d.ts.map +1 -1
  189. package/dist/server_pages/login.js +15 -19
  190. package/dist/server_pages/login_client_wrapper.d.ts +10 -6
  191. package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
  192. package/dist/server_pages/login_client_wrapper.js +2 -2
  193. package/dist/server_pages/my_settings.d.ts +2 -0
  194. package/dist/server_pages/my_settings.d.ts.map +1 -1
  195. package/dist/server_pages/my_settings.js +8 -2
  196. package/dist/server_pages/otp.d.ts +56 -0
  197. package/dist/server_pages/otp.d.ts.map +1 -0
  198. package/dist/server_pages/otp.js +45 -0
  199. package/dist/server_pages/register.d.ts +19 -16
  200. package/dist/server_pages/register.d.ts.map +1 -1
  201. package/dist/server_pages/register.js +15 -12
  202. package/dist/server_pages/register_client_wrapper.d.ts +10 -6
  203. package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
  204. package/dist/server_pages/register_client_wrapper.js +2 -2
  205. package/dist/server_pages/reset_password.d.ts +11 -16
  206. package/dist/server_pages/reset_password.d.ts.map +1 -1
  207. package/dist/server_pages/reset_password.js +11 -9
  208. package/dist/server_pages/reset_password_client_wrapper.d.ts +7 -6
  209. package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
  210. package/dist/server_pages/reset_password_client_wrapper.js +2 -2
  211. package/dist/server_pages/verify_email.d.ts +11 -17
  212. package/dist/server_pages/verify_email.d.ts.map +1 -1
  213. package/dist/server_pages/verify_email.js +11 -8
  214. package/dist/server_pages/verify_email_client_wrapper.d.ts +7 -6
  215. package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
  216. package/dist/server_pages/verify_email_client_wrapper.js +2 -2
  217. package/dist/strings/default_strings.d.ts +47 -0
  218. package/dist/strings/default_strings.d.ts.map +1 -0
  219. package/dist/strings/default_strings.js +18 -0
  220. package/dist/strings/index.d.ts +4 -0
  221. package/dist/strings/index.d.ts.map +1 -0
  222. package/dist/strings/index.js +3 -0
  223. package/dist/strings/strings_context.d.ts +12 -0
  224. package/dist/strings/strings_context.d.ts.map +1 -0
  225. package/dist/strings/strings_context.js +23 -0
  226. package/dist/strings/strings_provider.d.ts +26 -0
  227. package/dist/strings/strings_provider.d.ts.map +1 -0
  228. package/dist/strings/strings_provider.js +45 -0
  229. package/dist/theme/create_theme.d.ts +7 -0
  230. package/dist/theme/create_theme.d.ts.map +1 -0
  231. package/dist/theme/create_theme.js +97 -0
  232. package/dist/theme/hex_to_hsl.d.ts +16 -0
  233. package/dist/theme/hex_to_hsl.d.ts.map +1 -0
  234. package/dist/theme/hex_to_hsl.js +110 -0
  235. package/dist/theme/index.d.ts +4 -0
  236. package/dist/theme/index.d.ts.map +1 -0
  237. package/dist/theme/index.js +3 -0
  238. package/dist/theme/luminance.d.ts +11 -0
  239. package/dist/theme/luminance.d.ts.map +1 -0
  240. package/dist/theme/luminance.js +45 -0
  241. package/dist/theme/theme_provider.d.ts +14 -0
  242. package/dist/theme/theme_provider.d.ts.map +1 -0
  243. package/dist/theme/theme_provider.js +23 -0
  244. package/dist/theme/theme_types.d.ts +36 -0
  245. package/dist/theme/theme_types.d.ts.map +1 -0
  246. package/dist/theme/theme_types.js +1 -0
  247. package/dist/themes/index.d.ts +3 -0
  248. package/dist/themes/index.d.ts.map +1 -0
  249. package/dist/themes/index.js +2 -0
  250. package/dist/themes/preset_indigo_sunset.d.ts +3 -0
  251. package/dist/themes/preset_indigo_sunset.d.ts.map +1 -0
  252. package/dist/themes/preset_indigo_sunset.js +20 -0
  253. package/dist/themes/preset_neutral.d.ts +3 -0
  254. package/dist/themes/preset_neutral.d.ts.map +1 -0
  255. package/dist/themes/preset_neutral.js +14 -0
  256. package/package.json +36 -2
@@ -0,0 +1,58 @@
1
+ // file_description: API route handler for OTP verify (validates code and issues session cookies)
2
+ // section: imports
3
+ import { NextResponse } from "next/server";
4
+ import { z } from "zod";
5
+ import { verify_email_otp } from "../../../lib/services/otp_service.js";
6
+ import { hazo_auth_otp_session_ttl_seconds } from "../../../lib/otp_config.server.js";
7
+ import { get_cookie_name, get_cookie_options, BASE_COOKIE_NAMES, } from "../../../lib/cookies_config.server.js";
8
+ import { get_client_ip } from "../../../lib/auth/hazo_get_auth.server.js";
9
+ import { create_app_logger } from "../../../lib/app_logger.js";
10
+ // section: validation
11
+ const VerifySchema = z.object({
12
+ email: z.string().email().max(254),
13
+ code: z.string().regex(/^\d{6}$/),
14
+ });
15
+ // section: api_handler
16
+ export async function otpVerifyPOST(request) {
17
+ const logger = create_app_logger();
18
+ try {
19
+ const body_raw = await request.json().catch(() => ({}));
20
+ const parsed = VerifySchema.safeParse(body_raw);
21
+ if (!parsed.success) {
22
+ return NextResponse.json({ ok: false, error: "invalid_or_expired" }, { status: 400 });
23
+ }
24
+ const ip = get_client_ip(request);
25
+ const result = await verify_email_otp({
26
+ email: parsed.data.email,
27
+ code: parsed.data.code,
28
+ ip,
29
+ });
30
+ if (result.ok === false) {
31
+ return NextResponse.json({ ok: false, error: "invalid_or_expired" }, { status: 400 });
32
+ }
33
+ const ttl_seconds = hazo_auth_otp_session_ttl_seconds();
34
+ const base_cookie_options = {
35
+ httpOnly: true,
36
+ secure: process.env.NODE_ENV === "production",
37
+ sameSite: "lax",
38
+ path: "/",
39
+ maxAge: ttl_seconds,
40
+ };
41
+ const cookie_options = get_cookie_options(base_cookie_options);
42
+ const response = NextResponse.json({
43
+ ok: true,
44
+ user_id: result.user_id,
45
+ email: result.email,
46
+ });
47
+ response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.SESSION), result.session_token, cookie_options);
48
+ response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.USER_ID), result.user_id, cookie_options);
49
+ response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.USER_EMAIL), result.email, cookie_options);
50
+ response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.SESSION_KIND), "otp", cookie_options);
51
+ return response;
52
+ }
53
+ catch (err) {
54
+ const msg = err instanceof Error ? err.message : String(err);
55
+ logger.error("otp_verify_route_error", { error: msg });
56
+ return NextResponse.json({ ok: false, error: "invalid_or_expired" }, { status: 400 });
57
+ }
58
+ }
@@ -24,6 +24,9 @@ export { get_oauth_config, is_google_oauth_enabled, is_email_password_enabled, }
24
24
  export type { OAuthConfig } from "./lib/oauth_config.server";
25
25
  export { get_branding_config, is_branding_enabled, is_allowed_logo_format, get_max_logo_size_bytes, } from "./lib/branding_config.server.js";
26
26
  export type { FirmBrandingConfig } from "./lib/branding_config.server";
27
+ export { get_otp_config, hazo_auth_otp_session_ttl_seconds, OTP_CONFIG_DEFAULTS } from "./lib/otp_config.server.js";
28
+ export type { OtpConfig } from "./lib/otp_config.server";
29
+ export { request_email_otp, verify_email_otp } from "./lib/services/otp_service.js";
27
30
  export { create_sqlite_hazo_connect } from "./lib/hazo_connect_setup.js";
28
31
  export { get_hazo_connect_instance } from "./lib/hazo_connect_instance.server.js";
29
32
  export { create_app_logger } from "./lib/app_logger.js";
@@ -1 +1 @@
1
- {"version":3,"file":"server-lib.d.ts","sourceRoot":"","sources":["../src/server-lib.ts"],"names":[],"mappings":"AAYA,OAAO,aAAa,CAAC;AAGrB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAGrF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"server-lib.d.ts","sourceRoot":"","sources":["../src/server-lib.ts"],"names":[],"mappings":"AAYA,OAAO,aAAa,CAAC;AAGrB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAGrF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACjH,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,cAAc,+BAA+B,CAAC"}
@@ -37,6 +37,8 @@ export { get_user_fields_config } from "./lib/user_fields_config.server.js";
37
37
  export { get_file_types_config } from "./lib/file_types_config.server.js";
38
38
  export { get_oauth_config, is_google_oauth_enabled, is_email_password_enabled, } from "./lib/oauth_config.server.js";
39
39
  export { get_branding_config, is_branding_enabled, is_allowed_logo_format, get_max_logo_size_bytes, } from "./lib/branding_config.server.js";
40
+ export { get_otp_config, hazo_auth_otp_session_ttl_seconds, OTP_CONFIG_DEFAULTS } from "./lib/otp_config.server.js";
41
+ export { request_email_otp, verify_email_otp } from "./lib/services/otp_service.js";
40
42
  // section: hazo_connect_exports
41
43
  export { create_sqlite_hazo_connect } from "./lib/hazo_connect_setup.js";
42
44
  export { get_hazo_connect_instance } from "./lib/hazo_connect_instance.server.js";
@@ -1,21 +1,5 @@
1
1
  import "server-only";
2
- import type { StaticImageData } from "next/image";
3
2
  export type ForgotPasswordPageProps = {
4
- /**
5
- * Optional image source for the visual panel
6
- * Defaults from hazo_auth_config.ini or package default image
7
- */
8
- image_src?: string | StaticImageData;
9
- /**
10
- * Optional image alt text
11
- * Defaults to "Password recovery illustration"
12
- */
13
- image_alt?: string;
14
- /**
15
- * Optional image background color
16
- * Defaults to "#f1f5f9"
17
- */
18
- image_background_color?: string;
19
3
  /**
20
4
  * Optional sign in path
21
5
  * Defaults from DEFAULT_FORGOT_PASSWORD.loginPath
@@ -26,6 +10,18 @@ export type ForgotPasswordPageProps = {
26
10
  * Defaults from DEFAULT_FORGOT_PASSWORD.loginLabel
27
11
  */
28
12
  sign_in_label?: string;
13
+ /**
14
+ * Optional theme that controls visual appearance and layout mode.
15
+ * When `theme.layout` is `"split"`, activates the two-column split layout
16
+ * with the brand panel on the left.
17
+ */
18
+ theme?: import("../theme/theme_types").HazoAuthTheme;
19
+ /** Override the page heading. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
20
+ title?: string;
21
+ /** Override the page subtitle. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
22
+ subtitle?: string;
23
+ /** Override the submit button label. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
24
+ ctaText?: string;
29
25
  };
30
26
  /**
31
27
  * Zero-config ForgotPasswordPage server component
@@ -47,7 +43,7 @@ export type ForgotPasswordPageProps = {
47
43
  *
48
44
  * Zero configuration required - works out of the box!
49
45
  *
50
- * @param props - Optional visual and navigation customization props
46
+ * @param props - Optional navigation customization props
51
47
  * @returns Server-rendered forgot password page
52
48
  */
53
49
  export default function ForgotPasswordPage(props: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAiCxE;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAUrB,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,aAAa,CAAC;IACrD,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAoCxE;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -7,6 +7,7 @@ import { get_forgot_password_config } from "../lib/forgot_password_config.server
7
7
  import { ForgotPasswordClientWrapper } from "./forgot_password_client_wrapper.js";
8
8
  import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
9
9
  import { DEFAULT_FORGOT_PASSWORD } from "../lib/config/default_config.js";
10
+ import { DEFAULT_STRINGS, readStrings } from "../strings.js";
10
11
  // section: component
11
12
  /**
12
13
  * Zero-config ForgotPasswordPage server component
@@ -28,19 +29,22 @@ import { DEFAULT_FORGOT_PASSWORD } from "../lib/config/default_config.js";
28
29
  *
29
30
  * Zero configuration required - works out of the box!
30
31
  *
31
- * @param props - Optional visual and navigation customization props
32
+ * @param props - Optional navigation customization props
32
33
  * @returns Server-rendered forgot password page
33
34
  */
34
35
  export default function ForgotPasswordPage(props) {
35
- const { image_src, image_alt, image_background_color, sign_in_path = DEFAULT_FORGOT_PASSWORD.loginPath, sign_in_label = DEFAULT_FORGOT_PASSWORD.loginLabel, } = props !== null && props !== void 0 ? props : {};
36
- // Load configuration from INI file (with defaults including asset images)
36
+ var _a, _b, _c;
37
+ const { sign_in_path = DEFAULT_FORGOT_PASSWORD.loginPath, sign_in_label = DEFAULT_FORGOT_PASSWORD.loginLabel, theme, title, subtitle, ctaText, } = props !== null && props !== void 0 ? props : {};
38
+ // Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
39
+ const strings = readStrings();
40
+ const fp_strings = strings.forgot_password;
41
+ const resolved_title = (_a = title !== null && title !== void 0 ? title : fp_strings.title) !== null && _a !== void 0 ? _a : DEFAULT_STRINGS.forgot_password.title;
42
+ const resolved_subtitle = (_b = subtitle !== null && subtitle !== void 0 ? subtitle : fp_strings.subtitle) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.forgot_password.subtitle;
43
+ const resolved_cta = (_c = ctaText !== null && ctaText !== void 0 ? ctaText : fp_strings.ctaText) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.forgot_password.ctaText;
44
+ // Load configuration from INI file (with defaults)
37
45
  const config = get_forgot_password_config();
38
- // Use props if provided, otherwise fall back to config (which includes default asset image)
39
- const finalImageSrc = image_src || config.imageSrc;
40
- const finalImageAlt = image_alt || config.imageAlt;
41
- const finalImageBackgroundColor = image_background_color || config.imageBackgroundColor;
42
46
  // Pass serializable config to client wrapper, wrapped in AuthPageShell for navbar support
43
- return (_jsx(AuthPageShell, { children: _jsx(ForgotPasswordClientWrapper, { image_src: finalImageSrc, image_alt: finalImageAlt, image_background_color: finalImageBackgroundColor, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath }) }));
47
+ return (_jsx(AuthPageShell, { children: _jsx(ForgotPasswordClientWrapper, { sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, theme: theme, labels: { heading: resolved_title, subHeading: resolved_subtitle, submitButton: resolved_cta } }) }));
44
48
  }
45
49
  // Named export for direct imports
46
50
  export { ForgotPasswordPage };
@@ -1,15 +1,16 @@
1
1
  import type { ForgotPasswordConfig } from "../lib/forgot_password_config.server";
2
- import type { StaticImageData } from "next/image";
3
- export type ForgotPasswordClientWrapperProps = Omit<ForgotPasswordConfig, 'imageSrc' | 'imageAlt' | 'imageBackgroundColor'> & {
4
- image_src: string | StaticImageData;
5
- image_alt: string;
6
- image_background_color: string;
2
+ import type { HazoAuthTheme } from "../theme/theme_types";
3
+ export type ForgotPasswordClientWrapperProps = ForgotPasswordConfig & {
7
4
  sign_in_path: string;
8
5
  sign_in_label: string;
6
+ /** Optional theme passed through to ForgotPasswordLayout → TwoColumnAuthLayout. */
7
+ theme?: HazoAuthTheme;
8
+ /** Optional label overrides (heading, subHeading, submitButton) */
9
+ labels?: import("../components/layouts/shared/config/layout_customization").LayoutLabelOverrides;
9
10
  };
10
11
  /**
11
12
  * Client wrapper for ForgotPasswordLayout
12
13
  * Initializes hazo_connect data client on client side and passes config from server
13
14
  */
14
- export declare function ForgotPasswordClientWrapper({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, }: ForgotPasswordClientWrapperProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ForgotPasswordClientWrapper({ sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, theme, labels, }: ForgotPasswordClientWrapperProps): import("react/jsx-runtime").JSX.Element;
15
16
  //# sourceMappingURL=forgot_password_client_wrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forgot_password_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password_client_wrapper.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAGjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,UAAU,GAAG,sBAAsB,CAAC,GAAG;IAC5H,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAGF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,EAAE,gCAAgC,2CAmClC"}
1
+ {"version":3,"file":"forgot_password_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password_client_wrapper.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,GAAG;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,0DAA0D,EAAE,oBAAoB,CAAC;CAClG,CAAC;AAGF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,KAAK,EACL,MAAM,GACP,EAAE,gCAAgC,2CAkClC"}
@@ -11,7 +11,7 @@ import { create_sqlite_hazo_connect } from "../lib/hazo_connect_setup.js";
11
11
  * Client wrapper for ForgotPasswordLayout
12
12
  * Initializes hazo_connect data client on client side and passes config from server
13
13
  */
14
- export function ForgotPasswordClientWrapper({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, }) {
14
+ export function ForgotPasswordClientWrapper({ sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, theme, labels, }) {
15
15
  const [dataClient, setDataClient] = useState(null);
16
16
  useEffect(() => {
17
17
  // Initialize hazo_connect on client side
@@ -23,5 +23,5 @@ export function ForgotPasswordClientWrapper({ image_src, image_alt, image_backgr
23
23
  if (!dataClient) {
24
24
  return (_jsx("div", { className: "cls_forgot_password_page_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "text-slate-600 animate-pulse", children: "Loading..." }) }));
25
25
  }
26
- return (_jsx(ForgotPasswordLayout, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, data_client: dataClient, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath }));
26
+ return (_jsx(ForgotPasswordLayout, { data_client: dataClient, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, theme: theme, labels: labels }));
27
27
  }
@@ -1,33 +1,34 @@
1
1
  import "server-only";
2
- import type { StaticImageData } from "next/image";
2
+ import type React from "react";
3
3
  export type LoginPageProps = {
4
- /**
5
- * Optional image source for the visual panel
6
- * Defaults from hazo_auth_config.ini or package default image
7
- */
8
- image_src?: string | StaticImageData;
9
- /**
10
- * Optional image alt text
11
- * Defaults to "Secure login illustration"
12
- */
13
- image_alt?: string;
14
- /**
15
- * Optional image background color
16
- * Defaults to "#f1f5f9"
17
- */
18
- image_background_color?: string;
19
4
  /**
20
5
  * Layout mode (default: `"two_column"`).
21
6
  * - `"two_column"` — full server-rendered page with the package's
22
- * TwoColumnAuthLayout (image on the left, form on the right) wrapped in
23
- * the standalone AuthPageShell. Backwards-compatible.
7
+ * TwoColumnAuthLayout wrapped in the standalone AuthPageShell.
8
+ * Layout appearance is now controlled by the theme (split or centered).
24
9
  * - `"form_only"` — emits just the form content (no AuthPageShell, no
25
10
  * TwoColumnAuthLayout). Use when wrapping the form in your own brand
26
- * chrome (e.g. a custom split-panel layout or an existing app shell).
27
- * `image_src` / `image_alt` / `image_background_color` are ignored in
28
- * this mode.
11
+ * chrome.
29
12
  */
30
13
  layout?: "two_column" | "form_only";
14
+ /**
15
+ * Optional theme that controls visual appearance and layout mode.
16
+ * When `theme.layout` is `"split"`, activates the two-column split layout
17
+ * with the brand panel on the left.
18
+ */
19
+ theme?: import("../theme/theme_types").HazoAuthTheme;
20
+ /** Override the page heading. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
21
+ title?: string;
22
+ /** Override the page subtitle. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
23
+ subtitle?: string;
24
+ /** Override the submit button label. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
25
+ ctaText?: string;
26
+ /**
27
+ * Optional legal text rendered below the form.
28
+ * Accepts a string or JSX (e.g. `<a href="/tos">Terms of Service</a>`).
29
+ * Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
30
+ */
31
+ legalText?: React.ReactNode;
31
32
  };
32
33
  /**
33
34
  * Zero-config LoginPage server component
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/server_pages/login.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAiEtD;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/server_pages/login.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,aAAa,CAAC;IACrD,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkEtD;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -2,12 +2,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  // file_description: Zero-config LoginPage server component - drop in and use with no configuration required
3
3
  // section: server-only-guard
4
4
  import "server-only";
5
- // section: imports
6
5
  import { get_login_config } from "../lib/login_config.server.js";
7
6
  import { get_navbar_config } from "../lib/navbar_config.server.js";
8
7
  import { LoginClientWrapper } from "./login_client_wrapper.js";
9
8
  import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
10
9
  import { FloatingHomeLink } from "../components/layouts/shared/components/floating_home_link.js";
10
+ import { DEFAULT_STRINGS, readStrings } from "../strings.js";
11
11
  // section: component
12
12
  /**
13
13
  * Zero-config LoginPage server component
@@ -33,29 +33,25 @@ import { FloatingHomeLink } from "../components/layouts/shared/components/floati
33
33
  * @returns Server-rendered login page
34
34
  */
35
35
  export default function LoginPage(props) {
36
- const { image_src, image_alt, image_background_color, layout = "two_column", } = props !== null && props !== void 0 ? props : {};
37
- // Load configuration from INI file (with defaults including asset images)
36
+ var _a, _b, _c;
37
+ const { layout = "two_column", theme, title, subtitle, ctaText, legalText, } = props !== null && props !== void 0 ? props : {};
38
+ // Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
39
+ const strings = readStrings();
40
+ const login_strings = strings.login;
41
+ const resolved_title = (_a = title !== null && title !== void 0 ? title : login_strings.title) !== null && _a !== void 0 ? _a : DEFAULT_STRINGS.login.title;
42
+ const resolved_subtitle = (_b = subtitle !== null && subtitle !== void 0 ? subtitle : login_strings.subtitle) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.login.subtitle;
43
+ const resolved_cta = (_c = ctaText !== null && ctaText !== void 0 ? ctaText : login_strings.ctaText) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.login.ctaText;
44
+ const resolved_legal = legalText !== undefined ? legalText : (login_strings.legalText || undefined);
45
+ // Load configuration from INI file (with defaults)
38
46
  const config = get_login_config();
39
- // Use props if provided, otherwise fall back to config (which includes default asset image)
40
- const finalImageSrc = image_src || config.imageSrc;
41
- const finalImageAlt = image_alt || config.imageAlt;
42
- const finalImageBackgroundColor = image_background_color || config.imageBackgroundColor;
43
- const wrapper = (_jsx(LoginClientWrapper, { image_src: finalImageSrc, image_alt: finalImageAlt, image_background_color: finalImageBackgroundColor, redirectRoute: config.redirectRoute, successMessage: config.successMessage, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, forgotPasswordPath: config.forgotPasswordPath, forgotPasswordLabel: config.forgotPasswordLabel, createAccountPath: config.createAccountPath, createAccountLabel: config.createAccountLabel, showCreateAccountLink: config.showCreateAccountLink, oauth: {
47
+ const wrapper = (_jsx(LoginClientWrapper, { redirectRoute: config.redirectRoute, successMessage: config.successMessage, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, forgotPasswordPath: config.forgotPasswordPath, forgotPasswordLabel: config.forgotPasswordLabel, createAccountPath: config.createAccountPath, createAccountLabel: config.createAccountLabel, showCreateAccountLink: config.showCreateAccountLink, oauth: {
44
48
  enable_google: config.oauth.enable_google,
45
49
  enable_email_password: config.oauth.enable_email_password,
46
50
  google_button_text: config.oauth.google_button_text,
47
51
  oauth_divider_text: config.oauth.oauth_divider_text,
48
- }, layout: layout }));
49
- // form_only mode: skip AuthPageShell so the consumer's own page chrome
50
- // (e.g. a split-panel AuthLayout) hosts the form without our standalone
51
- // wrapper interfering. Two-column mode keeps the existing AuthPageShell
52
- // wrap for navbar/centering support.
53
- //
54
- // The navbar config's home_link is also surfaced here in form_only mode
55
- // so users mid-auth-flow always have a way out — without this, the only
56
- // exit is the browser back button. Rendered as a fixed-position "Back to
57
- // home" pill (top-left). Disabled by setting `[hazo_auth__navbar]
58
- // show_home_link = false` or by hiding it CSS-side at the consumer.
52
+ enable_facebook: config.oauth.enable_facebook,
53
+ facebook_button_text: config.oauth.facebook_button_text,
54
+ }, otpSigninEnabled: config.otpSigninEnabled, otpSigninLabel: config.otpSigninLabel, otpSigninHref: config.otpSigninHref, layout: layout, theme: theme, labels: { heading: resolved_title, subHeading: resolved_subtitle, submitButton: resolved_cta }, legalText: resolved_legal }));
59
55
  if (layout === "form_only") {
60
56
  const navbar = get_navbar_config();
61
57
  return (_jsxs(_Fragment, { children: [navbar.show_home_link && (_jsx(FloatingHomeLink, { path: navbar.home_path, label: navbar.home_label })), wrapper] }));
@@ -1,20 +1,24 @@
1
+ import React from "react";
1
2
  import type { LoginConfig } from "../lib/login_config.server";
2
3
  import type { OAuthLayoutConfig } from "../components/layouts/login/index";
3
- import type { StaticImageData } from "next/image";
4
- export type LoginClientWrapperProps = Omit<LoginConfig, 'imageSrc' | 'imageAlt' | 'imageBackgroundColor' | 'oauth' | 'showCreateAccountLink'> & {
5
- image_src?: string | StaticImageData;
6
- image_alt?: string;
7
- image_background_color?: string;
4
+ import type { HazoAuthTheme } from "../theme/theme_types";
5
+ export type LoginClientWrapperProps = Omit<LoginConfig, 'oauth' | 'showCreateAccountLink'> & {
8
6
  /** Show/hide "Create account" link (default: true) */
9
7
  showCreateAccountLink?: boolean;
10
8
  /** OAuth configuration */
11
9
  oauth?: OAuthLayoutConfig;
12
10
  /** Layout mode — see LoginLayoutProps.layout. Default `"two_column"`. */
13
11
  layout?: "two_column" | "form_only";
12
+ /** Optional theme passed through to LoginLayout → TwoColumnAuthLayout. */
13
+ theme?: HazoAuthTheme;
14
+ /** Optional label overrides (heading, subHeading, submitButton) */
15
+ labels?: import("../components/layouts/shared/config/layout_customization").LayoutLabelOverrides;
16
+ /** Optional legal text rendered below the form (accepts ReactNode for links/JSX) */
17
+ legalText?: React.ReactNode;
14
18
  };
15
19
  /**
16
20
  * Client wrapper for LoginLayout
17
21
  * Initializes hazo_connect data client on client side and passes config from server
18
22
  */
19
- export declare function LoginClientWrapper({ image_src, image_alt, image_background_color, redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, showCreateAccountLink, oauth, layout, }: LoginClientWrapperProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function LoginClientWrapper({ redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, showCreateAccountLink, oauth, otpSigninEnabled, otpSigninLabel, otpSigninHref, layout, theme, labels, legalText, }: LoginClientWrapperProps): import("react/jsx-runtime").JSX.Element;
20
24
  //# sourceMappingURL=login_client_wrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"login_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/login_client_wrapper.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,sBAAsB,GAAG,OAAO,GAAG,uBAAuB,CAAC,GAAG;IAC9I,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sDAAsD;IACtD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,yEAAyE;IACzE,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAGF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAA4B,EAC5B,KAAK,EACL,MAAqB,GACtB,EAAE,uBAAuB,2CA0CzB"}
1
+ {"version":3,"file":"login_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/login_client_wrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,uBAAuB,CAAC,GAAG;IAC3F,sDAAsD;IACtD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,yEAAyE;IACzE,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,0DAA0D,EAAE,oBAAoB,CAAC;IACjG,oFAAoF;IACpF,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAGF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAA4B,EAC5B,KAAK,EACL,gBAAwB,EACxB,cAA0C,EAC1C,aAAgC,EAChC,MAAqB,EACrB,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,uBAAuB,2CA6CzB"}
@@ -11,7 +11,7 @@ import { create_sqlite_hazo_connect } from "../lib/hazo_connect_setup.js";
11
11
  * Client wrapper for LoginLayout
12
12
  * Initializes hazo_connect data client on client side and passes config from server
13
13
  */
14
- export function LoginClientWrapper({ image_src, image_alt, image_background_color, redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, showCreateAccountLink = true, oauth, layout = "two_column", }) {
14
+ export function LoginClientWrapper({ redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, showCreateAccountLink = true, oauth, otpSigninEnabled = false, otpSigninLabel = "Sign in with email code", otpSigninHref = "/hazo_auth/otp", layout = "two_column", theme, labels, legalText, }) {
15
15
  const [dataClient, setDataClient] = useState(null);
16
16
  useEffect(() => {
17
17
  // Initialize hazo_connect on client side
@@ -23,5 +23,5 @@ export function LoginClientWrapper({ image_src, image_alt, image_background_colo
23
23
  if (!dataClient) {
24
24
  return (_jsx("div", { className: "cls_login_page_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "text-slate-600 animate-pulse", children: "Loading..." }) }));
25
25
  }
26
- return (_jsx(LoginLayout, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, data_client: dataClient, redirectRoute: redirectRoute, successMessage: successMessage, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, forgot_password_path: forgotPasswordPath, forgot_password_label: forgotPasswordLabel, create_account_path: createAccountPath, create_account_label: createAccountLabel, show_create_account_link: showCreateAccountLink, oauth: oauth, layout: layout }));
26
+ return (_jsx(LoginLayout, { data_client: dataClient, redirectRoute: redirectRoute, successMessage: successMessage, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, forgot_password_path: forgotPasswordPath, forgot_password_label: forgotPasswordLabel, create_account_path: createAccountPath, create_account_label: createAccountLabel, show_create_account_link: showCreateAccountLink, oauth: oauth, otp_signin_enabled: otpSigninEnabled, otp_signin_label: otpSigninLabel, otp_signin_href: otpSigninHref, layout: layout, theme: theme, labels: labels, legalText: legalText }));
27
27
  }
@@ -4,6 +4,8 @@ export type MySettingsPageProps = {
4
4
  * Optional className for custom styling
5
5
  */
6
6
  className?: string;
7
+ /** Override the page heading. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
8
+ title?: string;
7
9
  };
8
10
  /**
9
11
  * Zero-config MySettingsPage server component
@@ -1 +1 @@
1
- {"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAiChE;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAuChE;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -6,6 +6,7 @@ import "server-only";
6
6
  import { get_my_settings_config } from "../lib/my_settings_config.server.js";
7
7
  import MySettingsLayout from "../components/layouts/my_settings/index.js";
8
8
  import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
9
+ import { DEFAULT_STRINGS, readStrings } from "../strings.js";
9
10
  // section: component
10
11
  /**
11
12
  * Zero-config MySettingsPage server component
@@ -53,11 +54,16 @@ import { AuthPageShell } from "../components/layouts/shared/components/auth_page
53
54
  * @returns Server-rendered my settings component
54
55
  */
55
56
  export default function MySettingsPage(props) {
56
- const { className } = props !== null && props !== void 0 ? props : {};
57
+ var _a;
58
+ const { className, title } = props !== null && props !== void 0 ? props : {};
59
+ // Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
60
+ const strings = readStrings();
61
+ const ms_strings = strings.my_settings;
62
+ const resolved_title = (_a = title !== null && title !== void 0 ? title : ms_strings.title) !== null && _a !== void 0 ? _a : DEFAULT_STRINGS.my_settings.title;
57
63
  // Load configuration from INI file (with defaults)
58
64
  const config = get_my_settings_config();
59
65
  // Render layout with all server-initialized configuration, wrapped in AuthPageShell for navbar support
60
- return (_jsx(AuthPageShell, { children: _jsx(MySettingsLayout, { className: className, password_requirements: config.passwordRequirements, profilePicture: config.profilePicture, userFields: config.userFields, unauthorizedMessage: config.unauthorizedMessage, loginButtonLabel: config.loginButtonLabel, loginPath: config.loginPath, heading: config.heading, subHeading: config.subHeading, profilePhotoLabel: config.profilePhotoLabel, profilePhotoRecommendation: config.profilePhotoRecommendation, uploadPhotoButtonLabel: config.uploadPhotoButtonLabel, removePhotoButtonLabel: config.removePhotoButtonLabel, profileInformationLabel: config.profileInformationLabel, passwordLabel: config.passwordLabel, currentPasswordLabel: config.currentPasswordLabel, newPasswordLabel: config.newPasswordLabel, confirmPasswordLabel: config.confirmPasswordLabel, messages: config.messages, uiSizes: config.uiSizes, fileTypes: config.fileTypes }) }));
66
+ return (_jsx(AuthPageShell, { children: _jsx(MySettingsLayout, { className: className, password_requirements: config.passwordRequirements, profilePicture: config.profilePicture, userFields: config.userFields, unauthorizedMessage: config.unauthorizedMessage, loginButtonLabel: config.loginButtonLabel, loginPath: config.loginPath, heading: resolved_title, subHeading: config.subHeading, profilePhotoLabel: config.profilePhotoLabel, profilePhotoRecommendation: config.profilePhotoRecommendation, uploadPhotoButtonLabel: config.uploadPhotoButtonLabel, removePhotoButtonLabel: config.removePhotoButtonLabel, profileInformationLabel: config.profileInformationLabel, passwordLabel: config.passwordLabel, currentPasswordLabel: config.currentPasswordLabel, newPasswordLabel: config.newPasswordLabel, confirmPasswordLabel: config.confirmPasswordLabel, messages: config.messages, uiSizes: config.uiSizes, fileTypes: config.fileTypes }) }));
61
67
  }
62
68
  // Named export for direct imports
63
69
  export { MySettingsPage };
@@ -0,0 +1,56 @@
1
+ import "server-only";
2
+ import * as React from "react";
3
+ export type OTPPageProps = {
4
+ /**
5
+ * searchParams from Next.js page props — supports both sync and async forms.
6
+ * Reads `redirect` param to set the post-sign-in redirect URL.
7
+ */
8
+ searchParams?: Promise<{
9
+ redirect?: string;
10
+ }> | {
11
+ redirect?: string;
12
+ };
13
+ /**
14
+ * Page heading passed through to OTPLayout.
15
+ * Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
16
+ */
17
+ title?: string;
18
+ /**
19
+ * Page subtitle. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
20
+ */
21
+ subtitle?: string;
22
+ /**
23
+ * Submit button label. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
24
+ */
25
+ ctaText?: string;
26
+ /**
27
+ * Optional theme that controls visual appearance and layout mode.
28
+ * When `theme.layout` is `"split"`, activates the two-column split layout
29
+ * with the brand panel on the left.
30
+ */
31
+ theme?: import("../theme/theme_types").HazoAuthTheme;
32
+ };
33
+ /**
34
+ * Zero-config OTPPage server component
35
+ *
36
+ * Renders an email OTP sign-in flow: the user enters their email, receives a
37
+ * 6-digit code, and is redirected after successful verification.
38
+ *
39
+ * Usage in consuming apps:
40
+ * ```tsx
41
+ * // app/otp/page.tsx
42
+ * import { OTPPage } from "hazo_auth/pages/otp";
43
+ *
44
+ * export default function Page(props) {
45
+ * return <OTPPage {...props} />;
46
+ * }
47
+ * ```
48
+ *
49
+ * Pass `?redirect=/dashboard` in the URL to control the post-sign-in destination.
50
+ *
51
+ * @param props - Optional searchParams and title
52
+ * @returns Server-rendered OTP sign-in page
53
+ */
54
+ export default function OTPPage({ searchParams, title, subtitle, ctaText, theme, }?: OTPPageProps): Promise<React.ReactElement>;
55
+ export { OTPPage };
56
+ //# sourceMappingURL=otp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp.d.ts","sourceRoot":"","sources":["../../src/server_pages/otp.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,aAAa,CAAC;CACtD,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAA8B,OAAO,CAAC,EACpC,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,GACN,GAAE,YAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAyBjD;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // file_description: Zero-config OTPPage server component - drop in and use with no configuration required
3
+ // section: server-only-guard
4
+ import "server-only";
5
+ import { OTPLayout } from "../components/layouts/otp.js";
6
+ import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
7
+ import { DEFAULT_STRINGS, readStrings } from "../strings.js";
8
+ // section: component
9
+ /**
10
+ * Zero-config OTPPage server component
11
+ *
12
+ * Renders an email OTP sign-in flow: the user enters their email, receives a
13
+ * 6-digit code, and is redirected after successful verification.
14
+ *
15
+ * Usage in consuming apps:
16
+ * ```tsx
17
+ * // app/otp/page.tsx
18
+ * import { OTPPage } from "hazo_auth/pages/otp";
19
+ *
20
+ * export default function Page(props) {
21
+ * return <OTPPage {...props} />;
22
+ * }
23
+ * ```
24
+ *
25
+ * Pass `?redirect=/dashboard` in the URL to control the post-sign-in destination.
26
+ *
27
+ * @param props - Optional searchParams and title
28
+ * @returns Server-rendered OTP sign-in page
29
+ */
30
+ export default async function OTPPage({ searchParams, title, subtitle, ctaText, theme, } = {}) {
31
+ var _a, _b, _c, _d;
32
+ const params = searchParams instanceof Promise
33
+ ? await searchParams
34
+ : (searchParams !== null && searchParams !== void 0 ? searchParams : {});
35
+ const redirect_url = (_a = params.redirect) !== null && _a !== void 0 ? _a : "/";
36
+ // Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
37
+ const strings = readStrings();
38
+ const otp_strings = strings.otp;
39
+ const resolved_title = (_b = title !== null && title !== void 0 ? title : otp_strings.title) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.otp.title;
40
+ const resolved_subtitle = (_c = subtitle !== null && subtitle !== void 0 ? subtitle : otp_strings.subtitle) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.otp.subtitle;
41
+ const resolved_cta = (_d = ctaText !== null && ctaText !== void 0 ? ctaText : otp_strings.ctaText) !== null && _d !== void 0 ? _d : DEFAULT_STRINGS.otp.ctaText;
42
+ return (_jsx(AuthPageShell, { children: _jsx(OTPLayout, { redirect_url: redirect_url, title: resolved_title, subtitle: resolved_subtitle, ctaText: resolved_cta, theme: theme }) }));
43
+ }
44
+ // Named export for direct imports
45
+ export { OTPPage };