@niledatabase/react 4.0.0-alpha.2 → 4.0.0-alpha.20
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/README.md +71 -111
- package/dist/index.d.mts +122 -97
- package/dist/index.d.ts +122 -97
- 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 +2 -1
- package/package.json +10 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
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, LiteralUnion, ClientSafeProvider, SignOutParams, SignOutResponse, SignInAuthorizationParams, SignInResponse, UseSessionOptions } from 'next-auth/react';
|
|
6
|
+
import { SignInOptions, LiteralUnion, ClientSafeProvider, SignOutParams, SignOutResponse, SignInAuthorizationParams, SignInResponse as SignInResponse$1, 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
|
-
import { CreateBasicUserRequest } from '@niledatabase/browser';
|
|
10
9
|
import { CtxOrReq } from 'next-auth/client/_utils';
|
|
11
10
|
import { BuiltInProviderType, RedirectableProviderType } from 'next-auth/providers/index';
|
|
12
11
|
|
|
13
12
|
type EmailSignInInfo = SignInOptions;
|
|
14
13
|
type SignInSuccess = (response: Response) => void;
|
|
15
14
|
type AllowedAny$3 = any;
|
|
16
|
-
type Props$
|
|
15
|
+
type Props$5 = {
|
|
17
16
|
redirect?: boolean;
|
|
18
17
|
onSuccess?: SignInSuccess;
|
|
19
18
|
onError?: (e: Error, info: EmailSignInInfo) => void;
|
|
@@ -24,97 +23,17 @@ type Props$4 = {
|
|
|
24
23
|
init?: RequestInit;
|
|
25
24
|
};
|
|
26
25
|
|
|
27
|
-
declare function EmailSigningIn(props: Props$
|
|
26
|
+
declare function EmailSigningIn(props: Props$5): React__default.JSX.Element;
|
|
28
27
|
|
|
29
28
|
declare const buttonVariants: (props?: ({
|
|
30
29
|
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
31
30
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
32
31
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
33
|
-
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
32
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
34
33
|
asChild?: boolean;
|
|
35
34
|
loading?: boolean;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
type EmailError = void | {
|
|
39
|
-
error: string;
|
|
40
|
-
ok: boolean;
|
|
41
|
-
status: number;
|
|
42
|
-
url: null | string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* This works when the email identity provider is configured in the admin dashboard.
|
|
46
|
-
* @param props callbackUrl: the url to send the user to from their email
|
|
47
|
-
* @param props redirect: redirect to the default (unbranded) 'check your email' page. default is false
|
|
48
|
-
* @param props email: the email to send to
|
|
49
|
-
* @param props onSent: called if the email was sent
|
|
50
|
-
* @param props onFailure: called if there was a reportable
|
|
51
|
-
* @returns a JSX.Element to render
|
|
52
|
-
*/
|
|
53
|
-
declare const EmailSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
54
|
-
callbackUrl?: string;
|
|
55
|
-
redirect?: boolean;
|
|
56
|
-
email: string;
|
|
57
|
-
onSent?: () => void;
|
|
58
|
-
onFailure?: (error: EmailError) => void;
|
|
59
|
-
buttonText?: string;
|
|
60
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
61
|
-
|
|
62
|
-
declare function useEmailSignIn(params?: Props$4): _tanstack_react_query.UseMutateFunction<Response, Error, next_auth_react.SignInOptions, unknown>;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* A component for a Google login button, according to their design language.
|
|
66
|
-
* This works when an identity provider is configured in the admin dashboard.
|
|
67
|
-
* @param props callbackUrl: a string to override the URL provided by the context
|
|
68
|
-
* @returns a JSX.Element to render
|
|
69
|
-
*/
|
|
70
|
-
declare const GoogleSSOButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
71
|
-
callbackUrl?: string;
|
|
72
|
-
buttonText?: string;
|
|
73
|
-
init?: RequestInit;
|
|
74
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
75
|
-
|
|
76
|
-
declare const AzureSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
77
|
-
callbackUrl?: string;
|
|
78
|
-
buttonText?: string;
|
|
79
|
-
init?: RequestInit;
|
|
80
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
81
|
-
|
|
82
|
-
declare const DiscordSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
83
|
-
callbackUrl?: string;
|
|
84
|
-
buttonText?: string;
|
|
85
|
-
init?: RequestInit;
|
|
86
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
87
|
-
|
|
88
|
-
declare const GitHubSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
89
|
-
callbackUrl?: string;
|
|
90
|
-
buttonText?: string;
|
|
91
|
-
init?: RequestInit;
|
|
92
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
93
|
-
|
|
94
|
-
declare const HubSpotSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
95
|
-
callbackUrl?: string;
|
|
96
|
-
buttonText?: string;
|
|
97
|
-
init?: RequestInit;
|
|
98
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
99
|
-
|
|
100
|
-
declare const LinkedInSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
101
|
-
callbackUrl?: string;
|
|
102
|
-
buttonText?: string;
|
|
103
|
-
init?: RequestInit;
|
|
104
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
105
|
-
|
|
106
|
-
declare const SlackSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
107
|
-
callbackUrl?: string;
|
|
108
|
-
buttonText?: string;
|
|
109
|
-
init?: ResponseInit;
|
|
110
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
111
|
-
|
|
112
|
-
declare const XSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
113
|
-
callbackUrl?: string;
|
|
114
|
-
buttonText?: string;
|
|
115
|
-
init?: RequestInit;
|
|
116
|
-
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
117
|
-
|
|
118
37
|
type JWT = {
|
|
119
38
|
email: string;
|
|
120
39
|
sub: string;
|
|
@@ -249,7 +168,7 @@ declare class Authorizer {
|
|
|
249
168
|
init?: ResponseInit;
|
|
250
169
|
fetchUrl?: string;
|
|
251
170
|
auth?: Authorizer | PartialAuthorizer;
|
|
252
|
-
}, authorizationParams?: SignInAuthorizationParams): Promise<P extends RedirectableProviderType ? SignInResponse | undefined : undefined>;
|
|
171
|
+
}, authorizationParams?: SignInAuthorizationParams): Promise<P extends RedirectableProviderType ? SignInResponse$1 | undefined : undefined>;
|
|
253
172
|
signUp(options: {
|
|
254
173
|
baseUrl?: string;
|
|
255
174
|
init?: ResponseInit;
|
|
@@ -272,6 +191,102 @@ declare const getProviders: () => Promise<Record<LiteralUnion<BuiltInProviderTyp
|
|
|
272
191
|
declare const signOut: typeof authorizer.signOut;
|
|
273
192
|
declare const signIn: typeof authorizer.signIn;
|
|
274
193
|
|
|
194
|
+
interface SignInResponse {
|
|
195
|
+
error: string | null;
|
|
196
|
+
status: number;
|
|
197
|
+
ok: boolean;
|
|
198
|
+
url: string | null;
|
|
199
|
+
}
|
|
200
|
+
type SSOButtonProps = {
|
|
201
|
+
callbackUrl?: string;
|
|
202
|
+
buttonText?: string;
|
|
203
|
+
init?: RequestInit;
|
|
204
|
+
baseUrl?: string;
|
|
205
|
+
fetchUrl?: string;
|
|
206
|
+
auth?: Authorizer | PartialAuthorizer;
|
|
207
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, res: SignInResponse | undefined) => void;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
type EmailError = void | {
|
|
211
|
+
error: string;
|
|
212
|
+
ok: boolean;
|
|
213
|
+
status: number;
|
|
214
|
+
url: null | string;
|
|
215
|
+
};
|
|
216
|
+
type AllProps = ButtonProps & SSOButtonProps & {
|
|
217
|
+
callbackUrl?: string;
|
|
218
|
+
redirect?: boolean;
|
|
219
|
+
email: string;
|
|
220
|
+
onSent?: () => void;
|
|
221
|
+
onFailure?: (error: EmailError) => void;
|
|
222
|
+
buttonText?: string;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* This works when the email identity provider is configured in the admin dashboard.
|
|
226
|
+
* @param props callbackUrl: the url to send the user to from their email
|
|
227
|
+
* @param props redirect: redirect to the default (unbranded) 'check your email' page. default is false
|
|
228
|
+
* @param props email: the email to send to
|
|
229
|
+
* @param props onSent: called if the email was sent
|
|
230
|
+
* @param props onFailure: called if there was a reportable
|
|
231
|
+
* @returns a JSX.Element to render
|
|
232
|
+
*/
|
|
233
|
+
declare const EmailSignInButton: {
|
|
234
|
+
({ callbackUrl, className, variant, size, asChild, redirect, buttonText, email, onFailure, onSent, fetchUrl, baseUrl, auth, ...props }: AllProps): React__default.JSX.Element;
|
|
235
|
+
displayName: string;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare function useEmailSignIn(params?: Props$5): _tanstack_react_query.UseMutateFunction<Response, Error, next_auth_react.SignInOptions, unknown>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* A component for a Google login button, according to their design language.
|
|
242
|
+
* This works when an identity provider is configured in the admin dashboard.
|
|
243
|
+
* @param props callbackUrl: a string to override the URL provided by the context
|
|
244
|
+
* @returns a JSX.Element to render
|
|
245
|
+
*/
|
|
246
|
+
declare const GoogleSSOButton: {
|
|
247
|
+
({ callbackUrl, className, variant, size, buttonText, asChild, init, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
248
|
+
displayName: string;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
declare const AzureSignInButton: {
|
|
252
|
+
({ callbackUrl, className, buttonText, variant, size, init, asChild, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
253
|
+
displayName: string;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
declare const DiscordSignInButton: {
|
|
257
|
+
({ callbackUrl, className, buttonText, variant, size, asChild, init, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
258
|
+
displayName: string;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
declare const GitHubSignInButton: {
|
|
262
|
+
({ callbackUrl, className, buttonText, variant, size, init, asChild, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
263
|
+
displayName: string;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
declare const HubSpotSignInButton: {
|
|
267
|
+
({ callbackUrl, className, buttonText, variant, size, init, asChild, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
268
|
+
displayName: string;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
declare const LinkedInSignInButton: {
|
|
272
|
+
({ callbackUrl, className, buttonText, variant, size, asChild, init, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
273
|
+
displayName: string;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
declare const SlackSignInButton: {
|
|
277
|
+
({ callbackUrl, className, buttonText, variant, size, init, asChild, ...props }: ButtonProps & {
|
|
278
|
+
callbackUrl?: string;
|
|
279
|
+
buttonText?: string;
|
|
280
|
+
init?: RequestInit;
|
|
281
|
+
}): React__default.JSX.Element;
|
|
282
|
+
displayName: string;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
declare const XSignInButton: {
|
|
286
|
+
({ callbackUrl, className, buttonText, variant, size, init, asChild, auth, fetchUrl, baseUrl, ...props }: ButtonProps & SSOButtonProps): React__default.JSX.Element;
|
|
287
|
+
displayName: string;
|
|
288
|
+
};
|
|
289
|
+
|
|
275
290
|
type ComponentFetchProps = {
|
|
276
291
|
auth?: Authorizer | PartialAuthorizer;
|
|
277
292
|
init?: RequestInit;
|
|
@@ -284,6 +299,12 @@ type PrefetchParams = {
|
|
|
284
299
|
fetchUrl?: string;
|
|
285
300
|
};
|
|
286
301
|
|
|
302
|
+
interface CreateBasicUserRequest {
|
|
303
|
+
email: string;
|
|
304
|
+
password: string;
|
|
305
|
+
preferredName?: string;
|
|
306
|
+
newTenant?: string;
|
|
307
|
+
}
|
|
287
308
|
type SignUpInfo = CreateBasicUserRequest & {
|
|
288
309
|
tenantId?: string;
|
|
289
310
|
fetchUrl?: string;
|
|
@@ -291,7 +312,7 @@ type SignUpInfo = CreateBasicUserRequest & {
|
|
|
291
312
|
newTenantName?: string;
|
|
292
313
|
};
|
|
293
314
|
type AllowedAny$2 = any;
|
|
294
|
-
type Props$
|
|
315
|
+
type Props$4 = PrefetchParams & {
|
|
295
316
|
onSuccess?: (response: Response, formValues: SignUpInfo) => void;
|
|
296
317
|
onError?: (e: Error, info: SignUpInfo) => void;
|
|
297
318
|
beforeMutate?: (data: AllowedAny$2) => AllowedAny$2;
|
|
@@ -302,9 +323,9 @@ type Props$3 = PrefetchParams & {
|
|
|
302
323
|
redirect?: boolean;
|
|
303
324
|
};
|
|
304
325
|
|
|
305
|
-
declare function SigningUp({ className, ...props }: Props$
|
|
326
|
+
declare function SigningUp({ className, ...props }: Props$4): React__default.JSX.Element;
|
|
306
327
|
|
|
307
|
-
declare function useSignUp<T extends SignUpInfo>(params: Props$
|
|
328
|
+
declare function useSignUp<T extends SignUpInfo>(params: Props$4, client?: QueryClient): _tanstack_react_query.UseMutateFunction<any, Error, SignUpInfo, unknown>;
|
|
308
329
|
|
|
309
330
|
type AllowedAny$1 = any;
|
|
310
331
|
type LoginInfo = {
|
|
@@ -312,7 +333,7 @@ type LoginInfo = {
|
|
|
312
333
|
password: string;
|
|
313
334
|
};
|
|
314
335
|
type LoginSuccess = (response: AllowedAny$1, formValues: LoginInfo, ...args: AllowedAny$1) => void;
|
|
315
|
-
type Props$
|
|
336
|
+
type Props$3 = ComponentFetchProps & {
|
|
316
337
|
beforeMutate?: (data: AllowedAny$1) => AllowedAny$1;
|
|
317
338
|
onSuccess?: LoginSuccess;
|
|
318
339
|
onError?: (error: Error, data: AllowedAny$1) => void;
|
|
@@ -323,18 +344,22 @@ type Props$2 = ComponentFetchProps & {
|
|
|
323
344
|
fetchUrl?: string;
|
|
324
345
|
};
|
|
325
346
|
|
|
326
|
-
declare function SigningIn({ className, ...props }: Props$
|
|
347
|
+
declare function SigningIn({ className, ...props }: Props$3): React__default.JSX.Element;
|
|
327
348
|
|
|
328
|
-
declare function useSignIn(params?: Props$
|
|
349
|
+
declare function useSignIn(params?: Props$3): _tanstack_react_query.UseMutateFunction<next_auth_react.SignInResponse | undefined, Error, LoginInfo, any>;
|
|
329
350
|
|
|
330
|
-
|
|
351
|
+
type Props$2 = ButtonProps & ComponentFetchProps & {
|
|
331
352
|
redirect?: boolean;
|
|
332
353
|
callbackUrl?: string;
|
|
333
354
|
buttonText?: string;
|
|
334
355
|
baseUrl?: string;
|
|
335
356
|
fetchUrl?: string;
|
|
336
357
|
basePath?: string;
|
|
337
|
-
}
|
|
358
|
+
};
|
|
359
|
+
declare const SignOutButton: {
|
|
360
|
+
({ callbackUrl, redirect, className, buttonText, variant, size, baseUrl, fetchUrl, basePath, auth, asChild, ...props }: Props$2): React__default.JSX.Element;
|
|
361
|
+
displayName: string;
|
|
362
|
+
};
|
|
338
363
|
|
|
339
364
|
interface SessionProviderProps {
|
|
340
365
|
children: React__default.ReactNode;
|
|
@@ -495,7 +520,7 @@ declare function ResetPasswordForm(params: Params): React__default.JSX.Element;
|
|
|
495
520
|
|
|
496
521
|
declare function useResetPassword(params?: Params): _tanstack_react_query.UseMutateFunction<Response, Error, MutateFnParams, unknown>;
|
|
497
522
|
|
|
498
|
-
declare const Email: () => React.JSX.Element;
|
|
499
|
-
declare const Password: () => React.JSX.Element;
|
|
523
|
+
declare const Email: () => React$1.JSX.Element;
|
|
524
|
+
declare const Password: () => React$1.JSX.Element;
|
|
500
525
|
|
|
501
526
|
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 };
|