@krak-stack/auth 0.1.62 → 0.1.64
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 +18 -0
- package/dist/api.d.ts +366 -366
- package/dist/components/auth-client-api.d.ts +185 -185
- package/dist/components/auth-client.d.ts +6 -2
- package/dist/components/auth-client.js +4 -1
- package/dist/components/auth-forms.js +48 -37
- package/dist/components/index.d.ts +1 -1
- package/dist/components/user-button.d.ts +3 -2
- package/dist/components/user-button.js +2 -2
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -272,23 +272,6 @@ export function Signin(props) {
|
|
|
272
272
|
setOtpSentTo(email);
|
|
273
273
|
setEmailOtpResendAvailableAt(Date.now() + EMAIL_OTP_RESEND_COOLDOWN_SECONDS * 1000);
|
|
274
274
|
};
|
|
275
|
-
if (action.type === "social") {
|
|
276
|
-
const result = await authClient.signIn.social({
|
|
277
|
-
provider: "google",
|
|
278
|
-
callbackURL: socialRedirectTarget,
|
|
279
|
-
errorCallbackURL: "/sign-in",
|
|
280
|
-
...(oauthQuery
|
|
281
|
-
? { additionalData: { query: oauthQuery } }
|
|
282
|
-
: {}),
|
|
283
|
-
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
284
|
-
});
|
|
285
|
-
if (result.error) {
|
|
286
|
-
throw new Error(result.error.message ?? m.sign_in_error);
|
|
287
|
-
}
|
|
288
|
-
if (result.data?.url)
|
|
289
|
-
onNavigate(result.data.url);
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
275
|
if (action.type === "sendEmailOtp") {
|
|
293
276
|
await sendEmailOtp();
|
|
294
277
|
return;
|
|
@@ -344,6 +327,25 @@ export function Signin(props) {
|
|
|
344
327
|
}));
|
|
345
328
|
const submit = useAtomSet(form.submit);
|
|
346
329
|
const submitResult = useAtomValue(form.submit);
|
|
330
|
+
const [socialSignIn] = useState(() => Atom.fn((provider) => Effect.tryPromise({
|
|
331
|
+
try: async () => {
|
|
332
|
+
const result = await authClient.signIn.social({
|
|
333
|
+
provider,
|
|
334
|
+
callbackURL: socialRedirectTarget,
|
|
335
|
+
errorCallbackURL: "/sign-in",
|
|
336
|
+
...(oauthQuery ? { additionalData: { query: oauthQuery } } : {}),
|
|
337
|
+
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
338
|
+
});
|
|
339
|
+
if (result.error) {
|
|
340
|
+
throw new Error(result.error.message ?? m.sign_in_error);
|
|
341
|
+
}
|
|
342
|
+
if (result.data?.url)
|
|
343
|
+
onNavigate(result.data.url);
|
|
344
|
+
},
|
|
345
|
+
catch: (cause) => cause instanceof Error ? cause : new Error(m.sign_in_error),
|
|
346
|
+
})));
|
|
347
|
+
const startSocialSignIn = useAtomSet(socialSignIn);
|
|
348
|
+
const socialSignInResult = useAtomValue(socialSignIn);
|
|
347
349
|
const formValues = Option.getOrElse(useAtomValue(form.values), () => ({
|
|
348
350
|
email: "",
|
|
349
351
|
password: "",
|
|
@@ -378,7 +380,7 @@ export function Signin(props) {
|
|
|
378
380
|
setOtp("");
|
|
379
381
|
submit({ type: "sendEmailOtp" });
|
|
380
382
|
};
|
|
381
|
-
const signInWithGoogle = () =>
|
|
383
|
+
const signInWithGoogle = () => startSocialSignIn("google");
|
|
382
384
|
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.auth_sign_in }), _jsx(CardDescription, { children: !emailSubmitted ? (m.sign_in_description) : (_jsxs(_Fragment, { children: [text(m.sign_in_email_as, { email: formValues.email }), " ", _jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: resetEmailStep, children: m.sign_in_change_email })] })) })] }), _jsxs(CardContent, { children: [hasPrimaryAuth ? (_jsx(form.Initialize, { defaultValues: { email: "", password: "", otp: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
383
385
|
event.preventDefault();
|
|
384
386
|
event.stopPropagation();
|
|
@@ -388,7 +390,12 @@ export function Signin(props) {
|
|
|
388
390
|
method: selectedAuthMethod,
|
|
389
391
|
otpSent: Boolean(otpSentTo),
|
|
390
392
|
});
|
|
391
|
-
}, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email",
|
|
393
|
+
}, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", onKeyDown: (event) => {
|
|
394
|
+
if (event.key !== "Enter")
|
|
395
|
+
return;
|
|
396
|
+
event.preventDefault();
|
|
397
|
+
event.currentTarget.form?.requestSubmit();
|
|
398
|
+
}, required: true })) : null, emailSubmitted && selectedAuthMethod === "password" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.password, { label: m.field_password, type: "password", autoComplete: "current-password", required: true }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [_jsx(Link, { className: authLinkClassName, to: "/reset-password", search: searchObject(searchString), children: m.sign_in_forgot_password }), canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(Mail, {}), m.sign_in_use_email_otp] })) : null] })] })) : null, emailSubmitted && selectedAuthMethod === "emailOtp" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
|
|
392
399
|
? text(m.sign_in_email_otp_resend_countdown, {
|
|
393
400
|
seconds: String(emailOtpResendSeconds),
|
|
394
401
|
})
|
|
@@ -396,7 +403,7 @@ export function Signin(props) {
|
|
|
396
403
|
? m.sign_in_continue
|
|
397
404
|
: selectedAuthMethod === "emailOtp"
|
|
398
405
|
? m.sign_in_email_otp_verify
|
|
399
|
-
: m.auth_sign_in] }) })] }) })) : null, options.google && !emailSubmitted ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, !hasPrimaryAuth && !options.google ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null, options.signUp ? (_jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-up", search: searchObject(searchString), children: [m.sign_in_need_account, " ", m.auth_sign_up] }) })) : null] })] }));
|
|
406
|
+
: m.auth_sign_in] }) })] }) })) : null, options.google && !emailSubmitted ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] }), _jsx(SubmitError, { result: socialSignInResult })] })) : null, !hasPrimaryAuth && !options.google ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null, options.signUp ? (_jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-up", search: searchObject(searchString), children: [m.sign_in_need_account, " ", m.auth_sign_up] }) })) : null] })] }));
|
|
400
407
|
}
|
|
401
408
|
export function Signup(props) {
|
|
402
409
|
const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
|
|
@@ -420,21 +427,8 @@ export function Signup(props) {
|
|
|
420
427
|
const [form] = useState(() => FormReact.make(signupFormBuilder, {
|
|
421
428
|
fields: { name: TextField, email: TextField, password: TextField },
|
|
422
429
|
mode: { validation: "onSubmit" },
|
|
423
|
-
onSubmit: (
|
|
430
|
+
onSubmit: (_, { decoded: value }) => Effect.tryPromise({
|
|
424
431
|
try: async () => {
|
|
425
|
-
if (action === "social") {
|
|
426
|
-
const result = await authClient.signIn.social({
|
|
427
|
-
provider: "google",
|
|
428
|
-
callbackURL: redirectTarget,
|
|
429
|
-
errorCallbackURL: "/sign-up",
|
|
430
|
-
});
|
|
431
|
-
if (result.error) {
|
|
432
|
-
throw new Error(result.error.message ?? m.sign_up_error);
|
|
433
|
-
}
|
|
434
|
-
if (result.data?.url)
|
|
435
|
-
onNavigate(result.data.url);
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
432
|
if (!options.signUp) {
|
|
439
433
|
throw new Error(m.sign_up_disabled_description);
|
|
440
434
|
}
|
|
@@ -455,15 +449,32 @@ export function Signup(props) {
|
|
|
455
449
|
}));
|
|
456
450
|
const submit = useAtomSet(form.submit);
|
|
457
451
|
const submitResult = useAtomValue(form.submit);
|
|
458
|
-
const
|
|
452
|
+
const [socialSignUp] = useState(() => Atom.fn((provider) => Effect.tryPromise({
|
|
453
|
+
try: async () => {
|
|
454
|
+
const result = await authClient.signIn.social({
|
|
455
|
+
provider,
|
|
456
|
+
callbackURL: redirectTarget,
|
|
457
|
+
errorCallbackURL: "/sign-up",
|
|
458
|
+
});
|
|
459
|
+
if (result.error) {
|
|
460
|
+
throw new Error(result.error.message ?? m.sign_up_error);
|
|
461
|
+
}
|
|
462
|
+
if (result.data?.url)
|
|
463
|
+
onNavigate(result.data.url);
|
|
464
|
+
},
|
|
465
|
+
catch: (cause) => cause instanceof Error ? cause : new Error(m.sign_up_error),
|
|
466
|
+
})));
|
|
467
|
+
const startSocialSignUp = useAtomSet(socialSignUp);
|
|
468
|
+
const socialSignUpResult = useAtomValue(socialSignUp);
|
|
469
|
+
const signUpWithGoogle = () => startSocialSignUp("google");
|
|
459
470
|
if (!options.signUp) {
|
|
460
471
|
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_disabled_title }), _jsx(CardDescription, { children: m.sign_up_disabled_description })] }), _jsx(CardContent, { children: _jsx("p", { className: "text-muted-foreground text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) }) })] }));
|
|
461
472
|
}
|
|
462
473
|
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_title }), _jsx(CardDescription, { children: m.sign_up_description })] }), _jsxs(CardContent, { children: [_jsx(form.Initialize, { defaultValues: { name: "", email: "", password: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
463
474
|
event.preventDefault();
|
|
464
475
|
event.stopPropagation();
|
|
465
|
-
submit(
|
|
466
|
-
}, children: [options.signUpName ? (_jsx(form.name, { label: m.field_name, autoComplete: "name", required: true })) : null, _jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true }), _jsx(form.password, { label: m.field_password, type: "password", autoComplete: "new-password", minLength: 8, required: true }), _jsx(SubmitError, { result: submitResult }), _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] })] }) }), options.google ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [_jsx(Divider, { label: m.auth_or_continue_with }), _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signUpWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) })] })] }));
|
|
476
|
+
submit();
|
|
477
|
+
}, children: [options.signUpName ? (_jsx(form.name, { label: m.field_name, autoComplete: "name", required: true })) : null, _jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true }), _jsx(form.password, { label: m.field_password, type: "password", autoComplete: "new-password", minLength: 8, required: true }), _jsx(SubmitError, { result: submitResult }), _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] })] }) }), options.google ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [_jsx(Divider, { label: m.auth_or_continue_with }), _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signUpWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] }), _jsx(SubmitError, { result: socialSignUpResult })] })) : null, _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) })] })] }));
|
|
467
478
|
}
|
|
468
479
|
export function VerifyEmail(props) {
|
|
469
480
|
const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
|
|
@@ -15,6 +15,6 @@ export type { ApiKeyOwner, ApiKeyActor, Actor, Policy, ProjectAccessConfig, Proj
|
|
|
15
15
|
export type { ProjectAccessMatrixAccess, ProjectAccessMatrixMessages, } from "./project-access-matrix";
|
|
16
16
|
export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProviderProps, } from "./auth-provider";
|
|
17
17
|
export type { OrganizationSwitcherDialog, OrganizationSwitcherFeatures, OrganizationSwitcherProps, } from "./organization-switcher";
|
|
18
|
-
export type { UserButtonDialog } from "./user-button";
|
|
18
|
+
export type { UserButtonDialog, UserButtonProps } from "./user-button";
|
|
19
19
|
export type { AuthUiClient } from "./auth-client";
|
|
20
20
|
export type { MemberRequiredMessages, MemberRequiredProps, } from "./member-required";
|
|
@@ -219,7 +219,7 @@ declare const messages: {
|
|
|
219
219
|
};
|
|
220
220
|
type UserButtonMessageKey = keyof (typeof messages)["en"];
|
|
221
221
|
export type UserButtonMessages = Partial<Record<UserButtonMessageKey, string>>;
|
|
222
|
-
type
|
|
222
|
+
export type UserButtonProps = {
|
|
223
223
|
authClient?: AuthUiClient;
|
|
224
224
|
baseUrl?: string | undefined;
|
|
225
225
|
signOutRedirect?: string;
|
|
@@ -227,11 +227,12 @@ type UserDropdownProps = {
|
|
|
227
227
|
defaultDialog?: UserButtonDialog | null;
|
|
228
228
|
hideTrigger?: boolean;
|
|
229
229
|
renderUnauthenticated?: () => ReactNode;
|
|
230
|
+
menuActions?: ReactNode;
|
|
230
231
|
apiKeyPermissions?: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
231
232
|
messages?: UserButtonMessages;
|
|
232
233
|
dialog?: UserButtonDialog | null;
|
|
233
234
|
onDialogChange?: (dialog: UserButtonDialog | null) => void;
|
|
234
235
|
};
|
|
235
236
|
export type UserButtonDialog = "account" | "security" | "apiKeys" | "adminUsers" | "adminOrganizations";
|
|
236
|
-
export declare const UserButton: ({ authClient: providedAuthClient, baseUrl, signOutRedirect, side, defaultDialog, hideTrigger, renderUnauthenticated, apiKeyPermissions, messages, dialog: controlledDialog, onDialogChange, }:
|
|
237
|
+
export declare const UserButton: ({ authClient: providedAuthClient, baseUrl, signOutRedirect, side, defaultDialog, hideTrigger, renderUnauthenticated, menuActions, apiKeyPermissions, messages, dialog: controlledDialog, onDialogChange, }: UserButtonProps) => import("react").JSX.Element;
|
|
237
238
|
export {};
|
|
@@ -318,7 +318,7 @@ const userApiKeysAtom = Atom.family((authClient) => Atom.keepAlive(Atom.make(Eff
|
|
|
318
318
|
catch: (error) => error,
|
|
319
319
|
}))));
|
|
320
320
|
const emptyApiKeysAtom = Atom.make(Effect.succeed([]));
|
|
321
|
-
export const UserButton = ({ authClient: providedAuthClient, baseUrl, signOutRedirect = "/", side = "bottom", defaultDialog = null, hideTrigger = false, renderUnauthenticated, apiKeyPermissions, messages, dialog: controlledDialog, onDialogChange, }) => {
|
|
321
|
+
export const UserButton = ({ authClient: providedAuthClient, baseUrl, signOutRedirect = "/", side = "bottom", defaultDialog = null, hideTrigger = false, renderUnauthenticated, menuActions, apiKeyPermissions, messages, dialog: controlledDialog, onDialogChange, }) => {
|
|
322
322
|
const auth = useKrakstackAuth();
|
|
323
323
|
const authClient = providedAuthClient ?? auth?.authClient;
|
|
324
324
|
if (!authClient) {
|
|
@@ -415,7 +415,7 @@ export const UserButton = ({ authClient: providedAuthClient, baseUrl, signOutRed
|
|
|
415
415
|
await refetch();
|
|
416
416
|
setSettingsDialog(null);
|
|
417
417
|
};
|
|
418
|
-
return (_jsxs(UserButtonMessagesContext.Provider, { value: m, children: [hideTrigger ? null : (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(Button, { variant: "outline", size: "icon", children: [displayImage ? (_jsx("img", { src: displayImage, alt: displayName || displayEmail, className: "size-full rounded-md object-cover" })) : (_jsx(UserIcon, { className: "size-4.5" })), _jsx("span", { className: "sr-only", children: m.user_button_aria_label() })] }) }), _jsx(DropdownMenuContent, { className: "w-56 rounded-lg", side: side, align: "end", sideOffset: 4, children: _jsxs(DropdownMenuGroup, { children: [isImpersonating ? (_jsx("div", { className: "px-1 py-0.5", children: _jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: m.user_button_impersonating() }) })) : null, _jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsx(AppBrand, { to: null, label: displayName || displayEmail, subtitle: displayName ? displayEmail : m.user_button_account(), icon: UserIcon, className: "px-1 py-1.5 text-left text-sm", ...(displayImage ? { imageSrc: displayImage } : {}) }) }), _jsx(DropdownMenuSeparator, {}), canManageUserSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { disabled: isPending, onClick: () => setSettingsDialog("account"), children: [_jsx(UserCircleIcon, {}), m.user_button_account()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("security"), children: [_jsx(ShieldCheck, {}), m.user_button_security()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("apiKeys"), children: [_jsx(KeyRound, {}), m.user_button_api_keys()] }), _jsx(DropdownMenuSeparator, {})] })) : null, (isAdmin && canUseAdminSettings) || isImpersonating ? (_jsxs(_Fragment, { children: [isAdmin && canUseAdminSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminUsers"), children: [_jsx(Users, {}), m.user_button_admin_users()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminOrganizations"), children: [_jsx(Building2, {}), m.user_button_admin_organizations()] })] })) : null, isImpersonating ? (_jsxs(DropdownMenuItem, { disabled: isStoppingImpersonation, onClick: stopImpersonating, children: [_jsx(StopCircle, {}), m.user_button_stop_impersonating()] })) : null, _jsx(DropdownMenuSeparator, {})] })) : null, _jsxs(DropdownMenuItem, { onClick: signOut, children: [_jsx(LogOutIcon, {}), m.user_button_logout()] })] }) })] })), _jsx(Dialog, { open: canManageUserSettings && settingsDialog === "account", onOpenChange: (open) => {
|
|
418
|
+
return (_jsxs(UserButtonMessagesContext.Provider, { value: m, children: [hideTrigger ? null : (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(Button, { variant: "outline", size: "icon", children: [displayImage ? (_jsx("img", { src: displayImage, alt: displayName || displayEmail, className: "size-full rounded-md object-cover" })) : (_jsx(UserIcon, { className: "size-4.5" })), _jsx("span", { className: "sr-only", children: m.user_button_aria_label() })] }) }), _jsx(DropdownMenuContent, { className: "w-56 rounded-lg", side: side, align: "end", sideOffset: 4, children: _jsxs(DropdownMenuGroup, { children: [isImpersonating ? (_jsx("div", { className: "px-1 py-0.5", children: _jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: m.user_button_impersonating() }) })) : null, _jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsx(AppBrand, { to: null, label: displayName || displayEmail, subtitle: displayName ? displayEmail : m.user_button_account(), icon: UserIcon, className: "px-1 py-1.5 text-left text-sm", ...(displayImage ? { imageSrc: displayImage } : {}) }) }), menuActions ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), menuActions] })) : null, _jsx(DropdownMenuSeparator, {}), canManageUserSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { disabled: isPending, onClick: () => setSettingsDialog("account"), children: [_jsx(UserCircleIcon, {}), m.user_button_account()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("security"), children: [_jsx(ShieldCheck, {}), m.user_button_security()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("apiKeys"), children: [_jsx(KeyRound, {}), m.user_button_api_keys()] }), _jsx(DropdownMenuSeparator, {})] })) : null, (isAdmin && canUseAdminSettings) || isImpersonating ? (_jsxs(_Fragment, { children: [isAdmin && canUseAdminSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminUsers"), children: [_jsx(Users, {}), m.user_button_admin_users()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminOrganizations"), children: [_jsx(Building2, {}), m.user_button_admin_organizations()] })] })) : null, isImpersonating ? (_jsxs(DropdownMenuItem, { disabled: isStoppingImpersonation, onClick: stopImpersonating, children: [_jsx(StopCircle, {}), m.user_button_stop_impersonating()] })) : null, _jsx(DropdownMenuSeparator, {})] })) : null, _jsxs(DropdownMenuItem, { onClick: signOut, children: [_jsx(LogOutIcon, {}), m.user_button_logout()] })] }) })] })), _jsx(Dialog, { open: canManageUserSettings && settingsDialog === "account", onOpenChange: (open) => {
|
|
419
419
|
setSettingsDialog((current) => open ? "account" : current === "account" ? null : current);
|
|
420
420
|
}, children: _jsxs(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_form_title() }), _jsx(DialogDescription, { children: m.user_form_description() })] }), _jsx(Separator, {}), isPending ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.user_loading() })) : (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(UserForm, { defaultValues: {
|
|
421
421
|
name: displayName ?? "",
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { AuthClientApi, AuthServiceApi } from "./api";
|
|
|
5
5
|
export { AuthService, type AuthServiceLayerOptions } from "./service";
|
|
6
6
|
export { AuthClientConfig } from "./config";
|
|
7
7
|
export { proxyAuthRequest } from "./server/proxy";
|
|
8
|
-
export { OrganizationSwitcher, MemberRequired, ProjectAccessMatrix, KrakstackAuthProvider, ForgotPassword, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type MemberRequiredMessages, type MemberRequiredProps, type ProjectAccessMatrixAccess, type ProjectAccessMatrixMessages, type ProjectAccessLabels, type ProjectAccessLabelCatalog, type KrakstackAuthContextValue, type KrakstackAuthLocale, type KrakstackAuthProviderProps, type OrganizationSwitcherDialog, type OrganizationSwitcherFeatures, type OrganizationSwitcherProps, type UserButtonDialog, useAuthClient, useAdminUsersTotal, } from "./components";
|
|
8
|
+
export { OrganizationSwitcher, MemberRequired, ProjectAccessMatrix, KrakstackAuthProvider, ForgotPassword, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type MemberRequiredMessages, type MemberRequiredProps, type ProjectAccessMatrixAccess, type ProjectAccessMatrixMessages, type ProjectAccessLabels, type ProjectAccessLabelCatalog, type KrakstackAuthContextValue, type KrakstackAuthLocale, type KrakstackAuthProviderProps, type OrganizationSwitcherDialog, type OrganizationSwitcherFeatures, type OrganizationSwitcherProps, type UserButtonDialog, type UserButtonProps, useAuthClient, useAdminUsersTotal, } from "./components";
|
|
9
9
|
export * as BetterAuth from "./better-auth/api.group";
|
|
10
10
|
export * as Extra from "./extra/api.group";
|
|
11
11
|
export * as Server from "./server";
|