@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/README.md
CHANGED
|
@@ -1,143 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img width="1434" alt="Screen Shot 2024-09-18 at 9 20 04 AM" src="https://github.com/user-attachments/assets/20585883-5cdc-4f15-93d3-dc150e87bc11">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
---
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
# Nile's React SDK
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
In the root of your react application, add a Nile provider. This will add a [QueryClientProvider](https://tanstack.com/query/v4/docs/quick-start) and a [CssVarsProvider](https://mui.com/joy-ui/getting-started/usage/) to your application.
|
|
9
|
+
This package (`@niledatabase/react`) is part of [Nile's Javascript SDK](https://github.com/niledatabase/nile-js/tree/main).
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
import { NileProvider } from '@niledatabase/react';
|
|
13
|
-
|
|
14
|
-
function App() {
|
|
15
|
-
return (
|
|
16
|
-
<NileProvider>
|
|
17
|
-
<div>Welcome to my great app</div>
|
|
18
|
-
</NileProvider>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
```
|
|
11
|
+
Nile's React package provides:
|
|
22
12
|
|
|
23
|
-
|
|
13
|
+
- 🎨 UI components for authentication, user management, and tenant management (customizable with Tailwind CSS)
|
|
14
|
+
- 🪝 React hooks for authentication, user management, and tenant management functionality
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
| -------- | -------- | ----------------------------------------------------------------- |
|
|
27
|
-
| tenantId | `string` | ID of the tenant associated. |
|
|
28
|
-
| appUrl | `string` | the FQDN for a service running a `@niledatabase/server`-like API. |
|
|
29
|
-
| apiUrl | `string` | the API URL of your database |
|
|
16
|
+
You can browse all the components and explore their properties in [Nile's documentation](https://www.thenile.dev/docs/auth/components/signin) or in [Storybook](https://storybook.thenile.dev).
|
|
30
17
|
|
|
31
|
-
|
|
18
|
+
The components and hooks are designed to work best and provide a secure user experience when used with the generated routes provided by [Nile's Server-Side SDK](https://www.npmjs.com/package/@niledatabase/server).
|
|
32
19
|
|
|
33
|
-
|
|
20
|
+
**Nile is a Postgres platform that decouples storage from compute, virtualizes tenants, and supports vertical and horizontal scaling globally to ship B2B applications fast while being safe with limitless scale.** All B2B applications are multi-tenant. A tenant/customer is primarily a company, an organization, or a workspace in your product that contains a group of users. A B2B application provides services to multiple tenants. Tenant is the basic building block of all B2B applications.
|
|
34
21
|
|
|
35
|
-
|
|
22
|
+
## Usage
|
|
36
23
|
|
|
37
|
-
|
|
38
|
-
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
24
|
+
### Installation
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
retry: false,
|
|
44
|
-
refetchOnWindowFocus: false,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
});
|
|
26
|
+
```bash
|
|
27
|
+
npm install @niledatabase/react
|
|
28
|
+
```
|
|
48
29
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
30
|
+
### Signup / User Info page
|
|
31
|
+
|
|
32
|
+
This example uses several components to build a one-page signup / user profile example.
|
|
33
|
+
|
|
34
|
+
- `<SignedIn>` component renders for authenticated users while `<SignedOut>` renders for un-authenticated users.
|
|
35
|
+
- `<SignUpForm>` component shows a standard email/password signup.
|
|
36
|
+
- `<UserInfo />` component shows information about currently authenticated user - their image, email, name, etc.
|
|
37
|
+
- `<TenantSelector>` component shows the current tenant, allows to switch between tenants and to create new tenants.
|
|
38
|
+
- `<SignOutButton />` component expires the current session
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import {
|
|
42
|
+
SignOutButton,
|
|
43
|
+
SignUpForm,
|
|
44
|
+
SignedIn,
|
|
45
|
+
SignedOut,
|
|
46
|
+
TenantSelector,
|
|
47
|
+
UserInfo,
|
|
48
|
+
} from "@niledatabase/react";
|
|
49
|
+
import "@niledatabase/react/styles.css";
|
|
50
|
+
|
|
51
|
+
export default function SignUpPage() {
|
|
52
|
+
return (
|
|
53
|
+
<div className="flex flex-col items-center justify-center min-h-screen">
|
|
54
|
+
<SignedIn className="flex flex-col gap-4">
|
|
55
|
+
<UserInfo />
|
|
56
|
+
<TenantSelector className="py-6 mb-10" />
|
|
57
|
+
<SignOutButton />
|
|
58
|
+
</SignedIn>
|
|
59
|
+
<SignedOut>
|
|
60
|
+
<SignUpForm createTenant />
|
|
61
|
+
</SignedOut>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
61
64
|
}
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
###
|
|
67
|
+
### Social Login (SSO)
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
Nile-Auth supports multiple social providers. You configure and enable them in [Nile console](https://console.thenile.dev), and then simply drop-in the components. For example, for Discord authentication:
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
```tsx
|
|
72
|
+
import { DiscordSignInButton } from '@niledatabase/react';
|
|
69
73
|
|
|
70
|
-
```typescript
|
|
71
74
|
function App() {
|
|
72
75
|
return (
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
</
|
|
76
|
+
<div>
|
|
77
|
+
<DiscordSignInButton callbackUrl="/" />
|
|
78
|
+
</div>
|
|
76
79
|
);
|
|
77
80
|
}
|
|
78
81
|
```
|
|
79
82
|
|
|
80
|
-
###
|
|
81
|
-
|
|
82
|
-
A method exposing the configuration created in `<NileProvider />`. The methods on the instance can be found in [the client src readme](../../lib/nile/src/README.md), or found in the auto-complete of visual studio code.
|
|
83
|
+
### Customizing the components
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
Nile’s react package includes a CSS file that you can use to provide a nice default style to the components:
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
```ts
|
|
88
|
+
import "@niledatabase/react/styles.css";
|
|
89
|
+
```
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
import React, { useEffect } from 'react';
|
|
90
|
-
import { useNile, Queries } from '@niledatabase/react';
|
|
91
|
-
import { useQuery } from '@tanstack/react-query';
|
|
91
|
+
Nile Auth components use CSS variables for theming. This means that you can override the colors and other styles by setting the CSS variables. We support the same CSS variables that [Shadcn uses](https://ui.shadcn.com/docs/theming#list-of-variables). You can modify them in your `global.css` file.
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
const nile = useNile();
|
|
95
|
-
const [users, setUsers] = useState();
|
|
96
|
-
const { data: users = [] } = useQuery(Queries.ListUsers, () => nile.users.listUsers());
|
|
97
|
-
// with multiple requests
|
|
98
|
-
// const [{ data: users = [] }, { data: invites = [] }] = useQueries([
|
|
99
|
-
// { queryKey: Queries.ListUsers, queryFn: () => nile.users.listUsers({}) },
|
|
100
|
-
// { queryKey: Queries.ListInvites, queryFn: () => nile.organizations.listInvites({}) },
|
|
101
|
-
// ]);
|
|
93
|
+
For "spot changes", you can use the `className` prop of a component to customize it individually:
|
|
102
94
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return <div id={user.id}>{`Email: ${user.email}`</div>;
|
|
106
|
-
})
|
|
107
|
-
);
|
|
108
|
-
}
|
|
95
|
+
```tsx
|
|
96
|
+
<SignOutButton className="bg-red-500" />
|
|
109
97
|
```
|
|
110
98
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
For theming and display, A combination of [mui joy](https://mui.com/joy-ui/getting-started/overview/) and [material ui](https://mui.com/material-ui/getting-started/overview/) is used. As joy approaches feature parity with material, it will be removed from this codebase. For now, there are helper functions in the theme to support both, with the theming function preferring mui joy settings and colors over material.
|
|
114
|
-
|
|
115
|
-
For details on theming, see their [theming documentation](https://mui.com/joy-ui/customization/approaches/). You can pass a custom `theme` object to the `NileProvider` and it will merge it with the combined material and joy themes in the `<NileProvider />`.
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
import { NileProvider } from '@niledatabase/react';
|
|
119
|
-
import { extendTheme } from '@mui/joy/styles';
|
|
120
|
-
const customTheme = extendTheme({
|
|
121
|
-
colorSchemes: {
|
|
122
|
-
light: {
|
|
123
|
-
palette: {
|
|
124
|
-
primary: {
|
|
125
|
-
solidBg: '#0078D4',
|
|
126
|
-
solidHoverBg: '#106EBE',
|
|
127
|
-
solidActiveBg: '#005A9E',
|
|
128
|
-
solidDisabledBg: '#F3F2F1',
|
|
129
|
-
solidDisabledColor: '#A19F9D',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
});
|
|
99
|
+
## Learn more
|
|
135
100
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<div>Welcome to my great app</div>
|
|
140
|
-
</NileProvider>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
```
|
|
101
|
+
- You can learn more about Nile and the SDK in [https://thenile.dev/docs]
|
|
102
|
+
- You can find detailed code examples in [our main repo](https://github.com/niledatabase/niledatabase)
|
|
103
|
+
- Nile SDK interacts with APIs in Nile Auth service. You can learn more about it in the [repository](https://github.com/niledatabase/nile-auth) and the [docs](https://thenile.dev/docs/auth)
|
package/dist/index.d.mts
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 };
|