@sanvika/auth 1.0.23 → 1.0.25

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 (2) hide show
  1. package/dist/index.js +8 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15,21 +15,27 @@ import { jsx } from "react/jsx-runtime";
15
15
  var SA_URL = "https://accounts.sanvikaproduction.com";
16
16
  var SanvikaAuthContext = createContext(null);
17
17
  function SanvikaAuthProvider({ children }) {
18
+ console.log("[SanvikaAuthProvider] Initializing provider...");
18
19
  const [user, setUser] = useState(null);
19
20
  const [accessToken, setToken] = useState(null);
20
21
  const [loading, setLoading] = useState(true);
21
22
  useEffect(() => {
23
+ console.log("[SanvikaAuthProvider] Hydrating from localStorage...");
22
24
  try {
23
25
  const storedToken = localStorage.getItem(STORAGE_KEYS.ACCESS_TOKEN);
24
26
  const storedUser = localStorage.getItem(STORAGE_KEYS.USER);
27
+ console.log("[SanvikaAuthProvider] Token found:", !!storedToken);
28
+ console.log("[SanvikaAuthProvider] User found:", !!storedUser);
25
29
  if (storedToken && storedUser) {
26
30
  setToken(storedToken);
27
31
  setUser(JSON.parse(storedUser));
32
+ console.log("[SanvikaAuthProvider] User loaded:", JSON.parse(storedUser).firstName);
28
33
  }
29
34
  } catch (e) {
30
35
  console.error("[SanvikaAuth] Failed to load from localStorage:", e);
31
36
  } finally {
32
37
  setLoading(false);
38
+ console.log("[SanvikaAuthProvider] Loading complete, isAuthenticated:", !!user);
33
39
  }
34
40
  }, []);
35
41
  const login = async ({ mobile, password, deviceId, deviceName }) => {
@@ -202,6 +208,8 @@ function SanvikaAccountButtonContent({
202
208
  var _a, _b;
203
209
  const auth = useSanvikaAuth();
204
210
  console.log("[SanvikaAccountButton] auth context:", auth);
211
+ console.log("[SanvikaAccountButton] auth type:", typeof auth);
212
+ console.log("[SanvikaAccountButton] auth is null:", auth === null);
205
213
  const [dropdownOpen, setDropdownOpen] = useState2(false);
206
214
  const [imgError, setImgError] = useState2(false);
207
215
  const [prevImage, setPrevImage] = useState2((_a = auth == null ? void 0 : auth.user) == null ? void 0 : _a.image);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanvika/auth",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Sanvika Auth SDK — React components and hooks for Sanvika SSO integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",