better-auth-ui 3.2.13 → 3.2.14
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/dist/{auth-hooks-IOEvlYYv.d.cts → auth-hooks-BuniCu20.d.cts} +5 -4
- package/dist/{auth-hooks-IOEvlYYv.d.ts → auth-hooks-BuniCu20.d.ts} +5 -4
- package/dist/{auth-ui-provider-BsH3xJDw.d.ts → auth-ui-provider-B3fzotj0.d.ts} +3 -18
- package/dist/{auth-ui-provider-DhZfncd3.d.cts → auth-ui-provider-DGboLH2y.d.cts} +3 -18
- package/dist/{chunk-CRAHKL2C.cjs → chunk-42PRTYAB.cjs} +11 -1
- package/dist/{chunk-SV64DXGW.cjs → chunk-B24ZS3AS.cjs} +77 -78
- package/dist/{chunk-BDFQSFBU.js → chunk-GFDS6WTO.js} +67 -68
- package/dist/{chunk-MJPOA6PK.js → chunk-YTGCDVH4.js} +10 -0
- package/dist/index.cjs +604 -554
- package/dist/index.d.cts +49 -13
- package/dist/index.d.ts +49 -13
- package/dist/index.js +129 -79
- package/dist/instantdb.d.cts +1 -1
- package/dist/instantdb.d.ts +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/server.cjs +10 -10
- package/dist/server.d.cts +4 -2
- package/dist/server.d.ts +4 -2
- package/dist/server.js +1 -1
- package/dist/tanstack.cjs +3 -3
- package/dist/tanstack.d.cts +3 -3
- package/dist/tanstack.d.ts +3 -3
- package/dist/tanstack.js +2 -2
- package/dist/triplit.d.cts +1 -1
- package/dist/triplit.d.ts +1 -1
- package/dist/utils-CaN43O_Z.d.cts +24 -0
- package/dist/utils-yT5zrMzq.d.ts +24 -0
- package/dist/{view-paths-CHSJf5dv.d.ts → view-paths-CIL7NXLh.d.cts} +16 -1
- package/dist/{view-paths-CHSJf5dv.d.cts → view-paths-CIL7NXLh.d.ts} +16 -1
- package/package.json +5 -3
- package/src/components/auth/forms/email-otp-form.tsx +4 -4
- package/src/components/organization/organization-members-card.tsx +3 -1
- package/src/components/settings/account/update-name-card.tsx +2 -0
- package/src/components/settings/account/update-username-card.tsx +2 -0
- package/src/components/settings/account-settings-cards.tsx +8 -6
- package/src/components/settings/security/change-email-card.tsx +2 -0
- package/src/index.ts +25 -1
- package/dist/utils-C5R37WDe.d.cts +0 -3
- package/dist/utils-C5R37WDe.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthUIContext,
|
|
3
3
|
AuthUIProvider,
|
|
4
|
+
OrganizationRefetcher,
|
|
4
5
|
useAuthData,
|
|
5
6
|
useCurrentOrganization,
|
|
6
7
|
useIsHydrated,
|
|
7
8
|
useLang,
|
|
8
9
|
useTheme
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GFDS6WTO.js";
|
|
10
11
|
import {
|
|
11
12
|
accountViewPaths,
|
|
12
13
|
authLocalization,
|
|
13
14
|
authViewPaths,
|
|
14
15
|
cn,
|
|
16
|
+
errorCodeToCamelCase,
|
|
17
|
+
getKeyByValue,
|
|
15
18
|
getLocalizedError,
|
|
16
19
|
getPasswordSchema,
|
|
17
20
|
getSearchParam,
|
|
18
21
|
getViewByPath,
|
|
19
22
|
isValidEmail,
|
|
20
23
|
organizationViewPaths
|
|
21
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YTGCDVH4.js";
|
|
22
25
|
|
|
23
26
|
// src/components/account/account-view.tsx
|
|
24
27
|
import { MenuIcon } from "lucide-react";
|
|
@@ -994,7 +997,7 @@ function CreateOrganizationDialog({
|
|
|
994
997
|
}) {
|
|
995
998
|
var _a, _b, _c;
|
|
996
999
|
const {
|
|
997
|
-
authClient,
|
|
1000
|
+
authClient: authClient2,
|
|
998
1001
|
localization: contextLocalization,
|
|
999
1002
|
organization: organizationOptions,
|
|
1000
1003
|
navigate,
|
|
@@ -1070,7 +1073,7 @@ function CreateOrganizationDialog({
|
|
|
1070
1073
|
};
|
|
1071
1074
|
async function onSubmit({ name, slug, logo: logo2 }) {
|
|
1072
1075
|
try {
|
|
1073
|
-
const organization = await
|
|
1076
|
+
const organization = await authClient2.organization.create({
|
|
1074
1077
|
name,
|
|
1075
1078
|
slug,
|
|
1076
1079
|
logo: logo2,
|
|
@@ -1080,7 +1083,7 @@ function CreateOrganizationDialog({
|
|
|
1080
1083
|
navigate(`${organizationOptions.basePath}/${organization.slug}`);
|
|
1081
1084
|
return;
|
|
1082
1085
|
}
|
|
1083
|
-
await
|
|
1086
|
+
await authClient2.organization.setActive({
|
|
1084
1087
|
organizationId: organization.id
|
|
1085
1088
|
});
|
|
1086
1089
|
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
@@ -1408,7 +1411,7 @@ function LeaveOrganizationDialog({
|
|
|
1408
1411
|
}) {
|
|
1409
1412
|
var _a, _b, _c;
|
|
1410
1413
|
const {
|
|
1411
|
-
authClient,
|
|
1414
|
+
authClient: authClient2,
|
|
1412
1415
|
hooks: { useListOrganizations },
|
|
1413
1416
|
localization: contextLocalization,
|
|
1414
1417
|
toast
|
|
@@ -1422,7 +1425,7 @@ function LeaveOrganizationDialog({
|
|
|
1422
1425
|
const handleLeaveOrganization = async () => {
|
|
1423
1426
|
setIsLeaving(true);
|
|
1424
1427
|
try {
|
|
1425
|
-
await
|
|
1428
|
+
await authClient2.organization.leave({
|
|
1426
1429
|
organizationId: organization.id,
|
|
1427
1430
|
fetchOptions: { throw: true }
|
|
1428
1431
|
});
|
|
@@ -1530,7 +1533,7 @@ function OrganizationCell({
|
|
|
1530
1533
|
}) {
|
|
1531
1534
|
var _a;
|
|
1532
1535
|
const {
|
|
1533
|
-
authClient,
|
|
1536
|
+
authClient: authClient2,
|
|
1534
1537
|
localization: contextLocalization,
|
|
1535
1538
|
organization: organizationOptions,
|
|
1536
1539
|
navigate,
|
|
@@ -1553,7 +1556,7 @@ function OrganizationCell({
|
|
|
1553
1556
|
return;
|
|
1554
1557
|
}
|
|
1555
1558
|
try {
|
|
1556
|
-
await
|
|
1559
|
+
await authClient2.organization.setActive({
|
|
1557
1560
|
organizationId: organization.id,
|
|
1558
1561
|
fetchOptions: {
|
|
1559
1562
|
throw: true
|
|
@@ -1570,7 +1573,7 @@ function OrganizationCell({
|
|
|
1570
1573
|
setIsManagingOrganization(false);
|
|
1571
1574
|
}
|
|
1572
1575
|
}, [
|
|
1573
|
-
|
|
1576
|
+
authClient2,
|
|
1574
1577
|
organization.id,
|
|
1575
1578
|
organizationOptions == null ? void 0 : organizationOptions.basePath,
|
|
1576
1579
|
(_a = organizationOptions == null ? void 0 : organizationOptions.viewPaths) == null ? void 0 : _a.SETTINGS,
|
|
@@ -1890,7 +1893,7 @@ function UserInvitationRow({
|
|
|
1890
1893
|
onChanged
|
|
1891
1894
|
}) {
|
|
1892
1895
|
const {
|
|
1893
|
-
authClient,
|
|
1896
|
+
authClient: authClient2,
|
|
1894
1897
|
organization: organizationOptions,
|
|
1895
1898
|
localization: contextLocalization,
|
|
1896
1899
|
toast
|
|
@@ -1907,7 +1910,7 @@ function UserInvitationRow({
|
|
|
1907
1910
|
const handleAccept = async () => {
|
|
1908
1911
|
setIsLoading(true);
|
|
1909
1912
|
try {
|
|
1910
|
-
await
|
|
1913
|
+
await authClient2.organization.acceptInvitation({
|
|
1911
1914
|
invitationId: invitation.id,
|
|
1912
1915
|
fetchOptions: { throw: true }
|
|
1913
1916
|
});
|
|
@@ -1927,7 +1930,7 @@ function UserInvitationRow({
|
|
|
1927
1930
|
const handleReject = async () => {
|
|
1928
1931
|
setIsLoading(true);
|
|
1929
1932
|
try {
|
|
1930
|
-
await
|
|
1933
|
+
await authClient2.organization.rejectInvitation({
|
|
1931
1934
|
invitationId: invitation.id,
|
|
1932
1935
|
fetchOptions: { throw: true }
|
|
1933
1936
|
});
|
|
@@ -2774,7 +2777,7 @@ function ChangeEmailCard({
|
|
|
2774
2777
|
...props
|
|
2775
2778
|
}) {
|
|
2776
2779
|
const {
|
|
2777
|
-
authClient,
|
|
2780
|
+
authClient: authClient2,
|
|
2778
2781
|
emailVerification,
|
|
2779
2782
|
hooks: { useSession },
|
|
2780
2783
|
localization: contextLocalization,
|
|
@@ -2804,7 +2807,7 @@ function ChangeEmailCard({
|
|
|
2804
2807
|
return;
|
|
2805
2808
|
}
|
|
2806
2809
|
try {
|
|
2807
|
-
await
|
|
2810
|
+
await authClient2.changeEmail({
|
|
2808
2811
|
newEmail: email,
|
|
2809
2812
|
callbackURL: window.location.pathname,
|
|
2810
2813
|
fetchOptions: { throw: true }
|
|
@@ -2833,7 +2836,7 @@ function ChangeEmailCard({
|
|
|
2833
2836
|
const email = sessionData.user.email;
|
|
2834
2837
|
setResendDisabled(true);
|
|
2835
2838
|
try {
|
|
2836
|
-
await
|
|
2839
|
+
await authClient2.sendVerificationEmail({
|
|
2837
2840
|
email,
|
|
2838
2841
|
fetchOptions: { throw: true }
|
|
2839
2842
|
});
|
|
@@ -3562,7 +3565,7 @@ function CreateApiKeyDialog({
|
|
|
3562
3565
|
}) {
|
|
3563
3566
|
var _a, _b, _c;
|
|
3564
3567
|
const {
|
|
3565
|
-
authClient,
|
|
3568
|
+
authClient: authClient2,
|
|
3566
3569
|
apiKey,
|
|
3567
3570
|
hooks: { useListOrganizations, useSession },
|
|
3568
3571
|
localization: contextLocalization,
|
|
@@ -3604,7 +3607,7 @@ function CreateApiKeyDialog({
|
|
|
3604
3607
|
...typeof apiKey === "object" ? apiKey.metadata : {},
|
|
3605
3608
|
...contextOrganization && selectedOrgId ? { organizationId: selectedOrgId } : {}
|
|
3606
3609
|
};
|
|
3607
|
-
const result = await
|
|
3610
|
+
const result = await authClient2.apiKey.create({
|
|
3608
3611
|
name: values.name,
|
|
3609
3612
|
expiresIn,
|
|
3610
3613
|
prefix: typeof apiKey === "object" ? apiKey.prefix : void 0,
|
|
@@ -3970,7 +3973,7 @@ function DeleteAccountDialog({
|
|
|
3970
3973
|
}) {
|
|
3971
3974
|
var _a, _b, _c;
|
|
3972
3975
|
const {
|
|
3973
|
-
authClient,
|
|
3976
|
+
authClient: authClient2,
|
|
3974
3977
|
basePath,
|
|
3975
3978
|
baseURL,
|
|
3976
3979
|
deleteUser,
|
|
@@ -4011,7 +4014,7 @@ function DeleteAccountDialog({
|
|
|
4011
4014
|
params.callbackURL = `${baseURL}${basePath}/${viewPaths.SIGN_OUT}`;
|
|
4012
4015
|
}
|
|
4013
4016
|
try {
|
|
4014
|
-
await
|
|
4017
|
+
await authClient2.deleteUser({
|
|
4015
4018
|
...params,
|
|
4016
4019
|
fetchOptions: {
|
|
4017
4020
|
throw: true
|
|
@@ -4371,7 +4374,7 @@ function PasskeysCard({
|
|
|
4371
4374
|
localization
|
|
4372
4375
|
}) {
|
|
4373
4376
|
const {
|
|
4374
|
-
authClient,
|
|
4377
|
+
authClient: authClient2,
|
|
4375
4378
|
freshAge,
|
|
4376
4379
|
hooks: { useListPasskeys, useSession },
|
|
4377
4380
|
localization: authLocalization2,
|
|
@@ -4389,7 +4392,7 @@ function PasskeysCard({
|
|
|
4389
4392
|
return;
|
|
4390
4393
|
}
|
|
4391
4394
|
try {
|
|
4392
|
-
await
|
|
4395
|
+
await authClient2.passkey.addPasskey({
|
|
4393
4396
|
fetchOptions: { throw: true }
|
|
4394
4397
|
});
|
|
4395
4398
|
await (refetch == null ? void 0 : refetch());
|
|
@@ -5034,7 +5037,7 @@ function ProviderCell({
|
|
|
5034
5037
|
refetch
|
|
5035
5038
|
}) {
|
|
5036
5039
|
const {
|
|
5037
|
-
authClient,
|
|
5040
|
+
authClient: authClient2,
|
|
5038
5041
|
basePath,
|
|
5039
5042
|
baseURL,
|
|
5040
5043
|
localization: contextLocalization,
|
|
@@ -5049,13 +5052,13 @@ function ProviderCell({
|
|
|
5049
5052
|
const callbackURL = `${baseURL}${basePath}/${viewPaths.CALLBACK}?redirectTo=${window.location.pathname}`;
|
|
5050
5053
|
try {
|
|
5051
5054
|
if (other) {
|
|
5052
|
-
await
|
|
5055
|
+
await authClient2.oauth2.link({
|
|
5053
5056
|
providerId: provider.provider,
|
|
5054
5057
|
callbackURL,
|
|
5055
5058
|
fetchOptions: { throw: true }
|
|
5056
5059
|
});
|
|
5057
5060
|
} else {
|
|
5058
|
-
await
|
|
5061
|
+
await authClient2.linkSocial({
|
|
5059
5062
|
provider: provider.provider,
|
|
5060
5063
|
callbackURL,
|
|
5061
5064
|
fetchOptions: { throw: true }
|
|
@@ -5287,7 +5290,7 @@ function ChangePasswordCard({
|
|
|
5287
5290
|
passwordValidation
|
|
5288
5291
|
}) {
|
|
5289
5292
|
const {
|
|
5290
|
-
authClient,
|
|
5293
|
+
authClient: authClient2,
|
|
5291
5294
|
basePath,
|
|
5292
5295
|
baseURL,
|
|
5293
5296
|
credentials,
|
|
@@ -5344,7 +5347,7 @@ function ChangePasswordCard({
|
|
|
5344
5347
|
if (!sessionData) return;
|
|
5345
5348
|
const email = sessionData == null ? void 0 : sessionData.user.email;
|
|
5346
5349
|
try {
|
|
5347
|
-
await
|
|
5350
|
+
await authClient2.requestPasswordReset({
|
|
5348
5351
|
email,
|
|
5349
5352
|
redirectTo: `${baseURL}${basePath}/${viewPaths.RESET_PASSWORD}`,
|
|
5350
5353
|
fetchOptions: { throw: true }
|
|
@@ -5365,7 +5368,7 @@ function ChangePasswordCard({
|
|
|
5365
5368
|
newPassword
|
|
5366
5369
|
}) => {
|
|
5367
5370
|
try {
|
|
5368
|
-
await
|
|
5371
|
+
await authClient2.changePassword({
|
|
5369
5372
|
currentPassword,
|
|
5370
5373
|
newPassword,
|
|
5371
5374
|
revokeOtherSessions: true,
|
|
@@ -5761,7 +5764,7 @@ function TwoFactorPasswordDialog({
|
|
|
5761
5764
|
var _a, _b;
|
|
5762
5765
|
const {
|
|
5763
5766
|
localization,
|
|
5764
|
-
authClient,
|
|
5767
|
+
authClient: authClient2,
|
|
5765
5768
|
basePath,
|
|
5766
5769
|
viewPaths,
|
|
5767
5770
|
navigate,
|
|
@@ -5783,7 +5786,7 @@ function TwoFactorPasswordDialog({
|
|
|
5783
5786
|
const { isSubmitting } = form.formState;
|
|
5784
5787
|
async function enableTwoFactor({ password }) {
|
|
5785
5788
|
try {
|
|
5786
|
-
const response = await
|
|
5789
|
+
const response = await authClient2.twoFactor.enable({
|
|
5787
5790
|
password,
|
|
5788
5791
|
fetchOptions: { throw: true }
|
|
5789
5792
|
});
|
|
@@ -5804,7 +5807,7 @@ function TwoFactorPasswordDialog({
|
|
|
5804
5807
|
}
|
|
5805
5808
|
async function disableTwoFactor({ password }) {
|
|
5806
5809
|
try {
|
|
5807
|
-
await
|
|
5810
|
+
await authClient2.twoFactor.disable({
|
|
5808
5811
|
password,
|
|
5809
5812
|
fetchOptions: { throw: true }
|
|
5810
5813
|
});
|
|
@@ -6505,7 +6508,7 @@ function EmailForm({
|
|
|
6505
6508
|
}) {
|
|
6506
6509
|
const isHydrated = useIsHydrated();
|
|
6507
6510
|
const {
|
|
6508
|
-
authClient,
|
|
6511
|
+
authClient: authClient2,
|
|
6509
6512
|
localization: contextLocalization,
|
|
6510
6513
|
toast
|
|
6511
6514
|
} = useContext44(AuthUIContext);
|
|
@@ -6527,7 +6530,7 @@ function EmailForm({
|
|
|
6527
6530
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
6528
6531
|
async function sendEmailOTP({ email }) {
|
|
6529
6532
|
try {
|
|
6530
|
-
await
|
|
6533
|
+
await authClient2.emailOtp.sendVerificationOtp({
|
|
6531
6534
|
email,
|
|
6532
6535
|
type: "sign-in",
|
|
6533
6536
|
fetchOptions: { throw: true }
|
|
@@ -6600,7 +6603,7 @@ function OTPForm({
|
|
|
6600
6603
|
email
|
|
6601
6604
|
}) {
|
|
6602
6605
|
const {
|
|
6603
|
-
authClient,
|
|
6606
|
+
authClient: authClient2,
|
|
6604
6607
|
localization: contextLocalization,
|
|
6605
6608
|
toast
|
|
6606
6609
|
} = useContext44(AuthUIContext);
|
|
@@ -6627,7 +6630,7 @@ function OTPForm({
|
|
|
6627
6630
|
}, [form.formState.isSubmitting, transitionPending, setIsSubmitting]);
|
|
6628
6631
|
async function verifyCode({ code }) {
|
|
6629
6632
|
try {
|
|
6630
|
-
await
|
|
6633
|
+
await authClient2.signIn.emailOtp({
|
|
6631
6634
|
email,
|
|
6632
6635
|
otp: code,
|
|
6633
6636
|
fetchOptions: { throw: true }
|
|
@@ -6969,7 +6972,7 @@ function ForgotPasswordForm({
|
|
|
6969
6972
|
localization
|
|
6970
6973
|
});
|
|
6971
6974
|
const {
|
|
6972
|
-
authClient,
|
|
6975
|
+
authClient: authClient2,
|
|
6973
6976
|
basePath,
|
|
6974
6977
|
baseURL,
|
|
6975
6978
|
localization: contextLocalization,
|
|
@@ -7001,7 +7004,7 @@ function ForgotPasswordForm({
|
|
|
7001
7004
|
throw: true,
|
|
7002
7005
|
headers: await getCaptchaHeaders("/forget-password")
|
|
7003
7006
|
};
|
|
7004
|
-
await
|
|
7007
|
+
await authClient2.requestPasswordReset({
|
|
7005
7008
|
email,
|
|
7006
7009
|
redirectTo: `${baseURL}${basePath}/${viewPaths.RESET_PASSWORD}`,
|
|
7007
7010
|
fetchOptions
|
|
@@ -7096,7 +7099,7 @@ function MagicLinkForm({
|
|
|
7096
7099
|
localization
|
|
7097
7100
|
});
|
|
7098
7101
|
const {
|
|
7099
|
-
authClient,
|
|
7102
|
+
authClient: authClient2,
|
|
7100
7103
|
basePath,
|
|
7101
7104
|
baseURL,
|
|
7102
7105
|
persistClient,
|
|
@@ -7142,7 +7145,7 @@ function MagicLinkForm({
|
|
|
7142
7145
|
throw: true,
|
|
7143
7146
|
headers: await getCaptchaHeaders("/sign-in/magic-link")
|
|
7144
7147
|
};
|
|
7145
|
-
await
|
|
7148
|
+
await authClient2.signIn.magicLink({
|
|
7146
7149
|
email,
|
|
7147
7150
|
callbackURL: getCallbackURL(),
|
|
7148
7151
|
fetchOptions
|
|
@@ -7230,7 +7233,7 @@ function RecoverAccountForm({
|
|
|
7230
7233
|
setIsSubmitting
|
|
7231
7234
|
}) {
|
|
7232
7235
|
const {
|
|
7233
|
-
authClient,
|
|
7236
|
+
authClient: authClient2,
|
|
7234
7237
|
localization: contextLocalization,
|
|
7235
7238
|
toast
|
|
7236
7239
|
} = useContext51(AuthUIContext);
|
|
@@ -7253,7 +7256,7 @@ function RecoverAccountForm({
|
|
|
7253
7256
|
}, [form.formState.isSubmitting, transitionPending, setIsSubmitting]);
|
|
7254
7257
|
async function verifyBackupCode({ code }) {
|
|
7255
7258
|
try {
|
|
7256
|
-
await
|
|
7259
|
+
await authClient2.twoFactor.verifyBackupCode({
|
|
7257
7260
|
code,
|
|
7258
7261
|
fetchOptions: { throw: true }
|
|
7259
7262
|
});
|
|
@@ -7325,7 +7328,7 @@ function ResetPasswordForm({
|
|
|
7325
7328
|
}) {
|
|
7326
7329
|
const tokenChecked = useRef5(false);
|
|
7327
7330
|
const {
|
|
7328
|
-
authClient,
|
|
7331
|
+
authClient: authClient2,
|
|
7329
7332
|
basePath,
|
|
7330
7333
|
credentials,
|
|
7331
7334
|
localization: contextLocalization,
|
|
@@ -7381,7 +7384,7 @@ function ResetPasswordForm({
|
|
|
7381
7384
|
try {
|
|
7382
7385
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7383
7386
|
const token = searchParams.get("token");
|
|
7384
|
-
await
|
|
7387
|
+
await authClient2.resetPassword({
|
|
7385
7388
|
newPassword,
|
|
7386
7389
|
token,
|
|
7387
7390
|
fetchOptions: { throw: true }
|
|
@@ -7488,7 +7491,7 @@ function SignInForm({
|
|
|
7488
7491
|
localization
|
|
7489
7492
|
});
|
|
7490
7493
|
const {
|
|
7491
|
-
authClient,
|
|
7494
|
+
authClient: authClient2,
|
|
7492
7495
|
basePath,
|
|
7493
7496
|
credentials,
|
|
7494
7497
|
localization: contextLocalization,
|
|
@@ -7538,7 +7541,7 @@ function SignInForm({
|
|
|
7538
7541
|
throw: true,
|
|
7539
7542
|
headers: await getCaptchaHeaders("/sign-in/username")
|
|
7540
7543
|
};
|
|
7541
|
-
response = await
|
|
7544
|
+
response = await authClient2.signIn.username({
|
|
7542
7545
|
username: email,
|
|
7543
7546
|
password,
|
|
7544
7547
|
rememberMe,
|
|
@@ -7549,7 +7552,7 @@ function SignInForm({
|
|
|
7549
7552
|
throw: true,
|
|
7550
7553
|
headers: await getCaptchaHeaders("/sign-in/email")
|
|
7551
7554
|
};
|
|
7552
|
-
response = await
|
|
7555
|
+
response = await authClient2.signIn.email({
|
|
7553
7556
|
email,
|
|
7554
7557
|
password,
|
|
7555
7558
|
rememberMe,
|
|
@@ -7702,7 +7705,7 @@ function SignUpForm({
|
|
|
7702
7705
|
});
|
|
7703
7706
|
const {
|
|
7704
7707
|
additionalFields,
|
|
7705
|
-
authClient,
|
|
7708
|
+
authClient: authClient2,
|
|
7706
7709
|
basePath,
|
|
7707
7710
|
baseURL,
|
|
7708
7711
|
credentials,
|
|
@@ -7904,7 +7907,7 @@ function SignUpForm({
|
|
|
7904
7907
|
if (image !== void 0) {
|
|
7905
7908
|
additionalParams.image = image;
|
|
7906
7909
|
}
|
|
7907
|
-
const data = await
|
|
7910
|
+
const data = await authClient2.signUp.email({
|
|
7908
7911
|
email,
|
|
7909
7912
|
password,
|
|
7910
7913
|
name: name || "",
|
|
@@ -8293,7 +8296,7 @@ function TwoFactorForm({
|
|
|
8293
8296
|
const totpURI = isHydrated ? getSearchParam("totpURI") : null;
|
|
8294
8297
|
const initialSendRef = useRef7(false);
|
|
8295
8298
|
const {
|
|
8296
|
-
authClient,
|
|
8299
|
+
authClient: authClient2,
|
|
8297
8300
|
basePath,
|
|
8298
8301
|
hooks: { useSession },
|
|
8299
8302
|
localization: contextLocalization,
|
|
@@ -8348,7 +8351,7 @@ function TwoFactorForm({
|
|
|
8348
8351
|
if (isSendingOtp || cooldownSeconds > 0) return;
|
|
8349
8352
|
try {
|
|
8350
8353
|
setIsSendingOtp(true);
|
|
8351
|
-
await
|
|
8354
|
+
await authClient2.twoFactor.sendOtp({
|
|
8352
8355
|
fetchOptions: { throw: true }
|
|
8353
8356
|
});
|
|
8354
8357
|
setCooldownSeconds(60);
|
|
@@ -8369,7 +8372,7 @@ function TwoFactorForm({
|
|
|
8369
8372
|
trustDevice
|
|
8370
8373
|
}) {
|
|
8371
8374
|
try {
|
|
8372
|
-
const verifyMethod = method === "totp" ?
|
|
8375
|
+
const verifyMethod = method === "totp" ? authClient2.twoFactor.verifyTotp : authClient2.twoFactor.verifyOtp;
|
|
8373
8376
|
await verifyMethod({
|
|
8374
8377
|
code,
|
|
8375
8378
|
trustDevice,
|
|
@@ -8569,15 +8572,15 @@ import { useContext as useContext56, useEffect as useEffect13, useRef as useRef8
|
|
|
8569
8572
|
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
8570
8573
|
function SignOut() {
|
|
8571
8574
|
const signingOut = useRef8(false);
|
|
8572
|
-
const { authClient, basePath, viewPaths } = useContext56(AuthUIContext);
|
|
8575
|
+
const { authClient: authClient2, basePath, viewPaths } = useContext56(AuthUIContext);
|
|
8573
8576
|
const { onSuccess } = useOnSuccessTransition({
|
|
8574
8577
|
redirectTo: `${basePath}/${viewPaths.SIGN_IN}`
|
|
8575
8578
|
});
|
|
8576
8579
|
useEffect13(() => {
|
|
8577
8580
|
if (signingOut.current) return;
|
|
8578
8581
|
signingOut.current = true;
|
|
8579
|
-
|
|
8580
|
-
}, [
|
|
8582
|
+
authClient2.signOut().finally(onSuccess);
|
|
8583
|
+
}, [authClient2, onSuccess]);
|
|
8581
8584
|
return /* @__PURE__ */ jsx74(Loader223, { className: "animate-spin" });
|
|
8582
8585
|
}
|
|
8583
8586
|
|
|
@@ -8846,7 +8849,7 @@ function AcceptInvitationContent({
|
|
|
8846
8849
|
}) {
|
|
8847
8850
|
var _a;
|
|
8848
8851
|
const {
|
|
8849
|
-
authClient,
|
|
8852
|
+
authClient: authClient2,
|
|
8850
8853
|
hooks: { useInvitation },
|
|
8851
8854
|
localization: contextLocalization,
|
|
8852
8855
|
organization,
|
|
@@ -8899,7 +8902,7 @@ function AcceptInvitationContent({
|
|
|
8899
8902
|
const acceptInvitation = async () => {
|
|
8900
8903
|
setIsAccepting(true);
|
|
8901
8904
|
try {
|
|
8902
|
-
await
|
|
8905
|
+
await authClient2.organization.acceptInvitation({
|
|
8903
8906
|
invitationId,
|
|
8904
8907
|
fetchOptions: { throw: true }
|
|
8905
8908
|
});
|
|
@@ -8919,7 +8922,7 @@ function AcceptInvitationContent({
|
|
|
8919
8922
|
const rejectInvitation = async () => {
|
|
8920
8923
|
setIsRejecting(true);
|
|
8921
8924
|
try {
|
|
8922
|
-
await
|
|
8925
|
+
await authClient2.organization.rejectInvitation({
|
|
8923
8926
|
invitationId,
|
|
8924
8927
|
fetchOptions: { throw: true }
|
|
8925
8928
|
});
|
|
@@ -9200,7 +9203,7 @@ function MagicLinkButton({
|
|
|
9200
9203
|
import { useContext as useContext61, useEffect as useEffect16, useMemo as useMemo13, useRef as useRef9 } from "react";
|
|
9201
9204
|
function OneTap({ localization, redirectTo }) {
|
|
9202
9205
|
const {
|
|
9203
|
-
authClient,
|
|
9206
|
+
authClient: authClient2,
|
|
9204
9207
|
localization: contextLocalization,
|
|
9205
9208
|
toast
|
|
9206
9209
|
} = useContext61(AuthUIContext);
|
|
@@ -9214,7 +9217,7 @@ function OneTap({ localization, redirectTo }) {
|
|
|
9214
9217
|
if (oneTapFetched.current) return;
|
|
9215
9218
|
oneTapFetched.current = true;
|
|
9216
9219
|
try {
|
|
9217
|
-
|
|
9220
|
+
authClient2.oneTap({
|
|
9218
9221
|
fetchOptions: {
|
|
9219
9222
|
throw: true,
|
|
9220
9223
|
onSuccess
|
|
@@ -9226,7 +9229,7 @@ function OneTap({ localization, redirectTo }) {
|
|
|
9226
9229
|
message: getLocalizedError({ error, localization })
|
|
9227
9230
|
});
|
|
9228
9231
|
}
|
|
9229
|
-
}, [
|
|
9232
|
+
}, [authClient2, localization, onSuccess, toast]);
|
|
9230
9233
|
return null;
|
|
9231
9234
|
}
|
|
9232
9235
|
|
|
@@ -9243,7 +9246,7 @@ function PasskeyButton({
|
|
|
9243
9246
|
}) {
|
|
9244
9247
|
var _a, _b;
|
|
9245
9248
|
const {
|
|
9246
|
-
authClient,
|
|
9249
|
+
authClient: authClient2,
|
|
9247
9250
|
localization: contextLocalization,
|
|
9248
9251
|
toast
|
|
9249
9252
|
} = useContext62(AuthUIContext);
|
|
@@ -9252,7 +9255,7 @@ function PasskeyButton({
|
|
|
9252
9255
|
const signInPassKey = async () => {
|
|
9253
9256
|
setIsSubmitting == null ? void 0 : setIsSubmitting(true);
|
|
9254
9257
|
try {
|
|
9255
|
-
const response = await
|
|
9258
|
+
const response = await authClient2.signIn.passkey({
|
|
9256
9259
|
fetchOptions: { throw: true }
|
|
9257
9260
|
});
|
|
9258
9261
|
if (response == null ? void 0 : response.error) {
|
|
@@ -9316,7 +9319,7 @@ function ProviderButton({
|
|
|
9316
9319
|
}) {
|
|
9317
9320
|
var _a, _b, _c, _d;
|
|
9318
9321
|
const {
|
|
9319
|
-
authClient,
|
|
9322
|
+
authClient: authClient2,
|
|
9320
9323
|
basePath,
|
|
9321
9324
|
baseURL,
|
|
9322
9325
|
persistClient,
|
|
@@ -9356,7 +9359,7 @@ function ProviderButton({
|
|
|
9356
9359
|
setIsSubmitting(false);
|
|
9357
9360
|
}, 1e4);
|
|
9358
9361
|
} else {
|
|
9359
|
-
await
|
|
9362
|
+
await authClient2.signIn.oauth2(oauth2Params);
|
|
9360
9363
|
}
|
|
9361
9364
|
} else {
|
|
9362
9365
|
const socialParams = {
|
|
@@ -9370,7 +9373,7 @@ function ProviderButton({
|
|
|
9370
9373
|
setIsSubmitting(false);
|
|
9371
9374
|
}, 1e4);
|
|
9372
9375
|
} else {
|
|
9373
|
-
await
|
|
9376
|
+
await authClient2.signIn.social(socialParams);
|
|
9374
9377
|
}
|
|
9375
9378
|
}
|
|
9376
9379
|
} catch (error) {
|
|
@@ -9714,7 +9717,7 @@ function DeleteOrganizationDialog({
|
|
|
9714
9717
|
}) {
|
|
9715
9718
|
var _a, _b, _c;
|
|
9716
9719
|
const {
|
|
9717
|
-
authClient,
|
|
9720
|
+
authClient: authClient2,
|
|
9718
9721
|
account: accountOptions,
|
|
9719
9722
|
hooks: { useListOrganizations },
|
|
9720
9723
|
localization: contextLocalization,
|
|
@@ -9740,7 +9743,7 @@ function DeleteOrganizationDialog({
|
|
|
9740
9743
|
const { isSubmitting } = form.formState;
|
|
9741
9744
|
const deleteOrganization = async () => {
|
|
9742
9745
|
try {
|
|
9743
|
-
await
|
|
9746
|
+
await authClient2.organization.delete({
|
|
9744
9747
|
organizationId: organization.id,
|
|
9745
9748
|
fetchOptions: { throw: true }
|
|
9746
9749
|
});
|
|
@@ -9967,7 +9970,7 @@ function InvitationCell({
|
|
|
9967
9970
|
organization
|
|
9968
9971
|
}) {
|
|
9969
9972
|
const {
|
|
9970
|
-
authClient,
|
|
9973
|
+
authClient: authClient2,
|
|
9971
9974
|
hooks: { useListInvitations },
|
|
9972
9975
|
organization: organizationOptions,
|
|
9973
9976
|
localization: contextLocalization,
|
|
@@ -9991,7 +9994,7 @@ function InvitationCell({
|
|
|
9991
9994
|
const handleCancelInvitation = async () => {
|
|
9992
9995
|
setIsLoading(true);
|
|
9993
9996
|
try {
|
|
9994
|
-
await
|
|
9997
|
+
await authClient2.organization.cancelInvitation({
|
|
9995
9998
|
invitationId: invitation.id,
|
|
9996
9999
|
fetchOptions: { throw: true }
|
|
9997
10000
|
});
|
|
@@ -10454,7 +10457,7 @@ function InviteMemberDialog({
|
|
|
10454
10457
|
}) {
|
|
10455
10458
|
var _a, _b, _c;
|
|
10456
10459
|
const {
|
|
10457
|
-
authClient,
|
|
10460
|
+
authClient: authClient2,
|
|
10458
10461
|
hooks: { useListInvitations, useListMembers, useSession },
|
|
10459
10462
|
localization: contextLocalization,
|
|
10460
10463
|
toast,
|
|
@@ -10500,7 +10503,7 @@ function InviteMemberDialog({
|
|
|
10500
10503
|
const isSubmitting = form.formState.isSubmitting;
|
|
10501
10504
|
async function onSubmit({ email, role }) {
|
|
10502
10505
|
try {
|
|
10503
|
-
await
|
|
10506
|
+
await authClient2.organization.inviteMember({
|
|
10504
10507
|
email,
|
|
10505
10508
|
role,
|
|
10506
10509
|
organizationId: organization.id,
|
|
@@ -10648,7 +10651,7 @@ function RemoveMemberDialog({
|
|
|
10648
10651
|
}) {
|
|
10649
10652
|
var _a, _b, _c;
|
|
10650
10653
|
const {
|
|
10651
|
-
authClient,
|
|
10654
|
+
authClient: authClient2,
|
|
10652
10655
|
hooks: { useListMembers },
|
|
10653
10656
|
localization: contextLocalization,
|
|
10654
10657
|
toast
|
|
@@ -10664,7 +10667,7 @@ function RemoveMemberDialog({
|
|
|
10664
10667
|
const removeMember = async () => {
|
|
10665
10668
|
setIsRemoving(true);
|
|
10666
10669
|
try {
|
|
10667
|
-
await
|
|
10670
|
+
await authClient2.organization.removeMember({
|
|
10668
10671
|
memberIdOrEmail: member.id,
|
|
10669
10672
|
organizationId: member.organizationId,
|
|
10670
10673
|
fetchOptions: { throw: true }
|
|
@@ -10768,7 +10771,7 @@ function UpdateMemberRoleDialog({
|
|
|
10768
10771
|
}) {
|
|
10769
10772
|
var _a, _b, _c, _d;
|
|
10770
10773
|
const {
|
|
10771
|
-
authClient,
|
|
10774
|
+
authClient: authClient2,
|
|
10772
10775
|
hooks: { useSession, useListMembers },
|
|
10773
10776
|
localization: contextLocalization,
|
|
10774
10777
|
organization,
|
|
@@ -10816,7 +10819,7 @@ function UpdateMemberRoleDialog({
|
|
|
10816
10819
|
}
|
|
10817
10820
|
setIsUpdating(true);
|
|
10818
10821
|
try {
|
|
10819
|
-
await
|
|
10822
|
+
await authClient2.organization.updateMemberRole({
|
|
10820
10823
|
memberId: member.id,
|
|
10821
10824
|
role: selectedRole,
|
|
10822
10825
|
organizationId: member.organizationId,
|
|
@@ -11645,7 +11648,7 @@ function OrganizationSwitcher({
|
|
|
11645
11648
|
}) {
|
|
11646
11649
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
11647
11650
|
const {
|
|
11648
|
-
authClient,
|
|
11651
|
+
authClient: authClient2,
|
|
11649
11652
|
basePath,
|
|
11650
11653
|
hooks: { useSession, useListOrganizations },
|
|
11651
11654
|
localization: contextLocalization,
|
|
@@ -11702,7 +11705,7 @@ function OrganizationSwitcher({
|
|
|
11702
11705
|
setActiveOrganizationPending(true);
|
|
11703
11706
|
try {
|
|
11704
11707
|
onSetActive == null ? void 0 : onSetActive(organization);
|
|
11705
|
-
await
|
|
11708
|
+
await authClient2.organization.setActive({
|
|
11706
11709
|
organizationId: (organization == null ? void 0 : organization.id) || null,
|
|
11707
11710
|
fetchOptions: {
|
|
11708
11711
|
throw: true
|
|
@@ -11718,7 +11721,7 @@ function OrganizationSwitcher({
|
|
|
11718
11721
|
}
|
|
11719
11722
|
},
|
|
11720
11723
|
[
|
|
11721
|
-
|
|
11724
|
+
authClient2,
|
|
11722
11725
|
toast,
|
|
11723
11726
|
localization,
|
|
11724
11727
|
onSetActive,
|
|
@@ -12519,6 +12522,39 @@ function UserButton({
|
|
|
12519
12522
|
)
|
|
12520
12523
|
] });
|
|
12521
12524
|
}
|
|
12525
|
+
|
|
12526
|
+
// src/types/auth-client.ts
|
|
12527
|
+
import {
|
|
12528
|
+
anonymousClient,
|
|
12529
|
+
apiKeyClient,
|
|
12530
|
+
emailOTPClient,
|
|
12531
|
+
genericOAuthClient,
|
|
12532
|
+
magicLinkClient,
|
|
12533
|
+
multiSessionClient,
|
|
12534
|
+
oneTapClient,
|
|
12535
|
+
organizationClient,
|
|
12536
|
+
passkeyClient,
|
|
12537
|
+
twoFactorClient,
|
|
12538
|
+
usernameClient
|
|
12539
|
+
} from "better-auth/client/plugins";
|
|
12540
|
+
import { createAuthClient } from "better-auth/react";
|
|
12541
|
+
var authClient = createAuthClient({
|
|
12542
|
+
plugins: [
|
|
12543
|
+
apiKeyClient(),
|
|
12544
|
+
multiSessionClient(),
|
|
12545
|
+
passkeyClient(),
|
|
12546
|
+
oneTapClient({
|
|
12547
|
+
clientId: ""
|
|
12548
|
+
}),
|
|
12549
|
+
genericOAuthClient(),
|
|
12550
|
+
anonymousClient(),
|
|
12551
|
+
usernameClient(),
|
|
12552
|
+
magicLinkClient(),
|
|
12553
|
+
emailOTPClient(),
|
|
12554
|
+
twoFactorClient(),
|
|
12555
|
+
organizationClient()
|
|
12556
|
+
]
|
|
12557
|
+
});
|
|
12522
12558
|
export {
|
|
12523
12559
|
AcceptInvitationCard,
|
|
12524
12560
|
AccountSettingsCards,
|
|
@@ -12558,6 +12594,7 @@ export {
|
|
|
12558
12594
|
OrganizationLogoCard,
|
|
12559
12595
|
OrganizationMembersCard,
|
|
12560
12596
|
OrganizationNameCard,
|
|
12597
|
+
OrganizationRefetcher,
|
|
12561
12598
|
OrganizationSettingsCards,
|
|
12562
12599
|
OrganizationSlugCard,
|
|
12563
12600
|
OrganizationSwitcher,
|
|
@@ -12599,12 +12636,25 @@ export {
|
|
|
12599
12636
|
XIcon2 as XIcon,
|
|
12600
12637
|
ZoomIcon,
|
|
12601
12638
|
accountViewPaths,
|
|
12639
|
+
authClient,
|
|
12602
12640
|
authLocalization,
|
|
12603
12641
|
authViewPaths,
|
|
12642
|
+
cn,
|
|
12643
|
+
errorCodeToCamelCase,
|
|
12644
|
+
getKeyByValue,
|
|
12645
|
+
getLocalizedError,
|
|
12646
|
+
getPasswordSchema,
|
|
12647
|
+
getSearchParam,
|
|
12604
12648
|
getViewByPath,
|
|
12649
|
+
isValidEmail,
|
|
12605
12650
|
organizationViewPaths,
|
|
12606
12651
|
socialProviders,
|
|
12607
12652
|
useAuthData,
|
|
12608
12653
|
useAuthenticate,
|
|
12609
|
-
|
|
12654
|
+
useCaptcha,
|
|
12655
|
+
useCurrentOrganization,
|
|
12656
|
+
useIsHydrated,
|
|
12657
|
+
useLang,
|
|
12658
|
+
useOnSuccessTransition,
|
|
12659
|
+
useTheme
|
|
12610
12660
|
};
|