@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/api",
3
- "version": "2.1.232",
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.232",
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 (typeof window !== 'undefined' && process.env.NODE_ENV === 'development') {
705
+ if (isBrowser && isDev) {
705
706
  authLogger.debug('useAuth called outside AuthProvider, returning default state');
706
707
  }
707
708
  return defaultAuthState;
@@ -8,7 +8,7 @@
8
8
  * - In development: returns data as-is (no encoding)
9
9
  */
10
10
 
11
- const isDev = process.env.NODE_ENV === 'development';
11
+ import { isDev } from '../utils/env';
12
12
 
13
13
  /**
14
14
  * Encode string to base64
@@ -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 (process.env.NODE_ENV === 'development') {
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 (process.env.NODE_ENV === 'development') {
56
+ if (isDev) {
56
57
  console.log('[Analytics] Set user:', userId);
57
58
  }
58
59
 
@@ -0,0 +1,3 @@
1
+ export const isDev = process.env.NODE_ENV === 'development';
2
+ export const isProd = process.env.NODE_ENV === 'production';
3
+ export const isBrowser = typeof window !== 'undefined';
@@ -12,7 +12,7 @@ import { createConsola } from 'consola';
12
12
  * - 4: debug
13
13
  * - 5: trace, verbose
14
14
  */
15
- const isDevelopment = process.env.NODE_ENV === 'development';
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