@main12/auth-login 0.1.0 → 0.1.1
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/components/pages/ForgotPasswordPage.d.ts +1 -1
- package/dist/components/pages/ForgotPasswordPage.js +9 -42
- package/dist/components/pages/ForgotPasswordPageHero.d.ts +5 -0
- package/dist/components/pages/ForgotPasswordPageHero.js +69 -0
- package/dist/components/pages/ForgotPasswordPageTailwind.d.ts +5 -0
- package/dist/components/pages/ForgotPasswordPageTailwind.js +45 -0
- package/dist/components/pages/LoginPage.js +8 -218
- package/dist/components/pages/LoginPageHero.d.ts +11 -0
- package/dist/components/pages/LoginPageHero.js +298 -0
- package/dist/components/pages/LoginPageTailwind.d.ts +11 -0
- package/dist/components/pages/LoginPageTailwind.js +222 -0
- package/dist/components/pages/SetPasswordPage.d.ts +1 -1
- package/dist/components/pages/SetPasswordPage.js +9 -71
- package/dist/components/pages/SetPasswordPageHero.d.ts +5 -0
- package/dist/components/pages/SetPasswordPageHero.js +93 -0
- package/dist/components/pages/SetPasswordPageTailwind.d.ts +5 -0
- package/dist/components/pages/SetPasswordPageTailwind.js +74 -0
- package/dist/components/pages/SignupPage.d.ts +1 -1
- package/dist/components/pages/SignupPage.js +9 -126
- package/dist/components/pages/SignupPageHero.d.ts +10 -0
- package/dist/components/pages/SignupPageHero.js +150 -0
- package/dist/components/pages/SignupPageTailwind.d.ts +10 -0
- package/dist/components/pages/SignupPageTailwind.js +129 -0
- package/dist/components/pages/VerifyOtpPage.js +8 -83
- package/dist/components/pages/VerifyOtpPageHero.d.ts +5 -0
- package/dist/components/pages/VerifyOtpPageHero.js +104 -0
- package/dist/components/pages/VerifyOtpPageTailwind.d.ts +5 -0
- package/dist/components/pages/VerifyOtpPageTailwind.js +87 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +6 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -1
- package/package.json +5 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button, Input } from '@heroui/react';
|
|
5
|
+
import { Icon } from '@iconify/react';
|
|
6
|
+
import { motion } from 'framer-motion';
|
|
7
|
+
import { useSetPasswordFlow } from '../../auth/application/hooks/useSetPasswordFlow.js';
|
|
8
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
9
|
+
export default function SetPasswordPageHero({ redirectTo = '/', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
10
|
+
const { password, confirmPassword, error, isLoading, showPassword, strength, setPassword, setConfirmPassword, setShowPassword, handleSubmit } = useSetPasswordFlow({
|
|
11
|
+
redirectTo
|
|
12
|
+
});
|
|
13
|
+
const bars = Array.from({
|
|
14
|
+
length: 5
|
|
15
|
+
}, (_, i)=>i < strength.score);
|
|
16
|
+
return /*#__PURE__*/ _jsx(AuthLayout, {
|
|
17
|
+
logo: logo,
|
|
18
|
+
title: "Set Your Password",
|
|
19
|
+
subtitle: "Create a secure password for your account",
|
|
20
|
+
poweredBy: poweredBy,
|
|
21
|
+
cardClassName: cardClassName,
|
|
22
|
+
backgroundClass: backgroundClass,
|
|
23
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
24
|
+
onSubmit: handleSubmit,
|
|
25
|
+
className: "space-y-4",
|
|
26
|
+
children: [
|
|
27
|
+
error && /*#__PURE__*/ _jsx(motion.div, {
|
|
28
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
|
|
29
|
+
initial: {
|
|
30
|
+
opacity: 0
|
|
31
|
+
},
|
|
32
|
+
animate: {
|
|
33
|
+
opacity: 1
|
|
34
|
+
},
|
|
35
|
+
children: error
|
|
36
|
+
}),
|
|
37
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
38
|
+
type: showPassword ? 'text' : 'password',
|
|
39
|
+
label: "New Password",
|
|
40
|
+
value: password,
|
|
41
|
+
onValueChange: setPassword,
|
|
42
|
+
variant: "bordered",
|
|
43
|
+
size: "lg",
|
|
44
|
+
isRequired: true,
|
|
45
|
+
autoFocus: true,
|
|
46
|
+
classNames: {
|
|
47
|
+
input: 'text-gray-900',
|
|
48
|
+
label: 'text-gray-600',
|
|
49
|
+
inputWrapper: 'border-gray-300 bg-white'
|
|
50
|
+
},
|
|
51
|
+
endContent: /*#__PURE__*/ _jsx("button", {
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick: ()=>setShowPassword(!showPassword),
|
|
54
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
55
|
+
icon: showPassword ? 'lucide:eye-off' : 'lucide:eye',
|
|
56
|
+
className: "text-gray-400",
|
|
57
|
+
width: 20
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
password.length > 0 && /*#__PURE__*/ _jsx("div", {
|
|
62
|
+
className: "flex gap-1",
|
|
63
|
+
children: bars.map((a, i)=>/*#__PURE__*/ _jsx("div", {
|
|
64
|
+
className: `h-1 flex-1 rounded-full ${a ? 'bg-[#D5E855]' : 'bg-gray-200'}`
|
|
65
|
+
}, i))
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
68
|
+
type: showPassword ? 'text' : 'password',
|
|
69
|
+
label: "Confirm Password",
|
|
70
|
+
value: confirmPassword,
|
|
71
|
+
onValueChange: setConfirmPassword,
|
|
72
|
+
variant: "bordered",
|
|
73
|
+
size: "lg",
|
|
74
|
+
isRequired: true,
|
|
75
|
+
classNames: {
|
|
76
|
+
input: 'text-gray-900',
|
|
77
|
+
label: 'text-gray-600',
|
|
78
|
+
inputWrapper: 'border-gray-300 bg-white'
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
82
|
+
type: "submit",
|
|
83
|
+
fullWidth: true,
|
|
84
|
+
size: "lg",
|
|
85
|
+
color: "primary",
|
|
86
|
+
isLoading: isLoading,
|
|
87
|
+
className: "h-12 font-semibold",
|
|
88
|
+
children: "Set Password"
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
2
|
+
export interface SetPasswordPageProps extends AuthLayoutConfig {
|
|
3
|
+
redirectTo?: string;
|
|
4
|
+
}
|
|
5
|
+
export default function SetPasswordPage({ redirectTo, logo, poweredBy, cardClassName, backgroundClass, }: SetPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button, Input } from '../ui/index.js';
|
|
5
|
+
import { useSetPasswordFlow } from '../../auth/application/hooks/useSetPasswordFlow.js';
|
|
6
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
7
|
+
export default function SetPasswordPage({ redirectTo = '/', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
8
|
+
const { password, confirmPassword, error, isLoading, showPassword, strength, setPassword, setConfirmPassword, setShowPassword, handleSubmit } = useSetPasswordFlow({
|
|
9
|
+
redirectTo
|
|
10
|
+
});
|
|
11
|
+
const strengthBars = Array.from({
|
|
12
|
+
length: 5
|
|
13
|
+
}, (_, i)=>i < strength.score);
|
|
14
|
+
return /*#__PURE__*/ _jsx(AuthLayout, {
|
|
15
|
+
logo: logo,
|
|
16
|
+
title: "Set Your Password",
|
|
17
|
+
subtitle: "Create a secure password for your account",
|
|
18
|
+
poweredBy: poweredBy,
|
|
19
|
+
cardClassName: cardClassName,
|
|
20
|
+
backgroundClass: backgroundClass,
|
|
21
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
22
|
+
onSubmit: handleSubmit,
|
|
23
|
+
className: "space-y-4",
|
|
24
|
+
children: [
|
|
25
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
26
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
|
|
27
|
+
children: error
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
30
|
+
className: "relative",
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
33
|
+
type: showPassword ? 'text' : 'password',
|
|
34
|
+
label: "New Password",
|
|
35
|
+
value: password,
|
|
36
|
+
onValueChange: setPassword,
|
|
37
|
+
isRequired: true,
|
|
38
|
+
autoFocus: true
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ _jsx("button", {
|
|
41
|
+
type: "button",
|
|
42
|
+
onClick: ()=>setShowPassword(!showPassword),
|
|
43
|
+
className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
|
|
44
|
+
children: showPassword ? '🙈' : '👁'
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
password.length > 0 && /*#__PURE__*/ _jsx("div", {
|
|
49
|
+
className: "flex gap-1",
|
|
50
|
+
children: strengthBars.map((active, i)=>/*#__PURE__*/ _jsx("div", {
|
|
51
|
+
className: `h-1 flex-1 rounded-full ${active ? 'bg-[#D5E855]' : 'bg-gray-200'}`
|
|
52
|
+
}, i))
|
|
53
|
+
}),
|
|
54
|
+
password.length > 0 && !strength.isValid && /*#__PURE__*/ _jsx("p", {
|
|
55
|
+
className: "text-xs text-gray-500",
|
|
56
|
+
children: "At least 8 chars with 3 of: uppercase, lowercase, number, special character"
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
59
|
+
type: showPassword ? 'text' : 'password',
|
|
60
|
+
label: "Confirm Password",
|
|
61
|
+
value: confirmPassword,
|
|
62
|
+
onValueChange: setConfirmPassword,
|
|
63
|
+
isRequired: true
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
66
|
+
type: "submit",
|
|
67
|
+
variant: "primary",
|
|
68
|
+
isLoading: isLoading,
|
|
69
|
+
children: "Set Password"
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -7,4 +7,4 @@ export interface SignupPageProps extends AuthLayoutConfig {
|
|
|
7
7
|
showGoogleOAuth?: boolean;
|
|
8
8
|
loginUrl?: string;
|
|
9
9
|
}
|
|
10
|
-
export default function SignupPage(
|
|
10
|
+
export default function SignupPage(props: SignupPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,129 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export default function SignupPage(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const handleSubmit = async (e)=>{
|
|
12
|
-
e.preventDefault();
|
|
13
|
-
setIsLoading(true);
|
|
14
|
-
setError(null);
|
|
15
|
-
try {
|
|
16
|
-
await onSignup({
|
|
17
|
-
name,
|
|
18
|
-
email
|
|
19
|
-
});
|
|
20
|
-
window.location.href = `/verify-otp?email=${encodeURIComponent(email)}&purpose=signup`;
|
|
21
|
-
} catch (err) {
|
|
22
|
-
setError(err.message || 'Signup failed');
|
|
23
|
-
} finally{
|
|
24
|
-
setIsLoading(false);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return /*#__PURE__*/ _jsxs(AuthLayout, {
|
|
28
|
-
logo: logo,
|
|
29
|
-
title: "Create Account",
|
|
30
|
-
subtitle: "Enter your details to get started",
|
|
31
|
-
poweredBy: poweredBy,
|
|
32
|
-
cardClassName: cardClassName,
|
|
33
|
-
backgroundClass: backgroundClass,
|
|
34
|
-
footer: /*#__PURE__*/ _jsxs("p", {
|
|
35
|
-
className: "text-center text-gray-600 text-sm",
|
|
36
|
-
children: [
|
|
37
|
-
"Already have an account?",
|
|
38
|
-
' ',
|
|
39
|
-
/*#__PURE__*/ _jsx("a", {
|
|
40
|
-
href: loginUrl,
|
|
41
|
-
className: "text-gray-900 font-medium hover:underline",
|
|
42
|
-
children: "Sign in"
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
}),
|
|
46
|
-
children: [
|
|
47
|
-
showGoogleOAuth && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
48
|
-
children: [
|
|
49
|
-
/*#__PURE__*/ _jsxs(Button, {
|
|
50
|
-
fullWidth: true,
|
|
51
|
-
variant: "bordered",
|
|
52
|
-
size: "lg",
|
|
53
|
-
className: "mb-4",
|
|
54
|
-
children: [
|
|
55
|
-
/*#__PURE__*/ _jsx("span", {
|
|
56
|
-
className: "text-lg",
|
|
57
|
-
children: "G"
|
|
58
|
-
}),
|
|
59
|
-
" Continue with Google"
|
|
60
|
-
]
|
|
61
|
-
}),
|
|
62
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
63
|
-
className: "flex items-center gap-4 my-4",
|
|
64
|
-
children: [
|
|
65
|
-
/*#__PURE__*/ _jsx(Divider, {
|
|
66
|
-
className: "flex-1"
|
|
67
|
-
}),
|
|
68
|
-
/*#__PURE__*/ _jsx("span", {
|
|
69
|
-
className: "text-gray-500 text-sm",
|
|
70
|
-
children: "or"
|
|
71
|
-
}),
|
|
72
|
-
/*#__PURE__*/ _jsx(Divider, {
|
|
73
|
-
className: "flex-1"
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
}),
|
|
79
|
-
/*#__PURE__*/ _jsxs("form", {
|
|
80
|
-
onSubmit: handleSubmit,
|
|
81
|
-
className: "space-y-4",
|
|
82
|
-
children: [
|
|
83
|
-
error && /*#__PURE__*/ _jsx("div", {
|
|
84
|
-
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
|
|
85
|
-
children: error
|
|
86
|
-
}),
|
|
87
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
88
|
-
label: "Full Name",
|
|
89
|
-
value: name,
|
|
90
|
-
onValueChange: setName,
|
|
91
|
-
isRequired: true
|
|
92
|
-
}),
|
|
93
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
94
|
-
type: "email",
|
|
95
|
-
label: "Email",
|
|
96
|
-
value: email,
|
|
97
|
-
onValueChange: setEmail,
|
|
98
|
-
isRequired: true
|
|
99
|
-
}),
|
|
100
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
101
|
-
className: "text-xs text-gray-600 text-center",
|
|
102
|
-
children: [
|
|
103
|
-
"By signing up, you agree to our",
|
|
104
|
-
' ',
|
|
105
|
-
/*#__PURE__*/ _jsx("a", {
|
|
106
|
-
href: "/terms",
|
|
107
|
-
className: "text-gray-900 hover:underline",
|
|
108
|
-
children: "Terms of Service"
|
|
109
|
-
}),
|
|
110
|
-
" and",
|
|
111
|
-
' ',
|
|
112
|
-
/*#__PURE__*/ _jsx("a", {
|
|
113
|
-
href: "/privacy",
|
|
114
|
-
className: "text-gray-900 hover:underline",
|
|
115
|
-
children: "Privacy Policy"
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
}),
|
|
119
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
120
|
-
type: "submit",
|
|
121
|
-
variant: "primary",
|
|
122
|
-
isLoading: isLoading,
|
|
123
|
-
children: "Create Account"
|
|
124
|
-
})
|
|
125
|
-
]
|
|
126
|
-
})
|
|
127
|
-
]
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { pluginConfig } from '../../config.js';
|
|
4
|
+
import SignupPageTailwind from './SignupPageTailwind.js';
|
|
5
|
+
import SignupPageHero from './SignupPageHero.js';
|
|
6
|
+
export default function SignupPage(props) {
|
|
7
|
+
return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(SignupPageHero, {
|
|
8
|
+
...props
|
|
9
|
+
}) : /*#__PURE__*/ _jsx(SignupPageTailwind, {
|
|
10
|
+
...props
|
|
128
11
|
});
|
|
129
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
2
|
+
export interface SignupPageHeroProps extends AuthLayoutConfig {
|
|
3
|
+
onSignup: (data: {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
showGoogleOAuth?: boolean;
|
|
8
|
+
loginUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function SignupPageHero({ onSignup, showGoogleOAuth, loginUrl, logo, poweredBy, cardClassName, backgroundClass }: SignupPageHeroProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button, Input, Divider } from '@heroui/react';
|
|
5
|
+
import { Icon } from '@iconify/react';
|
|
6
|
+
import { motion } from 'framer-motion';
|
|
7
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
8
|
+
export default function SignupPageHero({ onSignup, showGoogleOAuth = true, loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
9
|
+
const [name, setName] = React.useState('');
|
|
10
|
+
const [email, setEmail] = React.useState('');
|
|
11
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
12
|
+
const [error, setError] = React.useState(null);
|
|
13
|
+
const handleSubmit = async (e)=>{
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
setIsLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
try {
|
|
18
|
+
await onSignup({
|
|
19
|
+
name,
|
|
20
|
+
email
|
|
21
|
+
});
|
|
22
|
+
window.location.href = `/verify-otp?email=${encodeURIComponent(email)}&purpose=signup`;
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setError(err.message || 'Signup failed');
|
|
25
|
+
} finally{
|
|
26
|
+
setIsLoading(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/ _jsxs(AuthLayout, {
|
|
30
|
+
logo: logo,
|
|
31
|
+
title: "Create Account",
|
|
32
|
+
subtitle: "Enter your details to get started",
|
|
33
|
+
poweredBy: poweredBy,
|
|
34
|
+
cardClassName: cardClassName,
|
|
35
|
+
backgroundClass: backgroundClass,
|
|
36
|
+
footer: /*#__PURE__*/ _jsxs("p", {
|
|
37
|
+
className: "text-center text-gray-600 text-sm",
|
|
38
|
+
children: [
|
|
39
|
+
"Already have an account? ",
|
|
40
|
+
/*#__PURE__*/ _jsx("a", {
|
|
41
|
+
href: loginUrl,
|
|
42
|
+
className: "text-gray-900 font-medium hover:underline",
|
|
43
|
+
children: "Sign in"
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
}),
|
|
47
|
+
children: [
|
|
48
|
+
showGoogleOAuth && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
51
|
+
fullWidth: true,
|
|
52
|
+
variant: "bordered",
|
|
53
|
+
size: "lg",
|
|
54
|
+
className: "mb-4 h-12 border-gray-300 rounded-full text-gray-700 hover:bg-gray-50",
|
|
55
|
+
startContent: /*#__PURE__*/ _jsx(Icon, {
|
|
56
|
+
icon: "flat-color-icons:google",
|
|
57
|
+
width: 20
|
|
58
|
+
}),
|
|
59
|
+
children: "Continue with Google"
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
62
|
+
className: "flex items-center gap-4 my-4",
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
65
|
+
className: "flex-1"
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx("span", {
|
|
68
|
+
className: "text-gray-500 text-sm",
|
|
69
|
+
children: "or"
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
72
|
+
className: "flex-1"
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
79
|
+
onSubmit: handleSubmit,
|
|
80
|
+
className: "space-y-4",
|
|
81
|
+
children: [
|
|
82
|
+
error && /*#__PURE__*/ _jsx(motion.div, {
|
|
83
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
|
|
84
|
+
initial: {
|
|
85
|
+
opacity: 0
|
|
86
|
+
},
|
|
87
|
+
animate: {
|
|
88
|
+
opacity: 1
|
|
89
|
+
},
|
|
90
|
+
children: error
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
93
|
+
type: "text",
|
|
94
|
+
label: "Full Name",
|
|
95
|
+
value: name,
|
|
96
|
+
onValueChange: setName,
|
|
97
|
+
variant: "bordered",
|
|
98
|
+
size: "lg",
|
|
99
|
+
isRequired: true,
|
|
100
|
+
classNames: {
|
|
101
|
+
input: 'text-gray-900',
|
|
102
|
+
label: 'text-gray-600',
|
|
103
|
+
inputWrapper: 'border-gray-300 bg-white'
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
107
|
+
type: "email",
|
|
108
|
+
label: "Email",
|
|
109
|
+
value: email,
|
|
110
|
+
onValueChange: setEmail,
|
|
111
|
+
variant: "bordered",
|
|
112
|
+
size: "lg",
|
|
113
|
+
isRequired: true,
|
|
114
|
+
classNames: {
|
|
115
|
+
input: 'text-gray-900',
|
|
116
|
+
label: 'text-gray-600',
|
|
117
|
+
inputWrapper: 'border-gray-300 bg-white'
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
121
|
+
className: "text-xs text-gray-600 text-center",
|
|
122
|
+
children: [
|
|
123
|
+
"By signing up, you agree to our ",
|
|
124
|
+
/*#__PURE__*/ _jsx("a", {
|
|
125
|
+
href: "/terms",
|
|
126
|
+
className: "text-gray-900 hover:underline",
|
|
127
|
+
children: "Terms"
|
|
128
|
+
}),
|
|
129
|
+
" and ",
|
|
130
|
+
/*#__PURE__*/ _jsx("a", {
|
|
131
|
+
href: "/privacy",
|
|
132
|
+
className: "text-gray-900 hover:underline",
|
|
133
|
+
children: "Privacy"
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
138
|
+
type: "submit",
|
|
139
|
+
fullWidth: true,
|
|
140
|
+
size: "lg",
|
|
141
|
+
color: "primary",
|
|
142
|
+
isLoading: isLoading,
|
|
143
|
+
className: "h-12 font-semibold",
|
|
144
|
+
children: "Create Account"
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuthLayoutConfig } from '../AuthLayout.js';
|
|
2
|
+
export interface SignupPageProps extends AuthLayoutConfig {
|
|
3
|
+
onSignup: (data: {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
showGoogleOAuth?: boolean;
|
|
8
|
+
loginUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function SignupPage({ onSignup, showGoogleOAuth, loginUrl, logo, poweredBy, cardClassName, backgroundClass, }: SignupPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Button, Input, Divider } from '../ui/index.js';
|
|
5
|
+
import { AuthLayout } from '../AuthLayout.js';
|
|
6
|
+
export default function SignupPage({ onSignup, showGoogleOAuth = true, loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass }) {
|
|
7
|
+
const [name, setName] = React.useState('');
|
|
8
|
+
const [email, setEmail] = React.useState('');
|
|
9
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
10
|
+
const [error, setError] = React.useState(null);
|
|
11
|
+
const handleSubmit = async (e)=>{
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
setIsLoading(true);
|
|
14
|
+
setError(null);
|
|
15
|
+
try {
|
|
16
|
+
await onSignup({
|
|
17
|
+
name,
|
|
18
|
+
email
|
|
19
|
+
});
|
|
20
|
+
window.location.href = `/verify-otp?email=${encodeURIComponent(email)}&purpose=signup`;
|
|
21
|
+
} catch (err) {
|
|
22
|
+
setError(err.message || 'Signup failed');
|
|
23
|
+
} finally{
|
|
24
|
+
setIsLoading(false);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/ _jsxs(AuthLayout, {
|
|
28
|
+
logo: logo,
|
|
29
|
+
title: "Create Account",
|
|
30
|
+
subtitle: "Enter your details to get started",
|
|
31
|
+
poweredBy: poweredBy,
|
|
32
|
+
cardClassName: cardClassName,
|
|
33
|
+
backgroundClass: backgroundClass,
|
|
34
|
+
footer: /*#__PURE__*/ _jsxs("p", {
|
|
35
|
+
className: "text-center text-gray-600 text-sm",
|
|
36
|
+
children: [
|
|
37
|
+
"Already have an account?",
|
|
38
|
+
' ',
|
|
39
|
+
/*#__PURE__*/ _jsx("a", {
|
|
40
|
+
href: loginUrl,
|
|
41
|
+
className: "text-gray-900 font-medium hover:underline",
|
|
42
|
+
children: "Sign in"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
children: [
|
|
47
|
+
showGoogleOAuth && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsxs(Button, {
|
|
50
|
+
fullWidth: true,
|
|
51
|
+
variant: "bordered",
|
|
52
|
+
size: "lg",
|
|
53
|
+
className: "mb-4",
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ _jsx("span", {
|
|
56
|
+
className: "text-lg",
|
|
57
|
+
children: "G"
|
|
58
|
+
}),
|
|
59
|
+
" Continue with Google"
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
63
|
+
className: "flex items-center gap-4 my-4",
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
66
|
+
className: "flex-1"
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsx("span", {
|
|
69
|
+
className: "text-gray-500 text-sm",
|
|
70
|
+
children: "or"
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
73
|
+
className: "flex-1"
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
80
|
+
onSubmit: handleSubmit,
|
|
81
|
+
className: "space-y-4",
|
|
82
|
+
children: [
|
|
83
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
84
|
+
className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
|
|
85
|
+
children: error
|
|
86
|
+
}),
|
|
87
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
88
|
+
label: "Full Name",
|
|
89
|
+
value: name,
|
|
90
|
+
onValueChange: setName,
|
|
91
|
+
isRequired: true
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
94
|
+
type: "email",
|
|
95
|
+
label: "Email",
|
|
96
|
+
value: email,
|
|
97
|
+
onValueChange: setEmail,
|
|
98
|
+
isRequired: true
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
101
|
+
className: "text-xs text-gray-600 text-center",
|
|
102
|
+
children: [
|
|
103
|
+
"By signing up, you agree to our",
|
|
104
|
+
' ',
|
|
105
|
+
/*#__PURE__*/ _jsx("a", {
|
|
106
|
+
href: "/terms",
|
|
107
|
+
className: "text-gray-900 hover:underline",
|
|
108
|
+
children: "Terms of Service"
|
|
109
|
+
}),
|
|
110
|
+
" and",
|
|
111
|
+
' ',
|
|
112
|
+
/*#__PURE__*/ _jsx("a", {
|
|
113
|
+
href: "/privacy",
|
|
114
|
+
className: "text-gray-900 hover:underline",
|
|
115
|
+
children: "Privacy Policy"
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
120
|
+
type: "submit",
|
|
121
|
+
variant: "primary",
|
|
122
|
+
isLoading: isLoading,
|
|
123
|
+
children: "Create Account"
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
}
|