@carlonicora/nextjs-jsonapi 1.29.4 → 1.29.6

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 (56) hide show
  1. package/dist/{BlockNoteEditor-G532N3N7.mjs → BlockNoteEditor-4NQ5LSD6.mjs} +4 -4
  2. package/dist/{BlockNoteEditor-XWHUG6VH.js → BlockNoteEditor-AZNYW5Y7.js} +14 -14
  3. package/dist/{BlockNoteEditor-XWHUG6VH.js.map → BlockNoteEditor-AZNYW5Y7.js.map} +1 -1
  4. package/dist/billing/index.js +335 -335
  5. package/dist/billing/index.mjs +3 -3
  6. package/dist/{chunk-UYBCHXXL.js → chunk-5KQXRLK3.js} +25 -2
  7. package/dist/chunk-5KQXRLK3.js.map +1 -0
  8. package/dist/{chunk-GR4QPP36.mjs → chunk-C62JXXUX.mjs} +1 -1
  9. package/dist/{chunk-ALGMJ4JS.js → chunk-CWRYS2F3.js} +539 -530
  10. package/dist/chunk-CWRYS2F3.js.map +1 -0
  11. package/dist/{chunk-EW6QPMN3.js → chunk-OR5NPUWF.js} +1 -1
  12. package/dist/{chunk-EW6QPMN3.js.map → chunk-OR5NPUWF.js.map} +1 -1
  13. package/dist/{chunk-NYNLJEPF.mjs → chunk-WQ3KF6BG.mjs} +24 -1
  14. package/dist/chunk-WQ3KF6BG.mjs.map +1 -0
  15. package/dist/{chunk-CWY6AL4V.mjs → chunk-ZQEFAWFP.mjs} +91 -82
  16. package/dist/chunk-ZQEFAWFP.mjs.map +1 -0
  17. package/dist/client/index.js +4 -4
  18. package/dist/client/index.mjs +3 -3
  19. package/dist/components/index.js +4 -4
  20. package/dist/components/index.mjs +3 -3
  21. package/dist/contexts/index.js +4 -4
  22. package/dist/contexts/index.mjs +3 -3
  23. package/dist/core/index.d.mts +25 -2
  24. package/dist/core/index.d.ts +25 -2
  25. package/dist/core/index.js +10 -2
  26. package/dist/core/index.js.map +1 -1
  27. package/dist/core/index.mjs +9 -1
  28. package/dist/index.d.mts +2 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +11 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +10 -2
  33. package/dist/server/index.js +3 -3
  34. package/dist/server/index.mjs +1 -1
  35. package/package.json +1 -1
  36. package/src/components/errors/errorToast.ts +2 -4
  37. package/src/components/forms/CommonAssociationForm.tsx +3 -3
  38. package/src/components/forms/FileUploader.tsx +4 -4
  39. package/src/features/auth/components/forms/AcceptInvitation.tsx +2 -2
  40. package/src/features/auth/components/forms/ActivateAccount.tsx +2 -2
  41. package/src/features/auth/components/forms/ResetPassword.tsx +2 -2
  42. package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +2 -2
  43. package/src/features/notification/components/modals/NotificationModal.tsx +2 -2
  44. package/src/features/notification/contexts/NotificationContext.tsx +27 -1
  45. package/src/features/role/components/forms/UserRoleAdd.tsx +2 -2
  46. package/src/features/user/components/forms/UserResentInvitationEmail.tsx +2 -2
  47. package/src/index.ts +3 -0
  48. package/src/shadcnui/ui/sonner.tsx +13 -23
  49. package/src/utils/index.ts +3 -0
  50. package/src/utils/toast.ts +39 -0
  51. package/dist/chunk-ALGMJ4JS.js.map +0 -1
  52. package/dist/chunk-CWY6AL4V.mjs.map +0 -1
  53. package/dist/chunk-NYNLJEPF.mjs.map +0 -1
  54. package/dist/chunk-UYBCHXXL.js.map +0 -1
  55. /package/dist/{BlockNoteEditor-G532N3N7.mjs.map → BlockNoteEditor-4NQ5LSD6.mjs.map} +0 -0
  56. /package/dist/{chunk-GR4QPP36.mjs.map → chunk-C62JXXUX.mjs.map} +0 -0
@@ -7,11 +7,12 @@ import {
7
7
  isDiscordAuthEnabled,
8
8
  isInternalAuthEnabled,
9
9
  isRegistrationAllowed,
10
+ isRolesConfigured,
10
11
  useI18nDateFnsLocale,
11
12
  useI18nLocale,
12
13
  useI18nRouter,
13
14
  useI18nTranslations
14
- } from "./chunk-GR4QPP36.mjs";
15
+ } from "./chunk-C62JXXUX.mjs";
15
16
  import {
16
17
  AVAILABLE_OAUTH_SCOPES,
17
18
  AuthService,
@@ -34,9 +35,11 @@ import {
34
35
  getIconByModule,
35
36
  getTokenHandler,
36
37
  rehydrate,
38
+ showError,
39
+ showToast,
37
40
  useComposedRefs,
38
41
  useIsMobile
39
- } from "./chunk-NYNLJEPF.mjs";
42
+ } from "./chunk-WQ3KF6BG.mjs";
40
43
  import {
41
44
  JsonApiContext
42
45
  } from "./chunk-VOXD3ZLY.mjs";
@@ -868,7 +871,7 @@ function useCustomD3Graph(nodes, links, onNodeClick, visibleNodeIds, loadingNode
868
871
  __name(useCustomD3Graph, "useCustomD3Graph");
869
872
 
870
873
  // src/hooks/useNotificationSync.ts
871
- import { useEffect as useEffect22 } from "react";
874
+ import { useEffect as useEffect23 } from "react";
872
875
 
873
876
  // src/features/company/contexts/CompanyContext.tsx
874
877
  import { useTranslations as useTranslations32 } from "next-intl";
@@ -7157,7 +7160,6 @@ import { useWatch as useWatch2 } from "react-hook-form";
7157
7160
  // src/components/forms/CommonAssociationForm.tsx
7158
7161
  import { useTranslations as useTranslations5 } from "next-intl";
7159
7162
  import { useCallback as useCallback9, useEffect as useEffect11, useRef as useRef7, useState as useState10 } from "react";
7160
- import { toast } from "sonner";
7161
7163
  import { jsx as jsx54, jsxs as jsxs25 } from "react/jsx-runtime";
7162
7164
  function CommonAssociationTrigger({
7163
7165
  sourceType,
@@ -7229,7 +7231,7 @@ function CommonAssociationCommandDialog({
7229
7231
  __name(CommonAssociationCommandDialog, "CommonAssociationCommandDialog");
7230
7232
  var triggerAssociationToast = /* @__PURE__ */ __name((params) => {
7231
7233
  if (params.level) {
7232
- toast.message(
7234
+ showToast(
7233
7235
  params.t(`common.association.label`, {
7234
7236
  source: params.source,
7235
7237
  destination: params.destination
@@ -7245,7 +7247,7 @@ var triggerAssociationToast = /* @__PURE__ */ __name((params) => {
7245
7247
  }
7246
7248
  );
7247
7249
  } else {
7248
- toast.message(
7250
+ showToast(
7249
7251
  params.t(`common.association.label`, {
7250
7252
  source: params.source,
7251
7253
  destination: params.destination
@@ -7296,9 +7298,8 @@ function ErrorDetails({ title, message, code }) {
7296
7298
  __name(ErrorDetails, "ErrorDetails");
7297
7299
 
7298
7300
  // src/components/errors/errorToast.ts
7299
- import { toast as toast2 } from "sonner";
7300
7301
  function errorToast(params) {
7301
- toast2.error(params?.title ?? "Error", {
7302
+ showError(params?.title ?? "Error", {
7302
7303
  description: params.error instanceof Error ? params.error.message : String(params.error)
7303
7304
  });
7304
7305
  }
@@ -7680,7 +7681,6 @@ import {
7680
7681
  useState as useState14
7681
7682
  } from "react";
7682
7683
  import { useDropzone } from "react-dropzone";
7683
- import { toast as toast3 } from "sonner";
7684
7684
  import { jsx as jsx62, jsxs as jsxs32 } from "react/jsx-runtime";
7685
7685
  var FileUploaderContext = createContext8(null);
7686
7686
  var useFileUpload = /* @__PURE__ */ __name(() => {
@@ -7749,7 +7749,7 @@ var FileUploader = forwardRef4(
7749
7749
  (acceptedFiles, rejectedFiles) => {
7750
7750
  const files = acceptedFiles;
7751
7751
  if (!files) {
7752
- toast3.error(t("common.errors.file"), {
7752
+ showError(t("common.errors.file"), {
7753
7753
  description: t("common.errors.file_large")
7754
7754
  });
7755
7755
  return;
@@ -7767,13 +7767,13 @@ var FileUploader = forwardRef4(
7767
7767
  if (rejectedFiles.length > 0) {
7768
7768
  for (let i = 0; i < rejectedFiles.length; i++) {
7769
7769
  if (rejectedFiles[i].errors[0]?.code === "file-too-large") {
7770
- toast3.error(t("common.errors.file"), {
7770
+ showError(t("common.errors.file"), {
7771
7771
  description: t(`common.errors.file_max`, { size: maxSize / 1024 / 1024 })
7772
7772
  });
7773
7773
  break;
7774
7774
  }
7775
7775
  if (rejectedFiles[i].errors[0]?.message) {
7776
- toast3.error(t(`common.errors.file`), {
7776
+ showError(t(`common.errors.file`), {
7777
7777
  description: rejectedFiles[i].errors[0].message
7778
7778
  });
7779
7779
  break;
@@ -9008,7 +9008,6 @@ __name(UserReactivator, "UserReactivator");
9008
9008
  import { MailIcon } from "lucide-react";
9009
9009
  import { useTranslations as useTranslations13 } from "next-intl";
9010
9010
  import { useState as useState22 } from "react";
9011
- import { toast as toast4 } from "sonner";
9012
9011
  import { jsx as jsx79, jsxs as jsxs47 } from "react/jsx-runtime";
9013
9012
  function UserResentInvitationEmailInternal({ user }) {
9014
9013
  const [open, setOpen] = useState22(false);
@@ -9017,7 +9016,7 @@ function UserResentInvitationEmailInternal({ user }) {
9017
9016
  try {
9018
9017
  await UserService.sendInvitation({ userId: user.id, companyId: user.company.id });
9019
9018
  setOpen(false);
9020
- toast4.message(t(`user.resend_activation.email_sent`), {
9019
+ showToast(t(`user.resend_activation.email_sent`), {
9021
9020
  description: t(`user.resend_activation.email_sent_description`, { email: user.email })
9022
9021
  });
9023
9022
  } catch (error) {
@@ -9749,7 +9748,6 @@ import { Settings2Icon } from "lucide-react";
9749
9748
  import { useTranslations as useTranslations28 } from "next-intl";
9750
9749
  import { useEffect as useEffect19, useMemo as useMemo11, useState as useState25 } from "react";
9751
9750
  import { useForm as useForm2 } from "react-hook-form";
9752
- import { toast as toast5 } from "sonner";
9753
9751
  import z2 from "zod";
9754
9752
 
9755
9753
  // src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx
@@ -9856,7 +9854,7 @@ function CompanyConfigurationEditorInternal({ company }) {
9856
9854
  if (fullUser) {
9857
9855
  setUser(fullUser);
9858
9856
  }
9859
- toast5.message("Configurations Updated", {
9857
+ showToast("Configurations Updated", {
9860
9858
  description: `The system configurations have been updated successfully.`
9861
9859
  });
9862
9860
  close();
@@ -10233,7 +10231,7 @@ var useCompanyContext = /* @__PURE__ */ __name(() => {
10233
10231
 
10234
10232
  // src/features/notification/contexts/NotificationContext.tsx
10235
10233
  import { useTranslations as useTranslations34 } from "next-intl";
10236
- import { createContext as createContext11, useCallback as useCallback13, useContext as useContext12, useState as useState30 } from "react";
10234
+ import { createContext as createContext11, useCallback as useCallback13, useContext as useContext12, useEffect as useEffect22, useState as useState30 } from "react";
10237
10235
 
10238
10236
  // src/features/notification/components/notifications/Notification.tsx
10239
10237
  import { useTranslations as useTranslations33 } from "next-intl";
@@ -10307,6 +10305,8 @@ var NotificationContextProvider = /* @__PURE__ */ __name(({ children }) => {
10307
10305
  const [isLoading, setIsLoading] = useState30(false);
10308
10306
  const [error, setError] = useState30(null);
10309
10307
  const [lastLoaded, setLastLoaded] = useState30(0);
10308
+ const [hasInitiallyLoaded, setHasInitiallyLoaded] = useState30(false);
10309
+ const { currentUser } = useCurrentUserContext();
10310
10310
  const shouldRefresh = Date.now() - lastLoaded > 5 * 60 * 1e3;
10311
10311
  const addNotification = useCallback13((notification) => {
10312
10312
  setNotifications((prev) => {
@@ -10337,6 +10337,20 @@ var NotificationContextProvider = /* @__PURE__ */ __name(({ children }) => {
10337
10337
  setIsLoading(false);
10338
10338
  }
10339
10339
  }, []);
10340
+ useEffect22(() => {
10341
+ if (hasInitiallyLoaded || !currentUser) return;
10342
+ if (isRolesConfigured()) {
10343
+ const isAdmin = currentUser.roles?.some(
10344
+ (role) => role.id === getRoleId().Administrator
10345
+ );
10346
+ if (isAdmin) {
10347
+ setHasInitiallyLoaded(true);
10348
+ return;
10349
+ }
10350
+ }
10351
+ loadNotifications();
10352
+ setHasInitiallyLoaded(true);
10353
+ }, [currentUser, hasInitiallyLoaded, loadNotifications]);
10340
10354
  const markNotificationsAsRead = useCallback13(async (ids) => {
10341
10355
  setIsLoading(true);
10342
10356
  setError(null);
@@ -10520,7 +10534,7 @@ var recentPagesAtom = atomWithStorage2("recentPages", []);
10520
10534
  function useNotificationSync() {
10521
10535
  const { socketNotifications, clearSocketNotifications } = useSocketContext();
10522
10536
  const { addSocketNotifications } = useNotificationContext();
10523
- useEffect22(() => {
10537
+ useEffect23(() => {
10524
10538
  if (socketNotifications.length > 0) {
10525
10539
  try {
10526
10540
  addSocketNotifications(socketNotifications);
@@ -10536,12 +10550,12 @@ __name(useNotificationSync, "useNotificationSync");
10536
10550
  // src/hooks/usePageTracker.ts
10537
10551
  import { useAtom as useAtom2 } from "jotai";
10538
10552
  import { usePathname as usePathname2 } from "next/navigation";
10539
- import { useEffect as useEffect23 } from "react";
10553
+ import { useEffect as useEffect24 } from "react";
10540
10554
  var EXCLUDED_ROUTES = ["/", "/login", "/register", "/forgot-password", "/reset-password", "/activate"];
10541
10555
  function usePageTracker() {
10542
10556
  const pathname = usePathname2();
10543
10557
  const [_recentPages, setRecentPages] = useAtom2(recentPagesAtom);
10544
- useEffect23(() => {
10558
+ useEffect24(() => {
10545
10559
  if (!pathname) return;
10546
10560
  if (EXCLUDED_ROUTES.some((route) => pathname === route || pathname.endsWith(route))) {
10547
10561
  return;
@@ -10578,7 +10592,7 @@ function usePageTracker() {
10578
10592
  __name(usePageTracker, "usePageTracker");
10579
10593
 
10580
10594
  // src/hooks/usePushNotifications.ts
10581
- import { useEffect as useEffect24 } from "react";
10595
+ import { useEffect as useEffect25 } from "react";
10582
10596
  function urlBase64ToUint8Array(base64String) {
10583
10597
  const padding = "=".repeat((4 - base64String.length % 4) % 4);
10584
10598
  const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
@@ -10592,7 +10606,7 @@ function urlBase64ToUint8Array(base64String) {
10592
10606
  __name(urlBase64ToUint8Array, "urlBase64ToUint8Array");
10593
10607
  function usePushNotifications() {
10594
10608
  const { currentUser, hasRole } = useCurrentUserContext();
10595
- useEffect24(() => {
10609
+ useEffect25(() => {
10596
10610
  const register = /* @__PURE__ */ __name(async () => {
10597
10611
  if ("serviceWorker" in navigator && "PushManager" in window) {
10598
10612
  try {
@@ -10637,7 +10651,7 @@ function usePushNotifications() {
10637
10651
  __name(usePushNotifications, "usePushNotifications");
10638
10652
 
10639
10653
  // src/hooks/useSocket.ts
10640
- import { useEffect as useEffect25, useRef as useRef12, useState as useState32 } from "react";
10654
+ import { useEffect as useEffect26, useRef as useRef12, useState as useState32 } from "react";
10641
10655
  import io from "socket.io-client";
10642
10656
  function useSocket({ token }) {
10643
10657
  const _errorCount = useRef12(0);
@@ -10648,7 +10662,7 @@ function useSocket({ token }) {
10648
10662
  const [messages, setMessages] = useState32([]);
10649
10663
  const [socketNotifications, setSocketNotifications] = useState32([]);
10650
10664
  const socketRef = useRef12(null);
10651
- useEffect25(() => {
10665
+ useEffect26(() => {
10652
10666
  if (!token) return;
10653
10667
  const globalSocketKey = `__socket_${process.env.NEXT_PUBLIC_API_URL?.replace(/[^a-zA-Z0-9]/g, "_")}`;
10654
10668
  if (typeof window !== "undefined") {
@@ -10811,12 +10825,12 @@ function BreadcrumbNavigation({ items }) {
10811
10825
  __name(BreadcrumbNavigation, "BreadcrumbNavigation");
10812
10826
 
10813
10827
  // src/components/navigations/ContentTitle.tsx
10814
- import { useEffect as useEffect26, useState as useState34 } from "react";
10828
+ import { useEffect as useEffect27, useState as useState34 } from "react";
10815
10829
  import { jsx as jsx112, jsxs as jsxs63 } from "react/jsx-runtime";
10816
10830
  function ContentTitle({ module, type, element, functions, className }) {
10817
10831
  const [clientFunctions, setClientFunctions] = useState34(null);
10818
10832
  const [isClient, setIsClient] = useState34(false);
10819
- useEffect26(() => {
10833
+ useEffect27(() => {
10820
10834
  setIsClient(true);
10821
10835
  setClientFunctions(functions);
10822
10836
  }, [functions]);
@@ -10891,19 +10905,19 @@ __name(ModeToggleSwitch, "ModeToggleSwitch");
10891
10905
 
10892
10906
  // src/components/navigations/PageSection.tsx
10893
10907
  import { ChevronDownIcon as ChevronDownIcon5, ChevronRightIcon as ChevronRightIcon6 } from "lucide-react";
10894
- import { useEffect as useEffect27, useState as useState35 } from "react";
10908
+ import { useEffect as useEffect28, useState as useState35 } from "react";
10895
10909
  import { v4 as v43 } from "uuid";
10896
10910
  import { jsx as jsx115, jsxs as jsxs65 } from "react/jsx-runtime";
10897
10911
  function PageSection({ children, title, options, open, small, onToggle }) {
10898
10912
  const [isOpen, setIsOpen] = useState35(open ?? true);
10899
10913
  const [shouldRender, setShouldRender] = useState35(open ?? true);
10900
- useEffect27(() => {
10914
+ useEffect28(() => {
10901
10915
  if (onToggle) {
10902
10916
  onToggle(isOpen);
10903
10917
  }
10904
10918
  }, [isOpen]);
10905
10919
  const toggleOpen = /* @__PURE__ */ __name(() => setIsOpen(!isOpen), "toggleOpen");
10906
- useEffect27(() => {
10920
+ useEffect28(() => {
10907
10921
  if (isOpen) {
10908
10922
  setShouldRender(true);
10909
10923
  } else {
@@ -10977,7 +10991,7 @@ __name(PageContainer, "PageContainer");
10977
10991
  // src/components/containers/ReactMarkdownContainer.tsx
10978
10992
  import { ChevronDown as ChevronDown2, ChevronUp } from "lucide-react";
10979
10993
  import { useTranslations as useTranslations40 } from "next-intl";
10980
- import { useEffect as useEffect28, useRef as useRef13, useState as useState36 } from "react";
10994
+ import { useEffect as useEffect29, useRef as useRef13, useState as useState36 } from "react";
10981
10995
  import ReactMarkdown from "react-markdown";
10982
10996
  import remarkGfm from "remark-gfm";
10983
10997
  import { jsx as jsx118, jsxs as jsxs68 } from "react/jsx-runtime";
@@ -10991,7 +11005,7 @@ function ReactMarkdownContainer({
10991
11005
  const [isExpanded, setIsExpanded] = useState36(false);
10992
11006
  const [showExpandButton, setShowExpandButton] = useState36(false);
10993
11007
  const contentRef = useRef13(null);
10994
- useEffect28(() => {
11008
+ useEffect29(() => {
10995
11009
  if (collapsible && contentRef.current && !isExpanded) {
10996
11010
  const isOverflowing = contentRef.current.scrollHeight > contentRef.current.clientHeight;
10997
11011
  setShowExpandButton(isOverflowing);
@@ -11129,7 +11143,7 @@ __name(AllowedUsersDetails, "AllowedUsersDetails");
11129
11143
  import dynamic from "next/dynamic";
11130
11144
  import React15 from "react";
11131
11145
  import { jsx as jsx122 } from "react/jsx-runtime";
11132
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-G532N3N7.mjs"), {
11146
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-4NQ5LSD6.mjs"), {
11133
11147
  ssr: false
11134
11148
  });
11135
11149
  var BlockNoteEditorContainer = React15.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11137,13 +11151,13 @@ var BlockNoteEditorContainer = React15.memo(/* @__PURE__ */ __name(function Edit
11137
11151
  }, "EditorContainer"));
11138
11152
 
11139
11153
  // src/components/pages/PageContainerContentDetails.tsx
11140
- import { useEffect as useEffect29, useRef as useRef14, useState as useState37 } from "react";
11154
+ import { useEffect as useEffect30, useRef as useRef14, useState as useState37 } from "react";
11141
11155
  import { jsx as jsx123, jsxs as jsxs72 } from "react/jsx-runtime";
11142
11156
  function PageContainerContentDetails({ items, section, module, id }) {
11143
11157
  const rewriteUrl = useUrlRewriter();
11144
11158
  const [isScrolled, setIsScrolled] = useState37(false);
11145
11159
  const sentinelRef = useRef14(null);
11146
- useEffect29(() => {
11160
+ useEffect30(() => {
11147
11161
  const sentinel = sentinelRef.current;
11148
11162
  if (!sentinel) return;
11149
11163
  const observer = new IntersectionObserver(
@@ -11176,12 +11190,12 @@ function PageContainerContentDetails({ items, section, module, id }) {
11176
11190
  __name(PageContainerContentDetails, "PageContainerContentDetails");
11177
11191
 
11178
11192
  // src/components/pages/PageContentContainer.tsx
11179
- import { useEffect as useEffect30, useState as useState38 } from "react";
11193
+ import { useEffect as useEffect31, useState as useState38 } from "react";
11180
11194
  import { jsx as jsx124, jsxs as jsxs73 } from "react/jsx-runtime";
11181
11195
  function PageContentContainer({ header, details, footer, content }) {
11182
11196
  const [mounted, setMounted] = useState38(false);
11183
11197
  const isMobile = useIsMobile();
11184
- useEffect30(() => {
11198
+ useEffect31(() => {
11185
11199
  setMounted(true);
11186
11200
  }, []);
11187
11201
  const isReady = mounted && isMobile !== void 0;
@@ -11294,10 +11308,10 @@ var cellUrl = /* @__PURE__ */ __name((params) => {
11294
11308
  }, "cellUrl");
11295
11309
 
11296
11310
  // src/client/context/JsonApiProvider.tsx
11297
- import { useEffect as useEffect31, useMemo as useMemo12 } from "react";
11311
+ import { useEffect as useEffect32, useMemo as useMemo12 } from "react";
11298
11312
  import { jsx as jsx129 } from "react/jsx-runtime";
11299
11313
  function JsonApiProvider({ config, children }) {
11300
- useEffect31(() => {
11314
+ useEffect32(() => {
11301
11315
  if (config.bootstrapper) {
11302
11316
  config.bootstrapper();
11303
11317
  }
@@ -11308,7 +11322,7 @@ function JsonApiProvider({ config, children }) {
11308
11322
  __name(JsonApiProvider, "JsonApiProvider");
11309
11323
 
11310
11324
  // src/client/hooks/useJsonApiGet.ts
11311
- import { useState as useState39, useEffect as useEffect32, useCallback as useCallback14, useRef as useRef15 } from "react";
11325
+ import { useState as useState39, useEffect as useEffect33, useCallback as useCallback14, useRef as useRef15 } from "react";
11312
11326
  function useJsonApiGet(params) {
11313
11327
  const [data, setData] = useState39(null);
11314
11328
  const [loading, setLoading] = useState39(false);
@@ -11386,7 +11400,7 @@ function useJsonApiGet(params) {
11386
11400
  }
11387
11401
  }
11388
11402
  }, [response]);
11389
- useEffect32(() => {
11403
+ useEffect33(() => {
11390
11404
  isMounted.current = true;
11391
11405
  fetchData();
11392
11406
  return () => {
@@ -11689,7 +11703,7 @@ var useRoleTableStructure = /* @__PURE__ */ __name((params) => {
11689
11703
  }, "useRoleTableStructure");
11690
11704
 
11691
11705
  // src/features/user/hooks/useUserSearch.ts
11692
- import { useCallback as useCallback16, useEffect as useEffect33, useRef as useRef16, useState as useState41 } from "react";
11706
+ import { useCallback as useCallback16, useEffect as useEffect34, useRef as useRef16, useState as useState41 } from "react";
11693
11707
  var useUserSearch = /* @__PURE__ */ __name(() => {
11694
11708
  const [users, setUsers] = useState41([]);
11695
11709
  const [searchQuery, setSearchQuery] = useState41("");
@@ -11712,7 +11726,7 @@ var useUserSearch = /* @__PURE__ */ __name(() => {
11712
11726
  [users.length]
11713
11727
  );
11714
11728
  const debouncedLoadUsers = useDebounce(loadUsers, 500);
11715
- useEffect33(() => {
11729
+ useEffect34(() => {
11716
11730
  if (searchQuery !== searchQueryRef.current) {
11717
11731
  setIsLoading(true);
11718
11732
  debouncedLoadUsers(searchQuery);
@@ -11937,7 +11951,7 @@ var useContentTableStructure = /* @__PURE__ */ __name((params) => {
11937
11951
 
11938
11952
  // src/features/oauth/hooks/useOAuthClients.ts
11939
11953
  import { useAtom as useAtom3, useSetAtom } from "jotai";
11940
- import { useCallback as useCallback17, useEffect as useEffect34 } from "react";
11954
+ import { useCallback as useCallback17, useEffect as useEffect35 } from "react";
11941
11955
 
11942
11956
  // src/features/oauth/atoms/oauth.atoms.ts
11943
11957
  import { atom } from "jotai";
@@ -12012,7 +12026,7 @@ function useOAuthClients() {
12012
12026
  setIsLoading(false);
12013
12027
  }
12014
12028
  }, [setClients, setIsLoading, setError]);
12015
- useEffect34(() => {
12029
+ useEffect35(() => {
12016
12030
  fetchClients();
12017
12031
  }, [fetchClients]);
12018
12032
  const createClient = useCallback17(
@@ -12052,7 +12066,7 @@ __name(useOAuthClients, "useOAuthClients");
12052
12066
 
12053
12067
  // src/features/oauth/hooks/useOAuthClient.ts
12054
12068
  import { useAtomValue as useAtomValue2, useSetAtom as useSetAtom2 } from "jotai";
12055
- import { useCallback as useCallback18, useEffect as useEffect35, useState as useState42 } from "react";
12069
+ import { useCallback as useCallback18, useEffect as useEffect36, useState as useState42 } from "react";
12056
12070
  function useOAuthClient(clientId) {
12057
12071
  const storedClient = useAtomValue2(oauthClientByIdAtom(clientId));
12058
12072
  const updateClientInStore = useSetAtom2(updateOAuthClientAtom);
@@ -12076,7 +12090,7 @@ function useOAuthClient(clientId) {
12076
12090
  setIsLoading(false);
12077
12091
  }
12078
12092
  }, [clientId]);
12079
- useEffect35(() => {
12093
+ useEffect36(() => {
12080
12094
  if (!storedClient && clientId) {
12081
12095
  fetchClient();
12082
12096
  }
@@ -12150,13 +12164,13 @@ function useOAuthClient(clientId) {
12150
12164
  __name(useOAuthClient, "useOAuthClient");
12151
12165
 
12152
12166
  // src/features/oauth/hooks/useOAuthConsent.ts
12153
- import { useCallback as useCallback19, useEffect as useEffect36, useState as useState43 } from "react";
12167
+ import { useCallback as useCallback19, useEffect as useEffect37, useState as useState43 } from "react";
12154
12168
  function useOAuthConsent(params) {
12155
12169
  const [clientInfo, setClientInfo] = useState43(null);
12156
12170
  const [isLoading, setIsLoading] = useState43(true);
12157
12171
  const [error, setError] = useState43(null);
12158
12172
  const [isSubmitting, setIsSubmitting] = useState43(false);
12159
- useEffect36(() => {
12173
+ useEffect37(() => {
12160
12174
  const fetchInfo = /* @__PURE__ */ __name(async () => {
12161
12175
  if (!params.clientId || !params.redirectUri || !params.scope) {
12162
12176
  setError(new Error("Missing required authorization parameters"));
@@ -12236,7 +12250,7 @@ import { memo, useMemo as useMemo19 } from "react";
12236
12250
  // src/components/tables/ContentTableSearch.tsx
12237
12251
  import { RefreshCw, Search, X } from "lucide-react";
12238
12252
  import { useTranslations as useTranslations46 } from "next-intl";
12239
- import { useCallback as useCallback20, useEffect as useEffect37, useRef as useRef17, useState as useState44 } from "react";
12253
+ import { useCallback as useCallback20, useEffect as useEffect38, useRef as useRef17, useState as useState44 } from "react";
12240
12254
  import { jsx as jsx134, jsxs as jsxs76 } from "react/jsx-runtime";
12241
12255
  function ContentTableSearch({ data }) {
12242
12256
  const t = useTranslations46();
@@ -12259,7 +12273,7 @@ function ContentTableSearch({ data }) {
12259
12273
  [searchTermRef, data]
12260
12274
  );
12261
12275
  const updateSearchTerm = useDebounce(search, 500);
12262
- useEffect37(() => {
12276
+ useEffect38(() => {
12263
12277
  setIsSearching(true);
12264
12278
  updateSearchTerm(searchTerm);
12265
12279
  }, [updateSearchTerm, searchTerm]);
@@ -12643,9 +12657,8 @@ __name(LandingComponent, "LandingComponent");
12643
12657
  import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
12644
12658
  import { useTranslations as useTranslations49 } from "next-intl";
12645
12659
  import Image10 from "next/image";
12646
- import { useEffect as useEffect38, useState as useState47 } from "react";
12660
+ import { useEffect as useEffect39, useState as useState47 } from "react";
12647
12661
  import { useForm as useForm5 } from "react-hook-form";
12648
- import { toast as toast6 } from "sonner";
12649
12662
  import { z as z5 } from "zod";
12650
12663
  import { Fragment as Fragment21, jsx as jsx140, jsxs as jsxs80 } from "react/jsx-runtime";
12651
12664
  function AcceptInvitation() {
@@ -12653,7 +12666,7 @@ function AcceptInvitation() {
12653
12666
  const [showConfirmation, setShowConfirmation] = useState47(false);
12654
12667
  const [error, setError] = useState47(void 0);
12655
12668
  const t = useTranslations49();
12656
- useEffect38(() => {
12669
+ useEffect39(() => {
12657
12670
  async function validateCode(code) {
12658
12671
  try {
12659
12672
  const payload = {
@@ -12699,7 +12712,7 @@ function AcceptInvitation() {
12699
12712
  };
12700
12713
  await AuthService.acceptInvitation(payload);
12701
12714
  setShowConfirmation(true);
12702
- toast6.success(t("auth.account_activated"), {
12715
+ showToast(t("auth.account_activated"), {
12703
12716
  description: t("auth.account_activated_description")
12704
12717
  });
12705
12718
  setTimeout(() => {
@@ -12746,15 +12759,14 @@ __name(AcceptInvitation, "AcceptInvitation");
12746
12759
  // src/features/auth/components/forms/ActivateAccount.tsx
12747
12760
  import { useTranslations as useTranslations50 } from "next-intl";
12748
12761
  import Image11 from "next/image";
12749
- import { useEffect as useEffect39, useState as useState48 } from "react";
12750
- import { toast as toast7 } from "sonner";
12762
+ import { useEffect as useEffect40, useState as useState48 } from "react";
12751
12763
  import { Fragment as Fragment22, jsx as jsx141, jsxs as jsxs81 } from "react/jsx-runtime";
12752
12764
  function ActivateAccount() {
12753
12765
  const { setComponentType, params, setParams } = useAuthContext();
12754
12766
  const [showConfirmation, setShowConfirmation] = useState48(false);
12755
12767
  const [error, setError] = useState48(void 0);
12756
12768
  const t = useTranslations50();
12757
- useEffect39(() => {
12769
+ useEffect40(() => {
12758
12770
  async function ActivateAccount2(code) {
12759
12771
  try {
12760
12772
  const payload = {
@@ -12763,7 +12775,7 @@ function ActivateAccount() {
12763
12775
  await AuthService.activate(payload);
12764
12776
  setShowConfirmation(true);
12765
12777
  setParams(void 0);
12766
- toast7.success(t("auth.account_activated"), {
12778
+ showToast(t("auth.account_activated"), {
12767
12779
  description: t("auth.account_activated_description")
12768
12780
  });
12769
12781
  setTimeout(() => {
@@ -12795,12 +12807,12 @@ function ActivateAccount() {
12795
12807
  __name(ActivateAccount, "ActivateAccount");
12796
12808
 
12797
12809
  // src/features/auth/components/forms/Cookies.tsx
12798
- import { useEffect as useEffect40, useState as useState49 } from "react";
12810
+ import { useEffect as useEffect41, useState as useState49 } from "react";
12799
12811
  function Cookies({ dehydratedAuth, page }) {
12800
12812
  const { setUser } = useCurrentUserContext();
12801
12813
  const router = useI18nRouter();
12802
12814
  const [hasSaved, setHasSaved] = useState49(false);
12803
- useEffect40(() => {
12815
+ useEffect41(() => {
12804
12816
  if (hasSaved) return;
12805
12817
  async function saveTokenOnServer() {
12806
12818
  await AuthService.saveToken({ dehydratedAuth });
@@ -12994,11 +13006,11 @@ function Login() {
12994
13006
  __name(Login, "Login");
12995
13007
 
12996
13008
  // src/features/auth/components/forms/Logout.tsx
12997
- import { useEffect as useEffect41 } from "react";
13009
+ import { useEffect as useEffect42 } from "react";
12998
13010
  import { Fragment as Fragment25, jsx as jsx144 } from "react/jsx-runtime";
12999
13011
  function Logout() {
13000
13012
  const generateUrl = usePageUrlGenerator();
13001
- useEffect41(() => {
13013
+ useEffect42(() => {
13002
13014
  const logOut = /* @__PURE__ */ __name(async () => {
13003
13015
  await AuthService.logout();
13004
13016
  window.location.href = generateUrl({ page: `/` });
@@ -13011,7 +13023,7 @@ __name(Logout, "Logout");
13011
13023
 
13012
13024
  // src/features/auth/components/forms/RefreshUser.tsx
13013
13025
  import { deleteCookie, getCookie as getCookie2 } from "cookies-next";
13014
- import { useEffect as useEffect42 } from "react";
13026
+ import { useEffect as useEffect43 } from "react";
13015
13027
  function RefreshUser() {
13016
13028
  const { setUser } = useCurrentUserContext();
13017
13029
  const loadFullUser = /* @__PURE__ */ __name(async () => {
@@ -13031,7 +13043,7 @@ function RefreshUser() {
13031
13043
  deleteCookie("reloadData");
13032
13044
  }
13033
13045
  }, "loadFullUser");
13034
- useEffect42(() => {
13046
+ useEffect43(() => {
13035
13047
  const reloadData = getCookie2("reloadData");
13036
13048
  if (reloadData !== void 0) loadFullUser();
13037
13049
  }, []);
@@ -13043,9 +13055,8 @@ __name(RefreshUser, "RefreshUser");
13043
13055
  import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
13044
13056
  import { useTranslations as useTranslations53 } from "next-intl";
13045
13057
  import Image14 from "next/image";
13046
- import { useEffect as useEffect43, useState as useState51 } from "react";
13058
+ import { useEffect as useEffect44, useState as useState51 } from "react";
13047
13059
  import { useForm as useForm8 } from "react-hook-form";
13048
- import { toast as toast8 } from "sonner";
13049
13060
  import { z as z8 } from "zod";
13050
13061
  import { Fragment as Fragment26, jsx as jsx145, jsxs as jsxs84 } from "react/jsx-runtime";
13051
13062
  function ResetPassword() {
@@ -13053,7 +13064,7 @@ function ResetPassword() {
13053
13064
  const [showConfirmation, setShowConfirmation] = useState51(false);
13054
13065
  const [error, setError] = useState51(void 0);
13055
13066
  const t = useTranslations53();
13056
- useEffect43(() => {
13067
+ useEffect44(() => {
13057
13068
  async function validateResetPasswordCode(code) {
13058
13069
  try {
13059
13070
  const payload = {
@@ -13099,7 +13110,7 @@ function ResetPassword() {
13099
13110
  };
13100
13111
  await AuthService.resetPassword(payload);
13101
13112
  setShowConfirmation(true);
13102
- toast8.success(t(`auth.reset_success`), {
13113
+ showToast(t(`auth.reset_success`), {
13103
13114
  description: t(`auth.reset_success_description`)
13104
13115
  });
13105
13116
  setTimeout(() => {
@@ -13335,8 +13346,7 @@ __name(NotificationsListContainer, "NotificationsListContainer");
13335
13346
  // src/features/notification/components/modals/NotificationModal.tsx
13336
13347
  import { BellIcon } from "lucide-react";
13337
13348
  import { useTranslations as useTranslations59 } from "next-intl";
13338
- import { Fragment as Fragment28, useCallback as useCallback21, useEffect as useEffect44, useMemo as useMemo21, useRef as useRef18, useState as useState52 } from "react";
13339
- import { toast as toast9 } from "sonner";
13349
+ import { Fragment as Fragment28, useCallback as useCallback21, useEffect as useEffect45, useMemo as useMemo21, useRef as useRef18, useState as useState52 } from "react";
13340
13350
  import { jsx as jsx152, jsxs as jsxs89 } from "react/jsx-runtime";
13341
13351
  function NotificationModalContent({ isOpen, setIsOpen }) {
13342
13352
  const instanceId = useRef18(Math.random().toString(36).substr(2, 9));
@@ -13384,10 +13394,10 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13384
13394
  unreadIds: unreadNotifications2.map((notif) => notif.id)
13385
13395
  };
13386
13396
  }, [notifications]);
13387
- useEffect44(() => {
13397
+ useEffect45(() => {
13388
13398
  setNewNotifications(unreadCount > 0);
13389
13399
  }, [unreadCount]);
13390
- useEffect44(() => {
13400
+ useEffect45(() => {
13391
13401
  if (lastLoaded === 0) loadNotifications();
13392
13402
  }, [lastLoaded, loadNotifications]);
13393
13403
  const processSocketNotificationsRef = useRef18(null);
@@ -13411,7 +13421,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13411
13421
  batch.forEach((notification) => {
13412
13422
  addNotification(notification);
13413
13423
  const toastNotification = generateToastNotification(notification, t, generateUrl);
13414
- toast9.message(toastNotification.title, {
13424
+ showToast(toastNotification.title, {
13415
13425
  description: toastNotification.description,
13416
13426
  action: toastNotification.action
13417
13427
  });
@@ -13430,7 +13440,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13430
13440
  generateUrl,
13431
13441
  checkCircuitBreaker
13432
13442
  ]);
13433
- useEffect44(() => {
13443
+ useEffect45(() => {
13434
13444
  if (processSocketNotificationsRef.current) {
13435
13445
  clearTimeout(processSocketNotificationsRef.current);
13436
13446
  }
@@ -13564,13 +13574,13 @@ __name(FormRoles, "FormRoles");
13564
13574
 
13565
13575
  // src/features/role/components/forms/RemoveUserFromRole.tsx
13566
13576
  import { useTranslations as useTranslations62 } from "next-intl";
13567
- import { useEffect as useEffect45, useState as useState53 } from "react";
13577
+ import { useEffect as useEffect46, useState as useState53 } from "react";
13568
13578
  import { Fragment as Fragment31, jsx as jsx157, jsxs as jsxs92 } from "react/jsx-runtime";
13569
13579
  function RemoveUserFromRole({ role, user, refresh }) {
13570
13580
  const [open, setOpen] = useState53(false);
13571
13581
  const [canRemove, setCanRemove] = useState53(false);
13572
13582
  const t = useTranslations62();
13573
- useEffect45(() => {
13583
+ useEffect46(() => {
13574
13584
  async function checkCompanyAdminDeletability() {
13575
13585
  const roleUsers = await UserService.findAllUsersByRole({
13576
13586
  roleId: role.id
@@ -13640,8 +13650,7 @@ __name(RemoveUserFromRole, "RemoveUserFromRole");
13640
13650
  // src/features/role/components/forms/UserRoleAdd.tsx
13641
13651
  import { PlusCircle as PlusCircle2 } from "lucide-react";
13642
13652
  import { useTranslations as useTranslations63 } from "next-intl";
13643
- import { useCallback as useCallback22, useEffect as useEffect46, useRef as useRef19, useState as useState54 } from "react";
13644
- import { toast as toast10 } from "sonner";
13653
+ import { useCallback as useCallback22, useEffect as useEffect47, useRef as useRef19, useState as useState54 } from "react";
13645
13654
  import { Fragment as Fragment32, jsx as jsx158, jsxs as jsxs93 } from "react/jsx-runtime";
13646
13655
  function UserRoleAdd({ user, refresh }) {
13647
13656
  const [open, setOpen] = useState54(false);
@@ -13655,7 +13664,7 @@ function UserRoleAdd({ user, refresh }) {
13655
13664
  userId: user.id
13656
13665
  });
13657
13666
  setRoles(roles.filter((u) => u.id !== role.id));
13658
- toast10.message(
13667
+ showToast(
13659
13668
  t(`common.association.label`, {
13660
13669
  source: t(`entities.roles`, { count: 1 }),
13661
13670
  destination: t(`entities.users`, { count: 1 })
@@ -13683,10 +13692,10 @@ function UserRoleAdd({ user, refresh }) {
13683
13692
  [searchTerm, user]
13684
13693
  );
13685
13694
  const updateSearchTerm = useDebounce(searchRoles, 500);
13686
- useEffect46(() => {
13695
+ useEffect47(() => {
13687
13696
  if (open) updateSearchTerm(searchTerm);
13688
13697
  }, [open, searchTerm]);
13689
- useEffect46(() => {
13698
+ useEffect47(() => {
13690
13699
  if (open) searchRoles("");
13691
13700
  }, [open]);
13692
13701
  return /* @__PURE__ */ jsxs93(Fragment32, { children: [
@@ -15084,4 +15093,4 @@ export {
15084
15093
  useOAuthClients,
15085
15094
  useOAuthClient
15086
15095
  };
15087
- //# sourceMappingURL=chunk-CWY6AL4V.mjs.map
15096
+ //# sourceMappingURL=chunk-ZQEFAWFP.mjs.map