@kuckit/app-web 3.0.0 → 3.0.1
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/index.d.ts +755 -11
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,19 +6,22 @@ import { AnyRoute, RouteComponent } from "@tanstack/react-router";
|
|
|
6
6
|
import { ClientModuleSpec, ClientModuleSpec as ClientModuleSpec$1, NavItem, NavRegistry, RouteDefinition, RouteRegistry, SlotRegistry } from "@kuckit/sdk-react";
|
|
7
7
|
import * as _orpc_client0 from "@orpc/client";
|
|
8
8
|
import { RPCLink } from "@orpc/client/fetch";
|
|
9
|
+
import * as _orpc_tanstack_query0 from "@orpc/tanstack-query";
|
|
9
10
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
10
11
|
import * as better_auth_react0 from "better-auth/react";
|
|
11
12
|
import { createAuthClient } from "better-auth/react";
|
|
12
13
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
14
|
+
import * as _orpc_server0 from "@orpc/server";
|
|
15
|
+
import * as zod0 from "zod";
|
|
13
16
|
import * as better_auth0 from "better-auth";
|
|
14
|
-
import { AppRouterClient
|
|
17
|
+
import { AppRouterClient } from "@kuckit/api/routers/index";
|
|
15
18
|
|
|
16
19
|
//#region src/types.d.ts
|
|
17
|
-
type ORPCUtils = ReturnType<typeof createTanstackQueryUtils<AppRouterClient
|
|
20
|
+
type ORPCUtils = ReturnType<typeof createTanstackQueryUtils<AppRouterClient>>;
|
|
18
21
|
type AuthClient = ReturnType<typeof createAuthClient>;
|
|
19
22
|
interface KuckitWebServices {
|
|
20
23
|
queryClient: QueryClient;
|
|
21
|
-
rpcClient: AppRouterClient
|
|
24
|
+
rpcClient: AppRouterClient;
|
|
22
25
|
orpc: ORPCUtils;
|
|
23
26
|
authClient: AuthClient;
|
|
24
27
|
}
|
|
@@ -64,12 +67,71 @@ interface ModuleRoute {
|
|
|
64
67
|
declare const KuckitWebContext: react0.Context<KuckitWebContext | null>;
|
|
65
68
|
declare function useKuckitWeb(): KuckitWebContext;
|
|
66
69
|
declare function useServices(): KuckitWebServices;
|
|
67
|
-
declare function useRpc():
|
|
68
|
-
|
|
70
|
+
declare function useRpc(): {
|
|
71
|
+
healthCheck: _orpc_server0.ProcedureClient<Record<never, never>, _orpc_server0.Schema<unknown, unknown>, _orpc_server0.Schema<string, string>, Record<never, never>>;
|
|
72
|
+
privateData: _orpc_server0.ProcedureClient<Record<never, never>, _orpc_server0.Schema<unknown, unknown>, _orpc_server0.Schema<{
|
|
73
|
+
message: string;
|
|
74
|
+
user: {
|
|
75
|
+
id: string;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
updatedAt: Date;
|
|
78
|
+
email: string;
|
|
79
|
+
emailVerified: boolean;
|
|
80
|
+
name: string;
|
|
81
|
+
image?: string | null | undefined | undefined;
|
|
82
|
+
};
|
|
83
|
+
}, {
|
|
84
|
+
message: string;
|
|
85
|
+
user: {
|
|
86
|
+
id: string;
|
|
87
|
+
createdAt: Date;
|
|
88
|
+
updatedAt: Date;
|
|
89
|
+
email: string;
|
|
90
|
+
emailVerified: boolean;
|
|
91
|
+
name: string;
|
|
92
|
+
image?: string | null | undefined | undefined;
|
|
93
|
+
};
|
|
94
|
+
}>, Record<never, never>>;
|
|
95
|
+
profile: {
|
|
96
|
+
me: _orpc_server0.ProcedureClient<Record<never, never>, _orpc_server0.Schema<unknown, unknown>, zod0.ZodObject<{
|
|
97
|
+
id: zod0.ZodString;
|
|
98
|
+
name: zod0.ZodString;
|
|
99
|
+
email: zod0.ZodString;
|
|
100
|
+
emailVerified: zod0.ZodBoolean;
|
|
101
|
+
createdAt: zod0.ZodString;
|
|
102
|
+
updatedAt: zod0.ZodString;
|
|
103
|
+
}, better_auth0.$strip>, Record<never, never>>;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
declare function useOrpc(): {
|
|
107
|
+
healthCheck: _orpc_tanstack_query0.ProcedureUtils<Record<never, never>, unknown, string, Error> & _orpc_tanstack_query0.GeneralUtils<unknown>;
|
|
108
|
+
privateData: _orpc_tanstack_query0.ProcedureUtils<Record<never, never>, unknown, {
|
|
109
|
+
message: string;
|
|
110
|
+
user: {
|
|
111
|
+
id: string;
|
|
112
|
+
createdAt: Date;
|
|
113
|
+
updatedAt: Date;
|
|
114
|
+
email: string;
|
|
115
|
+
emailVerified: boolean;
|
|
116
|
+
name: string;
|
|
117
|
+
image?: string | null | undefined | undefined;
|
|
118
|
+
};
|
|
119
|
+
}, Error> & _orpc_tanstack_query0.GeneralUtils<unknown>;
|
|
120
|
+
profile: {
|
|
121
|
+
me: _orpc_tanstack_query0.ProcedureUtils<Record<never, never>, unknown, {
|
|
122
|
+
id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
email: string;
|
|
125
|
+
emailVerified: boolean;
|
|
126
|
+
createdAt: string;
|
|
127
|
+
updatedAt: string;
|
|
128
|
+
}, Error> & _orpc_tanstack_query0.GeneralUtils<unknown>;
|
|
129
|
+
} & _orpc_tanstack_query0.GeneralUtils<unknown>;
|
|
130
|
+
} & _orpc_tanstack_query0.GeneralUtils<unknown>;
|
|
69
131
|
declare function useAuth(): {
|
|
70
132
|
signIn: {
|
|
71
133
|
social: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
72
|
-
provider: "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel"
|
|
134
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
73
135
|
callbackURL?: string | undefined;
|
|
74
136
|
newUserCallbackURL?: string | undefined;
|
|
75
137
|
errorCallbackURL?: string | undefined;
|
|
@@ -86,7 +148,7 @@ declare function useAuth(): {
|
|
|
86
148
|
loginHint?: string | undefined;
|
|
87
149
|
additionalData?: Record<string, any> | undefined;
|
|
88
150
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
89
|
-
provider: "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel"
|
|
151
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
90
152
|
callbackURL?: string | undefined;
|
|
91
153
|
newUserCallbackURL?: string | undefined;
|
|
92
154
|
errorCallbackURL?: string | undefined;
|
|
@@ -761,9 +823,690 @@ interface CreateServicesOptions {
|
|
|
761
823
|
}
|
|
762
824
|
declare function createQueryClient(onError?: (error: Error) => void): QueryClient;
|
|
763
825
|
declare function createRPCLink(serverUrl: string): RPCLink<_orpc_client0.ClientContext>;
|
|
764
|
-
declare function createRPCClient(link: ReturnType<typeof createRPCLink>): AppRouterClient
|
|
765
|
-
declare function createORPCUtils(client: AppRouterClient
|
|
766
|
-
declare function createAuthClientService(serverUrl: string):
|
|
826
|
+
declare function createRPCClient(link: ReturnType<typeof createRPCLink>): AppRouterClient;
|
|
827
|
+
declare function createORPCUtils(client: AppRouterClient): ORPCUtils;
|
|
828
|
+
declare function createAuthClientService(serverUrl: string): {
|
|
829
|
+
signIn: {
|
|
830
|
+
social: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
831
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
832
|
+
callbackURL?: string | undefined;
|
|
833
|
+
newUserCallbackURL?: string | undefined;
|
|
834
|
+
errorCallbackURL?: string | undefined;
|
|
835
|
+
disableRedirect?: boolean | undefined;
|
|
836
|
+
idToken?: {
|
|
837
|
+
token: string;
|
|
838
|
+
nonce?: string | undefined;
|
|
839
|
+
accessToken?: string | undefined;
|
|
840
|
+
refreshToken?: string | undefined;
|
|
841
|
+
expiresAt?: number | undefined;
|
|
842
|
+
} | undefined;
|
|
843
|
+
scopes?: string[] | undefined;
|
|
844
|
+
requestSignUp?: boolean | undefined;
|
|
845
|
+
loginHint?: string | undefined;
|
|
846
|
+
additionalData?: Record<string, any> | undefined;
|
|
847
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
848
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
849
|
+
callbackURL?: string | undefined;
|
|
850
|
+
newUserCallbackURL?: string | undefined;
|
|
851
|
+
errorCallbackURL?: string | undefined;
|
|
852
|
+
disableRedirect?: boolean | undefined;
|
|
853
|
+
idToken?: {
|
|
854
|
+
token: string;
|
|
855
|
+
nonce?: string | undefined;
|
|
856
|
+
accessToken?: string | undefined;
|
|
857
|
+
refreshToken?: string | undefined;
|
|
858
|
+
expiresAt?: number | undefined;
|
|
859
|
+
} | undefined;
|
|
860
|
+
scopes?: string[] | undefined;
|
|
861
|
+
requestSignUp?: boolean | undefined;
|
|
862
|
+
loginHint?: string | undefined;
|
|
863
|
+
additionalData?: Record<string, any> | undefined;
|
|
864
|
+
} & {
|
|
865
|
+
fetchOptions?: FetchOptions | undefined;
|
|
866
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<NonNullable<{
|
|
867
|
+
redirect: boolean;
|
|
868
|
+
url: string;
|
|
869
|
+
} | {
|
|
870
|
+
redirect: boolean;
|
|
871
|
+
token: string;
|
|
872
|
+
url: undefined;
|
|
873
|
+
user: {
|
|
874
|
+
id: string;
|
|
875
|
+
createdAt: Date;
|
|
876
|
+
updatedAt: Date;
|
|
877
|
+
email: string;
|
|
878
|
+
emailVerified: boolean;
|
|
879
|
+
name: string;
|
|
880
|
+
image?: string | null | undefined | undefined;
|
|
881
|
+
};
|
|
882
|
+
}>, {
|
|
883
|
+
code?: string | undefined;
|
|
884
|
+
message?: string | undefined;
|
|
885
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
886
|
+
};
|
|
887
|
+
} & {
|
|
888
|
+
signOut: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
889
|
+
query?: Record<string, any> | undefined;
|
|
890
|
+
fetchOptions?: FetchOptions | undefined;
|
|
891
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
892
|
+
success: boolean;
|
|
893
|
+
}, {
|
|
894
|
+
code?: string | undefined;
|
|
895
|
+
message?: string | undefined;
|
|
896
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
897
|
+
} & {
|
|
898
|
+
signUp: {
|
|
899
|
+
email: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
900
|
+
name: string;
|
|
901
|
+
email: string;
|
|
902
|
+
password: string;
|
|
903
|
+
image?: string | undefined;
|
|
904
|
+
callbackURL?: string | undefined;
|
|
905
|
+
rememberMe?: boolean | undefined;
|
|
906
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
907
|
+
email: string;
|
|
908
|
+
name: string;
|
|
909
|
+
password: string;
|
|
910
|
+
image?: string | undefined;
|
|
911
|
+
callbackURL?: string | undefined;
|
|
912
|
+
fetchOptions?: FetchOptions | undefined;
|
|
913
|
+
} & {} & {}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<NonNullable<{
|
|
914
|
+
token: null;
|
|
915
|
+
user: {
|
|
916
|
+
id: string;
|
|
917
|
+
createdAt: Date;
|
|
918
|
+
updatedAt: Date;
|
|
919
|
+
email: string;
|
|
920
|
+
emailVerified: boolean;
|
|
921
|
+
name: string;
|
|
922
|
+
image?: string | null | undefined | undefined;
|
|
923
|
+
};
|
|
924
|
+
} | {
|
|
925
|
+
token: string;
|
|
926
|
+
user: {
|
|
927
|
+
id: string;
|
|
928
|
+
createdAt: Date;
|
|
929
|
+
updatedAt: Date;
|
|
930
|
+
email: string;
|
|
931
|
+
emailVerified: boolean;
|
|
932
|
+
name: string;
|
|
933
|
+
image?: string | null | undefined | undefined;
|
|
934
|
+
};
|
|
935
|
+
}>, {
|
|
936
|
+
code?: string | undefined;
|
|
937
|
+
message?: string | undefined;
|
|
938
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
939
|
+
};
|
|
940
|
+
} & {
|
|
941
|
+
signIn: {
|
|
942
|
+
email: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
943
|
+
email: string;
|
|
944
|
+
password: string;
|
|
945
|
+
callbackURL?: string | undefined;
|
|
946
|
+
rememberMe?: boolean | undefined;
|
|
947
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
948
|
+
email: string;
|
|
949
|
+
password: string;
|
|
950
|
+
callbackURL?: string | undefined;
|
|
951
|
+
rememberMe?: boolean | undefined;
|
|
952
|
+
} & {
|
|
953
|
+
fetchOptions?: FetchOptions | undefined;
|
|
954
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
955
|
+
redirect: boolean;
|
|
956
|
+
token: string;
|
|
957
|
+
url?: string | undefined;
|
|
958
|
+
user: {
|
|
959
|
+
id: string;
|
|
960
|
+
createdAt: Date;
|
|
961
|
+
updatedAt: Date;
|
|
962
|
+
email: string;
|
|
963
|
+
emailVerified: boolean;
|
|
964
|
+
name: string;
|
|
965
|
+
image?: string | null | undefined | undefined;
|
|
966
|
+
};
|
|
967
|
+
}, {
|
|
968
|
+
code?: string | undefined;
|
|
969
|
+
message?: string | undefined;
|
|
970
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
971
|
+
};
|
|
972
|
+
} & {
|
|
973
|
+
resetPassword: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
974
|
+
newPassword: string;
|
|
975
|
+
token?: string | undefined;
|
|
976
|
+
}> & Record<string, any>, Partial<{
|
|
977
|
+
token?: string | undefined;
|
|
978
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
979
|
+
newPassword: string;
|
|
980
|
+
token?: string | undefined;
|
|
981
|
+
} & {
|
|
982
|
+
fetchOptions?: FetchOptions | undefined;
|
|
983
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
984
|
+
status: boolean;
|
|
985
|
+
}, {
|
|
986
|
+
code?: string | undefined;
|
|
987
|
+
message?: string | undefined;
|
|
988
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
989
|
+
} & {
|
|
990
|
+
verifyEmail: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
991
|
+
token: string;
|
|
992
|
+
callbackURL?: string | undefined;
|
|
993
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
994
|
+
query: {
|
|
995
|
+
token: string;
|
|
996
|
+
callbackURL?: string | undefined;
|
|
997
|
+
};
|
|
998
|
+
fetchOptions?: FetchOptions | undefined;
|
|
999
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<NonNullable<void | {
|
|
1000
|
+
status: boolean;
|
|
1001
|
+
}>, {
|
|
1002
|
+
code?: string | undefined;
|
|
1003
|
+
message?: string | undefined;
|
|
1004
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1005
|
+
} & {
|
|
1006
|
+
sendVerificationEmail: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1007
|
+
email: string;
|
|
1008
|
+
callbackURL?: string | undefined;
|
|
1009
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1010
|
+
email: string;
|
|
1011
|
+
callbackURL?: string | undefined;
|
|
1012
|
+
} & {
|
|
1013
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1014
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1015
|
+
status: boolean;
|
|
1016
|
+
}, {
|
|
1017
|
+
code?: string | undefined;
|
|
1018
|
+
message?: string | undefined;
|
|
1019
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1020
|
+
} & {
|
|
1021
|
+
changeEmail: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1022
|
+
newEmail: string;
|
|
1023
|
+
callbackURL?: string | undefined;
|
|
1024
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1025
|
+
newEmail: string;
|
|
1026
|
+
callbackURL?: string | undefined;
|
|
1027
|
+
} & {
|
|
1028
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1029
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1030
|
+
status: boolean;
|
|
1031
|
+
}, {
|
|
1032
|
+
code?: string | undefined;
|
|
1033
|
+
message?: string | undefined;
|
|
1034
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1035
|
+
} & {
|
|
1036
|
+
changePassword: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1037
|
+
newPassword: string;
|
|
1038
|
+
currentPassword: string;
|
|
1039
|
+
revokeOtherSessions?: boolean | undefined;
|
|
1040
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1041
|
+
newPassword: string;
|
|
1042
|
+
currentPassword: string;
|
|
1043
|
+
revokeOtherSessions?: boolean | undefined;
|
|
1044
|
+
} & {
|
|
1045
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1046
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1047
|
+
token: string | null;
|
|
1048
|
+
user: {
|
|
1049
|
+
id: string;
|
|
1050
|
+
email: string;
|
|
1051
|
+
name: string;
|
|
1052
|
+
image: string | null | undefined;
|
|
1053
|
+
emailVerified: boolean;
|
|
1054
|
+
createdAt: Date;
|
|
1055
|
+
updatedAt: Date;
|
|
1056
|
+
};
|
|
1057
|
+
}, {
|
|
1058
|
+
code?: string | undefined;
|
|
1059
|
+
message?: string | undefined;
|
|
1060
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1061
|
+
} & {
|
|
1062
|
+
updateUser: <FetchOptions extends better_auth0.ClientFetchOption<Partial<Partial<{}> & {
|
|
1063
|
+
name?: string | undefined;
|
|
1064
|
+
image?: string | undefined | null;
|
|
1065
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1066
|
+
image?: (string | null) | undefined;
|
|
1067
|
+
name?: string | undefined;
|
|
1068
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1069
|
+
} & Partial<{} & {}>> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1070
|
+
status: boolean;
|
|
1071
|
+
}, {
|
|
1072
|
+
code?: string | undefined;
|
|
1073
|
+
message?: string | undefined;
|
|
1074
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1075
|
+
} & {
|
|
1076
|
+
deleteUser: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1077
|
+
callbackURL?: string | undefined;
|
|
1078
|
+
password?: string | undefined;
|
|
1079
|
+
token?: string | undefined;
|
|
1080
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1081
|
+
callbackURL?: string | undefined;
|
|
1082
|
+
password?: string | undefined;
|
|
1083
|
+
token?: string | undefined;
|
|
1084
|
+
} & {
|
|
1085
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1086
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1087
|
+
success: boolean;
|
|
1088
|
+
message: string;
|
|
1089
|
+
}, {
|
|
1090
|
+
code?: string | undefined;
|
|
1091
|
+
message?: string | undefined;
|
|
1092
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1093
|
+
} & {
|
|
1094
|
+
requestPasswordReset: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1095
|
+
email: string;
|
|
1096
|
+
redirectTo?: string | undefined;
|
|
1097
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1098
|
+
email: string;
|
|
1099
|
+
redirectTo?: string | undefined;
|
|
1100
|
+
} & {
|
|
1101
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1102
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1103
|
+
status: boolean;
|
|
1104
|
+
message: string;
|
|
1105
|
+
}, {
|
|
1106
|
+
code?: string | undefined;
|
|
1107
|
+
message?: string | undefined;
|
|
1108
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1109
|
+
} & {
|
|
1110
|
+
resetPassword: {
|
|
1111
|
+
":token": <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
1112
|
+
callbackURL: string;
|
|
1113
|
+
}> & Record<string, any>, {
|
|
1114
|
+
token: string;
|
|
1115
|
+
}>>(data_0: better_auth0.Prettify<{
|
|
1116
|
+
query: {
|
|
1117
|
+
callbackURL: string;
|
|
1118
|
+
};
|
|
1119
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1120
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<never, {
|
|
1121
|
+
code?: string | undefined;
|
|
1122
|
+
message?: string | undefined;
|
|
1123
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1124
|
+
};
|
|
1125
|
+
} & {
|
|
1126
|
+
listSessions: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1127
|
+
query?: Record<string, any> | undefined;
|
|
1128
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1129
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<better_auth0.Prettify<{
|
|
1130
|
+
id: string;
|
|
1131
|
+
createdAt: Date;
|
|
1132
|
+
updatedAt: Date;
|
|
1133
|
+
userId: string;
|
|
1134
|
+
expiresAt: Date;
|
|
1135
|
+
token: string;
|
|
1136
|
+
ipAddress?: string | null | undefined | undefined;
|
|
1137
|
+
userAgent?: string | null | undefined | undefined;
|
|
1138
|
+
}>[], {
|
|
1139
|
+
code?: string | undefined;
|
|
1140
|
+
message?: string | undefined;
|
|
1141
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1142
|
+
} & {
|
|
1143
|
+
revokeSession: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1144
|
+
token: string;
|
|
1145
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1146
|
+
token: string;
|
|
1147
|
+
} & {
|
|
1148
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1149
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1150
|
+
status: boolean;
|
|
1151
|
+
}, {
|
|
1152
|
+
code?: string | undefined;
|
|
1153
|
+
message?: string | undefined;
|
|
1154
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1155
|
+
} & {
|
|
1156
|
+
revokeSessions: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1157
|
+
query?: Record<string, any> | undefined;
|
|
1158
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1159
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1160
|
+
status: boolean;
|
|
1161
|
+
}, {
|
|
1162
|
+
code?: string | undefined;
|
|
1163
|
+
message?: string | undefined;
|
|
1164
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1165
|
+
} & {
|
|
1166
|
+
revokeOtherSessions: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1167
|
+
query?: Record<string, any> | undefined;
|
|
1168
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1169
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1170
|
+
status: boolean;
|
|
1171
|
+
}, {
|
|
1172
|
+
code?: string | undefined;
|
|
1173
|
+
message?: string | undefined;
|
|
1174
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1175
|
+
} & {
|
|
1176
|
+
linkSocial: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1177
|
+
provider: unknown;
|
|
1178
|
+
callbackURL?: string | undefined;
|
|
1179
|
+
idToken?: {
|
|
1180
|
+
token: string;
|
|
1181
|
+
nonce?: string | undefined;
|
|
1182
|
+
accessToken?: string | undefined;
|
|
1183
|
+
refreshToken?: string | undefined;
|
|
1184
|
+
scopes?: string[] | undefined;
|
|
1185
|
+
} | undefined;
|
|
1186
|
+
requestSignUp?: boolean | undefined;
|
|
1187
|
+
scopes?: string[] | undefined;
|
|
1188
|
+
errorCallbackURL?: string | undefined;
|
|
1189
|
+
disableRedirect?: boolean | undefined;
|
|
1190
|
+
additionalData?: Record<string, any> | undefined;
|
|
1191
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1192
|
+
provider: unknown;
|
|
1193
|
+
callbackURL?: string | undefined;
|
|
1194
|
+
idToken?: {
|
|
1195
|
+
token: string;
|
|
1196
|
+
nonce?: string | undefined;
|
|
1197
|
+
accessToken?: string | undefined;
|
|
1198
|
+
refreshToken?: string | undefined;
|
|
1199
|
+
scopes?: string[] | undefined;
|
|
1200
|
+
} | undefined;
|
|
1201
|
+
requestSignUp?: boolean | undefined;
|
|
1202
|
+
scopes?: string[] | undefined;
|
|
1203
|
+
errorCallbackURL?: string | undefined;
|
|
1204
|
+
disableRedirect?: boolean | undefined;
|
|
1205
|
+
additionalData?: Record<string, any> | undefined;
|
|
1206
|
+
} & {
|
|
1207
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1208
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1209
|
+
url: string;
|
|
1210
|
+
redirect: boolean;
|
|
1211
|
+
}, {
|
|
1212
|
+
code?: string | undefined;
|
|
1213
|
+
message?: string | undefined;
|
|
1214
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1215
|
+
} & {
|
|
1216
|
+
listAccounts: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1217
|
+
query?: Record<string, any> | undefined;
|
|
1218
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1219
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1220
|
+
id: string;
|
|
1221
|
+
providerId: string;
|
|
1222
|
+
createdAt: Date;
|
|
1223
|
+
updatedAt: Date;
|
|
1224
|
+
accountId: string;
|
|
1225
|
+
userId: string;
|
|
1226
|
+
scopes: string[];
|
|
1227
|
+
}[], {
|
|
1228
|
+
code?: string | undefined;
|
|
1229
|
+
message?: string | undefined;
|
|
1230
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1231
|
+
} & {
|
|
1232
|
+
deleteUser: {
|
|
1233
|
+
callback: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
1234
|
+
token: string;
|
|
1235
|
+
callbackURL?: string | undefined;
|
|
1236
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1237
|
+
query: {
|
|
1238
|
+
token: string;
|
|
1239
|
+
callbackURL?: string | undefined;
|
|
1240
|
+
};
|
|
1241
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1242
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1243
|
+
success: boolean;
|
|
1244
|
+
message: string;
|
|
1245
|
+
}, {
|
|
1246
|
+
code?: string | undefined;
|
|
1247
|
+
message?: string | undefined;
|
|
1248
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1249
|
+
};
|
|
1250
|
+
} & {
|
|
1251
|
+
unlinkAccount: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1252
|
+
providerId: string;
|
|
1253
|
+
accountId?: string | undefined;
|
|
1254
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1255
|
+
providerId: string;
|
|
1256
|
+
accountId?: string | undefined;
|
|
1257
|
+
} & {
|
|
1258
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1259
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1260
|
+
status: boolean;
|
|
1261
|
+
}, {
|
|
1262
|
+
code?: string | undefined;
|
|
1263
|
+
message?: string | undefined;
|
|
1264
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1265
|
+
} & {
|
|
1266
|
+
refreshToken: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1267
|
+
providerId: string;
|
|
1268
|
+
accountId?: string | undefined;
|
|
1269
|
+
userId?: string | undefined;
|
|
1270
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1271
|
+
providerId: string;
|
|
1272
|
+
accountId?: string | undefined;
|
|
1273
|
+
userId?: string | undefined;
|
|
1274
|
+
} & {
|
|
1275
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1276
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1277
|
+
accessToken: string | undefined;
|
|
1278
|
+
refreshToken: string | undefined;
|
|
1279
|
+
accessTokenExpiresAt: Date | undefined;
|
|
1280
|
+
refreshTokenExpiresAt: Date | undefined;
|
|
1281
|
+
scope: string | null | undefined;
|
|
1282
|
+
idToken: string | null | undefined;
|
|
1283
|
+
providerId: string;
|
|
1284
|
+
accountId: string;
|
|
1285
|
+
}, {
|
|
1286
|
+
code?: string | undefined;
|
|
1287
|
+
message?: string | undefined;
|
|
1288
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1289
|
+
} & {
|
|
1290
|
+
getAccessToken: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
1291
|
+
providerId: string;
|
|
1292
|
+
accountId?: string | undefined;
|
|
1293
|
+
userId?: string | undefined;
|
|
1294
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<{
|
|
1295
|
+
providerId: string;
|
|
1296
|
+
accountId?: string | undefined;
|
|
1297
|
+
userId?: string | undefined;
|
|
1298
|
+
} & {
|
|
1299
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1300
|
+
}>, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1301
|
+
accessToken: string;
|
|
1302
|
+
accessTokenExpiresAt: Date | undefined;
|
|
1303
|
+
scopes: string[];
|
|
1304
|
+
idToken: string | undefined;
|
|
1305
|
+
}, {
|
|
1306
|
+
code?: string | undefined;
|
|
1307
|
+
message?: string | undefined;
|
|
1308
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1309
|
+
} & {
|
|
1310
|
+
accountInfo: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
1311
|
+
accountId?: string | undefined;
|
|
1312
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1313
|
+
query?: {
|
|
1314
|
+
accountId?: string | undefined;
|
|
1315
|
+
} | undefined;
|
|
1316
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1317
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1318
|
+
user: better_auth0.OAuth2UserInfo;
|
|
1319
|
+
data: Record<string, any>;
|
|
1320
|
+
}, {
|
|
1321
|
+
code?: string | undefined;
|
|
1322
|
+
message?: string | undefined;
|
|
1323
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1324
|
+
} & {
|
|
1325
|
+
getSession: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
1326
|
+
disableCookieCache?: unknown;
|
|
1327
|
+
disableRefresh?: unknown;
|
|
1328
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1329
|
+
query?: {
|
|
1330
|
+
disableCookieCache?: unknown;
|
|
1331
|
+
disableRefresh?: unknown;
|
|
1332
|
+
} | undefined;
|
|
1333
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1334
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<better_auth_react0.BetterFetchResponse<{
|
|
1335
|
+
user: {
|
|
1336
|
+
id: string;
|
|
1337
|
+
createdAt: Date;
|
|
1338
|
+
updatedAt: Date;
|
|
1339
|
+
email: string;
|
|
1340
|
+
emailVerified: boolean;
|
|
1341
|
+
name: string;
|
|
1342
|
+
image?: string | null | undefined;
|
|
1343
|
+
};
|
|
1344
|
+
session: {
|
|
1345
|
+
id: string;
|
|
1346
|
+
createdAt: Date;
|
|
1347
|
+
updatedAt: Date;
|
|
1348
|
+
userId: string;
|
|
1349
|
+
expiresAt: Date;
|
|
1350
|
+
token: string;
|
|
1351
|
+
ipAddress?: string | null | undefined;
|
|
1352
|
+
userAgent?: string | null | undefined;
|
|
1353
|
+
};
|
|
1354
|
+
} | null, {
|
|
1355
|
+
code?: string | undefined;
|
|
1356
|
+
message?: string | undefined;
|
|
1357
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1358
|
+
} & {
|
|
1359
|
+
useSession: () => {
|
|
1360
|
+
data: {
|
|
1361
|
+
user: {
|
|
1362
|
+
id: string;
|
|
1363
|
+
createdAt: Date;
|
|
1364
|
+
updatedAt: Date;
|
|
1365
|
+
email: string;
|
|
1366
|
+
emailVerified: boolean;
|
|
1367
|
+
name: string;
|
|
1368
|
+
image?: string | null | undefined;
|
|
1369
|
+
};
|
|
1370
|
+
session: {
|
|
1371
|
+
id: string;
|
|
1372
|
+
createdAt: Date;
|
|
1373
|
+
updatedAt: Date;
|
|
1374
|
+
userId: string;
|
|
1375
|
+
expiresAt: Date;
|
|
1376
|
+
token: string;
|
|
1377
|
+
ipAddress?: string | null | undefined;
|
|
1378
|
+
userAgent?: string | null | undefined;
|
|
1379
|
+
};
|
|
1380
|
+
} | null;
|
|
1381
|
+
isPending: boolean;
|
|
1382
|
+
isRefetching: boolean;
|
|
1383
|
+
error: better_auth_react0.BetterFetchError | null;
|
|
1384
|
+
refetch: (queryParams?: {
|
|
1385
|
+
query?: better_auth0.SessionQueryParams;
|
|
1386
|
+
} | undefined) => Promise<void>;
|
|
1387
|
+
};
|
|
1388
|
+
$Infer: {
|
|
1389
|
+
Session: {
|
|
1390
|
+
user: {
|
|
1391
|
+
id: string;
|
|
1392
|
+
createdAt: Date;
|
|
1393
|
+
updatedAt: Date;
|
|
1394
|
+
email: string;
|
|
1395
|
+
emailVerified: boolean;
|
|
1396
|
+
name: string;
|
|
1397
|
+
image?: string | null | undefined;
|
|
1398
|
+
};
|
|
1399
|
+
session: {
|
|
1400
|
+
id: string;
|
|
1401
|
+
createdAt: Date;
|
|
1402
|
+
updatedAt: Date;
|
|
1403
|
+
userId: string;
|
|
1404
|
+
expiresAt: Date;
|
|
1405
|
+
token: string;
|
|
1406
|
+
ipAddress?: string | null | undefined;
|
|
1407
|
+
userAgent?: string | null | undefined;
|
|
1408
|
+
};
|
|
1409
|
+
};
|
|
1410
|
+
};
|
|
1411
|
+
$fetch: better_auth_react0.BetterFetch<{
|
|
1412
|
+
plugins: (better_auth_react0.BetterFetchPlugin<Record<string, any>> | {
|
|
1413
|
+
id: string;
|
|
1414
|
+
name: string;
|
|
1415
|
+
hooks: {
|
|
1416
|
+
onSuccess(context: better_auth_react0.SuccessContext<any>): void;
|
|
1417
|
+
};
|
|
1418
|
+
} | {
|
|
1419
|
+
id: string;
|
|
1420
|
+
name: string;
|
|
1421
|
+
hooks: {
|
|
1422
|
+
onSuccess: ((context: better_auth_react0.SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1423
|
+
onError: ((context: better_auth_react0.ErrorContext) => Promise<void> | void) | undefined;
|
|
1424
|
+
onRequest: (<T extends Record<string, any>>(context: better_auth_react0.RequestContext<T>) => Promise<better_auth_react0.RequestContext | void> | better_auth_react0.RequestContext | void) | undefined;
|
|
1425
|
+
onResponse: ((context: better_auth_react0.ResponseContext) => Promise<Response | void | better_auth_react0.ResponseContext> | Response | better_auth_react0.ResponseContext | void) | undefined;
|
|
1426
|
+
};
|
|
1427
|
+
})[];
|
|
1428
|
+
cache?: RequestCache | undefined;
|
|
1429
|
+
method: string;
|
|
1430
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1431
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1432
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1433
|
+
authorization: "Bearer" | "Basic";
|
|
1434
|
+
})) | undefined;
|
|
1435
|
+
redirect?: RequestRedirect | undefined;
|
|
1436
|
+
credentials?: RequestCredentials;
|
|
1437
|
+
integrity?: string | undefined;
|
|
1438
|
+
keepalive?: boolean | undefined;
|
|
1439
|
+
mode?: RequestMode | undefined;
|
|
1440
|
+
priority?: RequestPriority | undefined;
|
|
1441
|
+
referrer?: string | undefined;
|
|
1442
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1443
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1444
|
+
window?: null | undefined;
|
|
1445
|
+
onRetry?: ((response: better_auth_react0.ResponseContext) => Promise<void> | void) | undefined;
|
|
1446
|
+
hookOptions?: {
|
|
1447
|
+
cloneResponse?: boolean;
|
|
1448
|
+
} | undefined;
|
|
1449
|
+
timeout?: number | undefined;
|
|
1450
|
+
customFetchImpl: better_auth_react0.FetchEsque;
|
|
1451
|
+
baseURL: string;
|
|
1452
|
+
throw?: boolean | undefined;
|
|
1453
|
+
auth?: ({
|
|
1454
|
+
type: "Bearer";
|
|
1455
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1456
|
+
} | {
|
|
1457
|
+
type: "Basic";
|
|
1458
|
+
username: string | (() => string | undefined) | undefined;
|
|
1459
|
+
password: string | (() => string | undefined) | undefined;
|
|
1460
|
+
} | {
|
|
1461
|
+
type: "Custom";
|
|
1462
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1463
|
+
value: string | (() => string | undefined) | undefined;
|
|
1464
|
+
}) | undefined;
|
|
1465
|
+
body?: any;
|
|
1466
|
+
query?: any;
|
|
1467
|
+
params?: any;
|
|
1468
|
+
duplex?: "full" | "half" | undefined;
|
|
1469
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
1470
|
+
retry?: better_auth_react0.RetryOptions | undefined;
|
|
1471
|
+
retryAttempt?: number | undefined;
|
|
1472
|
+
output?: (better_auth_react0.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1473
|
+
errorSchema?: better_auth_react0.StandardSchemaV1 | undefined;
|
|
1474
|
+
disableValidation?: boolean | undefined;
|
|
1475
|
+
disableSignal?: boolean | undefined;
|
|
1476
|
+
}, unknown, unknown, {}>;
|
|
1477
|
+
$store: {
|
|
1478
|
+
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
1479
|
+
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
1480
|
+
atoms: Record<string, better_auth_react0.WritableAtom<any>>;
|
|
1481
|
+
};
|
|
1482
|
+
$ERROR_CODES: {
|
|
1483
|
+
readonly USER_NOT_FOUND: "User not found";
|
|
1484
|
+
readonly FAILED_TO_CREATE_USER: "Failed to create user";
|
|
1485
|
+
readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
|
|
1486
|
+
readonly FAILED_TO_UPDATE_USER: "Failed to update user";
|
|
1487
|
+
readonly FAILED_TO_GET_SESSION: "Failed to get session";
|
|
1488
|
+
readonly INVALID_PASSWORD: "Invalid password";
|
|
1489
|
+
readonly INVALID_EMAIL: "Invalid email";
|
|
1490
|
+
readonly INVALID_EMAIL_OR_PASSWORD: "Invalid email or password";
|
|
1491
|
+
readonly SOCIAL_ACCOUNT_ALREADY_LINKED: "Social account already linked";
|
|
1492
|
+
readonly PROVIDER_NOT_FOUND: "Provider not found";
|
|
1493
|
+
readonly INVALID_TOKEN: "Invalid token";
|
|
1494
|
+
readonly ID_TOKEN_NOT_SUPPORTED: "id_token not supported";
|
|
1495
|
+
readonly FAILED_TO_GET_USER_INFO: "Failed to get user info";
|
|
1496
|
+
readonly USER_EMAIL_NOT_FOUND: "User email not found";
|
|
1497
|
+
readonly EMAIL_NOT_VERIFIED: "Email not verified";
|
|
1498
|
+
readonly PASSWORD_TOO_SHORT: "Password too short";
|
|
1499
|
+
readonly PASSWORD_TOO_LONG: "Password too long";
|
|
1500
|
+
readonly USER_ALREADY_EXISTS: "User already exists.";
|
|
1501
|
+
readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
|
|
1502
|
+
readonly EMAIL_CAN_NOT_BE_UPDATED: "Email can not be updated";
|
|
1503
|
+
readonly CREDENTIAL_ACCOUNT_NOT_FOUND: "Credential account not found";
|
|
1504
|
+
readonly SESSION_EXPIRED: "Session expired. Re-authenticate to perform this action.";
|
|
1505
|
+
readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
|
|
1506
|
+
readonly ACCOUNT_NOT_FOUND: "Account not found";
|
|
1507
|
+
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
1508
|
+
};
|
|
1509
|
+
};
|
|
767
1510
|
declare function createKuckitWebServices(options?: CreateServicesOptions): KuckitWebServices;
|
|
768
1511
|
//#endregion
|
|
769
1512
|
//#region src/router.d.ts
|
|
@@ -809,4 +1552,5 @@ declare function mergeRouteTrees<TStaticRoutes extends object>(staticRouteTree:
|
|
|
809
1552
|
*/
|
|
810
1553
|
declare function KuckitModuleRoute(): react_jsx_runtime0.JSX.Element | null;
|
|
811
1554
|
//#endregion
|
|
812
|
-
export { type AuthClient, type ClientModuleSpec, type CreateKuckitWebProviderOptions, type CreateServicesOptions, KuckitModuleRoute, type KuckitRouterContext, type KuckitWebConfig, type KuckitWebContext, type KuckitWebProviderProps, type KuckitWebRouterProps, type KuckitWebServices, type ModuleRoute, type NavItem, type ORPCUtils, type RouteDefinition, buildModuleRoutes, createAuthClientService, createKuckitWebProvider, createKuckitWebServices, createORPCUtils, createQueryClient, createRPCClient, createRPCLink, mergeRouteTrees, useAuth, useKuckitWeb, useOrpc, useQueryClient, useRpc, useServices, withKuckitWeb };
|
|
1555
|
+
export { type AuthClient, type ClientModuleSpec, type CreateKuckitWebProviderOptions, type CreateServicesOptions, KuckitModuleRoute, type KuckitRouterContext, type KuckitWebConfig, type KuckitWebContext, type KuckitWebProviderProps, type KuckitWebRouterProps, type KuckitWebServices, type ModuleRoute, type NavItem, type ORPCUtils, type RouteDefinition, buildModuleRoutes, createAuthClientService, createKuckitWebProvider, createKuckitWebServices, createORPCUtils, createQueryClient, createRPCClient, createRPCLink, mergeRouteTrees, useAuth, useKuckitWeb, useOrpc, useQueryClient, useRpc, useServices, withKuckitWeb };
|
|
1556
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -363,4 +363,5 @@ function KuckitModuleRoute() {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
//#endregion
|
|
366
|
-
export { KuckitModuleRoute, buildModuleRoutes, createAuthClientService, createKuckitWebProvider, createKuckitWebServices, createORPCUtils, createQueryClient, createRPCClient, createRPCLink, mergeRouteTrees, useAuth, useKuckitWeb, useOrpc, useQueryClient, useRpc, useServices, withKuckitWeb };
|
|
366
|
+
export { KuckitModuleRoute, buildModuleRoutes, createAuthClientService, createKuckitWebProvider, createKuckitWebServices, createORPCUtils, createQueryClient, createRPCClient, createRPCLink, mergeRouteTrees, useAuth, useKuckitWeb, useOrpc, useQueryClient, useRpc, useServices, withKuckitWeb };
|
|
367
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["contextValue: KuckitWebContext","pathname"],"sources":["../src/services.ts","../src/provider.tsx","../src/router.ts","../src/components/KuckitModuleRoute.tsx"],"sourcesContent":["import { createORPCClient } from '@orpc/client'\nimport { RPCLink } from '@orpc/client/fetch'\nimport { createTanstackQueryUtils } from '@orpc/tanstack-query'\nimport { QueryCache, QueryClient } from '@tanstack/react-query'\nimport { createAuthClient } from 'better-auth/react'\nimport { inferAdditionalFields } from 'better-auth/client/plugins'\nimport type { AppRouterClient } from '@kuckit/api/routers/index'\nimport type { Auth } from '@kuckit/auth'\nimport type { KuckitWebServices, ORPCUtils } from './types'\n\nexport interface CreateServicesOptions {\n\tserverUrl?: string\n\tonQueryError?: (error: Error) => void\n}\n\nexport function createQueryClient(onError?: (error: Error) => void): QueryClient {\n\tconst queryClient = new QueryClient({\n\t\tqueryCache: new QueryCache({\n\t\t\tonError: (error) => {\n\t\t\t\tonError?.(error)\n\t\t\t},\n\t\t}),\n\t})\n\treturn queryClient\n}\n\nexport function createRPCLink(serverUrl: string) {\n\treturn new RPCLink({\n\t\turl: `${serverUrl}/rpc`,\n\t\tfetch(url, options) {\n\t\t\treturn fetch(url, {\n\t\t\t\t...options,\n\t\t\t\tcredentials: 'include',\n\t\t\t})\n\t\t},\n\t})\n}\n\nexport function createRPCClient(link: ReturnType<typeof createRPCLink>): AppRouterClient {\n\treturn createORPCClient(link)\n}\n\nexport function createORPCUtils(client: AppRouterClient): ORPCUtils {\n\treturn createTanstackQueryUtils(client)\n}\n\nexport function createAuthClientService(serverUrl: string) {\n\treturn createAuthClient({\n\t\tbaseURL: serverUrl,\n\t\tplugins: [inferAdditionalFields<Auth>()],\n\t})\n}\n\nexport function createKuckitWebServices(options: CreateServicesOptions = {}): KuckitWebServices {\n\tconst serverUrl =\n\t\toptions.serverUrl ||\n\t\t(typeof globalThis !== 'undefined' && 'location' in globalThis\n\t\t\t? (globalThis as unknown as { location: { origin: string } }).location.origin\n\t\t\t: '')\n\n\tconst queryClient = createQueryClient(options.onQueryError)\n\tconst link = createRPCLink(serverUrl)\n\tconst rpcClient = createRPCClient(link)\n\tconst orpc = createORPCUtils(rpcClient)\n\tconst authClient = createAuthClientService(serverUrl)\n\n\treturn {\n\t\tqueryClient,\n\t\trpcClient,\n\t\torpc,\n\t\tauthClient,\n\t}\n}\n","import {\n\tcreateContext,\n\tuseContext,\n\tuseEffect,\n\tuseState,\n\tuseMemo,\n\tcreateElement,\n\ttype ReactNode,\n\ttype ComponentType,\n\ttype FC,\n} from 'react'\nimport { QueryClientProvider } from '@tanstack/react-query'\nimport {\n\tRouterProvider,\n\tcreateRouter,\n\tcreateRoute,\n\ttype RouteComponent,\n} from '@tanstack/react-router'\nimport {\n\tloadKuckitClientModules,\n\tKuckitNavProvider,\n\tKuckitSlotProvider,\n\tKuckitRpcProvider,\n\ttype LoadClientModulesResult,\n} from '@kuckit/sdk-react'\nimport { createKuckitWebServices } from './services'\nimport type {\n\tKuckitWebConfig,\n\tKuckitWebContext,\n\tKuckitWebServices,\n\tCreateKuckitWebProviderOptions,\n} from './types'\n\nconst KuckitWebContext = createContext<KuckitWebContext | null>(null)\nconst ServicesContext = createContext<KuckitWebServices | null>(null)\n\nfunction DefaultLoader() {\n\treturn createElement('div', {\n\t\tstyle: { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100vh' },\n\t\tchildren: 'Loading...',\n\t})\n}\n\nfunction DefaultError({ error }: { error: Error }) {\n\treturn createElement('div', {\n\t\tstyle: {\n\t\t\tdisplay: 'flex',\n\t\t\talignItems: 'center',\n\t\t\tjustifyContent: 'center',\n\t\t\theight: '100vh',\n\t\t\tflexDirection: 'column',\n\t\t},\n\t\tchildren: [\n\t\t\tcreateElement('h2', { key: 'title', style: { color: 'red' } }, 'Failed to load modules'),\n\t\t\tcreateElement('p', { key: 'message' }, error.message),\n\t\t],\n\t})\n}\n\nexport function useKuckitWeb(): KuckitWebContext {\n\tconst ctx = useContext(KuckitWebContext)\n\tif (!ctx) {\n\t\tthrow new Error('useKuckitWeb must be used within a KuckitWebProvider')\n\t}\n\treturn ctx\n}\n\nexport function useServices(): KuckitWebServices {\n\tconst ctx = useContext(ServicesContext)\n\tif (!ctx) {\n\t\tthrow new Error('useServices must be used within a KuckitWebProvider')\n\t}\n\treturn ctx\n}\n\nexport function useRpc() {\n\tconst { rpcClient } = useServices()\n\treturn rpcClient\n}\n\nexport function useOrpc() {\n\tconst { orpc } = useServices()\n\treturn orpc\n}\n\nexport function useAuth() {\n\tconst { authClient } = useServices()\n\treturn authClient\n}\n\nexport function useQueryClient() {\n\tconst { queryClient } = useServices()\n\treturn queryClient\n}\n\ninterface InternalProviderProps {\n\tconfig: KuckitWebConfig\n\trouteTree: unknown\n\trootRoute: unknown\n\tchildren?: ReactNode\n}\n\nfunction InternalKuckitWebProvider({\n\tconfig,\n\trouteTree,\n\trootRoute,\n\tchildren,\n}: InternalProviderProps) {\n\tconst { services, Loader, ErrorComponent } = useMemo(() => {\n\t\tconst svc = createKuckitWebServices({ serverUrl: config.serverUrl })\n\t\treturn {\n\t\t\tservices: svc,\n\t\t\tLoader: config.loaderComponent || DefaultLoader,\n\t\t\tErrorComponent: config.errorComponent || DefaultError,\n\t\t}\n\t}, [config.serverUrl, config.loaderComponent, config.errorComponent])\n\n\tconst [loadResult, setLoadResult] = useState<LoadClientModulesResult | null>(null)\n\tconst [error, setError] = useState<Error | null>(null)\n\n\tuseEffect(() => {\n\t\tlet cancelled = false\n\n\t\tconst loadModules = async () => {\n\t\t\ttry {\n\t\t\t\tconst result = await loadKuckitClientModules({\n\t\t\t\t\torpc: services.orpc,\n\t\t\t\t\tqueryClient: services.queryClient,\n\t\t\t\t\tenv: config.env || 'production',\n\t\t\t\t\tmodules: config.modules,\n\t\t\t\t})\n\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tsetLoadResult(result)\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tloadModules()\n\n\t\treturn () => {\n\t\t\tcancelled = true\n\t\t}\n\t}, [services, config.modules, config.env])\n\n\tconst router = useMemo(() => {\n\t\tif (!loadResult) return null\n\n\t\tconst moduleRouteDefs = loadResult.routeRegistry.getAll()\n\t\tconst moduleRoutes = moduleRouteDefs.map((routeDef) =>\n\t\t\tcreateRoute({\n\t\t\t\tgetParentRoute: () => rootRoute as ReturnType<typeof createRoute>,\n\t\t\t\tpath: routeDef.path,\n\t\t\t\tcomponent: routeDef.component as RouteComponent,\n\t\t\t})\n\t\t)\n\n\t\tif (moduleRoutes.length > 0) {\n\t\t\tconsole.log(\n\t\t\t\t`[kuckit/app-web] Loaded ${moduleRoutes.length} module routes:`,\n\t\t\t\tmoduleRouteDefs.map((r) => r.path)\n\t\t\t)\n\t\t}\n\n\t\treturn createRouter({\n\t\t\trouteTree: routeTree as Parameters<typeof createRouter>[0]['routeTree'],\n\t\t\tdefaultPreload: 'intent',\n\t\t\tdefaultPendingComponent: Loader as FC,\n\t\t\tcontext: {\n\t\t\t\torpc: services.orpc,\n\t\t\t\tqueryClient: services.queryClient,\n\t\t\t\tauthClient: services.authClient,\n\t\t\t},\n\t\t})\n\t}, [loadResult, routeTree, rootRoute, services, Loader])\n\n\tif (error) {\n\t\treturn createElement(ErrorComponent, { error })\n\t}\n\n\tif (!loadResult || !router) {\n\t\treturn createElement(Loader)\n\t}\n\n\tconst contextValue: KuckitWebContext = {\n\t\trouteRegistry: loadResult.routeRegistry,\n\t\tnavRegistry: loadResult.navRegistry,\n\t\tslotRegistry: loadResult.slotRegistry,\n\t\tservices,\n\t\tisLoaded: true,\n\t}\n\n\treturn createElement(\n\t\tServicesContext.Provider,\n\t\t{ value: services },\n\t\tcreateElement(\n\t\t\tQueryClientProvider,\n\t\t\t{ client: services.queryClient },\n\t\t\tcreateElement(\n\t\t\t\tKuckitWebContext.Provider,\n\t\t\t\t{ value: contextValue },\n\t\t\t\tcreateElement(\n\t\t\t\t\tKuckitRpcProvider,\n\t\t\t\t\t{ client: services.rpcClient, children: null },\n\t\t\t\t\tcreateElement(\n\t\t\t\t\t\tKuckitNavProvider,\n\t\t\t\t\t\t{ registry: loadResult.navRegistry, children: null },\n\t\t\t\t\t\tcreateElement(\n\t\t\t\t\t\t\tKuckitSlotProvider,\n\t\t\t\t\t\t\t{ registry: loadResult.slotRegistry, children: null },\n\t\t\t\t\t\t\tcreateElement(RouterProvider, { router }),\n\t\t\t\t\t\t\tchildren\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t)\n}\n\nexport function createKuckitWebProvider(\n\toptions: CreateKuckitWebProviderOptions\n): ComponentType<{ children?: ReactNode }> {\n\tconst { routeTree, rootRoute, ...config } = options\n\n\treturn function KuckitWebProvider({ children }: { children?: ReactNode }) {\n\t\treturn createElement(InternalKuckitWebProvider, {\n\t\t\tconfig,\n\t\t\trouteTree,\n\t\t\trootRoute,\n\t\t\tchildren,\n\t\t})\n\t}\n}\n\nexport function withKuckitWeb<P extends object>(\n\tComponent: ComponentType<P>,\n\toptions: CreateKuckitWebProviderOptions\n): ComponentType<P> {\n\tconst Provider = createKuckitWebProvider(options)\n\n\treturn function WrappedWithKuckit(props: P) {\n\t\treturn createElement(Provider, null, createElement(Component, props))\n\t}\n}\n","import { createRoute, type AnyRoute, type RouteComponent } from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\nimport type { RouteRegistry, RouteDefinition } from '@kuckit/sdk-react'\nimport type { ORPCUtils, AuthClient } from './types'\n\n/**\n * Context type for TanStack Router integration with Kuckit.\n * This is passed via router context to enable oRPC access in route loaders.\n */\nexport interface KuckitRouterContext {\n\torpc: ORPCUtils\n\tqueryClient: QueryClient\n\tauthClient: AuthClient\n}\n\n/**\n * Build TanStack Router routes from a RouteRegistry\n *\n * This function converts module-registered routes into TanStack Router\n * route objects that can be added to the route tree.\n *\n * @param routeRegistry - Registry containing module routes\n * @param rootRoute - The root route to attach module routes to\n * @returns Array of TanStack route objects\n */\nexport function buildModuleRoutes(routeRegistry: RouteRegistry, rootRoute: AnyRoute): AnyRoute[] {\n\tconst routes = routeRegistry.getAll()\n\tconst routeMap = new Map<string, AnyRoute>()\n\n\t// First pass: create all routes\n\tfor (const routeDef of routes) {\n\t\tconst route = createModuleRoute(routeDef, rootRoute)\n\t\trouteMap.set(routeDef.id, route)\n\t}\n\n\t// Second pass: handle parent-child relationships\n\t// Note: For now we attach all to root. Nested routes would need\n\t// the parent route to be created first.\n\tconst topLevelRoutes = routes\n\t\t.filter((r) => !r.parentRouteId || r.parentRouteId === '__root__')\n\t\t.map((r) => routeMap.get(r.id)!)\n\t\t.filter(Boolean)\n\n\treturn topLevelRoutes\n}\n\n/**\n * Create a single TanStack route from a RouteDefinition\n */\nfunction createModuleRoute(routeDef: RouteDefinition, parentRoute: AnyRoute): AnyRoute {\n\treturn createRoute({\n\t\tgetParentRoute: () => parentRoute,\n\t\tpath: routeDef.path,\n\t\tcomponent: routeDef.component as RouteComponent,\n\t\t// Add head metadata if provided\n\t\t...(routeDef.meta?.title && {\n\t\t\thead: () => ({\n\t\t\t\tmeta: [{ title: routeDef.meta!.title }],\n\t\t\t}),\n\t\t}),\n\t})\n}\n\n/**\n * Merge static routes with module routes\n *\n * This is used to combine the codegen route tree with dynamic module routes.\n */\nexport function mergeRouteTrees<TStaticRoutes extends object>(\n\tstaticRouteTree: TStaticRoutes,\n\t_moduleRoutes: AnyRoute[]\n): TStaticRoutes {\n\t// TanStack Router's route tree is built via _addFileChildren\n\t// For dynamic routes, we need to add them to the root route's children\n\t// This is a simplified approach - in practice you may need to patch\n\t// the root route to include new children\n\n\t// For now, return the static tree as-is\n\t// The module routes can be rendered via a catch-all pattern\n\t// or by using the router's addRoute API if available\n\n\treturn staticRouteTree\n}\n","import { useRouterState, Link, useNavigate } from '@tanstack/react-router'\nimport { useEffect, useState } from 'react'\nimport { useKuckitWeb, useAuth } from '../provider'\n\n/**\n * Helper to determine if a route path is a root-level route (outside dashboard).\n * Root routes start with '/' but NOT '/dashboard'.\n */\nfunction isRootLevelRoute(path: string): boolean {\n\treturn path.startsWith('/') && !path.startsWith('/dashboard')\n}\n\n/**\n * Dynamic route renderer for Kuckit module routes.\n *\n * This component looks up the current path in the RouteRegistry\n * and renders the corresponding module component if found.\n *\n * Route resolution is context-aware:\n * - When rendered under /dashboard/*: matches dashboard routes\n * - When rendered at root level: matches root-level routes (paths starting with '/' but not '/dashboard/')\n *\n * For root routes with meta.requiresAuth: true, redirects to /login if not authenticated.\n */\nexport function KuckitModuleRoute() {\n\tconst { routeRegistry } = useKuckitWeb()\n\tconst authClient = useAuth()\n\tconst { location } = useRouterState()\n\tconst navigate = useNavigate()\n\tconst pathname = location.pathname\n\n\tconst [authChecked, setAuthChecked] = useState(false)\n\tconst [isAuthenticated, setIsAuthenticated] = useState(false)\n\n\t// Determine if we're in dashboard context\n\tconst isDashboardContext = pathname.startsWith('/dashboard')\n\n\t// Filter routes based on context\n\tconst contextRoutes = routeRegistry.getAll().filter((r) => {\n\t\tconst isRoot = isRootLevelRoute(r.path)\n\t\t// In dashboard context: show non-root routes\n\t\t// In root context: show root routes\n\t\treturn isDashboardContext ? !isRoot : isRoot\n\t})\n\n\t// For dashboard context, also try matching with /dashboard prefix stripped\n\tconst modulePathname = isDashboardContext ? pathname.replace('/dashboard', '') || '/' : pathname\n\n\t// Match route path against pathname, supporting catch-all patterns like /docs/$\n\tfunction matchRoute(routePath: string, pathname: string): boolean {\n\t\t// Exact match\n\t\tif (routePath === pathname) return true\n\n\t\t// Catch-all pattern: /docs/$ matches /docs/anything/here\n\t\tif (routePath.endsWith('/$')) {\n\t\t\tconst base = routePath.slice(0, -1) // Remove trailing $\n\t\t\treturn pathname.startsWith(base)\n\t\t}\n\n\t\treturn false\n\t}\n\n\t// Find matching route - prefer exact matches over catch-all\n\tconst exactMatch = contextRoutes.find((r) => r.path === pathname)\n\tconst catchAllMatch = contextRoutes.find(\n\t\t(r) => r.path.endsWith('/$') && matchRoute(r.path, pathname)\n\t)\n\tlet routeDef = exactMatch || catchAllMatch\n\n\tif (!routeDef && isDashboardContext) {\n\t\t// For dashboard routes, also try matching stripped path\n\t\tconst exactDash = contextRoutes.find((r) => r.path === modulePathname)\n\t\tconst catchAllDash = contextRoutes.find(\n\t\t\t(r) => r.path.endsWith('/$') && matchRoute(r.path, modulePathname)\n\t\t)\n\t\trouteDef = exactDash || catchAllDash\n\t}\n\n\t// Check auth for root routes with requiresAuth\n\tuseEffect(() => {\n\t\tasync function checkAuth() {\n\t\t\tif (!routeDef) {\n\t\t\t\tsetAuthChecked(true)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Dashboard routes are already protected by the dashboard layout\n\t\t\tif (isDashboardContext) {\n\t\t\t\tsetAuthChecked(true)\n\t\t\t\tsetIsAuthenticated(true)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// For root routes, check if auth is required\n\t\t\tif (routeDef.meta?.requiresAuth) {\n\t\t\t\tconst session = await authClient.getSession()\n\t\t\t\tif (!session.data) {\n\t\t\t\t\t// Redirect to login with return URL\n\t\t\t\t\tnavigate({\n\t\t\t\t\t\tto: '/login',\n\t\t\t\t\t\tsearch: { redirect: pathname },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tsetIsAuthenticated(true)\n\t\t\t}\n\t\t\tsetAuthChecked(true)\n\t\t}\n\n\t\tcheckAuth()\n\t}, [routeDef, isDashboardContext, pathname, navigate, authClient])\n\n\t// Show loading while checking auth for protected root routes\n\tif (!isDashboardContext && routeDef?.meta?.requiresAuth && !authChecked) {\n\t\treturn (\n\t\t\t<div className=\"flex items-center justify-center min-h-screen\">\n\t\t\t\t<div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-primary\" />\n\t\t\t</div>\n\t\t)\n\t}\n\n\t// Protected root route - waiting for redirect\n\tif (!isDashboardContext && routeDef?.meta?.requiresAuth && !isAuthenticated) {\n\t\treturn null\n\t}\n\n\tif (!routeDef) {\n\t\treturn (\n\t\t\t<div className=\"flex flex-col items-center justify-center min-h-[50vh] gap-4\">\n\t\t\t\t<h1 className=\"text-2xl font-bold\">Page Not Found</h1>\n\t\t\t\t<p className=\"text-muted-foreground\">The page \"{pathname}\" could not be found.</p>\n\t\t\t\t<Link to=\"/\" className=\"text-primary hover:underline\">\n\t\t\t\t\tGo Home\n\t\t\t\t</Link>\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst Component = routeDef.component as React.ComponentType\n\treturn <Component />\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,kBAAkB,SAA+C;AAQhF,QAPoB,IAAI,YAAY,EACnC,YAAY,IAAI,WAAW,EAC1B,UAAU,UAAU;AACnB,YAAU,MAAM;IAEjB,CAAC,EACF,CAAC;;AAIH,SAAgB,cAAc,WAAmB;AAChD,QAAO,IAAI,QAAQ;EAClB,KAAK,GAAG,UAAU;EAClB,MAAM,KAAK,SAAS;AACnB,UAAO,MAAM,KAAK;IACjB,GAAG;IACH,aAAa;IACb,CAAC;;EAEH,CAAC;;AAGH,SAAgB,gBAAgB,MAAyD;AACxF,QAAO,iBAAiB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