@carlonicora/nextjs-jsonapi 1.29.4 → 1.29.5

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.
@@ -7,6 +7,7 @@ import {
7
7
  isDiscordAuthEnabled,
8
8
  isInternalAuthEnabled,
9
9
  isRegistrationAllowed,
10
+ isRolesConfigured,
10
11
  useI18nDateFnsLocale,
11
12
  useI18nLocale,
12
13
  useI18nRouter,
@@ -868,7 +869,7 @@ function useCustomD3Graph(nodes, links, onNodeClick, visibleNodeIds, loadingNode
868
869
  __name(useCustomD3Graph, "useCustomD3Graph");
869
870
 
870
871
  // src/hooks/useNotificationSync.ts
871
- import { useEffect as useEffect22 } from "react";
872
+ import { useEffect as useEffect23 } from "react";
872
873
 
873
874
  // src/features/company/contexts/CompanyContext.tsx
874
875
  import { useTranslations as useTranslations32 } from "next-intl";
@@ -10233,7 +10234,7 @@ var useCompanyContext = /* @__PURE__ */ __name(() => {
10233
10234
 
10234
10235
  // src/features/notification/contexts/NotificationContext.tsx
10235
10236
  import { useTranslations as useTranslations34 } from "next-intl";
10236
- import { createContext as createContext11, useCallback as useCallback13, useContext as useContext12, useState as useState30 } from "react";
10237
+ import { createContext as createContext11, useCallback as useCallback13, useContext as useContext12, useEffect as useEffect22, useState as useState30 } from "react";
10237
10238
 
10238
10239
  // src/features/notification/components/notifications/Notification.tsx
10239
10240
  import { useTranslations as useTranslations33 } from "next-intl";
@@ -10307,6 +10308,8 @@ var NotificationContextProvider = /* @__PURE__ */ __name(({ children }) => {
10307
10308
  const [isLoading, setIsLoading] = useState30(false);
10308
10309
  const [error, setError] = useState30(null);
10309
10310
  const [lastLoaded, setLastLoaded] = useState30(0);
10311
+ const [hasInitiallyLoaded, setHasInitiallyLoaded] = useState30(false);
10312
+ const { currentUser } = useCurrentUserContext();
10310
10313
  const shouldRefresh = Date.now() - lastLoaded > 5 * 60 * 1e3;
10311
10314
  const addNotification = useCallback13((notification) => {
10312
10315
  setNotifications((prev) => {
@@ -10337,6 +10340,20 @@ var NotificationContextProvider = /* @__PURE__ */ __name(({ children }) => {
10337
10340
  setIsLoading(false);
10338
10341
  }
10339
10342
  }, []);
10343
+ useEffect22(() => {
10344
+ if (hasInitiallyLoaded || !currentUser) return;
10345
+ if (isRolesConfigured()) {
10346
+ const isAdmin = currentUser.roles?.some(
10347
+ (role) => role.id === getRoleId().Administrator
10348
+ );
10349
+ if (isAdmin) {
10350
+ setHasInitiallyLoaded(true);
10351
+ return;
10352
+ }
10353
+ }
10354
+ loadNotifications();
10355
+ setHasInitiallyLoaded(true);
10356
+ }, [currentUser, hasInitiallyLoaded, loadNotifications]);
10340
10357
  const markNotificationsAsRead = useCallback13(async (ids) => {
10341
10358
  setIsLoading(true);
10342
10359
  setError(null);
@@ -10520,7 +10537,7 @@ var recentPagesAtom = atomWithStorage2("recentPages", []);
10520
10537
  function useNotificationSync() {
10521
10538
  const { socketNotifications, clearSocketNotifications } = useSocketContext();
10522
10539
  const { addSocketNotifications } = useNotificationContext();
10523
- useEffect22(() => {
10540
+ useEffect23(() => {
10524
10541
  if (socketNotifications.length > 0) {
10525
10542
  try {
10526
10543
  addSocketNotifications(socketNotifications);
@@ -10536,12 +10553,12 @@ __name(useNotificationSync, "useNotificationSync");
10536
10553
  // src/hooks/usePageTracker.ts
10537
10554
  import { useAtom as useAtom2 } from "jotai";
10538
10555
  import { usePathname as usePathname2 } from "next/navigation";
10539
- import { useEffect as useEffect23 } from "react";
10556
+ import { useEffect as useEffect24 } from "react";
10540
10557
  var EXCLUDED_ROUTES = ["/", "/login", "/register", "/forgot-password", "/reset-password", "/activate"];
10541
10558
  function usePageTracker() {
10542
10559
  const pathname = usePathname2();
10543
10560
  const [_recentPages, setRecentPages] = useAtom2(recentPagesAtom);
10544
- useEffect23(() => {
10561
+ useEffect24(() => {
10545
10562
  if (!pathname) return;
10546
10563
  if (EXCLUDED_ROUTES.some((route) => pathname === route || pathname.endsWith(route))) {
10547
10564
  return;
@@ -10578,7 +10595,7 @@ function usePageTracker() {
10578
10595
  __name(usePageTracker, "usePageTracker");
10579
10596
 
10580
10597
  // src/hooks/usePushNotifications.ts
10581
- import { useEffect as useEffect24 } from "react";
10598
+ import { useEffect as useEffect25 } from "react";
10582
10599
  function urlBase64ToUint8Array(base64String) {
10583
10600
  const padding = "=".repeat((4 - base64String.length % 4) % 4);
10584
10601
  const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
@@ -10592,7 +10609,7 @@ function urlBase64ToUint8Array(base64String) {
10592
10609
  __name(urlBase64ToUint8Array, "urlBase64ToUint8Array");
10593
10610
  function usePushNotifications() {
10594
10611
  const { currentUser, hasRole } = useCurrentUserContext();
10595
- useEffect24(() => {
10612
+ useEffect25(() => {
10596
10613
  const register = /* @__PURE__ */ __name(async () => {
10597
10614
  if ("serviceWorker" in navigator && "PushManager" in window) {
10598
10615
  try {
@@ -10637,7 +10654,7 @@ function usePushNotifications() {
10637
10654
  __name(usePushNotifications, "usePushNotifications");
10638
10655
 
10639
10656
  // src/hooks/useSocket.ts
10640
- import { useEffect as useEffect25, useRef as useRef12, useState as useState32 } from "react";
10657
+ import { useEffect as useEffect26, useRef as useRef12, useState as useState32 } from "react";
10641
10658
  import io from "socket.io-client";
10642
10659
  function useSocket({ token }) {
10643
10660
  const _errorCount = useRef12(0);
@@ -10648,7 +10665,7 @@ function useSocket({ token }) {
10648
10665
  const [messages, setMessages] = useState32([]);
10649
10666
  const [socketNotifications, setSocketNotifications] = useState32([]);
10650
10667
  const socketRef = useRef12(null);
10651
- useEffect25(() => {
10668
+ useEffect26(() => {
10652
10669
  if (!token) return;
10653
10670
  const globalSocketKey = `__socket_${process.env.NEXT_PUBLIC_API_URL?.replace(/[^a-zA-Z0-9]/g, "_")}`;
10654
10671
  if (typeof window !== "undefined") {
@@ -10811,12 +10828,12 @@ function BreadcrumbNavigation({ items }) {
10811
10828
  __name(BreadcrumbNavigation, "BreadcrumbNavigation");
10812
10829
 
10813
10830
  // src/components/navigations/ContentTitle.tsx
10814
- import { useEffect as useEffect26, useState as useState34 } from "react";
10831
+ import { useEffect as useEffect27, useState as useState34 } from "react";
10815
10832
  import { jsx as jsx112, jsxs as jsxs63 } from "react/jsx-runtime";
10816
10833
  function ContentTitle({ module, type, element, functions, className }) {
10817
10834
  const [clientFunctions, setClientFunctions] = useState34(null);
10818
10835
  const [isClient, setIsClient] = useState34(false);
10819
- useEffect26(() => {
10836
+ useEffect27(() => {
10820
10837
  setIsClient(true);
10821
10838
  setClientFunctions(functions);
10822
10839
  }, [functions]);
@@ -10891,19 +10908,19 @@ __name(ModeToggleSwitch, "ModeToggleSwitch");
10891
10908
 
10892
10909
  // src/components/navigations/PageSection.tsx
10893
10910
  import { ChevronDownIcon as ChevronDownIcon5, ChevronRightIcon as ChevronRightIcon6 } from "lucide-react";
10894
- import { useEffect as useEffect27, useState as useState35 } from "react";
10911
+ import { useEffect as useEffect28, useState as useState35 } from "react";
10895
10912
  import { v4 as v43 } from "uuid";
10896
10913
  import { jsx as jsx115, jsxs as jsxs65 } from "react/jsx-runtime";
10897
10914
  function PageSection({ children, title, options, open, small, onToggle }) {
10898
10915
  const [isOpen, setIsOpen] = useState35(open ?? true);
10899
10916
  const [shouldRender, setShouldRender] = useState35(open ?? true);
10900
- useEffect27(() => {
10917
+ useEffect28(() => {
10901
10918
  if (onToggle) {
10902
10919
  onToggle(isOpen);
10903
10920
  }
10904
10921
  }, [isOpen]);
10905
10922
  const toggleOpen = /* @__PURE__ */ __name(() => setIsOpen(!isOpen), "toggleOpen");
10906
- useEffect27(() => {
10923
+ useEffect28(() => {
10907
10924
  if (isOpen) {
10908
10925
  setShouldRender(true);
10909
10926
  } else {
@@ -10977,7 +10994,7 @@ __name(PageContainer, "PageContainer");
10977
10994
  // src/components/containers/ReactMarkdownContainer.tsx
10978
10995
  import { ChevronDown as ChevronDown2, ChevronUp } from "lucide-react";
10979
10996
  import { useTranslations as useTranslations40 } from "next-intl";
10980
- import { useEffect as useEffect28, useRef as useRef13, useState as useState36 } from "react";
10997
+ import { useEffect as useEffect29, useRef as useRef13, useState as useState36 } from "react";
10981
10998
  import ReactMarkdown from "react-markdown";
10982
10999
  import remarkGfm from "remark-gfm";
10983
11000
  import { jsx as jsx118, jsxs as jsxs68 } from "react/jsx-runtime";
@@ -10991,7 +11008,7 @@ function ReactMarkdownContainer({
10991
11008
  const [isExpanded, setIsExpanded] = useState36(false);
10992
11009
  const [showExpandButton, setShowExpandButton] = useState36(false);
10993
11010
  const contentRef = useRef13(null);
10994
- useEffect28(() => {
11011
+ useEffect29(() => {
10995
11012
  if (collapsible && contentRef.current && !isExpanded) {
10996
11013
  const isOverflowing = contentRef.current.scrollHeight > contentRef.current.clientHeight;
10997
11014
  setShowExpandButton(isOverflowing);
@@ -11129,7 +11146,7 @@ __name(AllowedUsersDetails, "AllowedUsersDetails");
11129
11146
  import dynamic from "next/dynamic";
11130
11147
  import React15 from "react";
11131
11148
  import { jsx as jsx122 } from "react/jsx-runtime";
11132
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-G532N3N7.mjs"), {
11149
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-C25QYFYD.mjs"), {
11133
11150
  ssr: false
11134
11151
  });
11135
11152
  var BlockNoteEditorContainer = React15.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11137,13 +11154,13 @@ var BlockNoteEditorContainer = React15.memo(/* @__PURE__ */ __name(function Edit
11137
11154
  }, "EditorContainer"));
11138
11155
 
11139
11156
  // src/components/pages/PageContainerContentDetails.tsx
11140
- import { useEffect as useEffect29, useRef as useRef14, useState as useState37 } from "react";
11157
+ import { useEffect as useEffect30, useRef as useRef14, useState as useState37 } from "react";
11141
11158
  import { jsx as jsx123, jsxs as jsxs72 } from "react/jsx-runtime";
11142
11159
  function PageContainerContentDetails({ items, section, module, id }) {
11143
11160
  const rewriteUrl = useUrlRewriter();
11144
11161
  const [isScrolled, setIsScrolled] = useState37(false);
11145
11162
  const sentinelRef = useRef14(null);
11146
- useEffect29(() => {
11163
+ useEffect30(() => {
11147
11164
  const sentinel = sentinelRef.current;
11148
11165
  if (!sentinel) return;
11149
11166
  const observer = new IntersectionObserver(
@@ -11176,12 +11193,12 @@ function PageContainerContentDetails({ items, section, module, id }) {
11176
11193
  __name(PageContainerContentDetails, "PageContainerContentDetails");
11177
11194
 
11178
11195
  // src/components/pages/PageContentContainer.tsx
11179
- import { useEffect as useEffect30, useState as useState38 } from "react";
11196
+ import { useEffect as useEffect31, useState as useState38 } from "react";
11180
11197
  import { jsx as jsx124, jsxs as jsxs73 } from "react/jsx-runtime";
11181
11198
  function PageContentContainer({ header, details, footer, content }) {
11182
11199
  const [mounted, setMounted] = useState38(false);
11183
11200
  const isMobile = useIsMobile();
11184
- useEffect30(() => {
11201
+ useEffect31(() => {
11185
11202
  setMounted(true);
11186
11203
  }, []);
11187
11204
  const isReady = mounted && isMobile !== void 0;
@@ -11294,10 +11311,10 @@ var cellUrl = /* @__PURE__ */ __name((params) => {
11294
11311
  }, "cellUrl");
11295
11312
 
11296
11313
  // src/client/context/JsonApiProvider.tsx
11297
- import { useEffect as useEffect31, useMemo as useMemo12 } from "react";
11314
+ import { useEffect as useEffect32, useMemo as useMemo12 } from "react";
11298
11315
  import { jsx as jsx129 } from "react/jsx-runtime";
11299
11316
  function JsonApiProvider({ config, children }) {
11300
- useEffect31(() => {
11317
+ useEffect32(() => {
11301
11318
  if (config.bootstrapper) {
11302
11319
  config.bootstrapper();
11303
11320
  }
@@ -11308,7 +11325,7 @@ function JsonApiProvider({ config, children }) {
11308
11325
  __name(JsonApiProvider, "JsonApiProvider");
11309
11326
 
11310
11327
  // src/client/hooks/useJsonApiGet.ts
11311
- import { useState as useState39, useEffect as useEffect32, useCallback as useCallback14, useRef as useRef15 } from "react";
11328
+ import { useState as useState39, useEffect as useEffect33, useCallback as useCallback14, useRef as useRef15 } from "react";
11312
11329
  function useJsonApiGet(params) {
11313
11330
  const [data, setData] = useState39(null);
11314
11331
  const [loading, setLoading] = useState39(false);
@@ -11386,7 +11403,7 @@ function useJsonApiGet(params) {
11386
11403
  }
11387
11404
  }
11388
11405
  }, [response]);
11389
- useEffect32(() => {
11406
+ useEffect33(() => {
11390
11407
  isMounted.current = true;
11391
11408
  fetchData();
11392
11409
  return () => {
@@ -11689,7 +11706,7 @@ var useRoleTableStructure = /* @__PURE__ */ __name((params) => {
11689
11706
  }, "useRoleTableStructure");
11690
11707
 
11691
11708
  // src/features/user/hooks/useUserSearch.ts
11692
- import { useCallback as useCallback16, useEffect as useEffect33, useRef as useRef16, useState as useState41 } from "react";
11709
+ import { useCallback as useCallback16, useEffect as useEffect34, useRef as useRef16, useState as useState41 } from "react";
11693
11710
  var useUserSearch = /* @__PURE__ */ __name(() => {
11694
11711
  const [users, setUsers] = useState41([]);
11695
11712
  const [searchQuery, setSearchQuery] = useState41("");
@@ -11712,7 +11729,7 @@ var useUserSearch = /* @__PURE__ */ __name(() => {
11712
11729
  [users.length]
11713
11730
  );
11714
11731
  const debouncedLoadUsers = useDebounce(loadUsers, 500);
11715
- useEffect33(() => {
11732
+ useEffect34(() => {
11716
11733
  if (searchQuery !== searchQueryRef.current) {
11717
11734
  setIsLoading(true);
11718
11735
  debouncedLoadUsers(searchQuery);
@@ -11937,7 +11954,7 @@ var useContentTableStructure = /* @__PURE__ */ __name((params) => {
11937
11954
 
11938
11955
  // src/features/oauth/hooks/useOAuthClients.ts
11939
11956
  import { useAtom as useAtom3, useSetAtom } from "jotai";
11940
- import { useCallback as useCallback17, useEffect as useEffect34 } from "react";
11957
+ import { useCallback as useCallback17, useEffect as useEffect35 } from "react";
11941
11958
 
11942
11959
  // src/features/oauth/atoms/oauth.atoms.ts
11943
11960
  import { atom } from "jotai";
@@ -12012,7 +12029,7 @@ function useOAuthClients() {
12012
12029
  setIsLoading(false);
12013
12030
  }
12014
12031
  }, [setClients, setIsLoading, setError]);
12015
- useEffect34(() => {
12032
+ useEffect35(() => {
12016
12033
  fetchClients();
12017
12034
  }, [fetchClients]);
12018
12035
  const createClient = useCallback17(
@@ -12052,7 +12069,7 @@ __name(useOAuthClients, "useOAuthClients");
12052
12069
 
12053
12070
  // src/features/oauth/hooks/useOAuthClient.ts
12054
12071
  import { useAtomValue as useAtomValue2, useSetAtom as useSetAtom2 } from "jotai";
12055
- import { useCallback as useCallback18, useEffect as useEffect35, useState as useState42 } from "react";
12072
+ import { useCallback as useCallback18, useEffect as useEffect36, useState as useState42 } from "react";
12056
12073
  function useOAuthClient(clientId) {
12057
12074
  const storedClient = useAtomValue2(oauthClientByIdAtom(clientId));
12058
12075
  const updateClientInStore = useSetAtom2(updateOAuthClientAtom);
@@ -12076,7 +12093,7 @@ function useOAuthClient(clientId) {
12076
12093
  setIsLoading(false);
12077
12094
  }
12078
12095
  }, [clientId]);
12079
- useEffect35(() => {
12096
+ useEffect36(() => {
12080
12097
  if (!storedClient && clientId) {
12081
12098
  fetchClient();
12082
12099
  }
@@ -12150,13 +12167,13 @@ function useOAuthClient(clientId) {
12150
12167
  __name(useOAuthClient, "useOAuthClient");
12151
12168
 
12152
12169
  // src/features/oauth/hooks/useOAuthConsent.ts
12153
- import { useCallback as useCallback19, useEffect as useEffect36, useState as useState43 } from "react";
12170
+ import { useCallback as useCallback19, useEffect as useEffect37, useState as useState43 } from "react";
12154
12171
  function useOAuthConsent(params) {
12155
12172
  const [clientInfo, setClientInfo] = useState43(null);
12156
12173
  const [isLoading, setIsLoading] = useState43(true);
12157
12174
  const [error, setError] = useState43(null);
12158
12175
  const [isSubmitting, setIsSubmitting] = useState43(false);
12159
- useEffect36(() => {
12176
+ useEffect37(() => {
12160
12177
  const fetchInfo = /* @__PURE__ */ __name(async () => {
12161
12178
  if (!params.clientId || !params.redirectUri || !params.scope) {
12162
12179
  setError(new Error("Missing required authorization parameters"));
@@ -12236,7 +12253,7 @@ import { memo, useMemo as useMemo19 } from "react";
12236
12253
  // src/components/tables/ContentTableSearch.tsx
12237
12254
  import { RefreshCw, Search, X } from "lucide-react";
12238
12255
  import { useTranslations as useTranslations46 } from "next-intl";
12239
- import { useCallback as useCallback20, useEffect as useEffect37, useRef as useRef17, useState as useState44 } from "react";
12256
+ import { useCallback as useCallback20, useEffect as useEffect38, useRef as useRef17, useState as useState44 } from "react";
12240
12257
  import { jsx as jsx134, jsxs as jsxs76 } from "react/jsx-runtime";
12241
12258
  function ContentTableSearch({ data }) {
12242
12259
  const t = useTranslations46();
@@ -12259,7 +12276,7 @@ function ContentTableSearch({ data }) {
12259
12276
  [searchTermRef, data]
12260
12277
  );
12261
12278
  const updateSearchTerm = useDebounce(search, 500);
12262
- useEffect37(() => {
12279
+ useEffect38(() => {
12263
12280
  setIsSearching(true);
12264
12281
  updateSearchTerm(searchTerm);
12265
12282
  }, [updateSearchTerm, searchTerm]);
@@ -12643,7 +12660,7 @@ __name(LandingComponent, "LandingComponent");
12643
12660
  import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
12644
12661
  import { useTranslations as useTranslations49 } from "next-intl";
12645
12662
  import Image10 from "next/image";
12646
- import { useEffect as useEffect38, useState as useState47 } from "react";
12663
+ import { useEffect as useEffect39, useState as useState47 } from "react";
12647
12664
  import { useForm as useForm5 } from "react-hook-form";
12648
12665
  import { toast as toast6 } from "sonner";
12649
12666
  import { z as z5 } from "zod";
@@ -12653,7 +12670,7 @@ function AcceptInvitation() {
12653
12670
  const [showConfirmation, setShowConfirmation] = useState47(false);
12654
12671
  const [error, setError] = useState47(void 0);
12655
12672
  const t = useTranslations49();
12656
- useEffect38(() => {
12673
+ useEffect39(() => {
12657
12674
  async function validateCode(code) {
12658
12675
  try {
12659
12676
  const payload = {
@@ -12746,7 +12763,7 @@ __name(AcceptInvitation, "AcceptInvitation");
12746
12763
  // src/features/auth/components/forms/ActivateAccount.tsx
12747
12764
  import { useTranslations as useTranslations50 } from "next-intl";
12748
12765
  import Image11 from "next/image";
12749
- import { useEffect as useEffect39, useState as useState48 } from "react";
12766
+ import { useEffect as useEffect40, useState as useState48 } from "react";
12750
12767
  import { toast as toast7 } from "sonner";
12751
12768
  import { Fragment as Fragment22, jsx as jsx141, jsxs as jsxs81 } from "react/jsx-runtime";
12752
12769
  function ActivateAccount() {
@@ -12754,7 +12771,7 @@ function ActivateAccount() {
12754
12771
  const [showConfirmation, setShowConfirmation] = useState48(false);
12755
12772
  const [error, setError] = useState48(void 0);
12756
12773
  const t = useTranslations50();
12757
- useEffect39(() => {
12774
+ useEffect40(() => {
12758
12775
  async function ActivateAccount2(code) {
12759
12776
  try {
12760
12777
  const payload = {
@@ -12795,12 +12812,12 @@ function ActivateAccount() {
12795
12812
  __name(ActivateAccount, "ActivateAccount");
12796
12813
 
12797
12814
  // src/features/auth/components/forms/Cookies.tsx
12798
- import { useEffect as useEffect40, useState as useState49 } from "react";
12815
+ import { useEffect as useEffect41, useState as useState49 } from "react";
12799
12816
  function Cookies({ dehydratedAuth, page }) {
12800
12817
  const { setUser } = useCurrentUserContext();
12801
12818
  const router = useI18nRouter();
12802
12819
  const [hasSaved, setHasSaved] = useState49(false);
12803
- useEffect40(() => {
12820
+ useEffect41(() => {
12804
12821
  if (hasSaved) return;
12805
12822
  async function saveTokenOnServer() {
12806
12823
  await AuthService.saveToken({ dehydratedAuth });
@@ -12994,11 +13011,11 @@ function Login() {
12994
13011
  __name(Login, "Login");
12995
13012
 
12996
13013
  // src/features/auth/components/forms/Logout.tsx
12997
- import { useEffect as useEffect41 } from "react";
13014
+ import { useEffect as useEffect42 } from "react";
12998
13015
  import { Fragment as Fragment25, jsx as jsx144 } from "react/jsx-runtime";
12999
13016
  function Logout() {
13000
13017
  const generateUrl = usePageUrlGenerator();
13001
- useEffect41(() => {
13018
+ useEffect42(() => {
13002
13019
  const logOut = /* @__PURE__ */ __name(async () => {
13003
13020
  await AuthService.logout();
13004
13021
  window.location.href = generateUrl({ page: `/` });
@@ -13011,7 +13028,7 @@ __name(Logout, "Logout");
13011
13028
 
13012
13029
  // src/features/auth/components/forms/RefreshUser.tsx
13013
13030
  import { deleteCookie, getCookie as getCookie2 } from "cookies-next";
13014
- import { useEffect as useEffect42 } from "react";
13031
+ import { useEffect as useEffect43 } from "react";
13015
13032
  function RefreshUser() {
13016
13033
  const { setUser } = useCurrentUserContext();
13017
13034
  const loadFullUser = /* @__PURE__ */ __name(async () => {
@@ -13031,7 +13048,7 @@ function RefreshUser() {
13031
13048
  deleteCookie("reloadData");
13032
13049
  }
13033
13050
  }, "loadFullUser");
13034
- useEffect42(() => {
13051
+ useEffect43(() => {
13035
13052
  const reloadData = getCookie2("reloadData");
13036
13053
  if (reloadData !== void 0) loadFullUser();
13037
13054
  }, []);
@@ -13043,7 +13060,7 @@ __name(RefreshUser, "RefreshUser");
13043
13060
  import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
13044
13061
  import { useTranslations as useTranslations53 } from "next-intl";
13045
13062
  import Image14 from "next/image";
13046
- import { useEffect as useEffect43, useState as useState51 } from "react";
13063
+ import { useEffect as useEffect44, useState as useState51 } from "react";
13047
13064
  import { useForm as useForm8 } from "react-hook-form";
13048
13065
  import { toast as toast8 } from "sonner";
13049
13066
  import { z as z8 } from "zod";
@@ -13053,7 +13070,7 @@ function ResetPassword() {
13053
13070
  const [showConfirmation, setShowConfirmation] = useState51(false);
13054
13071
  const [error, setError] = useState51(void 0);
13055
13072
  const t = useTranslations53();
13056
- useEffect43(() => {
13073
+ useEffect44(() => {
13057
13074
  async function validateResetPasswordCode(code) {
13058
13075
  try {
13059
13076
  const payload = {
@@ -13335,7 +13352,7 @@ __name(NotificationsListContainer, "NotificationsListContainer");
13335
13352
  // src/features/notification/components/modals/NotificationModal.tsx
13336
13353
  import { BellIcon } from "lucide-react";
13337
13354
  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";
13355
+ import { Fragment as Fragment28, useCallback as useCallback21, useEffect as useEffect45, useMemo as useMemo21, useRef as useRef18, useState as useState52 } from "react";
13339
13356
  import { toast as toast9 } from "sonner";
13340
13357
  import { jsx as jsx152, jsxs as jsxs89 } from "react/jsx-runtime";
13341
13358
  function NotificationModalContent({ isOpen, setIsOpen }) {
@@ -13384,10 +13401,10 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13384
13401
  unreadIds: unreadNotifications2.map((notif) => notif.id)
13385
13402
  };
13386
13403
  }, [notifications]);
13387
- useEffect44(() => {
13404
+ useEffect45(() => {
13388
13405
  setNewNotifications(unreadCount > 0);
13389
13406
  }, [unreadCount]);
13390
- useEffect44(() => {
13407
+ useEffect45(() => {
13391
13408
  if (lastLoaded === 0) loadNotifications();
13392
13409
  }, [lastLoaded, loadNotifications]);
13393
13410
  const processSocketNotificationsRef = useRef18(null);
@@ -13430,7 +13447,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13430
13447
  generateUrl,
13431
13448
  checkCircuitBreaker
13432
13449
  ]);
13433
- useEffect44(() => {
13450
+ useEffect45(() => {
13434
13451
  if (processSocketNotificationsRef.current) {
13435
13452
  clearTimeout(processSocketNotificationsRef.current);
13436
13453
  }
@@ -13564,13 +13581,13 @@ __name(FormRoles, "FormRoles");
13564
13581
 
13565
13582
  // src/features/role/components/forms/RemoveUserFromRole.tsx
13566
13583
  import { useTranslations as useTranslations62 } from "next-intl";
13567
- import { useEffect as useEffect45, useState as useState53 } from "react";
13584
+ import { useEffect as useEffect46, useState as useState53 } from "react";
13568
13585
  import { Fragment as Fragment31, jsx as jsx157, jsxs as jsxs92 } from "react/jsx-runtime";
13569
13586
  function RemoveUserFromRole({ role, user, refresh }) {
13570
13587
  const [open, setOpen] = useState53(false);
13571
13588
  const [canRemove, setCanRemove] = useState53(false);
13572
13589
  const t = useTranslations62();
13573
- useEffect45(() => {
13590
+ useEffect46(() => {
13574
13591
  async function checkCompanyAdminDeletability() {
13575
13592
  const roleUsers = await UserService.findAllUsersByRole({
13576
13593
  roleId: role.id
@@ -13640,7 +13657,7 @@ __name(RemoveUserFromRole, "RemoveUserFromRole");
13640
13657
  // src/features/role/components/forms/UserRoleAdd.tsx
13641
13658
  import { PlusCircle as PlusCircle2 } from "lucide-react";
13642
13659
  import { useTranslations as useTranslations63 } from "next-intl";
13643
- import { useCallback as useCallback22, useEffect as useEffect46, useRef as useRef19, useState as useState54 } from "react";
13660
+ import { useCallback as useCallback22, useEffect as useEffect47, useRef as useRef19, useState as useState54 } from "react";
13644
13661
  import { toast as toast10 } from "sonner";
13645
13662
  import { Fragment as Fragment32, jsx as jsx158, jsxs as jsxs93 } from "react/jsx-runtime";
13646
13663
  function UserRoleAdd({ user, refresh }) {
@@ -13683,10 +13700,10 @@ function UserRoleAdd({ user, refresh }) {
13683
13700
  [searchTerm, user]
13684
13701
  );
13685
13702
  const updateSearchTerm = useDebounce(searchRoles, 500);
13686
- useEffect46(() => {
13703
+ useEffect47(() => {
13687
13704
  if (open) updateSearchTerm(searchTerm);
13688
13705
  }, [open, searchTerm]);
13689
- useEffect46(() => {
13706
+ useEffect47(() => {
13690
13707
  if (open) searchRoles("");
13691
13708
  }, [open]);
13692
13709
  return /* @__PURE__ */ jsxs93(Fragment32, { children: [
@@ -15084,4 +15101,4 @@ export {
15084
15101
  useOAuthClients,
15085
15102
  useOAuthClient
15086
15103
  };
15087
- //# sourceMappingURL=chunk-CWY6AL4V.mjs.map
15104
+ //# sourceMappingURL=chunk-QFN6RG6A.mjs.map