@carlonicora/nextjs-jsonapi 3.8.0 → 3.8.2

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.
@@ -7662,6 +7662,7 @@ import { useTranslations as useTranslations41 } from "next-intl";
7662
7662
  import { Fragment as Fragment19, createContext as createContext16, useContext as useContext17, useState as useState36 } from "react";
7663
7663
 
7664
7664
  // src/features/user/contexts/CurrentUserContext.tsx
7665
+ import { getCookie } from "cookies-next";
7665
7666
  import { useAtom } from "jotai";
7666
7667
  import { atomWithStorage } from "jotai/utils";
7667
7668
  import { usePathname } from "next/navigation";
@@ -7818,6 +7819,12 @@ var CurrentUserProvider = /* @__PURE__ */ __name(({ children }) => {
7818
7819
  const { socket, isConnected } = useSocketContext();
7819
7820
  const refreshUserRef = useRef10(refreshUser);
7820
7821
  refreshUserRef.current = refreshUser;
7822
+ useEffect9(() => {
7823
+ if (typeof window === "undefined") return;
7824
+ if (window.localStorage.getItem(CURRENT_USER_STORAGE_KEY)) return;
7825
+ if (!getCookie("token")) return;
7826
+ void refreshUserRef.current({ skipCookieUpdate: true });
7827
+ }, []);
7821
7828
  const isRefreshingRef = useRef10(false);
7822
7829
  useEffect9(() => {
7823
7830
  if (!socket || !isConnected || !currentUser?.company?.id) {
@@ -10343,7 +10350,7 @@ import { useRef as useRef17 } from "react";
10343
10350
  import dynamic from "next/dynamic";
10344
10351
  import React18 from "react";
10345
10352
  import { jsx as jsx89 } from "react/jsx-runtime";
10346
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-F6P6SW3F.mjs"), {
10353
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-34AZITDR.mjs"), {
10347
10354
  ssr: false
10348
10355
  });
10349
10356
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -14623,7 +14630,8 @@ function usePushNotifications() {
14623
14630
  try {
14624
14631
  const sessionKey = `push_registered_${currentUser?.id}`;
14625
14632
  const lastRegisteredSubscription = sessionStorage.getItem(sessionKey);
14626
- const registration = await navigator.serviceWorker.register(`${getAppUrl()}/sw.js`);
14633
+ const swUrl = ENV.IS_PRODUCTION ? `${getAppUrl()}/sw.js` : `${getAppUrl()}/sw-dev.js`;
14634
+ const registration = await navigator.serviceWorker.register(swUrl);
14627
14635
  let permission = Notification.permission;
14628
14636
  if (permission === "default") {
14629
14637
  permission = await Notification.requestPermission();
@@ -19405,7 +19413,7 @@ function Logout({ storageKeys }) {
19405
19413
  __name(Logout, "Logout");
19406
19414
 
19407
19415
  // src/features/auth/components/forms/RefreshUser.tsx
19408
- import { deleteCookie, getCookie } from "cookies-next";
19416
+ import { deleteCookie, getCookie as getCookie2 } from "cookies-next";
19409
19417
  import { useEffect as useEffect60 } from "react";
19410
19418
  function RefreshUser() {
19411
19419
  const { setUser } = useCurrentUserContext();
@@ -19427,7 +19435,7 @@ function RefreshUser() {
19427
19435
  }
19428
19436
  }, "loadFullUser");
19429
19437
  useEffect60(() => {
19430
- const reloadData = getCookie("reloadData");
19438
+ const reloadData = getCookie2("reloadData");
19431
19439
  if (reloadData !== void 0) loadFullUser();
19432
19440
  }, []);
19433
19441
  return null;
@@ -25648,4 +25656,4 @@ export {
25648
25656
  useOAuthClients,
25649
25657
  useOAuthClient
25650
25658
  };
25651
- //# sourceMappingURL=chunk-XUDZOANZ.mjs.map
25659
+ //# sourceMappingURL=chunk-GXSXD4OR.mjs.map