@djangocfg/layouts 2.1.103 → 2.1.105
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 +33 -37
- package/src/components/RedirectPage/RedirectPage.tsx +2 -2
- package/src/components/core/ClientOnly.tsx +1 -1
- package/src/components/errors/ErrorLayout.tsx +1 -1
- package/src/components/errors/ErrorsTracker/components/ErrorButtons.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/layouts/AuthLayout/components/AuthHelp.tsx +1 -1
- package/src/layouts/AuthLayout/components/AuthSuccess.tsx +1 -1
- package/src/layouts/AuthLayout/components/IdentifierForm.tsx +1 -1
- package/src/layouts/AuthLayout/components/OTPForm.tsx +1 -1
- package/src/layouts/AuthLayout/components/TwoFactorForm.tsx +1 -1
- package/src/layouts/AuthLayout/components/TwoFactorSetup.tsx +1 -1
- package/src/layouts/AuthLayout/components/oauth/OAuthCallback.tsx +1 -1
- package/src/layouts/AuthLayout/components/oauth/OAuthProviders.tsx +1 -1
- package/src/layouts/PrivateLayout/PrivateLayout.tsx +3 -2
- package/src/layouts/PrivateLayout/components/PrivateHeader.tsx +2 -2
- package/src/layouts/ProfileLayout/ProfileLayout.tsx +1 -1
- package/src/layouts/ProfileLayout/__tests__/TwoFactorSection.test.tsx +1 -1
- package/src/layouts/ProfileLayout/components/AvatarSection.tsx +1 -1
- package/src/layouts/ProfileLayout/components/DeleteAccountSection.tsx +1 -1
- package/src/layouts/ProfileLayout/components/ProfileForm.tsx +1 -1
- package/src/layouts/ProfileLayout/components/TwoFactorSection.tsx +1 -1
- package/src/layouts/PublicLayout/components/PublicFooter/PublicFooter.tsx +1 -1
- package/src/layouts/PublicLayout/components/PublicMobileDrawer.tsx +1 -1
- package/src/layouts/PublicLayout/components/PublicNavigation.tsx +2 -2
- package/src/layouts/_components/UserMenu.tsx +1 -1
- package/src/layouts/index.ts +2 -0
- package/src/pages/index.ts +2 -0
- package/src/pages/legal/LegalPage.tsx +1 -1
- package/src/snippets/AuthDialog/AuthDialog.tsx +3 -2
- package/src/snippets/McpChat/components/AIChatWidget.tsx +1 -1
- package/src/snippets/McpChat/components/AskAIButton.tsx +1 -1
- package/src/snippets/McpChat/components/ChatMessages.tsx +1 -1
- package/src/snippets/McpChat/components/ChatPanel.tsx +1 -1
- package/src/snippets/McpChat/components/ChatSidebar.tsx +1 -1
- package/src/snippets/McpChat/components/ChatWidget.tsx +1 -1
- package/src/snippets/McpChat/components/MessageBubble.tsx +1 -1
- package/src/snippets/McpChat/components/MessageInput.tsx +1 -1
- package/src/snippets/McpChat/context/AIChatContext.tsx +1 -1
- package/src/snippets/McpChat/context/ChatContext.tsx +1 -1
- package/src/snippets/McpChat/hooks/useChatLayout.ts +1 -1
- package/src/snippets/PWAInstall/components/A2HSHint.tsx +0 -1
- package/src/snippets/PWAInstall/components/DesktopGuide.tsx +1 -1
- package/src/snippets/PWAInstall/components/IOSGuide.tsx +1 -1
- package/src/snippets/PWAInstall/components/IOSGuideDrawer.tsx +1 -1
- package/src/snippets/PWAInstall/components/IOSGuideModal.tsx +1 -1
- package/src/snippets/PWAInstall/hooks/useInstallPrompt.ts +2 -2
- package/src/snippets/PushNotifications/components/PushPrompt.tsx +1 -1
- package/src/snippets/index.ts +1 -0
- package/dist/AIChatWidget-LUPM7S2O.mjs +0 -1644
- package/dist/AIChatWidget-LUPM7S2O.mjs.map +0 -1
- package/dist/AIChatWidget-O23TJJ7C.mjs +0 -3
- package/dist/AIChatWidget-O23TJJ7C.mjs.map +0 -1
- package/dist/chunk-53YKWR6F.mjs +0 -6
- package/dist/chunk-53YKWR6F.mjs.map +0 -1
- package/dist/chunk-EI7TDN2G.mjs +0 -1652
- package/dist/chunk-EI7TDN2G.mjs.map +0 -1
- package/dist/components.cjs +0 -925
- package/dist/components.cjs.map +0 -1
- package/dist/components.d.mts +0 -583
- package/dist/components.d.ts +0 -583
- package/dist/components.mjs +0 -879
- package/dist/components.mjs.map +0 -1
- package/dist/index.cjs +0 -7573
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -2376
- package/dist/index.d.ts +0 -2376
- package/dist/index.mjs +0 -5673
- package/dist/index.mjs.map +0 -1
- package/dist/layouts.cjs +0 -6530
- package/dist/layouts.cjs.map +0 -1
- package/dist/layouts.d.mts +0 -748
- package/dist/layouts.d.ts +0 -748
- package/dist/layouts.mjs +0 -4741
- package/dist/layouts.mjs.map +0 -1
- package/dist/pages.cjs +0 -178
- package/dist/pages.cjs.map +0 -1
- package/dist/pages.d.mts +0 -57
- package/dist/pages.d.ts +0 -57
- package/dist/pages.mjs +0 -168
- package/dist/pages.mjs.map +0 -1
- package/dist/snippets.cjs +0 -3793
- package/dist/snippets.cjs.map +0 -1
- package/dist/snippets.d.mts +0 -1192
- package/dist/snippets.d.ts +0 -1192
- package/dist/snippets.mjs +0 -3738
- package/dist/snippets.mjs.map +0 -1
- package/dist/utils.cjs +0 -34
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.mts +0 -40
- package/dist/utils.d.ts +0 -40
- package/dist/utils.mjs +0 -25
- package/dist/utils.mjs.map +0 -1
package/dist/components.d.mts
DELETED
|
@@ -1,583 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React, { ReactNode, Component, ErrorInfo } from 'react';
|
|
3
|
-
import { LucideIcon as LucideIcon$1 } from 'lucide-react';
|
|
4
|
-
import { ZodError } from 'zod';
|
|
5
|
-
|
|
6
|
-
interface ClientOnlyProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Fallback to show during SSR and initial mount
|
|
10
|
-
* @default Preloader with "Loading..." text
|
|
11
|
-
*/
|
|
12
|
-
fallback?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* ClientOnly - Prevents SSR hydration mismatch
|
|
16
|
-
*
|
|
17
|
-
* Use this to wrap components that:
|
|
18
|
-
* - Access browser-only APIs (window, localStorage, etc.)
|
|
19
|
-
* - Have different initial state on server vs client
|
|
20
|
-
* - Use authentication state that differs between SSR and CSR
|
|
21
|
-
*/
|
|
22
|
-
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): react_jsx_runtime.JSX.Element;
|
|
23
|
-
|
|
24
|
-
interface JsonLdProps {
|
|
25
|
-
data: Record<string, any> | Record<string, any>[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* JsonLd Component
|
|
29
|
-
*
|
|
30
|
-
* Renders JSON-LD structured data for SEO.
|
|
31
|
-
* Use this for schema.org markup (Organization, WebSite, FAQPage, etc.)
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```tsx
|
|
35
|
-
* <JsonLd data={{
|
|
36
|
-
* "@context": "https://schema.org",
|
|
37
|
-
* "@type": "Organization",
|
|
38
|
-
* "name": "My Company"
|
|
39
|
-
* }} />
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare function JsonLd({ data }: JsonLdProps): react_jsx_runtime.JSX.Element;
|
|
43
|
-
|
|
44
|
-
interface LucideIconProps extends Omit<React.SVGProps<SVGSVGElement>, 'children'> {
|
|
45
|
-
/**
|
|
46
|
-
* Icon name (string) or icon component (LucideIcon)
|
|
47
|
-
* If string, will be resolved from lucide-react
|
|
48
|
-
* If component, will be used directly
|
|
49
|
-
*/
|
|
50
|
-
icon?: LucideIcon$1 | string;
|
|
51
|
-
/**
|
|
52
|
-
* Fallback icon if name not found
|
|
53
|
-
* @default CloudLightning
|
|
54
|
-
*/
|
|
55
|
-
fallback?: LucideIcon$1;
|
|
56
|
-
/**
|
|
57
|
-
* Additional CSS classes
|
|
58
|
-
*/
|
|
59
|
-
className?: string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* LucideIcon Component
|
|
63
|
-
*
|
|
64
|
-
* Renders a Lucide icon either by name (string) or by component reference.
|
|
65
|
-
* Automatically resolves icon names from lucide-react package.
|
|
66
|
-
*
|
|
67
|
-
* Usage:
|
|
68
|
-
* ```tsx
|
|
69
|
-
* // By name (string)
|
|
70
|
-
* <LucideIcon icon="CloudLightning" className="w-4 h-4" />
|
|
71
|
-
*
|
|
72
|
-
* // By component
|
|
73
|
-
* import { CloudLightning } from 'lucide-react';
|
|
74
|
-
* <LucideIcon icon={CloudLightning} className="w-4 h-4" />
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
declare function LucideIcon({ icon, fallback, className, ...props }: LucideIconProps): react_jsx_runtime.JSX.Element;
|
|
78
|
-
|
|
79
|
-
interface SuspenseProps {
|
|
80
|
-
children: ReactNode;
|
|
81
|
-
fallback?: ReactNode;
|
|
82
|
-
}
|
|
83
|
-
declare function Suspense({ children, fallback }: SuspenseProps): react_jsx_runtime.JSX.Element;
|
|
84
|
-
|
|
85
|
-
interface ErrorBoundaryProps {
|
|
86
|
-
children: ReactNode;
|
|
87
|
-
supportEmail?: string;
|
|
88
|
-
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
89
|
-
}
|
|
90
|
-
interface ErrorBoundaryState {
|
|
91
|
-
hasError: boolean;
|
|
92
|
-
error: Error | null;
|
|
93
|
-
}
|
|
94
|
-
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
95
|
-
constructor(props: ErrorBoundaryProps);
|
|
96
|
-
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
97
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
98
|
-
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>> | react_jsx_runtime.JSX.Element;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
interface ErrorLayoutProps {
|
|
102
|
-
/** Error code (e.g., "404", "500", "403") - if provided, auto-configures title/description/icon */
|
|
103
|
-
code?: string | number;
|
|
104
|
-
/** Error title (auto-generated from code if not provided) */
|
|
105
|
-
title?: string;
|
|
106
|
-
/** Error description (auto-generated from code if not provided) */
|
|
107
|
-
description?: string;
|
|
108
|
-
/** Custom action buttons */
|
|
109
|
-
actions?: React.ReactNode;
|
|
110
|
-
/** Show default actions (back, home) */
|
|
111
|
-
showDefaultActions?: boolean;
|
|
112
|
-
/** Custom illustration/icon (auto-generated from code if not provided) */
|
|
113
|
-
illustration?: React.ReactNode;
|
|
114
|
-
/** Support email for contact link */
|
|
115
|
-
supportEmail?: string;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* ErrorLayout Component
|
|
119
|
-
*/
|
|
120
|
-
declare function ErrorLayout({ code, title, description, actions, showDefaultActions, illustration, supportEmail, }: ErrorLayoutProps): react_jsx_runtime.JSX.Element;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Universal Error Configuration
|
|
124
|
-
*
|
|
125
|
-
* Provides standard error content for common HTTP status codes
|
|
126
|
-
* Use this to maintain consistency across error pages
|
|
127
|
-
*
|
|
128
|
-
* NOTE: Only returns primitives (title, description) - NO React components
|
|
129
|
-
* This ensures safe serialization during prerendering
|
|
130
|
-
*/
|
|
131
|
-
interface ErrorContent {
|
|
132
|
-
title: string;
|
|
133
|
-
description: string;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Get standardized error content based on status code
|
|
137
|
-
*
|
|
138
|
-
* @param statusCode - HTTP status code or custom error type
|
|
139
|
-
* @returns Error content configuration (title and description only)
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```tsx
|
|
143
|
-
* const { title, description } = getErrorContent(404);
|
|
144
|
-
* <ErrorLayout title={title} description={description} code={404} />
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
declare function getErrorContent(statusCode?: number | string): ErrorContent;
|
|
148
|
-
/**
|
|
149
|
-
* Common error codes as constants
|
|
150
|
-
*/
|
|
151
|
-
declare const ERROR_CODES: {
|
|
152
|
-
readonly BAD_REQUEST: 400;
|
|
153
|
-
readonly UNAUTHORIZED: 401;
|
|
154
|
-
readonly FORBIDDEN: 403;
|
|
155
|
-
readonly NOT_FOUND: 404;
|
|
156
|
-
readonly TIMEOUT: 408;
|
|
157
|
-
readonly SERVER_ERROR: 500;
|
|
158
|
-
readonly BAD_GATEWAY: 502;
|
|
159
|
-
readonly SERVICE_UNAVAILABLE: 503;
|
|
160
|
-
readonly GATEWAY_TIMEOUT: 504;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Error Tracking Types
|
|
165
|
-
*
|
|
166
|
-
* Common types for all error tracking functionality
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Base error detail from CustomEvent
|
|
171
|
-
*/
|
|
172
|
-
interface BaseErrorDetail {
|
|
173
|
-
/** Timestamp of the error */
|
|
174
|
-
timestamp: Date;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Validation error detail (from zod-validation-error event)
|
|
178
|
-
*/
|
|
179
|
-
interface ValidationErrorDetail extends BaseErrorDetail {
|
|
180
|
-
type: 'validation';
|
|
181
|
-
/** Operation/function name that failed validation */
|
|
182
|
-
operation: string;
|
|
183
|
-
/** API endpoint path */
|
|
184
|
-
path: string;
|
|
185
|
-
/** HTTP method */
|
|
186
|
-
method: string;
|
|
187
|
-
/** Zod validation error */
|
|
188
|
-
error: ZodError;
|
|
189
|
-
/** Raw response data that failed validation */
|
|
190
|
-
response: any;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* CORS error detail (from cors-error event)
|
|
194
|
-
*/
|
|
195
|
-
interface CORSErrorDetail extends BaseErrorDetail {
|
|
196
|
-
type: 'cors';
|
|
197
|
-
/** API endpoint that was blocked */
|
|
198
|
-
url: string;
|
|
199
|
-
/** HTTP method */
|
|
200
|
-
method: string;
|
|
201
|
-
/** Error message */
|
|
202
|
-
error: string;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Network error detail (from network-error event)
|
|
206
|
-
*/
|
|
207
|
-
interface NetworkErrorDetail extends BaseErrorDetail {
|
|
208
|
-
type: 'network';
|
|
209
|
-
/** API endpoint that failed */
|
|
210
|
-
url: string;
|
|
211
|
-
/** HTTP method */
|
|
212
|
-
method: string;
|
|
213
|
-
/** Error message */
|
|
214
|
-
error: string;
|
|
215
|
-
/** Status code if available */
|
|
216
|
-
statusCode?: number;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Centrifugo error detail (from centrifugo-error event)
|
|
220
|
-
*/
|
|
221
|
-
interface CentrifugoErrorDetail extends BaseErrorDetail {
|
|
222
|
-
type: 'centrifugo';
|
|
223
|
-
/** RPC method that failed */
|
|
224
|
-
method: string;
|
|
225
|
-
/** Error message */
|
|
226
|
-
error: string;
|
|
227
|
-
/** Error code from Centrifugo */
|
|
228
|
-
code?: number;
|
|
229
|
-
/** Additional data sent with the request */
|
|
230
|
-
data?: any;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Union type of all error details
|
|
234
|
-
*/
|
|
235
|
-
type ErrorDetail = ValidationErrorDetail | CORSErrorDetail | NetworkErrorDetail | CentrifugoErrorDetail;
|
|
236
|
-
/**
|
|
237
|
-
* Stored error with unique ID
|
|
238
|
-
*/
|
|
239
|
-
type StoredError<T extends ErrorDetail = ErrorDetail> = T & {
|
|
240
|
-
/** Unique identifier for this error instance */
|
|
241
|
-
id: string;
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* Configuration for specific error type
|
|
245
|
-
*/
|
|
246
|
-
interface ErrorTypeConfig {
|
|
247
|
-
/**
|
|
248
|
-
* Enable tracking for this error type
|
|
249
|
-
* @default true
|
|
250
|
-
*/
|
|
251
|
-
enabled?: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Show toast notifications
|
|
254
|
-
* @default true
|
|
255
|
-
*/
|
|
256
|
-
showToast?: boolean;
|
|
257
|
-
/**
|
|
258
|
-
* Maximum number of errors to keep in history
|
|
259
|
-
* @default 50
|
|
260
|
-
*/
|
|
261
|
-
maxErrors?: number;
|
|
262
|
-
/**
|
|
263
|
-
* Toast duration in milliseconds (0 = no auto-dismiss)
|
|
264
|
-
* @default 8000 for validation, 0 for cors/network
|
|
265
|
-
*/
|
|
266
|
-
duration?: number;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Validation error specific config
|
|
270
|
-
*/
|
|
271
|
-
interface ValidationErrorConfig extends ErrorTypeConfig {
|
|
272
|
-
/**
|
|
273
|
-
* Show operation name in toast
|
|
274
|
-
* @default true
|
|
275
|
-
*/
|
|
276
|
-
showOperation?: boolean;
|
|
277
|
-
/**
|
|
278
|
-
* Show endpoint path in toast
|
|
279
|
-
* @default true
|
|
280
|
-
*/
|
|
281
|
-
showPath?: boolean;
|
|
282
|
-
/**
|
|
283
|
-
* Show error count in toast
|
|
284
|
-
* @default true
|
|
285
|
-
*/
|
|
286
|
-
showErrorCount?: boolean;
|
|
287
|
-
/**
|
|
288
|
-
* Maximum number of issues to show in toast
|
|
289
|
-
* @default 3
|
|
290
|
-
*/
|
|
291
|
-
maxIssuesInToast?: number;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* CORS error specific config
|
|
295
|
-
*/
|
|
296
|
-
interface CORSErrorConfig extends ErrorTypeConfig {
|
|
297
|
-
/**
|
|
298
|
-
* Show full URL in toast
|
|
299
|
-
* @default true
|
|
300
|
-
*/
|
|
301
|
-
showUrl?: boolean;
|
|
302
|
-
/**
|
|
303
|
-
* Show HTTP method in toast
|
|
304
|
-
* @default true
|
|
305
|
-
*/
|
|
306
|
-
showMethod?: boolean;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Network error specific config
|
|
310
|
-
*/
|
|
311
|
-
interface NetworkErrorConfig extends ErrorTypeConfig {
|
|
312
|
-
/**
|
|
313
|
-
* Show full URL in toast
|
|
314
|
-
* @default true
|
|
315
|
-
*/
|
|
316
|
-
showUrl?: boolean;
|
|
317
|
-
/**
|
|
318
|
-
* Show HTTP method in toast
|
|
319
|
-
* @default true
|
|
320
|
-
*/
|
|
321
|
-
showMethod?: boolean;
|
|
322
|
-
/**
|
|
323
|
-
* Show status code in toast
|
|
324
|
-
* @default true
|
|
325
|
-
*/
|
|
326
|
-
showStatusCode?: boolean;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Centrifugo error specific config
|
|
330
|
-
*/
|
|
331
|
-
interface CentrifugoErrorConfig extends ErrorTypeConfig {
|
|
332
|
-
/**
|
|
333
|
-
* Show RPC method in toast
|
|
334
|
-
* @default true
|
|
335
|
-
*/
|
|
336
|
-
showMethod?: boolean;
|
|
337
|
-
/**
|
|
338
|
-
* Show error code in toast
|
|
339
|
-
* @default true
|
|
340
|
-
*/
|
|
341
|
-
showCode?: boolean;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Complete error tracking configuration
|
|
345
|
-
*/
|
|
346
|
-
interface ErrorTrackingConfig {
|
|
347
|
-
/**
|
|
348
|
-
* Validation error tracking configuration
|
|
349
|
-
*/
|
|
350
|
-
validation?: ValidationErrorConfig;
|
|
351
|
-
/**
|
|
352
|
-
* CORS error tracking configuration
|
|
353
|
-
*/
|
|
354
|
-
cors?: CORSErrorConfig;
|
|
355
|
-
/**
|
|
356
|
-
* Network error tracking configuration
|
|
357
|
-
*/
|
|
358
|
-
network?: NetworkErrorConfig;
|
|
359
|
-
/**
|
|
360
|
-
* Centrifugo error tracking configuration
|
|
361
|
-
*/
|
|
362
|
-
centrifugo?: CentrifugoErrorConfig;
|
|
363
|
-
/**
|
|
364
|
-
* Custom error handler (called before toast for all errors)
|
|
365
|
-
* Return false to prevent default toast notification
|
|
366
|
-
*/
|
|
367
|
-
onError?: (error: ErrorDetail) => boolean | void;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Error tracking context value
|
|
371
|
-
*/
|
|
372
|
-
interface ErrorTrackingContextValue {
|
|
373
|
-
/** All errors */
|
|
374
|
-
errors: StoredError[];
|
|
375
|
-
/** Validation errors only */
|
|
376
|
-
validationErrors: StoredError<ValidationErrorDetail>[];
|
|
377
|
-
/** CORS errors only */
|
|
378
|
-
corsErrors: StoredError<CORSErrorDetail>[];
|
|
379
|
-
/** Network errors only */
|
|
380
|
-
networkErrors: StoredError<NetworkErrorDetail>[];
|
|
381
|
-
/** Centrifugo errors only */
|
|
382
|
-
centrifugoErrors: StoredError<CentrifugoErrorDetail>[];
|
|
383
|
-
/** Clear all errors */
|
|
384
|
-
clearErrors: () => void;
|
|
385
|
-
/** Clear errors by type */
|
|
386
|
-
clearErrorsByType: (type: 'validation' | 'cors' | 'network' | 'centrifugo') => void;
|
|
387
|
-
/** Clear specific error by ID */
|
|
388
|
-
clearError: (id: string) => void;
|
|
389
|
-
/** Get error count */
|
|
390
|
-
errorCount: number;
|
|
391
|
-
/** Get latest error */
|
|
392
|
-
latestError: StoredError | null;
|
|
393
|
-
/** Configuration */
|
|
394
|
-
config: {
|
|
395
|
-
validation: Required<ValidationErrorConfig>;
|
|
396
|
-
cors: Required<CORSErrorConfig>;
|
|
397
|
-
network: Required<NetworkErrorConfig>;
|
|
398
|
-
centrifugo: Required<CentrifugoErrorConfig>;
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Error Handling Configuration Types
|
|
404
|
-
*
|
|
405
|
-
* Configuration types for ErrorTrackingProvider and ErrorBoundary
|
|
406
|
-
*/
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Error Boundary Configuration
|
|
410
|
-
*
|
|
411
|
-
* Configuration for React ErrorBoundary component
|
|
412
|
-
*/
|
|
413
|
-
interface ErrorBoundaryConfig {
|
|
414
|
-
/** Enable error boundary (default: true) */
|
|
415
|
-
enabled?: boolean;
|
|
416
|
-
/** Support email to display in error UI */
|
|
417
|
-
supportEmail?: string;
|
|
418
|
-
/** Custom error handler called when error is caught */
|
|
419
|
-
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
interface RedirectPageProps {
|
|
423
|
-
/**
|
|
424
|
-
* Path to redirect to when user is authenticated
|
|
425
|
-
* @default '/private'
|
|
426
|
-
*/
|
|
427
|
-
authenticatedPath?: string;
|
|
428
|
-
/**
|
|
429
|
-
* Path to redirect to when user is not authenticated
|
|
430
|
-
* @default '/auth'
|
|
431
|
-
*/
|
|
432
|
-
unauthenticatedPath?: string;
|
|
433
|
-
/**
|
|
434
|
-
* Custom loading text
|
|
435
|
-
* @default 'Loading...'
|
|
436
|
-
*/
|
|
437
|
-
loadingText?: string;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* RedirectPage - Root page component that handles authentication redirect
|
|
441
|
-
*
|
|
442
|
-
* Redirects authenticated users to authenticatedPath, otherwise to unauthenticatedPath
|
|
443
|
-
*
|
|
444
|
-
* Usage:
|
|
445
|
-
* ```tsx
|
|
446
|
-
* // app/page.tsx
|
|
447
|
-
* import { RedirectPage } from '@djangocfg/layouts/components';
|
|
448
|
-
*
|
|
449
|
-
* export default function Page() {
|
|
450
|
-
* return (
|
|
451
|
-
* <RedirectPage
|
|
452
|
-
* authenticatedPath="/private"
|
|
453
|
-
* unauthenticatedPath="/auth"
|
|
454
|
-
* />
|
|
455
|
-
* );
|
|
456
|
-
* }
|
|
457
|
-
* ```
|
|
458
|
-
*/
|
|
459
|
-
declare function RedirectPage({ authenticatedPath, unauthenticatedPath, loadingText, }: RedirectPageProps): react_jsx_runtime.JSX.Element;
|
|
460
|
-
|
|
461
|
-
interface ErrorTrackingProviderProps {
|
|
462
|
-
children: ReactNode;
|
|
463
|
-
validation?: Partial<ValidationErrorConfig>;
|
|
464
|
-
cors?: Partial<CORSErrorConfig>;
|
|
465
|
-
network?: Partial<NetworkErrorConfig>;
|
|
466
|
-
centrifugo?: Partial<CentrifugoErrorConfig>;
|
|
467
|
-
onError?: (error: ErrorDetail) => boolean | void;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Universal Error Tracking Provider
|
|
471
|
-
*
|
|
472
|
-
* Tracks all error types with a single provider
|
|
473
|
-
*/
|
|
474
|
-
declare function ErrorTrackingProvider({ children, validation: userValidationConfig, cors: userCorsConfig, network: userNetworkConfig, centrifugo: userCentrifugoConfig, onError, }: ErrorTrackingProviderProps): react_jsx_runtime.JSX.Element;
|
|
475
|
-
/**
|
|
476
|
-
* useErrors Hook
|
|
477
|
-
*
|
|
478
|
-
* Access errors from any component
|
|
479
|
-
*
|
|
480
|
-
* @example
|
|
481
|
-
* ```tsx
|
|
482
|
-
* function ErrorPanel() {
|
|
483
|
-
* const { errors, validationErrors, clearErrors } = useErrors();
|
|
484
|
-
*
|
|
485
|
-
* return (
|
|
486
|
-
* <div>
|
|
487
|
-
* <h3>Errors ({errors.length})</h3>
|
|
488
|
-
* <h4>Validation: {validationErrors.length}</h4>
|
|
489
|
-
* <button onClick={clearErrors}>Clear All</button>
|
|
490
|
-
* </div>
|
|
491
|
-
* );
|
|
492
|
-
* }
|
|
493
|
-
* ```
|
|
494
|
-
*/
|
|
495
|
-
declare function useErrors(): ErrorTrackingContextValue;
|
|
496
|
-
|
|
497
|
-
interface ErrorButtonsProps {
|
|
498
|
-
detail: ValidationErrorDetail | CORSErrorDetail | NetworkErrorDetail | CentrifugoErrorDetail;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Universal error buttons
|
|
502
|
-
*/
|
|
503
|
-
declare function ErrorButtons({ detail }: ErrorButtonsProps): react_jsx_runtime.JSX.Element;
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* ErrorToast - Universal toast for all error types
|
|
507
|
-
*
|
|
508
|
-
* Formats validation, CORS, and network errors with appropriate styling
|
|
509
|
-
*/
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Create toast options for any error type
|
|
513
|
-
*/
|
|
514
|
-
declare function createErrorToast(detail: ValidationErrorDetail | CORSErrorDetail | NetworkErrorDetail | CentrifugoErrorDetail, config: Required<ValidationErrorConfig | CORSErrorConfig | NetworkErrorConfig | CentrifugoErrorConfig>): {
|
|
515
|
-
title: string;
|
|
516
|
-
description: React.ReactNode;
|
|
517
|
-
variant: "destructive";
|
|
518
|
-
duration: number;
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Error Formatters
|
|
523
|
-
*
|
|
524
|
-
* Format different error types for display and copying
|
|
525
|
-
*/
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Format Zod error issues for display
|
|
529
|
-
*/
|
|
530
|
-
declare function formatZodIssues(error: ZodError, maxIssues?: number): string;
|
|
531
|
-
/**
|
|
532
|
-
* Format validation error for clipboard
|
|
533
|
-
*/
|
|
534
|
-
declare function formatValidationErrorForClipboard(detail: ValidationErrorDetail): string;
|
|
535
|
-
/**
|
|
536
|
-
* Format CORS error for clipboard
|
|
537
|
-
*/
|
|
538
|
-
declare function formatCORSErrorForClipboard(detail: CORSErrorDetail): string;
|
|
539
|
-
/**
|
|
540
|
-
* Format network error for clipboard
|
|
541
|
-
*/
|
|
542
|
-
declare function formatNetworkErrorForClipboard(detail: NetworkErrorDetail): string;
|
|
543
|
-
/**
|
|
544
|
-
* Format centrifugo error for clipboard
|
|
545
|
-
*/
|
|
546
|
-
declare function formatCentrifugoErrorForClipboard(detail: CentrifugoErrorDetail): string;
|
|
547
|
-
/**
|
|
548
|
-
* Extract domain from URL
|
|
549
|
-
*/
|
|
550
|
-
declare function extractDomain(url: string): string;
|
|
551
|
-
/**
|
|
552
|
-
* Format error title based on type
|
|
553
|
-
*/
|
|
554
|
-
declare function formatErrorTitle(detail: ValidationErrorDetail | CORSErrorDetail | NetworkErrorDetail | CentrifugoErrorDetail): string;
|
|
555
|
-
|
|
556
|
-
interface CurlOptions {
|
|
557
|
-
method: string;
|
|
558
|
-
path: string;
|
|
559
|
-
token?: string;
|
|
560
|
-
body?: any;
|
|
561
|
-
headers?: Record<string, string>;
|
|
562
|
-
baseUrl?: string;
|
|
563
|
-
queryParams?: Record<string, string>;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Get authentication token from localStorage
|
|
567
|
-
*/
|
|
568
|
-
declare function getAuthToken(): string | null;
|
|
569
|
-
/**
|
|
570
|
-
* Generate cURL command from request details
|
|
571
|
-
*/
|
|
572
|
-
declare function generateCurl(options: CurlOptions): string;
|
|
573
|
-
/**
|
|
574
|
-
* Generate cURL from validation error details
|
|
575
|
-
* Auto-fetches token from localStorage
|
|
576
|
-
*/
|
|
577
|
-
declare function generateCurlFromError(detail: {
|
|
578
|
-
method: string;
|
|
579
|
-
path: string;
|
|
580
|
-
response?: any;
|
|
581
|
-
}): string;
|
|
582
|
-
|
|
583
|
-
export { type CORSErrorConfig, type CORSErrorDetail, type CentrifugoErrorConfig, type CentrifugoErrorDetail, ClientOnly, type ClientOnlyProps, type CurlOptions, ERROR_CODES, ErrorBoundary, type ErrorBoundaryConfig, ErrorButtons, type ErrorContent, type ErrorDetail, ErrorLayout, type ErrorLayoutProps, type ErrorTrackingConfig, type ErrorTrackingContextValue, ErrorTrackingProvider, JsonLd, LucideIcon, type LucideIconProps, type NetworkErrorConfig, type NetworkErrorDetail, RedirectPage, type RedirectPageProps, type StoredError, Suspense, type ValidationErrorConfig, type ValidationErrorDetail, createErrorToast, extractDomain, formatCORSErrorForClipboard, formatCentrifugoErrorForClipboard, formatErrorTitle, formatNetworkErrorForClipboard, formatValidationErrorForClipboard, formatZodIssues, generateCurl, generateCurlFromError, getAuthToken, getErrorContent, useErrors };
|