@niledatabase/react 3.0.1-alpha.0 → 4.0.0-alpha.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.
- package/dist/index.d.mts +248 -108
- package/dist/index.d.ts +248 -108
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,18 +3,17 @@ import React__default from 'react';
|
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
import * as next_auth_react from 'next-auth/react';
|
|
6
|
-
import { SignInOptions,
|
|
6
|
+
import { SignInOptions, LiteralUnion, ClientSafeProvider, SignOutParams, SignOutResponse, SignInAuthorizationParams, SignInResponse, UseSessionOptions } from 'next-auth/react';
|
|
7
7
|
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
8
8
|
import { VariantProps } from 'class-variance-authority';
|
|
9
9
|
import { CreateBasicUserRequest } from '@niledatabase/browser';
|
|
10
|
-
import { BuiltInProviderType, RedirectableProviderType } from 'next-auth/providers/index';
|
|
11
10
|
import { CtxOrReq } from 'next-auth/client/_utils';
|
|
12
|
-
import {
|
|
11
|
+
import { BuiltInProviderType, RedirectableProviderType } from 'next-auth/providers/index';
|
|
13
12
|
|
|
14
13
|
type EmailSignInInfo = SignInOptions;
|
|
15
14
|
type SignInSuccess = (response: Response) => void;
|
|
16
15
|
type AllowedAny$3 = any;
|
|
17
|
-
|
|
16
|
+
type Props$4 = {
|
|
18
17
|
redirect?: boolean;
|
|
19
18
|
onSuccess?: SignInSuccess;
|
|
20
19
|
onError?: (e: Error, info: EmailSignInInfo) => void;
|
|
@@ -22,9 +21,10 @@ interface Props$5 {
|
|
|
22
21
|
buttonText?: string;
|
|
23
22
|
client?: QueryClient;
|
|
24
23
|
callbackUrl?: string;
|
|
25
|
-
|
|
24
|
+
init?: RequestInit;
|
|
25
|
+
};
|
|
26
26
|
|
|
27
|
-
declare function EmailSigningIn(props: Props$
|
|
27
|
+
declare function EmailSigningIn(props: Props$4): React__default.JSX.Element;
|
|
28
28
|
|
|
29
29
|
declare const buttonVariants: (props?: ({
|
|
30
30
|
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
@@ -59,7 +59,7 @@ declare const EmailSignInButton: React__default.ForwardRefExoticComponent<Button
|
|
|
59
59
|
buttonText?: string;
|
|
60
60
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
61
61
|
|
|
62
|
-
declare function useEmailSignIn(params?: Props$
|
|
62
|
+
declare function useEmailSignIn(params?: Props$4): _tanstack_react_query.UseMutateFunction<Response, Error, next_auth_react.SignInOptions, unknown>;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* A component for a Google login button, according to their design language.
|
|
@@ -70,43 +70,217 @@ declare function useEmailSignIn(params?: Props$5): _tanstack_react_query.UseMuta
|
|
|
70
70
|
declare const GoogleSSOButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
71
71
|
callbackUrl?: string;
|
|
72
72
|
buttonText?: string;
|
|
73
|
+
init?: RequestInit;
|
|
73
74
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
74
75
|
|
|
75
76
|
declare const AzureSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
76
77
|
callbackUrl?: string;
|
|
77
78
|
buttonText?: string;
|
|
79
|
+
init?: RequestInit;
|
|
78
80
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
79
81
|
|
|
80
82
|
declare const DiscordSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
81
83
|
callbackUrl?: string;
|
|
82
84
|
buttonText?: string;
|
|
85
|
+
init?: RequestInit;
|
|
83
86
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
84
87
|
|
|
85
88
|
declare const GitHubSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
86
89
|
callbackUrl?: string;
|
|
87
90
|
buttonText?: string;
|
|
91
|
+
init?: RequestInit;
|
|
88
92
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
89
93
|
|
|
90
94
|
declare const HubSpotSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
91
95
|
callbackUrl?: string;
|
|
92
96
|
buttonText?: string;
|
|
97
|
+
init?: RequestInit;
|
|
93
98
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
94
99
|
|
|
95
100
|
declare const LinkedInSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
96
101
|
callbackUrl?: string;
|
|
97
102
|
buttonText?: string;
|
|
103
|
+
init?: RequestInit;
|
|
98
104
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
99
105
|
|
|
100
106
|
declare const SlackSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
101
107
|
callbackUrl?: string;
|
|
102
108
|
buttonText?: string;
|
|
109
|
+
init?: ResponseInit;
|
|
103
110
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
104
111
|
|
|
105
112
|
declare const XSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
106
113
|
callbackUrl?: string;
|
|
107
114
|
buttonText?: string;
|
|
115
|
+
init?: RequestInit;
|
|
108
116
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
109
117
|
|
|
118
|
+
type JWT = {
|
|
119
|
+
email: string;
|
|
120
|
+
sub: string;
|
|
121
|
+
id: string;
|
|
122
|
+
iat: number;
|
|
123
|
+
exp: number;
|
|
124
|
+
jti: string;
|
|
125
|
+
loading: boolean;
|
|
126
|
+
};
|
|
127
|
+
type ActiveSession = {
|
|
128
|
+
loading: boolean;
|
|
129
|
+
id: string;
|
|
130
|
+
email: string;
|
|
131
|
+
expires: string;
|
|
132
|
+
user?: {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
image: string;
|
|
136
|
+
email: string;
|
|
137
|
+
emailVerified: void | Date;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
type NonErrorSession = JWT | ActiveSession | null | undefined;
|
|
141
|
+
type NileSession = Response | NonErrorSession;
|
|
142
|
+
type AuthState = {
|
|
143
|
+
basePath: string;
|
|
144
|
+
baseUrl: string;
|
|
145
|
+
lastSync: number;
|
|
146
|
+
getSession: (...args: any[]) => void;
|
|
147
|
+
session: NonErrorSession | undefined | null;
|
|
148
|
+
loading: boolean;
|
|
149
|
+
};
|
|
150
|
+
type ListenerParams = {
|
|
151
|
+
key: ListenerKeys;
|
|
152
|
+
next: any;
|
|
153
|
+
prev: any;
|
|
154
|
+
};
|
|
155
|
+
type Listener = (callback: ListenerParams) => void;
|
|
156
|
+
type ListenerKeys = 'basePath' | 'baseUrl' | 'lastSync' | 'getSession' | 'session' | 'loading';
|
|
157
|
+
type AuthConfig = Config & {
|
|
158
|
+
listenerKeys?: Array<ListenerKeys>;
|
|
159
|
+
};
|
|
160
|
+
type Config = {
|
|
161
|
+
basePath?: string;
|
|
162
|
+
baseUrl?: string;
|
|
163
|
+
init?: RequestInit;
|
|
164
|
+
};
|
|
165
|
+
type PartialAuthorizer = null | {
|
|
166
|
+
state?: {
|
|
167
|
+
baseUrl?: string;
|
|
168
|
+
session?: {
|
|
169
|
+
user?: {
|
|
170
|
+
email?: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
requestInit?: RequestInit | undefined;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type WarningCode = 'NEXTAUTH_URL' | 'NO_SECRET' | 'TWITTER_OAUTH_2_BETA' | 'DEBUG_ENABLED';
|
|
178
|
+
/**
|
|
179
|
+
* Override any of the methods, and the rest will use the default logger.
|
|
180
|
+
*
|
|
181
|
+
* [Documentation](https://next-auth.js.org/configuration/options#logger)
|
|
182
|
+
*/
|
|
183
|
+
interface LoggerInstance extends Record<string, (...args: any) => any> {
|
|
184
|
+
warn: (code: WarningCode) => void;
|
|
185
|
+
error: (code: string,
|
|
186
|
+
/**
|
|
187
|
+
* Either an instance of (JSON serializable) Error
|
|
188
|
+
* or an object that contains some debug information.
|
|
189
|
+
* (Error is still available through `metadata.error`)
|
|
190
|
+
*/
|
|
191
|
+
metadata: Error | {
|
|
192
|
+
error: Error;
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
}) => void;
|
|
195
|
+
debug: (code: string, metadata: unknown) => void;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
type GetSessionParams = CtxOrReq & {
|
|
199
|
+
event?: 'storage' | 'timer' | 'hidden' | string;
|
|
200
|
+
triggerEvent?: boolean;
|
|
201
|
+
broadcast?: boolean;
|
|
202
|
+
baseUrl?: string;
|
|
203
|
+
init?: RequestInit;
|
|
204
|
+
};
|
|
205
|
+
declare enum State {
|
|
206
|
+
SESSION = "getSession"
|
|
207
|
+
}
|
|
208
|
+
declare class Authorizer {
|
|
209
|
+
state: AuthState;
|
|
210
|
+
logger: LoggerInstance;
|
|
211
|
+
requestInit?: RequestInit;
|
|
212
|
+
addListener: (cb: Listener) => void;
|
|
213
|
+
removeListener: (cb: Listener) => void;
|
|
214
|
+
status: null | State;
|
|
215
|
+
constructor(config?: AuthConfig);
|
|
216
|
+
sync(event?: 'storage' | 'timer' | 'hidden' | 'poll' | 'visibilitychange'): Promise<void>;
|
|
217
|
+
set baseUrl(val: string);
|
|
218
|
+
get baseUrl(): string;
|
|
219
|
+
configure(config?: Config): this;
|
|
220
|
+
sanitize(): PartialAuthorizer;
|
|
221
|
+
initialize(params?: {
|
|
222
|
+
baseUrl?: string;
|
|
223
|
+
session?: NonErrorSession | null | undefined;
|
|
224
|
+
}): Promise<void>;
|
|
225
|
+
get apiBaseUrl(): string;
|
|
226
|
+
fetchData<T = any>(url: string, init?: RequestInit): Promise<T | undefined>;
|
|
227
|
+
fetchFormData<T = {
|
|
228
|
+
url: string;
|
|
229
|
+
}>(url: string, init: RequestInit): Promise<{
|
|
230
|
+
data: T;
|
|
231
|
+
status: number;
|
|
232
|
+
ok: boolean;
|
|
233
|
+
url: string;
|
|
234
|
+
} | undefined>;
|
|
235
|
+
getProviders(): Promise<Record<LiteralUnion<BuiltInProviderType>, ClientSafeProvider> | undefined>;
|
|
236
|
+
getCsrfToken(): Promise<string | undefined>;
|
|
237
|
+
getSession(params?: GetSessionParams): Promise<NonErrorSession>;
|
|
238
|
+
refreshSession(): Promise<NonErrorSession>;
|
|
239
|
+
signOut<R extends boolean = true>(options?: SignOutParams<R> & {
|
|
240
|
+
baseUrl?: string;
|
|
241
|
+
auth?: Authorizer | PartialAuthorizer;
|
|
242
|
+
fetchUrl?: string;
|
|
243
|
+
}): Promise<R extends true ? undefined : SignOutResponse>;
|
|
244
|
+
signIn<P extends RedirectableProviderType | undefined = undefined>(provider?: LiteralUnion<P extends RedirectableProviderType ? P | BuiltInProviderType : BuiltInProviderType>, options?: SignInOptions & {
|
|
245
|
+
baseUrl?: string;
|
|
246
|
+
init?: ResponseInit;
|
|
247
|
+
fetchUrl?: string;
|
|
248
|
+
auth?: Authorizer | PartialAuthorizer;
|
|
249
|
+
}, authorizationParams?: SignInAuthorizationParams): Promise<P extends RedirectableProviderType ? SignInResponse | undefined : undefined>;
|
|
250
|
+
signUp(options: {
|
|
251
|
+
baseUrl?: string;
|
|
252
|
+
init?: ResponseInit;
|
|
253
|
+
fetchUrl?: string;
|
|
254
|
+
newTenantName?: string;
|
|
255
|
+
createTenant?: string | boolean;
|
|
256
|
+
email: string;
|
|
257
|
+
password: string;
|
|
258
|
+
auth?: Authorizer | PartialAuthorizer;
|
|
259
|
+
tenantId?: string;
|
|
260
|
+
callbackUrl?: string;
|
|
261
|
+
redirect?: boolean;
|
|
262
|
+
}): Promise<any>;
|
|
263
|
+
}
|
|
264
|
+
declare const authorizer: Authorizer;
|
|
265
|
+
declare const auth: Authorizer;
|
|
266
|
+
declare const getSession: (params?: GetSessionParams) => Promise<NonErrorSession>;
|
|
267
|
+
declare const getCsrfToken: () => Promise<string | undefined>;
|
|
268
|
+
declare const getProviders: () => Promise<Record<LiteralUnion<BuiltInProviderType>, ClientSafeProvider> | undefined>;
|
|
269
|
+
declare const signOut: typeof authorizer.signOut;
|
|
270
|
+
declare const signIn: typeof authorizer.signIn;
|
|
271
|
+
|
|
272
|
+
type ComponentFetchProps = {
|
|
273
|
+
auth?: Authorizer | PartialAuthorizer;
|
|
274
|
+
init?: RequestInit;
|
|
275
|
+
};
|
|
276
|
+
type PrefetchParams = {
|
|
277
|
+
baseUrl?: string;
|
|
278
|
+
disableQuery?: boolean;
|
|
279
|
+
init?: RequestInit;
|
|
280
|
+
client?: QueryClient;
|
|
281
|
+
fetchUrl?: string;
|
|
282
|
+
};
|
|
283
|
+
|
|
110
284
|
type SignUpInfo = CreateBasicUserRequest & {
|
|
111
285
|
tenantId?: string;
|
|
112
286
|
fetchUrl?: string;
|
|
@@ -114,20 +288,20 @@ type SignUpInfo = CreateBasicUserRequest & {
|
|
|
114
288
|
newTenantName?: string;
|
|
115
289
|
};
|
|
116
290
|
type AllowedAny$2 = any;
|
|
117
|
-
|
|
291
|
+
type Props$3 = PrefetchParams & {
|
|
118
292
|
onSuccess?: (response: Response, formValues: SignUpInfo) => void;
|
|
119
293
|
onError?: (e: Error, info: SignUpInfo) => void;
|
|
120
294
|
beforeMutate?: (data: AllowedAny$2) => AllowedAny$2;
|
|
121
295
|
buttonText?: string;
|
|
122
|
-
client?: QueryClient;
|
|
123
296
|
callbackUrl?: string;
|
|
124
|
-
baseUrl?: string;
|
|
125
297
|
createTenant?: string | boolean;
|
|
126
|
-
|
|
298
|
+
className?: string;
|
|
299
|
+
redirect?: boolean;
|
|
300
|
+
};
|
|
127
301
|
|
|
128
|
-
declare function SigningUp(props: Props$
|
|
302
|
+
declare function SigningUp({ className, ...props }: Props$3): React__default.JSX.Element;
|
|
129
303
|
|
|
130
|
-
declare function useSignUp<T extends SignUpInfo>(params: Props$
|
|
304
|
+
declare function useSignUp<T extends SignUpInfo>(params: Props$3, client?: QueryClient): _tanstack_react_query.UseMutateFunction<any, Error, SignUpInfo, unknown>;
|
|
131
305
|
|
|
132
306
|
type AllowedAny$1 = any;
|
|
133
307
|
type LoginInfo = {
|
|
@@ -135,49 +309,75 @@ type LoginInfo = {
|
|
|
135
309
|
password: string;
|
|
136
310
|
};
|
|
137
311
|
type LoginSuccess = (response: AllowedAny$1, formValues: LoginInfo, ...args: AllowedAny$1) => void;
|
|
138
|
-
|
|
312
|
+
type Props$2 = ComponentFetchProps & {
|
|
139
313
|
beforeMutate?: (data: AllowedAny$1) => AllowedAny$1;
|
|
140
314
|
onSuccess?: LoginSuccess;
|
|
141
315
|
onError?: (error: Error, data: AllowedAny$1) => void;
|
|
142
316
|
callbackUrl?: string;
|
|
143
317
|
client?: QueryClient;
|
|
144
|
-
|
|
318
|
+
className?: string;
|
|
319
|
+
baseUrl?: string;
|
|
320
|
+
fetchUrl?: string;
|
|
321
|
+
};
|
|
145
322
|
|
|
146
|
-
declare function SigningIn(props: Props$
|
|
323
|
+
declare function SigningIn({ className, ...props }: Props$2): React__default.JSX.Element;
|
|
147
324
|
|
|
148
|
-
declare function useSignIn(params?: Props$
|
|
325
|
+
declare function useSignIn(params?: Props$2): _tanstack_react_query.UseMutateFunction<next_auth_react.SignInResponse | undefined, Error, LoginInfo, any>;
|
|
149
326
|
|
|
150
|
-
declare const SignOutButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
327
|
+
declare const SignOutButton: React__default.ForwardRefExoticComponent<ButtonProps & ComponentFetchProps & {
|
|
151
328
|
redirect?: boolean;
|
|
152
329
|
callbackUrl?: string;
|
|
153
330
|
buttonText?: string;
|
|
331
|
+
baseUrl?: string;
|
|
154
332
|
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
155
333
|
|
|
156
|
-
|
|
334
|
+
interface SessionProviderProps {
|
|
335
|
+
children: React__default.ReactNode;
|
|
336
|
+
session?: NileSession;
|
|
337
|
+
baseUrl?: string;
|
|
338
|
+
basePath?: string;
|
|
339
|
+
/**
|
|
340
|
+
* A time interval (in seconds) after which the session will be re-fetched.
|
|
341
|
+
* If set to `0` (default), the session is not polled.
|
|
342
|
+
*/
|
|
343
|
+
refetchInterval?: number;
|
|
344
|
+
/**
|
|
345
|
+
* `SessionProvider` automatically refetches the session when the user switches between windows.
|
|
346
|
+
* This option activates this behaviour if set to `true` (default).
|
|
347
|
+
*/
|
|
348
|
+
refetchOnWindowFocus?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Set to `false` to stop polling when the device has no internet access offline (determined by `navigator.onLine`)
|
|
351
|
+
*
|
|
352
|
+
* [`navigator.onLine` documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine)
|
|
353
|
+
*/
|
|
354
|
+
refetchWhenOffline?: false;
|
|
355
|
+
}
|
|
356
|
+
type UpdateSession = (data?: any) => Promise<NonErrorSession | null | undefined>;
|
|
157
357
|
type SessionContextValue<R extends boolean = false> = R extends true ? {
|
|
158
358
|
update: UpdateSession;
|
|
159
|
-
data:
|
|
359
|
+
data: NonErrorSession;
|
|
160
360
|
status: 'authenticated';
|
|
161
361
|
} | {
|
|
162
362
|
update: UpdateSession;
|
|
163
|
-
data: null;
|
|
363
|
+
data: null | undefined;
|
|
164
364
|
status: 'loading';
|
|
165
365
|
} : {
|
|
166
366
|
update: UpdateSession;
|
|
167
|
-
data:
|
|
367
|
+
data: NonErrorSession;
|
|
168
368
|
status: 'authenticated';
|
|
169
369
|
} | {
|
|
170
370
|
update: UpdateSession;
|
|
171
|
-
data: null;
|
|
371
|
+
data: null | undefined;
|
|
172
372
|
status: 'unauthenticated' | 'loading';
|
|
173
373
|
};
|
|
174
374
|
declare const SessionContext: React__default.Context<{
|
|
175
375
|
update: UpdateSession;
|
|
176
|
-
data:
|
|
376
|
+
data: NonErrorSession;
|
|
177
377
|
status: "authenticated";
|
|
178
378
|
} | {
|
|
179
379
|
update: UpdateSession;
|
|
180
|
-
data: null;
|
|
380
|
+
data: null | undefined;
|
|
181
381
|
status: "unauthenticated" | "loading";
|
|
182
382
|
} | undefined>;
|
|
183
383
|
/**
|
|
@@ -187,44 +387,12 @@ declare const SessionContext: React__default.Context<{
|
|
|
187
387
|
* [Documentation](https://next-auth.js.org/getting-started/client#usesession)
|
|
188
388
|
*/
|
|
189
389
|
declare function useSession<R extends boolean>(options?: UseSessionOptions<R>): SessionContextValue<R>;
|
|
190
|
-
type GetSessionParams = CtxOrReq & {
|
|
191
|
-
event?: 'storage' | 'timer' | 'hidden' | string;
|
|
192
|
-
triggerEvent?: boolean;
|
|
193
|
-
broadcast?: boolean;
|
|
194
|
-
};
|
|
195
|
-
declare function getSession(params?: GetSessionParams): Promise<Session | null>;
|
|
196
|
-
/**
|
|
197
|
-
* Returns the current Cross Site Request Forgery Token (CSRF Token)
|
|
198
|
-
* required to make POST requests (e.g. for signing in and signing out).
|
|
199
|
-
* You likely only need to use this if you are not using the built-in
|
|
200
|
-
* `signIn()` and `signOut()` methods.
|
|
201
|
-
*
|
|
202
|
-
* [Documentation](https://next-auth.js.org/getting-started/client#getcsrftoken)
|
|
203
|
-
*/
|
|
204
|
-
declare function getCsrfToken(params?: CtxOrReq): Promise<string | undefined>;
|
|
205
|
-
/**
|
|
206
|
-
* It calls `/api/auth/providers` and returns
|
|
207
|
-
* a list of the currently configured authentication providers.
|
|
208
|
-
* It can be useful if you are creating a dynamic custom sign in page.
|
|
209
|
-
*
|
|
210
|
-
* [Documentation](https://next-auth.js.org/getting-started/client#getproviders)
|
|
211
|
-
*/
|
|
212
|
-
declare function getProviders(): Promise<Record<LiteralUnion<BuiltInProviderType>, ClientSafeProvider> | null>;
|
|
213
|
-
/**
|
|
214
|
-
* Client-side method to initiate a signin flow
|
|
215
|
-
* or send the user to the signin page listing all possible providers.
|
|
216
|
-
* Automatically adds the CSRF token to the request.
|
|
217
|
-
*
|
|
218
|
-
* [Documentation](https://next-auth.js.org/getting-started/client#signin)
|
|
219
|
-
*/
|
|
220
|
-
declare function signIn<P extends RedirectableProviderType | undefined = undefined>(provider?: LiteralUnion<P extends RedirectableProviderType ? P | BuiltInProviderType : BuiltInProviderType>, options?: SignInOptions, authorizationParams?: SignInAuthorizationParams): Promise<P extends RedirectableProviderType ? SignInResponse | undefined : undefined>;
|
|
221
390
|
/**
|
|
222
391
|
* Signs the user out, by removing the session cookie.
|
|
223
392
|
* Automatically adds the CSRF token to the request.
|
|
224
393
|
*
|
|
225
394
|
* [Documentation](https://next-auth.js.org/getting-started/client#signout)
|
|
226
395
|
*/
|
|
227
|
-
declare function signOut<R extends boolean = true>(options?: SignOutParams<R>): Promise<R extends true ? undefined : SignOutResponse>;
|
|
228
396
|
/**
|
|
229
397
|
* Provider to wrap the app in to make session data available globally.
|
|
230
398
|
* Can also be used to throttle the number of requests to the endpoint
|
|
@@ -233,36 +401,12 @@ declare function signOut<R extends boolean = true>(options?: SignOutParams<R>):
|
|
|
233
401
|
* [Documentation](https://next-auth.js.org/getting-started/client#sessionprovider)
|
|
234
402
|
*/
|
|
235
403
|
declare function SessionProvider(props: SessionProviderProps): React__default.JSX.Element;
|
|
236
|
-
type JWT = {
|
|
237
|
-
email: string;
|
|
238
|
-
sub: string;
|
|
239
|
-
id: string;
|
|
240
|
-
iat: number;
|
|
241
|
-
exp: number;
|
|
242
|
-
jti: string;
|
|
243
|
-
};
|
|
244
|
-
type ActiveSession = {
|
|
245
|
-
id: string;
|
|
246
|
-
email: string;
|
|
247
|
-
expires: string;
|
|
248
|
-
user?: {
|
|
249
|
-
id: string;
|
|
250
|
-
name: string;
|
|
251
|
-
image: string;
|
|
252
|
-
email: string;
|
|
253
|
-
emailVerified: void | Date;
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
type NonErrorSession = JWT | ActiveSession | null | undefined;
|
|
257
|
-
type NileSession = Response | NonErrorSession;
|
|
258
404
|
|
|
259
|
-
declare function SignedIn({ children, session: startSession, ...props }:
|
|
260
|
-
session?: NileSession;
|
|
405
|
+
declare function SignedIn({ children, session: startSession, ...props }: SessionProviderProps & {
|
|
261
406
|
className?: string;
|
|
262
407
|
}): React__default.JSX.Element | null;
|
|
263
408
|
|
|
264
|
-
declare function SignedOut({ children, session: startSession, ...props }:
|
|
265
|
-
session?: NileSession;
|
|
409
|
+
declare function SignedOut({ children, session: startSession, ...props }: SessionProviderProps & {
|
|
266
410
|
className?: string;
|
|
267
411
|
}): React__default.JSX.Element | null;
|
|
268
412
|
|
|
@@ -271,23 +415,24 @@ type Tenant = {
|
|
|
271
415
|
name: string;
|
|
272
416
|
};
|
|
273
417
|
|
|
274
|
-
type HookProps = {
|
|
418
|
+
type HookProps$1 = ComponentFetchProps & {
|
|
419
|
+
fetchUrl?: string;
|
|
275
420
|
tenants?: Tenant[];
|
|
276
421
|
onError?: (e: Error) => void;
|
|
277
422
|
baseUrl?: string;
|
|
278
423
|
};
|
|
279
|
-
type ComponentProps = HookProps & {
|
|
424
|
+
type ComponentProps = HookProps$1 & {
|
|
280
425
|
client?: QueryClient;
|
|
281
426
|
activeTenant?: string;
|
|
282
427
|
useCookie?: boolean;
|
|
283
428
|
className?: string;
|
|
284
429
|
};
|
|
285
430
|
|
|
286
|
-
declare function useTenants(params: HookProps & {
|
|
431
|
+
declare function useTenants(params: HookProps$1 & {
|
|
287
432
|
disableQuery?: boolean;
|
|
288
433
|
}, client?: QueryClient): _tanstack_react_query.UseQueryResult<Tenant[], Error>;
|
|
289
|
-
declare function useTenantId(params?: HookProps & {
|
|
290
|
-
tenant
|
|
434
|
+
declare function useTenantId(params?: HookProps$1 & {
|
|
435
|
+
tenant?: Tenant;
|
|
291
436
|
}, client?: QueryClient): [string | undefined, (tenant: string) => void];
|
|
292
437
|
|
|
293
438
|
declare function TenantSelector(props: ComponentProps): React__default.JSX.Element;
|
|
@@ -307,41 +452,36 @@ interface User {
|
|
|
307
452
|
}[];
|
|
308
453
|
}
|
|
309
454
|
|
|
310
|
-
type
|
|
311
|
-
fetchUrl?: string;
|
|
455
|
+
type HookProps = ComponentFetchProps & {
|
|
312
456
|
user?: User | undefined | null;
|
|
457
|
+
baseUrl?: string;
|
|
458
|
+
client?: QueryClient;
|
|
459
|
+
fetchUrl?: string;
|
|
313
460
|
};
|
|
314
|
-
declare function useMe(props:
|
|
461
|
+
declare function useMe(props: HookProps): any;
|
|
315
462
|
|
|
316
|
-
type Props$1 = {
|
|
317
|
-
user?: User | undefined | null;
|
|
318
|
-
fetchUrl?: string;
|
|
463
|
+
type Props$1 = HookProps & {
|
|
319
464
|
profilePicturePlaceholder?: React__default.ReactElement;
|
|
320
465
|
className?: string;
|
|
321
466
|
};
|
|
322
|
-
declare function UserInfo(props: Props$1): React__default.JSX.Element
|
|
467
|
+
declare function UserInfo(props: Props$1): React__default.JSX.Element;
|
|
323
468
|
|
|
324
|
-
type Props = Params & {
|
|
325
|
-
client?: QueryClient;
|
|
326
|
-
callbackUrl?: string;
|
|
327
|
-
defaultValues?: MutateFnParams & {
|
|
328
|
-
confirmPassword?: string;
|
|
329
|
-
};
|
|
330
|
-
};
|
|
331
469
|
type AllowedAny = any;
|
|
332
|
-
|
|
470
|
+
type Params = PrefetchParams & {
|
|
333
471
|
beforeMutate?: (data: AllowedAny) => AllowedAny;
|
|
334
472
|
onSuccess?: (res: Response) => void;
|
|
335
473
|
onError?: (error: Error, data: AllowedAny) => void;
|
|
336
474
|
callbackUrl?: string;
|
|
337
|
-
|
|
338
|
-
fetchUrl?: string;
|
|
339
|
-
baseUrl?: string;
|
|
340
|
-
}
|
|
475
|
+
};
|
|
341
476
|
type MutateFnParams = {
|
|
342
477
|
email?: string;
|
|
343
478
|
password?: string;
|
|
344
479
|
};
|
|
480
|
+
type Props = Params & {
|
|
481
|
+
defaultValues?: MutateFnParams & {
|
|
482
|
+
confirmPassword?: string;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
345
485
|
|
|
346
486
|
declare function ResetPasswordForm$1(props: Props): React__default.JSX.Element;
|
|
347
487
|
|
|
@@ -352,4 +492,4 @@ declare function useResetPassword(params?: Params): _tanstack_react_query.UseMut
|
|
|
352
492
|
declare const Email: () => React.JSX.Element;
|
|
353
493
|
declare const Password: () => React.JSX.Element;
|
|
354
494
|
|
|
355
|
-
export { AzureSignInButton as Azure, DiscordSignInButton as Discord, Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, LinkedInSignInButton as LinkedIn, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, getCsrfToken, getProviders, getSession, signIn, signOut, useEmailSignIn, useMe, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };
|
|
495
|
+
export { type ActiveSession, type AuthConfig, type AuthState, Authorizer, AzureSignInButton as Azure, DiscordSignInButton as Discord, Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, type JWT, LinkedInSignInButton as LinkedIn, type Listener, type ListenerKeys, type ListenerParams, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, type NonErrorSession as Session, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, auth, getCsrfToken, getProviders, getSession, signIn, signOut, useEmailSignIn, useMe, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };
|