@carlonicora/nextjs-jsonapi 1.29.2 → 1.29.3
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/{BlockNoteEditor-BEWKLGW3.js → BlockNoteEditor-CJWHJRG3.js} +10 -10
- package/dist/BlockNoteEditor-CJWHJRG3.js.map +1 -0
- package/dist/{BlockNoteEditor-GNFK7ZVR.mjs → BlockNoteEditor-ZET7ANBC.mjs} +6 -6
- package/dist/BlockNoteEditor-ZET7ANBC.mjs.map +1 -0
- package/dist/billing/index.js +291 -291
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-IJSB4FH6.mjs → chunk-3HGZMKT4.mjs} +493 -523
- package/dist/chunk-3HGZMKT4.mjs.map +1 -0
- package/dist/{chunk-XU4MY6OG.js → chunk-6HQ6CPVL.js} +493 -523
- package/dist/chunk-6HQ6CPVL.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/details/AllowedUsersDetails.tsx +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +5 -5
- package/src/components/forms/CommonAssociationForm.tsx +9 -9
- package/src/components/forms/CommonDeleter.tsx +14 -8
- package/src/components/forms/CommonEditorButtons.tsx +2 -2
- package/src/components/forms/CommonEditorHeader.tsx +4 -4
- package/src/components/forms/CommonEditorTrigger.tsx +1 -1
- package/src/components/forms/FileUploader.tsx +8 -8
- package/src/components/forms/FormDateTime.tsx +6 -12
- package/src/components/forms/FormInput.tsx +4 -20
- package/src/components/forms/PasswordInput.tsx +1 -1
- package/src/components/navigations/Breadcrumb.tsx +1 -1
- package/src/components/navigations/Header.tsx +2 -2
- package/src/components/navigations/RecentPagesNavigator.tsx +3 -3
- package/src/components/tables/ContentTableSearch.tsx +1 -1
- package/src/contexts/CommonContext.tsx +2 -2
- package/src/features/auth/components/details/LandingComponent.tsx +5 -5
- package/src/features/auth/components/forms/AcceptInvitation.tsx +16 -22
- package/src/features/auth/components/forms/ActivateAccount.tsx +8 -8
- package/src/features/auth/components/forms/ForgotPassword.tsx +9 -9
- package/src/features/auth/components/forms/Login.tsx +12 -12
- package/src/features/auth/components/forms/Register.tsx +19 -21
- package/src/features/auth/components/forms/ResetPassword.tsx +12 -18
- package/src/features/company/components/details/TokenStatusIndicator.tsx +7 -7
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +2 -2
- package/src/features/company/components/forms/CompanyDeleter.tsx +13 -11
- package/src/features/company/components/forms/CompanyEditor.tsx +7 -13
- package/src/features/company/components/lists/CompaniesList.tsx +1 -1
- package/src/features/company/contexts/CompanyContext.tsx +1 -1
- package/src/features/company/hooks/useCompanyTableStructure.tsx +2 -2
- package/src/features/content/components/lists/ContentsList.tsx +1 -1
- package/src/features/content/components/lists/ContentsListById.tsx +1 -1
- package/src/features/content/components/lists/RelevantContentsList.tsx +1 -1
- package/src/features/content/hooks/useContentTableStructure.tsx +5 -5
- package/src/features/notification/components/containers/NotificationsListContainer.tsx +2 -2
- package/src/features/notification/components/lists/NotificationsList.tsx +3 -3
- package/src/features/notification/components/modals/NotificationModal.tsx +3 -5
- package/src/features/notification/components/notifications/Notification.tsx +4 -4
- package/src/features/notification/contexts/NotificationContext.tsx +2 -2
- package/src/features/role/components/details/RoleDetails.tsx +1 -1
- package/src/features/role/components/forms/FormRoles.tsx +2 -2
- package/src/features/role/components/forms/RemoveUserFromRole.tsx +9 -11
- package/src/features/role/components/forms/UserRoleAdd.tsx +18 -18
- package/src/features/role/components/lists/RolesList.tsx +1 -1
- package/src/features/role/components/lists/UserRolesList.tsx +1 -1
- package/src/features/role/contexts/RoleContext.tsx +2 -2
- package/src/features/role/hooks/useRoleTableStructure.tsx +3 -3
- package/src/features/user/components/containers/UsersListContainer.tsx +2 -2
- package/src/features/user/components/details/UserDetails.tsx +6 -6
- package/src/features/user/components/forms/RoleUserAdd.tsx +8 -8
- package/src/features/user/components/forms/UserAvatarEditor.tsx +2 -2
- package/src/features/user/components/forms/UserEditor.tsx +21 -25
- package/src/features/user/components/forms/UserReactivator.tsx +7 -7
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +9 -9
- package/src/features/user/components/forms/UserSelector.tsx +4 -9
- package/src/features/user/components/lists/AdminUsersList.tsx +1 -1
- package/src/features/user/components/lists/CompanyUsersList.tsx +1 -1
- package/src/features/user/components/lists/RelevantUsersList.tsx +1 -1
- package/src/features/user/components/lists/RoleUsersList.tsx +1 -1
- package/src/features/user/components/lists/UsersList.tsx +1 -1
- package/src/features/user/components/lists/UsersListByContentIds.tsx +1 -1
- package/src/features/user/components/widgets/UserSearchPopover.tsx +3 -3
- package/src/features/user/contexts/UserContext.tsx +5 -5
- package/src/features/user/hooks/useUserTableStructure.tsx +6 -6
- package/dist/BlockNoteEditor-BEWKLGW3.js.map +0 -1
- package/dist/BlockNoteEditor-GNFK7ZVR.mjs.map +0 -1
- package/dist/chunk-IJSB4FH6.mjs.map +0 -1
- package/dist/chunk-XU4MY6OG.js.map +0 -1
|
@@ -28,11 +28,11 @@ export function RecentPagesNavigator() {
|
|
|
28
28
|
<DropdownMenu>
|
|
29
29
|
<DropdownMenuTrigger>
|
|
30
30
|
<div className="flex w-full cursor-pointer items-center gap-2">
|
|
31
|
-
{state === "collapsed" ? <HistoryIcon className="h-4 w-4" /> : <span>{t(`
|
|
31
|
+
{state === "collapsed" ? <HistoryIcon className="h-4 w-4" /> : <span>{t(`common.recent_pages`)}</span>}
|
|
32
32
|
</div>
|
|
33
33
|
</DropdownMenuTrigger>
|
|
34
34
|
<DropdownMenuContent align="start" className="w-96">
|
|
35
|
-
<DropdownMenuLabel>{t(`
|
|
35
|
+
<DropdownMenuLabel>{t(`common.recent_pages`)}</DropdownMenuLabel>
|
|
36
36
|
<DropdownMenuSeparator />
|
|
37
37
|
{recentPages.map((page, index) => (
|
|
38
38
|
<DropdownMenuItem key={`${page.url}-${index}`}>
|
|
@@ -40,7 +40,7 @@ export function RecentPagesNavigator() {
|
|
|
40
40
|
<div className="flex flex-col">
|
|
41
41
|
<div className="truncate text-sm">{page.title}</div>
|
|
42
42
|
<div className="text-muted-foreground text-xs font-normal">
|
|
43
|
-
{t(`
|
|
43
|
+
{t(`entities.${page.moduleType}`, { count: 1 })}
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
</Link>
|
|
@@ -84,7 +84,7 @@ export function ContentTableSearch({ data }: ContentTableSearchProps) {
|
|
|
84
84
|
}}
|
|
85
85
|
onFocus={() => setIsFocused(true)}
|
|
86
86
|
onBlur={handleBlur}
|
|
87
|
-
placeholder={t(`
|
|
87
|
+
placeholder={t(`ui.search.placeholder_global`)}
|
|
88
88
|
type="text"
|
|
89
89
|
className="border-border/50 focus-visible:border-border h-10 w-full pr-8 pl-8 text-xs shadow-none focus-visible:ring-0"
|
|
90
90
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
|
|
5
5
|
import { createContext, ReactNode, useContext } from "react";
|
|
6
|
-
import { UserInterface } from "../features/user/data";
|
|
7
6
|
import { useCurrentUserContext } from "../features/user/contexts";
|
|
7
|
+
import { UserInterface } from "../features/user/data";
|
|
8
8
|
import { BreadcrumbItemData } from "../interfaces";
|
|
9
9
|
import { SharedProvider } from "./SharedContext";
|
|
10
10
|
|
|
@@ -28,7 +28,7 @@ export const CommonProvider = ({ children }: CommonProviderProps) => {
|
|
|
28
28
|
|
|
29
29
|
const title = () => {
|
|
30
30
|
const response: any = {
|
|
31
|
-
type: t(`
|
|
31
|
+
type: t(`common.title`),
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
if (company) response.element = company.name;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import Image from "next/image";
|
|
5
|
+
import { getApiUrl } from "../../../../client/config";
|
|
5
6
|
import { isDiscordAuthEnabled, isInternalAuthEnabled, isRegistrationAllowed } from "../../../../login";
|
|
6
7
|
import { Button, CardDescription, CardFooter, CardHeader, CardTitle, Link } from "../../../../shadcnui";
|
|
7
|
-
import { getApiUrl } from "../../../../client/config";
|
|
8
8
|
import { useAuthContext } from "../../contexts";
|
|
9
9
|
import { AuthComponent } from "../../enums";
|
|
10
10
|
|
|
@@ -18,10 +18,10 @@ export function LandingComponent() {
|
|
|
18
18
|
<CardHeader className="mb-4" data-testid="page-pre-login-container">
|
|
19
19
|
<CardTitle className="text-primary flex flex-col items-center gap-y-8 pb-8 text-4xl">
|
|
20
20
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
21
|
-
{t(`
|
|
21
|
+
{t(`common.title`)}
|
|
22
22
|
</CardTitle>
|
|
23
23
|
<CardDescription className="flex w-full justify-center text-center text-sm">
|
|
24
|
-
{t(`
|
|
24
|
+
{t(`common.description`)}
|
|
25
25
|
</CardDescription>
|
|
26
26
|
</CardHeader>
|
|
27
27
|
<CardFooter className="mt-4 flex w-full flex-col justify-between gap-y-4">
|
|
@@ -34,13 +34,13 @@ export function LandingComponent() {
|
|
|
34
34
|
onClick={() => setComponentType(AuthComponent.Register)}
|
|
35
35
|
>
|
|
36
36
|
<Button className="w-full" variant={`default`}>
|
|
37
|
-
{t(`
|
|
37
|
+
{t(`auth.buttons.register`)}
|
|
38
38
|
</Button>
|
|
39
39
|
</Link>
|
|
40
40
|
)}
|
|
41
41
|
<Link href="#" className="flex w-full justify-end" onClick={() => setComponentType(AuthComponent.Login)}>
|
|
42
42
|
<Button className="w-full" variant={`outline`} data-testid="page-login-button-initial-login">
|
|
43
|
-
{t(`
|
|
43
|
+
{t(`auth.buttons.login`)}
|
|
44
44
|
</Button>
|
|
45
45
|
</Link>
|
|
46
46
|
</>
|
|
@@ -29,28 +29,28 @@ export function AcceptInvitation() {
|
|
|
29
29
|
await AuthService.validateCode(payload);
|
|
30
30
|
} catch (e) {
|
|
31
31
|
setError(e instanceof Error ? e.message : String(e));
|
|
32
|
-
errorToast({ title: t(`
|
|
32
|
+
errorToast({ title: t(`common.errors.error`), error: e });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (params && params.code) {
|
|
37
37
|
validateCode(params.code);
|
|
38
38
|
} else {
|
|
39
|
-
setError(t(`
|
|
39
|
+
setError(t(`auth.errors.invalid_invitation_code`));
|
|
40
40
|
}
|
|
41
41
|
}, []);
|
|
42
42
|
|
|
43
43
|
const formSchema = z
|
|
44
44
|
.object({
|
|
45
45
|
password: z.string().min(1, {
|
|
46
|
-
message: t(`
|
|
46
|
+
message: t(`user.fields.password.error`),
|
|
47
47
|
}),
|
|
48
48
|
passwordRetype: z.string().min(1, {
|
|
49
|
-
message: t("
|
|
49
|
+
message: t("auth.errors.password_retype_required"),
|
|
50
50
|
}),
|
|
51
51
|
})
|
|
52
52
|
.refine((data) => data.password === data.passwordRetype, {
|
|
53
|
-
message: t("
|
|
53
|
+
message: t("auth.fields.retype_password.error_not_match"),
|
|
54
54
|
path: ["passwordRetype"],
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -74,8 +74,8 @@ export function AcceptInvitation() {
|
|
|
74
74
|
await AuthService.acceptInvitation(payload);
|
|
75
75
|
setShowConfirmation(true);
|
|
76
76
|
|
|
77
|
-
toast.success(t("
|
|
78
|
-
description: t("
|
|
77
|
+
toast.success(t("auth.account_activated"), {
|
|
78
|
+
description: t("auth.account_activated_description"),
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
setTimeout(() => {
|
|
@@ -83,7 +83,7 @@ export function AcceptInvitation() {
|
|
|
83
83
|
setParams(undefined);
|
|
84
84
|
}, 2000);
|
|
85
85
|
} catch (e) {
|
|
86
|
-
errorToast({ title: t(`
|
|
86
|
+
errorToast({ title: t(`common.errors.error`), error });
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -92,21 +92,15 @@ export function AcceptInvitation() {
|
|
|
92
92
|
<CardHeader>
|
|
93
93
|
<CardTitle className="text-primary flex flex-col items-center pb-10 text-4xl">
|
|
94
94
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
95
|
-
{t("
|
|
95
|
+
{t("auth.accept_invitation")}
|
|
96
96
|
</CardTitle>
|
|
97
97
|
<CardDescription className="text-center text-sm">
|
|
98
|
-
{error ? (
|
|
99
|
-
<>{t("foundations.auth.errors.activating_account")}</>
|
|
100
|
-
) : (
|
|
101
|
-
<>{t("foundations.auth.select_password")}</>
|
|
102
|
-
)}
|
|
98
|
+
{error ? <>{t("auth.errors.activating_account")}</> : <>{t("auth.select_password")}</>}
|
|
103
99
|
</CardDescription>
|
|
104
100
|
</CardHeader>
|
|
105
101
|
<CardContent>
|
|
106
102
|
{showConfirmation ? (
|
|
107
|
-
<CardDescription className="text-center text-xl">
|
|
108
|
-
{t("foundations.auth.activation_description")}
|
|
109
|
-
</CardDescription>
|
|
103
|
+
<CardDescription className="text-center text-xl">{t("auth.activation_description")}</CardDescription>
|
|
110
104
|
) : error ? (
|
|
111
105
|
<CardDescription className="text-center text-xl">{error}</CardDescription>
|
|
112
106
|
) : (
|
|
@@ -115,17 +109,17 @@ export function AcceptInvitation() {
|
|
|
115
109
|
<FormPassword
|
|
116
110
|
form={form}
|
|
117
111
|
id="password"
|
|
118
|
-
name={t(`
|
|
119
|
-
placeholder={t(`
|
|
112
|
+
name={t(`user.fields.password.label`)}
|
|
113
|
+
placeholder={t(`user.fields.password.placeholder`)}
|
|
120
114
|
/>
|
|
121
115
|
<FormPassword
|
|
122
116
|
form={form}
|
|
123
117
|
id="passwordRetype"
|
|
124
|
-
name={t("
|
|
125
|
-
placeholder={t(`
|
|
118
|
+
name={t("auth.fields.retype_password.label")}
|
|
119
|
+
placeholder={t(`auth.fields.retype_password.placeholder`)}
|
|
126
120
|
/>
|
|
127
121
|
<Button className="mt-4 w-full" type={"submit"}>
|
|
128
|
-
{t("
|
|
122
|
+
{t("auth.accept_invitation")}
|
|
129
123
|
</Button>
|
|
130
124
|
</form>
|
|
131
125
|
</Form>
|
|
@@ -28,8 +28,8 @@ export function ActivateAccount() {
|
|
|
28
28
|
|
|
29
29
|
setParams(undefined);
|
|
30
30
|
|
|
31
|
-
toast.success(t("
|
|
32
|
-
description: t("
|
|
31
|
+
toast.success(t("auth.account_activated"), {
|
|
32
|
+
description: t("auth.account_activated_description"),
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
setTimeout(() => {
|
|
@@ -37,14 +37,14 @@ export function ActivateAccount() {
|
|
|
37
37
|
}, 2000);
|
|
38
38
|
} catch (e) {
|
|
39
39
|
setError(e instanceof Error ? e.message : String(e));
|
|
40
|
-
errorToast({ title: t(`
|
|
40
|
+
errorToast({ title: t(`common.errors.error`), error: e });
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (params && params.code) {
|
|
45
45
|
ActivateAccount(params.code);
|
|
46
46
|
} else {
|
|
47
|
-
setError(t(`
|
|
47
|
+
setError(t(`auth.errors.invalid_invitation_code`));
|
|
48
48
|
}
|
|
49
49
|
}, []);
|
|
50
50
|
|
|
@@ -53,20 +53,20 @@ export function ActivateAccount() {
|
|
|
53
53
|
<CardHeader>
|
|
54
54
|
<CardTitle className="text-primary flex flex-col items-center pb-10 text-4xl">
|
|
55
55
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
56
|
-
{t("
|
|
56
|
+
{t("auth.accept_invitation")}
|
|
57
57
|
</CardTitle>
|
|
58
58
|
<CardDescription className="text-center text-sm">
|
|
59
|
-
{error ? <>{t("
|
|
59
|
+
{error ? <>{t("auth.errors.activating_account")}</> : <> </>}
|
|
60
60
|
</CardDescription>
|
|
61
61
|
</CardHeader>
|
|
62
62
|
<CardContent>
|
|
63
63
|
<CardDescription className="text-center text-xl">
|
|
64
64
|
{showConfirmation ? (
|
|
65
|
-
<>{t("
|
|
65
|
+
<>{t("auth.activation_description")}</>
|
|
66
66
|
) : error ? (
|
|
67
67
|
<>{error}</>
|
|
68
68
|
) : (
|
|
69
|
-
<>{t("
|
|
69
|
+
<>{t("auth.activation_wait")}</>
|
|
70
70
|
)}
|
|
71
71
|
</CardDescription>
|
|
72
72
|
</CardContent>
|
|
@@ -29,7 +29,7 @@ export function ForgotPassword() {
|
|
|
29
29
|
|
|
30
30
|
const formSchema = z.object({
|
|
31
31
|
email: z.string().email({
|
|
32
|
-
message: t(`
|
|
32
|
+
message: t(`common.errors.invalid_email`),
|
|
33
33
|
}),
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -58,15 +58,15 @@ export function ForgotPassword() {
|
|
|
58
58
|
<CardHeader data-testid="page-forgot-password-container">
|
|
59
59
|
<CardTitle className="text-primary flex flex-col items-center pb-10 text-4xl">
|
|
60
60
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
61
|
-
{t("
|
|
61
|
+
{t("auth.forgot_password")}
|
|
62
62
|
</CardTitle>
|
|
63
63
|
<CardDescription className="text-sm">
|
|
64
|
-
{showConfirmation ? <> </> : <>{t(`
|
|
64
|
+
{showConfirmation ? <> </> : <>{t(`auth.add_email_to_reset`)}</>}
|
|
65
65
|
</CardDescription>
|
|
66
66
|
</CardHeader>
|
|
67
67
|
{showConfirmation ? (
|
|
68
68
|
<CardContent>
|
|
69
|
-
<CardDescription className="text-center text-xl">{t(`
|
|
69
|
+
<CardDescription className="text-center text-xl">{t(`auth.reset_confirmation`)}</CardDescription>
|
|
70
70
|
</CardContent>
|
|
71
71
|
) : (
|
|
72
72
|
<Form {...form}>
|
|
@@ -75,12 +75,12 @@ export function ForgotPassword() {
|
|
|
75
75
|
<FormInput
|
|
76
76
|
form={form}
|
|
77
77
|
id="email"
|
|
78
|
-
name={t(`
|
|
79
|
-
placeholder={t(`
|
|
78
|
+
name={t(`common.fields.email.label`)}
|
|
79
|
+
placeholder={t(`common.fields.email.placeholder`)}
|
|
80
80
|
testId="form-forgot-password-input-email"
|
|
81
81
|
/>
|
|
82
82
|
<Button className="mt-4 w-full" type={"submit"} data-testid="form-forgot-password-button-reset">
|
|
83
|
-
{t(`
|
|
83
|
+
{t(`auth.buttons.reset_password`)}
|
|
84
84
|
</Button>
|
|
85
85
|
</CardContent>
|
|
86
86
|
<CardFooter className="flex w-full flex-row justify-between">
|
|
@@ -89,7 +89,7 @@ export function ForgotPassword() {
|
|
|
89
89
|
className="flex w-full justify-start"
|
|
90
90
|
onClick={() => setComponentType(AuthComponent.Register)}
|
|
91
91
|
>
|
|
92
|
-
{t("
|
|
92
|
+
{t("auth.buttons.register")}
|
|
93
93
|
</Link> */}
|
|
94
94
|
<Link
|
|
95
95
|
href="#"
|
|
@@ -97,7 +97,7 @@ export function ForgotPassword() {
|
|
|
97
97
|
onClick={() => setComponentType(AuthComponent.Login)}
|
|
98
98
|
data-testid="form-forgot-password-link-login"
|
|
99
99
|
>
|
|
100
|
-
{t(`
|
|
100
|
+
{t(`auth.buttons.login`)}
|
|
101
101
|
</Link>
|
|
102
102
|
</CardFooter>
|
|
103
103
|
</form>
|
|
@@ -34,9 +34,9 @@ export function Login() {
|
|
|
34
34
|
|
|
35
35
|
const formSchema = z.object({
|
|
36
36
|
email: z.string().email({
|
|
37
|
-
message: t(`
|
|
37
|
+
message: t(`common.errors.invalid_email`),
|
|
38
38
|
}),
|
|
39
|
-
password: z.string().min(3, { message: t(`
|
|
39
|
+
password: z.string().min(3, { message: t(`auth.errors.password_too_short`) }),
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
const form = useForm<z.infer<typeof formSchema>>({
|
|
@@ -58,7 +58,7 @@ export function Login() {
|
|
|
58
58
|
router.replace(generateUrl({ page: `/` }));
|
|
59
59
|
} catch (e) {
|
|
60
60
|
errorToast({
|
|
61
|
-
title: t(`
|
|
61
|
+
title: t(`common.errors.error`),
|
|
62
62
|
error: e,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -69,10 +69,10 @@ export function Login() {
|
|
|
69
69
|
<CardHeader data-testid="page-login-container">
|
|
70
70
|
<CardTitle className="text-primary flex flex-col items-center pb-10 text-4xl">
|
|
71
71
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
72
|
-
{t("
|
|
72
|
+
{t("auth.login")}
|
|
73
73
|
</CardTitle>
|
|
74
74
|
|
|
75
|
-
<CardDescription className="text-sm">{t(`
|
|
75
|
+
<CardDescription className="text-sm">{t(`auth.login_description`)}</CardDescription>
|
|
76
76
|
</CardHeader>
|
|
77
77
|
<Form {...form}>
|
|
78
78
|
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
@@ -83,19 +83,19 @@ export function Login() {
|
|
|
83
83
|
autoFocus
|
|
84
84
|
form={form}
|
|
85
85
|
id="email"
|
|
86
|
-
name={t(`
|
|
87
|
-
placeholder={t(`
|
|
86
|
+
name={t(`common.fields.email.label`)}
|
|
87
|
+
placeholder={t(`common.fields.email.placeholder`)}
|
|
88
88
|
testId="form-login-input-email"
|
|
89
89
|
/>
|
|
90
90
|
<FormPassword
|
|
91
91
|
form={form}
|
|
92
92
|
id="password"
|
|
93
|
-
name={t(`
|
|
94
|
-
placeholder={t(`
|
|
93
|
+
name={t(`user.fields.password.label`)}
|
|
94
|
+
placeholder={t(`user.fields.password.placeholder`)}
|
|
95
95
|
testId="form-login-input-password"
|
|
96
96
|
/>
|
|
97
97
|
<Button className="mt-4 w-full" type={"submit"} data-testid="form-login-button-submit">
|
|
98
|
-
{t(`
|
|
98
|
+
{t(`auth.login`)}
|
|
99
99
|
</Button>
|
|
100
100
|
</>
|
|
101
101
|
)}
|
|
@@ -114,7 +114,7 @@ export function Login() {
|
|
|
114
114
|
className="flex w-full justify-start"
|
|
115
115
|
onClick={() => setComponentType(AuthComponent.Register)}
|
|
116
116
|
>
|
|
117
|
-
{t(`
|
|
117
|
+
{t(`auth.register`)}
|
|
118
118
|
</Link>
|
|
119
119
|
<Link
|
|
120
120
|
href="#"
|
|
@@ -122,7 +122,7 @@ export function Login() {
|
|
|
122
122
|
onClick={() => setComponentType(AuthComponent.ForgotPassword)}
|
|
123
123
|
data-testid="form-login-link-forgot-password"
|
|
124
124
|
>
|
|
125
|
-
{t(`
|
|
125
|
+
{t(`auth.forgot_password`)}
|
|
126
126
|
</Link>
|
|
127
127
|
</div>
|
|
128
128
|
</CardFooter>
|
|
@@ -30,19 +30,19 @@ export default function Register() {
|
|
|
30
30
|
|
|
31
31
|
const formSchema = z.object({
|
|
32
32
|
company: z.string().min(1, {
|
|
33
|
-
message: t(`
|
|
33
|
+
message: t(`common.errors.missing_company_name`),
|
|
34
34
|
}),
|
|
35
35
|
name: z.string().min(1, {
|
|
36
|
-
message: t("
|
|
36
|
+
message: t("common.errors.missing_name"),
|
|
37
37
|
}),
|
|
38
38
|
email: z.string().email({
|
|
39
|
-
message: t(`
|
|
39
|
+
message: t(`common.errors.invalid_email`),
|
|
40
40
|
}),
|
|
41
41
|
password: z
|
|
42
42
|
.string()
|
|
43
|
-
.min(8, t(`
|
|
43
|
+
.min(8, t(`auth.errors.password_too_short`))
|
|
44
44
|
.regex(/^(?=.*[0-9])(?=.*[^a-zA-Z0-9]).*$/, {
|
|
45
|
-
message: t(`
|
|
45
|
+
message: t(`auth.errors.password_invalid_format`),
|
|
46
46
|
}),
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -78,17 +78,15 @@ export default function Register() {
|
|
|
78
78
|
<CardHeader>
|
|
79
79
|
<CardTitle className="text-primary flex flex-col items-center pb-10 text-4xl">
|
|
80
80
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
81
|
-
{t(`
|
|
81
|
+
{t(`auth.register`)}
|
|
82
82
|
</CardTitle>
|
|
83
83
|
<CardDescription className="text-sm">
|
|
84
|
-
{showConfirmation ? <> </> : <>{t(`
|
|
84
|
+
{showConfirmation ? <> </> : <>{t(`auth.register_description`)}</>}
|
|
85
85
|
</CardDescription>
|
|
86
86
|
</CardHeader>
|
|
87
87
|
{showConfirmation ? (
|
|
88
88
|
<CardContent>
|
|
89
|
-
<CardDescription className="text-center text-xl">
|
|
90
|
-
{t("foundations.auth.register_confirmation")}
|
|
91
|
-
</CardDescription>
|
|
89
|
+
<CardDescription className="text-center text-xl">{t("auth.register_confirmation")}</CardDescription>
|
|
92
90
|
</CardContent>
|
|
93
91
|
) : (
|
|
94
92
|
<Form {...form}>
|
|
@@ -98,32 +96,32 @@ export default function Register() {
|
|
|
98
96
|
isRequired
|
|
99
97
|
form={form}
|
|
100
98
|
id="company"
|
|
101
|
-
name={t(`
|
|
102
|
-
placeholder={t(`
|
|
99
|
+
name={t(`company.fields.name.label`)}
|
|
100
|
+
placeholder={t(`company.fields.name.placeholder`)}
|
|
103
101
|
/>
|
|
104
102
|
<FormInput
|
|
105
103
|
isRequired
|
|
106
104
|
form={form}
|
|
107
105
|
id="name"
|
|
108
|
-
name={t(`
|
|
109
|
-
placeholder={t(`
|
|
106
|
+
name={t(`user.fields.name.label`)}
|
|
107
|
+
placeholder={t(`user.fields.name.placeholder`)}
|
|
110
108
|
/>
|
|
111
109
|
<FormInput
|
|
112
110
|
isRequired
|
|
113
111
|
form={form}
|
|
114
112
|
id="email"
|
|
115
|
-
name={t(`
|
|
116
|
-
placeholder={t(`
|
|
113
|
+
name={t(`common.fields.email.label`)}
|
|
114
|
+
placeholder={t(`common.fields.email.placeholder`)}
|
|
117
115
|
/>
|
|
118
116
|
<FormPassword
|
|
119
117
|
isRequired
|
|
120
118
|
form={form}
|
|
121
119
|
id="password"
|
|
122
|
-
name={t(`
|
|
123
|
-
placeholder={t(`
|
|
120
|
+
name={t(`user.fields.password.label`)}
|
|
121
|
+
placeholder={t(`user.fields.password.placeholder`)}
|
|
124
122
|
/>
|
|
125
123
|
<Button className="mt-4 w-full" type={"submit"}>
|
|
126
|
-
{t(`
|
|
124
|
+
{t(`auth.buttons.register`)}
|
|
127
125
|
</Button>
|
|
128
126
|
</CardContent>
|
|
129
127
|
<CardFooter className="flex w-full flex-row justify-between">
|
|
@@ -132,14 +130,14 @@ export default function Register() {
|
|
|
132
130
|
className="flex w-full justify-start"
|
|
133
131
|
onClick={() => setComponentType(AuthComponent.Login)}
|
|
134
132
|
>
|
|
135
|
-
{t(`
|
|
133
|
+
{t(`auth.buttons.login`)}
|
|
136
134
|
</Link>
|
|
137
135
|
<Link
|
|
138
136
|
href="#"
|
|
139
137
|
className="flex w-full justify-end"
|
|
140
138
|
onClick={() => setComponentType(AuthComponent.ForgotPassword)}
|
|
141
139
|
>
|
|
142
|
-
{t(`
|
|
140
|
+
{t(`auth.buttons.forgot_password`)}
|
|
143
141
|
</Link>
|
|
144
142
|
</CardFooter>
|
|
145
143
|
</form>
|
|
@@ -29,28 +29,28 @@ export function ResetPassword() {
|
|
|
29
29
|
await AuthService.validateCode(payload);
|
|
30
30
|
} catch (e) {
|
|
31
31
|
setError(e instanceof Error ? e.message : String(e));
|
|
32
|
-
errorToast({ title: t(`
|
|
32
|
+
errorToast({ title: t(`common.errors.error`), error: e });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (params && params.code) {
|
|
37
37
|
validateResetPasswordCode(params.code);
|
|
38
38
|
} else {
|
|
39
|
-
setError(t(`
|
|
39
|
+
setError(t(`auth.errors.invalid_password_reset_code`));
|
|
40
40
|
}
|
|
41
41
|
}, []);
|
|
42
42
|
|
|
43
43
|
const formSchema = z
|
|
44
44
|
.object({
|
|
45
45
|
password: z.string().min(1, {
|
|
46
|
-
message: t(`
|
|
46
|
+
message: t(`user.fields.password.error`),
|
|
47
47
|
}),
|
|
48
48
|
passwordRetype: z.string().min(1, {
|
|
49
|
-
message: t(`
|
|
49
|
+
message: t(`auth.fields.retype_password.error`),
|
|
50
50
|
}),
|
|
51
51
|
})
|
|
52
52
|
.refine((data) => data.password === data.passwordRetype, {
|
|
53
|
-
message: t(`
|
|
53
|
+
message: t(`auth.fields.retype_password.error_not_match`),
|
|
54
54
|
path: ["passwordRetype"],
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -74,8 +74,8 @@ export function ResetPassword() {
|
|
|
74
74
|
await AuthService.resetPassword(payload);
|
|
75
75
|
setShowConfirmation(true);
|
|
76
76
|
|
|
77
|
-
toast.success(t(`
|
|
78
|
-
description: t(`
|
|
77
|
+
toast.success(t(`auth.reset_success`), {
|
|
78
|
+
description: t(`auth.reset_success_description`),
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
setTimeout(() => {
|
|
@@ -83,7 +83,7 @@ export function ResetPassword() {
|
|
|
83
83
|
setParams(undefined);
|
|
84
84
|
}, 2000);
|
|
85
85
|
} catch (e) {
|
|
86
|
-
errorToast({ title: t(`
|
|
86
|
+
errorToast({ title: t(`common.errors.error`), error });
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -92,21 +92,15 @@ export function ResetPassword() {
|
|
|
92
92
|
<CardHeader>
|
|
93
93
|
<CardTitle className="text-primary flex flex-col items-center pb-10 text-4xl">
|
|
94
94
|
<Image src="/logo.webp" alt="Logo" width={100} height={100} priority />
|
|
95
|
-
{t(`
|
|
95
|
+
{t(`auth.password_reset`)}
|
|
96
96
|
</CardTitle>
|
|
97
97
|
<CardDescription className="text-center text-sm">
|
|
98
|
-
{error ? (
|
|
99
|
-
<>{t(`foundations.auth.errors.password_reset_error`)}</>
|
|
100
|
-
) : (
|
|
101
|
-
<>{t(`foundations.auth.reset_password`)}</>
|
|
102
|
-
)}
|
|
98
|
+
{error ? <>{t(`auth.errors.password_reset_error`)}</> : <>{t(`auth.reset_password`)}</>}
|
|
103
99
|
</CardDescription>
|
|
104
100
|
</CardHeader>
|
|
105
101
|
<CardContent>
|
|
106
102
|
{showConfirmation ? (
|
|
107
|
-
<CardDescription className="text-center text-xl">
|
|
108
|
-
{t(`foundations.auth.reset_success_description`)}
|
|
109
|
-
</CardDescription>
|
|
103
|
+
<CardDescription className="text-center text-xl">{t(`auth.reset_success_description`)}</CardDescription>
|
|
110
104
|
) : error ? (
|
|
111
105
|
<CardDescription className="text-center text-xl">{error}</CardDescription>
|
|
112
106
|
) : (
|
|
@@ -115,7 +109,7 @@ export function ResetPassword() {
|
|
|
115
109
|
<FormPassword form={form} id="password" name={"Password"} />
|
|
116
110
|
<FormPassword form={form} id="passwordRetype" name={"Retype Password"} />
|
|
117
111
|
<Button className="mt-4 w-full" type={"submit"}>
|
|
118
|
-
{t(`
|
|
112
|
+
{t(`auth.buttons.reset_password`)}
|
|
119
113
|
</Button>
|
|
120
114
|
</form>
|
|
121
115
|
</Form>
|
|
@@ -86,35 +86,35 @@ export function TokenStatusIndicator({ className, size = "md", showExtraPages =
|
|
|
86
86
|
|
|
87
87
|
const tooltipContent = (
|
|
88
88
|
<div className="flex flex-col gap-2 p-1">
|
|
89
|
-
<div className="font-semibold text-sm">{t("
|
|
89
|
+
<div className="font-semibold text-sm">{t("billing.tokens.status", { defaultValue: "Page Status" })}</div>
|
|
90
90
|
<div className="flex flex-col gap-1 text-xs">
|
|
91
91
|
<div className="flex items-center justify-between gap-4">
|
|
92
92
|
<span className="text-muted-foreground">
|
|
93
|
-
{t("
|
|
93
|
+
{t("billing.tokens.monthly", { defaultValue: "Monthly Pages" })}:
|
|
94
94
|
</span>
|
|
95
95
|
<span className={cn("font-medium", getStatusColor())}>
|
|
96
96
|
{availableMonthlyTokens} / {monthlyTokens}
|
|
97
97
|
</span>
|
|
98
98
|
</div>
|
|
99
99
|
<div className="flex items-center justify-between gap-4">
|
|
100
|
-
<span className="text-muted-foreground">{t("
|
|
100
|
+
<span className="text-muted-foreground">{t("billing.tokens.available", { defaultValue: "Available" })}:</span>
|
|
101
101
|
<span className={cn("font-medium", getStatusColor())}>{percentage.toFixed(0)}%</span>
|
|
102
102
|
</div>
|
|
103
103
|
<Link href="/settings/billing?action=subscribe" className="w-full flex justify-end my-4">
|
|
104
104
|
<Button variant="outline" size="sm">
|
|
105
|
-
{t("
|
|
105
|
+
{t("billing.tokens.upgrade_plan", { defaultValue: "Upgrade plan" })}
|
|
106
106
|
</Button>
|
|
107
107
|
</Link>
|
|
108
108
|
<Separator />
|
|
109
109
|
<div className="flex items-center justify-between gap-4 pt-1 mt-1">
|
|
110
110
|
<span className="text-muted-foreground">
|
|
111
|
-
{t("
|
|
111
|
+
{t("billing.tokens.available_extra", { defaultValue: "Extra Pages" })}:
|
|
112
112
|
</span>
|
|
113
113
|
<span className="font-medium text-blue-500">{availableExtraTokens}</span>
|
|
114
114
|
</div>
|
|
115
115
|
<Link href="/settings/billing?action=subscribe" className="w-full flex justify-end my-4">
|
|
116
116
|
<Button variant="outline" size="sm">
|
|
117
|
-
{t("
|
|
117
|
+
{t("billing.tokens.purchase_extra", { defaultValue: "Purchase additional analysis" })}
|
|
118
118
|
</Button>
|
|
119
119
|
</Link>
|
|
120
120
|
</div>
|
|
@@ -126,7 +126,7 @@ export function TokenStatusIndicator({ className, size = "md", showExtraPages =
|
|
|
126
126
|
<TooltipTrigger>
|
|
127
127
|
<div
|
|
128
128
|
className={cn("inline-flex items-center gap-1.5 cursor-default", className)}
|
|
129
|
-
aria-label={t("
|
|
129
|
+
aria-label={t("billing.tokens.status", { defaultValue: "Page Status" })}
|
|
130
130
|
>
|
|
131
131
|
{getBatteryIcon()}
|
|
132
132
|
<span className={cn(textSize, "text-muted-foreground font-medium")}>{availableMonthlyTokens}</span>
|
|
@@ -95,7 +95,7 @@ function CompanyConfigurationEditorInternal({ company }: CompanyConfigurationEdi
|
|
|
95
95
|
close();
|
|
96
96
|
} catch (error) {
|
|
97
97
|
errorToast({
|
|
98
|
-
title: t(`
|
|
98
|
+
title: t(`common.errors.update`),
|
|
99
99
|
error,
|
|
100
100
|
});
|
|
101
101
|
}
|
|
@@ -110,7 +110,7 @@ function CompanyConfigurationEditorInternal({ company }: CompanyConfigurationEdi
|
|
|
110
110
|
</DialogTrigger>
|
|
111
111
|
<DialogContent className={`flex max-h-[70vh] max-w-4xl flex-col overflow-y-auto`}>
|
|
112
112
|
<DialogHeader>
|
|
113
|
-
<DialogTitle>{t(`
|
|
113
|
+
<DialogTitle>{t(`entities.configuration`, { count: 2 })}</DialogTitle>
|
|
114
114
|
<DialogDescription className="text-destructive">
|
|
115
115
|
{t(`features.configuration.warning_description`)}
|
|
116
116
|
</DialogDescription>
|