vintasend 0.2.3 → 0.4.0
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 +227 -12
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/next.config.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/next.config.js +9 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/forgot-password-notification-context.d.ts +6 -6
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/forgot-password-notification-context.js +16 -17
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/route.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/route.js +105 -79
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/login/route.d.ts +4 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/login/route.js +96 -66
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/reset-password/route.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/reset-password/route.js +95 -71
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/email-verification-notification-context.d.ts +6 -6
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/email-verification-notification-context.js +18 -18
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/route.d.ts +4 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/route.js +124 -96
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/verify-email/route.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/verify-email/route.js +94 -70
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/login/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/login/page.js +67 -55
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/reset-password/[token]/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/reset-password/[token]/page.js +76 -63
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/signup/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/signup/page.js +87 -63
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email/[token]/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email/[token]/page.js +50 -35
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.js +12 -12
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/layout.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/layout.js +15 -16
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/page.js +65 -21
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/AuthLayout.d.ts +7 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/AuthLayout.js +7 -8
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/accordion.d.ts +18 -6
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/accordion.js +86 -48
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert-dialog.d.ts +58 -14
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert-dialog.js +135 -53
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert.d.ts +21 -7
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert.js +85 -49
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/avatar.d.ts +14 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/avatar.js +77 -40
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/button.d.ts +25 -9
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/button.js +80 -58
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/card.d.ts +19 -7
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/card.js +98 -48
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/checkbox.d.ts +6 -3
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/checkbox.js +66 -42
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/collapsible.d.ts +10 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/collapsible.js +48 -35
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dialog.d.ts +40 -13
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dialog.js +116 -50
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dropdown-menu.d.ts +83 -19
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dropdown-menu.js +170 -68
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/form.d.ts +53 -21
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/form.js +137 -83
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/input.d.ts +8 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/input.js +60 -37
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/label.d.ts +10 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/label.js +61 -40
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/menubar.d.ts +77 -23
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/menubar.js +188 -64
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/select.d.ts +48 -12
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/select.js +148 -66
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/textarea.d.ts +8 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/textarea.js +59 -37
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/auth.d.ts +10 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/auth.js +54 -55
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/core.d.ts +14 -11
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/core.js +1 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/email.js +0 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/logger.d.ts +3 -3
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/logger.js +9 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/schemas/auth.d.ts +66 -32
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/schemas/auth.js +74 -54
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/auth.js +7 -8
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications-with-queue.d.ts +14 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications-with-queue.js +14 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.d.ts +11 -7
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.js +39 -26
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/temporal-queue-service.d.ts +11 -8
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/temporal-queue-service.js +14 -15
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/temporal.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/temporal.js +9 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/utils.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/utils.js +4 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.d.ts +6 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.js +14 -14
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.js +2 -3
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/constants.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/constants.js +1 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/worker.js +20 -22
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/workflows.d.ts +3 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/workflows.js +10 -9
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/tailwind.config.d.ts +74 -74
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/tailwind.config.js +80 -81
- package/dist/implementations/vintasend-nodemailer/src/index.js +6 -4
- package/dist/implementations/vintasend-nodemailer/src/nodemailer-notification-adapter.d.ts +36 -14
- package/dist/implementations/vintasend-nodemailer/src/nodemailer-notification-adapter.js +26 -28
- package/dist/implementations/vintasend-prisma/src/index.js +6 -4
- package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.d.ts +232 -138
- package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.js +275 -262
- package/dist/implementations/vintasend-pug/src/index.js +6 -4
- package/dist/implementations/vintasend-pug/src/pug-email-template-renderer.d.ts +18 -7
- package/dist/implementations/vintasend-pug/src/pug-email-template-renderer.js +19 -21
- package/dist/implementations/vintasend-winston/src/index.js +6 -4
- package/dist/implementations/vintasend-winston/src/winston-logger.d.ts +6 -6
- package/dist/implementations/vintasend-winston/src/winston-logger.js +65 -50
- package/dist/index.d.ts +13 -5
- package/dist/index.js +13 -1
- package/dist/services/attachment-manager/base-attachment-manager.d.ts +42 -0
- package/dist/services/attachment-manager/base-attachment-manager.js +115 -0
- package/dist/services/attachment-manager/local-file-attachment-manager.d.ts +58 -0
- package/dist/services/attachment-manager/local-file-attachment-manager.js +192 -0
- package/dist/services/notification-adapters/base-notification-adapter.d.ts +36 -4
- package/dist/services/notification-adapters/base-notification-adapter.js +73 -4
- package/dist/services/notification-backends/base-notification-backend.d.ts +54 -11
- package/dist/services/notification-backends/base-notification-backend.js +12 -0
- package/dist/services/notification-context-generators-map.d.ts +1 -1
- package/dist/services/notification-context-registry.d.ts +14 -9
- package/dist/services/notification-context-registry.js +30 -31
- package/dist/services/notification-queue-service/base-notification-queue-service.d.ts +1 -1
- package/dist/services/notification-service.d.ts +73 -13
- package/dist/services/notification-service.js +125 -8
- package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +3 -3
- package/dist/services/notification-template-renderers/base-notification-template-renderer.d.ts +2 -2
- package/dist/types/attachment.d.ts +42 -0
- package/dist/types/attachment.js +7 -0
- package/dist/types/notification-type-config.d.ts +2 -2
- package/dist/types/notification.d.ts +21 -0
- package/dist/types/one-off-notification.d.ts +72 -0
- package/dist/types/one-off-notification.js +2 -0
- package/package.json +13 -11
|
@@ -1,74 +1,86 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
3
|
exports.default = ResetPassword;
|
|
5
|
-
const react_1 = require(
|
|
6
|
-
const navigation_1 = require(
|
|
7
|
-
const zod_1 = require(
|
|
8
|
-
const react_hook_form_1 = require(
|
|
9
|
-
const alert_1 = require(
|
|
10
|
-
const form_1 = require(
|
|
11
|
-
const input_1 = require(
|
|
12
|
-
const button_1 = require(
|
|
13
|
-
const auth_1 = require(
|
|
14
|
-
const auth_2 = require(
|
|
15
|
-
const AuthLayout_1 = require(
|
|
4
|
+
const react_1 = require('react');
|
|
5
|
+
const navigation_1 = require('next/navigation');
|
|
6
|
+
const zod_1 = require('@hookform/resolvers/zod');
|
|
7
|
+
const react_hook_form_1 = require('react-hook-form');
|
|
8
|
+
const alert_1 = require('../../../../components/ui/alert');
|
|
9
|
+
const form_1 = require('../../../../components/ui/form');
|
|
10
|
+
const input_1 = require('../../../../components/ui/input');
|
|
11
|
+
const button_1 = require('../../../../components/ui/button');
|
|
12
|
+
const auth_1 = require('../../../../lib/schemas/auth');
|
|
13
|
+
const auth_2 = require('../../../../lib/api-clients/auth');
|
|
14
|
+
const AuthLayout_1 = require('../../../../components/AuthLayout');
|
|
16
15
|
function ResetPassword() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
16
|
+
const [status, setStatus] = (0, react_1.useState)('idle');
|
|
17
|
+
const [message, setMessage] = (0, react_1.useState)('');
|
|
18
|
+
const params = (0, navigation_1.useParams)();
|
|
19
|
+
const router = (0, navigation_1.useRouter)();
|
|
20
|
+
const form = (0, react_hook_form_1.useForm)({
|
|
21
|
+
resolver: (0, zod_1.zodResolver)(auth_1.passwordResetSchema),
|
|
22
|
+
defaultValues: {
|
|
23
|
+
password: '',
|
|
24
|
+
confirmPassword: '',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const onSubmit = async (data) => {
|
|
28
|
+
setStatus('loading');
|
|
29
|
+
try {
|
|
30
|
+
const response = await auth_2.authApi.resetPassword({
|
|
31
|
+
token: params.token,
|
|
32
|
+
password: data.password,
|
|
33
|
+
confirmPassword: data.confirmPassword,
|
|
34
|
+
});
|
|
35
|
+
if (response.success) {
|
|
36
|
+
setStatus('success');
|
|
37
|
+
setMessage('Password reset successfully!');
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
router.push('/login');
|
|
40
|
+
}, 3000);
|
|
41
|
+
} else {
|
|
42
|
+
setStatus('error');
|
|
43
|
+
setMessage(
|
|
44
|
+
response.error || 'Failed to reset password. The link may be invalid or expired.',
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
} catch (error) {
|
|
48
|
+
setStatus('error');
|
|
49
|
+
setMessage('An error occurred. Please try again.');
|
|
50
|
+
form.setError('password', { message: error });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (
|
|
54
|
+
<AuthLayout_1.AuthLayout title="Reset Password">
|
|
55
55
|
<form_1.Form {...form}>
|
|
56
56
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
|
57
|
-
<form_1.FormField
|
|
57
|
+
<form_1.FormField
|
|
58
|
+
control={form.control}
|
|
59
|
+
name="password"
|
|
60
|
+
render={({ field }) => (
|
|
61
|
+
<form_1.FormItem>
|
|
58
62
|
<form_1.FormLabel>New Password</form_1.FormLabel>
|
|
59
63
|
<form_1.FormControl>
|
|
60
|
-
<input_1.Input type="password" {...field}/>
|
|
64
|
+
<input_1.Input type="password" {...field} />
|
|
61
65
|
</form_1.FormControl>
|
|
62
66
|
<form_1.FormMessage />
|
|
63
|
-
</form_1.FormItem>
|
|
67
|
+
</form_1.FormItem>
|
|
68
|
+
)}
|
|
69
|
+
/>
|
|
64
70
|
|
|
65
|
-
<form_1.FormField
|
|
71
|
+
<form_1.FormField
|
|
72
|
+
control={form.control}
|
|
73
|
+
name="confirmPassword"
|
|
74
|
+
render={({ field }) => (
|
|
75
|
+
<form_1.FormItem>
|
|
66
76
|
<form_1.FormLabel>Confirm Password</form_1.FormLabel>
|
|
67
77
|
<form_1.FormControl>
|
|
68
|
-
<input_1.Input type="password" {...field}/>
|
|
78
|
+
<input_1.Input type="password" {...field} />
|
|
69
79
|
</form_1.FormControl>
|
|
70
80
|
<form_1.FormMessage />
|
|
71
|
-
</form_1.FormItem>
|
|
81
|
+
</form_1.FormItem>
|
|
82
|
+
)}
|
|
83
|
+
/>
|
|
72
84
|
|
|
73
85
|
<button_1.Button type="submit" disabled={status === 'loading'} className="w-full">
|
|
74
86
|
{status === 'loading' ? 'Resetting...' : 'Reset Password'}
|
|
@@ -76,11 +88,12 @@ function ResetPassword() {
|
|
|
76
88
|
</form>
|
|
77
89
|
</form_1.Form>
|
|
78
90
|
|
|
79
|
-
{status !== 'idle' && (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</alert_1.AlertTitle>
|
|
91
|
+
{status !== 'idle' && (
|
|
92
|
+
<alert_1.Alert variant={status === 'success' ? 'default' : 'destructive'} className="mt-6">
|
|
93
|
+
<alert_1.AlertTitle>{status === 'success' ? 'Success' : 'Error'}</alert_1.AlertTitle>
|
|
83
94
|
<alert_1.AlertDescription>{message}</alert_1.AlertDescription>
|
|
84
|
-
</alert_1.Alert>
|
|
85
|
-
|
|
95
|
+
</alert_1.Alert>
|
|
96
|
+
)}
|
|
97
|
+
</AuthLayout_1.AuthLayout>
|
|
98
|
+
);
|
|
86
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function SignUpPage(): import(
|
|
1
|
+
export default function SignUpPage(): import('react').JSX.Element;
|
|
@@ -1,90 +1,113 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
var __importDefault =
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) || ((mod) => (mod && mod.__esModule ? mod : { default: mod }));
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
5
|
exports.default = SignUpPage;
|
|
8
|
-
const react_1 = require(
|
|
9
|
-
const navigation_1 = require(
|
|
10
|
-
const link_1 = __importDefault(require(
|
|
11
|
-
const zod_1 = require(
|
|
12
|
-
const react_hook_form_1 = require(
|
|
13
|
-
const button_1 = require(
|
|
14
|
-
const input_1 = require(
|
|
15
|
-
const alert_1 = require(
|
|
16
|
-
const form_1 = require(
|
|
17
|
-
const auth_1 = require(
|
|
18
|
-
const auth_2 = require(
|
|
19
|
-
const AuthLayout_1 = require(
|
|
6
|
+
const react_1 = require('react');
|
|
7
|
+
const navigation_1 = require('next/navigation');
|
|
8
|
+
const link_1 = __importDefault(require('next/link'));
|
|
9
|
+
const zod_1 = require('@hookform/resolvers/zod');
|
|
10
|
+
const react_hook_form_1 = require('react-hook-form');
|
|
11
|
+
const button_1 = require('../../../components/ui/button');
|
|
12
|
+
const input_1 = require('../../../components/ui/input');
|
|
13
|
+
const alert_1 = require('../../../components/ui/alert');
|
|
14
|
+
const form_1 = require('../../../components/ui/form');
|
|
15
|
+
const auth_1 = require('../../../lib/schemas/auth');
|
|
16
|
+
const auth_2 = require('../../../lib/api-clients/auth');
|
|
17
|
+
const AuthLayout_1 = require('../../../components/AuthLayout');
|
|
20
18
|
function SignUpPage() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
finally {
|
|
47
|
-
setLoading(false);
|
|
48
|
-
}
|
|
19
|
+
const router = (0, navigation_1.useRouter)();
|
|
20
|
+
const [error, setError] = (0, react_1.useState)('');
|
|
21
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
22
|
+
const form = (0, react_hook_form_1.useForm)({
|
|
23
|
+
resolver: (0, zod_1.zodResolver)(auth_1.signupSchema),
|
|
24
|
+
defaultValues: {
|
|
25
|
+
firstName: '',
|
|
26
|
+
lastName: '',
|
|
27
|
+
email: '',
|
|
28
|
+
password: '',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
async function onSubmit(data) {
|
|
32
|
+
setError('');
|
|
33
|
+
setLoading(true);
|
|
34
|
+
try {
|
|
35
|
+
const response = await auth_2.authApi.signup(data);
|
|
36
|
+
if (!response.success) {
|
|
37
|
+
throw new Error(response.error || 'Registration failed');
|
|
38
|
+
}
|
|
39
|
+
router.push('/auth/verify-email-sent');
|
|
40
|
+
} catch (err) {
|
|
41
|
+
setError(err instanceof Error ? err.message : 'Registration failed');
|
|
42
|
+
} finally {
|
|
43
|
+
setLoading(false);
|
|
49
44
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
}
|
|
46
|
+
return (
|
|
47
|
+
<AuthLayout_1.AuthLayout title="Create Account">
|
|
48
|
+
{error && (
|
|
49
|
+
<alert_1.Alert variant="destructive" className="mb-4">
|
|
50
|
+
<alert_1.AlertDescription>{error}</alert_1.AlertDescription>
|
|
51
|
+
</alert_1.Alert>
|
|
52
|
+
)}
|
|
53
|
+
|
|
55
54
|
<form_1.Form {...form}>
|
|
56
55
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
|
57
|
-
<form_1.FormField
|
|
56
|
+
<form_1.FormField
|
|
57
|
+
control={form.control}
|
|
58
|
+
name="firstName"
|
|
59
|
+
render={({ field }) => (
|
|
60
|
+
<form_1.FormItem>
|
|
58
61
|
<form_1.FormLabel>First Name</form_1.FormLabel>
|
|
59
62
|
<form_1.FormControl>
|
|
60
|
-
<input_1.Input {...field}/>
|
|
63
|
+
<input_1.Input {...field} />
|
|
61
64
|
</form_1.FormControl>
|
|
62
65
|
<form_1.FormMessage />
|
|
63
|
-
</form_1.FormItem>
|
|
66
|
+
</form_1.FormItem>
|
|
67
|
+
)}
|
|
68
|
+
/>
|
|
64
69
|
|
|
65
|
-
<form_1.FormField
|
|
70
|
+
<form_1.FormField
|
|
71
|
+
control={form.control}
|
|
72
|
+
name="lastName"
|
|
73
|
+
render={({ field }) => (
|
|
74
|
+
<form_1.FormItem>
|
|
66
75
|
<form_1.FormLabel>Last Name</form_1.FormLabel>
|
|
67
76
|
<form_1.FormControl>
|
|
68
|
-
<input_1.Input {...field}/>
|
|
77
|
+
<input_1.Input {...field} />
|
|
69
78
|
</form_1.FormControl>
|
|
70
79
|
<form_1.FormMessage />
|
|
71
|
-
</form_1.FormItem>
|
|
80
|
+
</form_1.FormItem>
|
|
81
|
+
)}
|
|
82
|
+
/>
|
|
72
83
|
|
|
73
|
-
<form_1.FormField
|
|
84
|
+
<form_1.FormField
|
|
85
|
+
control={form.control}
|
|
86
|
+
name="email"
|
|
87
|
+
render={({ field }) => (
|
|
88
|
+
<form_1.FormItem>
|
|
74
89
|
<form_1.FormLabel>Email</form_1.FormLabel>
|
|
75
90
|
<form_1.FormControl>
|
|
76
|
-
<input_1.Input type="email" {...field}/>
|
|
91
|
+
<input_1.Input type="email" {...field} />
|
|
77
92
|
</form_1.FormControl>
|
|
78
93
|
<form_1.FormMessage />
|
|
79
|
-
</form_1.FormItem>
|
|
94
|
+
</form_1.FormItem>
|
|
95
|
+
)}
|
|
96
|
+
/>
|
|
80
97
|
|
|
81
|
-
<form_1.FormField
|
|
98
|
+
<form_1.FormField
|
|
99
|
+
control={form.control}
|
|
100
|
+
name="password"
|
|
101
|
+
render={({ field }) => (
|
|
102
|
+
<form_1.FormItem>
|
|
82
103
|
<form_1.FormLabel>Password</form_1.FormLabel>
|
|
83
104
|
<form_1.FormControl>
|
|
84
|
-
<input_1.Input type="password" {...field}/>
|
|
105
|
+
<input_1.Input type="password" {...field} />
|
|
85
106
|
</form_1.FormControl>
|
|
86
107
|
<form_1.FormMessage />
|
|
87
|
-
</form_1.FormItem>
|
|
108
|
+
</form_1.FormItem>
|
|
109
|
+
)}
|
|
110
|
+
/>
|
|
88
111
|
|
|
89
112
|
<button_1.Button type="submit" className="w-full" disabled={loading}>
|
|
90
113
|
{loading ? 'Creating account...' : 'Sign Up'}
|
|
@@ -98,5 +121,6 @@ function SignUpPage() {
|
|
|
98
121
|
Login
|
|
99
122
|
</link_1.default>
|
|
100
123
|
</p>
|
|
101
|
-
</AuthLayout_1.AuthLayout>
|
|
124
|
+
</AuthLayout_1.AuthLayout>
|
|
125
|
+
);
|
|
102
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function VerifyEmail(): import(
|
|
1
|
+
export default function VerifyEmail(): import('react').JSX.Element;
|
|
@@ -1,39 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
3
|
exports.default = VerifyEmail;
|
|
5
|
-
const react_1 = require(
|
|
6
|
-
const navigation_1 = require(
|
|
7
|
-
const alert_1 = require(
|
|
8
|
-
const auth_1 = require(
|
|
9
|
-
const AuthLayout_1 = require(
|
|
4
|
+
const react_1 = require('react');
|
|
5
|
+
const navigation_1 = require('next/navigation');
|
|
6
|
+
const alert_1 = require('../../../../components/ui/alert');
|
|
7
|
+
const auth_1 = require('../../../../lib/api-clients/auth');
|
|
8
|
+
const AuthLayout_1 = require('../../../../components/AuthLayout');
|
|
10
9
|
function VerifyEmail() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
10
|
+
const [status, setStatus] = (0, react_1.useState)('loading');
|
|
11
|
+
const params = (0, navigation_1.useParams)();
|
|
12
|
+
const router = (0, navigation_1.useRouter)();
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
const verifyEmail = async () => {
|
|
15
|
+
try {
|
|
16
|
+
const response = await auth_1.authApi.verifyEmail(params.token);
|
|
17
|
+
if (response.success) {
|
|
18
|
+
setStatus('success');
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
router.push('/auth/login');
|
|
21
|
+
}, 3000);
|
|
22
|
+
} else {
|
|
23
|
+
setStatus('error');
|
|
24
|
+
}
|
|
25
|
+
} catch (_error) {
|
|
26
|
+
setStatus('error');
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
verifyEmail();
|
|
30
|
+
}, [params.token, router]);
|
|
31
|
+
return (
|
|
32
|
+
<AuthLayout_1.AuthLayout title="Verify Email">
|
|
33
|
+
{status === 'loading' && (
|
|
34
|
+
<alert_1.Alert variant="default">
|
|
35
|
+
<alert_1.AlertDescription>Verifying your email address...</alert_1.AlertDescription>
|
|
36
|
+
</alert_1.Alert>
|
|
37
|
+
)}
|
|
38
|
+
{status === 'success' && (
|
|
39
|
+
<alert_1.Alert variant="default">
|
|
40
|
+
<alert_1.AlertDescription>
|
|
41
|
+
Email verified successfully! Redirecting to login...
|
|
42
|
+
</alert_1.AlertDescription>
|
|
43
|
+
</alert_1.Alert>
|
|
44
|
+
)}
|
|
45
|
+
{status === 'error' && (
|
|
46
|
+
<alert_1.Alert variant="destructive">
|
|
47
|
+
<alert_1.AlertDescription>
|
|
48
|
+
Failed to verify email. The link may be invalid or expired.
|
|
49
|
+
</alert_1.AlertDescription>
|
|
50
|
+
</alert_1.Alert>
|
|
51
|
+
)}
|
|
52
|
+
</AuthLayout_1.AuthLayout>
|
|
53
|
+
);
|
|
39
54
|
}
|
package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function VerifyEmailSentPage(): import(
|
|
1
|
+
export default function VerifyEmailSentPage(): import('react').JSX.Element;
|
package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
var __importDefault =
|
|
2
|
+
(this && this.__importDefault) || ((mod) => (mod && mod.__esModule ? mod : { default: mod }));
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
4
|
exports.default = VerifyEmailSentPage;
|
|
7
|
-
const link_1 = __importDefault(require(
|
|
8
|
-
const alert_1 = require(
|
|
9
|
-
const AuthLayout_1 = require(
|
|
5
|
+
const link_1 = __importDefault(require('next/link'));
|
|
6
|
+
const alert_1 = require('../../../components/ui/alert');
|
|
7
|
+
const AuthLayout_1 = require('../../../components/AuthLayout');
|
|
10
8
|
function VerifyEmailSentPage() {
|
|
11
|
-
|
|
9
|
+
return (
|
|
10
|
+
<AuthLayout_1.AuthLayout title="Check Your Email">
|
|
12
11
|
<alert_1.Alert>
|
|
13
12
|
<alert_1.AlertDescription>
|
|
14
|
-
We've sent you a verification link. Please check your inbox and click the
|
|
15
|
-
|
|
13
|
+
We've sent you a verification link. Please check your inbox and click the link to activate
|
|
14
|
+
your account.
|
|
16
15
|
</alert_1.AlertDescription>
|
|
17
16
|
</alert_1.Alert>
|
|
18
17
|
<p className="text-center text-sm text-gray-600 mt-4">
|
|
@@ -25,5 +24,6 @@ function VerifyEmailSentPage() {
|
|
|
25
24
|
return to login
|
|
26
25
|
</link_1.default>
|
|
27
26
|
</p>
|
|
28
|
-
</AuthLayout_1.AuthLayout>
|
|
27
|
+
</AuthLayout_1.AuthLayout>
|
|
28
|
+
);
|
|
29
29
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { Metadata } from
|
|
2
|
-
import
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import './globals.css';
|
|
3
3
|
export declare const metadata: Metadata;
|
|
4
|
-
export default function RootLayout({
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
export default function RootLayout({
|
|
5
|
+
children,
|
|
6
|
+
}: Readonly<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>): import('react').JSX.Element;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.metadata = void 0;
|
|
4
3
|
exports.default = RootLayout;
|
|
5
|
-
const google_1 = require(
|
|
6
|
-
require(
|
|
4
|
+
const google_1 = require('next/font/google');
|
|
5
|
+
require('./globals.css');
|
|
7
6
|
const geistSans = (0, google_1.Geist)({
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
variable: '--font-geist-sans',
|
|
8
|
+
subsets: ['latin'],
|
|
10
9
|
});
|
|
11
10
|
const geistMono = (0, google_1.Geist_Mono)({
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
variable: '--font-geist-mono',
|
|
12
|
+
subsets: ['latin'],
|
|
14
13
|
});
|
|
15
14
|
exports.metadata = {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
title: 'Create Next App',
|
|
16
|
+
description: 'Generated by create next app',
|
|
18
17
|
};
|
|
19
|
-
function RootLayout({ children
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
function RootLayout({ children }) {
|
|
19
|
+
return (
|
|
20
|
+
<html lang="en">
|
|
21
|
+
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>{children}</body>
|
|
22
|
+
</html>
|
|
23
|
+
);
|
|
25
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function Home(): import(
|
|
1
|
+
export default function Home(): import('react').JSX.Element;
|