better-auth-ui 3.2.12 → 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
2
2
|
import { BetterFetchError } from '@better-fetch/fetch';
|
|
3
3
|
import * as better_auth from 'better-auth';
|
|
4
|
-
import { Account, User } from 'better-auth';
|
|
4
|
+
import { Account, User as User$1 } from 'better-auth';
|
|
5
5
|
import * as better_auth_plugins_organization from 'better-auth/plugins/organization';
|
|
6
6
|
import { Member } from 'better-auth/plugins/organization';
|
|
7
7
|
import * as better_auth_react from 'better-auth/react';
|
|
@@ -6902,6 +6902,7 @@ declare const authClient: {
|
|
|
6902
6902
|
};
|
|
6903
6903
|
type AuthClient = typeof authClient;
|
|
6904
6904
|
type Session = AuthClient["$Infer"]["Session"]["session"];
|
|
6905
|
+
type User = AuthClient["$Infer"]["Session"]["user"];
|
|
6905
6906
|
|
|
6906
6907
|
type ApiKey = {
|
|
6907
6908
|
id: string;
|
|
@@ -6935,7 +6936,7 @@ type AuthHooks = {
|
|
|
6935
6936
|
useSession: () => ReturnType<AnyAuthClient["useSession"]>;
|
|
6936
6937
|
useListAccounts: () => AuthHook<Account[]>;
|
|
6937
6938
|
useAccountInfo: (params: Parameters<AuthClient["accountInfo"]>[0]) => AuthHook<{
|
|
6938
|
-
user: User;
|
|
6939
|
+
user: User$1;
|
|
6939
6940
|
}>;
|
|
6940
6941
|
useListDeviceSessions: () => AuthHook<AnyAuthClient["$Infer"]["Session"][]>;
|
|
6941
6942
|
useListSessions: () => AuthHook<AnyAuthSession["session"][]>;
|
|
@@ -6956,11 +6957,11 @@ type AuthHooks = {
|
|
|
6956
6957
|
useListUserInvitations: () => AuthHook<Invitation[]>;
|
|
6957
6958
|
useListMembers: (params: Parameters<AuthClient["organization"]["listMembers"]>[0]) => AuthHook<{
|
|
6958
6959
|
members: (Member & {
|
|
6959
|
-
user?: Partial<User> | null;
|
|
6960
|
+
user?: Partial<User$1> | null;
|
|
6960
6961
|
})[];
|
|
6961
6962
|
total: number;
|
|
6962
6963
|
}>;
|
|
6963
6964
|
useIsRestoring?: () => boolean;
|
|
6964
6965
|
};
|
|
6965
6966
|
|
|
6966
|
-
export type
|
|
6967
|
+
export { type AnyAuthClient as A, type Refetch as R, type Session as S, type User as U, authClient as a, type AuthClient as b, type AuthHooks as c };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
2
2
|
import { BetterFetchError } from '@better-fetch/fetch';
|
|
3
3
|
import * as better_auth from 'better-auth';
|
|
4
|
-
import { Account, User } from 'better-auth';
|
|
4
|
+
import { Account, User as User$1 } from 'better-auth';
|
|
5
5
|
import * as better_auth_plugins_organization from 'better-auth/plugins/organization';
|
|
6
6
|
import { Member } from 'better-auth/plugins/organization';
|
|
7
7
|
import * as better_auth_react from 'better-auth/react';
|
|
@@ -6902,6 +6902,7 @@ declare const authClient: {
|
|
|
6902
6902
|
};
|
|
6903
6903
|
type AuthClient = typeof authClient;
|
|
6904
6904
|
type Session = AuthClient["$Infer"]["Session"]["session"];
|
|
6905
|
+
type User = AuthClient["$Infer"]["Session"]["user"];
|
|
6905
6906
|
|
|
6906
6907
|
type ApiKey = {
|
|
6907
6908
|
id: string;
|
|
@@ -6935,7 +6936,7 @@ type AuthHooks = {
|
|
|
6935
6936
|
useSession: () => ReturnType<AnyAuthClient["useSession"]>;
|
|
6936
6937
|
useListAccounts: () => AuthHook<Account[]>;
|
|
6937
6938
|
useAccountInfo: (params: Parameters<AuthClient["accountInfo"]>[0]) => AuthHook<{
|
|
6938
|
-
user: User;
|
|
6939
|
+
user: User$1;
|
|
6939
6940
|
}>;
|
|
6940
6941
|
useListDeviceSessions: () => AuthHook<AnyAuthClient["$Infer"]["Session"][]>;
|
|
6941
6942
|
useListSessions: () => AuthHook<AnyAuthSession["session"][]>;
|
|
@@ -6956,11 +6957,11 @@ type AuthHooks = {
|
|
|
6956
6957
|
useListUserInvitations: () => AuthHook<Invitation[]>;
|
|
6957
6958
|
useListMembers: (params: Parameters<AuthClient["organization"]["listMembers"]>[0]) => AuthHook<{
|
|
6958
6959
|
members: (Member & {
|
|
6959
|
-
user?: Partial<User> | null;
|
|
6960
|
+
user?: Partial<User$1> | null;
|
|
6960
6961
|
})[];
|
|
6961
6962
|
total: number;
|
|
6962
6963
|
}>;
|
|
6963
6964
|
useIsRestoring?: () => boolean;
|
|
6964
6965
|
};
|
|
6965
6966
|
|
|
6966
|
-
export type
|
|
6967
|
+
export { type AnyAuthClient as A, type Refetch as R, type Session as S, type User as U, authClient as a, type AuthClient as b, type AuthHooks as c };
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode } from 'react';
|
|
4
|
-
import { f as AccountViewPaths, g as OrganizationViewPaths, h as authLocalization, c as AuthViewPaths, A as AuthLocalization } from './view-paths-
|
|
5
|
-
import { b as AuthClient,
|
|
4
|
+
import { f as AccountViewPaths, P as PasswordValidation, g as OrganizationViewPaths, h as authLocalization, c as AuthViewPaths, A as AuthLocalization } from './view-paths-CIL7NXLh.js';
|
|
5
|
+
import { b as AuthClient, c as AuthHooks, A as AnyAuthClient } from './auth-hooks-BuniCu20.js';
|
|
6
6
|
import { A as AuthMutators } from './auth-mutators-DdqOmQ32.js';
|
|
7
7
|
import { SocialProvider } from 'better-auth/social-providers';
|
|
8
8
|
|
|
9
|
-
type PasswordValidation = {
|
|
10
|
-
/**
|
|
11
|
-
* Maximum password length
|
|
12
|
-
*/
|
|
13
|
-
maxLength?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Minimum password length
|
|
16
|
-
*/
|
|
17
|
-
minLength?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Password validation regex
|
|
20
|
-
*/
|
|
21
|
-
regex?: RegExp;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
9
|
interface ProviderIconProps {
|
|
25
10
|
className?: string;
|
|
26
11
|
}
|
|
@@ -694,4 +679,4 @@ type AuthUIProviderProps = {
|
|
|
694
679
|
declare const AuthUIContext: React.Context<AuthUIContextType>;
|
|
695
680
|
declare const AuthUIProvider: ({ children, authClient: authClientProp, account: accountProp, avatar: avatarProp, deleteUser: deleteUserProp, social: socialProp, genericOAuth: genericOAuthProp, basePath, baseURL, captcha, redirectTo, credentials: credentialsProp, changeEmail, freshAge, hooks: hooksProp, mutators: mutatorsProp, localization: localizationProp, nameRequired, organization: organizationProp, signUp: signUpProp, toast, viewPaths: viewPathsProp, navigate, replace, Link, ...props }: AuthUIProviderProps) => react_jsx_runtime.JSX.Element;
|
|
696
681
|
|
|
697
|
-
export { AppleIcon as A, DiscordIcon as D, type FieldType as F, GitHubIcon as G, HuggingFaceIcon as H, KickIcon as K, LinearIcon as L, MicrosoftIcon as M, NotionIcon as N, type
|
|
682
|
+
export { AppleIcon as A, type OrganizationOptionsContext as B, type CaptchaOptions as C, DiscordIcon as D, type RenderToast as E, type FieldType as F, GitHubIcon as G, HuggingFaceIcon as H, type SignUpOptions as I, type SocialOptions as J, KickIcon as K, LinearIcon as L, MicrosoftIcon as M, NotionIcon as N, type OrganizationLogoOptions as O, type ProviderIconProps as P, RedditIcon as R, SlackIcon as S, TikTokIcon as T, VKIcon as V, XIcon as X, ZoomIcon as Z, type ProviderIcon as a, DropboxIcon as b, FacebookIcon as c, GitLabIcon as d, GoogleIcon as e, LinkedInIcon as f, RobloxIcon as g, SpotifyIcon as h, TwitchIcon as i, type AuthUIContextType as j, type AuthUIProviderProps as k, AuthUIContext as l, AuthUIProvider as m, type Provider as n, type AccountOptions as o, type AccountOptionsContext as p, type AdditionalField as q, type AdditionalFields as r, socialProviders as s, type AvatarOptions as t, type CredentialsOptions as u, type DeleteUserOptions as v, type GenericOAuthOptions as w, type GravatarOptions as x, type Link as y, type OrganizationOptions as z };
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode } from 'react';
|
|
4
|
-
import { f as AccountViewPaths, g as OrganizationViewPaths, h as authLocalization, c as AuthViewPaths, A as AuthLocalization } from './view-paths-
|
|
5
|
-
import { b as AuthClient,
|
|
4
|
+
import { f as AccountViewPaths, P as PasswordValidation, g as OrganizationViewPaths, h as authLocalization, c as AuthViewPaths, A as AuthLocalization } from './view-paths-CIL7NXLh.cjs';
|
|
5
|
+
import { b as AuthClient, c as AuthHooks, A as AnyAuthClient } from './auth-hooks-BuniCu20.cjs';
|
|
6
6
|
import { A as AuthMutators } from './auth-mutators-DdqOmQ32.cjs';
|
|
7
7
|
import { SocialProvider } from 'better-auth/social-providers';
|
|
8
8
|
|
|
9
|
-
type PasswordValidation = {
|
|
10
|
-
/**
|
|
11
|
-
* Maximum password length
|
|
12
|
-
*/
|
|
13
|
-
maxLength?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Minimum password length
|
|
16
|
-
*/
|
|
17
|
-
minLength?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Password validation regex
|
|
20
|
-
*/
|
|
21
|
-
regex?: RegExp;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
9
|
interface ProviderIconProps {
|
|
25
10
|
className?: string;
|
|
26
11
|
}
|
|
@@ -694,4 +679,4 @@ type AuthUIProviderProps = {
|
|
|
694
679
|
declare const AuthUIContext: React.Context<AuthUIContextType>;
|
|
695
680
|
declare const AuthUIProvider: ({ children, authClient: authClientProp, account: accountProp, avatar: avatarProp, deleteUser: deleteUserProp, social: socialProp, genericOAuth: genericOAuthProp, basePath, baseURL, captcha, redirectTo, credentials: credentialsProp, changeEmail, freshAge, hooks: hooksProp, mutators: mutatorsProp, localization: localizationProp, nameRequired, organization: organizationProp, signUp: signUpProp, toast, viewPaths: viewPathsProp, navigate, replace, Link, ...props }: AuthUIProviderProps) => react_jsx_runtime.JSX.Element;
|
|
696
681
|
|
|
697
|
-
export { AppleIcon as A, DiscordIcon as D, type FieldType as F, GitHubIcon as G, HuggingFaceIcon as H, KickIcon as K, LinearIcon as L, MicrosoftIcon as M, NotionIcon as N, type
|
|
682
|
+
export { AppleIcon as A, type OrganizationOptionsContext as B, type CaptchaOptions as C, DiscordIcon as D, type RenderToast as E, type FieldType as F, GitHubIcon as G, HuggingFaceIcon as H, type SignUpOptions as I, type SocialOptions as J, KickIcon as K, LinearIcon as L, MicrosoftIcon as M, NotionIcon as N, type OrganizationLogoOptions as O, type ProviderIconProps as P, RedditIcon as R, SlackIcon as S, TikTokIcon as T, VKIcon as V, XIcon as X, ZoomIcon as Z, type ProviderIcon as a, DropboxIcon as b, FacebookIcon as c, GitLabIcon as d, GoogleIcon as e, LinkedInIcon as f, RobloxIcon as g, SpotifyIcon as h, TwitchIcon as i, type AuthUIContextType as j, type AuthUIProviderProps as k, AuthUIContext as l, AuthUIProvider as m, type Provider as n, type AccountOptions as o, type AccountOptionsContext as p, type AdditionalField as q, type AdditionalFields as r, socialProviders as s, type AvatarOptions as t, type CredentialsOptions as u, type DeleteUserOptions as v, type GenericOAuthOptions as w, type GravatarOptions as x, type Link as y, type OrganizationOptions as z };
|
|
@@ -9,6 +9,9 @@ function isValidEmail(email) {
|
|
|
9
9
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
10
10
|
return emailRegex.test(email);
|
|
11
11
|
}
|
|
12
|
+
function errorCodeToCamelCase(errorCode) {
|
|
13
|
+
return errorCode.toLowerCase().replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
14
|
+
}
|
|
12
15
|
function getLocalizedError({
|
|
13
16
|
error,
|
|
14
17
|
localization
|
|
@@ -36,6 +39,11 @@ function getViewByPath(viewPaths, path) {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
42
|
+
function getKeyByValue(object, value) {
|
|
43
|
+
return Object.keys(object).find(
|
|
44
|
+
(key) => object[key] === value
|
|
45
|
+
);
|
|
46
|
+
}
|
|
39
47
|
function getPasswordSchema(passwordValidation, localization) {
|
|
40
48
|
let schema = z.string().min(1, {
|
|
41
49
|
message: localization == null ? void 0 : localization.PASSWORD_REQUIRED
|
|
@@ -798,4 +806,6 @@ var organizationViewPaths = {
|
|
|
798
806
|
|
|
799
807
|
|
|
800
808
|
|
|
801
|
-
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
exports.cn = cn; exports.isValidEmail = isValidEmail; exports.errorCodeToCamelCase = errorCodeToCamelCase; exports.getLocalizedError = getLocalizedError; exports.getSearchParam = getSearchParam; exports.getViewByPath = getViewByPath; exports.getKeyByValue = getKeyByValue; exports.getPasswordSchema = getPasswordSchema; exports.authLocalization = authLocalization; exports.authViewPaths = authViewPaths; exports.accountViewPaths = accountViewPaths; exports.organizationViewPaths = organizationViewPaths;
|
|
@@ -4,7 +4,72 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk42PRTYABcjs = require('./chunk-42PRTYAB.cjs');
|
|
8
|
+
|
|
9
|
+
// src/hooks/use-hydrated.ts
|
|
10
|
+
var _react = require('react');
|
|
11
|
+
function subscribe() {
|
|
12
|
+
return () => {
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function useIsHydrated() {
|
|
16
|
+
return _react.useSyncExternalStore.call(void 0,
|
|
17
|
+
subscribe,
|
|
18
|
+
() => true,
|
|
19
|
+
() => false
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/hooks/use-lang.ts
|
|
24
|
+
|
|
25
|
+
function useLang() {
|
|
26
|
+
const [lang, setLang] = _react.useState.call(void 0, );
|
|
27
|
+
_react.useEffect.call(void 0, () => {
|
|
28
|
+
const checkLang = () => {
|
|
29
|
+
const currentLang = document.documentElement.getAttribute("lang");
|
|
30
|
+
setLang(_nullishCoalesce(currentLang, () => ( void 0)));
|
|
31
|
+
};
|
|
32
|
+
checkLang();
|
|
33
|
+
const observer = new MutationObserver((mutations) => {
|
|
34
|
+
for (const mutation of mutations) {
|
|
35
|
+
if (mutation.attributeName === "lang") {
|
|
36
|
+
checkLang();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
41
|
+
return () => {
|
|
42
|
+
observer.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return { lang };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/hooks/use-theme.ts
|
|
49
|
+
|
|
50
|
+
function useTheme() {
|
|
51
|
+
const [theme, setTheme] = _react.useState.call(void 0, "light");
|
|
52
|
+
_react.useEffect.call(void 0, () => {
|
|
53
|
+
const checkTheme = () => {
|
|
54
|
+
var _a;
|
|
55
|
+
const isDark = document.documentElement.classList.contains("dark") || ((_a = document.documentElement.getAttribute("style")) == null ? void 0 : _a.includes("color-scheme: dark"));
|
|
56
|
+
setTheme(isDark ? "dark" : "light");
|
|
57
|
+
};
|
|
58
|
+
checkTheme();
|
|
59
|
+
const observer = new MutationObserver((mutations) => {
|
|
60
|
+
for (const mutation of mutations) {
|
|
61
|
+
if (mutation.attributeName === "style" || mutation.attributeName === "class") {
|
|
62
|
+
checkTheme();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
67
|
+
return () => {
|
|
68
|
+
observer.disconnect();
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
return { theme };
|
|
72
|
+
}
|
|
8
73
|
|
|
9
74
|
// src/hooks/use-auth-data.ts
|
|
10
75
|
|
|
@@ -14,7 +79,7 @@ var _chunkCRAHKL2Ccjs = require('./chunk-CRAHKL2C.cjs');
|
|
|
14
79
|
|
|
15
80
|
|
|
16
81
|
|
|
17
|
-
|
|
82
|
+
|
|
18
83
|
|
|
19
84
|
// src/lib/auth-data-cache.ts
|
|
20
85
|
var AuthDataCache = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }
|
|
@@ -100,73 +165,6 @@ var _sonner = require('sonner');
|
|
|
100
165
|
|
|
101
166
|
var _reactrecaptchav3 = require('@wojtekmaj/react-recaptcha-v3');
|
|
102
167
|
|
|
103
|
-
|
|
104
|
-
// src/hooks/use-hydrated.ts
|
|
105
|
-
|
|
106
|
-
function subscribe() {
|
|
107
|
-
return () => {
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function useIsHydrated() {
|
|
111
|
-
return _react.useSyncExternalStore.call(void 0,
|
|
112
|
-
subscribe,
|
|
113
|
-
() => true,
|
|
114
|
-
() => false
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/hooks/use-lang.ts
|
|
119
|
-
|
|
120
|
-
function useLang() {
|
|
121
|
-
const [lang, setLang] = _react.useState.call(void 0, );
|
|
122
|
-
_react.useEffect.call(void 0, () => {
|
|
123
|
-
const checkLang = () => {
|
|
124
|
-
const currentLang = document.documentElement.getAttribute("lang");
|
|
125
|
-
setLang(_nullishCoalesce(currentLang, () => ( void 0)));
|
|
126
|
-
};
|
|
127
|
-
checkLang();
|
|
128
|
-
const observer = new MutationObserver((mutations) => {
|
|
129
|
-
for (const mutation of mutations) {
|
|
130
|
-
if (mutation.attributeName === "lang") {
|
|
131
|
-
checkLang();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
136
|
-
return () => {
|
|
137
|
-
observer.disconnect();
|
|
138
|
-
};
|
|
139
|
-
}, []);
|
|
140
|
-
return { lang };
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// src/hooks/use-theme.ts
|
|
144
|
-
|
|
145
|
-
function useTheme() {
|
|
146
|
-
const [theme, setTheme] = _react.useState.call(void 0, "light");
|
|
147
|
-
_react.useEffect.call(void 0, () => {
|
|
148
|
-
const checkTheme = () => {
|
|
149
|
-
var _a;
|
|
150
|
-
const isDark = document.documentElement.classList.contains("dark") || ((_a = document.documentElement.getAttribute("style")) == null ? void 0 : _a.includes("color-scheme: dark"));
|
|
151
|
-
setTheme(isDark ? "dark" : "light");
|
|
152
|
-
};
|
|
153
|
-
checkTheme();
|
|
154
|
-
const observer = new MutationObserver((mutations) => {
|
|
155
|
-
for (const mutation of mutations) {
|
|
156
|
-
if (mutation.attributeName === "style" || mutation.attributeName === "class") {
|
|
157
|
-
checkTheme();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
162
|
-
return () => {
|
|
163
|
-
observer.disconnect();
|
|
164
|
-
};
|
|
165
|
-
}, []);
|
|
166
|
-
return { theme };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/components/captcha/recaptcha-v3.tsx
|
|
170
168
|
var _jsxruntime = require('react/jsx-runtime');
|
|
171
169
|
function RecaptchaV3({ children }) {
|
|
172
170
|
const isHydrated = useIsHydrated();
|
|
@@ -384,14 +382,14 @@ var AuthUIProvider = ({
|
|
|
384
382
|
return {
|
|
385
383
|
basePath: "/account",
|
|
386
384
|
fields: ["image", "name"],
|
|
387
|
-
viewPaths:
|
|
385
|
+
viewPaths: _chunk42PRTYABcjs.accountViewPaths
|
|
388
386
|
};
|
|
389
387
|
}
|
|
390
388
|
const basePath2 = ((_a = accountProp.basePath) == null ? void 0 : _a.endsWith("/")) ? accountProp.basePath.slice(0, -1) : accountProp.basePath;
|
|
391
389
|
return {
|
|
392
390
|
basePath: _nullishCoalesce(basePath2, () => ( "/account")),
|
|
393
391
|
fields: accountProp.fields || ["image", "name"],
|
|
394
|
-
viewPaths: { ...
|
|
392
|
+
viewPaths: { ..._chunk42PRTYABcjs.accountViewPaths, ...accountProp.viewPaths }
|
|
395
393
|
};
|
|
396
394
|
}, [accountProp]);
|
|
397
395
|
const deleteUser = _react.useMemo.call(void 0, () => {
|
|
@@ -438,7 +436,7 @@ var AuthUIProvider = ({
|
|
|
438
436
|
if (organizationProp === true) {
|
|
439
437
|
return {
|
|
440
438
|
basePath: "/organization",
|
|
441
|
-
viewPaths:
|
|
439
|
+
viewPaths: _chunk42PRTYABcjs.organizationViewPaths,
|
|
442
440
|
customRoles: []
|
|
443
441
|
};
|
|
444
442
|
}
|
|
@@ -463,7 +461,7 @@ var AuthUIProvider = ({
|
|
|
463
461
|
basePath: _nullishCoalesce(basePath2, () => ( "/organization")),
|
|
464
462
|
customRoles: organizationProp.customRoles || [],
|
|
465
463
|
viewPaths: {
|
|
466
|
-
...
|
|
464
|
+
..._chunk42PRTYABcjs.organizationViewPaths,
|
|
467
465
|
...organizationProp.viewPaths
|
|
468
466
|
}
|
|
469
467
|
};
|
|
@@ -568,10 +566,10 @@ var AuthUIProvider = ({
|
|
|
568
566
|
};
|
|
569
567
|
}, [authClient]);
|
|
570
568
|
const viewPaths = _react.useMemo.call(void 0, () => {
|
|
571
|
-
return { ...
|
|
569
|
+
return { ..._chunk42PRTYABcjs.authViewPaths, ...viewPathsProp };
|
|
572
570
|
}, [viewPathsProp]);
|
|
573
571
|
const localization = _react.useMemo.call(void 0, () => {
|
|
574
|
-
return { ...
|
|
572
|
+
return { ..._chunk42PRTYABcjs.authLocalization, ...localizationProp };
|
|
575
573
|
}, [localizationProp]);
|
|
576
574
|
const hooks = _react.useMemo.call(void 0, () => {
|
|
577
575
|
return { ...defaultHooks, ...hooksProp };
|
|
@@ -680,7 +678,7 @@ function useAuthData({
|
|
|
680
678
|
setError(error2);
|
|
681
679
|
toast2({
|
|
682
680
|
variant: "error",
|
|
683
|
-
message:
|
|
681
|
+
message: _chunk42PRTYABcjs.getLocalizedError.call(void 0, { error: error2, localization })
|
|
684
682
|
});
|
|
685
683
|
} else {
|
|
686
684
|
setError(null);
|
|
@@ -691,7 +689,7 @@ function useAuthData({
|
|
|
691
689
|
setError(error2);
|
|
692
690
|
toast2({
|
|
693
691
|
variant: "error",
|
|
694
|
-
message:
|
|
692
|
+
message: _chunk42PRTYABcjs.getLocalizedError.call(void 0, { error: error2, localization })
|
|
695
693
|
});
|
|
696
694
|
} finally {
|
|
697
695
|
authDataCache.setRefetching(stableCacheKey, false);
|
|
@@ -747,4 +745,5 @@ function useAuthData({
|
|
|
747
745
|
|
|
748
746
|
|
|
749
747
|
|
|
750
|
-
|
|
748
|
+
|
|
749
|
+
exports.useIsHydrated = useIsHydrated; exports.useLang = useLang; exports.useTheme = useTheme; exports.useAuthData = useAuthData; exports.useCurrentOrganization = useCurrentOrganization; exports.OrganizationRefetcher = OrganizationRefetcher; exports.AuthUIContext = AuthUIContext; exports.AuthUIProvider = AuthUIProvider;
|
|
@@ -4,7 +4,72 @@ import {
|
|
|
4
4
|
authViewPaths,
|
|
5
5
|
getLocalizedError,
|
|
6
6
|
organizationViewPaths
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YTGCDVH4.js";
|
|
8
|
+
|
|
9
|
+
// src/hooks/use-hydrated.ts
|
|
10
|
+
import { useSyncExternalStore } from "react";
|
|
11
|
+
function subscribe() {
|
|
12
|
+
return () => {
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function useIsHydrated() {
|
|
16
|
+
return useSyncExternalStore(
|
|
17
|
+
subscribe,
|
|
18
|
+
() => true,
|
|
19
|
+
() => false
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/hooks/use-lang.ts
|
|
24
|
+
import { useEffect, useState } from "react";
|
|
25
|
+
function useLang() {
|
|
26
|
+
const [lang, setLang] = useState();
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const checkLang = () => {
|
|
29
|
+
const currentLang = document.documentElement.getAttribute("lang");
|
|
30
|
+
setLang(currentLang ?? void 0);
|
|
31
|
+
};
|
|
32
|
+
checkLang();
|
|
33
|
+
const observer = new MutationObserver((mutations) => {
|
|
34
|
+
for (const mutation of mutations) {
|
|
35
|
+
if (mutation.attributeName === "lang") {
|
|
36
|
+
checkLang();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
41
|
+
return () => {
|
|
42
|
+
observer.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return { lang };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/hooks/use-theme.ts
|
|
49
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
50
|
+
function useTheme() {
|
|
51
|
+
const [theme, setTheme] = useState2("light");
|
|
52
|
+
useEffect2(() => {
|
|
53
|
+
const checkTheme = () => {
|
|
54
|
+
var _a;
|
|
55
|
+
const isDark = document.documentElement.classList.contains("dark") || ((_a = document.documentElement.getAttribute("style")) == null ? void 0 : _a.includes("color-scheme: dark"));
|
|
56
|
+
setTheme(isDark ? "dark" : "light");
|
|
57
|
+
};
|
|
58
|
+
checkTheme();
|
|
59
|
+
const observer = new MutationObserver((mutations) => {
|
|
60
|
+
for (const mutation of mutations) {
|
|
61
|
+
if (mutation.attributeName === "style" || mutation.attributeName === "class") {
|
|
62
|
+
checkTheme();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
67
|
+
return () => {
|
|
68
|
+
observer.disconnect();
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
return { theme };
|
|
72
|
+
}
|
|
8
73
|
|
|
9
74
|
// src/hooks/use-auth-data.ts
|
|
10
75
|
import {
|
|
@@ -100,73 +165,6 @@ import {
|
|
|
100
165
|
useGoogleReCaptcha
|
|
101
166
|
} from "@wojtekmaj/react-recaptcha-v3";
|
|
102
167
|
import { useContext, useEffect as useEffect3 } from "react";
|
|
103
|
-
|
|
104
|
-
// src/hooks/use-hydrated.ts
|
|
105
|
-
import { useSyncExternalStore } from "react";
|
|
106
|
-
function subscribe() {
|
|
107
|
-
return () => {
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function useIsHydrated() {
|
|
111
|
-
return useSyncExternalStore(
|
|
112
|
-
subscribe,
|
|
113
|
-
() => true,
|
|
114
|
-
() => false
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/hooks/use-lang.ts
|
|
119
|
-
import { useEffect, useState } from "react";
|
|
120
|
-
function useLang() {
|
|
121
|
-
const [lang, setLang] = useState();
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
const checkLang = () => {
|
|
124
|
-
const currentLang = document.documentElement.getAttribute("lang");
|
|
125
|
-
setLang(currentLang ?? void 0);
|
|
126
|
-
};
|
|
127
|
-
checkLang();
|
|
128
|
-
const observer = new MutationObserver((mutations) => {
|
|
129
|
-
for (const mutation of mutations) {
|
|
130
|
-
if (mutation.attributeName === "lang") {
|
|
131
|
-
checkLang();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
136
|
-
return () => {
|
|
137
|
-
observer.disconnect();
|
|
138
|
-
};
|
|
139
|
-
}, []);
|
|
140
|
-
return { lang };
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// src/hooks/use-theme.ts
|
|
144
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
145
|
-
function useTheme() {
|
|
146
|
-
const [theme, setTheme] = useState2("light");
|
|
147
|
-
useEffect2(() => {
|
|
148
|
-
const checkTheme = () => {
|
|
149
|
-
var _a;
|
|
150
|
-
const isDark = document.documentElement.classList.contains("dark") || ((_a = document.documentElement.getAttribute("style")) == null ? void 0 : _a.includes("color-scheme: dark"));
|
|
151
|
-
setTheme(isDark ? "dark" : "light");
|
|
152
|
-
};
|
|
153
|
-
checkTheme();
|
|
154
|
-
const observer = new MutationObserver((mutations) => {
|
|
155
|
-
for (const mutation of mutations) {
|
|
156
|
-
if (mutation.attributeName === "style" || mutation.attributeName === "class") {
|
|
157
|
-
checkTheme();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
162
|
-
return () => {
|
|
163
|
-
observer.disconnect();
|
|
164
|
-
};
|
|
165
|
-
}, []);
|
|
166
|
-
return { theme };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/components/captcha/recaptcha-v3.tsx
|
|
170
168
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
171
169
|
function RecaptchaV3({ children }) {
|
|
172
170
|
const isHydrated = useIsHydrated();
|
|
@@ -745,6 +743,7 @@ export {
|
|
|
745
743
|
useTheme,
|
|
746
744
|
useAuthData,
|
|
747
745
|
useCurrentOrganization,
|
|
746
|
+
OrganizationRefetcher,
|
|
748
747
|
AuthUIContext,
|
|
749
748
|
AuthUIProvider
|
|
750
749
|
};
|
|
@@ -9,6 +9,9 @@ function isValidEmail(email) {
|
|
|
9
9
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
10
10
|
return emailRegex.test(email);
|
|
11
11
|
}
|
|
12
|
+
function errorCodeToCamelCase(errorCode) {
|
|
13
|
+
return errorCode.toLowerCase().replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
14
|
+
}
|
|
12
15
|
function getLocalizedError({
|
|
13
16
|
error,
|
|
14
17
|
localization
|
|
@@ -36,6 +39,11 @@ function getViewByPath(viewPaths, path) {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
42
|
+
function getKeyByValue(object, value) {
|
|
43
|
+
return Object.keys(object).find(
|
|
44
|
+
(key) => object[key] === value
|
|
45
|
+
);
|
|
46
|
+
}
|
|
39
47
|
function getPasswordSchema(passwordValidation, localization) {
|
|
40
48
|
let schema = z.string().min(1, {
|
|
41
49
|
message: localization == null ? void 0 : localization.PASSWORD_REQUIRED
|
|
@@ -790,9 +798,11 @@ var organizationViewPaths = {
|
|
|
790
798
|
export {
|
|
791
799
|
cn,
|
|
792
800
|
isValidEmail,
|
|
801
|
+
errorCodeToCamelCase,
|
|
793
802
|
getLocalizedError,
|
|
794
803
|
getSearchParam,
|
|
795
804
|
getViewByPath,
|
|
805
|
+
getKeyByValue,
|
|
796
806
|
getPasswordSchema,
|
|
797
807
|
authLocalization,
|
|
798
808
|
authViewPaths,
|