@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.
Files changed (85) hide show
  1. package/dist/{BlockNoteEditor-BEWKLGW3.js → BlockNoteEditor-CJWHJRG3.js} +10 -10
  2. package/dist/BlockNoteEditor-CJWHJRG3.js.map +1 -0
  3. package/dist/{BlockNoteEditor-GNFK7ZVR.mjs → BlockNoteEditor-ZET7ANBC.mjs} +6 -6
  4. package/dist/BlockNoteEditor-ZET7ANBC.mjs.map +1 -0
  5. package/dist/billing/index.js +291 -291
  6. package/dist/billing/index.mjs +1 -1
  7. package/dist/{chunk-IJSB4FH6.mjs → chunk-3HGZMKT4.mjs} +493 -523
  8. package/dist/chunk-3HGZMKT4.mjs.map +1 -0
  9. package/dist/{chunk-XU4MY6OG.js → chunk-6HQ6CPVL.js} +493 -523
  10. package/dist/chunk-6HQ6CPVL.js.map +1 -0
  11. package/dist/client/index.js +2 -2
  12. package/dist/client/index.mjs +1 -1
  13. package/dist/components/index.js +2 -2
  14. package/dist/components/index.mjs +1 -1
  15. package/dist/contexts/index.js +2 -2
  16. package/dist/contexts/index.mjs +1 -1
  17. package/package.json +1 -1
  18. package/src/components/details/AllowedUsersDetails.tsx +1 -1
  19. package/src/components/editors/BlockNoteEditor.tsx +5 -5
  20. package/src/components/forms/CommonAssociationForm.tsx +9 -9
  21. package/src/components/forms/CommonDeleter.tsx +14 -8
  22. package/src/components/forms/CommonEditorButtons.tsx +2 -2
  23. package/src/components/forms/CommonEditorHeader.tsx +4 -4
  24. package/src/components/forms/CommonEditorTrigger.tsx +1 -1
  25. package/src/components/forms/FileUploader.tsx +8 -8
  26. package/src/components/forms/FormDateTime.tsx +6 -12
  27. package/src/components/forms/FormInput.tsx +4 -20
  28. package/src/components/forms/PasswordInput.tsx +1 -1
  29. package/src/components/navigations/Breadcrumb.tsx +1 -1
  30. package/src/components/navigations/Header.tsx +2 -2
  31. package/src/components/navigations/RecentPagesNavigator.tsx +3 -3
  32. package/src/components/tables/ContentTableSearch.tsx +1 -1
  33. package/src/contexts/CommonContext.tsx +2 -2
  34. package/src/features/auth/components/details/LandingComponent.tsx +5 -5
  35. package/src/features/auth/components/forms/AcceptInvitation.tsx +16 -22
  36. package/src/features/auth/components/forms/ActivateAccount.tsx +8 -8
  37. package/src/features/auth/components/forms/ForgotPassword.tsx +9 -9
  38. package/src/features/auth/components/forms/Login.tsx +12 -12
  39. package/src/features/auth/components/forms/Register.tsx +19 -21
  40. package/src/features/auth/components/forms/ResetPassword.tsx +12 -18
  41. package/src/features/company/components/details/TokenStatusIndicator.tsx +7 -7
  42. package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +2 -2
  43. package/src/features/company/components/forms/CompanyDeleter.tsx +13 -11
  44. package/src/features/company/components/forms/CompanyEditor.tsx +7 -13
  45. package/src/features/company/components/lists/CompaniesList.tsx +1 -1
  46. package/src/features/company/contexts/CompanyContext.tsx +1 -1
  47. package/src/features/company/hooks/useCompanyTableStructure.tsx +2 -2
  48. package/src/features/content/components/lists/ContentsList.tsx +1 -1
  49. package/src/features/content/components/lists/ContentsListById.tsx +1 -1
  50. package/src/features/content/components/lists/RelevantContentsList.tsx +1 -1
  51. package/src/features/content/hooks/useContentTableStructure.tsx +5 -5
  52. package/src/features/notification/components/containers/NotificationsListContainer.tsx +2 -2
  53. package/src/features/notification/components/lists/NotificationsList.tsx +3 -3
  54. package/src/features/notification/components/modals/NotificationModal.tsx +3 -5
  55. package/src/features/notification/components/notifications/Notification.tsx +4 -4
  56. package/src/features/notification/contexts/NotificationContext.tsx +2 -2
  57. package/src/features/role/components/details/RoleDetails.tsx +1 -1
  58. package/src/features/role/components/forms/FormRoles.tsx +2 -2
  59. package/src/features/role/components/forms/RemoveUserFromRole.tsx +9 -11
  60. package/src/features/role/components/forms/UserRoleAdd.tsx +18 -18
  61. package/src/features/role/components/lists/RolesList.tsx +1 -1
  62. package/src/features/role/components/lists/UserRolesList.tsx +1 -1
  63. package/src/features/role/contexts/RoleContext.tsx +2 -2
  64. package/src/features/role/hooks/useRoleTableStructure.tsx +3 -3
  65. package/src/features/user/components/containers/UsersListContainer.tsx +2 -2
  66. package/src/features/user/components/details/UserDetails.tsx +6 -6
  67. package/src/features/user/components/forms/RoleUserAdd.tsx +8 -8
  68. package/src/features/user/components/forms/UserAvatarEditor.tsx +2 -2
  69. package/src/features/user/components/forms/UserEditor.tsx +21 -25
  70. package/src/features/user/components/forms/UserReactivator.tsx +7 -7
  71. package/src/features/user/components/forms/UserResentInvitationEmail.tsx +9 -9
  72. package/src/features/user/components/forms/UserSelector.tsx +4 -9
  73. package/src/features/user/components/lists/AdminUsersList.tsx +1 -1
  74. package/src/features/user/components/lists/CompanyUsersList.tsx +1 -1
  75. package/src/features/user/components/lists/RelevantUsersList.tsx +1 -1
  76. package/src/features/user/components/lists/RoleUsersList.tsx +1 -1
  77. package/src/features/user/components/lists/UsersList.tsx +1 -1
  78. package/src/features/user/components/lists/UsersListByContentIds.tsx +1 -1
  79. package/src/features/user/components/widgets/UserSearchPopover.tsx +3 -3
  80. package/src/features/user/contexts/UserContext.tsx +5 -5
  81. package/src/features/user/hooks/useUserTableStructure.tsx +6 -6
  82. package/dist/BlockNoteEditor-BEWKLGW3.js.map +0 -1
  83. package/dist/BlockNoteEditor-GNFK7ZVR.mjs.map +0 -1
  84. package/dist/chunk-IJSB4FH6.mjs.map +0 -1
  85. package/dist/chunk-XU4MY6OG.js.map +0 -1
@@ -47,10 +47,10 @@ function AddUserToRoleInternal({ role, refresh }: AddUserToRoleProps) {
47
47
 
48
48
  triggerAssociationToast({
49
49
  t: t,
50
- source: t(`types.users`, { count: 1 }),
51
- destination: t(`types.roles`, { count: 1 }),
50
+ source: t(`entities.users`, { count: 1 }),
51
+ destination: t(`entities.roles`, { count: 1 }),
52
52
  source_name: user.name,
53
- destination_name: t(`foundations.role.roles`, { role: role.id.replaceAll(`-`, ``) }),
53
+ destination_name: t(`role.roles`, { role: role.id.replaceAll(`-`, ``) }),
54
54
  });
55
55
 
56
56
  refresh();
@@ -72,17 +72,17 @@ function AddUserToRoleInternal({ role, refresh }: AddUserToRoleProps) {
72
72
  return (
73
73
  <>
74
74
  <CommonAssociationTrigger
75
- sourceType={t(`types.users`, { count: 1 })}
76
- destinationType={t(`types.roles`, { count: 1 })}
75
+ sourceType={t(`entities.users`, { count: 1 })}
76
+ destinationType={t(`entities.roles`, { count: 1 })}
77
77
  onTrigger={() => setShow(true)}
78
78
  />
79
79
  <CommonAssociationCommandDialog
80
80
  show={show}
81
81
  setShow={setShow}
82
82
  data={data}
83
- source={t(`types.users`, { count: 1 })}
84
- destination={t(`types.roles`, { count: 1 })}
85
- destinationName={t(`foundations.role.roles`, { role: role.id.replaceAll(`-`, ``) })}
83
+ source={t(`entities.users`, { count: 1 })}
84
+ destination={t(`entities.roles`, { count: 1 })}
85
+ destinationName={t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })}
86
86
  >
87
87
  <UserListInAdd data={data} existingUsers={existingUsers} setSelectedUser={addUserToRole} />
88
88
  </CommonAssociationCommandDialog>
@@ -49,7 +49,7 @@ export function UserAvatarEditor({ user, file, setFile, resetImage, setResetImag
49
49
  {!resetImage && (file || user?.avatar) ? (
50
50
  <Image
51
51
  src={file ? URL.createObjectURL(file) : user?.avatar || ""}
52
- alt={t(`generic.avatar`)}
52
+ alt={t(`common.avatar`)}
53
53
  width={200}
54
54
  height={200}
55
55
  />
@@ -70,7 +70,7 @@ export function UserAvatarEditor({ user, file, setFile, resetImage, setResetImag
70
70
  setResetImage(true);
71
71
  }}
72
72
  >
73
- {t(`generic.buttons.remove`)}
73
+ {t(`ui.buttons.remove`)}
74
74
  </Button>
75
75
  )}
76
76
  </div>
@@ -67,8 +67,8 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
67
67
 
68
68
  const formSchema = z.object({
69
69
  id: z.uuidv4(),
70
- name: z.string().min(1, { message: t(`foundations.user.fields.name.error`) }),
71
- email: z.string().min(1, { message: t(`generic.fields.email.error`) }),
70
+ name: z.string().min(1, { message: t(`user.fields.name.error`) }),
71
+ email: z.string().min(1, { message: t(`common.fields.email.error`) }),
72
72
  password: z.string().optional(),
73
73
  title: z.string().optional(),
74
74
  bio: z.string().optional(),
@@ -101,9 +101,9 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
101
101
  if (existingUser) {
102
102
  form.setError("email", {
103
103
  type: "manual",
104
- message: t(`foundations.user.errors.email_exists`),
104
+ message: t(`user.errors.email_exists`),
105
105
  });
106
- errorToast({ title: t(`foundations.user.errors.email_exists`), error: "" });
106
+ errorToast({ title: t(`user.errors.email_exists`), error: "" });
107
107
  return;
108
108
  }
109
109
  } catch (error) {
@@ -157,7 +157,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
157
157
  router.push(generateUrl({ page: Modules.User, id: updatedUser.id }));
158
158
  }
159
159
  } catch (error) {
160
- errorToast({ title: user ? t(`generic.errors.update`) : t(`generic.errors.create`), error });
160
+ errorToast({ title: user ? t(`common.errors.update`) : t(`common.errors.create`), error });
161
161
  }
162
162
  };
163
163
 
@@ -216,7 +216,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
216
216
  <DialogContent
217
217
  className={`flex max-h-[70vh] ${canChangeRoles ? `max-w-[90vw]` : `max-w-3xl`} min-h-3xl max-h-[90vh] flex-col overflow-y-auto`}
218
218
  >
219
- <CommonEditorHeader type={t(`types.users`, { count: 1 })} name={user?.name} />
219
+ <CommonEditorHeader type={t(`entities.users`, { count: 1 })} name={user?.name} />
220
220
  <Form {...form}>
221
221
  <form onSubmit={form.handleSubmit(onSubmit)} className={`flex w-full flex-col gap-y-4`}>
222
222
  <div className={`flex flex-row gap-x-4`}>
@@ -233,54 +233,50 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
233
233
  <FormInput
234
234
  form={form}
235
235
  id="name"
236
- name={t(`foundations.user.fields.name.label`)}
237
- placeholder={t(`foundations.user.fields.name.placeholder`)}
236
+ name={t(`user.fields.name.label`)}
237
+ placeholder={t(`user.fields.name.placeholder`)}
238
238
  />
239
239
  <FormInput
240
240
  form={form}
241
241
  id="email"
242
- name={t(`generic.fields.email.label`)}
243
- placeholder={t(`generic.fields.email.placeholder`)}
242
+ name={t(`common.fields.email.label`)}
243
+ placeholder={t(`common.fields.email.placeholder`)}
244
244
  />
245
245
  <FormInput
246
246
  form={form}
247
247
  id="phone"
248
- name={t(`foundations.user.fields.phone.label`)}
249
- placeholder={t(`foundations.user.fields.phone.placeholder`)}
248
+ name={t(`user.fields.phone.label`)}
249
+ placeholder={t(`user.fields.phone.placeholder`)}
250
250
  />
251
251
  <FormPassword
252
252
  form={form}
253
253
  id="password"
254
- name={t(`foundations.user.fields.password.label`)}
255
- placeholder={t(`foundations.user.fields.password.placeholder`)}
254
+ name={t(`user.fields.password.label`)}
255
+ placeholder={t(`user.fields.password.placeholder`)}
256
256
  />
257
257
  <FormInput
258
258
  form={form}
259
259
  id="title"
260
- name={t(`foundations.user.fields.title.label`)}
261
- placeholder={t(`foundations.user.fields.title.placeholder`)}
260
+ name={t(`user.fields.title.label`)}
261
+ placeholder={t(`user.fields.title.placeholder`)}
262
262
  />
263
263
  <FormTextarea
264
264
  form={form}
265
265
  id="bio"
266
- name={t(`foundations.user.fields.bio.label`)}
267
- placeholder={t(`foundations.user.fields.bio.placeholder`)}
266
+ name={t(`user.fields.bio.label`)}
267
+ placeholder={t(`user.fields.bio.placeholder`)}
268
268
  className="min-h-40"
269
269
  />
270
270
  </div>
271
271
  {canChangeRoles && (
272
272
  <div className="flex w-1/3 flex-col">
273
273
  {canChangeRoles && (
274
- <FormRoles form={form} id="roleIds" name={t(`types.roles`, { count: 2 })} roles={roles} />
274
+ <FormRoles form={form} id="roleIds" name={t(`entities.roles`, { count: 2 })} roles={roles} />
275
275
  )}
276
276
  {!user && (
277
277
  <div className="flex flex-col gap-y-4">
278
- <div className="text-sm font-semibold">{t(`foundations.user.send_activation_email`)}</div>
279
- <FormCheckbox
280
- form={form}
281
- id="sendInvitationEmail"
282
- name={t(`foundations.user.send_activation_email`)}
283
- />
278
+ <div className="text-sm font-semibold">{t(`user.send_activation_email`)}</div>
279
+ <FormCheckbox form={form} id="sendInvitationEmail" name={t(`user.send_activation_email`)} />
284
280
  </div>
285
281
  )}
286
282
  </div>
@@ -35,7 +35,7 @@ function UserReactivatorInterface({ user, propagateChanges }: UserReactivatorPro
35
35
  setOpen(false);
36
36
  propagateChanges(updatedUser);
37
37
  } catch (error) {
38
- errorToast({ title: t(`generic.errors.error`), error: error });
38
+ errorToast({ title: t(`common.errors.error`), error: error });
39
39
  }
40
40
  };
41
41
 
@@ -44,18 +44,18 @@ function UserReactivatorInterface({ user, propagateChanges }: UserReactivatorPro
44
44
  <DialogTrigger>
45
45
  <Button size="sm">
46
46
  <UserCheckIcon className="mr-3 h-3.5 w-3.5" />
47
- {t(`foundations.user.buttons.reactivate`)}
47
+ {t(`user.buttons.reactivate`)}
48
48
  </Button>
49
49
  </DialogTrigger>
50
50
  <DialogContent className={`flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`}>
51
51
  <DialogHeader>
52
- <DialogTitle>{t(`foundations.user.reactivate.title`)}</DialogTitle>
53
- <DialogDescription>{t(`foundations.user.reactivate.subtitle`)}</DialogDescription>
52
+ <DialogTitle>{t(`user.reactivate.title`)}</DialogTitle>
53
+ <DialogDescription>{t(`user.reactivate.subtitle`)}</DialogDescription>
54
54
  </DialogHeader>
55
- {t(`foundations.user.reactivate.description`, { name: user.name })}
55
+ {t(`user.reactivate.description`, { name: user.name })}
56
56
  <div className="flex justify-end">
57
57
  <Button className="mr-2" variant={"outline"} type={`button`} onClick={() => setOpen(false)}>
58
- {t(`generic.buttons.cancel`)}
58
+ {t(`ui.buttons.cancel`)}
59
59
  </Button>
60
60
  <Button
61
61
  type="submit"
@@ -64,7 +64,7 @@ function UserReactivatorInterface({ user, propagateChanges }: UserReactivatorPro
64
64
  reactivateUser();
65
65
  }}
66
66
  >
67
- {t(`foundations.user.buttons.reactivate`)}
67
+ {t(`user.buttons.reactivate`)}
68
68
  </Button>
69
69
  </div>
70
70
  </DialogContent>
@@ -36,11 +36,11 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
36
36
  await UserService.sendInvitation({ userId: user.id, companyId: user.company!.id });
37
37
 
38
38
  setOpen(false);
39
- toast.message(t(`foundations.user.resend_activation.email_sent`), {
40
- description: t(`foundations.user.resend_activation.email_sent_description`, { email: user.email }),
39
+ toast.message(t(`user.resend_activation.email_sent`), {
40
+ description: t(`user.resend_activation.email_sent_description`, { email: user.email }),
41
41
  });
42
42
  } catch (error) {
43
- errorToast({ title: t(`generic.errors.error`), error: error });
43
+ errorToast({ title: t(`common.errors.error`), error: error });
44
44
  }
45
45
  };
46
46
 
@@ -54,17 +54,17 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
54
54
  </Button>
55
55
  </DialogTrigger>
56
56
  </TooltipTrigger>
57
- <TooltipContent>{t(`foundations.user.buttons.resend_activation`)}</TooltipContent>
57
+ <TooltipContent>{t(`user.buttons.resend_activation`)}</TooltipContent>
58
58
  </Tooltip>
59
59
  <DialogContent className={`flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`}>
60
60
  <DialogHeader>
61
- <DialogTitle>{t(`foundations.user.resend_activation.title`)}</DialogTitle>
62
- <DialogDescription>{t(`foundations.user.resend_activation.subtitle`)}</DialogDescription>
61
+ <DialogTitle>{t(`user.resend_activation.title`)}</DialogTitle>
62
+ <DialogDescription>{t(`user.resend_activation.subtitle`)}</DialogDescription>
63
63
  </DialogHeader>
64
- {t(`foundations.user.resend_activation.description`, { email: user.email })}
64
+ {t(`user.resend_activation.description`, { email: user.email })}
65
65
  <div className="flex justify-end">
66
66
  <Button className="mr-2" variant={"outline"} type={`button`} onClick={() => setOpen(false)}>
67
- {t(`generic.buttons.cancel`)}
67
+ {t(`ui.buttons.cancel`)}
68
68
  </Button>
69
69
  <Button
70
70
  type="submit"
@@ -73,7 +73,7 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
73
73
  sendInvitationEmail();
74
74
  }}
75
75
  >
76
- {t(`foundations.user.buttons.resend_activation`)}
76
+ {t(`user.buttons.resend_activation`)}
77
77
  </Button>
78
78
  </div>
79
79
  </DialogContent>
@@ -3,9 +3,9 @@
3
3
  import { CircleX, RefreshCwIcon, SearchIcon, XIcon } from "lucide-react";
4
4
  import { useTranslations } from "next-intl";
5
5
  import { useCallback, useEffect, useRef, useState } from "react";
6
+ import { FormFieldWrapper } from "../../../../components/forms";
6
7
  import { Modules } from "../../../../core";
7
8
  import { DataListRetriever, useDataListRetriever, useDebounce } from "../../../../hooks";
8
- import { FormFieldWrapper } from "../../../../components/forms";
9
9
  import {
10
10
  Avatar,
11
11
  AvatarFallback,
@@ -88,12 +88,7 @@ export function UserSelector({ id, form, label, placeholder, onChange, isRequire
88
88
 
89
89
  return (
90
90
  <div className="flex w-full flex-col">
91
- <FormFieldWrapper
92
- form={form}
93
- name={id}
94
- label={label}
95
- isRequired={isRequired}
96
- >
91
+ <FormFieldWrapper form={form} name={id} label={label} isRequired={isRequired}>
97
92
  {(field) => (
98
93
  <Popover open={open} onOpenChange={setOpen} modal={true}>
99
94
  <div className="flex w-full flex-row items-center justify-between">
@@ -117,7 +112,7 @@ export function UserSelector({ id, form, label, placeholder, onChange, isRequire
117
112
  </>
118
113
  ) : (
119
114
  <div className="text-muted-foreground mr-7 flex h-10 w-full flex-row items-center justify-start rounded-md border p-2 text-sm">
120
- {placeholder ?? t(`generic.search.placeholder`, { type: t(`types.users`, { count: 1 }) })}
115
+ {placeholder ?? t(`ui.search.placeholder`, { type: t(`entities.users`, { count: 1 }) })}
121
116
  </div>
122
117
  )}
123
118
  </div>
@@ -134,7 +129,7 @@ export function UserSelector({ id, form, label, placeholder, onChange, isRequire
134
129
  <div className="relative mb-2 w-full">
135
130
  <SearchIcon className="text-muted-foreground absolute top-2.5 left-2.5 h-4 w-4" />
136
131
  <Input
137
- placeholder={t(`generic.search.placeholder`, { type: t(`types.users`, { count: 1 }) })}
132
+ placeholder={t(`ui.search.placeholder`, { type: t(`entities.users`, { count: 1 }) })}
138
133
  type="text"
139
134
  className="w-full pr-8 pl-8"
140
135
  onChange={(e) => setSearchTerm(e.target.value)}
@@ -25,7 +25,7 @@ function AdminUsersListInternal({ company }: AdminUsersListProps) {
25
25
 
26
26
  return (
27
27
  <ContentListTable
28
- title={t(`types.users`, { count: 2 })}
28
+ title={t(`entities.users`, { count: 2 })}
29
29
  data={data}
30
30
  fields={[UserFields.name, UserFields.email, UserFields.createdAt]}
31
31
  tableGeneratorType={Modules.User}
@@ -39,7 +39,7 @@ export function CompanyUsersList({ isDeleted }: CompanyUsersListProps) {
39
39
  fields={[UserFields.name, UserFields.email]}
40
40
  tableGeneratorType={Modules.User}
41
41
  functions={functions}
42
- title={t(`types.users`, { count: 2 })}
42
+ title={t(`entities.users`, { count: 2 })}
43
43
  />
44
44
  );
45
45
  }
@@ -25,7 +25,7 @@ export function RelevantUsersList({ id }: RelevantUsersListProps) {
25
25
  data={data}
26
26
  fields={[UserFields.name, UserFields.email, UserFields.relevance]}
27
27
  tableGeneratorType={Modules.User}
28
- title={t(`generic.relevant_users`)}
28
+ title={t(`common.relevant_users`)}
29
29
  />
30
30
  );
31
31
  }
@@ -26,7 +26,7 @@ export function RoleUsersList({ role }: RoleUsersListProps) {
26
26
  data={data}
27
27
  fields={[UserFields.name, UserFields.email]}
28
28
  tableGeneratorType={Modules.User}
29
- title={t(`types.users`, { count: 2 })}
29
+ title={t(`entities.users`, { count: 2 })}
30
30
  />
31
31
  );
32
32
  }
@@ -24,7 +24,7 @@ export function UsersList({ data, optionComponents, removeFunction, hideOptions,
24
24
  data={data}
25
25
  fields={[UserFields.name, UserFields.email]}
26
26
  tableGeneratorType={Modules.User}
27
- title={t(`types.users`, { count: 2 })}
27
+ title={t(`entities.users`, { count: 2 })}
28
28
  />
29
29
  );
30
30
  }
@@ -25,7 +25,7 @@ export function UsersListByContentIds({ contentIds }: UsersListByContentIdsProps
25
25
  data={data}
26
26
  fields={[UserFields.name, UserFields.email]}
27
27
  tableGeneratorType={Modules.User}
28
- title={t(`generic.relevant_users`)}
28
+ title={t(`common.relevant_users`)}
29
29
  />
30
30
  );
31
31
  }
@@ -47,7 +47,7 @@ export const UserSearchPopover = ({ children, onSelect, align = "start", classNa
47
47
  <div className="relative mb-2 w-full">
48
48
  <SearchIcon className="text-muted-foreground absolute top-2.5 left-2.5 h-4 w-4" />
49
49
  <Input
50
- placeholder={t(`generic.search.placeholder`, { type: t(`types.users`, { count: 1 }) })}
50
+ placeholder={t(`ui.search.placeholder`, { type: t(`entities.users`, { count: 1 }) })}
51
51
  type="text"
52
52
  className="w-full pr-8 pl-8"
53
53
  onChange={(e) => setSearchQuery(e.target.value)}
@@ -81,8 +81,8 @@ 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(`generic.loading`)
85
- : t(`generic.search.no_results`, { type: t(`types.users`, { count: 1 }) })}
84
+ ? t(`common.loading`)
85
+ : t(`ui.search.no_results`, { type: t(`entities.users`, { count: 1 }) })}
86
86
  </div>
87
87
  )}
88
88
  </CommandList>
@@ -37,19 +37,19 @@ export const UserProvider = ({ children, dehydratedUser }: UserProviderProps) =>
37
37
 
38
38
  if (hasPermissionToModule({ module: Modules.User, action: Action.Update })) {
39
39
  response.push({
40
- name: t(`generic.settings`),
40
+ name: t(`common.settings`),
41
41
  href: generateUrl({ page: `/settings` }),
42
42
  });
43
43
 
44
44
  response.push({
45
- name: t(`types.users`, { count: 2 }),
45
+ name: t(`entities.users`, { count: 2 }),
46
46
  href: generateUrl({ page: `/settings`, id: Modules.User.pageUrl }),
47
47
  });
48
48
  }
49
49
 
50
50
  if (user)
51
51
  response.push({
52
- name: `${user.name}${user.isDeleted ? ` (${t(`foundations.user.deleted`)})` : ""}`,
52
+ name: `${user.name}${user.isDeleted ? ` (${t(`user.deleted`)})` : ""}`,
53
53
  href: generateUrl({ page: Modules.User, id: user.id }),
54
54
  });
55
55
 
@@ -58,13 +58,13 @@ export const UserProvider = ({ children, dehydratedUser }: UserProviderProps) =>
58
58
 
59
59
  const title = () => {
60
60
  const response: any = {
61
- type: t(`types.users`, { count: user ? 1 : 2 }),
61
+ type: t(`entities.users`, { count: user ? 1 : 2 }),
62
62
  };
63
63
 
64
64
  const functions: ReactNode[] = [];
65
65
 
66
66
  if (user) {
67
- response.element = `${user.name}${user.isDeleted ? ` (${t(`foundations.user.deleted`)})` : ""}`;
67
+ response.element = `${user.name}${user.isDeleted ? ` (${t(`user.deleted`)})` : ""}`;
68
68
 
69
69
  if (user.isDeleted) {
70
70
  functions.push(<UserReactivator key={`UserReactivator`} user={user} propagateChanges={setUser} />);
@@ -39,7 +39,7 @@ export const useUserTableStructure: UseTableStructureHook<UserInterface, UserFie
39
39
  [UserFields.name]: () => ({
40
40
  id: "name",
41
41
  accessorKey: "name",
42
- header: t(`foundations.user.fields.name.label`),
42
+ header: t(`user.fields.name.label`),
43
43
  cell: ({ row }: { row: Row<TableContent<UserInterface>> }) => {
44
44
  const user = row.original.jsonApiData as UserInterface;
45
45
  return (
@@ -52,8 +52,8 @@ export const useUserTableStructure: UseTableStructureHook<UserInterface, UserFie
52
52
  >
53
53
  <UserAvatar user={user} />
54
54
  {user.name}
55
- {user.isDeleted ? ` - ${t("foundations.user.errors.deleted")}` : ""}
56
- {!user.isActivated ? ` - ${t("foundations.user.errors.inactive")}` : ""}
55
+ {user.isDeleted ? ` - ${t("user.errors.deleted")}` : ""}
56
+ {!user.isActivated ? ` - ${t("user.errors.inactive")}` : ""}
57
57
  </Link>
58
58
  );
59
59
  },
@@ -63,7 +63,7 @@ export const useUserTableStructure: UseTableStructureHook<UserInterface, UserFie
63
63
  [UserFields.email]: () => ({
64
64
  id: "email",
65
65
  accessorKey: "email",
66
- header: t(`generic.fields.email.label`),
66
+ header: t(`common.fields.email.label`),
67
67
  cell: ({ row }: { row: Row<TableContent<UserInterface>> }) => <>{row.getValue("email")}</>,
68
68
  enableSorting: false,
69
69
  enableHiding: false,
@@ -71,7 +71,7 @@ export const useUserTableStructure: UseTableStructureHook<UserInterface, UserFie
71
71
  [UserFields.relevance]: () => ({
72
72
  id: "relevance",
73
73
  accessorKey: "relevance",
74
- header: t(`generic.relevance`),
74
+ header: t(`common.relevance`),
75
75
  cell: ({ row }: { row: TableContent<UserInterface> }) => {
76
76
  const user: UserInterface = row.original.jsonApiData;
77
77
 
@@ -99,7 +99,7 @@ export const useUserTableStructure: UseTableStructureHook<UserInterface, UserFie
99
99
  [UserFields.createdAt]: () =>
100
100
  cellDate({
101
101
  name: "createdAt",
102
- title: t(`generic.date.create`),
102
+ title: t(`common.date.create`),
103
103
  }),
104
104
  };
105
105
 
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-BEWKLGW3.js","../src/components/editors/BlockNoteEditor.tsx","../src/components/editors/BlockNoteEditorFormattingToolbar.tsx"],"names":["jsxs","jsx"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACnBA,uCAAyE;AACzE,yCAAiE;AACjE,2CAA8B;AAC9B,uCAAO;AACP,2CAAiC;AACjC,qCAAgC;AAChC,+BAAyE;ADqBzE;AACA;AE5BA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAOM,+CAAA;AAJD,SAAS,gCAAA,CAAA,EAAmC;AACjD,EAAA,uBACE,6BAAA;AAAA,IAAC,kCAAA;AAAA,IAAA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A;AACd,YAAA;AACpC,UAAA;AACsB,QAAA;AAC2B,UAAA;AACnD,QAAA;AACF,MAAA;AACF,IAAA;AACO,IAAA;AACT,EAAA;AAGqC,EAAA;AAChC,IAAA;AAAA,IAAA;AACC,MAAA;AACU,MAAA;AACa,MAAA;AACJ,MAAA;AACb,MAAA;AACuD,MAAA;AAE5D,MAAA;AAAiC,IAAA;AAEtC,EAAA;AAEJ;AAtUwB;AD6S6C;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-BEWKLGW3.js","sourcesContent":[null,"\"use client\";\n\nimport { BlockNoteSchema, defaultInlineContentSpecs, PartialBlock } from \"@blocknote/core\";\nimport { createReactInlineContentSpec, useCreateBlockNote } from \"@blocknote/react\";\nimport { BlockNoteView } from \"@blocknote/shadcn\";\nimport \"@blocknote/shadcn/style.css\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useCurrentUserContext } from \"../../contexts\";\nimport { S3Interface } from \"../../features/s3/data\";\nimport { UserInterface } from \"../../features/user/data\";\nimport { S3Service } from \"../../features/s3/data/s3.service\";\nimport { Button } from \"../../shadcnui\";\nimport { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from \"../../utils\";\nimport { errorToast } from \"../errors\";\nimport { BlockNoteEditorFormattingToolbar } from \"./BlockNoteEditorFormattingToolbar\";\n\nexport type BlockNoteEditorProps = {\n id: string;\n type: string;\n initialContent?: PartialBlock[];\n onChange?: (content: any, isEmpty: boolean, hasUnresolvedDiff: boolean) => void;\n size?: \"sm\" | \"md\";\n className?: string;\n markdownContent?: string;\n diffContent?: PartialBlock[];\n placeholder?: string;\n bordered?: boolean;\n};\n\nconst createDiffActionsInlineContentSpec = (\n handleAcceptChange: (diffId: string) => void,\n handleRejectChange: (diffId: string) => void,\n) => {\n return createReactInlineContentSpec(\n {\n type: \"diffActions\",\n propSchema: {\n diffIds: {\n default: \"\",\n },\n },\n content: \"none\",\n },\n {\n render: (props) => {\n const diffIds = props.inlineContent.props.diffIds;\n\n return (\n <span className=\"diff-actions-container mx-2 inline-flex items-center gap-1 align-middle\">\n <Button\n title=\"Accept change\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleAcceptChange(id.trim()));\n }}\n >\n <CheckIcon className=\"h-3 w-3 text-green-600\" />\n </Button>\n <Button\n title=\"Reject change\"\n className=\"mx-2 p-0\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleRejectChange(id.trim()));\n }}\n >\n <XIcon className=\"h-3 w-3 text-red-600\" />\n </Button>\n </span>\n );\n },\n },\n );\n};\n\nexport default function BlockNoteEditor({\n id,\n type,\n initialContent,\n onChange,\n size,\n className,\n markdownContent,\n diffContent,\n placeholder,\n bordered,\n}: BlockNoteEditorProps): React.JSX.Element {\n const t = useTranslations();\n const { company } = useCurrentUserContext<UserInterface>();\n\n const [acceptedChanges, setAcceptedChanges] = useState<Set<string>>(new Set());\n const [rejectedChanges, setRejectedChanges] = useState<Set<string>>(new Set());\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const handleAcceptChange = useCallback((diffId: string) => {\n setAcceptedChanges((prev) => new Set([...prev, diffId]));\n setRejectedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const handleRejectChange = useCallback((diffId: string) => {\n setRejectedChanges((prev) => new Set([...prev, diffId]));\n setAcceptedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const DiffActionsInlineContent = useMemo(\n () => createDiffActionsInlineContentSpec(handleAcceptChange, handleRejectChange),\n [handleAcceptChange, handleRejectChange],\n );\n\n const schema = useMemo(\n () =>\n BlockNoteSchema.create({\n inlineContentSpecs: {\n ...defaultInlineContentSpecs,\n diffActions: DiffActionsInlineContent,\n },\n } as any),\n [DiffActionsInlineContent],\n );\n\n const uploadImage = useCallback(\n async (file: File): Promise<string> => {\n if (!company) {\n errorToast({\n title: t(`generic.errors.upload`),\n error: t(`generic.errors.upload_description`),\n });\n throw new Error(t(`generic.errors.upload`));\n }\n\n const fileType = file.type;\n const key = `companies/${company.id}/${type}/${id}/${file.name}`;\n\n const s3: S3Interface = await S3Service.getPreSignedUrl({\n key: key,\n contentType: fileType,\n isPublic: true,\n });\n\n await fetch(s3.url, {\n method: \"PUT\",\n headers: s3.headers,\n body: file,\n });\n\n const signedImage: S3Interface = await S3Service.getSignedUrl({\n key: key,\n isPublic: true,\n });\n\n return signedImage.url;\n },\n [company, id, t],\n );\n\n // Utility: Remove trailing empty blocks for read-only display\n const removeTrailingEmptyBlocks = useCallback(\n (blocks: PartialBlock[]): PartialBlock[] => {\n if (!blocks || blocks.length === 0) return blocks;\n\n // Only remove trailing empty blocks in read-only mode\n if (onChange !== undefined) return blocks;\n\n const result = [...blocks];\n\n // Remove trailing empty paragraph blocks, but keep at least one block\n while (result.length > 1) {\n const lastBlock = result[result.length - 1];\n\n // Check if it's an empty paragraph\n const isEmptyParagraph =\n lastBlock.type === \"paragraph\" &&\n (!lastBlock.content ||\n lastBlock.content.length === 0 ||\n (Array.isArray(lastBlock.content) && lastBlock.content.every((c: any) => !c.text || c.text.trim() === \"\")));\n\n if (isEmptyParagraph) {\n result.pop();\n } else {\n break;\n }\n }\n\n return result;\n },\n [onChange],\n );\n\n const processedContent = useMemo(() => {\n if (diffContent && initialContent) {\n try {\n const diffResult = BlockNoteDiffUtil.diff(initialContent, diffContent);\n const renderedDiff = BlockNoteWordDiffRendererUtil.renderWordDiffs(\n diffResult.blocks,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n );\n return removeTrailingEmptyBlocks(renderedDiff);\n } catch (error) {\n return initialContent && Array.isArray(initialContent) && initialContent.length > 0\n ? removeTrailingEmptyBlocks(initialContent)\n : [];\n }\n }\n\n if (!initialContent) {\n return [];\n }\n\n if (!Array.isArray(initialContent)) {\n return [];\n }\n\n return initialContent.length > 0 ? removeTrailingEmptyBlocks(initialContent) : [];\n }, [\n initialContent,\n diffContent,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n removeTrailingEmptyBlocks,\n ]);\n\n const validatedInitialContent = useMemo(() => {\n if (processedContent && Array.isArray(processedContent) && processedContent.length > 0) {\n const validatedContent = processedContent.filter((block) => {\n if (!block || typeof block !== \"object\") return false;\n if (!(block as any).type) return false;\n return true;\n });\n return validatedContent.length > 0 ? (validatedContent as PartialBlock[]) : undefined;\n }\n return undefined;\n }, [processedContent]);\n\n const editor = useCreateBlockNote(\n useMemo(\n () => ({\n placeholders: {\n emptyDocument: placeholder || t(`generic.blocknote.placeholder`),\n },\n schema,\n initialContent: validatedInitialContent,\n uploadFile: uploadImage,\n }),\n [placeholder, t, schema, validatedInitialContent, uploadImage],\n ),\n );\n\n const handleChange = useCallback(async () => {\n if (!onChange) return;\n const newBlocks = editor.document;\n\n const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();\n\n function hasUnresolvedDiffsRecursive(block: any): boolean {\n if (!block || typeof block !== \"object\") return false;\n let diffId = undefined;\n if (block.props && block.props.diffId) diffId = block.props.diffId;\n if (!diffId && block.attrs && block.attrs.diffId) diffId = block.attrs.diffId;\n if (diffId && !acceptedChanges.has(diffId) && !rejectedChanges.has(diffId)) {\n return true;\n }\n\n if (block.content) {\n const contentArr = Array.isArray(block.content) ? block.content : [block.content];\n for (const inline of contentArr) {\n if (inline && typeof inline === \"object\") {\n if (inline.type === \"diffActions\" && inline.props && inline.props.diffIds) {\n const ids =\n typeof inline.props.diffIds === \"string\" ? inline.props.diffIds.split(\",\") : inline.props.diffIds;\n for (const id of ids) {\n const trimmed = (id || \"\").toString().trim();\n if (trimmed && !acceptedChanges.has(trimmed) && !rejectedChanges.has(trimmed)) {\n return true;\n }\n }\n }\n if (inline.props && inline.props.diffId) {\n const diffIdInline = inline.props.diffId;\n if (diffIdInline && !acceptedChanges.has(diffIdInline) && !rejectedChanges.has(diffIdInline)) {\n return true;\n }\n }\n if (inline.children && Array.isArray(inline.children)) {\n for (const child of inline.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n }\n }\n }\n if (Array.isArray(block.children)) {\n for (const child of block.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n return false;\n }\n\n let hasUnresolvedDiff = false;\n if (Array.isArray(newBlocks)) {\n hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));\n }\n\n onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);\n }, [editor, onChange, id, acceptedChanges, rejectedChanges]);\n\n // Utility: deep equality for arrays of blocks\n const areBlocksEqual = (a: any[], b: any[]): boolean => {\n return JSON.stringify(a) === JSON.stringify(b);\n };\n\n // Only initialize from markdownContent once per value, and only if different\n const hasInitializedFromMarkdown = useRef<string | null>(null);\n useEffect(() => {\n const updateContent = async (markdown: string) => {\n const blocks = await editor.tryParseMarkdownToBlocks(markdown);\n if (!areBlocksEqual(blocks, editor.document)) {\n editor.replaceBlocks(editor.document, blocks);\n }\n };\n\n if (markdownContent && hasInitializedFromMarkdown.current !== markdownContent) {\n hasInitializedFromMarkdown.current = markdownContent;\n updateContent(markdownContent).then(() => handleChange());\n }\n }, [markdownContent, editor]);\n\n // Update editor content when diff content changes, but only if different\n // Prevent unnecessary replaceBlocks calls that reset scroll/cursor.\n const previousContentHashRef = useRef<string | null>(null);\n useEffect(() => {\n if (!processedContent || !editor) return;\n const hash = JSON.stringify(processedContent);\n if (previousContentHashRef.current === hash) return; // no changes\n const currentHash = JSON.stringify(editor.document);\n if (currentHash === hash) {\n previousContentHashRef.current = hash;\n return; // already in sync\n }\n editor.replaceBlocks(editor.document, processedContent as PartialBlock[]);\n previousContentHashRef.current = hash;\n }, [processedContent, editor]);\n\n // Handle audio received from whisper transcription\n const handleAudioReceived = useCallback(\n (message: string) => {\n try {\n // Ensure the editor has focus\n const editorElement = editorRef.current?.querySelector('[contenteditable=\"true\"]') as HTMLElement;\n if (editorElement && document.activeElement !== editorElement) {\n editorElement.focus();\n }\n\n // Insert the transcribed text at the current cursor position\n editor.insertInlineContent(message);\n } catch (error) {\n console.error(\"Error inserting transcribed text:\", error);\n // Fallback: try to insert at the end of the document\n try {\n const blocks = editor.document;\n if (blocks.length > 0) {\n const lastBlock = blocks[blocks.length - 1];\n editor.setTextCursorPosition(lastBlock.id, \"end\");\n editor.insertInlineContent(message);\n }\n } catch (fallbackError) {\n console.error(\"Fallback insertion also failed:\", fallbackError);\n }\n }\n },\n [editor],\n );\n\n return (\n <div ref={editorRef} className={cn(bordered ? \"rounded-md border\" : \"\", \"w-full\")}>\n <BlockNoteView\n editor={editor}\n onChange={handleChange}\n editable={onChange !== undefined}\n formattingToolbar={false}\n theme=\"light\"\n className={cn(`BlockNoteView ${onChange ? \"min-h-96 p-4\" : \"\"}`, className, size === \"sm\" && \"small\")}\n >\n <BlockNoteEditorFormattingToolbar />\n </BlockNoteView>\n </div>\n );\n}\n","\"use client\";\n\nimport {\n BasicTextStyleButton,\n BlockTypeSelect,\n CreateLinkButton,\n FileCaptionButton,\n FileReplaceButton,\n FormattingToolbar,\n FormattingToolbarController,\n TextAlignButton,\n} from \"@blocknote/react\";\n\nexport function BlockNoteEditorFormattingToolbar() {\n return (\n <FormattingToolbarController\n formattingToolbar={() => (\n <FormattingToolbar>\n <BlockTypeSelect key={\"blockTypeSelect\"} />\n\n <FileCaptionButton key={\"fileCaptionButton\"} />\n <FileReplaceButton key={\"replaceFileButton\"} />\n\n <BasicTextStyleButton basicTextStyle={\"bold\"} key={\"boldStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"italic\"} key={\"italicStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"underline\"} key={\"underlineStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"strike\"} key={\"strikeStyleButton\"} />\n\n <TextAlignButton textAlignment={\"left\"} key={\"textAlignLeftButton\"} />\n <TextAlignButton textAlignment={\"center\"} key={\"textAlignCenterButton\"} />\n <TextAlignButton textAlignment={\"right\"} key={\"textAlignRightButton\"} />\n\n <CreateLinkButton key={\"createLinkButton\"} />\n </FormattingToolbar>\n )}\n />\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/editors/BlockNoteEditor.tsx","../src/components/editors/BlockNoteEditorFormattingToolbar.tsx"],"sourcesContent":["\"use client\";\n\nimport { BlockNoteSchema, defaultInlineContentSpecs, PartialBlock } from \"@blocknote/core\";\nimport { createReactInlineContentSpec, useCreateBlockNote } from \"@blocknote/react\";\nimport { BlockNoteView } from \"@blocknote/shadcn\";\nimport \"@blocknote/shadcn/style.css\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useCurrentUserContext } from \"../../contexts\";\nimport { S3Interface } from \"../../features/s3/data\";\nimport { UserInterface } from \"../../features/user/data\";\nimport { S3Service } from \"../../features/s3/data/s3.service\";\nimport { Button } from \"../../shadcnui\";\nimport { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from \"../../utils\";\nimport { errorToast } from \"../errors\";\nimport { BlockNoteEditorFormattingToolbar } from \"./BlockNoteEditorFormattingToolbar\";\n\nexport type BlockNoteEditorProps = {\n id: string;\n type: string;\n initialContent?: PartialBlock[];\n onChange?: (content: any, isEmpty: boolean, hasUnresolvedDiff: boolean) => void;\n size?: \"sm\" | \"md\";\n className?: string;\n markdownContent?: string;\n diffContent?: PartialBlock[];\n placeholder?: string;\n bordered?: boolean;\n};\n\nconst createDiffActionsInlineContentSpec = (\n handleAcceptChange: (diffId: string) => void,\n handleRejectChange: (diffId: string) => void,\n) => {\n return createReactInlineContentSpec(\n {\n type: \"diffActions\",\n propSchema: {\n diffIds: {\n default: \"\",\n },\n },\n content: \"none\",\n },\n {\n render: (props) => {\n const diffIds = props.inlineContent.props.diffIds;\n\n return (\n <span className=\"diff-actions-container mx-2 inline-flex items-center gap-1 align-middle\">\n <Button\n title=\"Accept change\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleAcceptChange(id.trim()));\n }}\n >\n <CheckIcon className=\"h-3 w-3 text-green-600\" />\n </Button>\n <Button\n title=\"Reject change\"\n className=\"mx-2 p-0\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleRejectChange(id.trim()));\n }}\n >\n <XIcon className=\"h-3 w-3 text-red-600\" />\n </Button>\n </span>\n );\n },\n },\n );\n};\n\nexport default function BlockNoteEditor({\n id,\n type,\n initialContent,\n onChange,\n size,\n className,\n markdownContent,\n diffContent,\n placeholder,\n bordered,\n}: BlockNoteEditorProps): React.JSX.Element {\n const t = useTranslations();\n const { company } = useCurrentUserContext<UserInterface>();\n\n const [acceptedChanges, setAcceptedChanges] = useState<Set<string>>(new Set());\n const [rejectedChanges, setRejectedChanges] = useState<Set<string>>(new Set());\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const handleAcceptChange = useCallback((diffId: string) => {\n setAcceptedChanges((prev) => new Set([...prev, diffId]));\n setRejectedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const handleRejectChange = useCallback((diffId: string) => {\n setRejectedChanges((prev) => new Set([...prev, diffId]));\n setAcceptedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const DiffActionsInlineContent = useMemo(\n () => createDiffActionsInlineContentSpec(handleAcceptChange, handleRejectChange),\n [handleAcceptChange, handleRejectChange],\n );\n\n const schema = useMemo(\n () =>\n BlockNoteSchema.create({\n inlineContentSpecs: {\n ...defaultInlineContentSpecs,\n diffActions: DiffActionsInlineContent,\n },\n } as any),\n [DiffActionsInlineContent],\n );\n\n const uploadImage = useCallback(\n async (file: File): Promise<string> => {\n if (!company) {\n errorToast({\n title: t(`generic.errors.upload`),\n error: t(`generic.errors.upload_description`),\n });\n throw new Error(t(`generic.errors.upload`));\n }\n\n const fileType = file.type;\n const key = `companies/${company.id}/${type}/${id}/${file.name}`;\n\n const s3: S3Interface = await S3Service.getPreSignedUrl({\n key: key,\n contentType: fileType,\n isPublic: true,\n });\n\n await fetch(s3.url, {\n method: \"PUT\",\n headers: s3.headers,\n body: file,\n });\n\n const signedImage: S3Interface = await S3Service.getSignedUrl({\n key: key,\n isPublic: true,\n });\n\n return signedImage.url;\n },\n [company, id, t],\n );\n\n // Utility: Remove trailing empty blocks for read-only display\n const removeTrailingEmptyBlocks = useCallback(\n (blocks: PartialBlock[]): PartialBlock[] => {\n if (!blocks || blocks.length === 0) return blocks;\n\n // Only remove trailing empty blocks in read-only mode\n if (onChange !== undefined) return blocks;\n\n const result = [...blocks];\n\n // Remove trailing empty paragraph blocks, but keep at least one block\n while (result.length > 1) {\n const lastBlock = result[result.length - 1];\n\n // Check if it's an empty paragraph\n const isEmptyParagraph =\n lastBlock.type === \"paragraph\" &&\n (!lastBlock.content ||\n lastBlock.content.length === 0 ||\n (Array.isArray(lastBlock.content) && lastBlock.content.every((c: any) => !c.text || c.text.trim() === \"\")));\n\n if (isEmptyParagraph) {\n result.pop();\n } else {\n break;\n }\n }\n\n return result;\n },\n [onChange],\n );\n\n const processedContent = useMemo(() => {\n if (diffContent && initialContent) {\n try {\n const diffResult = BlockNoteDiffUtil.diff(initialContent, diffContent);\n const renderedDiff = BlockNoteWordDiffRendererUtil.renderWordDiffs(\n diffResult.blocks,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n );\n return removeTrailingEmptyBlocks(renderedDiff);\n } catch (error) {\n return initialContent && Array.isArray(initialContent) && initialContent.length > 0\n ? removeTrailingEmptyBlocks(initialContent)\n : [];\n }\n }\n\n if (!initialContent) {\n return [];\n }\n\n if (!Array.isArray(initialContent)) {\n return [];\n }\n\n return initialContent.length > 0 ? removeTrailingEmptyBlocks(initialContent) : [];\n }, [\n initialContent,\n diffContent,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n removeTrailingEmptyBlocks,\n ]);\n\n const validatedInitialContent = useMemo(() => {\n if (processedContent && Array.isArray(processedContent) && processedContent.length > 0) {\n const validatedContent = processedContent.filter((block) => {\n if (!block || typeof block !== \"object\") return false;\n if (!(block as any).type) return false;\n return true;\n });\n return validatedContent.length > 0 ? (validatedContent as PartialBlock[]) : undefined;\n }\n return undefined;\n }, [processedContent]);\n\n const editor = useCreateBlockNote(\n useMemo(\n () => ({\n placeholders: {\n emptyDocument: placeholder || t(`generic.blocknote.placeholder`),\n },\n schema,\n initialContent: validatedInitialContent,\n uploadFile: uploadImage,\n }),\n [placeholder, t, schema, validatedInitialContent, uploadImage],\n ),\n );\n\n const handleChange = useCallback(async () => {\n if (!onChange) return;\n const newBlocks = editor.document;\n\n const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();\n\n function hasUnresolvedDiffsRecursive(block: any): boolean {\n if (!block || typeof block !== \"object\") return false;\n let diffId = undefined;\n if (block.props && block.props.diffId) diffId = block.props.diffId;\n if (!diffId && block.attrs && block.attrs.diffId) diffId = block.attrs.diffId;\n if (diffId && !acceptedChanges.has(diffId) && !rejectedChanges.has(diffId)) {\n return true;\n }\n\n if (block.content) {\n const contentArr = Array.isArray(block.content) ? block.content : [block.content];\n for (const inline of contentArr) {\n if (inline && typeof inline === \"object\") {\n if (inline.type === \"diffActions\" && inline.props && inline.props.diffIds) {\n const ids =\n typeof inline.props.diffIds === \"string\" ? inline.props.diffIds.split(\",\") : inline.props.diffIds;\n for (const id of ids) {\n const trimmed = (id || \"\").toString().trim();\n if (trimmed && !acceptedChanges.has(trimmed) && !rejectedChanges.has(trimmed)) {\n return true;\n }\n }\n }\n if (inline.props && inline.props.diffId) {\n const diffIdInline = inline.props.diffId;\n if (diffIdInline && !acceptedChanges.has(diffIdInline) && !rejectedChanges.has(diffIdInline)) {\n return true;\n }\n }\n if (inline.children && Array.isArray(inline.children)) {\n for (const child of inline.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n }\n }\n }\n if (Array.isArray(block.children)) {\n for (const child of block.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n return false;\n }\n\n let hasUnresolvedDiff = false;\n if (Array.isArray(newBlocks)) {\n hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));\n }\n\n onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);\n }, [editor, onChange, id, acceptedChanges, rejectedChanges]);\n\n // Utility: deep equality for arrays of blocks\n const areBlocksEqual = (a: any[], b: any[]): boolean => {\n return JSON.stringify(a) === JSON.stringify(b);\n };\n\n // Only initialize from markdownContent once per value, and only if different\n const hasInitializedFromMarkdown = useRef<string | null>(null);\n useEffect(() => {\n const updateContent = async (markdown: string) => {\n const blocks = await editor.tryParseMarkdownToBlocks(markdown);\n if (!areBlocksEqual(blocks, editor.document)) {\n editor.replaceBlocks(editor.document, blocks);\n }\n };\n\n if (markdownContent && hasInitializedFromMarkdown.current !== markdownContent) {\n hasInitializedFromMarkdown.current = markdownContent;\n updateContent(markdownContent).then(() => handleChange());\n }\n }, [markdownContent, editor]);\n\n // Update editor content when diff content changes, but only if different\n // Prevent unnecessary replaceBlocks calls that reset scroll/cursor.\n const previousContentHashRef = useRef<string | null>(null);\n useEffect(() => {\n if (!processedContent || !editor) return;\n const hash = JSON.stringify(processedContent);\n if (previousContentHashRef.current === hash) return; // no changes\n const currentHash = JSON.stringify(editor.document);\n if (currentHash === hash) {\n previousContentHashRef.current = hash;\n return; // already in sync\n }\n editor.replaceBlocks(editor.document, processedContent as PartialBlock[]);\n previousContentHashRef.current = hash;\n }, [processedContent, editor]);\n\n // Handle audio received from whisper transcription\n const handleAudioReceived = useCallback(\n (message: string) => {\n try {\n // Ensure the editor has focus\n const editorElement = editorRef.current?.querySelector('[contenteditable=\"true\"]') as HTMLElement;\n if (editorElement && document.activeElement !== editorElement) {\n editorElement.focus();\n }\n\n // Insert the transcribed text at the current cursor position\n editor.insertInlineContent(message);\n } catch (error) {\n console.error(\"Error inserting transcribed text:\", error);\n // Fallback: try to insert at the end of the document\n try {\n const blocks = editor.document;\n if (blocks.length > 0) {\n const lastBlock = blocks[blocks.length - 1];\n editor.setTextCursorPosition(lastBlock.id, \"end\");\n editor.insertInlineContent(message);\n }\n } catch (fallbackError) {\n console.error(\"Fallback insertion also failed:\", fallbackError);\n }\n }\n },\n [editor],\n );\n\n return (\n <div ref={editorRef} className={cn(bordered ? \"rounded-md border\" : \"\", \"w-full\")}>\n <BlockNoteView\n editor={editor}\n onChange={handleChange}\n editable={onChange !== undefined}\n formattingToolbar={false}\n theme=\"light\"\n className={cn(`BlockNoteView ${onChange ? \"min-h-96 p-4\" : \"\"}`, className, size === \"sm\" && \"small\")}\n >\n <BlockNoteEditorFormattingToolbar />\n </BlockNoteView>\n </div>\n );\n}\n","\"use client\";\n\nimport {\n BasicTextStyleButton,\n BlockTypeSelect,\n CreateLinkButton,\n FileCaptionButton,\n FileReplaceButton,\n FormattingToolbar,\n FormattingToolbarController,\n TextAlignButton,\n} from \"@blocknote/react\";\n\nexport function BlockNoteEditorFormattingToolbar() {\n return (\n <FormattingToolbarController\n formattingToolbar={() => (\n <FormattingToolbar>\n <BlockTypeSelect key={\"blockTypeSelect\"} />\n\n <FileCaptionButton key={\"fileCaptionButton\"} />\n <FileReplaceButton key={\"replaceFileButton\"} />\n\n <BasicTextStyleButton basicTextStyle={\"bold\"} key={\"boldStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"italic\"} key={\"italicStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"underline\"} key={\"underlineStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"strike\"} key={\"strikeStyleButton\"} />\n\n <TextAlignButton textAlignment={\"left\"} key={\"textAlignLeftButton\"} />\n <TextAlignButton textAlignment={\"center\"} key={\"textAlignCenterButton\"} />\n <TextAlignButton textAlignment={\"right\"} key={\"textAlignRightButton\"} />\n\n <CreateLinkButton key={\"createLinkButton\"} />\n </FormattingToolbar>\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,iBAAiB,iCAA+C;AACzE,SAAS,8BAA8B,0BAA0B;AACjE,SAAS,qBAAqB;AAC9B,OAAO;AACP,SAAS,WAAW,aAAa;AACjC,SAAS,uBAAuB;AAChC,SAAgB,aAAa,WAAW,SAAS,QAAQ,gBAAgB;;;ACNzE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMC,SACE,KADF;AAJD,SAAS,mCAAmC;AACjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,mBAAmB,MACjB,qBAAC,qBACC;AAAA,4BAAC,qBAAqB,iBAAmB;AAAA,QAEzC,oBAAC,uBAAuB,mBAAqB;AAAA,QAC7C,oBAAC,uBAAuB,mBAAqB;AAAA,QAE7C,oBAAC,wBAAqB,gBAAgB,UAAa,iBAAmB;AAAA,QACtE,oBAAC,wBAAqB,gBAAgB,YAAe,mBAAqB;AAAA,QAC1E,oBAAC,wBAAqB,gBAAgB,eAAkB,sBAAwB;AAAA,QAChF,oBAAC,wBAAqB,gBAAgB,YAAe,mBAAqB;AAAA,QAE1E,oBAAC,mBAAgB,eAAe,UAAa,qBAAuB;AAAA,QACpE,oBAAC,mBAAgB,eAAe,YAAe,uBAAyB;AAAA,QACxE,oBAAC,mBAAgB,eAAe,WAAc,sBAAwB;AAAA,QAEtE,oBAAC,sBAAsB,kBAAoB;AAAA,SAC7C;AAAA;AAAA,EAEJ;AAEJ;AAxBgB;;;ADqCN,SASI,OAAAA,MATJ,QAAAC,aAAA;AAnBV,IAA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