@choiceform/shared-auth 0.1.17 → 0.1.19

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.
Files changed (100) hide show
  1. package/README.md +504 -121
  2. package/dist/__tests__/auth-utils.test.d.ts +5 -0
  3. package/dist/__tests__/auth-utils.test.d.ts.map +1 -0
  4. package/dist/__tests__/auth-utils.test.js +96 -0
  5. package/dist/__tests__/store.test.d.ts +5 -0
  6. package/dist/__tests__/store.test.d.ts.map +1 -0
  7. package/dist/__tests__/store.test.js +210 -0
  8. package/dist/__tests__/user-mapper.test.d.ts +5 -0
  9. package/dist/__tests__/user-mapper.test.d.ts.map +1 -0
  10. package/dist/__tests__/user-mapper.test.js +76 -0
  11. package/dist/api/auth-api.d.ts +93 -9
  12. package/dist/api/auth-api.d.ts.map +1 -1
  13. package/dist/api/auth-api.js +219 -80
  14. package/dist/api/client.d.ts +10 -0
  15. package/dist/api/client.d.ts.map +1 -1
  16. package/dist/api/client.js +10 -0
  17. package/dist/api/organization-api.d.ts +2 -7
  18. package/dist/api/organization-api.d.ts.map +1 -1
  19. package/dist/api/organization-api.js +2 -17
  20. package/dist/api/team-api.d.ts +1 -5
  21. package/dist/api/team-api.d.ts.map +1 -1
  22. package/dist/api/team-api.js +5 -11
  23. package/dist/config.js +1 -1
  24. package/dist/core.d.ts +257 -137
  25. package/dist/core.d.ts.map +1 -1
  26. package/dist/core.js +112 -28
  27. package/dist/hooks/index.d.ts +8 -0
  28. package/dist/hooks/index.d.ts.map +1 -0
  29. package/dist/hooks/index.js +7 -0
  30. package/dist/hooks/use-auth-init.d.ts +4 -0
  31. package/dist/hooks/use-auth-init.d.ts.map +1 -1
  32. package/dist/hooks/use-auth-init.js +16 -21
  33. package/dist/hooks/use-auth-sync.d.ts +60 -0
  34. package/dist/hooks/use-auth-sync.d.ts.map +1 -0
  35. package/dist/hooks/use-auth-sync.js +116 -0
  36. package/dist/hooks/use-email-verification.d.ts +85 -0
  37. package/dist/hooks/use-email-verification.d.ts.map +1 -0
  38. package/dist/hooks/use-email-verification.js +145 -0
  39. package/dist/hooks/use-protected-route.d.ts +67 -0
  40. package/dist/hooks/use-protected-route.d.ts.map +1 -0
  41. package/dist/hooks/use-protected-route.js +102 -0
  42. package/dist/index.d.ts +12 -6
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +45 -13
  45. package/dist/init.d.ts +236 -136
  46. package/dist/init.d.ts.map +1 -1
  47. package/dist/lib/auth-client.d.ts +108 -66
  48. package/dist/lib/auth-client.d.ts.map +1 -1
  49. package/dist/lib/auth-client.js +75 -2
  50. package/dist/services/auth-service.d.ts +101 -0
  51. package/dist/services/auth-service.d.ts.map +1 -0
  52. package/dist/services/auth-service.js +356 -0
  53. package/dist/services/callback-service.d.ts +33 -0
  54. package/dist/services/callback-service.d.ts.map +1 -0
  55. package/dist/services/callback-service.js +473 -0
  56. package/dist/services/companion-team.d.ts.map +1 -1
  57. package/dist/services/companion-team.js +41 -39
  58. package/dist/services/index.d.ts +3 -0
  59. package/dist/services/index.d.ts.map +1 -1
  60. package/dist/services/index.js +3 -0
  61. package/dist/services/referral-service.d.ts +54 -0
  62. package/dist/services/referral-service.d.ts.map +1 -0
  63. package/dist/services/referral-service.js +54 -0
  64. package/dist/store/actions.d.ts +54 -51
  65. package/dist/store/actions.d.ts.map +1 -1
  66. package/dist/store/actions.js +111 -243
  67. package/dist/store/computed.d.ts +72 -1
  68. package/dist/store/computed.d.ts.map +1 -1
  69. package/dist/store/computed.js +90 -3
  70. package/dist/store/index.d.ts +3 -3
  71. package/dist/store/index.d.ts.map +1 -1
  72. package/dist/store/index.js +2 -2
  73. package/dist/store/state.d.ts +10 -0
  74. package/dist/store/state.d.ts.map +1 -1
  75. package/dist/store/state.js +11 -1
  76. package/dist/store/utils.d.ts +3 -34
  77. package/dist/store/utils.d.ts.map +1 -1
  78. package/dist/store/utils.js +2 -22
  79. package/dist/types/auth.d.ts +106 -0
  80. package/dist/types/auth.d.ts.map +1 -1
  81. package/dist/types/callback.d.ts +35 -0
  82. package/dist/types/callback.d.ts.map +1 -0
  83. package/dist/types/callback.js +1 -0
  84. package/dist/types/index.d.ts +4 -3
  85. package/dist/types/index.d.ts.map +1 -1
  86. package/dist/types/organization.d.ts +19 -3
  87. package/dist/types/organization.d.ts.map +1 -1
  88. package/dist/types/team.d.ts +6 -2
  89. package/dist/types/team.d.ts.map +1 -1
  90. package/dist/types/user.d.ts +11 -3
  91. package/dist/types/user.d.ts.map +1 -1
  92. package/dist/utils/auth-utils.d.ts +60 -0
  93. package/dist/utils/auth-utils.d.ts.map +1 -0
  94. package/dist/utils/auth-utils.js +146 -0
  95. package/dist/utils/index.d.ts +1 -0
  96. package/dist/utils/index.d.ts.map +1 -1
  97. package/dist/utils/index.js +1 -0
  98. package/dist/utils/user-mapper.d.ts.map +1 -1
  99. package/dist/utils/user-mapper.js +4 -1
  100. package/package.json +17 -10
package/dist/init.d.ts CHANGED
@@ -25,16 +25,6 @@ interface InitAuthConfig {
25
25
  * - 如果用户传入自定义 plugins,则使用用户配置(不会合并默认插件)
26
26
  */
27
27
  export declare function initAuth(config: InitAuthConfig): {
28
- getCurrentUser: () => import("./types").SessionUser | null;
29
- getCurrentUserId: () => string | null;
30
- isAuthenticated: () => boolean;
31
- isLoading: () => boolean;
32
- isLoaded: () => boolean;
33
- waitForAuth: () => Promise<void>;
34
- getAuthToken: () => Promise<string | null>;
35
- getAuthTokenSync: () => string | null;
36
- getAuthHeaders: () => Promise<Record<string, string>>;
37
- getAuthHeadersSync: () => Record<string, string>;
38
28
  apiClient: {
39
29
  get<T = unknown>(path: string, options?: RequestInit): Promise<import("./api").ApiResponse<T>>;
40
30
  post<T = unknown>(path: string, body?: unknown, options?: RequestInit): Promise<import("./api").ApiResponse<T>>;
@@ -42,37 +32,132 @@ export declare function initAuth(config: InitAuthConfig): {
42
32
  delete<T = unknown>(path: string, options?: RequestInit): Promise<import("./api").ApiResponse<T>>;
43
33
  fetch(path: string, options?: RequestInit): Promise<Response>;
44
34
  };
45
- userManager: {
46
- getUser: () => import("./types").SessionUser | null;
47
- getUserId: () => string | null;
48
- };
49
- authActions: {
50
- initialize(user: import("./types").SessionUser | null, isLoaded: boolean): Promise<void>;
51
- fetchSessionWithToken(token: string): Promise<void>;
52
- handleUnauthorized(): void;
53
- setLoading(loading: boolean): void;
54
- setError(error: string | null): void;
55
- signIn(provider: string, callbackURL: string, newUserCallbackURL?: string, errorCallbackURL?: string): Promise<void>;
56
- signInWithMagicLink(email: string, callbackURL: string, name?: string, newUserCallbackURL?: string): Promise<boolean>;
57
- signInWithEmail(email: string, password: string): Promise<boolean>;
58
- signUpWithEmail(email: string, password: string, name: string): Promise<boolean>;
59
- signOut(redirectTo?: string): Promise<void>;
60
- updateUser(user: import("./types").SessionUser | null): void;
61
- getUser(): import("./types").SessionUser | null;
62
- };
63
35
  authApi: {
64
- getSession(token?: string): Promise<import("./types").SessionUser | null>;
36
+ getSession(): Promise<import("./types").SessionUser | null>;
65
37
  getSessionWithToken(token: string): Promise<import("./types").SessionUser | null>;
66
- setActiveOrganization(params: import("./types").SetActiveOrganizationRequest, token?: string): Promise<void>;
67
- setActiveTeam(params: import("./types").SetActiveTeamRequest, token?: string): Promise<void>;
68
38
  onboard(token: string): Promise<void>;
69
39
  updateUser(data: import("./types").UpdateUserRequest): Promise<import("./types").SessionUser | null>;
70
40
  sendMagicLink(params: import("./types").MagicLinkRequest): Promise<{
71
41
  status: boolean;
72
42
  }>;
73
- linkCredential(newPassword: string, token?: string): Promise<void>;
43
+ resendVerificationEmail(email: string, callbackURL?: string): Promise<{
44
+ status: boolean;
45
+ }>;
74
46
  checkEmailExists(email: string): Promise<boolean>;
47
+ linkCredential(newPassword: string, token?: string): Promise<void>;
48
+ changePassword(currentPassword: string, newPassword: string, token?: string): Promise<{
49
+ success: boolean;
50
+ }>;
51
+ changeEmail(newEmail: string, callbackURL?: string, token?: string): Promise<{
52
+ success: boolean;
53
+ }>;
54
+ listAccounts(token?: string): Promise<import("./types").Account[]>;
55
+ getOAuthAccountInfo(accountId: string, token?: string): Promise<import("./types").OAuthAccountInfo | null>;
56
+ unlinkAccount(providerId: string, accountId?: string, token?: string): Promise<{
57
+ success: boolean;
58
+ }>;
59
+ deleteUser(password?: string, callbackURL?: string, token?: string): Promise<{
60
+ message: string;
61
+ success: boolean;
62
+ }>;
63
+ listSessions(token?: string): Promise<import("./types").UserSession[]>;
64
+ revokeSession(params: import("./types").RevokeSessionRequest, token?: string): Promise<{
65
+ success: boolean;
66
+ }>;
67
+ };
68
+ organizationApi: {
69
+ create(request: import("./types").CreateOrganizationRequest): Promise<import("./types").Organization>;
70
+ update(request: import("./types").UpdateOrganizationRequest): Promise<import("./types").Organization>;
71
+ delete(request: import("./types").DeleteOrganizationRequest): Promise<string>;
72
+ list(): Promise<import("./types").Organization[]>;
73
+ getFullOrganization(): Promise<import("./types").FullOrganization | null>;
74
+ checkSlug(request: import("./types").CheckSlugRequest): Promise<boolean>;
75
+ getActiveMember(): Promise<import("./types").Member | null>;
76
+ getActiveMemberRole(): Promise<{
77
+ role: string;
78
+ } | null>;
79
+ removeMember(request: import("./types").RemoveMemberRequest): Promise<import("./types").Member>;
80
+ updateMemberRole(request: import("./types").UpdateMemberRoleRequest): Promise<import("./types").Member>;
81
+ inviteMember(request: import("./types").InviteMemberRequest): Promise<import("./types").Invitation>;
82
+ listInvitations(): Promise<import("./types").Invitation[]>;
83
+ getInvitation(invitationId: string): Promise<import("./types").InvitationDetail | null>;
84
+ cancelInvitation(request: import("./types").CancelInvitationRequest): Promise<void>;
85
+ acceptInvitation(request: import("./types").AcceptInvitationRequest): Promise<import("./types").InvitationResponse>;
86
+ rejectInvitation(request: import("./types").RejectInvitationRequest): Promise<import("./types").InvitationResponse>;
87
+ leave(organizationId: string): Promise<void>;
88
+ };
89
+ teamApi: {
90
+ create(request: import("./types").CreateTeamRequest): Promise<import("./types").Team>;
91
+ list(): Promise<import("./types").Team[]>;
92
+ update(request: import("./types").UpdateTeamRequest): Promise<import("./types").Team>;
93
+ delete(request: import("./types").DeleteTeamRequest): Promise<void>;
94
+ listUserTeams(): Promise<import("./types").Team[]>;
95
+ listMembers(teamId: string): Promise<import("./types").TeamMember[]>;
96
+ addMember(request: import("./types").AddTeamMemberRequest): Promise<import("./types").TeamMember>;
97
+ removeMember(request: import("./types").RemoveTeamMemberRequest): Promise<void>;
98
+ leaveTeam(teamId: string): Promise<void>;
75
99
  };
100
+ authStore: import("@legendapp/state").Observable<import("./types").AuthState>;
101
+ authComputed: {
102
+ isInitializing: import("@legendapp/state").ObservableBoolean;
103
+ isReady: import("@legendapp/state").ObservableBoolean;
104
+ isUnauthenticated: import("@legendapp/state").ObservableBoolean;
105
+ hasError: import("@legendapp/state").ObservableBoolean;
106
+ userId: import("@legendapp/state").ObservablePrimitive<string | null>;
107
+ userEmail: import("@legendapp/state").ObservablePrimitive<string | null>;
108
+ userName: import("@legendapp/state").ObservablePrimitive<string | null>;
109
+ userImage: import("@legendapp/state").ObservablePrimitive<string | null>;
110
+ emailVerified: import("@legendapp/state").ObservableBoolean;
111
+ activeOrganizationId: import("@legendapp/state").ObservablePrimitive<string | null>;
112
+ activeTeamId: import("@legendapp/state").ObservablePrimitive<string | null>;
113
+ inherentOrganizationId: import("@legendapp/state").ObservablePrimitive<string | null>;
114
+ inherentTeamId: import("@legendapp/state").ObservablePrimitive<string | null>;
115
+ hasActiveOrganization: import("@legendapp/state").ObservableBoolean;
116
+ hasActiveTeam: import("@legendapp/state").ObservableBoolean;
117
+ isInInherentOrganization: import("@legendapp/state").ObservableBoolean;
118
+ isInInherentTeam: import("@legendapp/state").ObservableBoolean;
119
+ };
120
+ tokenStorage: import("./api").TokenStorage;
121
+ storeActions: {
122
+ getUser(): import("./types").SessionUser | null;
123
+ getUserId(): string | null;
124
+ isAuthenticated(): boolean;
125
+ isLoading(): boolean;
126
+ isLoaded(): boolean;
127
+ setUser(user: import("./types").SessionUser | null): void;
128
+ updateUser(updates: Partial<import("./types").SessionUser>): void;
129
+ setLoading(loading: boolean): void;
130
+ setLoaded(loaded: boolean): void;
131
+ setError(error: string | null): void;
132
+ setAuthenticated(user: import("./types").SessionUser): void;
133
+ clearAuth(): void;
134
+ handleUnauthorized(): void;
135
+ setActiveOrganizationId(organizationId: string | null | undefined): void;
136
+ setActiveTeamId(teamId: string | null | undefined): void;
137
+ initialize(user: import("./types").SessionUser | null, isLoaded: boolean): void;
138
+ };
139
+ authService: {
140
+ fetchAndSetSession: (token: string) => Promise<import("./types").SessionUser | null>;
141
+ signInWithOAuth: (provider: string, callbackURL: string, newUserCallbackURL?: string, errorCallbackURL?: string) => Promise<void>;
142
+ signInWithMagicLink: (email: string, callbackURL: string, name?: string, newUserCallbackURL?: string) => Promise<boolean>;
143
+ signInWithEmail: (email: string, password: string) => Promise<{
144
+ emailVerified?: boolean;
145
+ success: boolean;
146
+ }>;
147
+ signUpWithEmail: (email: string, password: string, name: string, callbackURL?: string) => Promise<{
148
+ emailVerified?: boolean;
149
+ success: boolean;
150
+ }>;
151
+ signOut: (redirectTo?: string) => Promise<void>;
152
+ deleteUser: (callbackURL: string, password?: string) => Promise<{
153
+ needsVerification: boolean;
154
+ success: boolean;
155
+ }>;
156
+ };
157
+ referralService: import("./services").ReferralService;
158
+ setActiveOrganization: (request: import("./types").SetActiveOrganizationRequest) => Promise<import("./types").Organization>;
159
+ setActiveTeam: (request: import("./types").SetActiveTeamRequest) => Promise<void>;
160
+ setActiveOrganizationAndTeam: (organizationId: string, teamId: string) => Promise<import("./types").Organization>;
76
161
  authClient: {
77
162
  signIn: {
78
163
  social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
@@ -92,7 +177,7 @@ export declare function initAuth(config: InitAuthConfig): {
92
177
  requestSignUp?: boolean | undefined;
93
178
  loginHint?: string | undefined;
94
179
  additionalData?: Record<string, any> | undefined;
95
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
180
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
96
181
  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";
97
182
  callbackURL?: string | undefined;
98
183
  newUserCallbackURL?: string | undefined;
@@ -111,7 +196,7 @@ export declare function initAuth(config: InitAuthConfig): {
111
196
  additionalData?: Record<string, any> | undefined;
112
197
  } & {
113
198
  fetchOptions?: FetchOptions | undefined;
114
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<{
199
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<{
115
200
  redirect: boolean;
116
201
  url: string;
117
202
  } | {
@@ -133,10 +218,10 @@ export declare function initAuth(config: InitAuthConfig): {
133
218
  }, FetchOptions["throw"] extends true ? true : false>>;
134
219
  };
135
220
  } & {
136
- signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
221
+ signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
137
222
  query?: Record<string, any> | undefined;
138
223
  fetchOptions?: FetchOptions | undefined;
139
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
224
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
140
225
  success: boolean;
141
226
  }, {
142
227
  code?: string | undefined;
@@ -151,14 +236,14 @@ export declare function initAuth(config: InitAuthConfig): {
151
236
  image?: string | undefined;
152
237
  callbackURL?: string | undefined;
153
238
  rememberMe?: boolean | undefined;
154
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
239
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
155
240
  email: string;
156
241
  name: string;
157
242
  password: string;
158
243
  image?: string | undefined;
159
244
  callbackURL?: string | undefined;
160
245
  fetchOptions?: FetchOptions | undefined;
161
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<{
246
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<{
162
247
  token: null;
163
248
  user: {
164
249
  id: string;
@@ -192,14 +277,14 @@ export declare function initAuth(config: InitAuthConfig): {
192
277
  password: string;
193
278
  callbackURL?: string | undefined;
194
279
  rememberMe?: boolean | undefined;
195
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
280
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
196
281
  email: string;
197
282
  password: string;
198
283
  callbackURL?: string | undefined;
199
284
  rememberMe?: boolean | undefined;
200
285
  } & {
201
286
  fetchOptions?: FetchOptions | undefined;
202
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
287
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
203
288
  redirect: boolean;
204
289
  token: string;
205
290
  url?: string | undefined;
@@ -223,12 +308,12 @@ export declare function initAuth(config: InitAuthConfig): {
223
308
  token?: string | undefined;
224
309
  }> & Record<string, any>, Partial<{
225
310
  token?: string | undefined;
226
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
311
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
227
312
  newPassword: string;
228
313
  token?: string | undefined;
229
314
  } & {
230
315
  fetchOptions?: FetchOptions | undefined;
231
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
316
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
232
317
  status: boolean;
233
318
  }, {
234
319
  code?: string | undefined;
@@ -238,13 +323,13 @@ export declare function initAuth(config: InitAuthConfig): {
238
323
  verifyEmail: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
239
324
  token: string;
240
325
  callbackURL?: string | undefined;
241
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
326
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
242
327
  query: {
243
328
  token: string;
244
329
  callbackURL?: string | undefined;
245
330
  };
246
331
  fetchOptions?: FetchOptions | undefined;
247
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<void | {
332
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<NonNullable<void | {
248
333
  status: boolean;
249
334
  }>, {
250
335
  code?: string | undefined;
@@ -254,12 +339,12 @@ export declare function initAuth(config: InitAuthConfig): {
254
339
  sendVerificationEmail: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
255
340
  email: string;
256
341
  callbackURL?: string | undefined;
257
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
342
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
258
343
  email: string;
259
344
  callbackURL?: string | undefined;
260
345
  } & {
261
346
  fetchOptions?: FetchOptions | undefined;
262
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
347
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
263
348
  status: boolean;
264
349
  }, {
265
350
  code?: string | undefined;
@@ -269,12 +354,12 @@ export declare function initAuth(config: InitAuthConfig): {
269
354
  changeEmail: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
270
355
  newEmail: string;
271
356
  callbackURL?: string | undefined;
272
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
357
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
273
358
  newEmail: string;
274
359
  callbackURL?: string | undefined;
275
360
  } & {
276
361
  fetchOptions?: FetchOptions | undefined;
277
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
362
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
278
363
  status: boolean;
279
364
  }, {
280
365
  code?: string | undefined;
@@ -285,13 +370,13 @@ export declare function initAuth(config: InitAuthConfig): {
285
370
  newPassword: string;
286
371
  currentPassword: string;
287
372
  revokeOtherSessions?: boolean | undefined;
288
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
373
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
289
374
  newPassword: string;
290
375
  currentPassword: string;
291
376
  revokeOtherSessions?: boolean | undefined;
292
377
  } & {
293
378
  fetchOptions?: FetchOptions | undefined;
294
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
379
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
295
380
  token: string | null;
296
381
  user: {
297
382
  id: string;
@@ -309,12 +394,12 @@ export declare function initAuth(config: InitAuthConfig): {
309
394
  } & {
310
395
  updateUser: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}> & {
311
396
  name?: string | undefined;
312
- image?: string | undefined;
313
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
397
+ image?: string | undefined | null;
398
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
314
399
  image?: (string | null) | undefined;
315
400
  name?: string | undefined;
316
401
  fetchOptions?: FetchOptions | undefined;
317
- } & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
402
+ } & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
318
403
  status: boolean;
319
404
  }, {
320
405
  code?: string | undefined;
@@ -325,13 +410,13 @@ export declare function initAuth(config: InitAuthConfig): {
325
410
  callbackURL?: string | undefined;
326
411
  password?: string | undefined;
327
412
  token?: string | undefined;
328
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
413
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
329
414
  callbackURL?: string | undefined;
330
415
  password?: string | undefined;
331
416
  token?: string | undefined;
332
417
  } & {
333
418
  fetchOptions?: FetchOptions | undefined;
334
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
419
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
335
420
  success: boolean;
336
421
  message: string;
337
422
  }, {
@@ -342,12 +427,12 @@ export declare function initAuth(config: InitAuthConfig): {
342
427
  requestPasswordReset: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
343
428
  email: string;
344
429
  redirectTo?: string | undefined;
345
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
430
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
346
431
  email: string;
347
432
  redirectTo?: string | undefined;
348
433
  } & {
349
434
  fetchOptions?: FetchOptions | undefined;
350
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
435
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
351
436
  status: boolean;
352
437
  message: string;
353
438
  }, {
@@ -360,21 +445,21 @@ export declare function initAuth(config: InitAuthConfig): {
360
445
  callbackURL: string;
361
446
  }> & Record<string, any>, {
362
447
  token: string;
363
- }>>(data_0: import("better-auth/react").Prettify<{
448
+ }>>(data_0: import("better-auth").Prettify<{
364
449
  query: {
365
450
  callbackURL: string;
366
451
  };
367
452
  fetchOptions?: FetchOptions | undefined;
368
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<never, {
453
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<never, {
369
454
  code?: string | undefined;
370
455
  message?: string | undefined;
371
456
  }, FetchOptions["throw"] extends true ? true : false>>;
372
457
  };
373
458
  } & {
374
- listSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
459
+ listSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
375
460
  query?: Record<string, any> | undefined;
376
461
  fetchOptions?: FetchOptions | undefined;
377
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<import("better-auth/react").Prettify<{
462
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<import("better-auth").Prettify<{
378
463
  id: string;
379
464
  createdAt: Date;
380
465
  updatedAt: Date;
@@ -390,31 +475,31 @@ export declare function initAuth(config: InitAuthConfig): {
390
475
  } & {
391
476
  revokeSession: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
392
477
  token: string;
393
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
478
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
394
479
  token: string;
395
480
  } & {
396
481
  fetchOptions?: FetchOptions | undefined;
397
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
482
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
398
483
  status: boolean;
399
484
  }, {
400
485
  code?: string | undefined;
401
486
  message?: string | undefined;
402
487
  }, FetchOptions["throw"] extends true ? true : false>>;
403
488
  } & {
404
- revokeSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
489
+ revokeSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
405
490
  query?: Record<string, any> | undefined;
406
491
  fetchOptions?: FetchOptions | undefined;
407
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
492
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
408
493
  status: boolean;
409
494
  }, {
410
495
  code?: string | undefined;
411
496
  message?: string | undefined;
412
497
  }, FetchOptions["throw"] extends true ? true : false>>;
413
498
  } & {
414
- revokeOtherSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
499
+ revokeOtherSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
415
500
  query?: Record<string, any> | undefined;
416
501
  fetchOptions?: FetchOptions | undefined;
417
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
502
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
418
503
  status: boolean;
419
504
  }, {
420
505
  code?: string | undefined;
@@ -436,7 +521,7 @@ export declare function initAuth(config: InitAuthConfig): {
436
521
  errorCallbackURL?: string | undefined;
437
522
  disableRedirect?: boolean | undefined;
438
523
  additionalData?: Record<string, any> | undefined;
439
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
524
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
440
525
  provider: unknown;
441
526
  callbackURL?: string | undefined;
442
527
  idToken?: {
@@ -453,7 +538,7 @@ export declare function initAuth(config: InitAuthConfig): {
453
538
  additionalData?: Record<string, any> | undefined;
454
539
  } & {
455
540
  fetchOptions?: FetchOptions | undefined;
456
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
541
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
457
542
  url: string;
458
543
  redirect: boolean;
459
544
  }, {
@@ -461,10 +546,10 @@ export declare function initAuth(config: InitAuthConfig): {
461
546
  message?: string | undefined;
462
547
  }, FetchOptions["throw"] extends true ? true : false>>;
463
548
  } & {
464
- listAccounts: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
549
+ listAccounts: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
465
550
  query?: Record<string, any> | undefined;
466
551
  fetchOptions?: FetchOptions | undefined;
467
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
552
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
468
553
  id: string;
469
554
  providerId: string;
470
555
  createdAt: Date;
@@ -481,13 +566,13 @@ export declare function initAuth(config: InitAuthConfig): {
481
566
  callback: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
482
567
  token: string;
483
568
  callbackURL?: string | undefined;
484
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
569
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
485
570
  query: {
486
571
  token: string;
487
572
  callbackURL?: string | undefined;
488
573
  };
489
574
  fetchOptions?: FetchOptions | undefined;
490
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
575
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
491
576
  success: boolean;
492
577
  message: string;
493
578
  }, {
@@ -499,12 +584,12 @@ export declare function initAuth(config: InitAuthConfig): {
499
584
  unlinkAccount: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
500
585
  providerId: string;
501
586
  accountId?: string | undefined;
502
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
587
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
503
588
  providerId: string;
504
589
  accountId?: string | undefined;
505
590
  } & {
506
591
  fetchOptions?: FetchOptions | undefined;
507
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
592
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
508
593
  status: boolean;
509
594
  }, {
510
595
  code?: string | undefined;
@@ -515,13 +600,13 @@ export declare function initAuth(config: InitAuthConfig): {
515
600
  providerId: string;
516
601
  accountId?: string | undefined;
517
602
  userId?: string | undefined;
518
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
603
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
519
604
  providerId: string;
520
605
  accountId?: string | undefined;
521
606
  userId?: string | undefined;
522
607
  } & {
523
608
  fetchOptions?: FetchOptions | undefined;
524
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
609
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
525
610
  accessToken: string | undefined;
526
611
  refreshToken: string | undefined;
527
612
  accessTokenExpiresAt: Date | undefined;
@@ -539,13 +624,13 @@ export declare function initAuth(config: InitAuthConfig): {
539
624
  providerId: string;
540
625
  accountId?: string | undefined;
541
626
  userId?: string | undefined;
542
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
627
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
543
628
  providerId: string;
544
629
  accountId?: string | undefined;
545
630
  userId?: string | undefined;
546
631
  } & {
547
632
  fetchOptions?: FetchOptions | undefined;
548
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
633
+ }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
549
634
  accessToken: string;
550
635
  accessTokenExpiresAt: Date | undefined;
551
636
  scopes: string[];
@@ -557,12 +642,12 @@ export declare function initAuth(config: InitAuthConfig): {
557
642
  } & {
558
643
  accountInfo: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
559
644
  accountId?: string | undefined;
560
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
645
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
561
646
  query?: {
562
647
  accountId?: string | undefined;
563
648
  } | undefined;
564
649
  fetchOptions?: FetchOptions | undefined;
565
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
650
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
566
651
  user: import("better-auth").OAuth2UserInfo;
567
652
  data: Record<string, any>;
568
653
  }, {
@@ -573,13 +658,13 @@ export declare function initAuth(config: InitAuthConfig): {
573
658
  getSession: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
574
659
  disableCookieCache?: unknown;
575
660
  disableRefresh?: unknown;
576
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
661
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
577
662
  query?: {
578
663
  disableCookieCache?: unknown;
579
664
  disableRefresh?: unknown;
580
665
  } | undefined;
581
666
  fetchOptions?: FetchOptions | undefined;
582
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
667
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
583
668
  user: {
584
669
  id: string;
585
670
  createdAt: Date;
@@ -628,7 +713,7 @@ export declare function initAuth(config: InitAuthConfig): {
628
713
  } | null;
629
714
  isPending: boolean;
630
715
  isRefetching: boolean;
631
- error: import("@better-fetch/fetch").BetterFetchError | null;
716
+ error: import("better-auth/client").BetterFetchError | null;
632
717
  refetch: (queryParams?: {
633
718
  query?: import("better-auth").SessionQueryParams;
634
719
  } | undefined) => Promise<void>;
@@ -656,21 +741,21 @@ export declare function initAuth(config: InitAuthConfig): {
656
741
  };
657
742
  };
658
743
  };
659
- $fetch: import("@better-fetch/fetch").BetterFetch<{
660
- plugins: (import("@better-fetch/fetch").BetterFetchPlugin | {
744
+ $fetch: import("better-auth/client").BetterFetch<{
745
+ plugins: (import("better-auth/client").BetterFetchPlugin<Record<string, any>> | {
661
746
  id: string;
662
747
  name: string;
663
748
  hooks: {
664
- onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
749
+ onSuccess(context: import("better-auth/client").SuccessContext<any>): void;
665
750
  };
666
751
  } | {
667
752
  id: string;
668
753
  name: string;
669
754
  hooks: {
670
- onSuccess: ((context: import("@better-fetch/fetch").SuccessContext<any>) => Promise<void> | void) | undefined;
671
- onError: ((context: import("@better-fetch/fetch").ErrorContext) => Promise<void> | void) | undefined;
672
- onRequest: (<T extends Record<string, any>>(context: import("@better-fetch/fetch").RequestContext<T>) => Promise<import("@better-fetch/fetch").RequestContext | void> | import("@better-fetch/fetch").RequestContext | void) | undefined;
673
- onResponse: ((context: import("@better-fetch/fetch").ResponseContext) => Promise<Response | void | import("@better-fetch/fetch").ResponseContext> | Response | import("@better-fetch/fetch").ResponseContext | void) | undefined;
755
+ onSuccess: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
756
+ onError: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
757
+ onRequest: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
758
+ onResponse: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
674
759
  };
675
760
  })[];
676
761
  cache?: RequestCache | undefined;
@@ -690,12 +775,12 @@ export declare function initAuth(config: InitAuthConfig): {
690
775
  referrerPolicy?: ReferrerPolicy | undefined;
691
776
  signal?: (AbortSignal | null) | undefined;
692
777
  window?: null | undefined;
693
- onRetry?: ((response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void) | undefined;
778
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
694
779
  hookOptions?: {
695
780
  cloneResponse?: boolean;
696
781
  } | undefined;
697
782
  timeout?: number | undefined;
698
- customFetchImpl: import("@better-fetch/fetch").FetchEsque;
783
+ customFetchImpl: import("better-auth/client").FetchEsque;
699
784
  baseURL: string;
700
785
  throw?: boolean | undefined;
701
786
  auth?: ({
@@ -715,61 +800,76 @@ export declare function initAuth(config: InitAuthConfig): {
715
800
  params?: any;
716
801
  duplex?: "full" | "half" | undefined;
717
802
  jsonParser: (text: string) => Promise<any> | any;
718
- retry?: import("@better-fetch/fetch").RetryOptions | undefined;
803
+ retry?: import("better-auth/client").RetryOptions | undefined;
719
804
  retryAttempt?: number | undefined;
720
- output?: (import("@better-fetch/fetch").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
721
- errorSchema?: import("@better-fetch/fetch").StandardSchemaV1 | undefined;
805
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
806
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
722
807
  disableValidation?: boolean | undefined;
723
808
  disableSignal?: boolean | undefined;
724
809
  }, unknown, unknown, {}>;
725
810
  $store: {
726
811
  notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
727
812
  listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
728
- atoms: Record<string, import("nanostores").WritableAtom<any>>;
813
+ atoms: Record<string, import("better-auth/client").WritableAtom<any>>;
729
814
  };
730
815
  $ERROR_CODES: {
731
- [x: string]: any;
816
+ readonly USER_NOT_FOUND: "User not found";
817
+ readonly FAILED_TO_CREATE_USER: "Failed to create user";
818
+ readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
819
+ readonly FAILED_TO_UPDATE_USER: "Failed to update user";
820
+ readonly FAILED_TO_GET_SESSION: "Failed to get session";
821
+ readonly INVALID_PASSWORD: "Invalid password";
822
+ readonly INVALID_EMAIL: "Invalid email";
823
+ readonly INVALID_EMAIL_OR_PASSWORD: "Invalid email or password";
824
+ readonly SOCIAL_ACCOUNT_ALREADY_LINKED: "Social account already linked";
825
+ readonly PROVIDER_NOT_FOUND: "Provider not found";
826
+ readonly INVALID_TOKEN: "Invalid token";
827
+ readonly ID_TOKEN_NOT_SUPPORTED: "id_token not supported";
828
+ readonly FAILED_TO_GET_USER_INFO: "Failed to get user info";
829
+ readonly USER_EMAIL_NOT_FOUND: "User email not found";
830
+ readonly EMAIL_NOT_VERIFIED: "Email not verified";
831
+ readonly PASSWORD_TOO_SHORT: "Password too short";
832
+ readonly PASSWORD_TOO_LONG: "Password too long";
833
+ readonly USER_ALREADY_EXISTS: "User already exists.";
834
+ readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
835
+ readonly EMAIL_CAN_NOT_BE_UPDATED: "Email can not be updated";
836
+ readonly CREDENTIAL_ACCOUNT_NOT_FOUND: "Credential account not found";
837
+ readonly SESSION_EXPIRED: "Session expired. Re-authenticate to perform this action.";
838
+ readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
839
+ readonly ACCOUNT_NOT_FOUND: "Account not found";
840
+ readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
841
+ readonly CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.";
842
+ readonly VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled";
843
+ readonly EMAIL_ALREADY_VERIFIED: "Email is already verified";
844
+ readonly EMAIL_MISMATCH: "Email mismatch";
845
+ readonly SESSION_NOT_FRESH: "Session is not fresh";
846
+ readonly LINKED_ACCOUNT_ALREADY_EXISTS: "Linked account already exists";
847
+ readonly INVALID_ORIGIN: "Invalid origin";
848
+ readonly INVALID_CALLBACK_URL: "Invalid callbackURL";
849
+ readonly INVALID_REDIRECT_URL: "Invalid redirectURL";
850
+ readonly INVALID_ERROR_CALLBACK_URL: "Invalid errorCallbackURL";
851
+ readonly INVALID_NEW_USER_CALLBACK_URL: "Invalid newUserCallbackURL";
852
+ readonly MISSING_OR_NULL_ORIGIN: "Missing or null Origin";
853
+ readonly CALLBACK_URL_REQUIRED: "callbackURL is required";
854
+ readonly FAILED_TO_CREATE_VERIFICATION: "Unable to create verification";
855
+ readonly FIELD_NOT_ALLOWED: "Field not allowed to be set";
856
+ readonly ASYNC_VALIDATION_NOT_SUPPORTED: "Async validation is not supported";
857
+ readonly VALIDATION_ERROR: "Validation Error";
858
+ readonly MISSING_FIELD: "Field is required";
732
859
  };
733
860
  };
734
- authComputed: {
735
- isInitializing: import("@legendapp/state").ObservableBoolean;
736
- };
737
- authStore: import("@legendapp/state").Observable<import("./types").AuthState>;
738
- organizationApi: {
739
- create(request: import("./types").CreateOrganizationRequest): Promise<import("./types").Organization>;
740
- update(request: import("./types").UpdateOrganizationRequest): Promise<import("./types").Organization>;
741
- delete(request: import("./types").DeleteOrganizationRequest): Promise<string>;
742
- list(): Promise<import("./types").Organization[]>;
743
- getFullOrganization(): Promise<import("./types").FullOrganization | null>;
744
- setActive(request: import("./types").SetActiveOrganizationRequest): Promise<import("./types").Organization>;
745
- checkSlug(request: import("./types").CheckSlugRequest): Promise<boolean>;
746
- getActiveMember(): Promise<import("./types").Member | null>;
747
- getActiveMemberRole(): Promise<{
748
- role: string;
749
- } | null>;
750
- removeMember(request: import("./types").RemoveMemberRequest): Promise<import("./types").Member>;
751
- updateMemberRole(request: import("./types").UpdateMemberRoleRequest): Promise<import("./types").Member>;
752
- inviteMember(request: import("./types").InviteMemberRequest, inviteLink?: string): Promise<import("./types").Invitation>;
753
- listInvitations(): Promise<import("./types").Invitation[]>;
754
- getInvitation(invitationId: string): Promise<import("./types").InvitationDetail | null>;
755
- cancelInvitation(request: import("./types").CancelInvitationRequest): Promise<void>;
756
- acceptInvitation(request: import("./types").AcceptInvitationRequest): Promise<import("./types").InvitationResponse>;
757
- rejectInvitation(request: import("./types").RejectInvitationRequest): Promise<import("./types").InvitationResponse>;
758
- leave(organizationId: string): Promise<void>;
759
- };
760
- teamApi: {
761
- create(request: import("./types").CreateTeamRequest): Promise<import("./types").Team>;
762
- list(): Promise<import("./types").Team[]>;
763
- update(request: import("./types").UpdateTeamRequest): Promise<import("./types").Team>;
764
- delete(request: import("./types").DeleteTeamRequest): Promise<void>;
765
- setActive(request: import("./types").SetActiveTeamRequest): Promise<void>;
766
- listUserTeams(): Promise<import("./types").Team[]>;
767
- listMembers(teamId: string): Promise<import("./types").TeamMember[]>;
768
- addMember(request: import("./types").AddTeamMemberRequest): Promise<import("./types").TeamMember>;
769
- removeMember(request: import("./types").RemoveTeamMemberRequest): Promise<void>;
770
- leaveTeam(teamId: string): Promise<void>;
861
+ getCurrentUser: () => import("./types").SessionUser | null;
862
+ getCurrentUserId: () => string | null;
863
+ isAuthenticated: () => boolean;
864
+ isLoading: () => boolean;
865
+ isLoaded: () => boolean;
866
+ getAuthToken: () => string | null;
867
+ getAuthHeaders: () => Record<string, string>;
868
+ waitForAuth: () => Promise<void>;
869
+ userManager: {
870
+ getUser: () => import("./types").SessionUser | null;
871
+ getUserId: () => string | null;
771
872
  };
772
- tokenStorage: import("./api").TokenStorage;
773
873
  };
774
874
  export {};
775
875
  //# sourceMappingURL=init.d.ts.map