@dloizides/auth-web 1.12.0 → 1.12.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,29 @@
1
1
  # Changelog
2
2
 
3
- ## 1.12.0 (2026-07-17)
3
+ ## 1.12.1 (2026-07-17)
4
+
5
+ Internal refactor only — **no API change, no behaviour change**. The public
6
+ export surface (`src/index.ts`) is byte-identical to 1.12.0; every consumer
7
+ (zygos, katalogos, erevna, kefi, ichnos) keeps importing the same symbols with
8
+ the same types from the same entry point.
9
+
10
+ Two oversized source files from the demo-credential work were split to satisfy
11
+ the repo size limits (files < 300 lines, components < 200):
12
+
13
+ - **`src/components/labels.ts` (511 lines) → `src/components/labels/`.** The
14
+ single label bag is now one file per component family (`loginLabels.ts`,
15
+ `forgotPasswordLabels.ts`, `otpLabels.ts`, `pinLabels.ts`, `devicePinLabels.ts`,
16
+ `passkeyLabels.ts`, `preferredMethodLabels.ts`, `demoLabels.ts`,
17
+ `resetPasswordLabels.ts`) behind a `labels/index.ts` barrel that re-exports the
18
+ exact same names, so `./labels` remains a single import site.
19
+ - **`src/components/LoginForm.tsx` (253 lines) → render body slimmed.** The
20
+ prop-doc-heavy `LoginFormProps` interface moved to a co-located
21
+ `LoginForm.types.ts` (re-exported from `LoginForm.tsx`), and the submit branch
22
+ logic moved into a unit-tested `useLoginSubmit` hook.
23
+
24
+ ### Changed
25
+
26
+ - No runtime change. Splitting only; identical bundled output.
4
27
 
5
28
  Completes the demo-credential feature for **BFF-fronted apps**, whose demo pair
6
29
  arrives ASYNChronously from `GET /bff/config` rather than a module-level const (a
package/dist/index.d.mts CHANGED
@@ -129,18 +129,6 @@ interface AuthScreenProps {
129
129
  /** The screen-level auth composition: one centered card the controls share. */
130
130
  declare function AuthScreen({ children, theme: themeProp, testID, cardTestID, maxWidth, title, subtitle, footer, }: Readonly<AuthScreenProps>): ReactElement;
131
131
 
132
- /**
133
- * Label bags for the auth components.
134
- *
135
- * `@dloizides/auth-web` ships **no** translation framework — it is i18n-agnostic
136
- * by design (each app already owns its own i18n). Every user-facing string a
137
- * component renders is supplied by the consuming app through a typed `labels`
138
- * prop. The app passes strings it has already localised with `FM()` / `t()`.
139
- *
140
- * Each bag has a `DEFAULT_*` constant (English) so a component renders sensibly
141
- * with no `labels` prop and a consuming app can spread-override only the keys
142
- * it wants to change.
143
- */
144
132
  /** Strings rendered by `<LoginForm>`. */
145
133
  interface LoginFormLabels {
146
134
  title: string;
@@ -162,6 +150,8 @@ interface LoginFormLabels {
162
150
  /** Shown when one or both fields are empty on submit. */
163
151
  missingFields: string;
164
152
  }
153
+ declare const DEFAULT_LOGIN_LABELS: LoginFormLabels;
154
+
165
155
  /** Strings rendered by `<ForgotPasswordForm>`. */
166
156
  interface ForgotPasswordFormLabels {
167
157
  title: string;
@@ -189,6 +179,9 @@ interface ForgotPasswordFieldsLabels extends ForgotPasswordFormLabels {
189
179
  /** The "close" button shown on the success state. */
190
180
  close: string;
191
181
  }
182
+ declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordFormLabels;
183
+ declare const DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS: ForgotPasswordFieldsLabels;
184
+
192
185
  /** Strings rendered by `<OtpForm>` — the two-step email-OTP login form. */
193
186
  interface OtpFormLabels {
194
187
  /** Title shown on the request-a-code step. */
@@ -224,6 +217,8 @@ interface OtpFormLabels {
224
217
  /** The "use a different email" link text — returns to step 1. */
225
218
  changeEmail: string;
226
219
  }
220
+ declare const DEFAULT_OTP_LABELS: OtpFormLabels;
221
+
227
222
  /** Strings rendered by `<PinForm>` — the single-step event-PIN login form. */
228
223
  interface PinFormLabels {
229
224
  /** Title shown above the PIN field. */
@@ -241,6 +236,8 @@ interface PinFormLabels {
241
236
  /** Generic "that PIN was wrong / expired / locked out" message. */
242
237
  invalidPin: string;
243
238
  }
239
+ declare const DEFAULT_PIN_LABELS: PinFormLabels;
240
+
244
241
  /**
245
242
  * Strings rendered by `<DevicePinUnlockScreen>` — the returning-device unlock
246
243
  * gate. `{name}` / `{count}` placeholders are substituted by the component.
@@ -336,6 +333,10 @@ interface DevicePinSettingsLabels {
336
333
  /** Error shown when disabling fails. */
337
334
  disableFailed: string;
338
335
  }
336
+ declare const DEFAULT_DEVICE_PIN_UNLOCK_LABELS: DevicePinUnlockLabels;
337
+ declare const DEFAULT_DEVICE_PIN_ENROLL_LABELS: DevicePinEnrollLabels;
338
+ declare const DEFAULT_DEVICE_PIN_SETTINGS_LABELS: DevicePinSettingsLabels;
339
+
339
340
  /** Strings rendered by `<PasskeyLoginButton>` — the login-surface passkey CTA. */
340
341
  interface PasskeyLoginLabels {
341
342
  /** The "sign in with a passkey" button. */
@@ -365,6 +366,9 @@ interface PasskeySettingsLabels {
365
366
  /** Success line shown after returning from a registration. */
366
367
  registeredSuccess: string;
367
368
  }
369
+ declare const DEFAULT_PASSKEY_LOGIN_LABELS: PasskeyLoginLabels;
370
+ declare const DEFAULT_PASSKEY_SETTINGS_LABELS: PasskeySettingsLabels;
371
+
368
372
  /** Strings rendered by `<PreferredMethodSettingsCard>` — the cross-device default-method picker. */
369
373
  interface PreferredMethodSettingsLabels {
370
374
  title: string;
@@ -391,6 +395,9 @@ interface PreferredMethodHintLabels {
391
395
  /** Full sentence shown when the cached preference is passkey. */
392
396
  passkey: string;
393
397
  }
398
+ declare const DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS: PreferredMethodSettingsLabels;
399
+ declare const DEFAULT_PREFERRED_METHOD_HINT_LABELS: PreferredMethodHintLabels;
400
+
394
401
  /** Strings rendered by `<DemoCredentialsHint>` — the public-demo credentials panel. */
395
402
  interface DemoCredentialsHintLabels {
396
403
  /** Panel heading (e.g. "Demo access"). */
@@ -406,6 +413,8 @@ interface DemoCredentialsHintLabels {
406
413
  /** Accessibility hint for that button. */
407
414
  useCredentialsHint: string;
408
415
  }
416
+ declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
417
+
409
418
  /** Strings rendered by `<ResetPasswordForm>`. */
410
419
  interface ResetPasswordFormLabels {
411
420
  title: string;
@@ -427,19 +436,6 @@ interface ResetPasswordFormLabels {
427
436
  /** Error: a network / 5xx failure. */
428
437
  errorNetwork: string;
429
438
  }
430
- declare const DEFAULT_LOGIN_LABELS: LoginFormLabels;
431
- declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordFormLabels;
432
- declare const DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS: ForgotPasswordFieldsLabels;
433
- declare const DEFAULT_OTP_LABELS: OtpFormLabels;
434
- declare const DEFAULT_PIN_LABELS: PinFormLabels;
435
- declare const DEFAULT_DEVICE_PIN_UNLOCK_LABELS: DevicePinUnlockLabels;
436
- declare const DEFAULT_DEVICE_PIN_ENROLL_LABELS: DevicePinEnrollLabels;
437
- declare const DEFAULT_DEVICE_PIN_SETTINGS_LABELS: DevicePinSettingsLabels;
438
- declare const DEFAULT_PASSKEY_LOGIN_LABELS: PasskeyLoginLabels;
439
- declare const DEFAULT_PASSKEY_SETTINGS_LABELS: PasskeySettingsLabels;
440
- declare const DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS: PreferredMethodSettingsLabels;
441
- declare const DEFAULT_PREFERRED_METHOD_HINT_LABELS: PreferredMethodHintLabels;
442
- declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
443
439
  declare const DEFAULT_RESET_PASSWORD_LABELS: ResetPasswordFormLabels;
444
440
 
445
441
  /**
@@ -464,17 +460,8 @@ declare const enum PrefillIntent {
464
460
  }
465
461
 
466
462
  /**
467
- * `<LoginForm>` — the ready-made, themeable password-login form.
468
- *
469
- * The "themeable component" half of the package design: drop it in, pass a
470
- * `client`, a `theme` (or wrap in `<AuthThemeProvider>`) and a localised
471
- * `labels` bag, and you have a branded login surface. It is built on the
472
- * headless `useBffAuth` hook, so the ready-made and custom-layout paths share
473
- * one code path.
474
- *
475
- * The package ships no router and no i18n. `onSuccess` hands the signed-in
476
- * `BffUser` back to the app, which decides where to navigate (typically via
477
- * `resolvePostLoginRoute`). All copy comes from `labels`.
463
+ * Props for `<LoginForm>`, split out of the component file to keep the render
464
+ * body under the component size limit. Purely a type module — no runtime code.
478
465
  */
479
466
 
480
467
  interface LoginFormProps {
@@ -531,6 +518,21 @@ interface LoginFormProps {
531
518
  */
532
519
  prefillIntent?: PrefillIntent;
533
520
  }
521
+
522
+ /**
523
+ * `<LoginForm>` — the ready-made, themeable password-login form.
524
+ *
525
+ * The "themeable component" half of the package design: drop it in, pass a
526
+ * `client`, a `theme` (or wrap in `<AuthThemeProvider>`) and a localised
527
+ * `labels` bag, and you have a branded login surface. It is built on the
528
+ * headless `useBffAuth` hook, so the ready-made and custom-layout paths share
529
+ * one code path.
530
+ *
531
+ * The package ships no router and no i18n. `onSuccess` hands the signed-in
532
+ * `BffUser` back to the app, which decides where to navigate (typically via
533
+ * `resolvePostLoginRoute`). All copy comes from `labels`.
534
+ */
535
+
534
536
  /** Themeable password-login form built on `useBffAuth`. */
535
537
  declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, chromeless, initialUsername, initialPassword, prefillNonce, prefillIntent, }: Readonly<LoginFormProps>): ReactElement;
536
538
 
package/dist/index.d.ts CHANGED
@@ -129,18 +129,6 @@ interface AuthScreenProps {
129
129
  /** The screen-level auth composition: one centered card the controls share. */
130
130
  declare function AuthScreen({ children, theme: themeProp, testID, cardTestID, maxWidth, title, subtitle, footer, }: Readonly<AuthScreenProps>): ReactElement;
131
131
 
132
- /**
133
- * Label bags for the auth components.
134
- *
135
- * `@dloizides/auth-web` ships **no** translation framework — it is i18n-agnostic
136
- * by design (each app already owns its own i18n). Every user-facing string a
137
- * component renders is supplied by the consuming app through a typed `labels`
138
- * prop. The app passes strings it has already localised with `FM()` / `t()`.
139
- *
140
- * Each bag has a `DEFAULT_*` constant (English) so a component renders sensibly
141
- * with no `labels` prop and a consuming app can spread-override only the keys
142
- * it wants to change.
143
- */
144
132
  /** Strings rendered by `<LoginForm>`. */
145
133
  interface LoginFormLabels {
146
134
  title: string;
@@ -162,6 +150,8 @@ interface LoginFormLabels {
162
150
  /** Shown when one or both fields are empty on submit. */
163
151
  missingFields: string;
164
152
  }
153
+ declare const DEFAULT_LOGIN_LABELS: LoginFormLabels;
154
+
165
155
  /** Strings rendered by `<ForgotPasswordForm>`. */
166
156
  interface ForgotPasswordFormLabels {
167
157
  title: string;
@@ -189,6 +179,9 @@ interface ForgotPasswordFieldsLabels extends ForgotPasswordFormLabels {
189
179
  /** The "close" button shown on the success state. */
190
180
  close: string;
191
181
  }
182
+ declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordFormLabels;
183
+ declare const DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS: ForgotPasswordFieldsLabels;
184
+
192
185
  /** Strings rendered by `<OtpForm>` — the two-step email-OTP login form. */
193
186
  interface OtpFormLabels {
194
187
  /** Title shown on the request-a-code step. */
@@ -224,6 +217,8 @@ interface OtpFormLabels {
224
217
  /** The "use a different email" link text — returns to step 1. */
225
218
  changeEmail: string;
226
219
  }
220
+ declare const DEFAULT_OTP_LABELS: OtpFormLabels;
221
+
227
222
  /** Strings rendered by `<PinForm>` — the single-step event-PIN login form. */
228
223
  interface PinFormLabels {
229
224
  /** Title shown above the PIN field. */
@@ -241,6 +236,8 @@ interface PinFormLabels {
241
236
  /** Generic "that PIN was wrong / expired / locked out" message. */
242
237
  invalidPin: string;
243
238
  }
239
+ declare const DEFAULT_PIN_LABELS: PinFormLabels;
240
+
244
241
  /**
245
242
  * Strings rendered by `<DevicePinUnlockScreen>` — the returning-device unlock
246
243
  * gate. `{name}` / `{count}` placeholders are substituted by the component.
@@ -336,6 +333,10 @@ interface DevicePinSettingsLabels {
336
333
  /** Error shown when disabling fails. */
337
334
  disableFailed: string;
338
335
  }
336
+ declare const DEFAULT_DEVICE_PIN_UNLOCK_LABELS: DevicePinUnlockLabels;
337
+ declare const DEFAULT_DEVICE_PIN_ENROLL_LABELS: DevicePinEnrollLabels;
338
+ declare const DEFAULT_DEVICE_PIN_SETTINGS_LABELS: DevicePinSettingsLabels;
339
+
339
340
  /** Strings rendered by `<PasskeyLoginButton>` — the login-surface passkey CTA. */
340
341
  interface PasskeyLoginLabels {
341
342
  /** The "sign in with a passkey" button. */
@@ -365,6 +366,9 @@ interface PasskeySettingsLabels {
365
366
  /** Success line shown after returning from a registration. */
366
367
  registeredSuccess: string;
367
368
  }
369
+ declare const DEFAULT_PASSKEY_LOGIN_LABELS: PasskeyLoginLabels;
370
+ declare const DEFAULT_PASSKEY_SETTINGS_LABELS: PasskeySettingsLabels;
371
+
368
372
  /** Strings rendered by `<PreferredMethodSettingsCard>` — the cross-device default-method picker. */
369
373
  interface PreferredMethodSettingsLabels {
370
374
  title: string;
@@ -391,6 +395,9 @@ interface PreferredMethodHintLabels {
391
395
  /** Full sentence shown when the cached preference is passkey. */
392
396
  passkey: string;
393
397
  }
398
+ declare const DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS: PreferredMethodSettingsLabels;
399
+ declare const DEFAULT_PREFERRED_METHOD_HINT_LABELS: PreferredMethodHintLabels;
400
+
394
401
  /** Strings rendered by `<DemoCredentialsHint>` — the public-demo credentials panel. */
395
402
  interface DemoCredentialsHintLabels {
396
403
  /** Panel heading (e.g. "Demo access"). */
@@ -406,6 +413,8 @@ interface DemoCredentialsHintLabels {
406
413
  /** Accessibility hint for that button. */
407
414
  useCredentialsHint: string;
408
415
  }
416
+ declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
417
+
409
418
  /** Strings rendered by `<ResetPasswordForm>`. */
410
419
  interface ResetPasswordFormLabels {
411
420
  title: string;
@@ -427,19 +436,6 @@ interface ResetPasswordFormLabels {
427
436
  /** Error: a network / 5xx failure. */
428
437
  errorNetwork: string;
429
438
  }
430
- declare const DEFAULT_LOGIN_LABELS: LoginFormLabels;
431
- declare const DEFAULT_FORGOT_PASSWORD_LABELS: ForgotPasswordFormLabels;
432
- declare const DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS: ForgotPasswordFieldsLabels;
433
- declare const DEFAULT_OTP_LABELS: OtpFormLabels;
434
- declare const DEFAULT_PIN_LABELS: PinFormLabels;
435
- declare const DEFAULT_DEVICE_PIN_UNLOCK_LABELS: DevicePinUnlockLabels;
436
- declare const DEFAULT_DEVICE_PIN_ENROLL_LABELS: DevicePinEnrollLabels;
437
- declare const DEFAULT_DEVICE_PIN_SETTINGS_LABELS: DevicePinSettingsLabels;
438
- declare const DEFAULT_PASSKEY_LOGIN_LABELS: PasskeyLoginLabels;
439
- declare const DEFAULT_PASSKEY_SETTINGS_LABELS: PasskeySettingsLabels;
440
- declare const DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS: PreferredMethodSettingsLabels;
441
- declare const DEFAULT_PREFERRED_METHOD_HINT_LABELS: PreferredMethodHintLabels;
442
- declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
443
439
  declare const DEFAULT_RESET_PASSWORD_LABELS: ResetPasswordFormLabels;
444
440
 
445
441
  /**
@@ -464,17 +460,8 @@ declare const enum PrefillIntent {
464
460
  }
465
461
 
466
462
  /**
467
- * `<LoginForm>` — the ready-made, themeable password-login form.
468
- *
469
- * The "themeable component" half of the package design: drop it in, pass a
470
- * `client`, a `theme` (or wrap in `<AuthThemeProvider>`) and a localised
471
- * `labels` bag, and you have a branded login surface. It is built on the
472
- * headless `useBffAuth` hook, so the ready-made and custom-layout paths share
473
- * one code path.
474
- *
475
- * The package ships no router and no i18n. `onSuccess` hands the signed-in
476
- * `BffUser` back to the app, which decides where to navigate (typically via
477
- * `resolvePostLoginRoute`). All copy comes from `labels`.
463
+ * Props for `<LoginForm>`, split out of the component file to keep the render
464
+ * body under the component size limit. Purely a type module — no runtime code.
478
465
  */
479
466
 
480
467
  interface LoginFormProps {
@@ -531,6 +518,21 @@ interface LoginFormProps {
531
518
  */
532
519
  prefillIntent?: PrefillIntent;
533
520
  }
521
+
522
+ /**
523
+ * `<LoginForm>` — the ready-made, themeable password-login form.
524
+ *
525
+ * The "themeable component" half of the package design: drop it in, pass a
526
+ * `client`, a `theme` (or wrap in `<AuthThemeProvider>`) and a localised
527
+ * `labels` bag, and you have a branded login surface. It is built on the
528
+ * headless `useBffAuth` hook, so the ready-made and custom-layout paths share
529
+ * one code path.
530
+ *
531
+ * The package ships no router and no i18n. `onSuccess` hands the signed-in
532
+ * `BffUser` back to the app, which decides where to navigate (typically via
533
+ * `resolvePostLoginRoute`). All copy comes from `labels`.
534
+ */
535
+
534
536
  /** Themeable password-login form built on `useBffAuth`. */
535
537
  declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, chromeless, initialUsername, initialPassword, prefillNonce, prefillIntent, }: Readonly<LoginFormProps>): ReactElement;
536
538
 
package/dist/index.js CHANGED
@@ -114,7 +114,7 @@ function AuthScreen({
114
114
  ] });
115
115
  }
116
116
 
117
- // src/components/labels.ts
117
+ // src/components/labels/loginLabels.ts
118
118
  var DEFAULT_LOGIN_LABELS = {
119
119
  title: "Sign in",
120
120
  subtitle: "Welcome back",
@@ -129,6 +129,8 @@ var DEFAULT_LOGIN_LABELS = {
129
129
  invalidCredentials: "Incorrect username or password.",
130
130
  missingFields: "Enter both your username and password."
131
131
  };
132
+
133
+ // src/components/labels/forgotPasswordLabels.ts
132
134
  var DEFAULT_FORGOT_PASSWORD_LABELS = {
133
135
  title: "Forgot password",
134
136
  description: "Enter your email and we will send you a reset link.",
@@ -145,6 +147,8 @@ var DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS = {
145
147
  cancel: "Cancel",
146
148
  close: "Close"
147
149
  };
150
+
151
+ // src/components/labels/otpLabels.ts
148
152
  var DEFAULT_OTP_LABELS = {
149
153
  requestTitle: "Sign in with a code",
150
154
  requestDescription: "Enter your email and we will send you a one-time code.",
@@ -165,6 +169,8 @@ var DEFAULT_OTP_LABELS = {
165
169
  resending: "Resending...",
166
170
  changeEmail: "Use a different email"
167
171
  };
172
+
173
+ // src/components/labels/pinLabels.ts
168
174
  var DEFAULT_PIN_LABELS = {
169
175
  title: "Enter your event PIN",
170
176
  description: "Enter the PIN for this event to sign in.",
@@ -175,6 +181,8 @@ var DEFAULT_PIN_LABELS = {
175
181
  missingPin: "Enter your event PIN.",
176
182
  invalidPin: "That PIN is incorrect, has expired, or is locked out."
177
183
  };
184
+
185
+ // src/components/labels/devicePinLabels.ts
178
186
  var DEFAULT_DEVICE_PIN_UNLOCK_LABELS = {
179
187
  title: "Welcome back, {name}",
180
188
  titleNoName: "Welcome back",
@@ -232,6 +240,8 @@ var DEFAULT_DEVICE_PIN_SETTINGS_LABELS = {
232
240
  disabling: "Disabling...",
233
241
  disableFailed: "Could not disable PIN sign-in. Try again later."
234
242
  };
243
+
244
+ // src/components/labels/passkeyLabels.ts
235
245
  var DEFAULT_PASSKEY_LOGIN_LABELS = {
236
246
  signInButton: "Sign in with a passkey",
237
247
  signInHint: "Use your fingerprint, face, or security key to sign in",
@@ -247,6 +257,8 @@ var DEFAULT_PASSKEY_SETTINGS_LABELS = {
247
257
  addHint: "Start setting up a passkey for this account",
248
258
  registeredSuccess: "Your passkey was added. You can now use it to sign in."
249
259
  };
260
+
261
+ // src/components/labels/preferredMethodLabels.ts
250
262
  var DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS = {
251
263
  title: "Preferred sign-in method",
252
264
  description: "Pick how you usually sign in. We will show this method first on your devices.",
@@ -262,6 +274,8 @@ var DEFAULT_PREFERRED_METHOD_HINT_LABELS = {
262
274
  pin: "You usually sign in with your quick PIN on this account.",
263
275
  passkey: "You usually sign in with a passkey."
264
276
  };
277
+
278
+ // src/components/labels/demoLabels.ts
265
279
  var DEFAULT_DEMO_CREDENTIALS_HINT_LABELS = {
266
280
  title: "Demo access",
267
281
  description: "Explore the full product with our shared demo account.",
@@ -270,6 +284,8 @@ var DEFAULT_DEMO_CREDENTIALS_HINT_LABELS = {
270
284
  useCredentials: "Use these credentials",
271
285
  useCredentialsHint: "Fill the sign-in form with the demo username and password"
272
286
  };
287
+
288
+ // src/components/labels/resetPasswordLabels.ts
273
289
  var DEFAULT_RESET_PASSWORD_LABELS = {
274
290
  title: "Reset password",
275
291
  description: "Choose a new password for your account.",
@@ -523,6 +539,35 @@ function useLoginPrefill({
523
539
  }
524
540
  return { username, password, setUsername, setPassword };
525
541
  }
542
+ function useLoginSubmit({
543
+ username,
544
+ password,
545
+ login,
546
+ onSuccess,
547
+ missingFieldsLabel,
548
+ invalidCredentialsLabel
549
+ }) {
550
+ const [errorText, setErrorText] = react.useState(null);
551
+ const runLogin = react.useCallback(async () => {
552
+ setErrorText(null);
553
+ const trimmedUsername = username.trim();
554
+ const hasMissingField = trimmedUsername.length === 0 || password.length === 0;
555
+ if (hasMissingField) {
556
+ setErrorText(missingFieldsLabel);
557
+ return;
558
+ }
559
+ try {
560
+ const user = await login({ username: trimmedUsername, password });
561
+ onSuccess(user);
562
+ } catch {
563
+ setErrorText(invalidCredentialsLabel);
564
+ }
565
+ }, [username, password, login, onSuccess, missingFieldsLabel, invalidCredentialsLabel]);
566
+ const handleSubmit = react.useCallback(() => {
567
+ void runLogin();
568
+ }, [runLogin]);
569
+ return { errorText, handleSubmit };
570
+ }
526
571
  var BffAuthStatus = /* @__PURE__ */ ((BffAuthStatus2) => {
527
572
  BffAuthStatus2["Loading"] = "loading";
528
573
  BffAuthStatus2["Authenticated"] = "authenticated";
@@ -653,25 +698,14 @@ function LoginForm({
653
698
  prefillNonce,
654
699
  prefillIntent
655
700
  });
656
- const [errorText, setErrorText] = react.useState(null);
657
- const runLogin = react.useCallback(async () => {
658
- setErrorText(null);
659
- const trimmedUsername = username.trim();
660
- const hasMissingField = trimmedUsername.length === 0 || password.length === 0;
661
- if (hasMissingField) {
662
- setErrorText(labels.missingFields);
663
- return;
664
- }
665
- try {
666
- const user = await login({ username: trimmedUsername, password });
667
- onSuccess(user);
668
- } catch {
669
- setErrorText(labels.invalidCredentials);
670
- }
671
- }, [username, password, login, onSuccess, labels.missingFields, labels.invalidCredentials]);
672
- const handleSubmit = react.useCallback(() => {
673
- void runLogin();
674
- }, [runLogin]);
701
+ const { errorText, handleSubmit } = useLoginSubmit({
702
+ username,
703
+ password,
704
+ login,
705
+ onSuccess,
706
+ missingFieldsLabel: labels.missingFields,
707
+ invalidCredentialsLabel: labels.invalidCredentials
708
+ });
675
709
  const submitButtonStyle = isSubmitting ? [styles3.primaryButton, styles3.primaryButtonDisabled] : styles3.primaryButton;
676
710
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
677
711
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.title, children: labels.title }),