@vitnode/core 1.2.0-canary.21 → 1.2.0-canary.22
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/src/api/models/user/sign-up.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.js +1 -2
- package/dist/src/api/models/user.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +10 -2
- 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 +14 -4
- package/dist/src/api/modules/users/users.module.d.ts +10 -2
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/components/table/content.js +1 -1
- package/dist/src/components/table/order-table-head.js +1 -1
- package/dist/src/components/ui/button.d.ts +1 -1
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +1 -0
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +14 -1
- package/dist/src/views/auth/sign-in/form/form.js +1 -1
- package/dist/src/views/auth/sign-in/form/{hooks/mutation-api.d.ts → mutation-api.d.ts} +1 -1
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sign-in/form/{hooks/mutation-api.js → mutation-api.js} +3 -3
- package/dist/src/views/auth/sign-in/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/email-confirmation-view.d.ts +4 -0
- package/dist/src/views/auth/sign-up/email-confirmation-view.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/email-confirmation-view.js +55 -0
- package/dist/src/views/auth/sign-up/form/form.js +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +14 -0
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/mutation-api.js +29 -0
- package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/{hooks/use-form.js → use-form.js} +7 -3
- package/dist/src/views/auth/sign-up/sign-up-view.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/sign-up-view.js +38 -35
- package/dist/src/views/auth/sign-up/wrapper.d.ts +8 -0
- package/dist/src/views/auth/sign-up/wrapper.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/wrapper.js +19 -0
- package/dist/src/views/auth/sso/buttons/sso-buttons.d.ts.map +1 -1
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +5 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/locales/en.json +5 -0
- package/dist/src/views/auth/sign-in/form/hooks/mutation-api.d.ts.map +0 -1
- package/dist/src/views/auth/sign-in/form/hooks/use-form.d.ts.map +0 -1
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.d.ts +0 -6
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.d.ts.map +0 -1
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.js +0 -18
- package/dist/src/views/auth/sign-up/form/hooks/use-form.d.ts.map +0 -1
- /package/dist/src/views/auth/sign-in/form/{hooks/use-form.d.ts → use-form.d.ts} +0 -0
- /package/dist/src/views/auth/sign-in/form/{hooks/use-form.js → use-form.js} +0 -0
- /package/dist/src/views/auth/sign-up/form/{hooks/use-form.d.ts → use-form.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAkEpC,eAAO,MAAM,MAAM,GACjB,8CAKG;IACD,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,EACD,GAAG,OAAO;;;;;;;;;;;;;EAwDX,CAAC"}
|
|
@@ -34,8 +34,7 @@ const getDefaultData = async (c)=>{
|
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
roleId: defaultRole.id,
|
|
37
|
-
|
|
38
|
-
emailVerified: false
|
|
37
|
+
emailVerified: !c.get('core').emailProvider
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
export const signUp = async ({ email, name, newsletter, hashedPassword }, c)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/api/models/user.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,WAAW;;;;;;;;;;;;;;cAAe;IAC1B,kBAAkB;;;;;;;OAAsB;IACxC,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/api/models/user.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,WAAW;;;;;;;;;;;;;;cAAe;IAC1B,kBAAkB;;;;;;;OAAsB;IACxC,MAAM;;;;kBAEw6C,CAAC;;;;;;;;;;;;;;OAF/5C;CACjB"}
|
|
@@ -35,7 +35,9 @@ export declare const signUpRoute: {
|
|
|
35
35
|
};
|
|
36
36
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
37
37
|
id: number;
|
|
38
|
-
|
|
38
|
+
emailVerified: boolean;
|
|
39
|
+
email: string;
|
|
40
|
+
}, 201, "json">>;
|
|
39
41
|
pluginId: "@vitnode/core";
|
|
40
42
|
route: {
|
|
41
43
|
method: "post";
|
|
@@ -67,15 +69,21 @@ export declare const signUpRoute: {
|
|
|
67
69
|
};
|
|
68
70
|
};
|
|
69
71
|
responses: {
|
|
70
|
-
|
|
72
|
+
201: {
|
|
71
73
|
content: {
|
|
72
74
|
'application/json': {
|
|
73
75
|
schema: z.ZodObject<{
|
|
74
76
|
id: z.ZodNumber;
|
|
77
|
+
emailVerified: z.ZodBoolean;
|
|
78
|
+
email: z.ZodString;
|
|
75
79
|
}, "strip", z.ZodTypeAny, {
|
|
76
80
|
id: number;
|
|
81
|
+
email: string;
|
|
82
|
+
emailVerified: boolean;
|
|
77
83
|
}, {
|
|
78
84
|
id: number;
|
|
85
|
+
email: string;
|
|
86
|
+
emailVerified: boolean;
|
|
79
87
|
}>;
|
|
80
88
|
};
|
|
81
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAe1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDtB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { buildRoute } from "../../../lib/route.js";
|
|
|
3
3
|
import { PasswordModel } from "../../../models/password.js";
|
|
4
4
|
import { UserModel } from "../../../models/user.js";
|
|
5
5
|
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
6
|
+
import { SessionModel } from "../../../models/session.js";
|
|
6
7
|
const nameRegex = /^(?!.* {2})[\p{L}\p{N}._@ -]*$/u;
|
|
7
8
|
export const zodSignUpSchema = z.object({
|
|
8
9
|
email: z.string().email().toLowerCase().openapi({
|
|
@@ -35,11 +36,13 @@ export const signUpRoute = buildRoute({
|
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
responses: {
|
|
38
|
-
|
|
39
|
+
201: {
|
|
39
40
|
content: {
|
|
40
41
|
'application/json': {
|
|
41
42
|
schema: z.object({
|
|
42
|
-
id: z.number()
|
|
43
|
+
id: z.number(),
|
|
44
|
+
emailVerified: z.boolean(),
|
|
45
|
+
email: z.string().email()
|
|
43
46
|
})
|
|
44
47
|
}
|
|
45
48
|
},
|
|
@@ -53,8 +56,15 @@ export const signUpRoute = buildRoute({
|
|
|
53
56
|
...c.req.valid('json'),
|
|
54
57
|
hashedPassword
|
|
55
58
|
}, c);
|
|
59
|
+
if (data.emailVerified) {
|
|
60
|
+
await new SessionModel(c).createSessionByUserId(data.id);
|
|
61
|
+
} else {
|
|
62
|
+
// TODO: Send verification email
|
|
63
|
+
}
|
|
56
64
|
return c.json({
|
|
57
|
-
id: data.id
|
|
58
|
-
|
|
65
|
+
id: data.id,
|
|
66
|
+
emailVerified: data.emailVerified,
|
|
67
|
+
email: data.email
|
|
68
|
+
}, 201);
|
|
59
69
|
}
|
|
60
70
|
});
|
|
@@ -234,7 +234,9 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
234
234
|
};
|
|
235
235
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
236
236
|
id: number;
|
|
237
|
-
|
|
237
|
+
emailVerified: boolean;
|
|
238
|
+
email: string;
|
|
239
|
+
}, 201, "json">>;
|
|
238
240
|
pluginId: "@vitnode/core";
|
|
239
241
|
route: {
|
|
240
242
|
method: "post";
|
|
@@ -266,15 +268,21 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
266
268
|
};
|
|
267
269
|
};
|
|
268
270
|
responses: {
|
|
269
|
-
|
|
271
|
+
201: {
|
|
270
272
|
content: {
|
|
271
273
|
'application/json': {
|
|
272
274
|
schema: import("zod").ZodObject<{
|
|
273
275
|
id: import("zod").ZodNumber;
|
|
276
|
+
emailVerified: import("zod").ZodBoolean;
|
|
277
|
+
email: import("zod").ZodString;
|
|
274
278
|
}, "strip", import("zod").ZodTypeAny, {
|
|
275
279
|
id: number;
|
|
280
|
+
email: string;
|
|
281
|
+
emailVerified: boolean;
|
|
276
282
|
}, {
|
|
277
283
|
id: number;
|
|
284
|
+
email: string;
|
|
285
|
+
emailVerified: boolean;
|
|
278
286
|
}>;
|
|
279
287
|
};
|
|
280
288
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAKtB,CAAC"}
|
|
@@ -39,7 +39,7 @@ export function ContentDataTable({ columns, edges, pageInfo, order, customNotFou
|
|
|
39
39
|
}) ?? (column.id === 'actions' ? '' : String(row[column.id]));
|
|
40
40
|
return /*#__PURE__*/ _jsx(TableCell, {
|
|
41
41
|
className: cn({
|
|
42
|
-
'flex
|
|
42
|
+
'flex items-center justify-end gap-2': column.id === 'actions'
|
|
43
43
|
}),
|
|
44
44
|
children: content
|
|
45
45
|
}, `${row.id}_${column.id.toString()}`);
|
|
@@ -16,7 +16,7 @@ export function OrderTableHeadDataTable({ id, children, order: { defaultOrder }
|
|
|
16
16
|
const isActive = currentOrderBy === id.toString();
|
|
17
17
|
const nextOrder = isActive && currentOrder === 'asc' ? 'desc' : 'asc';
|
|
18
18
|
return /*#__PURE__*/ _jsxs(Button, {
|
|
19
|
-
className: "[&_svg]:text-muted-foreground flex h-8 items-center gap-1.5 rounded-md px-2 py-1.5 [&_svg]:size-4 [&_svg]:shrink-0",
|
|
19
|
+
className: "[&_svg]:text-muted-foreground -ml-2 flex h-8 items-center gap-1.5 rounded-md px-2 py-1.5 [&_svg]:size-4 [&_svg]:shrink-0",
|
|
20
20
|
onClick: ()=>{
|
|
21
21
|
startTransition(()=>{
|
|
22
22
|
const params = new URLSearchParams(searchParams.toString());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "destructiveGhost" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, isLoading, loadingText, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,cAAc;;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,cAAc;;;8EA+BnB,CAAC;AAEF,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,SAAS,EACT,WAAW,EACX,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAC/B,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CA4BF;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -10,6 +10,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
|
|
|
10
10
|
variant: {
|
|
11
11
|
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
12
12
|
destructive: 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
13
|
+
destructiveGhost: 'hover:bg-destructive/20 text-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40',
|
|
13
14
|
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
14
15
|
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
15
16
|
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/layouts/sidebar/nav/item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/layouts/sidebar/nav/item.tsx"],"names":[],"mappings":"AAoBA,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,YAAY,GAAI,+CAM1B,iBAAiB,GAAG;IACrB,KAAK,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,EAAE,CAAC;CAC3C,4CA2EA,CAAC"}
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ChevronRight, MenuIcon } from "lucide-react";
|
|
4
4
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../../components/ui/collapsible.js";
|
|
5
|
-
import { SidebarMenuButton } from "../../../../../components/ui/sidebar.js";
|
|
5
|
+
import { SidebarMenuButton, useSidebar } from "../../../../../components/ui/sidebar.js";
|
|
6
6
|
import { SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "../../../../../components/ui/sidebar.js";
|
|
7
|
+
import { useIsMobile } from "../../../../../hooks/use-mobile.js";
|
|
7
8
|
import { Link } from "../../../../../lib/navigation.js";
|
|
8
9
|
import { cn } from "../../../../../lib/utils.js";
|
|
9
10
|
export const ItemNavAdmin = ({ href, title, icon, items = [], isOpenInNewTab })=>{
|
|
11
|
+
const { toggleSidebar } = useSidebar();
|
|
12
|
+
const isMobile = useIsMobile();
|
|
10
13
|
const content = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
11
14
|
children: [
|
|
12
15
|
icon ?? /*#__PURE__*/ _jsx(MenuIcon, {}),
|
|
@@ -22,6 +25,11 @@ export const ItemNavAdmin = ({ href, title, icon, items = [], isOpenInNewTab })=
|
|
|
22
25
|
tooltip: title,
|
|
23
26
|
children: /*#__PURE__*/ _jsx(Link, {
|
|
24
27
|
href: href,
|
|
28
|
+
onClick: ()=>{
|
|
29
|
+
if (isMobile) {
|
|
30
|
+
toggleSidebar();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
25
33
|
prefetch: true,
|
|
26
34
|
rel: isOpenInNewTab ? 'noopener noreferrer' : undefined,
|
|
27
35
|
target: isOpenInNewTab ? '_blank' : undefined,
|
|
@@ -55,6 +63,11 @@ export const ItemNavAdmin = ({ href, title, icon, items = [], isOpenInNewTab })=
|
|
|
55
63
|
asChild: true,
|
|
56
64
|
children: /*#__PURE__*/ _jsx(Link, {
|
|
57
65
|
href: item.href,
|
|
66
|
+
onClick: ()=>{
|
|
67
|
+
if (isMobile) {
|
|
68
|
+
toggleSidebar();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
58
71
|
prefetch: true,
|
|
59
72
|
rel: item.isOpenInNewTab ? 'noopener noreferrer' : undefined,
|
|
60
73
|
target: item.isOpenInNewTab ? '_blank' : undefined,
|
|
@@ -5,7 +5,7 @@ import { useTranslations } from "next-intl";
|
|
|
5
5
|
import { AutoForm } from "../../../../components/form/auto-form.js";
|
|
6
6
|
import { AutoFormInput } from "../../../../components/form/fields/input.js";
|
|
7
7
|
import { Alert, AlertDescription, AlertTitle } from "../../../../components/ui/alert.js";
|
|
8
|
-
import { useFormSignIn } from "./
|
|
8
|
+
import { useFormSignIn } from "./use-form.js";
|
|
9
9
|
export const FormSignIn = ({ isAdmin })=>{
|
|
10
10
|
const t = useTranslations('core.auth.sign_in');
|
|
11
11
|
const { onSubmit, error, formSchema } = useFormSignIn({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { zodSignInSchema } from '
|
|
2
|
+
import type { zodSignInSchema } from '../../../../api/modules/users/routes/sign-in.route';
|
|
3
3
|
export declare const mutationApi: (input: z.infer<typeof zodSignInSchema> & {
|
|
4
4
|
isAdmin?: boolean;
|
|
5
5
|
}) => Promise<{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-in/form/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAMhF,eAAO,MAAM,WAAW,GACtB,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,GAAG;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;;;;cA6BF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use server';
|
|
2
2
|
import { revalidatePath } from "next/cache";
|
|
3
|
-
import { usersModule } from "
|
|
4
|
-
import { fetcher } from "
|
|
5
|
-
import { redirect } from "
|
|
3
|
+
import { usersModule } from "../../../../api/modules/users/users.module.js";
|
|
4
|
+
import { fetcher } from "../../../../lib/fetcher.js";
|
|
5
|
+
import { redirect } from "../../../../lib/navigation.js";
|
|
6
6
|
export const mutationApi = async (input)=>{
|
|
7
7
|
const res = await fetcher(usersModule, {
|
|
8
8
|
path: '/sign_in',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-in/form/use-form.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE;uBAe9B,CAAC,CAAC,KAAK;;;;;;;;;OAAmB;;;;;;;;;;;;CAiB3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-confirmation-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-up/email-confirmation-view.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB,GAAI,WAAW;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,4CA2BjE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Mail, MailboxIcon } from "lucide-react";
|
|
3
|
+
import { useTranslations } from "next-intl";
|
|
4
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../../../components/ui/card.js";
|
|
5
|
+
export const EmailConfirmationView = ({ email })=>{
|
|
6
|
+
const t = useTranslations('core.auth.sign_up.email_confirmation');
|
|
7
|
+
return /*#__PURE__*/ _jsxs(Card, {
|
|
8
|
+
className: "w-full max-w-md p-6",
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ _jsxs(CardHeader, {
|
|
11
|
+
className: "text-center",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsx("div", {
|
|
14
|
+
className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900",
|
|
15
|
+
children: /*#__PURE__*/ _jsx(MailboxIcon, {
|
|
16
|
+
className: "h-8 w-8 text-green-600 dark:text-green-400"
|
|
17
|
+
})
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ _jsx(CardTitle, {
|
|
20
|
+
className: "text-2xl font-bold",
|
|
21
|
+
children: t('title')
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ _jsx(CardDescription, {
|
|
24
|
+
className: "text-base",
|
|
25
|
+
children: t('desc')
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ _jsxs(CardContent, {
|
|
30
|
+
className: "space-y-6",
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx("div", {
|
|
33
|
+
className: "bg-muted rounded-lg p-4",
|
|
34
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
35
|
+
className: "flex items-center gap-3",
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ _jsx("span", {
|
|
38
|
+
className: "text-sm font-medium",
|
|
39
|
+
children: email
|
|
40
|
+
}),
|
|
41
|
+
/*#__PURE__*/ _jsx(Mail, {
|
|
42
|
+
className: "text-muted-foreground ml-auto size-5"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ _jsx("p", {
|
|
48
|
+
className: "text-muted-foreground text-center text-sm",
|
|
49
|
+
children: t('check_spam')
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -7,7 +7,7 @@ import { AutoFormInput } from "../../../../components/form/fields/input.js";
|
|
|
7
7
|
import { Link } from "../../../../lib/navigation.js";
|
|
8
8
|
import { removeSpecialCharacters } from "../../../../lib/special-characters.js";
|
|
9
9
|
import { PasswordInput } from "../../components/password-input.js";
|
|
10
|
-
import { useFormSignUp } from "./
|
|
10
|
+
import { useFormSignUp } from "./use-form.js";
|
|
11
11
|
export const FormSignUp = ({ isEmail })=>{
|
|
12
12
|
const t = useTranslations('core.auth.sign_up');
|
|
13
13
|
const { onSubmit, formSchema } = useFormSignUp();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { zodSignUpSchema } from '../../../../api/modules/users/routes/sign-up.route';
|
|
3
|
+
export declare const mutationApi: (input: z.infer<typeof zodSignUpSchema>) => Promise<{
|
|
4
|
+
error: string;
|
|
5
|
+
data?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
data: {
|
|
8
|
+
id: number;
|
|
9
|
+
email: string;
|
|
10
|
+
emailVerified: boolean;
|
|
11
|
+
};
|
|
12
|
+
error?: undefined;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=mutation-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAMhF,eAAO,MAAM,WAAW,GAAU,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;;;;;;;;;;EAsBvE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
import { revalidatePath } from "next/cache";
|
|
3
|
+
import { usersModule } from "../../../../api/modules/users/users.module.js";
|
|
4
|
+
import { fetcher } from "../../../../lib/fetcher.js";
|
|
5
|
+
import { redirect } from "../../../../lib/navigation.js";
|
|
6
|
+
export const mutationApi = async (input)=>{
|
|
7
|
+
const res = await fetcher(usersModule, {
|
|
8
|
+
path: '/sign_up',
|
|
9
|
+
method: 'post',
|
|
10
|
+
module: 'users',
|
|
11
|
+
allowSaveCookies: true,
|
|
12
|
+
args: {
|
|
13
|
+
body: input
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
if (res.status !== 201) {
|
|
17
|
+
return {
|
|
18
|
+
error: await res.text()
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const data = await res.json();
|
|
22
|
+
if (data.emailVerified) {
|
|
23
|
+
revalidatePath('/[locale]/(main)', 'layout');
|
|
24
|
+
await redirect('/');
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
data
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/use-form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa;uBA+Bd,CAAC,CAAC,KAAK;;;;;;;;;;;;;;;;;;OAAmB,QAC5B,aAAa,CAAC,CAAC,CAAC,KAAK;;;;;;;;;;;;;;;;;;OAAmB,CAAC;;;;;;;;;;;;;;;;;;;;CA8ClD,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTranslations } from "next-intl";
|
|
2
2
|
import { toast } from "sonner";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { useWrapperSignUp } from "../wrapper.js";
|
|
4
5
|
import { mutationApi } from "./mutation-api.js";
|
|
5
6
|
export const useFormSignUp = ()=>{
|
|
6
7
|
const t = useTranslations('core.auth.sign_up');
|
|
@@ -20,10 +21,13 @@ export const useFormSignUp = ()=>{
|
|
|
20
21
|
terms: z.boolean().refine((value)=>value, t('terms.required')),
|
|
21
22
|
newsletter: z.boolean().optional()
|
|
22
23
|
});
|
|
24
|
+
const { setShowSendingEmail } = useWrapperSignUp();
|
|
23
25
|
const onSubmit = async (values, form)=>{
|
|
24
26
|
const mutation = await mutationApi(values);
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
+
if (mutation.data) {
|
|
28
|
+
if (!mutation.data.emailVerified) {
|
|
29
|
+
setShowSendingEmail(mutation.data.email);
|
|
30
|
+
}
|
|
27
31
|
return;
|
|
28
32
|
}
|
|
29
33
|
const errorMessages = {
|
|
@@ -36,7 +40,7 @@ export const useFormSignUp = ()=>{
|
|
|
36
40
|
message: t('username.exists')
|
|
37
41
|
}
|
|
38
42
|
};
|
|
39
|
-
const errorConfig = errorMessages[mutation.
|
|
43
|
+
const errorConfig = errorMessages[mutation.error];
|
|
40
44
|
if (errorConfig) {
|
|
41
45
|
form.setError(errorConfig.field, {
|
|
42
46
|
type: 'manual',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-up/sign-up-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-up-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-up/sign-up-view.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,wDAwCtB,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Link } from "../../../lib/navigation.js";
|
|
|
7
7
|
import { I18nProvider } from "../../../components/i18n-provider.js";
|
|
8
8
|
import { SSOButtons, SSOButtonsSkeleton } from "../sso/buttons/sso-buttons.js";
|
|
9
9
|
import { FormSignUp } from "./form/form.js";
|
|
10
|
+
import { WrapperSignUp } from "./wrapper.js";
|
|
10
11
|
export const SignUpView = async ()=>{
|
|
11
12
|
const [t, tGlobal, { isEmail }] = await Promise.all([
|
|
12
13
|
getTranslations('core.auth.sign_up'),
|
|
@@ -17,44 +18,46 @@ export const SignUpView = async ()=>{
|
|
|
17
18
|
namespaces: "core.auth.sign_up",
|
|
18
19
|
children: /*#__PURE__*/ _jsx("div", {
|
|
19
20
|
className: "mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col justify-center px-4 py-16",
|
|
20
|
-
children: /*#__PURE__*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
children: /*#__PURE__*/ _jsx(WrapperSignUp, {
|
|
22
|
+
children: /*#__PURE__*/ _jsxs(Card, {
|
|
23
|
+
className: "bg-muted gap-0 p-0",
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
26
|
+
className: "bg-card rounded-xl p-6",
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
29
|
+
className: "mb-10 space-y-2 text-center",
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
32
|
+
className: "text-2xl font-semibold leading-none tracking-tight",
|
|
33
|
+
children: tGlobal('register')
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ _jsx(CardDescription, {
|
|
36
|
+
children: t('desc')
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ _jsx(FormSignUp, {
|
|
41
|
+
isEmail: isEmail
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ _jsx(React.Suspense, {
|
|
44
|
+
fallback: /*#__PURE__*/ _jsx(SSOButtonsSkeleton, {}),
|
|
45
|
+
children: /*#__PURE__*/ _jsx(SSOButtons, {})
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ _jsx("div", {
|
|
50
|
+
className: "text-accent-foreground p-6 text-center text-sm",
|
|
51
|
+
children: t.rich('already_have_account', {
|
|
52
|
+
link: (text)=>/*#__PURE__*/ _jsx(Link, {
|
|
53
|
+
className: "font-semibold",
|
|
54
|
+
href: "/login",
|
|
55
|
+
children: text
|
|
35
56
|
})
|
|
36
|
-
]
|
|
37
|
-
}),
|
|
38
|
-
/*#__PURE__*/ _jsx(FormSignUp, {
|
|
39
|
-
isEmail: isEmail
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ _jsx(React.Suspense, {
|
|
42
|
-
fallback: /*#__PURE__*/ _jsx(SSOButtonsSkeleton, {}),
|
|
43
|
-
children: /*#__PURE__*/ _jsx(SSOButtons, {})
|
|
44
57
|
})
|
|
45
|
-
]
|
|
46
|
-
}),
|
|
47
|
-
/*#__PURE__*/ _jsx("div", {
|
|
48
|
-
className: "text-accent-foreground p-6 text-center text-sm",
|
|
49
|
-
children: t.rich('already_have_account', {
|
|
50
|
-
link: (text)=>/*#__PURE__*/ _jsx(Link, {
|
|
51
|
-
className: "font-semibold",
|
|
52
|
-
href: "/login",
|
|
53
|
-
children: text
|
|
54
|
-
})
|
|
55
58
|
})
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
]
|
|
60
|
+
})
|
|
58
61
|
})
|
|
59
62
|
})
|
|
60
63
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const useWrapperSignUp: () => {
|
|
3
|
+
setShowSendingEmail: React.Dispatch<React.SetStateAction<string>>;
|
|
4
|
+
};
|
|
5
|
+
export declare const WrapperSignUp: ({ children }: {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-up/wrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,gBAAgB;yBALN,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;CAKS,CAAC;AAE7E,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAQxE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { EmailConfirmationView } from "./email-confirmation-view.js";
|
|
5
|
+
const WrapperSignUpContext = /*#__PURE__*/ React.createContext({
|
|
6
|
+
setShowSendingEmail: ()=>{}
|
|
7
|
+
});
|
|
8
|
+
export const useWrapperSignUp = ()=>React.useContext(WrapperSignUpContext);
|
|
9
|
+
export const WrapperSignUp = ({ children })=>{
|
|
10
|
+
const [sendingEmail, setShowSendingEmail] = React.useState('');
|
|
11
|
+
return /*#__PURE__*/ _jsx(WrapperSignUpContext.Provider, {
|
|
12
|
+
value: {
|
|
13
|
+
setShowSendingEmail
|
|
14
|
+
},
|
|
15
|
+
children: sendingEmail ? /*#__PURE__*/ _jsx(EmailConfirmationView, {
|
|
16
|
+
email: sendingEmail
|
|
17
|
+
}) : children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sso-buttons.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sso/buttons/sso-buttons.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB,+CAO9B,CAAC;AAEF,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"sso-buttons.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sso/buttons/sso-buttons.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB,+CAO9B,CAAC;AAEF,eAAO,MAAM,UAAU,wDAiCtB,CAAC"}
|
|
@@ -17,8 +17,10 @@ export const SSOButtonsSkeleton = ()=>{
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
export const SSOButtons = async ()=>{
|
|
20
|
-
const t = await
|
|
21
|
-
|
|
20
|
+
const [t, { sso }] = await Promise.all([
|
|
21
|
+
getTranslations('core.auth.sso'),
|
|
22
|
+
getMiddlewareApi()
|
|
23
|
+
]);
|
|
22
24
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
23
25
|
children: [
|
|
24
26
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -30,7 +32,7 @@ export const SSOButtons = async ()=>{
|
|
|
30
32
|
className: "w-full border-t"
|
|
31
33
|
})
|
|
32
34
|
}),
|
|
33
|
-
/*#__PURE__*/ _jsx("div", {
|
|
35
|
+
sso.length > 0 && /*#__PURE__*/ _jsx("div", {
|
|
34
36
|
className: "relative flex justify-center text-xs",
|
|
35
37
|
children: /*#__PURE__*/ _jsx("span", {
|
|
36
38
|
className: "bg-card text-muted-foreground px-4",
|