@carlonicora/nextjs-jsonapi 1.29.5 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-C25QYFYD.mjs → BlockNoteEditor-CEJE3YHQ.mjs} +4 -4
- package/dist/{BlockNoteEditor-6U5KIP4Q.js → BlockNoteEditor-TUJ3VCS3.js} +14 -14
- package/dist/{BlockNoteEditor-6U5KIP4Q.js.map → BlockNoteEditor-TUJ3VCS3.js.map} +1 -1
- package/dist/billing/index.js +335 -335
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-UYBCHXXL.js → chunk-5KQXRLK3.js} +25 -2
- package/dist/chunk-5KQXRLK3.js.map +1 -0
- package/dist/{chunk-CYZZ3E33.js → chunk-BHKXZF2I.js} +493 -501
- package/dist/chunk-BHKXZF2I.js.map +1 -0
- package/dist/{chunk-GR4QPP36.mjs → chunk-C62JXXUX.mjs} +1 -1
- package/dist/{chunk-EW6QPMN3.js → chunk-OR5NPUWF.js} +1 -1
- package/dist/{chunk-EW6QPMN3.js.map → chunk-OR5NPUWF.js.map} +1 -1
- package/dist/{chunk-NYNLJEPF.mjs → chunk-WQ3KF6BG.mjs} +24 -1
- package/dist/chunk-WQ3KF6BG.mjs.map +1 -0
- package/dist/{chunk-QFN6RG6A.mjs → chunk-XY6HEWHI.mjs} +28 -36
- package/dist/chunk-XY6HEWHI.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +25 -2
- package/dist/core/index.d.ts +25 -2
- package/dist/core/index.js +10 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +9 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/containers/ReactMarkdownContainer.tsx +1 -1
- package/src/components/errors/errorToast.ts +2 -4
- package/src/components/forms/CommonAssociationForm.tsx +3 -3
- package/src/components/forms/FileUploader.tsx +4 -4
- package/src/features/auth/components/forms/AcceptInvitation.tsx +2 -2
- package/src/features/auth/components/forms/ActivateAccount.tsx +2 -2
- package/src/features/auth/components/forms/ForgotPassword.tsx +1 -1
- package/src/features/auth/components/forms/Login.tsx +4 -4
- package/src/features/auth/components/forms/Register.tsx +1 -1
- package/src/features/auth/components/forms/ResetPassword.tsx +2 -2
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +3 -3
- package/src/features/company/components/forms/CompanyDeleter.tsx +1 -1
- package/src/features/notification/components/modals/NotificationModal.tsx +2 -2
- package/src/features/role/components/forms/UserRoleAdd.tsx +2 -2
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +2 -2
- package/src/features/user/components/widgets/UserSearchPopover.tsx +1 -1
- package/src/index.ts +3 -0
- package/src/shadcnui/ui/sonner.tsx +13 -23
- package/src/utils/index.ts +3 -0
- package/src/utils/toast.ts +39 -0
- package/dist/chunk-CYZZ3E33.js.map +0 -1
- package/dist/chunk-NYNLJEPF.mjs.map +0 -1
- package/dist/chunk-QFN6RG6A.mjs.map +0 -1
- package/dist/chunk-UYBCHXXL.js.map +0 -1
- /package/dist/{BlockNoteEditor-C25QYFYD.mjs.map → BlockNoteEditor-CEJE3YHQ.mjs.map} +0 -0
- /package/dist/{chunk-GR4QPP36.mjs.map → chunk-C62JXXUX.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getStripePublishableKey,
|
|
10
10
|
getTrackablePages,
|
|
11
11
|
isRolesConfigured
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-C62JXXUX.mjs";
|
|
13
13
|
import {
|
|
14
14
|
AVAILABLE_OAUTH_SCOPES,
|
|
15
15
|
AbstractApiData,
|
|
@@ -98,6 +98,7 @@ import {
|
|
|
98
98
|
composeRefs,
|
|
99
99
|
configureAuth,
|
|
100
100
|
createJsonApiInclusion,
|
|
101
|
+
dismissToast,
|
|
101
102
|
entityObjectSchema,
|
|
102
103
|
exists,
|
|
103
104
|
formatDate,
|
|
@@ -117,10 +118,13 @@ import {
|
|
|
117
118
|
rehydrateList,
|
|
118
119
|
setClientGlobalErrorHandler,
|
|
119
120
|
setGlobalErrorHandler,
|
|
121
|
+
showCustomToast,
|
|
122
|
+
showError,
|
|
123
|
+
showToast,
|
|
120
124
|
useComposedRefs,
|
|
121
125
|
useIsMobile,
|
|
122
126
|
userObjectSchema
|
|
123
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-WQ3KF6BG.mjs";
|
|
124
128
|
import "./chunk-AUXK7QSA.mjs";
|
|
125
129
|
import "./chunk-C7C7VY4F.mjs";
|
|
126
130
|
import {
|
|
@@ -230,6 +234,7 @@ export {
|
|
|
230
234
|
configureLogin,
|
|
231
235
|
configureRoles,
|
|
232
236
|
createJsonApiInclusion,
|
|
237
|
+
dismissToast,
|
|
233
238
|
entityObjectSchema,
|
|
234
239
|
exists,
|
|
235
240
|
formatDate,
|
|
@@ -259,6 +264,9 @@ export {
|
|
|
259
264
|
setBootstrapper,
|
|
260
265
|
setClientGlobalErrorHandler,
|
|
261
266
|
setGlobalErrorHandler,
|
|
267
|
+
showCustomToast,
|
|
268
|
+
showError,
|
|
269
|
+
showToast,
|
|
262
270
|
translateData,
|
|
263
271
|
translateResponse,
|
|
264
272
|
tryBootstrap,
|
package/dist/server/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _chunk3ZPK4QOBjs = require('../chunk-3ZPK4QOB.js');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk5KQXRLK3js = require('../chunk-5KQXRLK3.js');
|
|
19
19
|
require('../chunk-LXKSUWAV.js');
|
|
20
20
|
require('../chunk-IBS6NI7D.js');
|
|
21
21
|
|
|
@@ -86,7 +86,7 @@ var ServerSession = class {
|
|
|
86
86
|
if (!rawModules) return false;
|
|
87
87
|
const modules = JSON.parse(_pako2.default.ungzip(Buffer.from(rawModules, "base64"), { to: "string" }));
|
|
88
88
|
const selectedModule = modules.find((module) => module.id === params.module.moduleId);
|
|
89
|
-
return
|
|
89
|
+
return _chunk5KQXRLK3js.checkPermissionsFromServer.call(void 0, {
|
|
90
90
|
module: params.module,
|
|
91
91
|
action: params.action,
|
|
92
92
|
data: params.data,
|
|
@@ -296,5 +296,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ServerJsonApiDelete, "ServerJsonApiDelete")
|
|
|
296
296
|
|
|
297
297
|
|
|
298
298
|
|
|
299
|
-
exports.ServerAuthService =
|
|
299
|
+
exports.ServerAuthService = _chunk5KQXRLK3js.AuthService; exports.ServerCompanyService = _chunk5KQXRLK3js.CompanyService; exports.ServerContentService = _chunk5KQXRLK3js.ContentService; exports.ServerFeatureService = _chunk5KQXRLK3js.FeatureService; exports.ServerJsonApiDelete = ServerJsonApiDelete; exports.ServerJsonApiGet = ServerJsonApiGet; exports.ServerJsonApiPatch = ServerJsonApiPatch; exports.ServerJsonApiPost = ServerJsonApiPost; exports.ServerJsonApiPut = ServerJsonApiPut; exports.ServerNotificationService = _chunk5KQXRLK3js.NotificationService; exports.ServerPushService = _chunk5KQXRLK3js.PushService; exports.ServerRoleService = _chunk5KQXRLK3js.RoleService; exports.ServerS3Service = _chunk5KQXRLK3js.S3Service; exports.ServerSession = ServerSession; exports.ServerUserService = _chunk5KQXRLK3js.UserService; exports.configureServerJsonApi = configureServerJsonApi; exports.getServerApiUrl = getServerApiUrl; exports.getServerAppUrl = getServerAppUrl; exports.getServerToken = _chunkYUO55Q5Ajs.getServerToken; exports.getServerTrackablePages = getServerTrackablePages; exports.invalidateCacheTag = invalidateCacheTag; exports.invalidateCacheTags = invalidateCacheTags; exports.serverRequest = _chunk3ZPK4QOBjs.serverRequest;
|
|
300
300
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ export function ReactMarkdownContainer({
|
|
|
19
19
|
initialLines = 4,
|
|
20
20
|
size = "normal",
|
|
21
21
|
}: ReactMarkdownContainerProps) {
|
|
22
|
-
const t = useTranslations("
|
|
22
|
+
const t = useTranslations("ui.buttons");
|
|
23
23
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
24
24
|
const [showExpandButton, setShowExpandButton] = useState(false);
|
|
25
25
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { toast } from "sonner";
|
|
1
|
+
import { showError } from "../../utils/toast";
|
|
4
2
|
|
|
5
3
|
export function errorToast(params: { title?: string; error: any }) {
|
|
6
|
-
|
|
4
|
+
showError(params?.title ?? "Error", {
|
|
7
5
|
description: params.error instanceof Error ? params.error.message : String(params.error),
|
|
8
6
|
});
|
|
9
7
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import { ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { showToast } from "../../utils/toast";
|
|
6
6
|
import { DataListRetriever, useDebounce } from "../../hooks";
|
|
7
7
|
import {
|
|
8
8
|
Button,
|
|
@@ -128,7 +128,7 @@ export const triggerAssociationToast = (params: {
|
|
|
128
128
|
level?: string;
|
|
129
129
|
}) => {
|
|
130
130
|
if (params.level) {
|
|
131
|
-
|
|
131
|
+
showToast(
|
|
132
132
|
params.t(`common.association.label`, {
|
|
133
133
|
source: params.source,
|
|
134
134
|
destination: params.destination,
|
|
@@ -144,7 +144,7 @@ export const triggerAssociationToast = (params: {
|
|
|
144
144
|
},
|
|
145
145
|
);
|
|
146
146
|
} else {
|
|
147
|
-
|
|
147
|
+
showToast(
|
|
148
148
|
params.t(`common.association.label`, {
|
|
149
149
|
source: params.source,
|
|
150
150
|
destination: params.destination,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useState,
|
|
15
15
|
} from "react";
|
|
16
16
|
import { DropzoneOptions, DropzoneState, FileRejection, useDropzone } from "react-dropzone";
|
|
17
|
-
import {
|
|
17
|
+
import { showError } from "../../utils/toast";
|
|
18
18
|
import { buttonVariants, Input } from "../../shadcnui";
|
|
19
19
|
import { cn } from "../../utils";
|
|
20
20
|
|
|
@@ -124,7 +124,7 @@ export const FileUploader = forwardRef<HTMLDivElement, FileUploaderProps & React
|
|
|
124
124
|
const files = acceptedFiles;
|
|
125
125
|
|
|
126
126
|
if (!files) {
|
|
127
|
-
|
|
127
|
+
showError(t("common.errors.file"), {
|
|
128
128
|
description: t("common.errors.file_large"),
|
|
129
129
|
});
|
|
130
130
|
return;
|
|
@@ -147,13 +147,13 @@ export const FileUploader = forwardRef<HTMLDivElement, FileUploaderProps & React
|
|
|
147
147
|
if (rejectedFiles.length > 0) {
|
|
148
148
|
for (let i = 0; i < rejectedFiles.length; i++) {
|
|
149
149
|
if (rejectedFiles[i].errors[0]?.code === "file-too-large") {
|
|
150
|
-
|
|
150
|
+
showError(t("common.errors.file"), {
|
|
151
151
|
description: t(`common.errors.file_max`, { size: maxSize / 1024 / 1024 }),
|
|
152
152
|
});
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
if (rejectedFiles[i].errors[0]?.message) {
|
|
156
|
-
|
|
156
|
+
showError(t(`common.errors.file`), {
|
|
157
157
|
description: rejectedFiles[i].errors[0].message,
|
|
158
158
|
});
|
|
159
159
|
break;
|
|
@@ -5,7 +5,7 @@ import { useTranslations } from "next-intl";
|
|
|
5
5
|
import Image from "next/image";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
7
|
import { SubmitHandler, useForm } from "react-hook-form";
|
|
8
|
-
import {
|
|
8
|
+
import { showToast } from "../../../../utils/toast";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { errorToast, FormPassword } from "../../../../components";
|
|
11
11
|
import { Button, CardContent, CardDescription, CardHeader, CardTitle, Form } from "../../../../shadcnui";
|
|
@@ -74,7 +74,7 @@ export function AcceptInvitation() {
|
|
|
74
74
|
await AuthService.acceptInvitation(payload);
|
|
75
75
|
setShowConfirmation(true);
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
showToast(t("auth.account_activated"), {
|
|
78
78
|
description: t("auth.account_activated_description"),
|
|
79
79
|
});
|
|
80
80
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import Image from "next/image";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { showToast } from "../../../../utils/toast";
|
|
7
7
|
import { errorToast } from "../../../../components";
|
|
8
8
|
import { CardContent, CardDescription, CardHeader, CardTitle } from "../../../../shadcnui";
|
|
9
9
|
import { useAuthContext } from "../../contexts";
|
|
@@ -28,7 +28,7 @@ export function ActivateAccount() {
|
|
|
28
28
|
|
|
29
29
|
setParams(undefined);
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
showToast(t("auth.account_activated"), {
|
|
32
32
|
description: t("auth.account_activated_description"),
|
|
33
33
|
});
|
|
34
34
|
|
|
@@ -58,7 +58,7 @@ 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("auth.forgot_password")}
|
|
61
|
+
{t("auth.buttons.forgot_password")}
|
|
62
62
|
</CardTitle>
|
|
63
63
|
<CardDescription className="text-sm">
|
|
64
64
|
{showConfirmation ? <> </> : <>{t(`auth.add_email_to_reset`)}</>}
|
|
@@ -69,7 +69,7 @@ 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("auth.login")}
|
|
72
|
+
{t("auth.buttons.login")}
|
|
73
73
|
</CardTitle>
|
|
74
74
|
|
|
75
75
|
<CardDescription className="text-sm">{t(`auth.login_description`)}</CardDescription>
|
|
@@ -95,7 +95,7 @@ export function Login() {
|
|
|
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(`auth.login`)}
|
|
98
|
+
{t(`auth.buttons.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(`auth.register`)}
|
|
117
|
+
{t(`auth.buttons.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(`auth.forgot_password`)}
|
|
125
|
+
{t(`auth.buttons.forgot_password`)}
|
|
126
126
|
</Link>
|
|
127
127
|
</div>
|
|
128
128
|
</CardFooter>
|
|
@@ -78,7 +78,7 @@ 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(`auth.register`)}
|
|
81
|
+
{t(`auth.buttons.register`)}
|
|
82
82
|
</CardTitle>
|
|
83
83
|
<CardDescription className="text-sm">
|
|
84
84
|
{showConfirmation ? <> </> : <>{t(`auth.register_description`)}</>}
|
|
@@ -5,7 +5,7 @@ import { useTranslations } from "next-intl";
|
|
|
5
5
|
import Image from "next/image";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
7
|
import { SubmitHandler, useForm } from "react-hook-form";
|
|
8
|
-
import {
|
|
8
|
+
import { showToast } from "../../../../utils/toast";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { errorToast, FormPassword } from "../../../../components";
|
|
11
11
|
import { Button, CardContent, CardDescription, CardHeader, CardTitle, Form } from "../../../../shadcnui";
|
|
@@ -74,7 +74,7 @@ export function ResetPassword() {
|
|
|
74
74
|
await AuthService.resetPassword(payload);
|
|
75
75
|
setShowConfirmation(true);
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
showToast(t(`auth.reset_success`), {
|
|
78
78
|
description: t(`auth.reset_success_description`),
|
|
79
79
|
});
|
|
80
80
|
|
|
@@ -5,7 +5,7 @@ import { Settings2Icon } from "lucide-react";
|
|
|
5
5
|
import { useTranslations } from "next-intl";
|
|
6
6
|
import { useEffect, useMemo, useState } from "react";
|
|
7
7
|
import { SubmitHandler, useForm } from "react-hook-form";
|
|
8
|
-
import {
|
|
8
|
+
import { showToast } from "../../../../utils/toast";
|
|
9
9
|
import z from "zod";
|
|
10
10
|
import { CommonEditorButtons, errorToast } from "../../../../components";
|
|
11
11
|
import { getRoleId } from "../../../../roles";
|
|
@@ -89,7 +89,7 @@ function CompanyConfigurationEditorInternal({ company }: CompanyConfigurationEdi
|
|
|
89
89
|
setUser(fullUser);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
showToast("Configurations Updated", {
|
|
93
93
|
description: `The system configurations have been updated successfully.`,
|
|
94
94
|
});
|
|
95
95
|
close();
|
|
@@ -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(`entities.
|
|
113
|
+
<DialogTitle>{t(`entities.configurations`, { count: 2 })}</DialogTitle>
|
|
114
114
|
<DialogDescription className="text-destructive">
|
|
115
115
|
{t(`features.configuration.warning_description`)}
|
|
116
116
|
</DialogDescription>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BellIcon } from "lucide-react";
|
|
2
2
|
import { useTranslations } from "next-intl";
|
|
3
3
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { showToast } from "../../../../utils/toast";
|
|
5
5
|
import { useSocketContext } from "../../../../contexts";
|
|
6
6
|
import { usePageUrlGenerator } from "../../../../hooks";
|
|
7
7
|
import {
|
|
@@ -116,7 +116,7 @@ function NotificationModalContent({ isOpen, setIsOpen }: NotificationModalProps)
|
|
|
116
116
|
addNotification(notification);
|
|
117
117
|
const toastNotification = generateToastNotification(notification, t, generateUrl);
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
showToast(toastNotification.title, {
|
|
120
120
|
description: toastNotification.description,
|
|
121
121
|
action: toastNotification.action,
|
|
122
122
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { PlusCircle } from "lucide-react";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { showToast } from "../../../../utils/toast";
|
|
7
7
|
import { useDebounce } from "../../../../hooks";
|
|
8
8
|
import {
|
|
9
9
|
Button,
|
|
@@ -39,7 +39,7 @@ export function UserRoleAdd({ user, refresh }: UserRoleAddProps) {
|
|
|
39
39
|
});
|
|
40
40
|
setRoles(roles.filter((u) => u.id !== role.id));
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
showToast(
|
|
43
43
|
t(`common.association.label`, {
|
|
44
44
|
source: t(`entities.roles`, { count: 1 }),
|
|
45
45
|
destination: t(`entities.users`, { count: 1 }),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { MailIcon } from "lucide-react";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { showToast } from "../../../../utils/toast";
|
|
7
7
|
import { errorToast } from "../../../../components";
|
|
8
8
|
import { Modules } from "../../../../core";
|
|
9
9
|
import { Action } from "../../../../permissions";
|
|
@@ -36,7 +36,7 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
|
|
|
36
36
|
await UserService.sendInvitation({ userId: user.id, companyId: user.company!.id });
|
|
37
37
|
|
|
38
38
|
setOpen(false);
|
|
39
|
-
|
|
39
|
+
showToast(t(`user.resend_activation.email_sent`), {
|
|
40
40
|
description: t(`user.resend_activation.email_sent_description`, { email: user.email }),
|
|
41
41
|
});
|
|
42
42
|
} catch (error) {
|
|
@@ -81,7 +81,7 @@ export const UserSearchPopover = ({ children, onSelect, align = "start", classNa
|
|
|
81
81
|
) : (
|
|
82
82
|
<div className="text-muted-foreground py-6 text-center text-sm">
|
|
83
83
|
{isLoading
|
|
84
|
-
? t(`
|
|
84
|
+
? t(`ui.buttons.loading`)
|
|
85
85
|
: t(`ui.search.no_results`, { type: t(`entities.users`, { count: 1 }) })}
|
|
86
86
|
</div>
|
|
87
87
|
)}
|
package/src/index.ts
CHANGED
|
@@ -26,3 +26,6 @@ export type { RoleIdConfig } from "./roles";
|
|
|
26
26
|
// Auth configuration
|
|
27
27
|
export { configureAuth, getTokenHandler } from "./features/auth/config";
|
|
28
28
|
export type { TokenHandler, TokenParams } from "./features/auth/config";
|
|
29
|
+
|
|
30
|
+
// Toast utilities
|
|
31
|
+
export { showToast, showError, dismissToast, showCustomToast, type ToastOptions } from "./utils/toast";
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import { useTheme } from "next-themes"
|
|
4
|
-
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
|
5
|
-
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
|
|
3
|
+
import { useTheme } from "next-themes";
|
|
4
|
+
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
|
5
|
+
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react";
|
|
6
6
|
|
|
7
7
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
8
|
-
const { theme = "system" } = useTheme()
|
|
8
|
+
const { theme = "system" } = useTheme();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Sonner
|
|
12
12
|
theme={theme as ToasterProps["theme"]}
|
|
13
13
|
className="toaster group"
|
|
14
14
|
icons={{
|
|
15
|
-
success:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
),
|
|
21
|
-
warning: (
|
|
22
|
-
<TriangleAlertIcon className="size-4" />
|
|
23
|
-
),
|
|
24
|
-
error: (
|
|
25
|
-
<OctagonXIcon className="size-4" />
|
|
26
|
-
),
|
|
27
|
-
loading: (
|
|
28
|
-
<Loader2Icon className="size-4 animate-spin" />
|
|
29
|
-
),
|
|
15
|
+
success: <CircleCheckIcon className="size-4" />,
|
|
16
|
+
info: <InfoIcon className="size-4" />,
|
|
17
|
+
warning: <TriangleAlertIcon className="size-4" />,
|
|
18
|
+
error: <OctagonXIcon className="size-4" />,
|
|
19
|
+
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
30
20
|
}}
|
|
31
21
|
style={
|
|
32
22
|
{
|
|
@@ -43,7 +33,7 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|
|
43
33
|
}}
|
|
44
34
|
{...props}
|
|
45
35
|
/>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
48
38
|
|
|
49
|
-
export { Toaster }
|
|
39
|
+
export { Toaster };
|
package/src/utils/index.ts
CHANGED
|
@@ -14,3 +14,6 @@ export { entityObjectSchema, userObjectSchema, type EntityObject, type UserObjec
|
|
|
14
14
|
export * from "./blocknote-diff.util";
|
|
15
15
|
export * from "./blocknote-word-diff-renderer.util";
|
|
16
16
|
export * from "./icons";
|
|
17
|
+
|
|
18
|
+
// Toast utilities
|
|
19
|
+
export { showToast, showError, dismissToast, showCustomToast, type ToastOptions } from "./toast";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { toast as sonnerToast, type ExternalToast } from "sonner";
|
|
2
|
+
import type { ReactElement, JSXElementConstructor, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export type ToastOptions = {
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
duration?: number;
|
|
7
|
+
id?: string;
|
|
8
|
+
onDismiss?: () => void;
|
|
9
|
+
action?: ExternalToast["action"];
|
|
10
|
+
dismissible?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Standard toast - neutral/white */
|
|
14
|
+
export function showToast(message: string, options?: ToastOptions) {
|
|
15
|
+
return sonnerToast(message, options as ExternalToast);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Error toast - destructive red */
|
|
19
|
+
export function showError(message: string, options?: ToastOptions) {
|
|
20
|
+
return sonnerToast.error(message, options as ExternalToast);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Dismiss toast(s) */
|
|
24
|
+
export function dismissToast(toastId?: string | number) {
|
|
25
|
+
return sonnerToast.dismiss(toastId);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Custom toast - ONLY for complex UI like upload progress */
|
|
29
|
+
export function showCustomToast(
|
|
30
|
+
render: (id: string | number) => ReactElement<unknown, string | JSXElementConstructor<unknown>>,
|
|
31
|
+
options?: {
|
|
32
|
+
id?: string | number;
|
|
33
|
+
duration?: number;
|
|
34
|
+
dismissible?: boolean;
|
|
35
|
+
onDismiss?: () => void;
|
|
36
|
+
},
|
|
37
|
+
) {
|
|
38
|
+
return sonnerToast.custom(render, options);
|
|
39
|
+
}
|