@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.
Files changed (33) hide show
  1. package/dist/components/pages/ForgotPasswordPage.d.ts +1 -1
  2. package/dist/components/pages/ForgotPasswordPage.js +9 -42
  3. package/dist/components/pages/ForgotPasswordPageHero.d.ts +5 -0
  4. package/dist/components/pages/ForgotPasswordPageHero.js +69 -0
  5. package/dist/components/pages/ForgotPasswordPageTailwind.d.ts +5 -0
  6. package/dist/components/pages/ForgotPasswordPageTailwind.js +45 -0
  7. package/dist/components/pages/LoginPage.js +8 -218
  8. package/dist/components/pages/LoginPageHero.d.ts +11 -0
  9. package/dist/components/pages/LoginPageHero.js +298 -0
  10. package/dist/components/pages/LoginPageTailwind.d.ts +11 -0
  11. package/dist/components/pages/LoginPageTailwind.js +222 -0
  12. package/dist/components/pages/SetPasswordPage.d.ts +1 -1
  13. package/dist/components/pages/SetPasswordPage.js +9 -71
  14. package/dist/components/pages/SetPasswordPageHero.d.ts +5 -0
  15. package/dist/components/pages/SetPasswordPageHero.js +93 -0
  16. package/dist/components/pages/SetPasswordPageTailwind.d.ts +5 -0
  17. package/dist/components/pages/SetPasswordPageTailwind.js +74 -0
  18. package/dist/components/pages/SignupPage.d.ts +1 -1
  19. package/dist/components/pages/SignupPage.js +9 -126
  20. package/dist/components/pages/SignupPageHero.d.ts +10 -0
  21. package/dist/components/pages/SignupPageHero.js +150 -0
  22. package/dist/components/pages/SignupPageTailwind.d.ts +10 -0
  23. package/dist/components/pages/SignupPageTailwind.js +129 -0
  24. package/dist/components/pages/VerifyOtpPage.js +8 -83
  25. package/dist/components/pages/VerifyOtpPageHero.d.ts +5 -0
  26. package/dist/components/pages/VerifyOtpPageHero.js +104 -0
  27. package/dist/components/pages/VerifyOtpPageTailwind.d.ts +5 -0
  28. package/dist/components/pages/VerifyOtpPageTailwind.js +87 -0
  29. package/dist/config.d.ts +8 -0
  30. package/dist/config.js +6 -0
  31. package/dist/index.d.ts +4 -4
  32. package/dist/index.js +5 -1
  33. package/package.json +5 -2
@@ -2,4 +2,4 @@ import type { AuthLayoutConfig } from '../AuthLayout.js';
2
2
  export interface ForgotPasswordPageProps extends AuthLayoutConfig {
3
3
  loginUrl?: string;
4
4
  }
5
- export default function ForgotPasswordPage({ loginUrl, logo, poweredBy, cardClassName, backgroundClass, }: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function ForgotPasswordPage(props: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
@@ -1,45 +1,12 @@
1
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 { useForgotPasswordFlow } from '../../auth/application/hooks/useForgotPasswordFlow.js';
6
- import { AuthLayout } from '../AuthLayout.js';
7
- export default function ForgotPasswordPage({ loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass }) {
8
- const { email, error, isLoading, setEmail, handleSubmit } = useForgotPasswordFlow();
9
- return /*#__PURE__*/ _jsx(AuthLayout, {
10
- logo: logo,
11
- title: "Forgot Password",
12
- subtitle: "Enter your email and we'll send you a reset code",
13
- poweredBy: poweredBy,
14
- cardClassName: cardClassName,
15
- backgroundClass: backgroundClass,
16
- footer: /*#__PURE__*/ _jsx("a", {
17
- href: loginUrl,
18
- className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
19
- children: "← Back to Login"
20
- }),
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__*/ _jsx(Input, {
30
- type: "email",
31
- label: "Email",
32
- value: email,
33
- onChange: (e)=>setEmail(e.target.value),
34
- isRequired: true
35
- }),
36
- /*#__PURE__*/ _jsx(Button, {
37
- type: "submit",
38
- variant: "primary",
39
- isLoading: isLoading,
40
- children: "Send Reset Code"
41
- })
42
- ]
43
- })
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { pluginConfig } from '../../config.js';
4
+ import ForgotPasswordPageTailwind from './ForgotPasswordPageTailwind.js';
5
+ import ForgotPasswordPageHero from './ForgotPasswordPageHero.js';
6
+ export default function ForgotPasswordPage(props) {
7
+ return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(ForgotPasswordPageHero, {
8
+ ...props
9
+ }) : /*#__PURE__*/ _jsx(ForgotPasswordPageTailwind, {
10
+ ...props
44
11
  });
45
12
  }
@@ -0,0 +1,5 @@
1
+ import type { AuthLayoutConfig } from '../AuthLayout.js';
2
+ export interface ForgotPasswordPageHeroProps extends AuthLayoutConfig {
3
+ loginUrl?: string;
4
+ }
5
+ export default function ForgotPasswordPageHero({ loginUrl, logo, poweredBy, cardClassName, backgroundClass }: ForgotPasswordPageHeroProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,69 @@
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 { useForgotPasswordFlow } from '../../auth/application/hooks/useForgotPasswordFlow.js';
8
+ import { AuthLayout } from '../AuthLayout.js';
9
+ export default function ForgotPasswordPageHero({ loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass }) {
10
+ const { email, error, isLoading, setEmail, handleSubmit } = useForgotPasswordFlow();
11
+ return /*#__PURE__*/ _jsx(AuthLayout, {
12
+ logo: logo,
13
+ title: "Forgot Password",
14
+ subtitle: "Enter your email and we'll send you a reset code",
15
+ poweredBy: poweredBy,
16
+ cardClassName: cardClassName,
17
+ backgroundClass: backgroundClass,
18
+ footer: /*#__PURE__*/ _jsxs("a", {
19
+ href: loginUrl,
20
+ className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
21
+ children: [
22
+ /*#__PURE__*/ _jsx(Icon, {
23
+ icon: "lucide:arrow-left",
24
+ width: 16
25
+ }),
26
+ "Back to Login"
27
+ ]
28
+ }),
29
+ children: /*#__PURE__*/ _jsxs("form", {
30
+ onSubmit: handleSubmit,
31
+ className: "space-y-4",
32
+ children: [
33
+ error && /*#__PURE__*/ _jsx(motion.div, {
34
+ className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
35
+ initial: {
36
+ opacity: 0
37
+ },
38
+ animate: {
39
+ opacity: 1
40
+ },
41
+ children: error
42
+ }),
43
+ /*#__PURE__*/ _jsx(Input, {
44
+ type: "email",
45
+ label: "Email",
46
+ value: email,
47
+ onChange: (e)=>setEmail(e.target.value),
48
+ variant: "bordered",
49
+ size: "lg",
50
+ isRequired: true,
51
+ classNames: {
52
+ input: 'text-gray-900',
53
+ label: 'text-gray-600',
54
+ inputWrapper: 'border-gray-300 bg-white'
55
+ }
56
+ }),
57
+ /*#__PURE__*/ _jsx(Button, {
58
+ type: "submit",
59
+ fullWidth: true,
60
+ size: "lg",
61
+ color: "primary",
62
+ isLoading: isLoading,
63
+ className: "h-12 font-semibold",
64
+ children: "Send Reset Code"
65
+ })
66
+ ]
67
+ })
68
+ });
69
+ }
@@ -0,0 +1,5 @@
1
+ import type { AuthLayoutConfig } from '../AuthLayout.js';
2
+ export interface ForgotPasswordPageProps extends AuthLayoutConfig {
3
+ loginUrl?: string;
4
+ }
5
+ export default function ForgotPasswordPage({ loginUrl, logo, poweredBy, cardClassName, backgroundClass, }: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
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 { useForgotPasswordFlow } from '../../auth/application/hooks/useForgotPasswordFlow.js';
6
+ import { AuthLayout } from '../AuthLayout.js';
7
+ export default function ForgotPasswordPage({ loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass }) {
8
+ const { email, error, isLoading, setEmail, handleSubmit } = useForgotPasswordFlow();
9
+ return /*#__PURE__*/ _jsx(AuthLayout, {
10
+ logo: logo,
11
+ title: "Forgot Password",
12
+ subtitle: "Enter your email and we'll send you a reset code",
13
+ poweredBy: poweredBy,
14
+ cardClassName: cardClassName,
15
+ backgroundClass: backgroundClass,
16
+ footer: /*#__PURE__*/ _jsx("a", {
17
+ href: loginUrl,
18
+ className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
19
+ children: "← Back to Login"
20
+ }),
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__*/ _jsx(Input, {
30
+ type: "email",
31
+ label: "Email",
32
+ value: email,
33
+ onChange: (e)=>setEmail(e.target.value),
34
+ isRequired: true
35
+ }),
36
+ /*#__PURE__*/ _jsx(Button, {
37
+ type: "submit",
38
+ variant: "primary",
39
+ isLoading: isLoading,
40
+ children: "Send Reset Code"
41
+ })
42
+ ]
43
+ })
44
+ });
45
+ }
@@ -1,222 +1,12 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import React, { Suspense } from 'react';
4
- import { useSearchParams } from 'next/navigation';
5
- import { Button, Input, Divider, Spinner } from '../ui/index.js';
6
- import { useLoginFlow } from '../../auth/application/hooks/useLoginFlow.js';
7
- import { AuthLayout } from '../AuthLayout.js';
8
- function LoginContent({ onPasswordLogin, redirectTo = '/', showGoogleOAuth = true, signupUrl = '/signup', logo, poweredBy, cardClassName, backgroundClass }) {
9
- const searchParams = useSearchParams();
10
- const resolvedRedirect = searchParams.get('redirect') || redirectTo;
11
- const { step, email, password, error, isLoading, isSendingOtp, showPassword, setEmail, setPassword, setShowPassword, handleEmailSubmit, handlePasswordSubmit, handleSendOtp, handleEditEmail, handleGoogleLogin } = useLoginFlow({
12
- redirectTo: resolvedRedirect,
13
- onPasswordLogin
14
- });
15
- const stepTitle = step === 'otp-prompt' ? 'Verify Identity' : step === 'email' ? 'Welcome Back' : 'Enter Password';
16
- const stepSubtitle = step === 'otp-prompt' ? "We need to verify it's you." : step === 'email' ? 'Sign in with your email to continue.' : 'Enter your password to sign in.';
17
- return /*#__PURE__*/ _jsxs(AuthLayout, {
18
- logo: logo,
19
- title: stepTitle,
20
- subtitle: stepSubtitle,
21
- poweredBy: poweredBy,
22
- cardClassName: cardClassName,
23
- backgroundClass: backgroundClass,
24
- footer: /*#__PURE__*/ _jsxs("p", {
25
- className: "text-center text-gray-600 text-sm",
26
- children: [
27
- "Don't have an account?",
28
- ' ',
29
- /*#__PURE__*/ _jsx("a", {
30
- href: signupUrl,
31
- className: "text-gray-900 font-medium hover:underline",
32
- children: "Sign up"
33
- })
34
- ]
35
- }),
36
- children: [
37
- step === 'email' && /*#__PURE__*/ _jsxs("div", {
38
- className: "animate-[fadeIn_0.3s_ease-out]",
39
- children: [
40
- showGoogleOAuth && /*#__PURE__*/ _jsxs(_Fragment, {
41
- children: [
42
- /*#__PURE__*/ _jsxs(Button, {
43
- fullWidth: true,
44
- variant: "bordered",
45
- size: "lg",
46
- className: "mb-4",
47
- onPress: handleGoogleLogin,
48
- children: [
49
- /*#__PURE__*/ _jsx("span", {
50
- className: "text-lg",
51
- children: "G"
52
- }),
53
- " Continue with Google"
54
- ]
55
- }),
56
- /*#__PURE__*/ _jsxs("div", {
57
- className: "flex items-center gap-4 my-4",
58
- children: [
59
- /*#__PURE__*/ _jsx(Divider, {
60
- className: "flex-1"
61
- }),
62
- /*#__PURE__*/ _jsx("span", {
63
- className: "text-gray-500 text-sm",
64
- children: "or"
65
- }),
66
- /*#__PURE__*/ _jsx(Divider, {
67
- className: "flex-1"
68
- })
69
- ]
70
- })
71
- ]
72
- }),
73
- /*#__PURE__*/ _jsxs("form", {
74
- onSubmit: handleEmailSubmit,
75
- className: "space-y-4",
76
- children: [
77
- error && /*#__PURE__*/ _jsx("div", {
78
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
79
- children: error
80
- }),
81
- /*#__PURE__*/ _jsx(Input, {
82
- type: "email",
83
- label: "Email",
84
- value: email,
85
- onValueChange: setEmail,
86
- isRequired: true
87
- }),
88
- /*#__PURE__*/ _jsx(Button, {
89
- type: "submit",
90
- variant: "primary",
91
- isLoading: isLoading,
92
- children: "Continue"
93
- })
94
- ]
95
- })
96
- ]
97
- }),
98
- step === 'password' && /*#__PURE__*/ _jsxs("div", {
99
- className: "animate-[fadeIn_0.3s_ease-out]",
100
- children: [
101
- /*#__PURE__*/ _jsxs("div", {
102
- className: "flex items-center justify-between border border-gray-300 rounded-xl px-4 py-3 mb-4",
103
- children: [
104
- /*#__PURE__*/ _jsx("span", {
105
- className: "text-gray-900 text-sm",
106
- children: email
107
- }),
108
- /*#__PURE__*/ _jsx("button", {
109
- type: "button",
110
- onClick: handleEditEmail,
111
- className: "text-gray-600 text-sm font-medium hover:text-gray-900",
112
- children: "Edit"
113
- })
114
- ]
115
- }),
116
- /*#__PURE__*/ _jsxs("form", {
117
- onSubmit: handlePasswordSubmit,
118
- className: "space-y-4",
119
- children: [
120
- error && /*#__PURE__*/ _jsx("div", {
121
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
122
- children: error
123
- }),
124
- /*#__PURE__*/ _jsxs("div", {
125
- className: "relative",
126
- children: [
127
- /*#__PURE__*/ _jsx(Input, {
128
- type: showPassword ? 'text' : 'password',
129
- label: "Password",
130
- value: password,
131
- onValueChange: setPassword,
132
- isRequired: true,
133
- autoFocus: true
134
- }),
135
- /*#__PURE__*/ _jsx("button", {
136
- type: "button",
137
- onClick: ()=>setShowPassword(!showPassword),
138
- className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
139
- children: showPassword ? '🙈' : '👁'
140
- })
141
- ]
142
- }),
143
- /*#__PURE__*/ _jsx("div", {
144
- className: "text-left",
145
- children: /*#__PURE__*/ _jsx("a", {
146
- href: "/forgot-password",
147
- className: "text-sm text-gray-700 hover:text-gray-900 hover:underline",
148
- children: "Forgot password?"
149
- })
150
- }),
151
- /*#__PURE__*/ _jsx(Button, {
152
- type: "submit",
153
- variant: "primary",
154
- isLoading: isLoading,
155
- children: "Continue"
156
- })
157
- ]
158
- })
159
- ]
160
- }),
161
- step === 'otp-prompt' && /*#__PURE__*/ _jsxs("div", {
162
- className: "animate-[fadeIn_0.3s_ease-out]",
163
- children: [
164
- /*#__PURE__*/ _jsxs("div", {
165
- className: "flex items-center justify-between border border-gray-300 rounded-xl px-4 py-3 mb-4",
166
- children: [
167
- /*#__PURE__*/ _jsx("span", {
168
- className: "text-gray-900 text-sm",
169
- children: email
170
- }),
171
- /*#__PURE__*/ _jsx("button", {
172
- type: "button",
173
- onClick: handleEditEmail,
174
- className: "text-gray-600 text-sm font-medium hover:text-gray-900",
175
- children: "Edit"
176
- })
177
- ]
178
- }),
179
- error && /*#__PURE__*/ _jsx("div", {
180
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm mb-4",
181
- children: error
182
- }),
183
- /*#__PURE__*/ _jsx("div", {
184
- className: "bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",
185
- children: /*#__PURE__*/ _jsxs("div", {
186
- className: "flex gap-3",
187
- children: [
188
- /*#__PURE__*/ _jsx("span", {
189
- className: "text-blue-500 text-lg",
190
- children: "✉"
191
- }),
192
- /*#__PURE__*/ _jsx("p", {
193
- className: "text-sm text-blue-700",
194
- children: "We'll send a verification code to this email."
195
- })
196
- ]
197
- })
198
- }),
199
- /*#__PURE__*/ _jsx(Button, {
200
- variant: "primary",
201
- isLoading: isSendingOtp,
202
- onPress: handleSendOtp,
203
- children: isSendingOtp ? 'Sending...' : 'Send Code'
204
- })
205
- ]
206
- })
207
- ]
208
- });
209
- }
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { pluginConfig } from '../../config.js';
4
+ import LoginPageTailwind from './LoginPageTailwind.js';
5
+ import LoginPageHero from './LoginPageHero.js';
210
6
  export default function LoginPage(props) {
211
- return /*#__PURE__*/ _jsx(Suspense, {
212
- fallback: /*#__PURE__*/ _jsx("div", {
213
- className: "min-h-screen flex items-center justify-center",
214
- children: /*#__PURE__*/ _jsx(Spinner, {
215
- size: "lg"
216
- })
217
- }),
218
- children: /*#__PURE__*/ _jsx(LoginContent, {
219
- ...props
220
- })
7
+ return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(LoginPageHero, {
8
+ ...props
9
+ }) : /*#__PURE__*/ _jsx(LoginPageTailwind, {
10
+ ...props
221
11
  });
222
12
  }
@@ -0,0 +1,11 @@
1
+ import type { AuthLayoutConfig } from '../AuthLayout.js';
2
+ export interface LoginPageHeroProps extends AuthLayoutConfig {
3
+ onPasswordLogin: (credentials: {
4
+ email: string;
5
+ password: string;
6
+ }) => Promise<void>;
7
+ redirectTo?: string;
8
+ showGoogleOAuth?: boolean;
9
+ signupUrl?: string;
10
+ }
11
+ export default function LoginPageHero(props: LoginPageHeroProps): import("react/jsx-runtime").JSX.Element;