@vitnode/core 1.2.0-canary.51 → 1.2.0-canary.52
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/scripts/scripts.js +2 -2
- package/dist/src/api/middlewares/global.middleware.d.ts +2 -10
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/models/email.d.ts +24 -8
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +27 -15
- package/dist/src/api/models/password.d.ts +4 -0
- package/dist/src/api/models/password.d.ts.map +1 -1
- package/dist/src/api/models/password.js +8 -0
- package/dist/src/api/models/session-admin.d.ts +1 -0
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session.d.ts +1 -0
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/sso.d.ts.map +1 -1
- package/dist/src/api/models/sso.js +8 -5
- package/dist/src/api/models/user/get-user-by-id.d.ts +1 -0
- package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -1
- package/dist/src/api/models/user/get-user-by-id.js +2 -1
- package/dist/src/api/models/user/sign-up.js +2 -2
- package/dist/src/api/models/user.d.ts +1 -0
- package/dist/src/api/models/user.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/change-password.route.d.ts +52 -0
- package/dist/src/api/modules/users/routes/change-password.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/change-password.route.js +58 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts +42 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +91 -0
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +6 -0
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.js +6 -0
- package/dist/src/api/modules/users/routes/test.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/test.route.js +0 -6
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +4 -1
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/routes/callback.route.js +3 -0
- package/dist/src/api/modules/users/sso/sso.module.d.ts +4 -1
- package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.d.ts +93 -1
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.js +5 -1
- package/dist/src/app/login/reset-password/page.d.ts +9 -0
- package/dist/src/app/login/reset-password/page.d.ts.map +1 -0
- package/dist/src/app/login/reset-password/page.js +18 -0
- package/dist/src/components/form/auto-form.d.ts +2 -1
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +3 -2
- package/dist/src/components/form/common/label.d.ts +3 -1
- package/dist/src/components/form/common/label.d.ts.map +1 -1
- package/dist/src/components/form/common/label.js +14 -4
- package/dist/src/components/form/fields/checkbox.d.ts +1 -1
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/checkbox.js +2 -1
- package/dist/src/components/form/fields/combobox-async.d.ts +1 -1
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +2 -1
- package/dist/src/components/form/fields/combobox.d.ts +1 -1
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +2 -1
- package/dist/src/components/form/fields/input.d.ts +1 -1
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +2 -1
- package/dist/src/components/form/fields/radio-group.d.ts +1 -1
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +2 -1
- package/dist/src/components/form/fields/select.d.ts +1 -1
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +2 -1
- package/dist/src/components/form/fields/switch.d.ts +1 -1
- package/dist/src/components/form/fields/switch.d.ts.map +1 -1
- package/dist/src/components/form/fields/switch.js +2 -1
- package/dist/src/components/form/fields/textarea.d.ts +1 -1
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +2 -1
- package/dist/src/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/components/ui/alert-dialog.js +1 -2
- package/dist/src/components/ui/alert.d.ts +1 -1
- package/dist/src/components/ui/badge.d.ts +1 -1
- package/dist/src/components/ui/button.d.ts +1 -1
- package/dist/src/components/ui/button.js +1 -1
- package/dist/src/components/ui/card.d.ts +1 -1
- package/dist/src/components/ui/card.d.ts.map +1 -1
- package/dist/src/components/ui/card.js +1 -2
- package/dist/src/components/ui/form.js +1 -1
- package/dist/src/components/ui/popover.d.ts +1 -1
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/popover.js +2 -1
- package/dist/src/components/ui/tooltip.d.ts +1 -1
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +6 -7
- package/dist/src/database/users.d.ts +21 -2
- package/dist/src/database/users.d.ts.map +1 -1
- package/dist/src/database/users.js +5 -2
- package/dist/src/emails/default-template.d.ts +34 -22
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +57 -63
- package/dist/src/emails/reset-password.d.ts +56 -0
- package/dist/src/emails/reset-password.d.ts.map +1 -0
- package/dist/src/emails/reset-password.js +132 -0
- package/dist/src/emails/ui/button.d.ts +9 -0
- package/dist/src/emails/ui/button.d.ts.map +1 -0
- package/dist/src/emails/ui/button.js +36 -0
- package/dist/src/emails/ui/card.d.ts +8 -0
- package/dist/src/emails/ui/card.d.ts.map +1 -0
- package/dist/src/emails/ui/card.js +39 -0
- package/dist/src/hooks/use-captcha.d.ts.map +1 -1
- package/dist/src/hooks/use-captcha.js +47 -15
- package/dist/src/lib/fetcher/core.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.js +6 -1
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +2 -1
- package/dist/src/views/auth/password-reset/change-password-form/form.d.ts +5 -0
- package/dist/src/views/auth/password-reset/change-password-form/form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/form.js +48 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts +6 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +22 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts +11 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.js +36 -0
- package/dist/src/views/auth/password-reset/form/form.d.ts +6 -0
- package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/form.js +104 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.d.ts +7 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.js +21 -0
- package/dist/src/views/auth/password-reset/form/use-form.d.ts +12 -0
- package/dist/src/views/auth/password-reset/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/use-form.js +33 -0
- package/dist/src/views/auth/password-reset/password-reset-view.d.ts +7 -0
- package/dist/src/views/auth/password-reset/password-reset-view.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/password-reset-view.js +37 -0
- package/dist/src/views/auth/sign-in/form/form.d.ts +2 -1
- package/dist/src/views/auth/sign-in/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/form.js +7 -2
- package/dist/src/views/auth/sign-in/sign-in-view.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/sign-in-view.js +10 -4
- package/dist/src/views/auth/{components → sign-up/components}/password-input.d.ts +2 -2
- package/dist/src/views/auth/sign-up/components/password-input.d.ts.map +1 -0
- package/dist/src/views/auth/{components → sign-up/components}/password-input.js +4 -4
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/form.js +2 -15
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.d.ts +1 -6
- package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.js +12 -9
- package/dist/src/views/auth/sign-up/sign-up-view.js +1 -1
- package/dist/src/views/auth/sso/callback/callback-sso-view.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +19 -5
- package/dist/src/views/auth/sso/callback/client/client.d.ts +3 -1
- package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/client.js +32 -3
- package/dist/src/views/auth/sso/callback/client/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +5 -0
- package/dist/src/views/error/error-view.d.ts +5 -3
- package/dist/src/views/error/error-view.d.ts.map +1 -1
- package/dist/src/views/error/error-view.js +24 -22
- package/dist/src/views/layouts/theme/header/header.js +1 -1
- package/dist/src/vitnode.config.d.ts +3 -0
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -44
- package/src/app/login/reset-password/page.tsx +27 -0
- package/src/locales/en.json +42 -2
- package/dist/src/views/auth/components/password-input.d.ts.map +0 -1
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Body,
|
|
3
|
-
import { createTranslator } from "use-intl";
|
|
1
|
+
/* eslint-disable @typescript-eslint/dot-notation */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body, Container, Head, Html, Img, Link, Preview, Section, Tailwind, Text } from "@react-email/components";
|
|
4
3
|
import { CONFIG } from "../lib/config.js";
|
|
5
|
-
export default function DefaultTemplateEmail({
|
|
6
|
-
const t = createTranslator({
|
|
7
|
-
locale,
|
|
8
|
-
messages
|
|
9
|
-
});
|
|
4
|
+
export default function DefaultTemplateEmail({ children, i18n: { locale }, templateProps: { logo, metadata, previewText, head, tailwindConfig } }) {
|
|
10
5
|
return /*#__PURE__*/ _jsxs(Html, {
|
|
11
6
|
lang: locale,
|
|
12
7
|
children: [
|
|
@@ -18,13 +13,32 @@ export default function DefaultTemplateEmail({ previewText, head, children, logo
|
|
|
18
13
|
}),
|
|
19
14
|
/*#__PURE__*/ _jsx(Tailwind, {
|
|
20
15
|
config: {
|
|
16
|
+
...tailwindConfig,
|
|
21
17
|
theme: {
|
|
18
|
+
...tailwindConfig?.theme,
|
|
22
19
|
extend: {
|
|
20
|
+
...tailwindConfig?.theme?.extend,
|
|
23
21
|
colors: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
foreground: '#0e1216',
|
|
27
|
-
|
|
22
|
+
...tailwindConfig?.theme?.extend?.colors,
|
|
23
|
+
background: tailwindConfig?.theme?.extend?.colors?.['background'] ?? '#edf2f8',
|
|
24
|
+
foreground: tailwindConfig?.theme?.extend?.colors?.['foreground'] ?? '#0e1216',
|
|
25
|
+
card: tailwindConfig?.theme?.extend?.colors?.['card'] ?? '#ffffff',
|
|
26
|
+
'card-foreground': tailwindConfig?.theme?.extend?.colors?.['card-foreground'] ?? '#171b1f',
|
|
27
|
+
popover: tailwindConfig?.theme?.extend?.colors?.['popover'] ?? '#ffffff',
|
|
28
|
+
'popover-foreground': tailwindConfig?.theme?.extend?.colors?.['popover-foreground'] ?? '#171b1f',
|
|
29
|
+
primary: tailwindConfig?.theme?.extend?.colors?.['primary'] ?? '#3160c0',
|
|
30
|
+
'primary-foreground': tailwindConfig?.theme?.extend?.colors?.['primary-foreground'] ?? '#fafafa',
|
|
31
|
+
secondary: tailwindConfig?.theme?.extend?.colors?.['secondary'] ?? '#f4f9ff',
|
|
32
|
+
'secondary-foreground': tailwindConfig?.theme?.extend?.colors?.['secondary-foreground'] ?? '#1e2226',
|
|
33
|
+
muted: tailwindConfig?.theme?.extend?.colors?.['muted'] ?? '#eaeff5',
|
|
34
|
+
'muted-foreground': tailwindConfig?.theme?.extend?.colors?.['muted-foreground'] ?? '#686c72',
|
|
35
|
+
accent: tailwindConfig?.theme?.extend?.colors?.['accent'] ?? '#e0e5eb',
|
|
36
|
+
'accent-foreground': tailwindConfig?.theme?.extend?.colors?.['accent-foreground'] ?? '#1e2226',
|
|
37
|
+
destructive: tailwindConfig?.theme?.extend?.colors?.['destructive'] ?? '#de3b3f',
|
|
38
|
+
warn: tailwindConfig?.theme?.extend?.colors?.['warn'] ?? '#906600',
|
|
39
|
+
border: tailwindConfig?.theme?.extend?.colors?.['border'] ?? '#d9dfe4',
|
|
40
|
+
input: tailwindConfig?.theme?.extend?.colors?.['input'] ?? '#d9dfe4',
|
|
41
|
+
ring: tailwindConfig?.theme?.extend?.colors?.['ring'] ?? '#5aa3ec'
|
|
28
42
|
}
|
|
29
43
|
}
|
|
30
44
|
}
|
|
@@ -35,53 +49,29 @@ export default function DefaultTemplateEmail({ previewText, head, children, logo
|
|
|
35
49
|
className: "mx-auto max-w-[465px]",
|
|
36
50
|
children: [
|
|
37
51
|
/*#__PURE__*/ _jsx(Section, {
|
|
38
|
-
className: "
|
|
39
|
-
children: logo ? /*#__PURE__*/ _jsx(Img, {
|
|
40
|
-
alt: metadata.title,
|
|
52
|
+
className: "my-8",
|
|
53
|
+
children: logo?.src ? /*#__PURE__*/ _jsx(Img, {
|
|
54
|
+
alt: logo.text ?? metadata.title,
|
|
41
55
|
className: "mx-auto my-0 max-w-[150px]",
|
|
42
|
-
src:
|
|
56
|
+
src: logo.src
|
|
43
57
|
}) : /*#__PURE__*/ _jsx(Text, {
|
|
44
58
|
className: "m-0 text-center text-2xl",
|
|
45
|
-
children: metadata.title
|
|
59
|
+
children: logo?.text ?? metadata.title
|
|
46
60
|
})
|
|
47
61
|
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}),
|
|
62
|
-
/*#__PURE__*/ _jsxs(Button, {
|
|
63
|
-
className: "bg-primary px-3 py-2 font-medium leading-4 text-white",
|
|
64
|
-
href: "https://example.com",
|
|
65
|
-
children: [
|
|
66
|
-
previewText,
|
|
67
|
-
"Click me"
|
|
68
|
-
]
|
|
69
|
-
}),
|
|
70
|
-
children,
|
|
71
|
-
/*#__PURE__*/ _jsx(Section, {
|
|
72
|
-
className: "my-8 text-center text-sm",
|
|
73
|
-
children: /*#__PURE__*/ _jsxs(Link, {
|
|
74
|
-
className: "text-muted-foreground",
|
|
75
|
-
href: metadata.url,
|
|
76
|
-
children: [
|
|
77
|
-
metadata.shortTitle ?? metadata.title,
|
|
78
|
-
" ©",
|
|
79
|
-
' ',
|
|
80
|
-
new Date().getFullYear()
|
|
81
|
-
]
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
]
|
|
62
|
+
children,
|
|
63
|
+
/*#__PURE__*/ _jsx(Section, {
|
|
64
|
+
className: "my-8 text-center text-sm",
|
|
65
|
+
children: /*#__PURE__*/ _jsxs(Link, {
|
|
66
|
+
className: "text-muted-foreground",
|
|
67
|
+
href: metadata.url,
|
|
68
|
+
children: [
|
|
69
|
+
metadata.shortTitle ?? metadata.title,
|
|
70
|
+
" ©",
|
|
71
|
+
' ',
|
|
72
|
+
new Date().getFullYear()
|
|
73
|
+
]
|
|
74
|
+
})
|
|
85
75
|
})
|
|
86
76
|
]
|
|
87
77
|
})
|
|
@@ -92,14 +82,18 @@ export default function DefaultTemplateEmail({ previewText, head, children, logo
|
|
|
92
82
|
}
|
|
93
83
|
DefaultTemplateEmail.PreviewProps = {
|
|
94
84
|
children: 'This is a preview text for the email template.',
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
templateProps: {
|
|
86
|
+
metadata: {
|
|
87
|
+
title: 'VitNode - Email Template',
|
|
88
|
+
shortTitle: 'VitNode',
|
|
89
|
+
url: CONFIG.web.href
|
|
90
|
+
},
|
|
91
|
+
logo: {
|
|
92
|
+
src: 'http://localhost:3000/logo_vitnode_dark.png'
|
|
93
|
+
}
|
|
102
94
|
},
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
i18n: {
|
|
96
|
+
messages: {},
|
|
97
|
+
locale: 'en'
|
|
98
|
+
}
|
|
105
99
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type DefaultTemplateEmailProps } from './default-template';
|
|
2
|
+
interface ResetPasswordEmailTemplateProps extends DefaultTemplateEmailProps {
|
|
3
|
+
expiryDate: Date;
|
|
4
|
+
resetUrl: string;
|
|
5
|
+
userIpAddress?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function ResetPasswordEmailTemplate({ i18n, resetUrl, expiryDate, userIpAddress, user, ...props }: ResetPasswordEmailTemplateProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare namespace ResetPasswordEmailTemplate {
|
|
9
|
+
var PreviewProps: {
|
|
10
|
+
resetUrl: string;
|
|
11
|
+
expiryDate: Date;
|
|
12
|
+
userIpAddress: string;
|
|
13
|
+
user: {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
email: string;
|
|
17
|
+
language: string;
|
|
18
|
+
nameCode: string;
|
|
19
|
+
};
|
|
20
|
+
i18n: {
|
|
21
|
+
messages: {
|
|
22
|
+
core: {
|
|
23
|
+
auth: {
|
|
24
|
+
reset_password: {
|
|
25
|
+
email: {
|
|
26
|
+
subject: string;
|
|
27
|
+
greeting: string;
|
|
28
|
+
intro: string;
|
|
29
|
+
button: string;
|
|
30
|
+
instructions: string;
|
|
31
|
+
no_action: string;
|
|
32
|
+
security_note: string;
|
|
33
|
+
help: string;
|
|
34
|
+
expire_time: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
locale: string;
|
|
41
|
+
};
|
|
42
|
+
children: string;
|
|
43
|
+
templateProps: {
|
|
44
|
+
metadata: {
|
|
45
|
+
title: string;
|
|
46
|
+
shortTitle: string;
|
|
47
|
+
url: string;
|
|
48
|
+
};
|
|
49
|
+
logo: {
|
|
50
|
+
src: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export default ResetPasswordEmailTemplate;
|
|
56
|
+
//# sourceMappingURL=reset-password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../../src/emails/reset-password.tsx"],"names":[],"mappings":"AAGA,OAA6B,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAW5B,UAAU,+BAAgC,SAAQ,yBAAyB;IACzE,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iBAAwB,0BAA0B,CAAC,EACjD,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,+BAA+B,2CAgFjC;kBAvFuB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAA1B,0BAA0B"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Hr, Link, Section, Text } from "@react-email/components";
|
|
3
|
+
import { createTranslator } from "use-intl";
|
|
4
|
+
import DefaultTemplateEmail from "./default-template.js";
|
|
5
|
+
import { EmailButton } from "./ui/button.js";
|
|
6
|
+
import { EmailCard, EmailCardContent, EmailCardDescription, EmailCardFooter, EmailCardHeader, EmailCardTitle } from "./ui/card.js";
|
|
7
|
+
export default function ResetPasswordEmailTemplate({ i18n, resetUrl, expiryDate, userIpAddress, user, ...props }) {
|
|
8
|
+
const t = createTranslator(i18n);
|
|
9
|
+
const userName = user?.name ?? 'there';
|
|
10
|
+
return /*#__PURE__*/ _jsxs(DefaultTemplateEmail, {
|
|
11
|
+
i18n: i18n,
|
|
12
|
+
templateProps: {
|
|
13
|
+
...props.templateProps,
|
|
14
|
+
previewText: t('core.auth.reset_password.email.subject')
|
|
15
|
+
},
|
|
16
|
+
user: user,
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ _jsxs(EmailCard, {
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ _jsxs(EmailCardHeader, {
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ _jsx(EmailCardTitle, {
|
|
23
|
+
children: t('core.auth.reset_password.email.greeting', {
|
|
24
|
+
name: userName
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ _jsx(EmailCardDescription, {
|
|
28
|
+
children: t('core.auth.reset_password.email.intro')
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsxs(EmailCardContent, {
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ _jsx(Section, {
|
|
35
|
+
className: "text-center",
|
|
36
|
+
children: /*#__PURE__*/ _jsx(EmailButton, {
|
|
37
|
+
className: "min-w-[200px]",
|
|
38
|
+
href: resetUrl,
|
|
39
|
+
size: "lg",
|
|
40
|
+
children: t('core.auth.reset_password.email.button')
|
|
41
|
+
})
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
44
|
+
className: "text-muted-foreground mt-6 text-sm leading-relaxed",
|
|
45
|
+
children: t('core.auth.reset_password.email.instructions')
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
48
|
+
className: "text-muted-foreground mt-4 text-sm leading-relaxed",
|
|
49
|
+
children: t('core.auth.reset_password.email.expire_time', {
|
|
50
|
+
date: expiryDate.toLocaleString(i18n.locale, {
|
|
51
|
+
year: 'numeric',
|
|
52
|
+
month: 'long',
|
|
53
|
+
day: 'numeric',
|
|
54
|
+
hour: '2-digit',
|
|
55
|
+
minute: '2-digit',
|
|
56
|
+
timeZoneName: 'short'
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsxs(EmailCardFooter, {
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ _jsx(Hr, {
|
|
65
|
+
className: "border-border my-4 w-full border-t border-solid"
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
68
|
+
className: "text-muted-foreground m-0 text-sm leading-relaxed",
|
|
69
|
+
children: t('core.auth.reset_password.email.no_action')
|
|
70
|
+
}),
|
|
71
|
+
userIpAddress && /*#__PURE__*/ _jsx(Text, {
|
|
72
|
+
className: "text-muted-foreground mt-4 text-xs",
|
|
73
|
+
children: t('core.auth.reset_password.email.security_note', {
|
|
74
|
+
ip: userIpAddress
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsxs(Section, {
|
|
82
|
+
className: "mt-6",
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
85
|
+
className: "text-muted-foreground text-sm",
|
|
86
|
+
children: t('core.auth.reset_password.email.help')
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ _jsx(Link, {
|
|
89
|
+
className: "text-primary break-all text-sm underline",
|
|
90
|
+
href: resetUrl,
|
|
91
|
+
children: resetUrl
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
ResetPasswordEmailTemplate.PreviewProps = {
|
|
99
|
+
...DefaultTemplateEmail.PreviewProps,
|
|
100
|
+
resetUrl: 'https://example.com/reset-password?token=abc123',
|
|
101
|
+
expiryDate: new Date(Date.now() + 30 * 60 * 1000),
|
|
102
|
+
userIpAddress: '192.168.1.1',
|
|
103
|
+
user: {
|
|
104
|
+
id: 1,
|
|
105
|
+
name: 'John Doe',
|
|
106
|
+
email: 'john@example.com',
|
|
107
|
+
language: 'en',
|
|
108
|
+
nameCode: 'john-doe'
|
|
109
|
+
},
|
|
110
|
+
i18n: {
|
|
111
|
+
...DefaultTemplateEmail.PreviewProps.i18n,
|
|
112
|
+
messages: {
|
|
113
|
+
core: {
|
|
114
|
+
auth: {
|
|
115
|
+
reset_password: {
|
|
116
|
+
email: {
|
|
117
|
+
subject: 'Reset your password',
|
|
118
|
+
greeting: 'Hello {name}!',
|
|
119
|
+
intro: 'We received a request to reset your password for your account.',
|
|
120
|
+
button: 'Reset Password',
|
|
121
|
+
instructions: 'Click the button above to reset your password. This link will expire in 30 minutes for security reasons.',
|
|
122
|
+
no_action: "If you didn't request a password reset, you can safely ignore this email. Your password will remain unchanged.",
|
|
123
|
+
security_note: 'For your security, this request was made from IP address: {ip}',
|
|
124
|
+
help: "If you're having trouble with the button above, copy and paste the URL below into your web browser:",
|
|
125
|
+
expire_time: 'This link will expire on {date}'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Button as ButtonReactEmail } from '@react-email/components';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "secondary" | "destructive" | "default" | "destructiveGhost" | "outline" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const EmailButton: ({ className, variant, size, ...props }: React.ComponentProps<typeof ButtonReactEmail> & VariantProps<typeof buttonVariants>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/emails/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,cAAc;;;8EAwBnB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,wCAKzB,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,GAC9C,YAAY,CAAC,OAAO,cAAc,CAAC,4CAOpC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button as ButtonReactEmail } from "@react-email/components";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const buttonVariants = cva('cursor-pointer whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all', {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-primary text-primary-foreground shadow-xs',
|
|
9
|
+
destructive: 'bg-destructive text-white shadow-xs',
|
|
10
|
+
destructiveGhost: 'text-destructive',
|
|
11
|
+
outline: 'border bg-background shadow-xs',
|
|
12
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-xs',
|
|
13
|
+
ghost: '',
|
|
14
|
+
link: 'text-primary underline-offset-4'
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: 'px-4 py-2',
|
|
18
|
+
sm: 'rounded-md gap-1.5 px-3 py-1.5',
|
|
19
|
+
lg: 'rounded-md px-6 py-2.5'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
size: 'default'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export const EmailButton = ({ className, variant, size, ...props })=>{
|
|
28
|
+
return /*#__PURE__*/ _jsx(ButtonReactEmail, {
|
|
29
|
+
className: cn(buttonVariants({
|
|
30
|
+
variant,
|
|
31
|
+
size,
|
|
32
|
+
className
|
|
33
|
+
})),
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Section, Text } from '@react-email/components';
|
|
2
|
+
export declare const EmailCard: ({ className, ...props }: React.ComponentProps<typeof Section>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const EmailCardHeader: ({ className, ...props }: React.ComponentProps<typeof Section>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const EmailCardTitle: ({ className, ...props }: React.ComponentProps<typeof Text>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const EmailCardDescription: ({ className, ...props }: React.ComponentProps<typeof Text>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const EmailCardContent: ({ className, ...props }: React.ComponentProps<typeof Section>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const EmailCardFooter: ({ className, ...props }: React.ComponentProps<typeof Section>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/emails/ui/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIxD,eAAO,MAAM,SAAS,GAAI,yBAGvB,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,4CAUtC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,yBAG7B,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,4CAEtC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,yBAG5B,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,4CAOnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,yBAGlC,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,4CAOnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,yBAG9B,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,4CAEtC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,yBAG7B,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,4CAEtC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Section, Text } from "@react-email/components";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
export const EmailCard = ({ className, ...props })=>{
|
|
5
|
+
return /*#__PURE__*/ _jsx(Section, {
|
|
6
|
+
className: cn('bg-card text-card-foreground border-border rounded-xl border border-solid py-6 shadow-sm', className),
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const EmailCardHeader = ({ className, ...props })=>{
|
|
11
|
+
return /*#__PURE__*/ _jsx(Section, {
|
|
12
|
+
className: cn('mb-6 px-6', className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export const EmailCardTitle = ({ className, ...props })=>{
|
|
17
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
18
|
+
className: cn('text-xl font-semibold leading-[0]', className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export const EmailCardDescription = ({ className, ...props })=>{
|
|
23
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
24
|
+
className: cn('text-muted-foreground m-0 text-sm', className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export const EmailCardContent = ({ className, ...props })=>{
|
|
29
|
+
return /*#__PURE__*/ _jsx(Section, {
|
|
30
|
+
className: cn('px-6', className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const EmailCardFooter = ({ className, ...props })=>{
|
|
35
|
+
return /*#__PURE__*/ _jsx(Section, {
|
|
36
|
+
className: cn('mt-6 px-6', className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-captcha.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-captcha.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-captcha.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-captcha.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAS7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,eAAO,MAAM,UAAU,GACrB,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC;;;oBAwG9B,OAAO,CAAC,MAAM,CAAC;CA+B3C,CAAC"}
|
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
import { useLocale, useTranslations } from "next-intl";
|
|
1
|
+
/* eslint-disable @eslint-react/hooks-extra/no-direct-set-state-in-use-effect */ import { useLocale, useTranslations } from "next-intl";
|
|
2
2
|
import { useTheme } from "next-themes";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { toast } from "sonner";
|
|
5
|
+
import { usePathname } from "../lib/navigation.js";
|
|
5
6
|
export const useCaptcha = (captcha)=>{
|
|
6
7
|
const t = useTranslations('core.global.errors');
|
|
7
8
|
const locale = useLocale();
|
|
8
9
|
const { resolvedTheme } = useTheme();
|
|
9
10
|
const [isReady, setIsReady] = React.useState(false);
|
|
10
11
|
const [token, setToken] = React.useState('');
|
|
12
|
+
const pathname = usePathname();
|
|
11
13
|
const handleLoaded = ()=>{
|
|
12
14
|
if (!captcha) return;
|
|
13
15
|
const elementId = 'vitnode_captcha';
|
|
14
16
|
if (captcha.type === 'cloudflare_turnstile') {
|
|
15
17
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16
|
-
// @ts-
|
|
18
|
+
// @ts-expect-error
|
|
17
19
|
window.turnstile.render(`#${elementId}`, {
|
|
18
20
|
sitekey: captcha.siteKey,
|
|
19
21
|
theme: resolvedTheme,
|
|
20
22
|
language: locale,
|
|
21
23
|
callback: (token)=>{
|
|
22
24
|
setToken(token);
|
|
25
|
+
// ✅ Set isReady to true ONLY when the token is received
|
|
26
|
+
setIsReady(true);
|
|
27
|
+
},
|
|
28
|
+
// Optional: Add more callbacks for a better user experience
|
|
29
|
+
'expired-callback': ()=>{
|
|
30
|
+
onReset();
|
|
23
31
|
}
|
|
24
32
|
});
|
|
33
|
+
} else {
|
|
34
|
+
// For reCAPTCHA, the script being loaded means it's ready.
|
|
35
|
+
setIsReady(true);
|
|
25
36
|
}
|
|
26
|
-
setIsReady(true);
|
|
27
37
|
};
|
|
28
38
|
const handleError = ()=>{
|
|
29
39
|
toast.error(t('title'), {
|
|
@@ -31,9 +41,15 @@ export const useCaptcha = (captcha)=>{
|
|
|
31
41
|
});
|
|
32
42
|
};
|
|
33
43
|
React.useEffect(()=>{
|
|
34
|
-
if (!captcha)
|
|
44
|
+
if (!captcha) {
|
|
45
|
+
// If no captcha is required, consider it "ready"
|
|
46
|
+
setIsReady(true);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Reset state on captcha type change
|
|
50
|
+
setIsReady(false);
|
|
51
|
+
setToken('');
|
|
35
52
|
const googleCaptchaDomain = `https://www.google.com/recaptcha/api.js?hl=${locale}`;
|
|
36
|
-
// Load script
|
|
37
53
|
const script = document.createElement('script');
|
|
38
54
|
if (captcha.type === 'cloudflare_turnstile') {
|
|
39
55
|
script.src = 'https://challenges.cloudflare.com/turnstile/v0/api.js';
|
|
@@ -41,37 +57,53 @@ export const useCaptcha = (captcha)=>{
|
|
|
41
57
|
script.src = `${googleCaptchaDomain}&render=${captcha.siteKey}`;
|
|
42
58
|
}
|
|
43
59
|
if (!script.src) return;
|
|
60
|
+
script.async = true;
|
|
61
|
+
script.defer = true;
|
|
44
62
|
document.body.appendChild(script);
|
|
45
63
|
script.addEventListener('load', handleLoaded);
|
|
46
64
|
script.addEventListener('error', handleError);
|
|
47
65
|
return ()=>{
|
|
48
66
|
script.removeEventListener('load', handleLoaded);
|
|
49
67
|
script.removeEventListener('error', handleError);
|
|
50
|
-
document.body.
|
|
68
|
+
if (document.body.contains(script)) {
|
|
69
|
+
document.body.removeChild(script);
|
|
70
|
+
}
|
|
71
|
+
// Clean up the captcha widget if it exists
|
|
72
|
+
const widget = document.getElementById('vitnode_captcha');
|
|
73
|
+
if (widget) {
|
|
74
|
+
widget.innerHTML = '';
|
|
75
|
+
}
|
|
51
76
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
77
|
+
}, [
|
|
78
|
+
pathname,
|
|
79
|
+
locale,
|
|
80
|
+
captcha?.type,
|
|
81
|
+
captcha?.siteKey
|
|
82
|
+
]);
|
|
55
83
|
const onReset = ()=>{
|
|
56
84
|
if (!captcha) return;
|
|
57
85
|
if (captcha.type === 'cloudflare_turnstile') {
|
|
58
86
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
59
|
-
// @ts-
|
|
60
|
-
window.turnstile
|
|
87
|
+
// @ts-expect-error
|
|
88
|
+
if (window.turnstile) {
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
90
|
+
// @ts-expect-error
|
|
91
|
+
window.turnstile.reset();
|
|
92
|
+
}
|
|
61
93
|
}
|
|
62
94
|
setToken('');
|
|
95
|
+
setIsReady(false);
|
|
63
96
|
};
|
|
64
97
|
const getToken = async ()=>{
|
|
65
98
|
if (!captcha) return '';
|
|
66
99
|
if (captcha.type === 'recaptcha_v3') {
|
|
67
|
-
// Captcha
|
|
68
100
|
return new Promise((resolve)=>{
|
|
69
101
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
-
// @ts-
|
|
102
|
+
// @ts-expect-error
|
|
71
103
|
window.grecaptcha.ready(async ()=>{
|
|
72
104
|
try {
|
|
73
105
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
74
|
-
// @ts-
|
|
106
|
+
// @ts-expect-error
|
|
75
107
|
const token = await window.grecaptcha.execute(captcha.siteKey, {
|
|
76
108
|
action: 'submit'
|
|
77
109
|
});
|
|
@@ -79,8 +111,8 @@ export const useCaptcha = (captcha)=>{
|
|
|
79
111
|
} catch (error) {
|
|
80
112
|
// eslint-disable-next-line no-console
|
|
81
113
|
console.error('Captcha error', error);
|
|
114
|
+
resolve('');
|
|
82
115
|
}
|
|
83
|
-
resolve('');
|
|
84
116
|
});
|
|
85
117
|
});
|
|
86
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAKjB,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'body' in args ? JSON.stringify(args.body) : undefined,
|
|
36
36
|
...options
|
|
37
37
|
});
|
|
38
|
-
if (
|
|
38
|
+
if (response.status === 500) {
|
|
39
39
|
const errorText = await response.text();
|
|
40
40
|
throw new Error(`${response.status} - ${url.toString()}\n${response.statusText ?? errorText}`);
|
|
41
41
|
}
|
|
42
|
+
if (response.status >= 400) {
|
|
43
|
+
const errorText = await response.text();
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.error(`\x1b[34m[VitNode - API]\x1b[0m \x1b[31m${response.status}\x1b[0m - \x1b[33m${url.toString()}\x1b[0m\n\x1b[36mError: ${errorText}\x1b[0m`);
|
|
46
|
+
}
|
|
42
47
|
return response;
|
|
43
48
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/password-reset/change-password-form/form.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,kBAAkB,GAAI,OAAO;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,4CAkCA,CAAC"}
|