@carlonicora/nextjs-jsonapi 1.29.3 → 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,
@@ -180,6 +181,7 @@ function useDataListRetriever(params) {
180
181
  const requestIdRef = useRef(0);
181
182
  const abortControllerRef = useRef(null);
182
183
  const isFetchingRef = useRef(false);
184
+ const isPaginatingRef = useRef(false);
183
185
  const resolvedType = params.module;
184
186
  const resolvedService = ClientAbstractService;
185
187
  const parsePageParams = useCallback2((url) => {
@@ -235,7 +237,13 @@ function useDataListRetriever(params) {
235
237
  const fetchData = useCallback2(
236
238
  async (fetchParams) => {
237
239
  if (ready === false) return;
240
+ if ((fetchParams?.callNext || fetchParams?.callPrevious) && isPaginatingRef.current) {
241
+ return;
242
+ }
238
243
  if (isFetchingRef.current && !fetchParams?.callNext && !fetchParams?.callPrevious) return;
244
+ if (fetchParams?.callNext || fetchParams?.callPrevious) {
245
+ isPaginatingRef.current = true;
246
+ }
239
247
  const thisRequestId = ++requestIdRef.current;
240
248
  isFetchingRef.current = true;
241
249
  if (stableParams.requiresSearch === true && fetchParams?.isRefine !== true && fetchParams?.isRefresh !== true) {
@@ -299,6 +307,7 @@ function useDataListRetriever(params) {
299
307
  } finally {
300
308
  if (thisRequestId === requestIdRef.current) {
301
309
  isFetchingRef.current = false;
310
+ isPaginatingRef.current = false;
302
311
  }
303
312
  }
304
313
  },
@@ -860,7 +869,7 @@ function useCustomD3Graph(nodes, links, onNodeClick, visibleNodeIds, loadingNode
860
869
  __name(useCustomD3Graph, "useCustomD3Graph");
861
870
 
862
871
  // src/hooks/useNotificationSync.ts
863
- import { useEffect as useEffect22 } from "react";
872
+ import { useEffect as useEffect23 } from "react";
864
873
 
865
874
  // src/features/company/contexts/CompanyContext.tsx
866
875
  import { useTranslations as useTranslations32 } from "next-intl";
@@ -10225,7 +10234,7 @@ var useCompanyContext = /* @__PURE__ */ __name(() => {
10225
10234
 
10226
10235
  // src/features/notification/contexts/NotificationContext.tsx
10227
10236
  import { useTranslations as useTranslations34 } from "next-intl";
10228
- 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";
10229
10238
 
10230
10239
  // src/features/notification/components/notifications/Notification.tsx
10231
10240
  import { useTranslations as useTranslations33 } from "next-intl";
@@ -10299,6 +10308,8 @@ var NotificationContextProvider = /* @__PURE__ */ __name(({ children }) => {
10299
10308
  const [isLoading, setIsLoading] = useState30(false);
10300
10309
  const [error, setError] = useState30(null);
10301
10310
  const [lastLoaded, setLastLoaded] = useState30(0);
10311
+ const [hasInitiallyLoaded, setHasInitiallyLoaded] = useState30(false);
10312
+ const { currentUser } = useCurrentUserContext();
10302
10313
  const shouldRefresh = Date.now() - lastLoaded > 5 * 60 * 1e3;
10303
10314
  const addNotification = useCallback13((notification) => {
10304
10315
  setNotifications((prev) => {
@@ -10329,6 +10340,20 @@ var NotificationContextProvider = /* @__PURE__ */ __name(({ children }) => {
10329
10340
  setIsLoading(false);
10330
10341
  }
10331
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]);
10332
10357
  const markNotificationsAsRead = useCallback13(async (ids) => {
10333
10358
  setIsLoading(true);
10334
10359
  setError(null);
@@ -10512,7 +10537,7 @@ var recentPagesAtom = atomWithStorage2("recentPages", []);
10512
10537
  function useNotificationSync() {
10513
10538
  const { socketNotifications, clearSocketNotifications } = useSocketContext();
10514
10539
  const { addSocketNotifications } = useNotificationContext();
10515
- useEffect22(() => {
10540
+ useEffect23(() => {
10516
10541
  if (socketNotifications.length > 0) {
10517
10542
  try {
10518
10543
  addSocketNotifications(socketNotifications);
@@ -10528,12 +10553,12 @@ __name(useNotificationSync, "useNotificationSync");
10528
10553
  // src/hooks/usePageTracker.ts
10529
10554
  import { useAtom as useAtom2 } from "jotai";
10530
10555
  import { usePathname as usePathname2 } from "next/navigation";
10531
- import { useEffect as useEffect23 } from "react";
10556
+ import { useEffect as useEffect24 } from "react";
10532
10557
  var EXCLUDED_ROUTES = ["/", "/login", "/register", "/forgot-password", "/reset-password", "/activate"];
10533
10558
  function usePageTracker() {
10534
10559
  const pathname = usePathname2();
10535
10560
  const [_recentPages, setRecentPages] = useAtom2(recentPagesAtom);
10536
- useEffect23(() => {
10561
+ useEffect24(() => {
10537
10562
  if (!pathname) return;
10538
10563
  if (EXCLUDED_ROUTES.some((route) => pathname === route || pathname.endsWith(route))) {
10539
10564
  return;
@@ -10570,7 +10595,7 @@ function usePageTracker() {
10570
10595
  __name(usePageTracker, "usePageTracker");
10571
10596
 
10572
10597
  // src/hooks/usePushNotifications.ts
10573
- import { useEffect as useEffect24 } from "react";
10598
+ import { useEffect as useEffect25 } from "react";
10574
10599
  function urlBase64ToUint8Array(base64String) {
10575
10600
  const padding = "=".repeat((4 - base64String.length % 4) % 4);
10576
10601
  const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
@@ -10584,7 +10609,7 @@ function urlBase64ToUint8Array(base64String) {
10584
10609
  __name(urlBase64ToUint8Array, "urlBase64ToUint8Array");
10585
10610
  function usePushNotifications() {
10586
10611
  const { currentUser, hasRole } = useCurrentUserContext();
10587
- useEffect24(() => {
10612
+ useEffect25(() => {
10588
10613
  const register = /* @__PURE__ */ __name(async () => {
10589
10614
  if ("serviceWorker" in navigator && "PushManager" in window) {
10590
10615
  try {
@@ -10629,7 +10654,7 @@ function usePushNotifications() {
10629
10654
  __name(usePushNotifications, "usePushNotifications");
10630
10655
 
10631
10656
  // src/hooks/useSocket.ts
10632
- 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";
10633
10658
  import io from "socket.io-client";
10634
10659
  function useSocket({ token }) {
10635
10660
  const _errorCount = useRef12(0);
@@ -10640,7 +10665,7 @@ function useSocket({ token }) {
10640
10665
  const [messages, setMessages] = useState32([]);
10641
10666
  const [socketNotifications, setSocketNotifications] = useState32([]);
10642
10667
  const socketRef = useRef12(null);
10643
- useEffect25(() => {
10668
+ useEffect26(() => {
10644
10669
  if (!token) return;
10645
10670
  const globalSocketKey = `__socket_${process.env.NEXT_PUBLIC_API_URL?.replace(/[^a-zA-Z0-9]/g, "_")}`;
10646
10671
  if (typeof window !== "undefined") {
@@ -10803,12 +10828,12 @@ function BreadcrumbNavigation({ items }) {
10803
10828
  __name(BreadcrumbNavigation, "BreadcrumbNavigation");
10804
10829
 
10805
10830
  // src/components/navigations/ContentTitle.tsx
10806
- import { useEffect as useEffect26, useState as useState34 } from "react";
10831
+ import { useEffect as useEffect27, useState as useState34 } from "react";
10807
10832
  import { jsx as jsx112, jsxs as jsxs63 } from "react/jsx-runtime";
10808
10833
  function ContentTitle({ module, type, element, functions, className }) {
10809
10834
  const [clientFunctions, setClientFunctions] = useState34(null);
10810
10835
  const [isClient, setIsClient] = useState34(false);
10811
- useEffect26(() => {
10836
+ useEffect27(() => {
10812
10837
  setIsClient(true);
10813
10838
  setClientFunctions(functions);
10814
10839
  }, [functions]);
@@ -10883,19 +10908,19 @@ __name(ModeToggleSwitch, "ModeToggleSwitch");
10883
10908
 
10884
10909
  // src/components/navigations/PageSection.tsx
10885
10910
  import { ChevronDownIcon as ChevronDownIcon5, ChevronRightIcon as ChevronRightIcon6 } from "lucide-react";
10886
- import { useEffect as useEffect27, useState as useState35 } from "react";
10911
+ import { useEffect as useEffect28, useState as useState35 } from "react";
10887
10912
  import { v4 as v43 } from "uuid";
10888
10913
  import { jsx as jsx115, jsxs as jsxs65 } from "react/jsx-runtime";
10889
10914
  function PageSection({ children, title, options, open, small, onToggle }) {
10890
10915
  const [isOpen, setIsOpen] = useState35(open ?? true);
10891
10916
  const [shouldRender, setShouldRender] = useState35(open ?? true);
10892
- useEffect27(() => {
10917
+ useEffect28(() => {
10893
10918
  if (onToggle) {
10894
10919
  onToggle(isOpen);
10895
10920
  }
10896
10921
  }, [isOpen]);
10897
10922
  const toggleOpen = /* @__PURE__ */ __name(() => setIsOpen(!isOpen), "toggleOpen");
10898
- useEffect27(() => {
10923
+ useEffect28(() => {
10899
10924
  if (isOpen) {
10900
10925
  setShouldRender(true);
10901
10926
  } else {
@@ -10969,7 +10994,7 @@ __name(PageContainer, "PageContainer");
10969
10994
  // src/components/containers/ReactMarkdownContainer.tsx
10970
10995
  import { ChevronDown as ChevronDown2, ChevronUp } from "lucide-react";
10971
10996
  import { useTranslations as useTranslations40 } from "next-intl";
10972
- 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";
10973
10998
  import ReactMarkdown from "react-markdown";
10974
10999
  import remarkGfm from "remark-gfm";
10975
11000
  import { jsx as jsx118, jsxs as jsxs68 } from "react/jsx-runtime";
@@ -10983,7 +11008,7 @@ function ReactMarkdownContainer({
10983
11008
  const [isExpanded, setIsExpanded] = useState36(false);
10984
11009
  const [showExpandButton, setShowExpandButton] = useState36(false);
10985
11010
  const contentRef = useRef13(null);
10986
- useEffect28(() => {
11011
+ useEffect29(() => {
10987
11012
  if (collapsible && contentRef.current && !isExpanded) {
10988
11013
  const isOverflowing = contentRef.current.scrollHeight > contentRef.current.clientHeight;
10989
11014
  setShowExpandButton(isOverflowing);
@@ -11121,7 +11146,7 @@ __name(AllowedUsersDetails, "AllowedUsersDetails");
11121
11146
  import dynamic from "next/dynamic";
11122
11147
  import React15 from "react";
11123
11148
  import { jsx as jsx122 } from "react/jsx-runtime";
11124
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-ZET7ANBC.mjs"), {
11149
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-C25QYFYD.mjs"), {
11125
11150
  ssr: false
11126
11151
  });
11127
11152
  var BlockNoteEditorContainer = React15.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11129,13 +11154,13 @@ var BlockNoteEditorContainer = React15.memo(/* @__PURE__ */ __name(function Edit
11129
11154
  }, "EditorContainer"));
11130
11155
 
11131
11156
  // src/components/pages/PageContainerContentDetails.tsx
11132
- 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";
11133
11158
  import { jsx as jsx123, jsxs as jsxs72 } from "react/jsx-runtime";
11134
11159
  function PageContainerContentDetails({ items, section, module, id }) {
11135
11160
  const rewriteUrl = useUrlRewriter();
11136
11161
  const [isScrolled, setIsScrolled] = useState37(false);
11137
11162
  const sentinelRef = useRef14(null);
11138
- useEffect29(() => {
11163
+ useEffect30(() => {
11139
11164
  const sentinel = sentinelRef.current;
11140
11165
  if (!sentinel) return;
11141
11166
  const observer = new IntersectionObserver(
@@ -11168,12 +11193,12 @@ function PageContainerContentDetails({ items, section, module, id }) {
11168
11193
  __name(PageContainerContentDetails, "PageContainerContentDetails");
11169
11194
 
11170
11195
  // src/components/pages/PageContentContainer.tsx
11171
- import { useEffect as useEffect30, useState as useState38 } from "react";
11196
+ import { useEffect as useEffect31, useState as useState38 } from "react";
11172
11197
  import { jsx as jsx124, jsxs as jsxs73 } from "react/jsx-runtime";
11173
11198
  function PageContentContainer({ header, details, footer, content }) {
11174
11199
  const [mounted, setMounted] = useState38(false);
11175
11200
  const isMobile = useIsMobile();
11176
- useEffect30(() => {
11201
+ useEffect31(() => {
11177
11202
  setMounted(true);
11178
11203
  }, []);
11179
11204
  const isReady = mounted && isMobile !== void 0;
@@ -11286,10 +11311,10 @@ var cellUrl = /* @__PURE__ */ __name((params) => {
11286
11311
  }, "cellUrl");
11287
11312
 
11288
11313
  // src/client/context/JsonApiProvider.tsx
11289
- import { useEffect as useEffect31, useMemo as useMemo12 } from "react";
11314
+ import { useEffect as useEffect32, useMemo as useMemo12 } from "react";
11290
11315
  import { jsx as jsx129 } from "react/jsx-runtime";
11291
11316
  function JsonApiProvider({ config, children }) {
11292
- useEffect31(() => {
11317
+ useEffect32(() => {
11293
11318
  if (config.bootstrapper) {
11294
11319
  config.bootstrapper();
11295
11320
  }
@@ -11300,7 +11325,7 @@ function JsonApiProvider({ config, children }) {
11300
11325
  __name(JsonApiProvider, "JsonApiProvider");
11301
11326
 
11302
11327
  // src/client/hooks/useJsonApiGet.ts
11303
- 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";
11304
11329
  function useJsonApiGet(params) {
11305
11330
  const [data, setData] = useState39(null);
11306
11331
  const [loading, setLoading] = useState39(false);
@@ -11378,7 +11403,7 @@ function useJsonApiGet(params) {
11378
11403
  }
11379
11404
  }
11380
11405
  }, [response]);
11381
- useEffect32(() => {
11406
+ useEffect33(() => {
11382
11407
  isMounted.current = true;
11383
11408
  fetchData();
11384
11409
  return () => {
@@ -11681,7 +11706,7 @@ var useRoleTableStructure = /* @__PURE__ */ __name((params) => {
11681
11706
  }, "useRoleTableStructure");
11682
11707
 
11683
11708
  // src/features/user/hooks/useUserSearch.ts
11684
- 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";
11685
11710
  var useUserSearch = /* @__PURE__ */ __name(() => {
11686
11711
  const [users, setUsers] = useState41([]);
11687
11712
  const [searchQuery, setSearchQuery] = useState41("");
@@ -11704,7 +11729,7 @@ var useUserSearch = /* @__PURE__ */ __name(() => {
11704
11729
  [users.length]
11705
11730
  );
11706
11731
  const debouncedLoadUsers = useDebounce(loadUsers, 500);
11707
- useEffect33(() => {
11732
+ useEffect34(() => {
11708
11733
  if (searchQuery !== searchQueryRef.current) {
11709
11734
  setIsLoading(true);
11710
11735
  debouncedLoadUsers(searchQuery);
@@ -11929,7 +11954,7 @@ var useContentTableStructure = /* @__PURE__ */ __name((params) => {
11929
11954
 
11930
11955
  // src/features/oauth/hooks/useOAuthClients.ts
11931
11956
  import { useAtom as useAtom3, useSetAtom } from "jotai";
11932
- import { useCallback as useCallback17, useEffect as useEffect34 } from "react";
11957
+ import { useCallback as useCallback17, useEffect as useEffect35 } from "react";
11933
11958
 
11934
11959
  // src/features/oauth/atoms/oauth.atoms.ts
11935
11960
  import { atom } from "jotai";
@@ -12004,7 +12029,7 @@ function useOAuthClients() {
12004
12029
  setIsLoading(false);
12005
12030
  }
12006
12031
  }, [setClients, setIsLoading, setError]);
12007
- useEffect34(() => {
12032
+ useEffect35(() => {
12008
12033
  fetchClients();
12009
12034
  }, [fetchClients]);
12010
12035
  const createClient = useCallback17(
@@ -12044,7 +12069,7 @@ __name(useOAuthClients, "useOAuthClients");
12044
12069
 
12045
12070
  // src/features/oauth/hooks/useOAuthClient.ts
12046
12071
  import { useAtomValue as useAtomValue2, useSetAtom as useSetAtom2 } from "jotai";
12047
- 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";
12048
12073
  function useOAuthClient(clientId) {
12049
12074
  const storedClient = useAtomValue2(oauthClientByIdAtom(clientId));
12050
12075
  const updateClientInStore = useSetAtom2(updateOAuthClientAtom);
@@ -12068,7 +12093,7 @@ function useOAuthClient(clientId) {
12068
12093
  setIsLoading(false);
12069
12094
  }
12070
12095
  }, [clientId]);
12071
- useEffect35(() => {
12096
+ useEffect36(() => {
12072
12097
  if (!storedClient && clientId) {
12073
12098
  fetchClient();
12074
12099
  }
@@ -12142,13 +12167,13 @@ function useOAuthClient(clientId) {
12142
12167
  __name(useOAuthClient, "useOAuthClient");
12143
12168
 
12144
12169
  // src/features/oauth/hooks/useOAuthConsent.ts
12145
- 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";
12146
12171
  function useOAuthConsent(params) {
12147
12172
  const [clientInfo, setClientInfo] = useState43(null);
12148
12173
  const [isLoading, setIsLoading] = useState43(true);
12149
12174
  const [error, setError] = useState43(null);
12150
12175
  const [isSubmitting, setIsSubmitting] = useState43(false);
12151
- useEffect36(() => {
12176
+ useEffect37(() => {
12152
12177
  const fetchInfo = /* @__PURE__ */ __name(async () => {
12153
12178
  if (!params.clientId || !params.redirectUri || !params.scope) {
12154
12179
  setError(new Error("Missing required authorization parameters"));
@@ -12228,7 +12253,7 @@ import { memo, useMemo as useMemo19 } from "react";
12228
12253
  // src/components/tables/ContentTableSearch.tsx
12229
12254
  import { RefreshCw, Search, X } from "lucide-react";
12230
12255
  import { useTranslations as useTranslations46 } from "next-intl";
12231
- 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";
12232
12257
  import { jsx as jsx134, jsxs as jsxs76 } from "react/jsx-runtime";
12233
12258
  function ContentTableSearch({ data }) {
12234
12259
  const t = useTranslations46();
@@ -12251,7 +12276,7 @@ function ContentTableSearch({ data }) {
12251
12276
  [searchTermRef, data]
12252
12277
  );
12253
12278
  const updateSearchTerm = useDebounce(search, 500);
12254
- useEffect37(() => {
12279
+ useEffect38(() => {
12255
12280
  setIsSearching(true);
12256
12281
  updateSearchTerm(searchTerm);
12257
12282
  }, [updateSearchTerm, searchTerm]);
@@ -12635,7 +12660,7 @@ __name(LandingComponent, "LandingComponent");
12635
12660
  import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
12636
12661
  import { useTranslations as useTranslations49 } from "next-intl";
12637
12662
  import Image10 from "next/image";
12638
- import { useEffect as useEffect38, useState as useState47 } from "react";
12663
+ import { useEffect as useEffect39, useState as useState47 } from "react";
12639
12664
  import { useForm as useForm5 } from "react-hook-form";
12640
12665
  import { toast as toast6 } from "sonner";
12641
12666
  import { z as z5 } from "zod";
@@ -12645,7 +12670,7 @@ function AcceptInvitation() {
12645
12670
  const [showConfirmation, setShowConfirmation] = useState47(false);
12646
12671
  const [error, setError] = useState47(void 0);
12647
12672
  const t = useTranslations49();
12648
- useEffect38(() => {
12673
+ useEffect39(() => {
12649
12674
  async function validateCode(code) {
12650
12675
  try {
12651
12676
  const payload = {
@@ -12738,7 +12763,7 @@ __name(AcceptInvitation, "AcceptInvitation");
12738
12763
  // src/features/auth/components/forms/ActivateAccount.tsx
12739
12764
  import { useTranslations as useTranslations50 } from "next-intl";
12740
12765
  import Image11 from "next/image";
12741
- import { useEffect as useEffect39, useState as useState48 } from "react";
12766
+ import { useEffect as useEffect40, useState as useState48 } from "react";
12742
12767
  import { toast as toast7 } from "sonner";
12743
12768
  import { Fragment as Fragment22, jsx as jsx141, jsxs as jsxs81 } from "react/jsx-runtime";
12744
12769
  function ActivateAccount() {
@@ -12746,7 +12771,7 @@ function ActivateAccount() {
12746
12771
  const [showConfirmation, setShowConfirmation] = useState48(false);
12747
12772
  const [error, setError] = useState48(void 0);
12748
12773
  const t = useTranslations50();
12749
- useEffect39(() => {
12774
+ useEffect40(() => {
12750
12775
  async function ActivateAccount2(code) {
12751
12776
  try {
12752
12777
  const payload = {
@@ -12787,12 +12812,12 @@ function ActivateAccount() {
12787
12812
  __name(ActivateAccount, "ActivateAccount");
12788
12813
 
12789
12814
  // src/features/auth/components/forms/Cookies.tsx
12790
- import { useEffect as useEffect40, useState as useState49 } from "react";
12815
+ import { useEffect as useEffect41, useState as useState49 } from "react";
12791
12816
  function Cookies({ dehydratedAuth, page }) {
12792
12817
  const { setUser } = useCurrentUserContext();
12793
12818
  const router = useI18nRouter();
12794
12819
  const [hasSaved, setHasSaved] = useState49(false);
12795
- useEffect40(() => {
12820
+ useEffect41(() => {
12796
12821
  if (hasSaved) return;
12797
12822
  async function saveTokenOnServer() {
12798
12823
  await AuthService.saveToken({ dehydratedAuth });
@@ -12986,11 +13011,11 @@ function Login() {
12986
13011
  __name(Login, "Login");
12987
13012
 
12988
13013
  // src/features/auth/components/forms/Logout.tsx
12989
- import { useEffect as useEffect41 } from "react";
13014
+ import { useEffect as useEffect42 } from "react";
12990
13015
  import { Fragment as Fragment25, jsx as jsx144 } from "react/jsx-runtime";
12991
13016
  function Logout() {
12992
13017
  const generateUrl = usePageUrlGenerator();
12993
- useEffect41(() => {
13018
+ useEffect42(() => {
12994
13019
  const logOut = /* @__PURE__ */ __name(async () => {
12995
13020
  await AuthService.logout();
12996
13021
  window.location.href = generateUrl({ page: `/` });
@@ -13003,7 +13028,7 @@ __name(Logout, "Logout");
13003
13028
 
13004
13029
  // src/features/auth/components/forms/RefreshUser.tsx
13005
13030
  import { deleteCookie, getCookie as getCookie2 } from "cookies-next";
13006
- import { useEffect as useEffect42 } from "react";
13031
+ import { useEffect as useEffect43 } from "react";
13007
13032
  function RefreshUser() {
13008
13033
  const { setUser } = useCurrentUserContext();
13009
13034
  const loadFullUser = /* @__PURE__ */ __name(async () => {
@@ -13023,7 +13048,7 @@ function RefreshUser() {
13023
13048
  deleteCookie("reloadData");
13024
13049
  }
13025
13050
  }, "loadFullUser");
13026
- useEffect42(() => {
13051
+ useEffect43(() => {
13027
13052
  const reloadData = getCookie2("reloadData");
13028
13053
  if (reloadData !== void 0) loadFullUser();
13029
13054
  }, []);
@@ -13035,7 +13060,7 @@ __name(RefreshUser, "RefreshUser");
13035
13060
  import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
13036
13061
  import { useTranslations as useTranslations53 } from "next-intl";
13037
13062
  import Image14 from "next/image";
13038
- import { useEffect as useEffect43, useState as useState51 } from "react";
13063
+ import { useEffect as useEffect44, useState as useState51 } from "react";
13039
13064
  import { useForm as useForm8 } from "react-hook-form";
13040
13065
  import { toast as toast8 } from "sonner";
13041
13066
  import { z as z8 } from "zod";
@@ -13045,7 +13070,7 @@ function ResetPassword() {
13045
13070
  const [showConfirmation, setShowConfirmation] = useState51(false);
13046
13071
  const [error, setError] = useState51(void 0);
13047
13072
  const t = useTranslations53();
13048
- useEffect43(() => {
13073
+ useEffect44(() => {
13049
13074
  async function validateResetPasswordCode(code) {
13050
13075
  try {
13051
13076
  const payload = {
@@ -13327,7 +13352,7 @@ __name(NotificationsListContainer, "NotificationsListContainer");
13327
13352
  // src/features/notification/components/modals/NotificationModal.tsx
13328
13353
  import { BellIcon } from "lucide-react";
13329
13354
  import { useTranslations as useTranslations59 } from "next-intl";
13330
- 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";
13331
13356
  import { toast as toast9 } from "sonner";
13332
13357
  import { jsx as jsx152, jsxs as jsxs89 } from "react/jsx-runtime";
13333
13358
  function NotificationModalContent({ isOpen, setIsOpen }) {
@@ -13376,10 +13401,10 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13376
13401
  unreadIds: unreadNotifications2.map((notif) => notif.id)
13377
13402
  };
13378
13403
  }, [notifications]);
13379
- useEffect44(() => {
13404
+ useEffect45(() => {
13380
13405
  setNewNotifications(unreadCount > 0);
13381
13406
  }, [unreadCount]);
13382
- useEffect44(() => {
13407
+ useEffect45(() => {
13383
13408
  if (lastLoaded === 0) loadNotifications();
13384
13409
  }, [lastLoaded, loadNotifications]);
13385
13410
  const processSocketNotificationsRef = useRef18(null);
@@ -13422,7 +13447,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
13422
13447
  generateUrl,
13423
13448
  checkCircuitBreaker
13424
13449
  ]);
13425
- useEffect44(() => {
13450
+ useEffect45(() => {
13426
13451
  if (processSocketNotificationsRef.current) {
13427
13452
  clearTimeout(processSocketNotificationsRef.current);
13428
13453
  }
@@ -13556,13 +13581,13 @@ __name(FormRoles, "FormRoles");
13556
13581
 
13557
13582
  // src/features/role/components/forms/RemoveUserFromRole.tsx
13558
13583
  import { useTranslations as useTranslations62 } from "next-intl";
13559
- import { useEffect as useEffect45, useState as useState53 } from "react";
13584
+ import { useEffect as useEffect46, useState as useState53 } from "react";
13560
13585
  import { Fragment as Fragment31, jsx as jsx157, jsxs as jsxs92 } from "react/jsx-runtime";
13561
13586
  function RemoveUserFromRole({ role, user, refresh }) {
13562
13587
  const [open, setOpen] = useState53(false);
13563
13588
  const [canRemove, setCanRemove] = useState53(false);
13564
13589
  const t = useTranslations62();
13565
- useEffect45(() => {
13590
+ useEffect46(() => {
13566
13591
  async function checkCompanyAdminDeletability() {
13567
13592
  const roleUsers = await UserService.findAllUsersByRole({
13568
13593
  roleId: role.id
@@ -13632,7 +13657,7 @@ __name(RemoveUserFromRole, "RemoveUserFromRole");
13632
13657
  // src/features/role/components/forms/UserRoleAdd.tsx
13633
13658
  import { PlusCircle as PlusCircle2 } from "lucide-react";
13634
13659
  import { useTranslations as useTranslations63 } from "next-intl";
13635
- 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";
13636
13661
  import { toast as toast10 } from "sonner";
13637
13662
  import { Fragment as Fragment32, jsx as jsx158, jsxs as jsxs93 } from "react/jsx-runtime";
13638
13663
  function UserRoleAdd({ user, refresh }) {
@@ -13675,10 +13700,10 @@ function UserRoleAdd({ user, refresh }) {
13675
13700
  [searchTerm, user]
13676
13701
  );
13677
13702
  const updateSearchTerm = useDebounce(searchRoles, 500);
13678
- useEffect46(() => {
13703
+ useEffect47(() => {
13679
13704
  if (open) updateSearchTerm(searchTerm);
13680
13705
  }, [open, searchTerm]);
13681
- useEffect46(() => {
13706
+ useEffect47(() => {
13682
13707
  if (open) searchRoles("");
13683
13708
  }, [open]);
13684
13709
  return /* @__PURE__ */ jsxs93(Fragment32, { children: [
@@ -15076,4 +15101,4 @@ export {
15076
15101
  useOAuthClients,
15077
15102
  useOAuthClient
15078
15103
  };
15079
- //# sourceMappingURL=chunk-3HGZMKT4.mjs.map
15104
+ //# sourceMappingURL=chunk-QFN6RG6A.mjs.map