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