@djangocfg/layouts 1.1.0 → 1.2.1
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": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Layout system and components for Unrealon applications",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "DjangoCFG",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"check": "tsc --noEmit"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@djangocfg/api": "^1.1
|
|
57
|
-
"@djangocfg/og-image": "^1.1
|
|
58
|
-
"@djangocfg/ui": "^1.1
|
|
56
|
+
"@djangocfg/api": "^1.2.1",
|
|
57
|
+
"@djangocfg/og-image": "^1.2.1",
|
|
58
|
+
"@djangocfg/ui": "^1.2.1",
|
|
59
59
|
"@hookform/resolvers": "^5.2.0",
|
|
60
60
|
"consola": "^3.4.2",
|
|
61
61
|
"lucide-react": "^0.468.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vidstack": "0.6.15"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@djangocfg/typescript-config": "^1.1
|
|
79
|
+
"@djangocfg/typescript-config": "^1.2.1",
|
|
80
80
|
"@types/node": "^24.7.2",
|
|
81
81
|
"@types/react": "19.2.2",
|
|
82
82
|
"@types/react-dom": "19.2.1",
|
|
@@ -89,8 +89,19 @@ function LayoutRouter({
|
|
|
89
89
|
// If forceLayout is specified, use it
|
|
90
90
|
if (forceLayout) return forceLayout;
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
const isAuthRoute = config.routes.detectors.isAuthRoute(router.pathname);
|
|
93
|
+
const isPrivateRoute = config.routes.detectors.isPrivateRoute(router.pathname);
|
|
94
|
+
// const isPublicRoute = config.routes.detectors.isPublicRoute(router.pathname);
|
|
95
|
+
|
|
96
|
+
if (isAuthRoute) return 'auth';
|
|
97
|
+
|
|
98
|
+
if (isPrivateRoute) {
|
|
99
|
+
if (isAuthenticated) {
|
|
100
|
+
return 'private';
|
|
101
|
+
};
|
|
102
|
+
return 'auth';
|
|
103
|
+
};
|
|
104
|
+
|
|
94
105
|
return 'public';
|
|
95
106
|
};
|
|
96
107
|
|
|
@@ -102,19 +113,17 @@ function LayoutRouter({
|
|
|
102
113
|
case 'public':
|
|
103
114
|
return <PublicLayout>{children}</PublicLayout>;
|
|
104
115
|
|
|
105
|
-
// Auth routes: render inside
|
|
116
|
+
// Auth routes: render inside AuthLayout
|
|
106
117
|
case 'auth':
|
|
107
118
|
return (
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</AuthLayout>
|
|
117
|
-
</PublicLayout>
|
|
119
|
+
<AuthLayout
|
|
120
|
+
termsUrl={config.auth?.termsUrl}
|
|
121
|
+
privacyUrl={config.auth?.privacyUrl}
|
|
122
|
+
supportUrl={config.auth?.supportUrl}
|
|
123
|
+
enablePhoneAuth={config.auth?.enablePhoneAuth}
|
|
124
|
+
>
|
|
125
|
+
{children}
|
|
126
|
+
</AuthLayout>
|
|
118
127
|
);
|
|
119
128
|
|
|
120
129
|
// Private routes: wait for client-side hydration and auth check
|
|
@@ -160,6 +169,8 @@ function LayoutRouter({
|
|
|
160
169
|
* ```
|
|
161
170
|
*/
|
|
162
171
|
export function AppLayout({ children, config, disableLayout = false, forceLayout, fontFamily }: AppLayoutProps) {
|
|
172
|
+
const router = useRouter();
|
|
173
|
+
|
|
163
174
|
// Check if ErrorBoundary is enabled (default: true)
|
|
164
175
|
const enableErrorBoundary = config.errors?.enableErrorBoundary !== false;
|
|
165
176
|
const supportEmail = config.errors?.supportEmail;
|
|
@@ -205,7 +216,11 @@ export function AppLayout({ children, config, disableLayout = false, forceLayout
|
|
|
205
216
|
// Wrap with ErrorBoundary if enabled
|
|
206
217
|
if (enableErrorBoundary) {
|
|
207
218
|
return (
|
|
208
|
-
<ErrorBoundary
|
|
219
|
+
<ErrorBoundary
|
|
220
|
+
key={router.pathname}
|
|
221
|
+
supportEmail={supportEmail}
|
|
222
|
+
onError={onError}
|
|
223
|
+
>
|
|
209
224
|
{content}
|
|
210
225
|
</ErrorBoundary>
|
|
211
226
|
);
|
|
@@ -7,10 +7,11 @@ import { OTPForm } from './OTPForm';
|
|
|
7
7
|
import type { AuthProps } from './types';
|
|
8
8
|
|
|
9
9
|
export const AuthLayout: React.FC<AuthProps> = (props) => {
|
|
10
|
+
|
|
10
11
|
return (
|
|
11
12
|
<AuthProvider {...props}>
|
|
12
13
|
<div
|
|
13
|
-
className={`flex flex-col items-center justify-center bg-background py-6 px-4 sm:py-12 sm:px-6 lg:px-8 ${props.className || ''}`}
|
|
14
|
+
className={`min-h-screen flex flex-col items-center justify-center bg-background py-6 px-4 sm:py-12 sm:px-6 lg:px-8 ${props.className || ''}`}
|
|
14
15
|
>
|
|
15
16
|
<div className="w-full sm:max-w-md space-y-8">
|
|
16
17
|
{props.children}
|
|
@@ -28,11 +29,11 @@ const AuthContent: React.FC = () => {
|
|
|
28
29
|
|
|
29
30
|
return (
|
|
30
31
|
<>
|
|
31
|
-
{error && (
|
|
32
|
+
{/* {error && (
|
|
32
33
|
<div className="bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-md">
|
|
33
34
|
{error}
|
|
34
35
|
</div>
|
|
35
|
-
)}
|
|
36
|
+
)} */}
|
|
36
37
|
|
|
37
38
|
<div>{step === 'identifier' ? <IdentifierForm /> : <OTPForm />}</div>
|
|
38
39
|
</>
|
|
@@ -101,15 +101,7 @@ export const IdentifierForm: React.FC = () => {
|
|
|
101
101
|
? 'Enter your phone number to receive a verification code via SMS'
|
|
102
102
|
: 'Enter your email address to receive a verification code';
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
const getChannelIcon = () => {
|
|
106
|
-
return localChannel === 'phone' ? (
|
|
107
|
-
<Phone className="w-5 h-5" />
|
|
108
|
-
) : (
|
|
109
|
-
<Mail className="w-5 h-5" />
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
|
|
104
|
+
|
|
113
105
|
return (
|
|
114
106
|
<Card className="w-full max-w-md mx-auto shadow-lg border border-border bg-card/50 backdrop-blur-sm">
|
|
115
107
|
<CardHeader className="text-center pb-6">
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Type definitions for RAG-powered chat widget
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ChatMessage
|
|
6
|
+
import type { ChatMessage, ChatSource } from '@djangocfg/api/cfg/contexts';
|
|
7
7
|
|
|
8
8
|
// ─────────────────────────────────────────────────────────────────────────
|
|
9
9
|
// Extended Message Type (for UI with sources)
|
|
10
10
|
// ─────────────────────────────────────────────────────────────────────────
|
|
11
11
|
|
|
12
|
-
export interface ChatMessageWithSources extends
|
|
12
|
+
export interface ChatMessageWithSources extends ChatMessage {
|
|
13
13
|
sources?: ChatSource[];
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -74,6 +74,5 @@ export interface SessionListProps {
|
|
|
74
74
|
// Re-export types from API
|
|
75
75
|
// ─────────────────────────────────────────────────────────────────────────
|
|
76
76
|
|
|
77
|
-
export type { ChatSource } from '@djangocfg/api/cfg/contexts';
|
|
78
|
-
export type { ChatMessage as BaseChatMessage } from '@djangocfg/api/cfg/contexts';
|
|
77
|
+
export type { ChatSource, ChatMessage } from '@djangocfg/api/cfg/contexts';
|
|
79
78
|
|