@djangocfg/api 2.1.232 → 2.1.234
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.
- package/README.md +6 -0
- package/dist/auth-server.cjs +7 -2
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +7 -2
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +9 -6
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +9 -6
- package/dist/auth.mjs.map +1 -1
- package/package.json +2 -2
- package/src/auth/context/AuthContext.tsx +2 -1
- package/src/auth/hooks/useBase64.ts +1 -1
- package/src/auth/utils/analytics.ts +3 -2
- package/src/auth/utils/env.ts +3 -0
- package/src/auth/utils/logger.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.234",
|
|
4
4
|
"description": "Auto-generated TypeScript API client with React hooks, SWR integration, and Zod validation for Django REST Framework backends",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"django",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/node": "^24.7.2",
|
|
86
86
|
"@types/react": "^19.1.0",
|
|
87
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
87
|
+
"@djangocfg/typescript-config": "^2.1.234",
|
|
88
88
|
"next": "^16.0.10",
|
|
89
89
|
"react": "^19.1.0",
|
|
90
90
|
"tsup": "^8.5.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
+
import { isDev, isBrowser } from "../utils/env";
|
|
4
5
|
import { usePathname } from 'next/navigation';
|
|
5
6
|
import React, {
|
|
6
7
|
createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState
|
|
@@ -701,7 +702,7 @@ export const useAuth = (): AuthContextType => {
|
|
|
701
702
|
if (context === undefined) {
|
|
702
703
|
// SSR or outside provider - return safe defaults
|
|
703
704
|
// Log only in development to help debugging
|
|
704
|
-
if (
|
|
705
|
+
if (isBrowser && isDev) {
|
|
705
706
|
authLogger.debug('useAuth called outside AuthProvider, returning default state');
|
|
706
707
|
}
|
|
707
708
|
return defaultAuthState;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDev } from "./env";
|
|
1
2
|
/**
|
|
2
3
|
* Analytics stub for @djangocfg/api/auth
|
|
3
4
|
* Provides minimal analytics interface without external dependencies
|
|
@@ -40,7 +41,7 @@ export const Analytics = {
|
|
|
40
41
|
* Track an analytics event
|
|
41
42
|
*/
|
|
42
43
|
event(eventName: AnalyticsEventType, params?: AnalyticsEventParams) {
|
|
43
|
-
if (
|
|
44
|
+
if (isDev) {
|
|
44
45
|
console.log('[Analytics]', eventName, params);
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -52,7 +53,7 @@ export const Analytics = {
|
|
|
52
53
|
* Set user ID for tracking
|
|
53
54
|
*/
|
|
54
55
|
setUser(userId: string) {
|
|
55
|
-
if (
|
|
56
|
+
if (isDev) {
|
|
56
57
|
console.log('[Analytics] Set user:', userId);
|
|
57
58
|
}
|
|
58
59
|
|
package/src/auth/utils/logger.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { createConsola } from 'consola';
|
|
|
12
12
|
* - 4: debug
|
|
13
13
|
* - 5: trace, verbose
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
import { isDev as isDevelopment } from './env';
|
|
16
16
|
const isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';
|
|
17
17
|
const showLogs = isDevelopment || isStaticBuild;
|
|
18
18
|
|