bwh-auth 0.6.2 → 0.6.4

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/README.md CHANGED
@@ -202,6 +202,42 @@ The explicit passkey button and conditional autofill both default to the Laravel
202
202
  - `POST /api/passkeys/auth/options`
203
203
  - `POST /api/passkeys/auth`
204
204
 
205
+ ## Composing login and password recovery
206
+
207
+ As of 0.6.3, `LoginForm` accepts `unwrapped` to render its controls without the
208
+ built-in card and heading. The consumer can keep its own page shell, notices and
209
+ links. `passkeySeparator` supplies optional content before the passkey button;
210
+ both props leave the existing layout unchanged when omitted.
211
+
212
+ `PasswordResetRequestForm` and `ResetPasswordForm` accept `onSubmitStart` to clear
213
+ consumer messages and `submitClassName` to style the submit button. Both forms
214
+ ignore duplicate submissions and disable that button while a request is pending.
215
+
216
+ `ResetPasswordForm` keeps server validation authoritative. Consumers may opt into
217
+ client confirmation matching and a minimum length:
218
+
219
+ ```tsx
220
+ <ResetPasswordForm
221
+ components={getShadcnComponents()}
222
+ token={resetToken}
223
+ email={resetEmail}
224
+ minPasswordLength={8}
225
+ validatePasswordConfirmation
226
+ passwordLabel="New Password"
227
+ passwordConfirmationLabel="Confirm New Password"
228
+ passwordHelpText="Use at least 8 characters"
229
+ idPrefix="account-new-password"
230
+ onError={setError}
231
+ />
232
+ ```
233
+
234
+ The policy props are unset by default. Labels retain their existing defaults;
235
+ `idPrefix` defaults to `reset-password` and changes the field IDs and associated
236
+ labels together, avoiding a collision when the embedding page already uses that
237
+ ID. The consumer owns success/error messages, navigation and any generic
238
+ reset-request acknowledgement needed to protect account privacy. Endpoint and
239
+ CSRF overrides remain available through `endpoints`.
240
+
205
241
  ## Password Change
206
242
 
207
243
  `ChangePasswordForm` is intended for authenticated settings pages or dialogs. The consuming app owns the wrapper and backend endpoint; the form posts to `/api/change-password` by default and accepts `endpoints.changePassword` for apps that use a different route.
@@ -294,6 +330,35 @@ Passkey components default to the Laravel package routes:
294
330
  - `POST /api/passkeys/auth/options`
295
331
  - `POST /api/passkeys/auth`
296
332
 
333
+ ## Development toolchain
334
+
335
+ Use pnpm 12.18.0 and Node 22.22.2+, 24.15.0+, or 26+. The supported Node
336
+ ranges match the build/test dependencies; CI covers both minimum versions and
337
+ Node 26. Run focused checks locally and use CI for the full tests, typecheck,
338
+ build and packed-consumer matrix.
339
+
340
+ Typechecking uses TypeScript 7.0.2 explicitly. The `typescript` dependency is
341
+ intentionally an alias to the last JavaScript compiler (`@typescript/typescript6`)
342
+ for tsup's declaration bundler only. tsup 9 still calls `createProgram` and
343
+ `createCompilerHost`; TypeScript 7.0's main export has neither API. Removing that
344
+ alias requires an upstream declaration-bundler migration, not an unchecked swap
345
+ to a native compiler. See the [TypeScript 7.0 API notes](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/).
346
+
347
+ CI installs the packed artifact into isolated consumers with React 18.3.1 /
348
+ Lucide 0.468.0 and React 19.3.1 / Lucide 1.72.0. It verifies ESM and CommonJS
349
+ runtime exports and compiles `.mts` and `.cts` consumers with TypeScript 7.
350
+ React 18/19 peer support and the public entrypoints remain unchanged. The release
351
+ workflow repeats the packed-consumer check before publishing.
352
+
353
+ ### 0.6.4 dependency refresh
354
+
355
+ This patch publishes the pnpm 12.18.0, tsup 9 and TypeScript 7 toolchain refresh,
356
+ updates the development and packed-consumer Lucide dependency to 1.72.0, and runs
357
+ the packed-consumer checks above. The package's Node engine now requires
358
+ `^22.22.2 || ^24.15.0 || >=26.0.0`, matching its supported build dependencies.
359
+ React 18/19 and Lucide `>=0.468.0 <2.0.0` peer ranges remain unchanged. There are
360
+ no authentication API, component-prop or public-export changes.
361
+
297
362
  ## Releasing
298
363
 
299
364
  Prepare a release from this package directory:
package/dist/index.cjs CHANGED
@@ -437,6 +437,8 @@ function LoginForm({
437
437
  onSubmitStart,
438
438
  onTwoFactorRequired,
439
439
  onPasskeySuccess,
440
+ unwrapped = false,
441
+ passkeySeparator,
440
442
  enablePasskeys = false,
441
443
  enablePasskeyAutofill = enablePasskeys
442
444
  }) {
@@ -523,47 +525,47 @@ function LoginForm({
523
525
  setLoading(false);
524
526
  }
525
527
  }
526
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Card, { children: [
527
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CardHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CardTitle, { children: "Sign In" }) }),
528
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(CardContent, { children: [
529
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
530
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
531
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "login-email", children: "Email" }),
532
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
533
- Input,
534
- {
535
- id: "login-email",
536
- type: "email",
537
- autoComplete: conditionalPasskeyAvailable ? "username webauthn" : "email",
538
- required: true,
539
- value: email,
540
- onChange: (event) => {
541
- setEmail(event.target.value);
542
- onEmailChange?.(event.target.value);
543
- }
544
- }
545
- )
546
- ] }),
547
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
548
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "login-password", children: "Password" }),
549
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "login-password", type: "password", autoComplete: "current-password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
550
- ] }),
551
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
552
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
553
- RememberMeCheckbox,
554
- {
555
- id: "login-remember",
556
- "aria-labelledby": "login-remember-label",
557
- "data-test": rememberMeDataTest,
558
- checked: remember,
559
- onCheckedChange: setRemember
528
+ const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
529
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
530
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
531
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "login-email", children: "Email" }),
532
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
533
+ Input,
534
+ {
535
+ id: "login-email",
536
+ type: "email",
537
+ autoComplete: conditionalPasskeyAvailable ? "username webauthn" : "email",
538
+ required: true,
539
+ value: email,
540
+ onChange: (event) => {
541
+ setEmail(event.target.value);
542
+ onEmailChange?.(event.target.value);
560
543
  }
561
- ),
562
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { id: "login-remember-label", htmlFor: "login-remember", children: rememberMeLabel })
563
- ] }),
564
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { type: "submit", className: "w-full", disabled: loading, children: loading ? "Signing in..." : "Sign In" })
544
+ }
545
+ )
565
546
  ] }),
566
- enablePasskeys ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PasskeyAuthenticationContext.Provider, { value: coordinatedAuthentication, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
547
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
548
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "login-password", children: "Password" }),
549
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "login-password", type: "password", autoComplete: "current-password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
550
+ ] }),
551
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
552
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
553
+ RememberMeCheckbox,
554
+ {
555
+ id: "login-remember",
556
+ "aria-labelledby": "login-remember-label",
557
+ "data-test": rememberMeDataTest,
558
+ checked: remember,
559
+ onCheckedChange: setRemember
560
+ }
561
+ ),
562
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { id: "login-remember-label", htmlFor: "login-remember", children: rememberMeLabel })
563
+ ] }),
564
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { type: "submit", className: "w-full", disabled: loading, children: loading ? "Signing in..." : "Sign In" })
565
+ ] }),
566
+ enablePasskeys ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mt-4", children: [
567
+ passkeySeparator,
568
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PasskeyAuthenticationContext.Provider, { value: coordinatedAuthentication, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
567
569
  PasskeyLoginButton,
568
570
  {
569
571
  components: { Button },
@@ -579,8 +581,12 @@ function LoginForm({
579
581
  },
580
582
  onError
581
583
  }
582
- ) }) }) : null
583
- ] })
584
+ ) })
585
+ ] }) : null
586
+ ] });
587
+ return unwrapped ? content : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Card, { children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CardHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CardTitle, { children: "Sign In" }) }),
589
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CardContent, { children: content })
584
590
  ] });
585
591
  }
586
592
  function defaultSignupFields() {
@@ -700,12 +706,16 @@ function SignupForm({
700
706
  ] }) })
701
707
  ] });
702
708
  }
703
- function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError }) {
709
+ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError, onSubmitStart, submitClassName }) {
704
710
  const { Button, Input, Label } = resolveAuthComponents(components);
705
711
  const [email, setEmail] = React3.useState("");
706
712
  const [loading, setLoading] = React3.useState(false);
713
+ const submitting = React3.useRef(false);
707
714
  async function onSubmit(event) {
708
715
  event.preventDefault();
716
+ if (submitting.current) return;
717
+ submitting.current = true;
718
+ onSubmitStart?.();
709
719
  setLoading(true);
710
720
  try {
711
721
  const result = await postForm(endpoints.forgotPassword ?? "/api/auth/forgot-password", { email }, endpoints.csrfToken);
@@ -713,6 +723,7 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
713
723
  } catch (error) {
714
724
  onError?.(error instanceof Error ? error.message : "Password reset request failed");
715
725
  } finally {
726
+ submitting.current = false;
716
727
  setLoading(false);
717
728
  }
718
729
  }
@@ -721,17 +732,46 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
721
732
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "reset-email", children: "Email" }),
722
733
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "reset-email", type: "email", autoComplete: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
723
734
  ] }),
724
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { type: "submit", disabled: loading, children: loading ? "Sending..." : "Send Reset Link" })
735
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { type: "submit", className: submitClassName, disabled: loading, children: loading ? "Sending..." : "Send Reset Link" })
725
736
  ] });
726
737
  }
727
- function ResetPasswordForm({ endpoints = {}, components, onSuccess, onError, token: initialToken = "", email: initialEmail = "" }) {
738
+ function ResetPasswordForm({
739
+ endpoints = {},
740
+ components,
741
+ onSuccess,
742
+ onError,
743
+ onSubmitStart,
744
+ submitClassName,
745
+ token: initialToken = "",
746
+ email: initialEmail = "",
747
+ idPrefix = "reset-password",
748
+ minPasswordLength,
749
+ validatePasswordConfirmation = false,
750
+ passwordLabel = "Password",
751
+ passwordConfirmationLabel = "Confirm Password",
752
+ passwordHelpText
753
+ }) {
728
754
  const { Button, Input, Label } = resolveAuthComponents(components);
729
755
  const [email, setEmail] = React3.useState(initialEmail);
730
756
  const [token, setToken] = React3.useState(initialToken);
731
757
  const [password, setPassword] = React3.useState("");
732
758
  const [passwordConfirmation, setPasswordConfirmation] = React3.useState("");
759
+ const [loading, setLoading] = React3.useState(false);
760
+ const submitting = React3.useRef(false);
733
761
  async function onSubmit(event) {
734
762
  event.preventDefault();
763
+ if (submitting.current) return;
764
+ onSubmitStart?.();
765
+ if (validatePasswordConfirmation && password !== passwordConfirmation) {
766
+ onError?.("Passwords do not match.");
767
+ return;
768
+ }
769
+ if (minPasswordLength !== void 0 && password.length < minPasswordLength) {
770
+ onError?.(`Password must be at least ${minPasswordLength} characters long.`);
771
+ return;
772
+ }
773
+ submitting.current = true;
774
+ setLoading(true);
735
775
  try {
736
776
  const result = await postForm(endpoints.resetPassword ?? "/api/auth/reset-password", {
737
777
  email,
@@ -742,23 +782,27 @@ function ResetPasswordForm({ endpoints = {}, components, onSuccess, onError, tok
742
782
  onSuccess?.(result);
743
783
  } catch (error) {
744
784
  onError?.(error instanceof Error ? error.message : "Password reset failed");
785
+ } finally {
786
+ submitting.current = false;
787
+ setLoading(false);
745
788
  }
746
789
  }
747
790
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
748
791
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { type: "hidden", value: token, onChange: (event) => setToken(event.target.value) }),
749
792
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
750
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "reset-password-email", children: "Email" }),
751
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "reset-password-email", type: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
793
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: `${idPrefix}-email`, children: "Email" }),
794
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: `${idPrefix}-email`, type: "email", autoComplete: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
752
795
  ] }),
753
796
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
754
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "reset-password", children: "Password" }),
755
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "reset-password", type: "password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
797
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: idPrefix, children: passwordLabel }),
798
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: idPrefix, type: "password", autoComplete: "new-password", minLength: minPasswordLength, required: true, value: password, onChange: (event) => setPassword(event.target.value) }),
799
+ passwordHelpText ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-muted-foreground", children: passwordHelpText }) : null
756
800
  ] }),
757
801
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
758
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "reset-password-confirmation", children: "Confirm Password" }),
759
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "reset-password-confirmation", type: "password", required: true, value: passwordConfirmation, onChange: (event) => setPasswordConfirmation(event.target.value) })
802
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: `${idPrefix}-confirmation`, children: passwordConfirmationLabel }),
803
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: `${idPrefix}-confirmation`, type: "password", autoComplete: "new-password", minLength: minPasswordLength, required: true, value: passwordConfirmation, onChange: (event) => setPasswordConfirmation(event.target.value) })
760
804
  ] }),
761
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { type: "submit", children: "Reset Password" })
805
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { type: "submit", className: submitClassName, disabled: loading, children: loading ? "Resetting..." : "Reset Password" })
762
806
  ] });
763
807
  }
764
808
  function ChangePasswordForm({ endpoints = {}, components, onSuccess, onError }) {
package/dist/index.d.cts CHANGED
@@ -120,6 +120,9 @@ interface LoginRememberMeCheckboxProps {
120
120
  'data-test'?: string;
121
121
  }
122
122
  interface LoginFormProps extends AuthFormProps {
123
+ /** Render only the controls when the consumer owns the card and heading. */
124
+ unwrapped?: boolean;
125
+ passkeySeparator?: React.ReactNode;
123
126
  enablePasskeys?: boolean;
124
127
  enablePasskeyAutofill?: boolean;
125
128
  initialEmail?: string;
@@ -144,19 +147,30 @@ interface SignupFormProps extends Omit<AuthFormProps, 'onSuccess'> {
144
147
  submittingLabel?: React.ReactNode;
145
148
  onSuccess?: (result: AuthJsonResponse, values: AuthSignupValues) => void | Promise<void>;
146
149
  }
147
- interface ResetPasswordFormProps extends AuthFormProps {
150
+ interface PasswordResetRequestFormProps extends AuthFormProps {
151
+ onSubmitStart?: () => void;
152
+ submitClassName?: string;
153
+ }
154
+ interface ResetPasswordFormProps extends PasswordResetRequestFormProps {
148
155
  token?: string;
149
156
  email?: string;
157
+ /** Override field IDs when the embedding page already uses the default ID. */
158
+ idPrefix?: string;
159
+ minPasswordLength?: number;
160
+ validatePasswordConfirmation?: boolean;
161
+ passwordLabel?: React.ReactNode;
162
+ passwordConfirmationLabel?: React.ReactNode;
163
+ passwordHelpText?: React.ReactNode;
150
164
  }
151
165
  interface TwoFactorFormProps extends AuthFormProps {
152
166
  attemptToken: string;
153
167
  appEnv?: string;
154
168
  onReportSuspicious?: (result: AuthJsonResponse) => void;
155
169
  }
156
- declare function LoginForm({ endpoints, components, onSuccess, onError, initialEmail, onEmailChange, rememberMeCheckbox: RememberMeCheckbox, rememberMeLabel, rememberMeDataTest, onSubmitStart, onTwoFactorRequired, onPasskeySuccess, enablePasskeys, enablePasskeyAutofill, }: LoginFormProps): React.JSX.Element;
170
+ declare function LoginForm({ endpoints, components, onSuccess, onError, initialEmail, onEmailChange, rememberMeCheckbox: RememberMeCheckbox, rememberMeLabel, rememberMeDataTest, onSubmitStart, onTwoFactorRequired, onPasskeySuccess, unwrapped, passkeySeparator, enablePasskeys, enablePasskeyAutofill, }: LoginFormProps): React.JSX.Element;
157
171
  declare function SignupForm({ endpoints, components, onSuccess, onError, fields, initialValues, errors, submitMode, title, description, submitLabel, submittingLabel, }: SignupFormProps): React.JSX.Element;
158
- declare function PasswordResetRequestForm({ endpoints, components, onSuccess, onError }: AuthFormProps): React.JSX.Element;
159
- declare function ResetPasswordForm({ endpoints, components, onSuccess, onError, token: initialToken, email: initialEmail }: ResetPasswordFormProps): React.JSX.Element;
172
+ declare function PasswordResetRequestForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName }: PasswordResetRequestFormProps): React.JSX.Element;
173
+ declare function ResetPasswordForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName, token: initialToken, email: initialEmail, idPrefix, minPasswordLength, validatePasswordConfirmation, passwordLabel, passwordConfirmationLabel, passwordHelpText, }: ResetPasswordFormProps): React.JSX.Element;
160
174
  declare function ChangePasswordForm({ endpoints, components, onSuccess, onError }: AuthFormProps): React.JSX.Element;
161
175
  declare function TwoFactorForm({ endpoints, components, attemptToken, appEnv, onSuccess, onError, onReportSuspicious }: TwoFactorFormProps): React.JSX.Element;
162
176
 
@@ -410,4 +424,5 @@ declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken,
410
424
  /** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
411
425
  declare function describeDuration(spec: string): string;
412
426
 
413
- export { type ApiCredentialApp, type ApiCredentialEndpointLink, type ApiCredentialIndex, type ApiCredentialRequest, type ApiCredentialRequestResult, type ApiCredentialScope, type ApiCredentialScopeGroup, type ApiCredentialScopePreset, type ApiCredentialToken, ApiCredentialsSection, type ApiCredentialsSectionProps, type AuthBadgeComponentProps, type AuthButtonComponent, type AuthButtonComponentInput, type AuthButtonComponentProps, type AuthButtonSize, type AuthButtonVariant, type AuthCheckboxComponentProps, type AuthComponentInput, type AuthComponentOverrides, type AuthComponentSet, type AuthComponentSuperset, type AuthComponents, type AuthContainerComponentProps, type AuthEndpointConfig, type AuthInputComponentProps, type AuthJsonResponse, type AuthLabelComponentProps, type AuthRadioGroupComponentProps, type AuthRadioGroupOption, type AuthSignupField, type AuthSignupValues, type AuthTextareaComponentProps, type AuthValidationErrors, ChangePasswordForm, type IssuedApiCredential, LoginForm, type LoginFormProps, type LoginRememberMeCheckboxProps, type Passkey, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, type RelyingApplication, ResetPasswordForm, type ScopeImplications, ScopePicker, type ScopePickerProps, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, closeImplications, describeDuration, getCsrfToken, getDefaultPasskeyName, inCatalogOrder, isAbortError, isConditionalMediationAvailable, neededBy, registerPasskey, relyingApplicationsFrom, restrictImplications, safeApplicationHref, sameSelection, withScopes, withoutScopes };
427
+ export { ApiCredentialsSection, ChangePasswordForm, LoginForm, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, ResetPasswordForm, ScopePicker, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, closeImplications, describeDuration, getCsrfToken, getDefaultPasskeyName, inCatalogOrder, isAbortError, isConditionalMediationAvailable, neededBy, registerPasskey, relyingApplicationsFrom, restrictImplications, safeApplicationHref, sameSelection, withScopes, withoutScopes };
428
+ export type { ApiCredentialApp, ApiCredentialEndpointLink, ApiCredentialIndex, ApiCredentialRequest, ApiCredentialRequestResult, ApiCredentialScope, ApiCredentialScopeGroup, ApiCredentialScopePreset, ApiCredentialToken, ApiCredentialsSectionProps, AuthBadgeComponentProps, AuthButtonComponent, AuthButtonComponentInput, AuthButtonComponentProps, AuthButtonSize, AuthButtonVariant, AuthCheckboxComponentProps, AuthComponentInput, AuthComponentOverrides, AuthComponentSet, AuthComponentSuperset, AuthComponents, AuthContainerComponentProps, AuthEndpointConfig, AuthInputComponentProps, AuthJsonResponse, AuthLabelComponentProps, AuthRadioGroupComponentProps, AuthRadioGroupOption, AuthSignupField, AuthSignupValues, AuthTextareaComponentProps, AuthValidationErrors, IssuedApiCredential, LoginFormProps, LoginRememberMeCheckboxProps, Passkey, PasswordResetRequestFormProps, RelyingApplication, ResetPasswordFormProps, ScopeImplications, ScopePickerProps };
package/dist/index.d.ts CHANGED
@@ -120,6 +120,9 @@ interface LoginRememberMeCheckboxProps {
120
120
  'data-test'?: string;
121
121
  }
122
122
  interface LoginFormProps extends AuthFormProps {
123
+ /** Render only the controls when the consumer owns the card and heading. */
124
+ unwrapped?: boolean;
125
+ passkeySeparator?: React.ReactNode;
123
126
  enablePasskeys?: boolean;
124
127
  enablePasskeyAutofill?: boolean;
125
128
  initialEmail?: string;
@@ -144,19 +147,30 @@ interface SignupFormProps extends Omit<AuthFormProps, 'onSuccess'> {
144
147
  submittingLabel?: React.ReactNode;
145
148
  onSuccess?: (result: AuthJsonResponse, values: AuthSignupValues) => void | Promise<void>;
146
149
  }
147
- interface ResetPasswordFormProps extends AuthFormProps {
150
+ interface PasswordResetRequestFormProps extends AuthFormProps {
151
+ onSubmitStart?: () => void;
152
+ submitClassName?: string;
153
+ }
154
+ interface ResetPasswordFormProps extends PasswordResetRequestFormProps {
148
155
  token?: string;
149
156
  email?: string;
157
+ /** Override field IDs when the embedding page already uses the default ID. */
158
+ idPrefix?: string;
159
+ minPasswordLength?: number;
160
+ validatePasswordConfirmation?: boolean;
161
+ passwordLabel?: React.ReactNode;
162
+ passwordConfirmationLabel?: React.ReactNode;
163
+ passwordHelpText?: React.ReactNode;
150
164
  }
151
165
  interface TwoFactorFormProps extends AuthFormProps {
152
166
  attemptToken: string;
153
167
  appEnv?: string;
154
168
  onReportSuspicious?: (result: AuthJsonResponse) => void;
155
169
  }
156
- declare function LoginForm({ endpoints, components, onSuccess, onError, initialEmail, onEmailChange, rememberMeCheckbox: RememberMeCheckbox, rememberMeLabel, rememberMeDataTest, onSubmitStart, onTwoFactorRequired, onPasskeySuccess, enablePasskeys, enablePasskeyAutofill, }: LoginFormProps): React.JSX.Element;
170
+ declare function LoginForm({ endpoints, components, onSuccess, onError, initialEmail, onEmailChange, rememberMeCheckbox: RememberMeCheckbox, rememberMeLabel, rememberMeDataTest, onSubmitStart, onTwoFactorRequired, onPasskeySuccess, unwrapped, passkeySeparator, enablePasskeys, enablePasskeyAutofill, }: LoginFormProps): React.JSX.Element;
157
171
  declare function SignupForm({ endpoints, components, onSuccess, onError, fields, initialValues, errors, submitMode, title, description, submitLabel, submittingLabel, }: SignupFormProps): React.JSX.Element;
158
- declare function PasswordResetRequestForm({ endpoints, components, onSuccess, onError }: AuthFormProps): React.JSX.Element;
159
- declare function ResetPasswordForm({ endpoints, components, onSuccess, onError, token: initialToken, email: initialEmail }: ResetPasswordFormProps): React.JSX.Element;
172
+ declare function PasswordResetRequestForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName }: PasswordResetRequestFormProps): React.JSX.Element;
173
+ declare function ResetPasswordForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName, token: initialToken, email: initialEmail, idPrefix, minPasswordLength, validatePasswordConfirmation, passwordLabel, passwordConfirmationLabel, passwordHelpText, }: ResetPasswordFormProps): React.JSX.Element;
160
174
  declare function ChangePasswordForm({ endpoints, components, onSuccess, onError }: AuthFormProps): React.JSX.Element;
161
175
  declare function TwoFactorForm({ endpoints, components, attemptToken, appEnv, onSuccess, onError, onReportSuspicious }: TwoFactorFormProps): React.JSX.Element;
162
176
 
@@ -410,4 +424,5 @@ declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken,
410
424
  /** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
411
425
  declare function describeDuration(spec: string): string;
412
426
 
413
- export { type ApiCredentialApp, type ApiCredentialEndpointLink, type ApiCredentialIndex, type ApiCredentialRequest, type ApiCredentialRequestResult, type ApiCredentialScope, type ApiCredentialScopeGroup, type ApiCredentialScopePreset, type ApiCredentialToken, ApiCredentialsSection, type ApiCredentialsSectionProps, type AuthBadgeComponentProps, type AuthButtonComponent, type AuthButtonComponentInput, type AuthButtonComponentProps, type AuthButtonSize, type AuthButtonVariant, type AuthCheckboxComponentProps, type AuthComponentInput, type AuthComponentOverrides, type AuthComponentSet, type AuthComponentSuperset, type AuthComponents, type AuthContainerComponentProps, type AuthEndpointConfig, type AuthInputComponentProps, type AuthJsonResponse, type AuthLabelComponentProps, type AuthRadioGroupComponentProps, type AuthRadioGroupOption, type AuthSignupField, type AuthSignupValues, type AuthTextareaComponentProps, type AuthValidationErrors, ChangePasswordForm, type IssuedApiCredential, LoginForm, type LoginFormProps, type LoginRememberMeCheckboxProps, type Passkey, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, type RelyingApplication, ResetPasswordForm, type ScopeImplications, ScopePicker, type ScopePickerProps, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, closeImplications, describeDuration, getCsrfToken, getDefaultPasskeyName, inCatalogOrder, isAbortError, isConditionalMediationAvailable, neededBy, registerPasskey, relyingApplicationsFrom, restrictImplications, safeApplicationHref, sameSelection, withScopes, withoutScopes };
427
+ export { ApiCredentialsSection, ChangePasswordForm, LoginForm, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, ResetPasswordForm, ScopePicker, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, closeImplications, describeDuration, getCsrfToken, getDefaultPasskeyName, inCatalogOrder, isAbortError, isConditionalMediationAvailable, neededBy, registerPasskey, relyingApplicationsFrom, restrictImplications, safeApplicationHref, sameSelection, withScopes, withoutScopes };
428
+ export type { ApiCredentialApp, ApiCredentialEndpointLink, ApiCredentialIndex, ApiCredentialRequest, ApiCredentialRequestResult, ApiCredentialScope, ApiCredentialScopeGroup, ApiCredentialScopePreset, ApiCredentialToken, ApiCredentialsSectionProps, AuthBadgeComponentProps, AuthButtonComponent, AuthButtonComponentInput, AuthButtonComponentProps, AuthButtonSize, AuthButtonVariant, AuthCheckboxComponentProps, AuthComponentInput, AuthComponentOverrides, AuthComponentSet, AuthComponentSuperset, AuthComponents, AuthContainerComponentProps, AuthEndpointConfig, AuthInputComponentProps, AuthJsonResponse, AuthLabelComponentProps, AuthRadioGroupComponentProps, AuthRadioGroupOption, AuthSignupField, AuthSignupValues, AuthTextareaComponentProps, AuthValidationErrors, IssuedApiCredential, LoginFormProps, LoginRememberMeCheckboxProps, Passkey, PasswordResetRequestFormProps, RelyingApplication, ResetPasswordFormProps, ScopeImplications, ScopePickerProps };
package/dist/index.js CHANGED
@@ -316,7 +316,7 @@ function PasskeyLoginButton({ endpoints = {}, components, className, disabled =
316
316
  }
317
317
 
318
318
  // src/forms.tsx
319
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
319
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
320
320
  var AuthRequestError = class extends Error {
321
321
  constructor(message, result) {
322
322
  super(message);
@@ -374,6 +374,8 @@ function LoginForm({
374
374
  onSubmitStart,
375
375
  onTwoFactorRequired,
376
376
  onPasskeySuccess,
377
+ unwrapped = false,
378
+ passkeySeparator,
377
379
  enablePasskeys = false,
378
380
  enablePasskeyAutofill = enablePasskeys
379
381
  }) {
@@ -460,47 +462,47 @@ function LoginForm({
460
462
  setLoading(false);
461
463
  }
462
464
  }
463
- return /* @__PURE__ */ jsxs2(Card, { children: [
464
- /* @__PURE__ */ jsx2(CardHeader, { children: /* @__PURE__ */ jsx2(CardTitle, { children: "Sign In" }) }),
465
- /* @__PURE__ */ jsxs2(CardContent, { children: [
466
- /* @__PURE__ */ jsxs2("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
467
- /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
468
- /* @__PURE__ */ jsx2(Label, { htmlFor: "login-email", children: "Email" }),
469
- /* @__PURE__ */ jsx2(
470
- Input,
471
- {
472
- id: "login-email",
473
- type: "email",
474
- autoComplete: conditionalPasskeyAvailable ? "username webauthn" : "email",
475
- required: true,
476
- value: email,
477
- onChange: (event) => {
478
- setEmail(event.target.value);
479
- onEmailChange?.(event.target.value);
480
- }
481
- }
482
- )
483
- ] }),
484
- /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
485
- /* @__PURE__ */ jsx2(Label, { htmlFor: "login-password", children: "Password" }),
486
- /* @__PURE__ */ jsx2(Input, { id: "login-password", type: "password", autoComplete: "current-password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
487
- ] }),
488
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-sm", children: [
489
- /* @__PURE__ */ jsx2(
490
- RememberMeCheckbox,
491
- {
492
- id: "login-remember",
493
- "aria-labelledby": "login-remember-label",
494
- "data-test": rememberMeDataTest,
495
- checked: remember,
496
- onCheckedChange: setRemember
465
+ const content = /* @__PURE__ */ jsxs2(Fragment, { children: [
466
+ /* @__PURE__ */ jsxs2("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
467
+ /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
468
+ /* @__PURE__ */ jsx2(Label, { htmlFor: "login-email", children: "Email" }),
469
+ /* @__PURE__ */ jsx2(
470
+ Input,
471
+ {
472
+ id: "login-email",
473
+ type: "email",
474
+ autoComplete: conditionalPasskeyAvailable ? "username webauthn" : "email",
475
+ required: true,
476
+ value: email,
477
+ onChange: (event) => {
478
+ setEmail(event.target.value);
479
+ onEmailChange?.(event.target.value);
497
480
  }
498
- ),
499
- /* @__PURE__ */ jsx2(Label, { id: "login-remember-label", htmlFor: "login-remember", children: rememberMeLabel })
500
- ] }),
501
- /* @__PURE__ */ jsx2(Button, { type: "submit", className: "w-full", disabled: loading, children: loading ? "Signing in..." : "Sign In" })
481
+ }
482
+ )
502
483
  ] }),
503
- enablePasskeys ? /* @__PURE__ */ jsx2("div", { className: "mt-4", children: /* @__PURE__ */ jsx2(PasskeyAuthenticationContext.Provider, { value: coordinatedAuthentication, children: /* @__PURE__ */ jsx2(
484
+ /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
485
+ /* @__PURE__ */ jsx2(Label, { htmlFor: "login-password", children: "Password" }),
486
+ /* @__PURE__ */ jsx2(Input, { id: "login-password", type: "password", autoComplete: "current-password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
487
+ ] }),
488
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-sm", children: [
489
+ /* @__PURE__ */ jsx2(
490
+ RememberMeCheckbox,
491
+ {
492
+ id: "login-remember",
493
+ "aria-labelledby": "login-remember-label",
494
+ "data-test": rememberMeDataTest,
495
+ checked: remember,
496
+ onCheckedChange: setRemember
497
+ }
498
+ ),
499
+ /* @__PURE__ */ jsx2(Label, { id: "login-remember-label", htmlFor: "login-remember", children: rememberMeLabel })
500
+ ] }),
501
+ /* @__PURE__ */ jsx2(Button, { type: "submit", className: "w-full", disabled: loading, children: loading ? "Signing in..." : "Sign In" })
502
+ ] }),
503
+ enablePasskeys ? /* @__PURE__ */ jsxs2("div", { className: "mt-4", children: [
504
+ passkeySeparator,
505
+ /* @__PURE__ */ jsx2(PasskeyAuthenticationContext.Provider, { value: coordinatedAuthentication, children: /* @__PURE__ */ jsx2(
504
506
  PasskeyLoginButton,
505
507
  {
506
508
  components: { Button },
@@ -516,8 +518,12 @@ function LoginForm({
516
518
  },
517
519
  onError
518
520
  }
519
- ) }) }) : null
520
- ] })
521
+ ) })
522
+ ] }) : null
523
+ ] });
524
+ return unwrapped ? content : /* @__PURE__ */ jsxs2(Card, { children: [
525
+ /* @__PURE__ */ jsx2(CardHeader, { children: /* @__PURE__ */ jsx2(CardTitle, { children: "Sign In" }) }),
526
+ /* @__PURE__ */ jsx2(CardContent, { children: content })
521
527
  ] });
522
528
  }
523
529
  function defaultSignupFields() {
@@ -637,12 +643,16 @@ function SignupForm({
637
643
  ] }) })
638
644
  ] });
639
645
  }
640
- function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError }) {
646
+ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError, onSubmitStart, submitClassName }) {
641
647
  const { Button, Input, Label } = resolveAuthComponents(components);
642
648
  const [email, setEmail] = React3.useState("");
643
649
  const [loading, setLoading] = React3.useState(false);
650
+ const submitting = React3.useRef(false);
644
651
  async function onSubmit(event) {
645
652
  event.preventDefault();
653
+ if (submitting.current) return;
654
+ submitting.current = true;
655
+ onSubmitStart?.();
646
656
  setLoading(true);
647
657
  try {
648
658
  const result = await postForm(endpoints.forgotPassword ?? "/api/auth/forgot-password", { email }, endpoints.csrfToken);
@@ -650,6 +660,7 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
650
660
  } catch (error) {
651
661
  onError?.(error instanceof Error ? error.message : "Password reset request failed");
652
662
  } finally {
663
+ submitting.current = false;
653
664
  setLoading(false);
654
665
  }
655
666
  }
@@ -658,17 +669,46 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
658
669
  /* @__PURE__ */ jsx2(Label, { htmlFor: "reset-email", children: "Email" }),
659
670
  /* @__PURE__ */ jsx2(Input, { id: "reset-email", type: "email", autoComplete: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
660
671
  ] }),
661
- /* @__PURE__ */ jsx2(Button, { type: "submit", disabled: loading, children: loading ? "Sending..." : "Send Reset Link" })
672
+ /* @__PURE__ */ jsx2(Button, { type: "submit", className: submitClassName, disabled: loading, children: loading ? "Sending..." : "Send Reset Link" })
662
673
  ] });
663
674
  }
664
- function ResetPasswordForm({ endpoints = {}, components, onSuccess, onError, token: initialToken = "", email: initialEmail = "" }) {
675
+ function ResetPasswordForm({
676
+ endpoints = {},
677
+ components,
678
+ onSuccess,
679
+ onError,
680
+ onSubmitStart,
681
+ submitClassName,
682
+ token: initialToken = "",
683
+ email: initialEmail = "",
684
+ idPrefix = "reset-password",
685
+ minPasswordLength,
686
+ validatePasswordConfirmation = false,
687
+ passwordLabel = "Password",
688
+ passwordConfirmationLabel = "Confirm Password",
689
+ passwordHelpText
690
+ }) {
665
691
  const { Button, Input, Label } = resolveAuthComponents(components);
666
692
  const [email, setEmail] = React3.useState(initialEmail);
667
693
  const [token, setToken] = React3.useState(initialToken);
668
694
  const [password, setPassword] = React3.useState("");
669
695
  const [passwordConfirmation, setPasswordConfirmation] = React3.useState("");
696
+ const [loading, setLoading] = React3.useState(false);
697
+ const submitting = React3.useRef(false);
670
698
  async function onSubmit(event) {
671
699
  event.preventDefault();
700
+ if (submitting.current) return;
701
+ onSubmitStart?.();
702
+ if (validatePasswordConfirmation && password !== passwordConfirmation) {
703
+ onError?.("Passwords do not match.");
704
+ return;
705
+ }
706
+ if (minPasswordLength !== void 0 && password.length < minPasswordLength) {
707
+ onError?.(`Password must be at least ${minPasswordLength} characters long.`);
708
+ return;
709
+ }
710
+ submitting.current = true;
711
+ setLoading(true);
672
712
  try {
673
713
  const result = await postForm(endpoints.resetPassword ?? "/api/auth/reset-password", {
674
714
  email,
@@ -679,23 +719,27 @@ function ResetPasswordForm({ endpoints = {}, components, onSuccess, onError, tok
679
719
  onSuccess?.(result);
680
720
  } catch (error) {
681
721
  onError?.(error instanceof Error ? error.message : "Password reset failed");
722
+ } finally {
723
+ submitting.current = false;
724
+ setLoading(false);
682
725
  }
683
726
  }
684
727
  return /* @__PURE__ */ jsxs2("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
685
728
  /* @__PURE__ */ jsx2(Input, { type: "hidden", value: token, onChange: (event) => setToken(event.target.value) }),
686
729
  /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
687
- /* @__PURE__ */ jsx2(Label, { htmlFor: "reset-password-email", children: "Email" }),
688
- /* @__PURE__ */ jsx2(Input, { id: "reset-password-email", type: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
730
+ /* @__PURE__ */ jsx2(Label, { htmlFor: `${idPrefix}-email`, children: "Email" }),
731
+ /* @__PURE__ */ jsx2(Input, { id: `${idPrefix}-email`, type: "email", autoComplete: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
689
732
  ] }),
690
733
  /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
691
- /* @__PURE__ */ jsx2(Label, { htmlFor: "reset-password", children: "Password" }),
692
- /* @__PURE__ */ jsx2(Input, { id: "reset-password", type: "password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
734
+ /* @__PURE__ */ jsx2(Label, { htmlFor: idPrefix, children: passwordLabel }),
735
+ /* @__PURE__ */ jsx2(Input, { id: idPrefix, type: "password", autoComplete: "new-password", minLength: minPasswordLength, required: true, value: password, onChange: (event) => setPassword(event.target.value) }),
736
+ passwordHelpText ? /* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground", children: passwordHelpText }) : null
693
737
  ] }),
694
738
  /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
695
- /* @__PURE__ */ jsx2(Label, { htmlFor: "reset-password-confirmation", children: "Confirm Password" }),
696
- /* @__PURE__ */ jsx2(Input, { id: "reset-password-confirmation", type: "password", required: true, value: passwordConfirmation, onChange: (event) => setPasswordConfirmation(event.target.value) })
739
+ /* @__PURE__ */ jsx2(Label, { htmlFor: `${idPrefix}-confirmation`, children: passwordConfirmationLabel }),
740
+ /* @__PURE__ */ jsx2(Input, { id: `${idPrefix}-confirmation`, type: "password", autoComplete: "new-password", minLength: minPasswordLength, required: true, value: passwordConfirmation, onChange: (event) => setPasswordConfirmation(event.target.value) })
697
741
  ] }),
698
- /* @__PURE__ */ jsx2(Button, { type: "submit", children: "Reset Password" })
742
+ /* @__PURE__ */ jsx2(Button, { type: "submit", className: submitClassName, disabled: loading, children: loading ? "Resetting..." : "Reset Password" })
699
743
  ] });
700
744
  }
701
745
  function ChangePasswordForm({ endpoints = {}, components, onSuccess, onError }) {
@@ -1033,7 +1077,7 @@ function sameSelection(a, b) {
1033
1077
  }
1034
1078
 
1035
1079
  // src/scope-picker.tsx
1036
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1080
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1037
1081
  function resolveGroups(scopes, groups) {
1038
1082
  if (!Array.isArray(groups) || groups.length === 0) {
1039
1083
  return null;
@@ -1186,7 +1230,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1186
1230
  /* @__PURE__ */ jsx4(Chip, { style: { fontSize: 12, fontWeight: 500, border: "1px solid currentColor", borderRadius: 999, padding: "3px 8px", lineHeight: 1 }, children: "Sensitive" })
1187
1231
  ] }),
1188
1232
  warning !== null && (() => {
1189
- const content = /* @__PURE__ */ jsxs4(Fragment, { children: [
1233
+ const content = /* @__PURE__ */ jsxs4(Fragment2, { children: [
1190
1234
  /* @__PURE__ */ jsx4(TriangleAlert, { "aria-hidden": "true", size: 16, style: { flex: "none", marginTop: 2 } }),
1191
1235
  /* @__PURE__ */ jsx4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: warning })
1192
1236
  ] });
@@ -1246,7 +1290,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
1246
1290
  }
1247
1291
 
1248
1292
  // src/api-credentials-section.tsx
1249
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1293
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1250
1294
  function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError, layout = "stacked" }) {
1251
1295
  const { Card, CardContent, CardDescription, CardHeader, CardTitle } = resolveAuthComponents(components);
1252
1296
  const [index, setIndex] = React6.useState(null);
@@ -1313,7 +1357,7 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
1313
1357
  key
1314
1358
  )),
1315
1359
  loadError !== null && /* @__PURE__ */ jsx5("p", { role: "alert", children: loadError }),
1316
- index !== null && /* @__PURE__ */ jsxs5(Fragment2, { children: [
1360
+ index !== null && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1317
1361
  (index.issue_token_href === null || index.register_app_href === null) && /* @__PURE__ */ jsx5("p", { role: "status", children: "Creating new credentials is unavailable right now. You can still revoke existing ones." }),
1318
1362
  /* @__PURE__ */ jsxs5(
1319
1363
  "div",
@@ -1426,8 +1470,8 @@ function TokenSection({ index, components, csrfToken, request, onIssued, reload,
1426
1470
  /* @__PURE__ */ jsx5("strong", { children: token.name }),
1427
1471
  " \xB7 ",
1428
1472
  token.scopes.join(", "),
1429
- token.connection === true && /* @__PURE__ */ jsx5(Fragment2, { children: " \xB7 MCP connection" }),
1430
- token.expires_at !== null && /* @__PURE__ */ jsxs5(Fragment2, { children: [
1473
+ token.connection === true && /* @__PURE__ */ jsx5(Fragment3, { children: " \xB7 MCP connection" }),
1474
+ token.expires_at !== null && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1431
1475
  " \xB7 expires ",
1432
1476
  new Date(token.expires_at).toLocaleString()
1433
1477
  ] }),
@@ -1515,7 +1559,7 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
1515
1559
  { value: "public", label: "Public: no secret, PKCE only" }
1516
1560
  ]
1517
1561
  }
1518
- ) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
1562
+ ) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
1519
1563
  /* @__PURE__ */ jsxs5("label", { children: [
1520
1564
  /* @__PURE__ */ jsx5("input", { type: "radio", name: "oauth-app-type", checked: confidential, onChange: () => setConfidential(true) }),
1521
1565
  " Confidential: the app keeps a client secret on its server"
@@ -1586,7 +1630,7 @@ function IssuedNotice({
1586
1630
  function CopyButton({ text, label, components }) {
1587
1631
  const { Button } = resolveAuthComponents(components);
1588
1632
  const [state, setState] = React6.useState("idle");
1589
- return /* @__PURE__ */ jsxs5(Fragment2, { children: [
1633
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
1590
1634
  /* @__PURE__ */ jsx5(
1591
1635
  Button,
1592
1636
  {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "bwh-auth",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Shared React auth UI and browser WebAuthn helpers for BWH applications.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "packageManager": "pnpm@12.11.2",
7
+ "packageManager": "pnpm@12.18.0",
8
8
  "engines": {
9
- "node": ">=22"
9
+ "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
@@ -35,9 +35,10 @@
35
35
  "build": "tsup src/index.ts --format esm,cjs --dts --dts-resolve --tsconfig tsconfig.build.json",
36
36
  "release": "node scripts/release.mjs",
37
37
  "test": "vitest run",
38
- "typecheck": "tsc --noEmit",
38
+ "typecheck": "node node_modules/@typescript/native/bin/tsc --noEmit",
39
39
  "prepare": "pnpm run build",
40
- "postinstall": "node scripts/spotlight-noindex.mjs"
40
+ "postinstall": "node scripts/spotlight-noindex.mjs",
41
+ "verify-package": "node scripts/verify-package.mjs"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "lucide-react": ">=0.468.0 <2.0.0",
@@ -47,18 +48,19 @@
47
48
  "devDependencies": {
48
49
  "@testing-library/dom": "^10.4.2",
49
50
  "@testing-library/react": "^16.3.3",
50
- "@types/node": "^26.4.1",
51
- "@types/react": "^19.2.18",
52
- "@types/react-dom": "^19.2.7",
51
+ "@types/node": "^26.6.6",
52
+ "@types/react": "^19.3.0",
53
+ "@types/react-dom": "^19.3.0",
53
54
  "@typescript/native": "npm:typescript@^7.0.2",
54
55
  "esbuild": "0.28.2",
55
- "jsdom": "^27.4.0",
56
- "lucide-react": "^0.577.0",
57
- "react": "^19.2.8",
58
- "react-dom": "^19.2.8",
56
+ "jsdom": "^31.0.0",
57
+ "lucide-react": "^1.72.0",
58
+ "react": "^19.3.1",
59
+ "react-dom": "^19.3.1",
59
60
  "spotlight-noindex": "1.1.1",
60
- "tsup": "^8.5.1",
61
+ "tsup": "^9.0.0",
61
62
  "typescript": "npm:@typescript/typescript6@^6.0.2",
62
- "vitest": "^5.0.5"
63
+ "vite": "^7.3.8",
64
+ "vitest": "^5.1.0"
63
65
  }
64
66
  }