@djangocfg/layouts 2.1.229 → 2.1.231

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/layouts",
3
- "version": "2.1.229",
3
+ "version": "2.1.231",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -74,14 +74,14 @@
74
74
  "check": "tsc --noEmit"
75
75
  },
76
76
  "peerDependencies": {
77
- "@djangocfg/api": "^2.1.229",
78
- "@djangocfg/centrifugo": "^2.1.229",
79
- "@djangocfg/i18n": "^2.1.229",
80
- "@djangocfg/monitor": "^2.1.229",
81
- "@djangocfg/debuger": "^2.1.229",
82
- "@djangocfg/ui-core": "^2.1.229",
83
- "@djangocfg/ui-nextjs": "^2.1.229",
84
- "@djangocfg/ui-tools": "^2.1.229",
77
+ "@djangocfg/api": "^2.1.231",
78
+ "@djangocfg/centrifugo": "^2.1.231",
79
+ "@djangocfg/i18n": "^2.1.231",
80
+ "@djangocfg/monitor": "^2.1.231",
81
+ "@djangocfg/debuger": "^2.1.231",
82
+ "@djangocfg/ui-core": "^2.1.231",
83
+ "@djangocfg/ui-nextjs": "^2.1.231",
84
+ "@djangocfg/ui-tools": "^2.1.231",
85
85
  "@hookform/resolvers": "^5.2.2",
86
86
  "consola": "^3.4.2",
87
87
  "lucide-react": "^0.545.0",
@@ -109,15 +109,15 @@
109
109
  "uuid": "^11.1.0"
110
110
  },
111
111
  "devDependencies": {
112
- "@djangocfg/api": "^2.1.229",
113
- "@djangocfg/i18n": "^2.1.229",
114
- "@djangocfg/centrifugo": "^2.1.229",
115
- "@djangocfg/monitor": "^2.1.229",
116
- "@djangocfg/debuger": "^2.1.229",
117
- "@djangocfg/typescript-config": "^2.1.229",
118
- "@djangocfg/ui-core": "^2.1.229",
119
- "@djangocfg/ui-nextjs": "^2.1.229",
120
- "@djangocfg/ui-tools": "^2.1.229",
112
+ "@djangocfg/api": "^2.1.231",
113
+ "@djangocfg/i18n": "^2.1.231",
114
+ "@djangocfg/centrifugo": "^2.1.231",
115
+ "@djangocfg/monitor": "^2.1.231",
116
+ "@djangocfg/debuger": "^2.1.231",
117
+ "@djangocfg/typescript-config": "^2.1.231",
118
+ "@djangocfg/ui-core": "^2.1.231",
119
+ "@djangocfg/ui-nextjs": "^2.1.231",
120
+ "@djangocfg/ui-tools": "^2.1.231",
121
121
  "@types/node": "^24.7.2",
122
122
  "@types/react": "^19.1.0",
123
123
  "@types/react-dom": "^19.1.0",
@@ -31,6 +31,7 @@ import React, {
31
31
  } from 'react';
32
32
 
33
33
  import { toast } from '@djangocfg/ui-core/hooks';
34
+ import { useDebugMode, isProduction } from '@djangocfg/monitor/client';
34
35
 
35
36
  import { createErrorToast } from '../components/ErrorToast';
36
37
  import {
@@ -175,6 +176,7 @@ export function ErrorTrackingProvider({
175
176
  onMonitorCapture,
176
177
  }: ErrorTrackingProviderProps) {
177
178
  const [errors, setErrors] = useState<StoredError[]>([]);
179
+ const isDebugMode = useDebugMode();
178
180
 
179
181
  // Merge user configs with defaults
180
182
  const validationConfig: Required<ValidationErrorConfig> = {
@@ -253,8 +255,8 @@ export function ErrorTrackingProvider({
253
255
  // Call custom error handler
254
256
  const shouldShowToast = onError?.(detail) !== false;
255
257
 
256
- // Show toast notification using Sonner (only for unique errors)
257
- if (config.showToast && shouldShowToast && isUnique) {
258
+ // Show toast notification using Sonner (only for unique errors, and only in debug mode on production)
259
+ if (config.showToast && shouldShowToast && isUnique && (!isProduction || isDebugMode)) {
258
260
  const toastOptions = createErrorToast(detail, config);
259
261
  toast.error(toastOptions.title, {
260
262
  description: toastOptions.description,
@@ -262,7 +264,7 @@ export function ErrorTrackingProvider({
262
264
  });
263
265
  }
264
266
  },
265
- [onError, onMonitorCapture]
267
+ [onError, onMonitorCapture, isProduction, isDebugMode]
266
268
  );
267
269
 
268
270
  /**
@@ -288,21 +290,7 @@ export function ErrorTrackingProvider({
288
290
  handlers.push({ event: ERROR_EVENTS.VALIDATION, handler });
289
291
  }
290
292
 
291
- // CORS errors
292
- if (corsConfig.enabled) {
293
- const handler = (event: Event) => {
294
- if (!(event instanceof CustomEvent)) return;
295
- const detail: CORSErrorDetail = {
296
- ...event.detail,
297
- type: 'cors' as const,
298
- };
299
- handleError(detail, corsConfig);
300
- };
301
- window.addEventListener(ERROR_EVENTS.CORS, handler);
302
- handlers.push({ event: ERROR_EVENTS.CORS, handler });
303
- }
304
-
305
- // Network errors
293
+ // Network errors (includes possibly_cors hint from generated clients)
306
294
  if (networkConfig.enabled) {
307
295
  const handler = (event: Event) => {
308
296
  if (!(event instanceof CustomEvent)) return;
@@ -57,6 +57,12 @@ export interface NetworkErrorDetail extends BaseErrorDetail {
57
57
  error: string;
58
58
  /** Status code if available */
59
59
  statusCode?: number;
60
+ /**
61
+ * Heuristic hint: request is cross-origin and PerformanceResourceTiming suggests
62
+ * the connection reached the server but JS was blocked — likely a CORS policy issue.
63
+ * Not definitive — browser intentionally prevents exact classification.
64
+ */
65
+ possibly_cors?: boolean;
60
66
  }
61
67
 
62
68
  /**
@@ -161,7 +161,7 @@ export function formatErrorTitle(detail: ValidationErrorDetail | CORSErrorDetail
161
161
  case 'validation':
162
162
  return `❌ Validation Error in ${detail.operation}`;
163
163
  case 'cors':
164
- return '🚫 CORS Error';
164
+ return '⚠️ Server Unavailable';
165
165
  case 'network':
166
166
  return detail.statusCode
167
167
  ? `⚠️ Network Error (${detail.statusCode})`