authhero 9.38.0 → 9.40.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 (89) hide show
  1. package/README.md +13 -3
  2. package/dist/assets/u/widget/authhero-widget.esm.js +1 -1
  3. package/dist/assets/u/widget/index.esm.js +1 -1
  4. package/dist/assets/u/widget/p-603aa8fa.entry.js +1 -0
  5. package/dist/assets/u/widget/p-d0eb5acc.entry.js +1 -0
  6. package/dist/authhero.cjs +175 -170
  7. package/dist/authhero.d.ts +381 -237
  8. package/dist/authhero.mjs +21363 -19930
  9. package/dist/mfa-BlaRHQgI.js +4 -0
  10. package/dist/mfa-Ddp9JT1l.mjs +406 -0
  11. package/dist/{mfa-attempts-BK-gWrgJ.mjs → mfa-attempts-YsmteBp0.mjs} +5188 -4601
  12. package/dist/mfa-attempts-bPJnyu2c.js +385 -0
  13. package/dist/{passkey-enrollment-CmKahPq7.js → passkey-enrollment-CLg7RteL.js} +1 -1
  14. package/dist/tsconfig.types.tsbuildinfo +1 -1
  15. package/dist/types/authentication-flows/common.d.ts +4 -1
  16. package/dist/types/authentication-flows/mfa.d.ts +3 -1
  17. package/dist/types/authentication-flows/passwordless.d.ts +2 -2
  18. package/dist/types/emails/index.d.ts +33 -1
  19. package/dist/types/generated/locale-types.d.ts +39 -0
  20. package/dist/types/helpers/client.d.ts +1 -0
  21. package/dist/types/helpers/code-recipient.d.ts +37 -0
  22. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  23. package/dist/types/helpers/response-type-grants.d.ts +8 -0
  24. package/dist/types/hooks/custom-notification-provider.d.ts +174 -0
  25. package/dist/types/hooks/helpers/action-users.d.ts +56 -0
  26. package/dist/types/hooks/helpers/post-login-account-linking.d.ts +18 -4
  27. package/dist/types/hooks/lifecycle-codehooks.d.ts +1 -1
  28. package/dist/types/hooks/pre-screen.d.ts +114 -0
  29. package/dist/types/index.d.ts +295 -217
  30. package/dist/types/routes/auth-api/device.d.ts +8 -8
  31. package/dist/types/routes/auth-api/index.d.ts +18 -18
  32. package/dist/types/routes/auth-api/passwordless.d.ts +12 -12
  33. package/dist/types/routes/auth-api/token.d.ts +10 -10
  34. package/dist/types/routes/management-api/action-executions.d.ts +2 -2
  35. package/dist/types/routes/management-api/action-triggers.d.ts +25 -25
  36. package/dist/types/routes/management-api/actions.d.ts +9 -9
  37. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  38. package/dist/types/routes/management-api/branding.d.ts +1 -1
  39. package/dist/types/routes/management-api/clients.d.ts +2 -0
  40. package/dist/types/routes/management-api/connections.d.ts +7 -1
  41. package/dist/types/routes/management-api/email-templates.d.ts +20 -20
  42. package/dist/types/routes/management-api/emails.d.ts +2 -2
  43. package/dist/types/routes/management-api/failed-events.d.ts +2 -2
  44. package/dist/types/routes/management-api/forms.d.ts +168 -144
  45. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  46. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  47. package/dist/types/routes/management-api/hooks.d.ts +25 -25
  48. package/dist/types/routes/management-api/index.d.ts +222 -190
  49. package/dist/types/routes/management-api/keys.d.ts +8 -8
  50. package/dist/types/routes/management-api/log-streams.d.ts +12 -12
  51. package/dist/types/routes/management-api/logs.d.ts +4 -4
  52. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  53. package/dist/types/routes/management-api/organizations.d.ts +8 -8
  54. package/dist/types/routes/management-api/prompts.d.ts +8 -8
  55. package/dist/types/routes/management-api/roles.d.ts +1 -1
  56. package/dist/types/routes/management-api/self-service-profiles.d.ts +8 -8
  57. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  58. package/dist/types/routes/management-api/tenants.d.ts +29 -29
  59. package/dist/types/routes/management-api/users.d.ts +29 -29
  60. package/dist/types/routes/universal-login/continue.d.ts +35 -0
  61. package/dist/types/routes/universal-login/flow-api.d.ts +12 -12
  62. package/dist/types/routes/universal-login/form-node.d.ts +4 -4
  63. package/dist/types/routes/universal-login/index.d.ts +4 -4
  64. package/dist/types/routes/universal-login/pre-screen-gates.d.ts +31 -0
  65. package/dist/types/routes/universal-login/screens/account-change-email.d.ts +52 -0
  66. package/dist/types/routes/universal-login/screens/account-helpers.d.ts +19 -24
  67. package/dist/types/routes/universal-login/screens/account.d.ts +6 -0
  68. package/dist/types/routes/universal-login/screens/connect-authz.d.ts +13 -1
  69. package/dist/types/routes/universal-login/screens/index.d.ts +4 -2
  70. package/dist/types/routes/universal-login/screens/invalid-session.d.ts +10 -0
  71. package/dist/types/routes/universal-login/screens/login-otp.d.ts +2 -2
  72. package/dist/types/routes/universal-login/screens/signup.d.ts +0 -3
  73. package/dist/types/routes/universal-login/screens/social-connections.d.ts +31 -0
  74. package/dist/types/routes/universal-login/screens/types.d.ts +3 -0
  75. package/dist/types/routes/universal-login/u2-form-node.d.ts +2 -2
  76. package/dist/types/routes/universal-login/u2-index.d.ts +50 -5
  77. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  78. package/dist/types/routes/universal-login/u2-widget-page.d.ts +1 -4
  79. package/dist/types/routes/universal-login/widget-assets.d.ts +20 -0
  80. package/dist/types/state-machines/login-session.d.ts +12 -0
  81. package/dist/types/types/AuthHeroConfig.d.ts +9 -1
  82. package/dist/types/types/Hooks.d.ts +62 -17
  83. package/dist/types/utils/embedded-browser.d.ts +4 -0
  84. package/package.json +6 -6
  85. package/dist/assets/u/widget/p-32247347.entry.js +0 -1
  86. package/dist/assets/u/widget/p-3f908508.entry.js +0 -1
  87. package/dist/mfa-DBhvi2B5.js +0 -1
  88. package/dist/mfa-DnCary4g.mjs +0 -128
  89. package/dist/mfa-attempts-C5kobAHS.js +0 -275
@@ -3,8 +3,8 @@ import type { LoginSession } from "@authhero/adapter-interfaces";
3
3
  import type { EnrichedClient } from "../../../helpers/client";
4
4
  import type { Bindings, Variables } from "../../../types";
5
5
  /**
6
- * Create a one-time code bound to the login session and deliver it to the
7
- * user, either as a code or (for magic-link email connections) as a link.
6
+ * Create a one-time code bound to the login session and to `to`, and deliver
7
+ * it to the user, either as a code or (for magic-link email connections) as a link.
8
8
  */
9
9
  export declare function sendLoginOtp(ctx: Context<{
10
10
  Bindings: Bindings;
@@ -56,8 +56,5 @@ export declare function localizePasswordPolicyError(error: unknown, locale: stri
56
56
  * Create the signup screen
57
57
  */
58
58
  export declare function signupScreen(context: ScreenContext): Promise<ScreenResult>;
59
- /**
60
- * Screen definition for the signup screen
61
- */
62
59
  export declare const signupScreenDefinition: ScreenDefinition;
63
60
  export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Which of a client's connections the u2 login screens show as social /
3
+ * enterprise buttons. Same rules as the legacy /u identifier page:
4
+ *
5
+ * - Email, SMS and database connections are form inputs, not buttons.
6
+ * - `show_as_button: false` always hides a connection.
7
+ * - Connections with `domain_aliases` are reached by home realm discovery
8
+ * (email-domain routing) and hidden unless `show_as_button: true`, on
9
+ * screens that do that routing (the identifier screen).
10
+ * - Strategies that refuse embedded browsers (Google) are hidden in in-app
11
+ * browsers, where the provider would reject the sign-in.
12
+ *
13
+ * Unlike /u, strategies without a built-in handler (custom OAuth2/OIDC set up
14
+ * through the `STRATEGIES` env) are kept: they fall back to their name and a
15
+ * generic icon.
16
+ */
17
+ import type { Connection } from "@authhero/adapter-interfaces";
18
+ export declare function isFormConnection(connection: Connection): boolean;
19
+ export declare function isShownAsButton(connection: Connection, options: {
20
+ embeddedBrowser: boolean;
21
+ hideHrdConnections?: boolean;
22
+ }): boolean;
23
+ /** The connections to render as social / enterprise buttons, in client order. */
24
+ export declare function getButtonConnections(connections: Connection[], userAgent: string | undefined, options?: {
25
+ /**
26
+ * Hide HRD connections (default). Only screens whose submit routes the
27
+ * identifier by email domain may hide them; elsewhere the button is the
28
+ * connection's only way in.
29
+ */
30
+ hideHrdConnections?: boolean;
31
+ }): Connection[];
@@ -160,6 +160,9 @@ export interface ScreenDefinition {
160
160
  /** The screen handler */
161
161
  handler: ScreenHandler;
162
162
  }
163
+ export declare function screenUsesUrlCode(screenId: string): boolean;
164
+ /** `&code=…` for the form action of a screen that carries a URL code. */
165
+ export declare function urlCodeSuffix(screenId: string, code: string | undefined): string;
163
166
  /**
164
167
  * Get the correct login path based on the tenant's identifier_first setting.
165
168
  * Returns "/u2/login" for password-first or "/u2/login/identifier" for identifier-first.
@@ -28,7 +28,7 @@ export declare const u2FormNodeRoutes: OpenAPIHono<{
28
28
  };
29
29
  output: {};
30
30
  outputFormat: string;
31
- status: 404;
31
+ status: 200;
32
32
  } | {
33
33
  input: {
34
34
  param: {
@@ -42,7 +42,7 @@ export declare const u2FormNodeRoutes: OpenAPIHono<{
42
42
  };
43
43
  output: {};
44
44
  outputFormat: string;
45
- status: 200;
45
+ status: 404;
46
46
  };
47
47
  };
48
48
  } & {
@@ -195,7 +195,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
195
195
  $get: {
196
196
  input: {
197
197
  param: {
198
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "account" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
198
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "account" | "enter-password" | "invalid-session" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
199
199
  };
200
200
  } & {
201
201
  query: {
@@ -211,7 +211,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
211
211
  } | {
212
212
  input: {
213
213
  param: {
214
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "account" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
214
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "account" | "enter-password" | "invalid-session" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
215
215
  };
216
216
  } & {
217
217
  query: {
@@ -227,7 +227,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
227
227
  } | {
228
228
  input: {
229
229
  param: {
230
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "account" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
230
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "account" | "enter-password" | "invalid-session" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
231
231
  };
232
232
  } & {
233
233
  query: {
@@ -247,7 +247,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
247
247
  $post: {
248
248
  input: {
249
249
  param: {
250
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
250
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
251
251
  };
252
252
  } & {
253
253
  query: {
@@ -265,7 +265,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
265
265
  } | {
266
266
  input: {
267
267
  param: {
268
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
268
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
269
269
  };
270
270
  } & {
271
271
  query: {
@@ -283,6 +283,51 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
283
283
  };
284
284
  };
285
285
  }, "/"> & import("hono/types").MergeSchemaPath<{
286
+ "/": {
287
+ $get: {
288
+ input: {
289
+ query: {
290
+ error?: string | undefined;
291
+ error_description?: string | undefined;
292
+ };
293
+ };
294
+ output: {};
295
+ outputFormat: string;
296
+ status: 200;
297
+ };
298
+ };
299
+ }, "/error"> & import("hono/types").MergeSchemaPath<{
300
+ "/": {
301
+ $get: {
302
+ input: {
303
+ query: {
304
+ state: string;
305
+ };
306
+ };
307
+ output: {};
308
+ outputFormat: string;
309
+ status: 302;
310
+ } | {
311
+ input: {
312
+ query: {
313
+ state: string;
314
+ };
315
+ };
316
+ output: {};
317
+ outputFormat: string;
318
+ status: 400;
319
+ } | {
320
+ input: {
321
+ query: {
322
+ state: string;
323
+ };
324
+ };
325
+ output: {};
326
+ outputFormat: string;
327
+ status: 500;
328
+ };
329
+ };
330
+ }, "/continue"> & import("hono/types").MergeSchemaPath<{
286
331
  "/:formId/nodes/:nodeId": {
287
332
  $get: {
288
333
  input: {
@@ -200,7 +200,7 @@ export declare const u2Routes: OpenAPIHono<{
200
200
  $get: {
201
201
  input: {
202
202
  param: {
203
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "account" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
203
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "account" | "enter-password" | "invalid-session" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
204
204
  };
205
205
  } & {
206
206
  query: {
@@ -216,7 +216,7 @@ export declare const u2Routes: OpenAPIHono<{
216
216
  } | {
217
217
  input: {
218
218
  param: {
219
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "account" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
219
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "account" | "enter-password" | "invalid-session" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
220
220
  };
221
221
  } & {
222
222
  query: {
@@ -232,7 +232,7 @@ export declare const u2Routes: OpenAPIHono<{
232
232
  } | {
233
233
  input: {
234
234
  param: {
235
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "account" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
235
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "account" | "enter-password" | "invalid-session" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
236
236
  };
237
237
  } & {
238
238
  query: {
@@ -252,7 +252,7 @@ export declare const u2Routes: OpenAPIHono<{
252
252
  $post: {
253
253
  input: {
254
254
  param: {
255
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
255
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
256
256
  };
257
257
  } & {
258
258
  query: {
@@ -270,7 +270,7 @@ export declare const u2Routes: OpenAPIHono<{
270
270
  } | {
271
271
  input: {
272
272
  param: {
273
- screen: "signup" | "login" | "reset-password" | "consent" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
273
+ screen: "login" | "signup" | "consent" | "impersonate" | "reset-password" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "account/change-email" | "account/change-email/verify" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
274
274
  };
275
275
  } & {
276
276
  query: {
@@ -121,10 +121,7 @@ export type WidgetPageProps = {
121
121
  name?: string;
122
122
  };
123
123
  };
124
- /** Detects in-app browsers from the request's User-Agent. */
125
- export declare function detectEmbeddedBrowser(userAgent: string | undefined): {
126
- name?: string;
127
- } | undefined;
124
+ export { detectEmbeddedBrowser } from "../../utils/embedded-browser";
128
125
  /** Localized display names for the language picker, in the given order. */
129
126
  export declare function buildLanguageOptions(availableLanguages?: string[]): LanguageOption[] | undefined;
130
127
  /** The short "Terms & Privacy" label, in the page's language. */
@@ -0,0 +1,20 @@
1
+ import { Hono } from "hono";
2
+ import { AuthHeroConfig, Bindings, Variables } from "../../types";
3
+ /**
4
+ * Neutral location for the widget bundle and the shared client script, so the
5
+ * universal-login pages don't depend on the legacy /u prefix.
6
+ */
7
+ export declare const WIDGET_ASSET_PATH = "/widget";
8
+ export declare const WIDGET_CLIENT_JS_PATH = "/widget/client.js";
9
+ /**
10
+ * Serves `/widget/client.js` and `/widget/*`. The configured `widgetHandler`
11
+ * is invoked with the request path rewritten to the legacy `/u/widget/*`
12
+ * form, so handlers that do `p.replace("/u/widget", "")` keep working as well
13
+ * as handlers written for the neutral path. Without a `widgetHandler`,
14
+ * `/widget/*` redirects to `/u/widget/*`, where deployments that ship the
15
+ * widget as static files keep it today.
16
+ */
17
+ export declare function createWidgetAssetRoutes(config: AuthHeroConfig): Hono<{
18
+ Bindings: Bindings;
19
+ Variables: Variables;
20
+ }, import("hono/types").BlankSchema, "/">;
@@ -32,6 +32,18 @@ export interface LoginSessionData {
32
32
  mfa_failed_attempts?: number;
33
33
  mfa_sms_sent?: number;
34
34
  pending_email_verification?: unknown;
35
+ /** u2 change-email: the address a code was sent to, shown on the verify step */
36
+ pending_email_change?: {
37
+ email: string;
38
+ };
39
+ /**
40
+ * u2 change-email: the address the last change set. The verify step shows
41
+ * the confirmation from it on GET, so it survives a no-JS form post, which
42
+ * redirects instead of rendering the POST result.
43
+ */
44
+ email_change_done?: {
45
+ email: string;
46
+ };
35
47
  hookId?: string;
36
48
  form_values?: Record<string, unknown>;
37
49
  continuationScope?: string[];
@@ -320,7 +320,15 @@ export interface AuthHeroConfig {
320
320
  */
321
321
  entityHooks?: EntityHooksConfig;
322
322
  /**
323
- * Handler for serving widget static files at /u/widget/*.
323
+ * Handler for serving widget static files at /widget/* (and the legacy /u/widget/* alias).
324
+ * Requests to /widget/* are passed to the handler with the path rewritten to
325
+ * /u/widget/*, so a handler only needs to strip "/u/widget". The /widget/* routes
326
+ * are registered on the root app returned by init(), so mount that (or
327
+ * createWidgetAssetRoutes) when serving the pages from a sub-app.
328
+ *
329
+ * Without a widgetHandler, /widget/* redirects to /u/widget/*, so deployments
330
+ * that ship the widget as static files under /u/widget/ keep working. Serve the
331
+ * files at /widget/ as well before /u is removed.
324
332
  *
325
333
  * The widget files are served from @authhero/widget package.
326
334
  * This must be a platform-specific static file handler.
@@ -1,4 +1,4 @@
1
- import { AuthorizationResponseMode, AuthorizationResponseType, DataAdapters, LinkCandidate, RolePermissionInsert, User } from "@authhero/adapter-interfaces";
1
+ import { AuthorizationResponseMode, AuthorizationResponseType, DataAdapters, LinkCandidate, PreScreenOperation, PreScreenPhase, RolePermissionInsert, User } from "@authhero/adapter-interfaces";
2
2
  import { EnrichedClient } from "../helpers/client";
3
3
  import { Context } from "hono";
4
4
  import { Bindings } from "./Bindings";
@@ -251,20 +251,58 @@ export type OnExecutePostUserDeletion = (event: HookEvent & {
251
251
  user_id: string;
252
252
  }, api: OnExecutePostUserDeletionAPI) => Promise<void>;
253
253
  /**
254
- * Self-service account operations that fire the `pre-account-action` trigger
255
- * (an AuthHero extension; Auth0 has no equivalent). The trigger runs once when
256
- * the user starts the operation, before any form, code or write.
254
+ * The authorization request a universal-login screen belongs to, plus the
255
+ * phase the `pre-screen` trigger runs in. The login session id is not
256
+ * included: it is the key to the transaction, not a request parameter.
257
257
  */
258
- export type AccountActionOperation = "change-email" | "update-profile" | "reset-password" | "enroll-mfa" | "remove-mfa" | "enroll-passkey" | "remove-passkey" | "unlink-identity" | "delete-account";
259
- export type PreAccountActionEvent = {
258
+ export type PreScreenTransaction = {
259
+ /** `render` before the screen is shown, `submit` when it is submitted. */
260
+ phase: PreScreenPhase;
261
+ locale: string;
262
+ client_id?: string;
263
+ redirect_uri?: string;
264
+ requested_scopes: string[];
265
+ response_type?: AuthorizationResponseType;
266
+ response_mode?: AuthorizationResponseMode;
267
+ /** The application's `state` parameter. */
268
+ state?: string;
269
+ audience?: string;
270
+ prompt?: string;
271
+ ui_locales?: string;
272
+ acr_values?: string;
273
+ /** The identifier entered or passed as `login_hint` so far. */
274
+ login_hint?: string;
275
+ /** `screen_hint` from the authorization request. */
276
+ screen_hint?: string;
277
+ };
278
+ /**
279
+ * Event of the `pre-screen` trigger (an AuthHero extension; Auth0 has no
280
+ * pre-login trigger). Fires before a universal-login screen is shown and when
281
+ * it is submitted.
282
+ */
283
+ export type PreScreenEvent = {
260
284
  ctx: Context<{
261
285
  Bindings: Bindings;
262
286
  Variables: Variables;
263
287
  }>;
264
- operation: AccountActionOperation;
288
+ screen: {
289
+ name: string;
290
+ };
291
+ prompt: {
292
+ name: string;
293
+ };
294
+ transaction: PreScreenTransaction;
295
+ /**
296
+ * Submit phase only: the operation the submission performs, e.g.
297
+ * `remove-mfa` for the remove button on `account-security`.
298
+ */
299
+ operation?: PreScreenOperation;
300
+ /** Operation-specific detail, e.g. `{ factor: "totp" }` for `enroll-mfa`. */
301
+ details?: Record<string, string>;
265
302
  /**
266
- * The signed-in user. Undefined only for `reset-password` when the
267
- * identifier entered so far doesn't match a user (or none was entered).
303
+ * The user when known: the signed-in user on account screens, the user the
304
+ * identifier entered so far matches on login and password-reset screens,
305
+ * the authenticated user on MFA and consent screens.
268
306
  */
269
307
  user?: User;
270
308
  /** Connection of the user's primary identity. */
@@ -274,27 +312,31 @@ export type PreAccountActionEvent = {
274
312
  strategy?: string;
275
313
  };
276
314
  client?: EnrichedClient;
315
+ organization?: {
316
+ id: string;
317
+ name: string;
318
+ display_name?: string;
319
+ metadata?: Record<string, unknown>;
320
+ };
277
321
  tenant: {
278
322
  id: string;
279
323
  };
280
324
  request: HookRequest;
281
- /** Operation-specific detail, e.g. `{ factor: "totp" }` for `enroll-mfa`. */
282
- details?: Record<string, string>;
283
325
  };
284
- export type OnExecutePreAccountActionAPI = {
326
+ export type OnExecutePreScreenAPI = {
285
327
  redirect: {
286
- /** Send the user to `url` instead of running the operation here. */
328
+ /** Send the user to `url` instead of showing or submitting the screen. */
287
329
  sendUserTo: (url: string, options?: {
288
330
  query?: Record<string, string>;
289
331
  }) => void;
290
332
  };
291
333
  access: {
292
- /** Stop the operation and show `reason` to the user. */
334
+ /** Stop the screen and show `reason` to the user. */
293
335
  deny: (reason?: string) => void;
294
336
  };
295
337
  token: TokenAPI;
296
338
  };
297
- export type OnExecutePreAccountAction = (event: PreAccountActionEvent, api: OnExecutePreAccountActionAPI) => Promise<void>;
339
+ export type OnExecutePreScreen = (event: PreScreenEvent, api: OnExecutePreScreenAPI) => Promise<void>;
298
340
  export type OnExecuteValidateRegistrationUsernameAPI = {
299
341
  deny: (reason?: string) => void;
300
342
  token: TokenAPI;
@@ -333,8 +375,11 @@ export type Hooks = {
333
375
  onExecutePreUserDeletion?: OnExecutePreUserDeletion;
334
376
  onExecutePostUserDeletion?: OnExecutePostUserDeletion;
335
377
  onExecuteValidateRegistrationUsername?: OnExecuteValidateRegistrationUsername;
336
- /** Called when a user starts a self-service account operation (AuthHero extension) */
337
- onExecutePreAccountAction?: OnExecutePreAccountAction;
378
+ /**
379
+ * Called before a universal-login screen is shown and when it is submitted
380
+ * (AuthHero extension, the `pre-screen` trigger)
381
+ */
382
+ onExecutePreScreen?: OnExecutePreScreen;
338
383
  /** Called when /userinfo endpoint is accessed to add custom claims */
339
384
  onFetchUserInfo?: OnFetchUserInfo;
340
385
  };
@@ -0,0 +1,4 @@
1
+ /** Detects in-app browsers from the request's User-Agent. */
2
+ export declare function detectEmbeddedBrowser(userAgent: string | undefined): {
3
+ name?: string;
4
+ } | undefined;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/sesamyab/authhero"
13
13
  },
14
- "version": "9.38.0",
14
+ "version": "9.40.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -63,8 +63,8 @@
63
63
  "vite": "^8.0.14",
64
64
  "vite-plugin-dts": "^4.5.4",
65
65
  "vitest": "^4.1.7",
66
- "@authhero/kysely-adapter": "12.24.0",
67
- "@authhero/widget": "0.42.0"
66
+ "@authhero/kysely-adapter": "12.24.2",
67
+ "@authhero/widget": "0.43.0"
68
68
  },
69
69
  "dependencies": {
70
70
  "@peculiar/x509": "^1.14.3",
@@ -82,9 +82,9 @@
82
82
  "qrcode": "^1.5.4",
83
83
  "sanitize-html": "^2.17.4",
84
84
  "xstate": "^5.31.1",
85
- "@authhero/adapter-interfaces": "4.33.0",
86
- "@authhero/proxy": "0.11.20",
87
- "@authhero/saml": "0.6.13"
85
+ "@authhero/adapter-interfaces": "4.35.0",
86
+ "@authhero/proxy": "0.11.22",
87
+ "@authhero/saml": "0.6.15"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@authhero/widget": ">=0.38.9",