@payez/next-mvp 3.8.1 → 3.9.0

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.
@@ -33,6 +33,7 @@ export declare function buildBetterAuthProviders(config: IDPClientConfig): Recor
33
33
  export declare function createBetterAuthInstance(idpConfig: IDPClientConfig): import("better-auth").Auth<{
34
34
  secret: string;
35
35
  socialProviders: Record<string, BetterAuthSocialProvider>;
36
+ trustedOrigins: string[];
36
37
  session: {
37
38
  cookieCache: {
38
39
  enabled: true;
@@ -48,6 +48,14 @@ function createBetterAuthInstance(idpConfig) {
48
48
  return (0, better_auth_1.betterAuth)({
49
49
  secret: idpConfig.nextAuthSecret,
50
50
  socialProviders: buildBetterAuthProviders(idpConfig),
51
+ // Trust the app's own origin + any configured base URL
52
+ trustedOrigins: [
53
+ ...(idpConfig.baseClientUrl ? [idpConfig.baseClientUrl] : []),
54
+ ...(process.env.BETTER_AUTH_URL ? [process.env.BETTER_AUTH_URL] : []),
55
+ 'http://localhost:3000',
56
+ 'http://localhost:3400',
57
+ 'http://localhost:3600',
58
+ ],
51
59
  // No database — stateless mode. Better Auth defaults to JWE cookie cache.
52
60
  // Session cookie cache with refreshCache for DB-less setup.
53
61
  session: {
@@ -0,0 +1,961 @@
1
+ /**
2
+ * Better Auth Client (Phase 3)
3
+ *
4
+ * Drop-in replacement for next-auth/react hooks and functions.
5
+ * Import from '@payez/next-mvp/client/better-auth-client'.
6
+ *
7
+ * Migration map:
8
+ * useSession() → authClient.useSession()
9
+ * signIn('google') → authClient.signIn.social({ provider: 'google' })
10
+ * signIn('credentials', {...}) → authClient.signIn.email({...})
11
+ * signOut() → authClient.signOut()
12
+ */
13
+ export declare const authClient: {
14
+ signIn: {
15
+ social: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
16
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
17
+ callbackURL?: string | undefined;
18
+ newUserCallbackURL?: string | undefined;
19
+ errorCallbackURL?: string | undefined;
20
+ disableRedirect?: boolean | undefined;
21
+ idToken?: {
22
+ token: string;
23
+ nonce?: string | undefined;
24
+ accessToken?: string | undefined;
25
+ refreshToken?: string | undefined;
26
+ expiresAt?: number | undefined;
27
+ user?: {
28
+ name?: {
29
+ firstName?: string | undefined;
30
+ lastName?: string | undefined;
31
+ } | undefined;
32
+ email?: string | undefined;
33
+ } | undefined;
34
+ } | undefined;
35
+ scopes?: string[] | undefined;
36
+ requestSignUp?: boolean | undefined;
37
+ loginHint?: string | undefined;
38
+ additionalData?: Record<string, any> | undefined;
39
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
40
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
41
+ callbackURL?: string | undefined;
42
+ newUserCallbackURL?: string | undefined;
43
+ errorCallbackURL?: string | undefined;
44
+ disableRedirect?: boolean | undefined;
45
+ idToken?: {
46
+ token: string;
47
+ nonce?: string | undefined;
48
+ accessToken?: string | undefined;
49
+ refreshToken?: string | undefined;
50
+ expiresAt?: number | undefined;
51
+ user?: {
52
+ name?: {
53
+ firstName?: string | undefined;
54
+ lastName?: string | undefined;
55
+ } | undefined;
56
+ email?: string | undefined;
57
+ } | undefined;
58
+ } | undefined;
59
+ scopes?: string[] | undefined;
60
+ requestSignUp?: boolean | undefined;
61
+ loginHint?: string | undefined;
62
+ additionalData?: Record<string, any> | undefined;
63
+ } & {
64
+ fetchOptions?: FetchOptions | undefined;
65
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
66
+ redirect: boolean;
67
+ url: string;
68
+ } | (Omit<{
69
+ redirect: boolean;
70
+ token: string;
71
+ url: undefined;
72
+ user: {
73
+ id: string;
74
+ createdAt: Date;
75
+ updatedAt: Date;
76
+ email: string;
77
+ emailVerified: boolean;
78
+ name: string;
79
+ image?: string | null | undefined | undefined;
80
+ };
81
+ }, "user"> & {
82
+ user: import("better-auth/react").StripEmptyObjects<{
83
+ id: string;
84
+ createdAt: Date;
85
+ updatedAt: Date;
86
+ email: string;
87
+ emailVerified: boolean;
88
+ name: string;
89
+ image?: string | null | undefined;
90
+ }>;
91
+ }), {
92
+ code?: string | undefined;
93
+ message?: string | undefined;
94
+ }, FetchOptions["throw"] extends true ? true : false>>;
95
+ };
96
+ } & {
97
+ signOut: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
98
+ query?: Record<string, any> | undefined;
99
+ fetchOptions?: FetchOptions | undefined;
100
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
101
+ success: boolean;
102
+ }, {
103
+ code?: string | undefined;
104
+ message?: string | undefined;
105
+ }, FetchOptions["throw"] extends true ? true : false>>;
106
+ } & {
107
+ signUp: {
108
+ email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
109
+ name: string;
110
+ email: string;
111
+ password: string;
112
+ image?: string | undefined;
113
+ callbackURL?: string | undefined;
114
+ rememberMe?: boolean | undefined;
115
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
116
+ email: string;
117
+ name: string;
118
+ password: string;
119
+ image?: string | undefined;
120
+ callbackURL?: string | undefined;
121
+ fetchOptions?: FetchOptions | undefined;
122
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<(Omit<{
123
+ token: null;
124
+ user: {
125
+ id: string;
126
+ createdAt: Date;
127
+ updatedAt: Date;
128
+ email: string;
129
+ emailVerified: boolean;
130
+ name: string;
131
+ image?: string | null | undefined | undefined;
132
+ };
133
+ }, "user"> & {
134
+ user: import("better-auth/react").StripEmptyObjects<{
135
+ id: string;
136
+ createdAt: Date;
137
+ updatedAt: Date;
138
+ email: string;
139
+ emailVerified: boolean;
140
+ name: string;
141
+ image?: string | null | undefined;
142
+ }>;
143
+ }) | (Omit<{
144
+ token: string;
145
+ user: {
146
+ id: string;
147
+ createdAt: Date;
148
+ updatedAt: Date;
149
+ email: string;
150
+ emailVerified: boolean;
151
+ name: string;
152
+ image?: string | null | undefined | undefined;
153
+ };
154
+ }, "user"> & {
155
+ user: import("better-auth/react").StripEmptyObjects<{
156
+ id: string;
157
+ createdAt: Date;
158
+ updatedAt: Date;
159
+ email: string;
160
+ emailVerified: boolean;
161
+ name: string;
162
+ image?: string | null | undefined;
163
+ }>;
164
+ }), {
165
+ code?: string | undefined;
166
+ message?: string | undefined;
167
+ }, FetchOptions["throw"] extends true ? true : false>>;
168
+ };
169
+ } & {
170
+ signIn: {
171
+ email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
172
+ email: string;
173
+ password: string;
174
+ callbackURL?: string | undefined;
175
+ rememberMe?: boolean | undefined;
176
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
177
+ email: string;
178
+ password: string;
179
+ callbackURL?: string | undefined;
180
+ rememberMe?: boolean | undefined;
181
+ } & {
182
+ fetchOptions?: FetchOptions | undefined;
183
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<Omit<{
184
+ redirect: boolean;
185
+ token: string;
186
+ url?: string | undefined;
187
+ user: {
188
+ id: string;
189
+ createdAt: Date;
190
+ updatedAt: Date;
191
+ email: string;
192
+ emailVerified: boolean;
193
+ name: string;
194
+ image?: string | null | undefined | undefined;
195
+ };
196
+ }, "user"> & {
197
+ user: import("better-auth/react").StripEmptyObjects<{
198
+ id: string;
199
+ createdAt: Date;
200
+ updatedAt: Date;
201
+ email: string;
202
+ emailVerified: boolean;
203
+ name: string;
204
+ image?: string | null | undefined;
205
+ }>;
206
+ }, {
207
+ code?: string | undefined;
208
+ message?: string | undefined;
209
+ }, FetchOptions["throw"] extends true ? true : false>>;
210
+ };
211
+ } & {
212
+ resetPassword: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
213
+ newPassword: string;
214
+ token?: string | undefined;
215
+ }> & Record<string, any>, Partial<{
216
+ token?: string | undefined;
217
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
218
+ newPassword: string;
219
+ token?: string | undefined;
220
+ } & {
221
+ fetchOptions?: FetchOptions | undefined;
222
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
223
+ status: boolean;
224
+ }, {
225
+ code?: string | undefined;
226
+ message?: string | undefined;
227
+ }, FetchOptions["throw"] extends true ? true : false>>;
228
+ } & {
229
+ verifyEmail: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<{
230
+ token: string;
231
+ callbackURL?: string | undefined;
232
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
233
+ query: {
234
+ token: string;
235
+ callbackURL?: string | undefined;
236
+ };
237
+ fetchOptions?: FetchOptions | undefined;
238
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<void | {
239
+ status: boolean;
240
+ }>, {
241
+ code?: string | undefined;
242
+ message?: string | undefined;
243
+ }, FetchOptions["throw"] extends true ? true : false>>;
244
+ } & {
245
+ sendVerificationEmail: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
246
+ email: string;
247
+ callbackURL?: string | undefined;
248
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
249
+ email: string;
250
+ callbackURL?: string | undefined;
251
+ } & {
252
+ fetchOptions?: FetchOptions | undefined;
253
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
254
+ status: boolean;
255
+ }, {
256
+ code?: string | undefined;
257
+ message?: string | undefined;
258
+ }, FetchOptions["throw"] extends true ? true : false>>;
259
+ } & {
260
+ changeEmail: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
261
+ newEmail: string;
262
+ callbackURL?: string | undefined;
263
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
264
+ newEmail: string;
265
+ callbackURL?: string | undefined;
266
+ } & {
267
+ fetchOptions?: FetchOptions | undefined;
268
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
269
+ status: boolean;
270
+ }, {
271
+ code?: string | undefined;
272
+ message?: string | undefined;
273
+ }, FetchOptions["throw"] extends true ? true : false>>;
274
+ } & {
275
+ changePassword: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
276
+ newPassword: string;
277
+ currentPassword: string;
278
+ revokeOtherSessions?: boolean | undefined;
279
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
280
+ newPassword: string;
281
+ currentPassword: string;
282
+ revokeOtherSessions?: boolean | undefined;
283
+ } & {
284
+ fetchOptions?: FetchOptions | undefined;
285
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<Omit<{
286
+ token: string | null;
287
+ user: {
288
+ id: string;
289
+ createdAt: Date;
290
+ updatedAt: Date;
291
+ email: string;
292
+ emailVerified: boolean;
293
+ name: string;
294
+ image?: string | null | undefined;
295
+ } & Record<string, any> & {
296
+ id: string;
297
+ createdAt: Date;
298
+ updatedAt: Date;
299
+ email: string;
300
+ emailVerified: boolean;
301
+ name: string;
302
+ image?: string | null | undefined;
303
+ };
304
+ }, "user"> & {
305
+ user: import("better-auth/react").StripEmptyObjects<{
306
+ id: string;
307
+ createdAt: Date;
308
+ updatedAt: Date;
309
+ email: string;
310
+ emailVerified: boolean;
311
+ name: string;
312
+ image?: string | null | undefined;
313
+ }>;
314
+ }, {
315
+ code?: string | undefined;
316
+ message?: string | undefined;
317
+ }, FetchOptions["throw"] extends true ? true : false>>;
318
+ } & {
319
+ updateSession: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<Partial<{}> & {
320
+ fetchOptions?: FetchOptions | undefined;
321
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
322
+ session: {
323
+ id: string;
324
+ createdAt: Date;
325
+ updatedAt: Date;
326
+ userId: string;
327
+ expiresAt: Date;
328
+ token: string;
329
+ ipAddress?: string | null | undefined;
330
+ userAgent?: string | null | undefined;
331
+ };
332
+ }, {
333
+ code?: string | undefined;
334
+ message?: string | undefined;
335
+ }, FetchOptions["throw"] extends true ? true : false>>;
336
+ } & {
337
+ updateUser: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<Partial<{}> & {
338
+ name?: string | undefined;
339
+ image?: string | undefined | null;
340
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<import("better-auth/dist/client/path-to-object.mjs").InferUserUpdateCtx<{}, FetchOptions>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
341
+ status: boolean;
342
+ }, {
343
+ code?: string | undefined;
344
+ message?: string | undefined;
345
+ }, FetchOptions["throw"] extends true ? true : false>>;
346
+ } & {
347
+ deleteUser: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
348
+ callbackURL?: string | undefined;
349
+ password?: string | undefined;
350
+ token?: string | undefined;
351
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
352
+ callbackURL?: string | undefined;
353
+ password?: string | undefined;
354
+ token?: string | undefined;
355
+ } & {
356
+ fetchOptions?: FetchOptions | undefined;
357
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
358
+ success: boolean;
359
+ message: string;
360
+ }, {
361
+ code?: string | undefined;
362
+ message?: string | undefined;
363
+ }, FetchOptions["throw"] extends true ? true : false>>;
364
+ } & {
365
+ requestPasswordReset: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
366
+ email: string;
367
+ redirectTo?: string | undefined;
368
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
369
+ email: string;
370
+ redirectTo?: string | undefined;
371
+ } & {
372
+ fetchOptions?: FetchOptions | undefined;
373
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
374
+ status: boolean;
375
+ message: string;
376
+ }, {
377
+ code?: string | undefined;
378
+ message?: string | undefined;
379
+ }, FetchOptions["throw"] extends true ? true : false>>;
380
+ } & {
381
+ resetPassword: {
382
+ ":token": <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<{
383
+ callbackURL: string;
384
+ }> & Record<string, any>, {
385
+ token: string;
386
+ }>>(data_0: import("better-auth/react").Prettify<{
387
+ query: {
388
+ callbackURL: string;
389
+ };
390
+ fetchOptions?: FetchOptions | undefined;
391
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<never, {
392
+ code?: string | undefined;
393
+ message?: string | undefined;
394
+ }, FetchOptions["throw"] extends true ? true : false>>;
395
+ };
396
+ } & {
397
+ listSessions: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
398
+ query?: Record<string, any> | undefined;
399
+ fetchOptions?: FetchOptions | undefined;
400
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<import("better-auth/react").Prettify<{
401
+ id: string;
402
+ createdAt: Date;
403
+ updatedAt: Date;
404
+ userId: string;
405
+ expiresAt: Date;
406
+ token: string;
407
+ ipAddress?: string | null | undefined | undefined;
408
+ userAgent?: string | null | undefined | undefined;
409
+ }>[], {
410
+ code?: string | undefined;
411
+ message?: string | undefined;
412
+ }, FetchOptions["throw"] extends true ? true : false>>;
413
+ } & {
414
+ revokeSession: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
415
+ token: string;
416
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
417
+ token: string;
418
+ } & {
419
+ fetchOptions?: FetchOptions | undefined;
420
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
421
+ status: boolean;
422
+ }, {
423
+ code?: string | undefined;
424
+ message?: string | undefined;
425
+ }, FetchOptions["throw"] extends true ? true : false>>;
426
+ } & {
427
+ revokeSessions: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
428
+ query?: Record<string, any> | undefined;
429
+ fetchOptions?: FetchOptions | undefined;
430
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
431
+ status: boolean;
432
+ }, {
433
+ code?: string | undefined;
434
+ message?: string | undefined;
435
+ }, FetchOptions["throw"] extends true ? true : false>>;
436
+ } & {
437
+ revokeOtherSessions: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
438
+ query?: Record<string, any> | undefined;
439
+ fetchOptions?: FetchOptions | undefined;
440
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
441
+ status: boolean;
442
+ }, {
443
+ code?: string | undefined;
444
+ message?: string | undefined;
445
+ }, FetchOptions["throw"] extends true ? true : false>>;
446
+ } & {
447
+ linkSocial: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
448
+ provider: unknown;
449
+ callbackURL?: string | undefined;
450
+ idToken?: {
451
+ token: string;
452
+ nonce?: string | undefined;
453
+ accessToken?: string | undefined;
454
+ refreshToken?: string | undefined;
455
+ scopes?: string[] | undefined;
456
+ } | undefined;
457
+ requestSignUp?: boolean | undefined;
458
+ scopes?: string[] | undefined;
459
+ errorCallbackURL?: string | undefined;
460
+ disableRedirect?: boolean | undefined;
461
+ additionalData?: Record<string, any> | undefined;
462
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
463
+ provider: unknown;
464
+ callbackURL?: string | undefined;
465
+ idToken?: {
466
+ token: string;
467
+ nonce?: string | undefined;
468
+ accessToken?: string | undefined;
469
+ refreshToken?: string | undefined;
470
+ scopes?: string[] | undefined;
471
+ } | undefined;
472
+ requestSignUp?: boolean | undefined;
473
+ scopes?: string[] | undefined;
474
+ errorCallbackURL?: string | undefined;
475
+ disableRedirect?: boolean | undefined;
476
+ additionalData?: Record<string, any> | undefined;
477
+ } & {
478
+ fetchOptions?: FetchOptions | undefined;
479
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
480
+ url: string;
481
+ redirect: boolean;
482
+ }, {
483
+ code?: string | undefined;
484
+ message?: string | undefined;
485
+ }, FetchOptions["throw"] extends true ? true : false>>;
486
+ } & {
487
+ listAccounts: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
488
+ query?: Record<string, any> | undefined;
489
+ fetchOptions?: FetchOptions | undefined;
490
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
491
+ scopes: string[];
492
+ id: string;
493
+ createdAt: Date;
494
+ updatedAt: Date;
495
+ userId: string;
496
+ providerId: string;
497
+ accountId: string;
498
+ }[], {
499
+ code?: string | undefined;
500
+ message?: string | undefined;
501
+ }, FetchOptions["throw"] extends true ? true : false>>;
502
+ } & {
503
+ deleteUser: {
504
+ callback: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<{
505
+ token: string;
506
+ callbackURL?: string | undefined;
507
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
508
+ query: {
509
+ token: string;
510
+ callbackURL?: string | undefined;
511
+ };
512
+ fetchOptions?: FetchOptions | undefined;
513
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
514
+ success: boolean;
515
+ message: string;
516
+ }, {
517
+ code?: string | undefined;
518
+ message?: string | undefined;
519
+ }, FetchOptions["throw"] extends true ? true : false>>;
520
+ };
521
+ } & {
522
+ unlinkAccount: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
523
+ providerId: string;
524
+ accountId?: string | undefined;
525
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
526
+ providerId: string;
527
+ accountId?: string | undefined;
528
+ } & {
529
+ fetchOptions?: FetchOptions | undefined;
530
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
531
+ status: boolean;
532
+ }, {
533
+ code?: string | undefined;
534
+ message?: string | undefined;
535
+ }, FetchOptions["throw"] extends true ? true : false>>;
536
+ } & {
537
+ refreshToken: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
538
+ providerId: string;
539
+ accountId?: string | undefined;
540
+ userId?: string | undefined;
541
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
542
+ providerId: string;
543
+ accountId?: string | undefined;
544
+ userId?: string | undefined;
545
+ } & {
546
+ fetchOptions?: FetchOptions | undefined;
547
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
548
+ accessToken: string | undefined;
549
+ refreshToken: string;
550
+ accessTokenExpiresAt: Date | undefined;
551
+ refreshTokenExpiresAt: Date | null | undefined;
552
+ scope: string | null | undefined;
553
+ idToken: string | null | undefined;
554
+ providerId: string;
555
+ accountId: string;
556
+ }, {
557
+ code?: string | undefined;
558
+ message?: string | undefined;
559
+ }, FetchOptions["throw"] extends true ? true : false>>;
560
+ } & {
561
+ getAccessToken: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
562
+ providerId: string;
563
+ accountId?: string | undefined;
564
+ userId?: string | undefined;
565
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
566
+ providerId: string;
567
+ accountId?: string | undefined;
568
+ userId?: string | undefined;
569
+ } & {
570
+ fetchOptions?: FetchOptions | undefined;
571
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
572
+ accessToken: string;
573
+ accessTokenExpiresAt: Date | undefined;
574
+ scopes: string[];
575
+ idToken: string | undefined;
576
+ }, {
577
+ code?: string | undefined;
578
+ message?: string | undefined;
579
+ }, FetchOptions["throw"] extends true ? true : false>>;
580
+ } & {
581
+ accountInfo: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<{
582
+ accountId?: string | undefined;
583
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
584
+ query?: {
585
+ accountId?: string | undefined;
586
+ } | undefined;
587
+ fetchOptions?: FetchOptions | undefined;
588
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
589
+ user: import("better-auth/*").OAuth2UserInfo;
590
+ data: Record<string, any>;
591
+ }, {
592
+ code?: string | undefined;
593
+ message?: string | undefined;
594
+ }, FetchOptions["throw"] extends true ? true : false>>;
595
+ } & {
596
+ getSession: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<{
597
+ disableCookieCache?: unknown;
598
+ disableRefresh?: unknown;
599
+ }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
600
+ query?: {
601
+ disableCookieCache?: unknown;
602
+ disableRefresh?: unknown;
603
+ } | undefined;
604
+ fetchOptions?: FetchOptions | undefined;
605
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
606
+ user: import("better-auth/react").StripEmptyObjects<{
607
+ id: string;
608
+ createdAt: Date;
609
+ updatedAt: Date;
610
+ email: string;
611
+ emailVerified: boolean;
612
+ name: string;
613
+ image?: string | null | undefined;
614
+ }>;
615
+ session: import("better-auth/react").StripEmptyObjects<{
616
+ id: string;
617
+ createdAt: Date;
618
+ updatedAt: Date;
619
+ userId: string;
620
+ expiresAt: Date;
621
+ token: string;
622
+ ipAddress?: string | null | undefined;
623
+ userAgent?: string | null | undefined;
624
+ }>;
625
+ } | null, {
626
+ code?: string | undefined;
627
+ message?: string | undefined;
628
+ }, FetchOptions["throw"] extends true ? true : false>>;
629
+ } & {
630
+ useSession: () => {
631
+ data: {
632
+ user: import("better-auth/react").StripEmptyObjects<{
633
+ id: string;
634
+ createdAt: Date;
635
+ updatedAt: Date;
636
+ email: string;
637
+ emailVerified: boolean;
638
+ name: string;
639
+ image?: string | null | undefined;
640
+ }>;
641
+ session: import("better-auth/react").StripEmptyObjects<{
642
+ id: string;
643
+ createdAt: Date;
644
+ updatedAt: Date;
645
+ userId: string;
646
+ expiresAt: Date;
647
+ token: string;
648
+ ipAddress?: string | null | undefined;
649
+ userAgent?: string | null | undefined;
650
+ }>;
651
+ } | null;
652
+ isPending: boolean;
653
+ isRefetching: boolean;
654
+ error: import("@better-fetch/fetch").BetterFetchError | null;
655
+ refetch: (queryParams?: {
656
+ query?: import("better-auth/types").SessionQueryParams;
657
+ } | undefined) => Promise<void>;
658
+ };
659
+ $Infer: {
660
+ Session: {
661
+ user: import("better-auth/react").StripEmptyObjects<{
662
+ id: string;
663
+ createdAt: Date;
664
+ updatedAt: Date;
665
+ email: string;
666
+ emailVerified: boolean;
667
+ name: string;
668
+ image?: string | null | undefined;
669
+ }>;
670
+ session: import("better-auth/react").StripEmptyObjects<{
671
+ id: string;
672
+ createdAt: Date;
673
+ updatedAt: Date;
674
+ userId: string;
675
+ expiresAt: Date;
676
+ token: string;
677
+ ipAddress?: string | null | undefined;
678
+ userAgent?: string | null | undefined;
679
+ }>;
680
+ };
681
+ };
682
+ $fetch: import("@better-fetch/fetch").BetterFetch<{
683
+ plugins: (import("@better-fetch/fetch").BetterFetchPlugin<Record<string, any>> | {
684
+ id: string;
685
+ name: string;
686
+ hooks: {
687
+ onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
688
+ };
689
+ } | {
690
+ id: string;
691
+ name: string;
692
+ hooks: {
693
+ onSuccess: ((context: import("@better-fetch/fetch").SuccessContext<any>) => Promise<void> | void) | undefined;
694
+ onError: ((context: import("@better-fetch/fetch").ErrorContext) => Promise<void> | void) | undefined;
695
+ 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;
696
+ onResponse: ((context: import("@better-fetch/fetch").ResponseContext) => Promise<Response | void | import("@better-fetch/fetch").ResponseContext> | Response | import("@better-fetch/fetch").ResponseContext | void) | undefined;
697
+ };
698
+ })[];
699
+ cache?: RequestCache | undefined;
700
+ priority?: RequestPriority | undefined;
701
+ credentials?: RequestCredentials;
702
+ headers?: (HeadersInit & (HeadersInit | {
703
+ accept: "application/json" | "text/plain" | "application/octet-stream";
704
+ "content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
705
+ authorization: "Bearer" | "Basic";
706
+ })) | undefined;
707
+ integrity?: string | undefined;
708
+ keepalive?: boolean | undefined;
709
+ method: string;
710
+ mode?: RequestMode | undefined;
711
+ redirect?: RequestRedirect | undefined;
712
+ referrer?: string | undefined;
713
+ referrerPolicy?: ReferrerPolicy | undefined;
714
+ signal?: (AbortSignal | null) | undefined;
715
+ window?: null | undefined;
716
+ onRetry?: ((response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void) | undefined;
717
+ hookOptions?: {
718
+ cloneResponse?: boolean;
719
+ } | undefined;
720
+ timeout?: number | undefined;
721
+ customFetchImpl: import("@better-fetch/fetch").FetchEsque;
722
+ baseURL: string;
723
+ throw?: boolean | undefined;
724
+ auth?: ({
725
+ type: "Bearer";
726
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
727
+ } | {
728
+ type: "Basic";
729
+ username: string | (() => string | undefined) | undefined;
730
+ password: string | (() => string | undefined) | undefined;
731
+ } | {
732
+ type: "Custom";
733
+ prefix: string | (() => string | undefined) | undefined;
734
+ value: string | (() => string | undefined) | undefined;
735
+ }) | undefined;
736
+ body?: any;
737
+ query?: any;
738
+ params?: any;
739
+ duplex?: "full" | "half" | undefined;
740
+ jsonParser: (text: string) => Promise<any> | any;
741
+ retry?: import("@better-fetch/fetch").RetryOptions | undefined;
742
+ retryAttempt?: number | undefined;
743
+ output?: (import("@better-fetch/fetch").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
744
+ errorSchema?: import("@better-fetch/fetch").StandardSchemaV1 | undefined;
745
+ disableValidation?: boolean | undefined;
746
+ disableSignal?: boolean | undefined;
747
+ }, unknown, unknown, {}>;
748
+ $store: {
749
+ notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
750
+ listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
751
+ atoms: Record<string, import("nanostores/atom").WritableAtom<any>>;
752
+ };
753
+ $ERROR_CODES: {
754
+ USER_NOT_FOUND: import("better-auth/*").RawError<"USER_NOT_FOUND">;
755
+ FAILED_TO_CREATE_USER: import("better-auth/*").RawError<"FAILED_TO_CREATE_USER">;
756
+ FAILED_TO_CREATE_SESSION: import("better-auth/*").RawError<"FAILED_TO_CREATE_SESSION">;
757
+ FAILED_TO_UPDATE_USER: import("better-auth/*").RawError<"FAILED_TO_UPDATE_USER">;
758
+ FAILED_TO_GET_SESSION: import("better-auth/*").RawError<"FAILED_TO_GET_SESSION">;
759
+ INVALID_PASSWORD: import("better-auth/*").RawError<"INVALID_PASSWORD">;
760
+ INVALID_EMAIL: import("better-auth/*").RawError<"INVALID_EMAIL">;
761
+ INVALID_EMAIL_OR_PASSWORD: import("better-auth/*").RawError<"INVALID_EMAIL_OR_PASSWORD">;
762
+ INVALID_USER: import("better-auth/*").RawError<"INVALID_USER">;
763
+ SOCIAL_ACCOUNT_ALREADY_LINKED: import("better-auth/*").RawError<"SOCIAL_ACCOUNT_ALREADY_LINKED">;
764
+ PROVIDER_NOT_FOUND: import("better-auth/*").RawError<"PROVIDER_NOT_FOUND">;
765
+ INVALID_TOKEN: import("better-auth/*").RawError<"INVALID_TOKEN">;
766
+ TOKEN_EXPIRED: import("better-auth/*").RawError<"TOKEN_EXPIRED">;
767
+ ID_TOKEN_NOT_SUPPORTED: import("better-auth/*").RawError<"ID_TOKEN_NOT_SUPPORTED">;
768
+ FAILED_TO_GET_USER_INFO: import("better-auth/*").RawError<"FAILED_TO_GET_USER_INFO">;
769
+ USER_EMAIL_NOT_FOUND: import("better-auth/*").RawError<"USER_EMAIL_NOT_FOUND">;
770
+ EMAIL_NOT_VERIFIED: import("better-auth/*").RawError<"EMAIL_NOT_VERIFIED">;
771
+ PASSWORD_TOO_SHORT: import("better-auth/*").RawError<"PASSWORD_TOO_SHORT">;
772
+ PASSWORD_TOO_LONG: import("better-auth/*").RawError<"PASSWORD_TOO_LONG">;
773
+ USER_ALREADY_EXISTS: import("better-auth/*").RawError<"USER_ALREADY_EXISTS">;
774
+ USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: import("better-auth/*").RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
775
+ EMAIL_CAN_NOT_BE_UPDATED: import("better-auth/*").RawError<"EMAIL_CAN_NOT_BE_UPDATED">;
776
+ CREDENTIAL_ACCOUNT_NOT_FOUND: import("better-auth/*").RawError<"CREDENTIAL_ACCOUNT_NOT_FOUND">;
777
+ ACCOUNT_NOT_FOUND: import("better-auth/*").RawError<"ACCOUNT_NOT_FOUND">;
778
+ SESSION_EXPIRED: import("better-auth/*").RawError<"SESSION_EXPIRED">;
779
+ FAILED_TO_UNLINK_LAST_ACCOUNT: import("better-auth/*").RawError<"FAILED_TO_UNLINK_LAST_ACCOUNT">;
780
+ USER_ALREADY_HAS_PASSWORD: import("better-auth/*").RawError<"USER_ALREADY_HAS_PASSWORD">;
781
+ CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: import("better-auth/*").RawError<"CROSS_SITE_NAVIGATION_LOGIN_BLOCKED">;
782
+ VERIFICATION_EMAIL_NOT_ENABLED: import("better-auth/*").RawError<"VERIFICATION_EMAIL_NOT_ENABLED">;
783
+ EMAIL_ALREADY_VERIFIED: import("better-auth/*").RawError<"EMAIL_ALREADY_VERIFIED">;
784
+ EMAIL_MISMATCH: import("better-auth/*").RawError<"EMAIL_MISMATCH">;
785
+ SESSION_NOT_FRESH: import("better-auth/*").RawError<"SESSION_NOT_FRESH">;
786
+ LINKED_ACCOUNT_ALREADY_EXISTS: import("better-auth/*").RawError<"LINKED_ACCOUNT_ALREADY_EXISTS">;
787
+ INVALID_ORIGIN: import("better-auth/*").RawError<"INVALID_ORIGIN">;
788
+ INVALID_CALLBACK_URL: import("better-auth/*").RawError<"INVALID_CALLBACK_URL">;
789
+ INVALID_REDIRECT_URL: import("better-auth/*").RawError<"INVALID_REDIRECT_URL">;
790
+ INVALID_ERROR_CALLBACK_URL: import("better-auth/*").RawError<"INVALID_ERROR_CALLBACK_URL">;
791
+ INVALID_NEW_USER_CALLBACK_URL: import("better-auth/*").RawError<"INVALID_NEW_USER_CALLBACK_URL">;
792
+ MISSING_OR_NULL_ORIGIN: import("better-auth/*").RawError<"MISSING_OR_NULL_ORIGIN">;
793
+ CALLBACK_URL_REQUIRED: import("better-auth/*").RawError<"CALLBACK_URL_REQUIRED">;
794
+ FAILED_TO_CREATE_VERIFICATION: import("better-auth/*").RawError<"FAILED_TO_CREATE_VERIFICATION">;
795
+ FIELD_NOT_ALLOWED: import("better-auth/*").RawError<"FIELD_NOT_ALLOWED">;
796
+ ASYNC_VALIDATION_NOT_SUPPORTED: import("better-auth/*").RawError<"ASYNC_VALIDATION_NOT_SUPPORTED">;
797
+ VALIDATION_ERROR: import("better-auth/*").RawError<"VALIDATION_ERROR">;
798
+ MISSING_FIELD: import("better-auth/*").RawError<"MISSING_FIELD">;
799
+ METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED: import("better-auth/*").RawError<"METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED">;
800
+ BODY_MUST_BE_AN_OBJECT: import("better-auth/*").RawError<"BODY_MUST_BE_AN_OBJECT">;
801
+ PASSWORD_ALREADY_SET: import("better-auth/*").RawError<"PASSWORD_ALREADY_SET">;
802
+ };
803
+ };
804
+ export declare const useSession: () => {
805
+ data: {
806
+ user: import("better-auth/react").StripEmptyObjects<{
807
+ id: string;
808
+ createdAt: Date;
809
+ updatedAt: Date;
810
+ email: string;
811
+ emailVerified: boolean;
812
+ name: string;
813
+ image?: string | null | undefined;
814
+ }>;
815
+ session: import("better-auth/react").StripEmptyObjects<{
816
+ id: string;
817
+ createdAt: Date;
818
+ updatedAt: Date;
819
+ userId: string;
820
+ expiresAt: Date;
821
+ token: string;
822
+ ipAddress?: string | null | undefined;
823
+ userAgent?: string | null | undefined;
824
+ }>;
825
+ } | null;
826
+ isPending: boolean;
827
+ isRefetching: boolean;
828
+ error: import("@better-fetch/fetch").BetterFetchError | null;
829
+ refetch: (queryParams?: {
830
+ query?: import("better-auth/types").SessionQueryParams;
831
+ } | undefined) => Promise<void>;
832
+ }, signIn: {
833
+ social: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
834
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
835
+ callbackURL?: string | undefined;
836
+ newUserCallbackURL?: string | undefined;
837
+ errorCallbackURL?: string | undefined;
838
+ disableRedirect?: boolean | undefined;
839
+ idToken?: {
840
+ token: string;
841
+ nonce?: string | undefined;
842
+ accessToken?: string | undefined;
843
+ refreshToken?: string | undefined;
844
+ expiresAt?: number | undefined;
845
+ user?: {
846
+ name?: {
847
+ firstName?: string | undefined;
848
+ lastName?: string | undefined;
849
+ } | undefined;
850
+ email?: string | undefined;
851
+ } | undefined;
852
+ } | undefined;
853
+ scopes?: string[] | undefined;
854
+ requestSignUp?: boolean | undefined;
855
+ loginHint?: string | undefined;
856
+ additionalData?: Record<string, any> | undefined;
857
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
858
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
859
+ callbackURL?: string | undefined;
860
+ newUserCallbackURL?: string | undefined;
861
+ errorCallbackURL?: string | undefined;
862
+ disableRedirect?: boolean | undefined;
863
+ idToken?: {
864
+ token: string;
865
+ nonce?: string | undefined;
866
+ accessToken?: string | undefined;
867
+ refreshToken?: string | undefined;
868
+ expiresAt?: number | undefined;
869
+ user?: {
870
+ name?: {
871
+ firstName?: string | undefined;
872
+ lastName?: string | undefined;
873
+ } | undefined;
874
+ email?: string | undefined;
875
+ } | undefined;
876
+ } | undefined;
877
+ scopes?: string[] | undefined;
878
+ requestSignUp?: boolean | undefined;
879
+ loginHint?: string | undefined;
880
+ additionalData?: Record<string, any> | undefined;
881
+ } & {
882
+ fetchOptions?: FetchOptions | undefined;
883
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
884
+ redirect: boolean;
885
+ url: string;
886
+ } | (Omit<{
887
+ redirect: boolean;
888
+ token: string;
889
+ url: undefined;
890
+ user: {
891
+ id: string;
892
+ createdAt: Date;
893
+ updatedAt: Date;
894
+ email: string;
895
+ emailVerified: boolean;
896
+ name: string;
897
+ image?: string | null | undefined | undefined;
898
+ };
899
+ }, "user"> & {
900
+ user: import("better-auth/react").StripEmptyObjects<{
901
+ id: string;
902
+ createdAt: Date;
903
+ updatedAt: Date;
904
+ email: string;
905
+ emailVerified: boolean;
906
+ name: string;
907
+ image?: string | null | undefined;
908
+ }>;
909
+ }), {
910
+ code?: string | undefined;
911
+ message?: string | undefined;
912
+ }, FetchOptions["throw"] extends true ? true : false>>;
913
+ } & {
914
+ email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
915
+ email: string;
916
+ password: string;
917
+ callbackURL?: string | undefined;
918
+ rememberMe?: boolean | undefined;
919
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
920
+ email: string;
921
+ password: string;
922
+ callbackURL?: string | undefined;
923
+ rememberMe?: boolean | undefined;
924
+ } & {
925
+ fetchOptions?: FetchOptions | undefined;
926
+ }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<Omit<{
927
+ redirect: boolean;
928
+ token: string;
929
+ url?: string | undefined;
930
+ user: {
931
+ id: string;
932
+ createdAt: Date;
933
+ updatedAt: Date;
934
+ email: string;
935
+ emailVerified: boolean;
936
+ name: string;
937
+ image?: string | null | undefined | undefined;
938
+ };
939
+ }, "user"> & {
940
+ user: import("better-auth/react").StripEmptyObjects<{
941
+ id: string;
942
+ createdAt: Date;
943
+ updatedAt: Date;
944
+ email: string;
945
+ emailVerified: boolean;
946
+ name: string;
947
+ image?: string | null | undefined;
948
+ }>;
949
+ }, {
950
+ code?: string | undefined;
951
+ message?: string | undefined;
952
+ }, FetchOptions["throw"] extends true ? true : false>>;
953
+ }, signOut: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
954
+ query?: Record<string, any> | undefined;
955
+ fetchOptions?: FetchOptions | undefined;
956
+ }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
957
+ success: boolean;
958
+ }, {
959
+ code?: string | undefined;
960
+ message?: string | undefined;
961
+ }, FetchOptions["throw"] extends true ? true : false>>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Better Auth Client (Phase 3)
4
+ *
5
+ * Drop-in replacement for next-auth/react hooks and functions.
6
+ * Import from '@payez/next-mvp/client/better-auth-client'.
7
+ *
8
+ * Migration map:
9
+ * useSession() → authClient.useSession()
10
+ * signIn('google') → authClient.signIn.social({ provider: 'google' })
11
+ * signIn('credentials', {...}) → authClient.signIn.email({...})
12
+ * signOut() → authClient.signOut()
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.signOut = exports.signIn = exports.useSession = exports.authClient = void 0;
16
+ const react_1 = require("better-auth/react");
17
+ exports.authClient = (0, react_1.createAuthClient)({
18
+ // baseURL is derived from BETTER_AUTH_URL or window.location.origin
19
+ });
20
+ // Convenience exports matching NextAuth patterns
21
+ exports.useSession = exports.authClient.useSession, exports.signIn = exports.authClient.signIn, exports.signOut = exports.authClient.signOut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payez/next-mvp",
3
- "version": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,6 +32,11 @@
32
32
  "require": "./dist/client/index.js",
33
33
  "default": "./dist/client/index.js"
34
34
  },
35
+ "./client/better-auth-client": {
36
+ "types": "./dist/client/better-auth-client.d.ts",
37
+ "require": "./dist/client/better-auth-client.js",
38
+ "default": "./dist/client/better-auth-client.js"
39
+ },
35
40
  "./client/AuthContext": {
36
41
  "types": "./dist/client/AuthContext.d.ts",
37
42
  "require": "./dist/client/AuthContext.js",
@@ -60,6 +60,15 @@ export function createBetterAuthInstance(idpConfig: IDPClientConfig) {
60
60
 
61
61
  socialProviders: buildBetterAuthProviders(idpConfig),
62
62
 
63
+ // Trust the app's own origin + any configured base URL
64
+ trustedOrigins: [
65
+ ...(idpConfig.baseClientUrl ? [idpConfig.baseClientUrl] : []),
66
+ ...(process.env.BETTER_AUTH_URL ? [process.env.BETTER_AUTH_URL] : []),
67
+ 'http://localhost:3000',
68
+ 'http://localhost:3400',
69
+ 'http://localhost:3600',
70
+ ],
71
+
63
72
  // No database — stateless mode. Better Auth defaults to JWE cookie cache.
64
73
  // Session cookie cache with refreshCache for DB-less setup.
65
74
  session: {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Better Auth Client (Phase 3)
3
+ *
4
+ * Drop-in replacement for next-auth/react hooks and functions.
5
+ * Import from '@payez/next-mvp/client/better-auth-client'.
6
+ *
7
+ * Migration map:
8
+ * useSession() → authClient.useSession()
9
+ * signIn('google') → authClient.signIn.social({ provider: 'google' })
10
+ * signIn('credentials', {...}) → authClient.signIn.email({...})
11
+ * signOut() → authClient.signOut()
12
+ */
13
+
14
+ import { createAuthClient } from 'better-auth/react';
15
+
16
+ export const authClient = createAuthClient({
17
+ // baseURL is derived from BETTER_AUTH_URL or window.location.origin
18
+ });
19
+
20
+ // Convenience exports matching NextAuth patterns
21
+ export const { useSession, signIn, signOut } = authClient;