bwh-auth 0.6.1 → 0.6.3
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 +44 -0
- package/dist/index.cjs +115 -60
- package/dist/index.d.cts +24 -7
- package/dist/index.d.ts +24 -7
- package/dist/index.js +124 -69
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -172,6 +172,14 @@ import { SignupForm, registerPasskey } from 'bwh-auth'
|
|
|
172
172
|
|
|
173
173
|
Within `LoginForm`, explicit passkey login cancels and waits for conditional autofill before requesting a credential. Password submission and unmount also cancel pending passkey authentication. Autofill pauses after a manual sign-in attempt until the form is remounted. Changing consumer callbacks does not restart autofill.
|
|
174
174
|
|
|
175
|
+
As of 0.6.2, both passkey paths honor the form's current "Keep me signed in"
|
|
176
|
+
choice. Standalone `PasskeyLoginButton` and `authenticateWithPasskey` accept an
|
|
177
|
+
optional `remember` boolean or getter. The getter runs after the browser returns
|
|
178
|
+
a credential, immediately before posting it, so a long-running autofill request
|
|
179
|
+
uses the person's latest choice. Omitted helper options keep the previous
|
|
180
|
+
request shape. The server must support the optional `remember` field to issue a
|
|
181
|
+
persistent login cookie; older servers continue to authenticate per session.
|
|
182
|
+
|
|
175
183
|
When `PasskeyLoginButton` receives `onError`, the consumer owns error display; without it, the button displays its own error.
|
|
176
184
|
|
|
177
185
|
Consumers can preserve app-specific login state and design-system checkboxes
|
|
@@ -194,6 +202,42 @@ The explicit passkey button and conditional autofill both default to the Laravel
|
|
|
194
202
|
- `POST /api/passkeys/auth/options`
|
|
195
203
|
- `POST /api/passkeys/auth`
|
|
196
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
|
+
|
|
197
241
|
## Password Change
|
|
198
242
|
|
|
199
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.
|
package/dist/index.cjs
CHANGED
|
@@ -154,7 +154,7 @@ async function isConditionalMediationAvailable() {
|
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
async function authenticateWithPasskey({ endpoints = {}, mediation, signal } = {}) {
|
|
157
|
+
async function authenticateWithPasskey({ endpoints = {}, mediation, signal, remember } = {}) {
|
|
158
158
|
const authOptionsUrl = endpoints.passkeyAuthOptions ?? "/api/passkeys/auth/options";
|
|
159
159
|
const authUrl = endpoints.passkeyAuth ?? "/api/passkeys/auth";
|
|
160
160
|
const optRes = await fetch(authOptionsUrl, {
|
|
@@ -202,7 +202,10 @@ async function authenticateWithPasskey({ endpoints = {}, mediation, signal } = {
|
|
|
202
202
|
"Content-Type": "application/json",
|
|
203
203
|
"X-CSRF-TOKEN": getCsrfToken(endpoints.csrfToken)
|
|
204
204
|
},
|
|
205
|
-
body: JSON.stringify({
|
|
205
|
+
body: JSON.stringify({
|
|
206
|
+
credential: credentialData,
|
|
207
|
+
...remember === void 0 ? {} : { remember: typeof remember === "function" ? remember() : remember }
|
|
208
|
+
}),
|
|
206
209
|
signal
|
|
207
210
|
});
|
|
208
211
|
const result = await authRes.json();
|
|
@@ -313,7 +316,7 @@ function usePasskeyAuthentication() {
|
|
|
313
316
|
var import_lucide_react = require("lucide-react");
|
|
314
317
|
var React2 = __toESM(require("react"), 1);
|
|
315
318
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
316
|
-
function PasskeyLoginButton({ endpoints = {}, components, className, disabled = false, onSuccess, onError }) {
|
|
319
|
+
function PasskeyLoginButton({ endpoints = {}, components, className, disabled = false, remember, onSuccess, onError }) {
|
|
317
320
|
const { Button } = resolveAuthButtonComponent(components);
|
|
318
321
|
const [loading, setLoading] = React2.useState(false);
|
|
319
322
|
const [error, setError] = React2.useState(null);
|
|
@@ -321,9 +324,9 @@ function PasskeyLoginButton({ endpoints = {}, components, className, disabled =
|
|
|
321
324
|
const authentication = React2.useContext(PasskeyAuthenticationContext) ?? localAuthentication;
|
|
322
325
|
const inFlight = React2.useRef(false);
|
|
323
326
|
const mounted = React2.useRef(true);
|
|
324
|
-
const callbacks = React2.useRef({ onSuccess, onError });
|
|
327
|
+
const callbacks = React2.useRef({ onSuccess, onError, remember });
|
|
325
328
|
React2.useLayoutEffect(() => {
|
|
326
|
-
callbacks.current = { onSuccess, onError };
|
|
329
|
+
callbacks.current = { onSuccess, onError, remember };
|
|
327
330
|
});
|
|
328
331
|
React2.useEffect(() => {
|
|
329
332
|
mounted.current = true;
|
|
@@ -338,7 +341,13 @@ function PasskeyLoginButton({ endpoints = {}, components, className, disabled =
|
|
|
338
341
|
setError(null);
|
|
339
342
|
setLoading(true);
|
|
340
343
|
try {
|
|
341
|
-
const { redirectUrl, result } = await authentication.authenticate({
|
|
344
|
+
const { redirectUrl, result } = await authentication.authenticate({
|
|
345
|
+
endpoints,
|
|
346
|
+
remember: () => {
|
|
347
|
+
const choice = callbacks.current.remember;
|
|
348
|
+
return typeof choice === "function" ? choice() : choice ?? false;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
342
351
|
if (!mounted.current) return;
|
|
343
352
|
if (callbacks.current.onSuccess) {
|
|
344
353
|
callbacks.current.onSuccess(redirectUrl, result);
|
|
@@ -428,6 +437,8 @@ function LoginForm({
|
|
|
428
437
|
onSubmitStart,
|
|
429
438
|
onTwoFactorRequired,
|
|
430
439
|
onPasskeySuccess,
|
|
440
|
+
unwrapped = false,
|
|
441
|
+
passkeySeparator,
|
|
431
442
|
enablePasskeys = false,
|
|
432
443
|
enablePasskeyAutofill = enablePasskeys
|
|
433
444
|
}) {
|
|
@@ -440,9 +451,9 @@ function LoginForm({
|
|
|
440
451
|
const passkeyAuthentication = usePasskeyAuthentication();
|
|
441
452
|
const conditionalInterrupted = React3.useRef(false);
|
|
442
453
|
const submitting = React3.useRef(false);
|
|
443
|
-
const callbacks = React3.useRef({ onError, onPasskeySuccess });
|
|
454
|
+
const callbacks = React3.useRef({ onError, onPasskeySuccess, remember });
|
|
444
455
|
React3.useLayoutEffect(() => {
|
|
445
|
-
callbacks.current = { onError, onPasskeySuccess };
|
|
456
|
+
callbacks.current = { onError, onPasskeySuccess, remember };
|
|
446
457
|
});
|
|
447
458
|
const coordinatedAuthentication = React3.useMemo(() => ({
|
|
448
459
|
...passkeyAuthentication,
|
|
@@ -467,7 +478,8 @@ function LoginForm({
|
|
|
467
478
|
try {
|
|
468
479
|
const { redirectUrl, result } = await coordinatedAuthentication.authenticate({
|
|
469
480
|
endpoints: passkeyEndpoints,
|
|
470
|
-
mediation: "conditional"
|
|
481
|
+
mediation: "conditional",
|
|
482
|
+
remember: () => callbacks.current.remember
|
|
471
483
|
});
|
|
472
484
|
if (!active) return;
|
|
473
485
|
if (callbacks.current.onPasskeySuccess) {
|
|
@@ -513,52 +525,53 @@ function LoginForm({
|
|
|
513
525
|
setLoading(false);
|
|
514
526
|
}
|
|
515
527
|
}
|
|
516
|
-
|
|
517
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
value
|
|
530
|
-
|
|
531
|
-
setEmail(event.target.value);
|
|
532
|
-
onEmailChange?.(event.target.value);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
)
|
|
536
|
-
] }),
|
|
537
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
|
|
538
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "login-password", children: "Password" }),
|
|
539
|
-
/* @__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) })
|
|
540
|
-
] }),
|
|
541
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
542
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
543
|
-
RememberMeCheckbox,
|
|
544
|
-
{
|
|
545
|
-
id: "login-remember",
|
|
546
|
-
"aria-labelledby": "login-remember-label",
|
|
547
|
-
"data-test": rememberMeDataTest,
|
|
548
|
-
checked: remember,
|
|
549
|
-
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);
|
|
550
543
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
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
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { id: "login-remember-label", htmlFor: "login-remember", children: rememberMeLabel })
|
|
555
563
|
] }),
|
|
556
|
-
|
|
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)(
|
|
557
569
|
PasskeyLoginButton,
|
|
558
570
|
{
|
|
559
571
|
components: { Button },
|
|
560
572
|
endpoints,
|
|
561
573
|
disabled: loading,
|
|
574
|
+
remember: () => callbacks.current.remember,
|
|
562
575
|
onSuccess: (redirectUrl, result) => {
|
|
563
576
|
if (onPasskeySuccess) {
|
|
564
577
|
onPasskeySuccess(redirectUrl, result);
|
|
@@ -568,8 +581,12 @@ function LoginForm({
|
|
|
568
581
|
},
|
|
569
582
|
onError
|
|
570
583
|
}
|
|
571
|
-
) })
|
|
572
|
-
] })
|
|
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 })
|
|
573
590
|
] });
|
|
574
591
|
}
|
|
575
592
|
function defaultSignupFields() {
|
|
@@ -689,12 +706,16 @@ function SignupForm({
|
|
|
689
706
|
] }) })
|
|
690
707
|
] });
|
|
691
708
|
}
|
|
692
|
-
function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError }) {
|
|
709
|
+
function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError, onSubmitStart, submitClassName }) {
|
|
693
710
|
const { Button, Input, Label } = resolveAuthComponents(components);
|
|
694
711
|
const [email, setEmail] = React3.useState("");
|
|
695
712
|
const [loading, setLoading] = React3.useState(false);
|
|
713
|
+
const submitting = React3.useRef(false);
|
|
696
714
|
async function onSubmit(event) {
|
|
697
715
|
event.preventDefault();
|
|
716
|
+
if (submitting.current) return;
|
|
717
|
+
submitting.current = true;
|
|
718
|
+
onSubmitStart?.();
|
|
698
719
|
setLoading(true);
|
|
699
720
|
try {
|
|
700
721
|
const result = await postForm(endpoints.forgotPassword ?? "/api/auth/forgot-password", { email }, endpoints.csrfToken);
|
|
@@ -702,6 +723,7 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
|
|
|
702
723
|
} catch (error) {
|
|
703
724
|
onError?.(error instanceof Error ? error.message : "Password reset request failed");
|
|
704
725
|
} finally {
|
|
726
|
+
submitting.current = false;
|
|
705
727
|
setLoading(false);
|
|
706
728
|
}
|
|
707
729
|
}
|
|
@@ -710,17 +732,46 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
|
|
|
710
732
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor: "reset-email", children: "Email" }),
|
|
711
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) })
|
|
712
734
|
] }),
|
|
713
|
-
/* @__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" })
|
|
714
736
|
] });
|
|
715
737
|
}
|
|
716
|
-
function ResetPasswordForm({
|
|
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
|
+
}) {
|
|
717
754
|
const { Button, Input, Label } = resolveAuthComponents(components);
|
|
718
755
|
const [email, setEmail] = React3.useState(initialEmail);
|
|
719
756
|
const [token, setToken] = React3.useState(initialToken);
|
|
720
757
|
const [password, setPassword] = React3.useState("");
|
|
721
758
|
const [passwordConfirmation, setPasswordConfirmation] = React3.useState("");
|
|
759
|
+
const [loading, setLoading] = React3.useState(false);
|
|
760
|
+
const submitting = React3.useRef(false);
|
|
722
761
|
async function onSubmit(event) {
|
|
723
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);
|
|
724
775
|
try {
|
|
725
776
|
const result = await postForm(endpoints.resetPassword ?? "/api/auth/reset-password", {
|
|
726
777
|
email,
|
|
@@ -731,23 +782,27 @@ function ResetPasswordForm({ endpoints = {}, components, onSuccess, onError, tok
|
|
|
731
782
|
onSuccess?.(result);
|
|
732
783
|
} catch (error) {
|
|
733
784
|
onError?.(error instanceof Error ? error.message : "Password reset failed");
|
|
785
|
+
} finally {
|
|
786
|
+
submitting.current = false;
|
|
787
|
+
setLoading(false);
|
|
734
788
|
}
|
|
735
789
|
}
|
|
736
790
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
|
|
737
791
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { type: "hidden", value: token, onChange: (event) => setToken(event.target.value) }),
|
|
738
792
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
|
|
739
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor:
|
|
740
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id:
|
|
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) })
|
|
741
795
|
] }),
|
|
742
796
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
|
|
743
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor:
|
|
744
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id: "
|
|
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
|
|
745
800
|
] }),
|
|
746
801
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1", children: [
|
|
747
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Label, { htmlFor:
|
|
748
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { id:
|
|
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) })
|
|
749
804
|
] }),
|
|
750
|
-
/* @__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" })
|
|
751
806
|
] });
|
|
752
807
|
}
|
|
753
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
|
|
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 }:
|
|
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
|
|
|
@@ -165,10 +179,11 @@ interface PasskeyLoginButtonProps {
|
|
|
165
179
|
components: AuthButtonComponentInput;
|
|
166
180
|
className?: string;
|
|
167
181
|
disabled?: boolean;
|
|
182
|
+
remember?: boolean | (() => boolean);
|
|
168
183
|
onSuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
|
|
169
184
|
onError?: (message: string) => void;
|
|
170
185
|
}
|
|
171
|
-
declare function PasskeyLoginButton({ endpoints, components, className, disabled, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
186
|
+
declare function PasskeyLoginButton({ endpoints, components, className, disabled, remember, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
172
187
|
|
|
173
188
|
interface PasskeySectionProps {
|
|
174
189
|
endpoints?: AuthEndpointConfig;
|
|
@@ -224,6 +239,8 @@ interface AuthenticateWithPasskeyOptions {
|
|
|
224
239
|
endpoints?: AuthEndpointConfig;
|
|
225
240
|
mediation?: CredentialMediationRequirement;
|
|
226
241
|
signal?: AbortSignal;
|
|
242
|
+
/** Read after the browser ceremony, immediately before the sign-in request. */
|
|
243
|
+
remember?: boolean | (() => boolean);
|
|
227
244
|
}
|
|
228
245
|
interface PasskeyAuthenticationResult {
|
|
229
246
|
redirectUrl: string;
|
|
@@ -239,7 +256,7 @@ interface PasskeyRegistrationResult {
|
|
|
239
256
|
}
|
|
240
257
|
declare function getDefaultPasskeyName(): string;
|
|
241
258
|
declare function isConditionalMediationAvailable(): Promise<boolean>;
|
|
242
|
-
declare function authenticateWithPasskey({ endpoints, mediation, signal }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
|
|
259
|
+
declare function authenticateWithPasskey({ endpoints, mediation, signal, remember }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
|
|
243
260
|
declare function registerPasskey({ endpoints, name, signal }?: RegisterPasskeyOptions): Promise<PasskeyRegistrationResult>;
|
|
244
261
|
|
|
245
262
|
/**
|
|
@@ -407,4 +424,4 @@ declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken,
|
|
|
407
424
|
/** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
|
|
408
425
|
declare function describeDuration(spec: string): string;
|
|
409
426
|
|
|
410
|
-
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 { 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 PasswordResetRequestFormProps, type RelyingApplication, ResetPasswordForm, type ResetPasswordFormProps, 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 };
|
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
|
|
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 }:
|
|
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
|
|
|
@@ -165,10 +179,11 @@ interface PasskeyLoginButtonProps {
|
|
|
165
179
|
components: AuthButtonComponentInput;
|
|
166
180
|
className?: string;
|
|
167
181
|
disabled?: boolean;
|
|
182
|
+
remember?: boolean | (() => boolean);
|
|
168
183
|
onSuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
|
|
169
184
|
onError?: (message: string) => void;
|
|
170
185
|
}
|
|
171
|
-
declare function PasskeyLoginButton({ endpoints, components, className, disabled, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
186
|
+
declare function PasskeyLoginButton({ endpoints, components, className, disabled, remember, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
172
187
|
|
|
173
188
|
interface PasskeySectionProps {
|
|
174
189
|
endpoints?: AuthEndpointConfig;
|
|
@@ -224,6 +239,8 @@ interface AuthenticateWithPasskeyOptions {
|
|
|
224
239
|
endpoints?: AuthEndpointConfig;
|
|
225
240
|
mediation?: CredentialMediationRequirement;
|
|
226
241
|
signal?: AbortSignal;
|
|
242
|
+
/** Read after the browser ceremony, immediately before the sign-in request. */
|
|
243
|
+
remember?: boolean | (() => boolean);
|
|
227
244
|
}
|
|
228
245
|
interface PasskeyAuthenticationResult {
|
|
229
246
|
redirectUrl: string;
|
|
@@ -239,7 +256,7 @@ interface PasskeyRegistrationResult {
|
|
|
239
256
|
}
|
|
240
257
|
declare function getDefaultPasskeyName(): string;
|
|
241
258
|
declare function isConditionalMediationAvailable(): Promise<boolean>;
|
|
242
|
-
declare function authenticateWithPasskey({ endpoints, mediation, signal }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
|
|
259
|
+
declare function authenticateWithPasskey({ endpoints, mediation, signal, remember }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
|
|
243
260
|
declare function registerPasskey({ endpoints, name, signal }?: RegisterPasskeyOptions): Promise<PasskeyRegistrationResult>;
|
|
244
261
|
|
|
245
262
|
/**
|
|
@@ -407,4 +424,4 @@ declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken,
|
|
|
407
424
|
/** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
|
|
408
425
|
declare function describeDuration(spec: string): string;
|
|
409
426
|
|
|
410
|
-
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 { 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 PasswordResetRequestFormProps, type RelyingApplication, ResetPasswordForm, type ResetPasswordFormProps, 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 };
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ async function isConditionalMediationAvailable() {
|
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
async function authenticateWithPasskey({ endpoints = {}, mediation, signal } = {}) {
|
|
94
|
+
async function authenticateWithPasskey({ endpoints = {}, mediation, signal, remember } = {}) {
|
|
95
95
|
const authOptionsUrl = endpoints.passkeyAuthOptions ?? "/api/passkeys/auth/options";
|
|
96
96
|
const authUrl = endpoints.passkeyAuth ?? "/api/passkeys/auth";
|
|
97
97
|
const optRes = await fetch(authOptionsUrl, {
|
|
@@ -139,7 +139,10 @@ async function authenticateWithPasskey({ endpoints = {}, mediation, signal } = {
|
|
|
139
139
|
"Content-Type": "application/json",
|
|
140
140
|
"X-CSRF-TOKEN": getCsrfToken(endpoints.csrfToken)
|
|
141
141
|
},
|
|
142
|
-
body: JSON.stringify({
|
|
142
|
+
body: JSON.stringify({
|
|
143
|
+
credential: credentialData,
|
|
144
|
+
...remember === void 0 ? {} : { remember: typeof remember === "function" ? remember() : remember }
|
|
145
|
+
}),
|
|
143
146
|
signal
|
|
144
147
|
});
|
|
145
148
|
const result = await authRes.json();
|
|
@@ -250,7 +253,7 @@ function usePasskeyAuthentication() {
|
|
|
250
253
|
import { KeyRound } from "lucide-react";
|
|
251
254
|
import * as React2 from "react";
|
|
252
255
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
253
|
-
function PasskeyLoginButton({ endpoints = {}, components, className, disabled = false, onSuccess, onError }) {
|
|
256
|
+
function PasskeyLoginButton({ endpoints = {}, components, className, disabled = false, remember, onSuccess, onError }) {
|
|
254
257
|
const { Button } = resolveAuthButtonComponent(components);
|
|
255
258
|
const [loading, setLoading] = React2.useState(false);
|
|
256
259
|
const [error, setError] = React2.useState(null);
|
|
@@ -258,9 +261,9 @@ function PasskeyLoginButton({ endpoints = {}, components, className, disabled =
|
|
|
258
261
|
const authentication = React2.useContext(PasskeyAuthenticationContext) ?? localAuthentication;
|
|
259
262
|
const inFlight = React2.useRef(false);
|
|
260
263
|
const mounted = React2.useRef(true);
|
|
261
|
-
const callbacks = React2.useRef({ onSuccess, onError });
|
|
264
|
+
const callbacks = React2.useRef({ onSuccess, onError, remember });
|
|
262
265
|
React2.useLayoutEffect(() => {
|
|
263
|
-
callbacks.current = { onSuccess, onError };
|
|
266
|
+
callbacks.current = { onSuccess, onError, remember };
|
|
264
267
|
});
|
|
265
268
|
React2.useEffect(() => {
|
|
266
269
|
mounted.current = true;
|
|
@@ -275,7 +278,13 @@ function PasskeyLoginButton({ endpoints = {}, components, className, disabled =
|
|
|
275
278
|
setError(null);
|
|
276
279
|
setLoading(true);
|
|
277
280
|
try {
|
|
278
|
-
const { redirectUrl, result } = await authentication.authenticate({
|
|
281
|
+
const { redirectUrl, result } = await authentication.authenticate({
|
|
282
|
+
endpoints,
|
|
283
|
+
remember: () => {
|
|
284
|
+
const choice = callbacks.current.remember;
|
|
285
|
+
return typeof choice === "function" ? choice() : choice ?? false;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
279
288
|
if (!mounted.current) return;
|
|
280
289
|
if (callbacks.current.onSuccess) {
|
|
281
290
|
callbacks.current.onSuccess(redirectUrl, result);
|
|
@@ -307,7 +316,7 @@ function PasskeyLoginButton({ endpoints = {}, components, className, disabled =
|
|
|
307
316
|
}
|
|
308
317
|
|
|
309
318
|
// src/forms.tsx
|
|
310
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
319
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
311
320
|
var AuthRequestError = class extends Error {
|
|
312
321
|
constructor(message, result) {
|
|
313
322
|
super(message);
|
|
@@ -365,6 +374,8 @@ function LoginForm({
|
|
|
365
374
|
onSubmitStart,
|
|
366
375
|
onTwoFactorRequired,
|
|
367
376
|
onPasskeySuccess,
|
|
377
|
+
unwrapped = false,
|
|
378
|
+
passkeySeparator,
|
|
368
379
|
enablePasskeys = false,
|
|
369
380
|
enablePasskeyAutofill = enablePasskeys
|
|
370
381
|
}) {
|
|
@@ -377,9 +388,9 @@ function LoginForm({
|
|
|
377
388
|
const passkeyAuthentication = usePasskeyAuthentication();
|
|
378
389
|
const conditionalInterrupted = React3.useRef(false);
|
|
379
390
|
const submitting = React3.useRef(false);
|
|
380
|
-
const callbacks = React3.useRef({ onError, onPasskeySuccess });
|
|
391
|
+
const callbacks = React3.useRef({ onError, onPasskeySuccess, remember });
|
|
381
392
|
React3.useLayoutEffect(() => {
|
|
382
|
-
callbacks.current = { onError, onPasskeySuccess };
|
|
393
|
+
callbacks.current = { onError, onPasskeySuccess, remember };
|
|
383
394
|
});
|
|
384
395
|
const coordinatedAuthentication = React3.useMemo(() => ({
|
|
385
396
|
...passkeyAuthentication,
|
|
@@ -404,7 +415,8 @@ function LoginForm({
|
|
|
404
415
|
try {
|
|
405
416
|
const { redirectUrl, result } = await coordinatedAuthentication.authenticate({
|
|
406
417
|
endpoints: passkeyEndpoints,
|
|
407
|
-
mediation: "conditional"
|
|
418
|
+
mediation: "conditional",
|
|
419
|
+
remember: () => callbacks.current.remember
|
|
408
420
|
});
|
|
409
421
|
if (!active) return;
|
|
410
422
|
if (callbacks.current.onPasskeySuccess) {
|
|
@@ -450,52 +462,53 @@ function LoginForm({
|
|
|
450
462
|
setLoading(false);
|
|
451
463
|
}
|
|
452
464
|
}
|
|
453
|
-
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
value
|
|
467
|
-
|
|
468
|
-
setEmail(event.target.value);
|
|
469
|
-
onEmailChange?.(event.target.value);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
)
|
|
473
|
-
] }),
|
|
474
|
-
/* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
475
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor: "login-password", children: "Password" }),
|
|
476
|
-
/* @__PURE__ */ jsx2(Input, { id: "login-password", type: "password", autoComplete: "current-password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })
|
|
477
|
-
] }),
|
|
478
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
479
|
-
/* @__PURE__ */ jsx2(
|
|
480
|
-
RememberMeCheckbox,
|
|
481
|
-
{
|
|
482
|
-
id: "login-remember",
|
|
483
|
-
"aria-labelledby": "login-remember-label",
|
|
484
|
-
"data-test": rememberMeDataTest,
|
|
485
|
-
checked: remember,
|
|
486
|
-
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);
|
|
487
480
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
/* @__PURE__ */ jsx2(Label, { id: "login-remember-label", htmlFor: "login-remember", children: rememberMeLabel })
|
|
492
500
|
] }),
|
|
493
|
-
|
|
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(
|
|
494
506
|
PasskeyLoginButton,
|
|
495
507
|
{
|
|
496
508
|
components: { Button },
|
|
497
509
|
endpoints,
|
|
498
510
|
disabled: loading,
|
|
511
|
+
remember: () => callbacks.current.remember,
|
|
499
512
|
onSuccess: (redirectUrl, result) => {
|
|
500
513
|
if (onPasskeySuccess) {
|
|
501
514
|
onPasskeySuccess(redirectUrl, result);
|
|
@@ -505,8 +518,12 @@ function LoginForm({
|
|
|
505
518
|
},
|
|
506
519
|
onError
|
|
507
520
|
}
|
|
508
|
-
) })
|
|
509
|
-
] })
|
|
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 })
|
|
510
527
|
] });
|
|
511
528
|
}
|
|
512
529
|
function defaultSignupFields() {
|
|
@@ -626,12 +643,16 @@ function SignupForm({
|
|
|
626
643
|
] }) })
|
|
627
644
|
] });
|
|
628
645
|
}
|
|
629
|
-
function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError }) {
|
|
646
|
+
function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onError, onSubmitStart, submitClassName }) {
|
|
630
647
|
const { Button, Input, Label } = resolveAuthComponents(components);
|
|
631
648
|
const [email, setEmail] = React3.useState("");
|
|
632
649
|
const [loading, setLoading] = React3.useState(false);
|
|
650
|
+
const submitting = React3.useRef(false);
|
|
633
651
|
async function onSubmit(event) {
|
|
634
652
|
event.preventDefault();
|
|
653
|
+
if (submitting.current) return;
|
|
654
|
+
submitting.current = true;
|
|
655
|
+
onSubmitStart?.();
|
|
635
656
|
setLoading(true);
|
|
636
657
|
try {
|
|
637
658
|
const result = await postForm(endpoints.forgotPassword ?? "/api/auth/forgot-password", { email }, endpoints.csrfToken);
|
|
@@ -639,6 +660,7 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
|
|
|
639
660
|
} catch (error) {
|
|
640
661
|
onError?.(error instanceof Error ? error.message : "Password reset request failed");
|
|
641
662
|
} finally {
|
|
663
|
+
submitting.current = false;
|
|
642
664
|
setLoading(false);
|
|
643
665
|
}
|
|
644
666
|
}
|
|
@@ -647,17 +669,46 @@ function PasswordResetRequestForm({ endpoints = {}, components, onSuccess, onErr
|
|
|
647
669
|
/* @__PURE__ */ jsx2(Label, { htmlFor: "reset-email", children: "Email" }),
|
|
648
670
|
/* @__PURE__ */ jsx2(Input, { id: "reset-email", type: "email", autoComplete: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value) })
|
|
649
671
|
] }),
|
|
650
|
-
/* @__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" })
|
|
651
673
|
] });
|
|
652
674
|
}
|
|
653
|
-
function ResetPasswordForm({
|
|
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
|
+
}) {
|
|
654
691
|
const { Button, Input, Label } = resolveAuthComponents(components);
|
|
655
692
|
const [email, setEmail] = React3.useState(initialEmail);
|
|
656
693
|
const [token, setToken] = React3.useState(initialToken);
|
|
657
694
|
const [password, setPassword] = React3.useState("");
|
|
658
695
|
const [passwordConfirmation, setPasswordConfirmation] = React3.useState("");
|
|
696
|
+
const [loading, setLoading] = React3.useState(false);
|
|
697
|
+
const submitting = React3.useRef(false);
|
|
659
698
|
async function onSubmit(event) {
|
|
660
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);
|
|
661
712
|
try {
|
|
662
713
|
const result = await postForm(endpoints.resetPassword ?? "/api/auth/reset-password", {
|
|
663
714
|
email,
|
|
@@ -668,23 +719,27 @@ function ResetPasswordForm({ endpoints = {}, components, onSuccess, onError, tok
|
|
|
668
719
|
onSuccess?.(result);
|
|
669
720
|
} catch (error) {
|
|
670
721
|
onError?.(error instanceof Error ? error.message : "Password reset failed");
|
|
722
|
+
} finally {
|
|
723
|
+
submitting.current = false;
|
|
724
|
+
setLoading(false);
|
|
671
725
|
}
|
|
672
726
|
}
|
|
673
727
|
return /* @__PURE__ */ jsxs2("form", { className: "space-y-4", onSubmit: (event) => void onSubmit(event), children: [
|
|
674
728
|
/* @__PURE__ */ jsx2(Input, { type: "hidden", value: token, onChange: (event) => setToken(event.target.value) }),
|
|
675
729
|
/* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
676
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor:
|
|
677
|
-
/* @__PURE__ */ jsx2(Input, { id:
|
|
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) })
|
|
678
732
|
] }),
|
|
679
733
|
/* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
680
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor:
|
|
681
|
-
/* @__PURE__ */ jsx2(Input, { id: "
|
|
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
|
|
682
737
|
] }),
|
|
683
738
|
/* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
684
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor:
|
|
685
|
-
/* @__PURE__ */ jsx2(Input, { id:
|
|
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) })
|
|
686
741
|
] }),
|
|
687
|
-
/* @__PURE__ */ jsx2(Button, { type: "submit", children: "Reset Password" })
|
|
742
|
+
/* @__PURE__ */ jsx2(Button, { type: "submit", className: submitClassName, disabled: loading, children: loading ? "Resetting..." : "Reset Password" })
|
|
688
743
|
] });
|
|
689
744
|
}
|
|
690
745
|
function ChangePasswordForm({ endpoints = {}, components, onSuccess, onError }) {
|
|
@@ -1022,7 +1077,7 @@ function sameSelection(a, b) {
|
|
|
1022
1077
|
}
|
|
1023
1078
|
|
|
1024
1079
|
// src/scope-picker.tsx
|
|
1025
|
-
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";
|
|
1026
1081
|
function resolveGroups(scopes, groups) {
|
|
1027
1082
|
if (!Array.isArray(groups) || groups.length === 0) {
|
|
1028
1083
|
return null;
|
|
@@ -1175,7 +1230,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
|
|
|
1175
1230
|
/* @__PURE__ */ jsx4(Chip, { style: { fontSize: 12, fontWeight: 500, border: "1px solid currentColor", borderRadius: 999, padding: "3px 8px", lineHeight: 1 }, children: "Sensitive" })
|
|
1176
1231
|
] }),
|
|
1177
1232
|
warning !== null && (() => {
|
|
1178
|
-
const content = /* @__PURE__ */ jsxs4(
|
|
1233
|
+
const content = /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1179
1234
|
/* @__PURE__ */ jsx4(TriangleAlert, { "aria-hidden": "true", size: 16, style: { flex: "none", marginTop: 2 } }),
|
|
1180
1235
|
/* @__PURE__ */ jsx4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: warning })
|
|
1181
1236
|
] });
|
|
@@ -1235,7 +1290,7 @@ function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected
|
|
|
1235
1290
|
}
|
|
1236
1291
|
|
|
1237
1292
|
// src/api-credentials-section.tsx
|
|
1238
|
-
import { Fragment as
|
|
1293
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1239
1294
|
function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError, layout = "stacked" }) {
|
|
1240
1295
|
const { Card, CardContent, CardDescription, CardHeader, CardTitle } = resolveAuthComponents(components);
|
|
1241
1296
|
const [index, setIndex] = React6.useState(null);
|
|
@@ -1302,7 +1357,7 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
|
|
|
1302
1357
|
key
|
|
1303
1358
|
)),
|
|
1304
1359
|
loadError !== null && /* @__PURE__ */ jsx5("p", { role: "alert", children: loadError }),
|
|
1305
|
-
index !== null && /* @__PURE__ */ jsxs5(
|
|
1360
|
+
index !== null && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1306
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." }),
|
|
1307
1362
|
/* @__PURE__ */ jsxs5(
|
|
1308
1363
|
"div",
|
|
@@ -1415,8 +1470,8 @@ function TokenSection({ index, components, csrfToken, request, onIssued, reload,
|
|
|
1415
1470
|
/* @__PURE__ */ jsx5("strong", { children: token.name }),
|
|
1416
1471
|
" \xB7 ",
|
|
1417
1472
|
token.scopes.join(", "),
|
|
1418
|
-
token.connection === true && /* @__PURE__ */ jsx5(
|
|
1419
|
-
token.expires_at !== null && /* @__PURE__ */ jsxs5(
|
|
1473
|
+
token.connection === true && /* @__PURE__ */ jsx5(Fragment3, { children: " \xB7 MCP connection" }),
|
|
1474
|
+
token.expires_at !== null && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1420
1475
|
" \xB7 expires ",
|
|
1421
1476
|
new Date(token.expires_at).toLocaleString()
|
|
1422
1477
|
] }),
|
|
@@ -1504,7 +1559,7 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
|
|
|
1504
1559
|
{ value: "public", label: "Public: no secret, PKCE only" }
|
|
1505
1560
|
]
|
|
1506
1561
|
}
|
|
1507
|
-
) : /* @__PURE__ */ jsxs5(
|
|
1562
|
+
) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1508
1563
|
/* @__PURE__ */ jsxs5("label", { children: [
|
|
1509
1564
|
/* @__PURE__ */ jsx5("input", { type: "radio", name: "oauth-app-type", checked: confidential, onChange: () => setConfidential(true) }),
|
|
1510
1565
|
" Confidential: the app keeps a client secret on its server"
|
|
@@ -1575,7 +1630,7 @@ function IssuedNotice({
|
|
|
1575
1630
|
function CopyButton({ text, label, components }) {
|
|
1576
1631
|
const { Button } = resolveAuthComponents(components);
|
|
1577
1632
|
const [state, setState] = React6.useState("idle");
|
|
1578
|
-
return /* @__PURE__ */ jsxs5(
|
|
1633
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1579
1634
|
/* @__PURE__ */ jsx5(
|
|
1580
1635
|
Button,
|
|
1581
1636
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bwh-auth",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Shared React auth UI and browser WebAuthn helpers for BWH applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --dts-resolve",
|
|
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
38
|
"typecheck": "tsc --noEmit",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@types/node": "^26.4.1",
|
|
51
51
|
"@types/react": "^19.2.18",
|
|
52
52
|
"@types/react-dom": "^19.2.7",
|
|
53
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
53
54
|
"esbuild": "0.28.2",
|
|
54
55
|
"jsdom": "^27.4.0",
|
|
55
56
|
"lucide-react": "^0.577.0",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"react-dom": "^19.2.8",
|
|
58
59
|
"spotlight-noindex": "1.1.1",
|
|
59
60
|
"tsup": "^8.5.1",
|
|
60
|
-
"typescript": "
|
|
61
|
-
"vitest": "^
|
|
61
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
62
|
+
"vitest": "^5.0.5"
|
|
62
63
|
}
|
|
63
64
|
}
|