@niledatabase/react 3.0.0-alpha.36 → 3.0.0-alpha.38

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 CHANGED
@@ -1,21 +1,62 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
4
- import { VariantProps } from 'class-variance-authority';
5
- import { CreateBasicUserRequest } from '@niledatabase/browser';
6
3
  import * as _tanstack_react_query from '@tanstack/react-query';
7
4
  import { QueryClient } from '@tanstack/react-query';
8
5
  import * as next_auth_react from 'next-auth/react';
9
- export * from 'next-auth/react';
6
+ import { SignInOptions } from 'next-auth/react';
7
+ export { signIn, signOut } from 'next-auth/react';
8
+ import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
9
+ import { VariantProps } from 'class-variance-authority';
10
+ import { CreateBasicUserRequest } from '@niledatabase/browser';
11
+
12
+ type EmailSignInInfo = SignInOptions;
13
+ type SignInSuccess$1 = (response: Response) => void;
14
+ type AllowedAny$2 = any;
15
+ interface Props$2 {
16
+ redirect?: boolean;
17
+ onSuccess?: SignInSuccess$1;
18
+ onError?: (e: Error, info: EmailSignInInfo) => void;
19
+ beforeMutate?: (data: AllowedAny$2) => AllowedAny$2;
20
+ buttonText?: string;
21
+ client?: QueryClient;
22
+ callbackUrl?: string;
23
+ }
24
+
25
+ declare function EmailSigningIn(props: Props$2): React__default.JSX.Element;
10
26
 
11
27
  declare const buttonVariants: (props?: ({
12
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
28
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
13
29
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
14
30
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
15
31
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
16
32
  asChild?: boolean;
17
33
  }
18
34
 
35
+ type EmailError = void | {
36
+ error: string;
37
+ ok: boolean;
38
+ status: number;
39
+ url: null | string;
40
+ };
41
+ /**
42
+ * This works when the email identity provider is configured in the admin dashboard.
43
+ * @param props callbackUrl: the url to send the user to from their email
44
+ * @param props redirect: redirect to the default (unbranded) 'check your email' page. default is false
45
+ * @param props email: the email to send to
46
+ * @param props onSent: called if the email was sent
47
+ * @param props onFailure: called if there was a reportable
48
+ * @returns a JSX.Element to render
49
+ */
50
+ declare const EmailSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
51
+ callbackUrl?: string;
52
+ redirect?: boolean;
53
+ email: string;
54
+ onSent?: () => void;
55
+ onFailure?: (error: EmailError) => void;
56
+ } & React__default.RefAttributes<HTMLButtonElement>>;
57
+
58
+ declare function useSignIn$1(params?: Props$2): _tanstack_react_query.UseMutateFunction<Response, Error, next_auth_react.SignInOptions, unknown>;
59
+
19
60
  /**
20
61
  * A component for a Google login button, according to their design language.
21
62
  * This works when an identity provider is configured in the admin dashboard.
@@ -23,7 +64,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Var
23
64
  * @returns a JSX.Element to render
24
65
  */
25
66
  declare const GoogleSSOButton: React__default.ForwardRefExoticComponent<ButtonProps & {
26
- callbackUrl: string;
67
+ callbackUrl?: string;
27
68
  } & React__default.RefAttributes<HTMLButtonElement>>;
28
69
 
29
70
  type SignUpInfo = CreateBasicUserRequest & {
@@ -35,7 +76,7 @@ type SignUpInfo = CreateBasicUserRequest & {
35
76
  type SignInSuccess = (response: Response, formValues: SignUpInfo) => void;
36
77
  type AllowedAny$1 = any;
37
78
  interface Props$1 {
38
- onSuccess: SignInSuccess;
79
+ onSuccess?: SignInSuccess;
39
80
  onError?: (e: Error, info: SignUpInfo) => void;
40
81
  beforeMutate?: (data: AllowedAny$1) => AllowedAny$1;
41
82
  buttonText?: string;
@@ -68,4 +109,4 @@ declare function useSignIn(params?: Props): _tanstack_react_query.UseMutateFunct
68
109
  declare const Email: () => React.JSX.Element;
69
110
  declare const Password: () => React.JSX.Element;
70
111
 
71
- export { Email, GoogleSSOButton as Google, Password, SigningIn as SignInForm, SigningUp as SignUpForm, useSignIn, useSignUp };
112
+ export { Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GoogleSSOButton as Google, Password, SigningIn as SignInForm, SigningUp as SignUpForm, useSignIn$1 as useEmailSignIn, useSignIn, useSignUp };
package/dist/index.d.ts CHANGED
@@ -1,21 +1,62 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
4
- import { VariantProps } from 'class-variance-authority';
5
- import { CreateBasicUserRequest } from '@niledatabase/browser';
6
3
  import * as _tanstack_react_query from '@tanstack/react-query';
7
4
  import { QueryClient } from '@tanstack/react-query';
8
5
  import * as next_auth_react from 'next-auth/react';
9
- export * from 'next-auth/react';
6
+ import { SignInOptions } from 'next-auth/react';
7
+ export { signIn, signOut } from 'next-auth/react';
8
+ import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
9
+ import { VariantProps } from 'class-variance-authority';
10
+ import { CreateBasicUserRequest } from '@niledatabase/browser';
11
+
12
+ type EmailSignInInfo = SignInOptions;
13
+ type SignInSuccess$1 = (response: Response) => void;
14
+ type AllowedAny$2 = any;
15
+ interface Props$2 {
16
+ redirect?: boolean;
17
+ onSuccess?: SignInSuccess$1;
18
+ onError?: (e: Error, info: EmailSignInInfo) => void;
19
+ beforeMutate?: (data: AllowedAny$2) => AllowedAny$2;
20
+ buttonText?: string;
21
+ client?: QueryClient;
22
+ callbackUrl?: string;
23
+ }
24
+
25
+ declare function EmailSigningIn(props: Props$2): React__default.JSX.Element;
10
26
 
11
27
  declare const buttonVariants: (props?: ({
12
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
28
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
13
29
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
14
30
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
15
31
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
16
32
  asChild?: boolean;
17
33
  }
18
34
 
35
+ type EmailError = void | {
36
+ error: string;
37
+ ok: boolean;
38
+ status: number;
39
+ url: null | string;
40
+ };
41
+ /**
42
+ * This works when the email identity provider is configured in the admin dashboard.
43
+ * @param props callbackUrl: the url to send the user to from their email
44
+ * @param props redirect: redirect to the default (unbranded) 'check your email' page. default is false
45
+ * @param props email: the email to send to
46
+ * @param props onSent: called if the email was sent
47
+ * @param props onFailure: called if there was a reportable
48
+ * @returns a JSX.Element to render
49
+ */
50
+ declare const EmailSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
51
+ callbackUrl?: string;
52
+ redirect?: boolean;
53
+ email: string;
54
+ onSent?: () => void;
55
+ onFailure?: (error: EmailError) => void;
56
+ } & React__default.RefAttributes<HTMLButtonElement>>;
57
+
58
+ declare function useSignIn$1(params?: Props$2): _tanstack_react_query.UseMutateFunction<Response, Error, next_auth_react.SignInOptions, unknown>;
59
+
19
60
  /**
20
61
  * A component for a Google login button, according to their design language.
21
62
  * This works when an identity provider is configured in the admin dashboard.
@@ -23,7 +64,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Var
23
64
  * @returns a JSX.Element to render
24
65
  */
25
66
  declare const GoogleSSOButton: React__default.ForwardRefExoticComponent<ButtonProps & {
26
- callbackUrl: string;
67
+ callbackUrl?: string;
27
68
  } & React__default.RefAttributes<HTMLButtonElement>>;
28
69
 
29
70
  type SignUpInfo = CreateBasicUserRequest & {
@@ -35,7 +76,7 @@ type SignUpInfo = CreateBasicUserRequest & {
35
76
  type SignInSuccess = (response: Response, formValues: SignUpInfo) => void;
36
77
  type AllowedAny$1 = any;
37
78
  interface Props$1 {
38
- onSuccess: SignInSuccess;
79
+ onSuccess?: SignInSuccess;
39
80
  onError?: (e: Error, info: SignUpInfo) => void;
40
81
  beforeMutate?: (data: AllowedAny$1) => AllowedAny$1;
41
82
  buttonText?: string;
@@ -68,4 +109,4 @@ declare function useSignIn(params?: Props): _tanstack_react_query.UseMutateFunct
68
109
  declare const Email: () => React.JSX.Element;
69
110
  declare const Password: () => React.JSX.Element;
70
111
 
71
- export { Email, GoogleSSOButton as Google, Password, SigningIn as SignInForm, SigningUp as SignUpForm, useSignIn, useSignUp };
112
+ export { Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GoogleSSOButton as Google, Password, SigningIn as SignInForm, SigningUp as SignUpForm, useSignIn$1 as useEmailSignIn, useSignIn, useSignUp };