@djangocfg/layouts 2.1.10 → 2.1.15
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 +53 -161
- package/package.json +6 -6
- package/src/components/RedirectPage/RedirectPage.tsx +1 -1
- package/src/index.ts +0 -6
- package/src/layouts/AppLayout/AppLayout.tsx +1 -1
- package/src/layouts/AppLayout/BaseApp.tsx +1 -1
- package/src/layouts/AuthLayout/AuthContext.tsx +1 -1
- package/src/layouts/AuthLayout/OAuthCallback.tsx +1 -1
- package/src/layouts/AuthLayout/OAuthProviders.tsx +1 -1
- package/src/layouts/PrivateLayout/PrivateLayout.tsx +1 -1
- package/src/layouts/PrivateLayout/components/PrivateHeader.tsx +1 -1
- package/src/layouts/ProfileLayout/ProfileLayout.tsx +2 -2
- package/src/layouts/ProfileLayout/components/AvatarSection.tsx +2 -2
- package/src/layouts/ProfileLayout/components/ProfileForm.tsx +2 -2
- package/src/layouts/PublicLayout/components/PublicMobileDrawer.tsx +1 -1
- package/src/layouts/PublicLayout/components/PublicNavigation.tsx +1 -1
- package/src/layouts/_components/UserMenu.tsx +1 -1
- package/src/layouts/index.ts +0 -2
- package/src/snippets/Analytics/useAnalytics.ts +1 -1
- package/src/snippets/index.ts +0 -3
- package/src/auth/README.md +0 -962
- package/src/auth/context/AccountsContext.tsx +0 -240
- package/src/auth/context/AuthContext.tsx +0 -604
- package/src/auth/context/index.ts +0 -4
- package/src/auth/context/types.ts +0 -68
- package/src/auth/hooks/index.ts +0 -17
- package/src/auth/hooks/useAuthForm.ts +0 -332
- package/src/auth/hooks/useAuthGuard.ts +0 -25
- package/src/auth/hooks/useAuthRedirect.ts +0 -51
- package/src/auth/hooks/useAutoAuth.ts +0 -49
- package/src/auth/hooks/useGithubAuth.ts +0 -184
- package/src/auth/hooks/useLocalStorage.ts +0 -214
- package/src/auth/hooks/useProfileCache.ts +0 -146
- package/src/auth/hooks/useSessionStorage.ts +0 -189
- package/src/auth/index.ts +0 -10
- package/src/auth/middlewares/index.ts +0 -1
- package/src/auth/middlewares/proxy.ts +0 -32
- package/src/auth/server.ts +0 -6
- package/src/auth/utils/errors.ts +0 -34
- package/src/auth/utils/index.ts +0 -2
- package/src/auth/utils/validation.ts +0 -14
- package/src/contexts/LeadsContext.tsx +0 -156
- package/src/contexts/NewsletterContext.tsx +0 -263
- package/src/contexts/SupportContext.tsx +0 -256
- package/src/contexts/index.ts +0 -59
- package/src/contexts/knowbase/ChatContext.tsx +0 -174
- package/src/contexts/knowbase/DocumentsContext.tsx +0 -304
- package/src/contexts/knowbase/SessionsContext.tsx +0 -174
- package/src/contexts/knowbase/index.ts +0 -61
- package/src/contexts/payments/BalancesContext.tsx +0 -65
- package/src/contexts/payments/CurrenciesContext.tsx +0 -66
- package/src/contexts/payments/OverviewContext.tsx +0 -174
- package/src/contexts/payments/PaymentsContext.tsx +0 -132
- package/src/contexts/payments/README.md +0 -201
- package/src/contexts/payments/RootPaymentsContext.tsx +0 -68
- package/src/contexts/payments/index.ts +0 -50
- package/src/layouts/PaymentsLayout/PaymentsLayout.tsx +0 -92
- package/src/layouts/PaymentsLayout/components/CreatePaymentDialog.tsx +0 -291
- package/src/layouts/PaymentsLayout/components/PaymentDetailsDialog.tsx +0 -290
- package/src/layouts/PaymentsLayout/components/index.ts +0 -2
- package/src/layouts/PaymentsLayout/events.ts +0 -47
- package/src/layouts/PaymentsLayout/index.ts +0 -16
- package/src/layouts/PaymentsLayout/types.ts +0 -6
- package/src/layouts/PaymentsLayout/views/overview/components/BalanceCard.tsx +0 -128
- package/src/layouts/PaymentsLayout/views/overview/components/RecentPayments.tsx +0 -142
- package/src/layouts/PaymentsLayout/views/overview/components/index.ts +0 -2
- package/src/layouts/PaymentsLayout/views/overview/index.tsx +0 -20
- package/src/layouts/PaymentsLayout/views/payments/components/PaymentsList.tsx +0 -276
- package/src/layouts/PaymentsLayout/views/payments/components/index.ts +0 -1
- package/src/layouts/PaymentsLayout/views/payments/index.tsx +0 -17
- package/src/layouts/PaymentsLayout/views/transactions/components/TransactionsList.tsx +0 -273
- package/src/layouts/PaymentsLayout/views/transactions/components/index.ts +0 -1
- package/src/layouts/PaymentsLayout/views/transactions/index.tsx +0 -17
- package/src/layouts/SupportLayout/README.md +0 -91
- package/src/layouts/SupportLayout/SupportLayout.tsx +0 -179
- package/src/layouts/SupportLayout/components/CreateTicketDialog.tsx +0 -155
- package/src/layouts/SupportLayout/components/MessageInput.tsx +0 -92
- package/src/layouts/SupportLayout/components/MessageList.tsx +0 -314
- package/src/layouts/SupportLayout/components/TicketCard.tsx +0 -96
- package/src/layouts/SupportLayout/components/TicketList.tsx +0 -153
- package/src/layouts/SupportLayout/components/index.ts +0 -6
- package/src/layouts/SupportLayout/context/SupportLayoutContext.tsx +0 -263
- package/src/layouts/SupportLayout/context/index.ts +0 -2
- package/src/layouts/SupportLayout/events.ts +0 -33
- package/src/layouts/SupportLayout/hooks/index.ts +0 -2
- package/src/layouts/SupportLayout/hooks/useInfiniteMessages.ts +0 -119
- package/src/layouts/SupportLayout/hooks/useInfiniteTickets.ts +0 -92
- package/src/layouts/SupportLayout/index.ts +0 -8
- package/src/layouts/SupportLayout/types.ts +0 -21
- package/src/snippets/Chat/ChatUIContext.tsx +0 -110
- package/src/snippets/Chat/ChatWidget.tsx +0 -476
- package/src/snippets/Chat/README.md +0 -122
- package/src/snippets/Chat/components/MessageInput.tsx +0 -124
- package/src/snippets/Chat/components/MessageList.tsx +0 -169
- package/src/snippets/Chat/components/SessionList.tsx +0 -192
- package/src/snippets/Chat/components/index.ts +0 -9
- package/src/snippets/Chat/hooks/index.ts +0 -6
- package/src/snippets/Chat/hooks/useInfiniteSessions.ts +0 -82
- package/src/snippets/Chat/index.tsx +0 -45
- package/src/snippets/Chat/types.ts +0 -80
- package/src/snippets/ContactForm/ContactForm.tsx +0 -346
- package/src/snippets/ContactForm/ContactFormProvider.tsx +0 -153
- package/src/snippets/ContactForm/ContactInfo.tsx +0 -114
- package/src/snippets/ContactForm/ContactPage.tsx +0 -131
- package/src/snippets/ContactForm/dynamic.tsx +0 -55
- package/src/snippets/ContactForm/index.ts +0 -34
- package/src/snippets/ContactForm/types.ts +0 -110
package/README.md
CHANGED
|
@@ -37,10 +37,12 @@ export default function RootLayout({ children }) {
|
|
|
37
37
|
- ThemeProvider (light/dark/system)
|
|
38
38
|
- TooltipProvider
|
|
39
39
|
- SWRConfig
|
|
40
|
-
- AuthProvider
|
|
40
|
+
- AuthProvider (from `@djangocfg/api`)
|
|
41
41
|
- ErrorTrackingProvider
|
|
42
42
|
- Toaster + PageProgress
|
|
43
43
|
|
|
44
|
+
> **Note:** Auth functionality is provided by `@djangocfg/api` package. See [@djangocfg/api documentation](../api/README.md) for auth usage.
|
|
45
|
+
|
|
44
46
|
### AppLayout
|
|
45
47
|
|
|
46
48
|
Smart layout router built on BaseApp - automatically selects layout based on route:
|
|
@@ -80,7 +82,7 @@ export default function RootLayout({ children }) {
|
|
|
80
82
|
|
|
81
83
|
Simple, props-based layout components. No complex configs needed!
|
|
82
84
|
|
|
83
|
-
###
|
|
85
|
+
### Available Layouts
|
|
84
86
|
|
|
85
87
|
```tsx
|
|
86
88
|
import { PublicLayout, PrivateLayout, AuthLayout } from '@djangocfg/layouts';
|
|
@@ -121,105 +123,10 @@ import { PublicLayout, PrivateLayout, AuthLayout } from '@djangocfg/layouts';
|
|
|
121
123
|
| `AuthLayout` | Authentication pages (login, signup, password reset) |
|
|
122
124
|
| `AdminLayout` | Admin panel layout |
|
|
123
125
|
| `ProfileLayout` | User profile pages |
|
|
124
|
-
| `SupportLayout` | Support/help pages with ticket system |
|
|
125
|
-
| `PaymentsLayout` | Payment flows and billing |
|
|
126
|
-
|
|
127
|
-
## Auth
|
|
128
|
-
|
|
129
|
-
Complete authentication system with OTP and OAuth support.
|
|
130
|
-
|
|
131
|
-
```tsx
|
|
132
|
-
import { AuthProvider, useAuth } from '@djangocfg/layouts/auth';
|
|
133
|
-
import { AuthLayout, OAuthCallback } from '@djangocfg/layouts';
|
|
134
126
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
enableGithubAuth={true}
|
|
139
|
-
termsUrl="/legal/terms"
|
|
140
|
-
privacyUrl="/legal/privacy"
|
|
141
|
-
>
|
|
142
|
-
<h1>Welcome Back</h1>
|
|
143
|
-
</AuthLayout>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
| Export | Description |
|
|
147
|
-
|--------|-------------|
|
|
148
|
-
| `AuthProvider` | Auth context provider |
|
|
149
|
-
| `useAuth` | Auth hook (user, login, logout) |
|
|
150
|
-
| `useAuthGuard` | Route protection hook |
|
|
151
|
-
| `useAuthRedirect` | Redirect hook for auth flows |
|
|
152
|
-
| `useAutoAuth` | Auto-authentication hook |
|
|
153
|
-
| `useGithubAuth` | GitHub OAuth hook |
|
|
154
|
-
| `authMiddleware` | Next.js middleware |
|
|
155
|
-
|
|
156
|
-
### GitHub OAuth
|
|
157
|
-
|
|
158
|
-
Complete GitHub OAuth flow with automatic token handling:
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
// app/auth/page.tsx
|
|
162
|
-
import { AuthLayout } from '@djangocfg/layouts';
|
|
163
|
-
|
|
164
|
-
export default function AuthPage() {
|
|
165
|
-
return (
|
|
166
|
-
<AuthLayout
|
|
167
|
-
enableGithubAuth={true}
|
|
168
|
-
redirectUrl="/dashboard"
|
|
169
|
-
onOAuthSuccess={(user, isNewUser, provider) => console.log('Success!', user)}
|
|
170
|
-
onError={(error) => console.error(error)}
|
|
171
|
-
>
|
|
172
|
-
<h1>Sign In</h1>
|
|
173
|
-
</AuthLayout>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**OAuth Flow:**
|
|
179
|
-
1. User clicks "Continue with GitHub"
|
|
180
|
-
2. Redirects to GitHub authorization page
|
|
181
|
-
3. GitHub redirects to `/auth?provider=github&code=XXX&state=YYY`
|
|
182
|
-
4. `AuthLayout` automatically handles callback and exchanges code for JWT tokens
|
|
183
|
-
5. User is logged in and redirected to `redirectUrl`
|
|
184
|
-
|
|
185
|
-
> **Note:** OAuth callback handling is built into `AuthLayout` when `enableGithubAuth={true}`. No need to add `OAuthCallback` separately!
|
|
186
|
-
|
|
187
|
-
**Using the hook directly:**
|
|
188
|
-
|
|
189
|
-
```tsx
|
|
190
|
-
import { useGithubAuth } from '@djangocfg/layouts';
|
|
191
|
-
|
|
192
|
-
function CustomGithubButton() {
|
|
193
|
-
const { isLoading, startGithubAuth } = useGithubAuth({
|
|
194
|
-
onSuccess: (user) => console.log('Logged in!', user),
|
|
195
|
-
onError: (error) => console.error(error),
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<button onClick={startGithubAuth} disabled={isLoading}>
|
|
200
|
-
{isLoading ? 'Connecting...' : 'Login with GitHub'}
|
|
201
|
-
</button>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Auth Context
|
|
207
|
-
|
|
208
|
-
```tsx
|
|
209
|
-
import { AccountsProvider, useAccountsContext } from '@djangocfg/layouts/auth/context';
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Auth Hooks
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
import {
|
|
216
|
-
useAuthForm,
|
|
217
|
-
useAuthGuard,
|
|
218
|
-
useAuthRedirect,
|
|
219
|
-
useAutoAuth,
|
|
220
|
-
useProfileCache
|
|
221
|
-
} from '@djangocfg/layouts/auth/hooks';
|
|
222
|
-
```
|
|
127
|
+
> **Extension Layouts:** Additional layouts like `SupportLayout` and `PaymentsLayout` are available in extension packages:
|
|
128
|
+
> - `@djangocfg/ext-support` - Support ticket layouts
|
|
129
|
+
> - `@djangocfg/ext-payments` - Payment flow layouts
|
|
223
130
|
|
|
224
131
|
## Analytics
|
|
225
132
|
|
|
@@ -263,7 +170,7 @@ Analytics.setUser('user-123');
|
|
|
263
170
|
|
|
264
171
|
| Category | Events |
|
|
265
172
|
|----------|--------|
|
|
266
|
-
| **Auth** | `
|
|
173
|
+
| **Auth** | `AUTH_LOGIN_SUCCESS`, `AUTH_LOGOUT`, `AUTH_SESSION_EXPIRED`, `AUTH_TOKEN_REFRESH` |
|
|
267
174
|
| **OAuth** | `AUTH_OAUTH_START`, `AUTH_OAUTH_SUCCESS`, `AUTH_OAUTH_FAIL` |
|
|
268
175
|
| **Error** | `ERROR_BOUNDARY`, `ERROR_API`, `ERROR_VALIDATION`, `ERROR_NETWORK` |
|
|
269
176
|
| **Navigation** | `NAV_ADMIN_ENTER`, `NAV_DASHBOARD_ENTER`, `NAV_PAGE_VIEW` |
|
|
@@ -274,7 +181,7 @@ Analytics.setUser('user-123');
|
|
|
274
181
|
Built-in tracking for:
|
|
275
182
|
- **Page views** - on every route change
|
|
276
183
|
- **User ID** - automatically set when user is authenticated
|
|
277
|
-
- **Auth events** - login, logout,
|
|
184
|
+
- **Auth events** - login, logout, session expiry (from `@djangocfg/api`)
|
|
278
185
|
- **OAuth events** - GitHub OAuth start, success, failure
|
|
279
186
|
- **Errors** - React ErrorBoundary errors
|
|
280
187
|
|
|
@@ -283,13 +190,9 @@ Built-in tracking for:
|
|
|
283
190
|
Reusable UI components ready to use.
|
|
284
191
|
|
|
285
192
|
```tsx
|
|
286
|
-
import {
|
|
287
|
-
Breadcrumbs,
|
|
288
|
-
AuthDialog,
|
|
289
|
-
ContactForm,
|
|
290
|
-
ContactPage,
|
|
291
|
-
KnowledgeChat,
|
|
292
|
-
ChatWidget
|
|
193
|
+
import {
|
|
194
|
+
Breadcrumbs,
|
|
195
|
+
AuthDialog,
|
|
293
196
|
} from '@djangocfg/layouts/snippets';
|
|
294
197
|
```
|
|
295
198
|
|
|
@@ -297,13 +200,13 @@ import {
|
|
|
297
200
|
|---------|-------------|
|
|
298
201
|
| `Breadcrumbs` | Navigation breadcrumbs with automatic path generation |
|
|
299
202
|
| `AuthDialog` | Auth modal (login/register) with event-based triggers |
|
|
300
|
-
| `ContactForm` | Contact form with API integration and validation |
|
|
301
|
-
| `ContactPage` | Complete contact page with form and info cards |
|
|
302
|
-
| `ContactInfo` | Contact details card component |
|
|
303
|
-
| `KnowledgeChat` | AI-powered chat widget with knowledge base |
|
|
304
|
-
| `ChatWidget` | Chat widget component |
|
|
305
203
|
| `AnalyticsProvider` | Analytics wrapper component |
|
|
306
204
|
|
|
205
|
+
> **Extension Snippets:** Additional components are available in extension packages:
|
|
206
|
+
> - `@djangocfg/ext-leads` - ContactForm, ContactPage, ContactInfo
|
|
207
|
+
> - `@djangocfg/ext-knowbase` - KnowledgeChat, ChatWidget, ChatUIProvider
|
|
208
|
+
> - `@djangocfg/ext-newsletter` - Hero (with newsletter subscription)
|
|
209
|
+
|
|
307
210
|
### Breadcrumbs
|
|
308
211
|
|
|
309
212
|
```tsx
|
|
@@ -321,29 +224,6 @@ import Breadcrumbs from '@djangocfg/layouts/snippets';
|
|
|
321
224
|
/>
|
|
322
225
|
```
|
|
323
226
|
|
|
324
|
-
### ContactPage
|
|
325
|
-
|
|
326
|
-
```tsx
|
|
327
|
-
import { ContactPage } from '@djangocfg/layouts/snippets';
|
|
328
|
-
|
|
329
|
-
// Minimal - all defaults configured
|
|
330
|
-
<ContactPage />
|
|
331
|
-
|
|
332
|
-
// Custom
|
|
333
|
-
<ContactPage
|
|
334
|
-
apiUrl="https://api.example.com"
|
|
335
|
-
email="hello@example.com"
|
|
336
|
-
calendlyUrl="https://calendly.com/..."
|
|
337
|
-
/>
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
**Features:**
|
|
341
|
-
- localStorage draft saving
|
|
342
|
-
- Success state with icon
|
|
343
|
-
- Zod validation from `@djangocfg/api`
|
|
344
|
-
- Contact info cards (Email, WhatsApp, Location)
|
|
345
|
-
- Optional Calendly integration
|
|
346
|
-
|
|
347
227
|
### AuthDialog
|
|
348
228
|
|
|
349
229
|
```tsx
|
|
@@ -356,16 +236,6 @@ import { AuthDialog, openAuthDialog } from '@djangocfg/layouts/snippets';
|
|
|
356
236
|
openAuthDialog({ message: 'Sign in to continue' });
|
|
357
237
|
```
|
|
358
238
|
|
|
359
|
-
### Chat Widget
|
|
360
|
-
|
|
361
|
-
```tsx
|
|
362
|
-
import { ChatWidget, ChatUIProvider, useChatUI } from '@djangocfg/layouts/snippets';
|
|
363
|
-
|
|
364
|
-
<ChatUIProvider>
|
|
365
|
-
<ChatWidget />
|
|
366
|
-
</ChatUIProvider>
|
|
367
|
-
```
|
|
368
|
-
|
|
369
239
|
## Components
|
|
370
240
|
|
|
371
241
|
Utility components organized by category.
|
|
@@ -373,8 +243,8 @@ Utility components organized by category.
|
|
|
373
243
|
### Core Components
|
|
374
244
|
|
|
375
245
|
```tsx
|
|
376
|
-
import {
|
|
377
|
-
JsonLd,
|
|
246
|
+
import {
|
|
247
|
+
JsonLd,
|
|
378
248
|
LucideIcon,
|
|
379
249
|
PageProgress,
|
|
380
250
|
Suspense
|
|
@@ -391,7 +261,7 @@ import {
|
|
|
391
261
|
### Error Components
|
|
392
262
|
|
|
393
263
|
```tsx
|
|
394
|
-
import {
|
|
264
|
+
import {
|
|
395
265
|
ErrorBoundary,
|
|
396
266
|
ErrorLayout,
|
|
397
267
|
getErrorContent,
|
|
@@ -445,8 +315,8 @@ export default function Page() {
|
|
|
445
315
|
### Error Tracking
|
|
446
316
|
|
|
447
317
|
```tsx
|
|
448
|
-
import {
|
|
449
|
-
ErrorTrackingProvider,
|
|
318
|
+
import {
|
|
319
|
+
ErrorTrackingProvider,
|
|
450
320
|
useErrors,
|
|
451
321
|
ErrorButtons,
|
|
452
322
|
ErrorToast
|
|
@@ -477,11 +347,11 @@ Ready-to-use page components.
|
|
|
477
347
|
Pre-built legal page components with default configurations.
|
|
478
348
|
|
|
479
349
|
```tsx
|
|
480
|
-
import {
|
|
481
|
-
PrivacyPage,
|
|
482
|
-
TermsPage,
|
|
483
|
-
CookiesPage,
|
|
484
|
-
SecurityPage
|
|
350
|
+
import {
|
|
351
|
+
PrivacyPage,
|
|
352
|
+
TermsPage,
|
|
353
|
+
CookiesPage,
|
|
354
|
+
SecurityPage
|
|
485
355
|
} from '@djangocfg/layouts/pages/legal';
|
|
486
356
|
|
|
487
357
|
// app/legal/privacy/page.tsx
|
|
@@ -510,7 +380,7 @@ export default function CustomPrivacy() {
|
|
|
510
380
|
Utility functions and helpers.
|
|
511
381
|
|
|
512
382
|
```tsx
|
|
513
|
-
import {
|
|
383
|
+
import {
|
|
514
384
|
generateOgImageUrl,
|
|
515
385
|
getAbsoluteOgImageUrl,
|
|
516
386
|
createOgImageUrlBuilder
|
|
@@ -536,9 +406,6 @@ const ogUrl = generateOgImageUrl('/api/og', {
|
|
|
536
406
|
|------|---------|
|
|
537
407
|
| `@djangocfg/layouts` | Main exports (all modules) |
|
|
538
408
|
| `@djangocfg/layouts/layouts` | Layout components |
|
|
539
|
-
| `@djangocfg/layouts/auth` | Auth context & hooks |
|
|
540
|
-
| `@djangocfg/layouts/auth/context` | Auth context only |
|
|
541
|
-
| `@djangocfg/layouts/auth/hooks` | Auth hooks only |
|
|
542
409
|
| `@djangocfg/layouts/snippets` | Reusable components + Analytics |
|
|
543
410
|
| `@djangocfg/layouts/components` | All utility components |
|
|
544
411
|
| `@djangocfg/layouts/pages` | Page components (legal pages) |
|
|
@@ -547,6 +414,22 @@ const ogUrl = generateOgImageUrl('/api/og', {
|
|
|
547
414
|
| `@djangocfg/layouts/styles` | CSS |
|
|
548
415
|
| `@djangocfg/layouts/styles/dashboard` | Dashboard-specific CSS |
|
|
549
416
|
|
|
417
|
+
> **Auth Exports:** For authentication, use `@djangocfg/api/auth` - See [@djangocfg/api documentation](../api/README.md)
|
|
418
|
+
|
|
419
|
+
## Extension Packages
|
|
420
|
+
|
|
421
|
+
Additional functionality is available in extension packages:
|
|
422
|
+
|
|
423
|
+
| Extension | Package | Description |
|
|
424
|
+
|-----------|---------|-------------|
|
|
425
|
+
| **Newsletter** | `@djangocfg/ext-newsletter` | Newsletter subscription and campaigns |
|
|
426
|
+
| **Knowledge Base** | `@djangocfg/ext-knowbase` | Documentation, chat, RAG-powered AI |
|
|
427
|
+
| **Leads** | `@djangocfg/ext-leads` | Lead capture and contact forms |
|
|
428
|
+
| **Payments** | `@djangocfg/ext-payments` | Payment processing and subscriptions |
|
|
429
|
+
| **Support** | `@djangocfg/ext-support` | Support tickets and helpdesk |
|
|
430
|
+
|
|
431
|
+
Each extension has its own layouts, contexts, and components. See individual extension documentation for details.
|
|
432
|
+
|
|
550
433
|
## Requirements
|
|
551
434
|
|
|
552
435
|
- Next.js >= 15
|
|
@@ -564,6 +447,7 @@ This package follows a **simple, props-based approach**:
|
|
|
564
447
|
- ✅ **Type-safe** - full TypeScript support
|
|
565
448
|
- ✅ **Flexible** - compose layouts as needed
|
|
566
449
|
- ✅ **Production-ready** - built for real apps
|
|
450
|
+
- ✅ **Modular** - core layouts in one package, extensions separate
|
|
567
451
|
|
|
568
452
|
## Examples
|
|
569
453
|
|
|
@@ -653,3 +537,11 @@ export default function LoginPage() {
|
|
|
653
537
|
}
|
|
654
538
|
```
|
|
655
539
|
|
|
540
|
+
## License
|
|
541
|
+
|
|
542
|
+
MIT
|
|
543
|
+
|
|
544
|
+
## Links
|
|
545
|
+
|
|
546
|
+
- [DjangoCFG Documentation](https://djangocfg.com)
|
|
547
|
+
- [GitHub](https://github.com/markolofsen/django-cfg)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/layouts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
4
4
|
"description": "Simple, straightforward layout components for Next.js - import and use with props",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"layouts",
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
"check": "tsc --noEmit"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@djangocfg/api": "^2.1.
|
|
96
|
-
"@djangocfg/centrifugo": "^2.1.
|
|
97
|
-
"@djangocfg/ui-nextjs": "^2.1.
|
|
95
|
+
"@djangocfg/api": "^2.1.15",
|
|
96
|
+
"@djangocfg/centrifugo": "^2.1.15",
|
|
97
|
+
"@djangocfg/ui-nextjs": "^2.1.15",
|
|
98
98
|
"@hookform/resolvers": "^5.2.0",
|
|
99
99
|
"consola": "^3.4.2",
|
|
100
100
|
"lucide-react": "^0.545.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"react-dom": "^19.1.0",
|
|
105
105
|
"react-hook-form": "7.65.0",
|
|
106
106
|
"sonner": "2.0.7",
|
|
107
|
-
"swr": "^2.3.
|
|
107
|
+
"swr": "^2.3.7",
|
|
108
108
|
"tailwindcss": "^4.1.14",
|
|
109
109
|
"tailwindcss-animate": "^1.0.7",
|
|
110
110
|
"zod": "^4.1.13"
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"uuid": "^11.1.0"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
117
|
+
"@djangocfg/typescript-config": "^2.1.15",
|
|
118
118
|
"@types/node": "^24.7.2",
|
|
119
119
|
"@types/react": "^19.1.0",
|
|
120
120
|
"@types/react-dom": "^19.1.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
-
import { useAuth } from '
|
|
4
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
5
5
|
import { useCfgRouter } from '@djangocfg/ui-nextjs/hooks';
|
|
6
6
|
import { Preloader } from '@djangocfg/ui-nextjs/components';
|
|
7
7
|
|
package/src/index.ts
CHANGED
|
@@ -25,9 +25,6 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
// Auth system
|
|
29
|
-
export * from './auth';
|
|
30
|
-
|
|
31
28
|
// Layout components
|
|
32
29
|
export * from './layouts';
|
|
33
30
|
|
|
@@ -42,6 +39,3 @@ export * from './utils';
|
|
|
42
39
|
|
|
43
40
|
// Pages
|
|
44
41
|
export * from './pages';
|
|
45
|
-
|
|
46
|
-
// Contexts (API contexts for data management)
|
|
47
|
-
export * from './contexts';
|
|
@@ -40,7 +40,7 @@ import React, { ReactNode, useMemo } from 'react';
|
|
|
40
40
|
import { usePathname } from 'next/navigation';
|
|
41
41
|
import { CentrifugoProvider } from '@djangocfg/centrifugo';
|
|
42
42
|
import { ErrorBoundary } from '../../components/errors/ErrorBoundary';
|
|
43
|
-
import { type AuthConfig } from '
|
|
43
|
+
import { type AuthConfig } from '@djangocfg/api/auth';
|
|
44
44
|
import { type ValidationErrorConfig, type CORSErrorConfig, type NetworkErrorConfig } from '../../components/errors/ErrorsTracker';
|
|
45
45
|
import { AnalyticsProvider } from '../../snippets/Analytics';
|
|
46
46
|
import { Suspense, ClientOnly } from '../../components/core';
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { ReactNode } from 'react';
|
|
27
27
|
import { SWRConfig } from 'swr';
|
|
28
28
|
import { ThemeProvider, Toaster, TooltipProvider } from '@djangocfg/ui-nextjs';
|
|
29
|
-
import { AuthProvider, type AuthConfig } from '
|
|
29
|
+
import { AuthProvider, type AuthConfig } from '@djangocfg/api/auth';
|
|
30
30
|
import { ErrorTrackingProvider, type ValidationErrorConfig, type CORSErrorConfig, type NetworkErrorConfig } from '../../components/errors/ErrorsTracker';
|
|
31
31
|
import { PageProgress } from '../../components/core/PageProgress';
|
|
32
32
|
|
|
@@ -6,7 +6,7 @@ import { Loader2, AlertCircle, CheckCircle } from 'lucide-react';
|
|
|
6
6
|
|
|
7
7
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@djangocfg/ui-nextjs/components';
|
|
8
8
|
|
|
9
|
-
import { useGithubAuth } from '
|
|
9
|
+
import { useGithubAuth } from '@djangocfg/api/auth';
|
|
10
10
|
|
|
11
11
|
export interface OAuthCallbackProps {
|
|
12
12
|
onSuccess?: (user: any, isNewUser: boolean, provider: string) => void;
|
|
@@ -5,7 +5,7 @@ import { Github, Loader2 } from 'lucide-react';
|
|
|
5
5
|
|
|
6
6
|
import { Button } from '@djangocfg/ui-nextjs/components';
|
|
7
7
|
|
|
8
|
-
import { useGithubAuth } from '
|
|
8
|
+
import { useGithubAuth } from '@djangocfg/api/auth';
|
|
9
9
|
import { useAuthContext } from './AuthContext';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
import React, { ReactNode } from 'react';
|
|
41
41
|
import { SidebarProvider, SidebarInset, Preloader, ButtonLink } from '@djangocfg/ui-nextjs/components';
|
|
42
|
-
import { useAuth } from '
|
|
42
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
43
43
|
import { PrivateSidebar, PrivateHeader, PrivateContent } from './components';
|
|
44
44
|
import type { LucideIcon as LucideIconType } from 'lucide-react';
|
|
45
45
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
SidebarTrigger,
|
|
15
15
|
} from '@djangocfg/ui-nextjs/components';
|
|
16
16
|
import { ThemeToggle } from '@djangocfg/ui-nextjs/theme';
|
|
17
|
-
import { useAuth } from '
|
|
17
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
18
18
|
import { UserMenu } from '../../_components/UserMenu';
|
|
19
19
|
import type { HeaderConfig } from '../PrivateLayout';
|
|
20
20
|
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
CardHeader,
|
|
11
11
|
CardTitle,
|
|
12
12
|
} from '@djangocfg/ui-nextjs/components';
|
|
13
|
-
import { AccountsProvider } from '@djangocfg/
|
|
14
|
-
import { useAuth } from '
|
|
13
|
+
import { AccountsProvider } from '@djangocfg/api/auth';
|
|
14
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
15
15
|
|
|
16
16
|
import { AvatarSection, ProfileForm } from './components';
|
|
17
17
|
|
|
@@ -5,8 +5,8 @@ import React, { useState } from 'react';
|
|
|
5
5
|
import { toast } from 'sonner';
|
|
6
6
|
|
|
7
7
|
import { Avatar, AvatarFallback, Button } from '@djangocfg/ui-nextjs/components';
|
|
8
|
-
import { useAccountsContext } from '@djangocfg/
|
|
9
|
-
import { useAuth } from '
|
|
8
|
+
import { useAccountsContext } from '@djangocfg/api/auth';
|
|
9
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
10
10
|
import { profileLogger } from '../../../utils/logger';
|
|
11
11
|
|
|
12
12
|
export const AvatarSection = () => {
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
useAccountsContext,
|
|
24
24
|
PatchedUserProfileUpdateRequestSchema,
|
|
25
25
|
type PatchedUserProfileUpdateRequest
|
|
26
|
-
} from '
|
|
27
|
-
import { useAuth } from '
|
|
26
|
+
} from '@djangocfg/api/auth';
|
|
27
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
28
28
|
|
|
29
29
|
export const ProfileForm = () => {
|
|
30
30
|
const { user } = useAuth();
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
Button,
|
|
19
19
|
} from '@djangocfg/ui-nextjs/components';
|
|
20
20
|
import { ThemeToggle } from '@djangocfg/ui-nextjs/theme';
|
|
21
|
-
import { useAuth } from '
|
|
21
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
22
22
|
import { UserMenu } from '../../_components/UserMenu';
|
|
23
23
|
import type { NavigationItem } from '../PublicLayout';
|
|
24
24
|
|
|
@@ -13,7 +13,7 @@ import { Button } from '@djangocfg/ui-nextjs/components';
|
|
|
13
13
|
import { ThemeToggle } from '@djangocfg/ui-nextjs/theme';
|
|
14
14
|
import { cn } from '@djangocfg/ui-nextjs/lib';
|
|
15
15
|
import { useIsMobile } from '@djangocfg/ui-nextjs/hooks';
|
|
16
|
-
import { useAuth } from '
|
|
16
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
17
17
|
import { UserMenu } from '../../_components/UserMenu';
|
|
18
18
|
import type { NavigationItem } from '../PublicLayout';
|
|
19
19
|
|
package/src/layouts/index.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { useEffect } from 'react';
|
|
12
12
|
import { usePathname } from 'next/navigation';
|
|
13
13
|
import ReactGA from 'react-ga4';
|
|
14
|
-
import { useAuth } from '
|
|
14
|
+
import { useAuth } from '@djangocfg/api/auth';
|
|
15
15
|
|
|
16
16
|
// Check if we're in production
|
|
17
17
|
const isProduction = process.env.NODE_ENV === 'production';
|
package/src/snippets/index.ts
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
// Snippets - Reusable UI Snippets
|
|
3
3
|
// ============================================================================
|
|
4
4
|
|
|
5
|
-
export { KnowledgeChat, ChatWidget, ChatUIProvider, useChatUI } from './Chat';
|
|
6
|
-
export type { ChatWidgetProps, ChatUIState } from './Chat';
|
|
7
5
|
|
|
8
6
|
export * from './Breadcrumbs';
|
|
9
7
|
export * from './AuthDialog';
|
|
10
|
-
export * from './ContactForm';
|
|
11
8
|
export * from './Analytics';
|
|
12
9
|
|
|
13
10
|
// MCP Chat (AI-powered documentation assistant)
|