@carlonicora/nextjs-jsonapi 1.66.0 → 1.67.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.
Files changed (63) hide show
  1. package/dist/{BlockNoteEditor-GQM2TZG2.js → BlockNoteEditor-QHWPE3BJ.js} +14 -14
  2. package/dist/{BlockNoteEditor-GQM2TZG2.js.map → BlockNoteEditor-QHWPE3BJ.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-KCJMA6LW.mjs → BlockNoteEditor-TIX3GDVZ.mjs} +4 -4
  4. package/dist/billing/index.js +346 -346
  5. package/dist/billing/index.mjs +3 -3
  6. package/dist/{chunk-QIFM4G7T.js → chunk-3BWYWS3A.js} +1476 -1298
  7. package/dist/chunk-3BWYWS3A.js.map +1 -0
  8. package/dist/{chunk-NVXYOQFW.js → chunk-CJY63D6U.js} +12 -5
  9. package/dist/chunk-CJY63D6U.js.map +1 -0
  10. package/dist/{chunk-OQRBY22T.js → chunk-KFIQTY4O.js} +11 -11
  11. package/dist/{chunk-OQRBY22T.js.map → chunk-KFIQTY4O.js.map} +1 -1
  12. package/dist/{chunk-35GWVOYZ.mjs → chunk-RIG2BEXJ.mjs} +12 -5
  13. package/dist/{chunk-35GWVOYZ.mjs.map → chunk-RIG2BEXJ.mjs.map} +1 -1
  14. package/dist/{chunk-4E74ZTRT.mjs → chunk-WWP32QYC.mjs} +2606 -2428
  15. package/dist/chunk-WWP32QYC.mjs.map +1 -0
  16. package/dist/{chunk-UXGPZZ6V.mjs → chunk-ZYAAJMZZ.mjs} +2 -2
  17. package/dist/client/index.js +4 -4
  18. package/dist/client/index.mjs +3 -3
  19. package/dist/components/index.d.mts +29 -7
  20. package/dist/components/index.d.ts +29 -7
  21. package/dist/components/index.js +8 -4
  22. package/dist/components/index.js.map +1 -1
  23. package/dist/components/index.mjs +9 -5
  24. package/dist/contexts/index.d.mts +1 -1
  25. package/dist/contexts/index.d.ts +1 -1
  26. package/dist/contexts/index.js +4 -4
  27. package/dist/contexts/index.mjs +3 -3
  28. package/dist/core/index.d.mts +2 -2
  29. package/dist/core/index.d.ts +2 -2
  30. package/dist/core/index.js +2 -2
  31. package/dist/core/index.mjs +1 -1
  32. package/dist/index.d.mts +2 -2
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js +3 -3
  35. package/dist/index.mjs +2 -2
  36. package/dist/{s3.service-DIR6Su9B.d.ts → s3.service-Cg5TmbU_.d.ts} +3 -0
  37. package/dist/{s3.service-XchHd3ii.d.mts → s3.service-DLf_a0xS.d.mts} +3 -0
  38. package/dist/server/index.d.mts +1 -1
  39. package/dist/server/index.d.ts +1 -1
  40. package/dist/server/index.js +3 -3
  41. package/dist/server/index.mjs +1 -1
  42. package/package.json +1 -1
  43. package/src/components/EditableAvatar.tsx +175 -0
  44. package/src/components/index.ts +1 -0
  45. package/src/features/company/components/forms/CompanyEditor.tsx +1 -3
  46. package/src/features/role/components/forms/FormRoles.tsx +5 -4
  47. package/src/features/user/components/containers/AllUsersListContainer.tsx +36 -0
  48. package/src/features/user/components/containers/UserContainer.tsx +10 -13
  49. package/src/features/user/components/containers/UsersListContainer.tsx +15 -24
  50. package/src/features/user/components/containers/index.ts +1 -0
  51. package/src/features/user/components/details/UserContent.tsx +92 -0
  52. package/src/features/user/components/details/index.ts +1 -1
  53. package/src/features/user/components/forms/UserEditor.tsx +233 -233
  54. package/src/features/user/components/lists/CompanyUsersList.tsx +3 -1
  55. package/src/features/user/contexts/UserContext.tsx +1 -6
  56. package/src/features/user/data/user.service.ts +9 -0
  57. package/src/features/user/data/user.ts +3 -4
  58. package/dist/chunk-4E74ZTRT.mjs.map +0 -1
  59. package/dist/chunk-NVXYOQFW.js.map +0 -1
  60. package/dist/chunk-QIFM4G7T.js.map +0 -1
  61. package/src/features/user/components/details/UserDetails.tsx +0 -74
  62. /package/dist/{BlockNoteEditor-KCJMA6LW.mjs.map → BlockNoteEditor-TIX3GDVZ.mjs.map} +0 -0
  63. /package/dist/{chunk-UXGPZZ6V.mjs.map → chunk-ZYAAJMZZ.mjs.map} +0 -0
@@ -1,36 +1,27 @@
1
1
  "use client";
2
2
 
3
- import { useTranslations } from "next-intl";
4
- import { CompanyUsersList, Tab, TabsContainer } from "../../../../components";
3
+ import { CompanyUsersList, RoundPageContainer } from "../../../../components";
5
4
  import { Modules } from "../../../../core";
6
5
  import { Action } from "../../../../permissions";
7
6
  import { useCurrentUserContext } from "../../contexts";
8
7
  import { UserInterface } from "../../data";
9
8
 
10
- function UsersListContainerInternal() {
11
- const { hasPermissionToModule } = useCurrentUserContext<UserInterface>();
12
- const t = useTranslations();
9
+ type UsersListContainerProps = {
10
+ fullWidth?: boolean;
11
+ };
13
12
 
14
- if (!hasPermissionToModule({ module: Modules.User, action: Action.Delete })) return <CompanyUsersList />;
13
+ function UsersListContainerInternal({ fullWidth }: UsersListContainerProps) {
14
+ return (
15
+ <RoundPageContainer module={Modules.User} fullWidth={fullWidth}>
16
+ <CompanyUsersList fullWidth={fullWidth} />
17
+ </RoundPageContainer>
18
+ );
19
+ }
15
20
 
16
- const tabs: Tab[] = [
17
- {
18
- label: t(`entities.users`, { count: 2 }),
19
- content: <CompanyUsersList />,
20
- modules: [Modules.Company],
21
- action: Action.Read,
22
- },
23
- {
24
- label: t(`user.deleted`),
25
- content: <CompanyUsersList isDeleted={true} />,
26
- modules: [Modules.Company],
27
- action: Action.Update,
28
- },
29
- ];
21
+ export function UsersListContainer({ fullWidth }: UsersListContainerProps) {
22
+ const { hasPermissionToModule } = useCurrentUserContext<UserInterface>();
30
23
 
31
- return <TabsContainer tabs={tabs} />;
32
- }
24
+ if (!hasPermissionToModule({ module: Modules.User, action: Action.Read })) return null;
33
25
 
34
- export function UsersListContainer() {
35
- return <UsersListContainerInternal />;
26
+ return <UsersListContainerInternal fullWidth={fullWidth} />;
36
27
  }
@@ -1,3 +1,4 @@
1
+ export * from "./AllUsersListContainer";
1
2
  export * from "./UserContainer";
2
3
  export * from "./UserIndexContainer";
3
4
  export * from "./UsersListContainer";
@@ -0,0 +1,92 @@
1
+ "use client";
2
+
3
+ import { useTranslations } from "next-intl";
4
+ import { AttributeElement } from "../../../../components/contents";
5
+ import { EditableAvatar } from "../../../../components/EditableAvatar";
6
+ import { getInitials } from "../../../../utils/getInitials";
7
+ import { Modules } from "../../../../core";
8
+ import { usePageUrlGenerator } from "../../../../hooks";
9
+ import { Badge, Link } from "../../../../shadcnui";
10
+ import { RoleInterface } from "../../../role";
11
+ import { UserInterface } from "../../data";
12
+ import { UserService } from "../../data/user.service";
13
+ import { useUserContext } from "../../contexts";
14
+ import { BriefcaseIcon, MailIcon, PhoneIcon } from "lucide-react";
15
+
16
+ type UserContentProps = {
17
+ user: UserInterface;
18
+ };
19
+
20
+ export function UserContent({ user }: UserContentProps) {
21
+ const t = useTranslations();
22
+ const generateUrl = usePageUrlGenerator();
23
+ const { setUser } = useUserContext();
24
+
25
+ const hasBio = !!user.bio;
26
+
27
+ return (
28
+ <div className="flex flex-col gap-y-8">
29
+ {/* Hero Section */}
30
+ <div className="flex items-start gap-x-6">
31
+ <EditableAvatar
32
+ entityId={user.id}
33
+ module={Modules.User}
34
+ image={user.avatar}
35
+ fallback={getInitials(user.name)}
36
+ alt={user.name}
37
+ patchImage={async (imageKey) => {
38
+ const updated = await UserService.patch({ id: user.id, avatar: imageKey });
39
+ setUser(updated);
40
+ }}
41
+ className="h-24 w-24"
42
+ fallbackClassName="text-2xl"
43
+ />
44
+ <div className="flex flex-col gap-y-2">
45
+ {user.roles && user.roles.length > 0 && (
46
+ <div className="flex flex-wrap gap-2">
47
+ {user.roles.map((role: RoleInterface) => (
48
+ <Link key={role.id} href={generateUrl({ page: Modules.Role, id: role.id })}>
49
+ <Badge variant="default">{t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })}</Badge>
50
+ </Link>
51
+ ))}
52
+ </div>
53
+ )}
54
+ {user.isDeleted ? (
55
+ <div>
56
+ <Badge variant="destructive">{t(`user.errors.deleted`)}</Badge>
57
+ </div>
58
+ ) : (
59
+ <>
60
+ {!user.isActivated && (
61
+ <div>
62
+ <Badge variant="destructive">{t(`user.errors.inactive`)}</Badge>
63
+ </div>
64
+ )}
65
+ </>
66
+ )}
67
+ {user.title && (
68
+ <div className="text-muted-foreground flex items-center gap-x-2 text-sm">
69
+ <BriefcaseIcon className="h-4 w-4 shrink-0" />
70
+ {user.title}
71
+ </div>
72
+ )}
73
+ {user.email && (
74
+ <div className="text-muted-foreground flex items-center gap-x-2 text-sm">
75
+ <MailIcon className="h-4 w-4 shrink-0" />
76
+ {user.email}
77
+ </div>
78
+ )}
79
+ {user.phone && (
80
+ <div className="text-muted-foreground flex items-center gap-x-2 text-sm">
81
+ <PhoneIcon className="h-4 w-4 shrink-0" />
82
+ {user.phone}
83
+ </div>
84
+ )}
85
+ </div>
86
+ </div>
87
+
88
+ {/* Bio Section */}
89
+ {hasBio && <AttributeElement title={t(`user.fields.bio.label`)} value={user.bio} />}
90
+ </div>
91
+ );
92
+ }
@@ -1,3 +1,3 @@
1
- export * from "./UserDetails";
1
+ export * from "./UserContent";
2
2
  export * from "./UserIndexDetails";
3
3
  export * from "./UserStandaloneDetails";