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