@djangocfg/layouts 2.0.4 → 2.0.6
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 +138 -20
- package/package.json +20 -5
- package/src/components/RedirectPage/RedirectPage.tsx +70 -0
- package/src/components/RedirectPage/index.ts +7 -0
- package/src/components/core/index.ts +10 -0
- package/src/components/errors/ErrorLayout.tsx +228 -0
- package/src/components/errors/errorConfig.ts +118 -0
- package/src/components/errors/index.ts +10 -0
- package/src/components/index.ts +13 -5
- package/src/contexts/LeadsContext.tsx +156 -0
- package/src/contexts/NewsletterContext.tsx +263 -0
- package/src/contexts/SupportContext.tsx +256 -0
- package/src/contexts/index.ts +59 -0
- package/src/contexts/knowbase/ChatContext.tsx +174 -0
- package/src/contexts/knowbase/DocumentsContext.tsx +304 -0
- package/src/contexts/knowbase/SessionsContext.tsx +174 -0
- package/src/contexts/knowbase/index.ts +61 -0
- package/src/contexts/payments/BalancesContext.tsx +65 -0
- package/src/contexts/payments/CurrenciesContext.tsx +66 -0
- package/src/contexts/payments/OverviewContext.tsx +174 -0
- package/src/contexts/payments/PaymentsContext.tsx +132 -0
- package/src/contexts/payments/README.md +201 -0
- package/src/contexts/payments/RootPaymentsContext.tsx +68 -0
- package/src/contexts/payments/index.ts +50 -0
- package/src/index.ts +8 -0
- package/src/layouts/AppLayout/AppLayout.tsx +24 -14
- package/src/layouts/PaymentsLayout/PaymentsLayout.tsx +1 -1
- package/src/layouts/PaymentsLayout/components/CreatePaymentDialog.tsx +1 -1
- package/src/layouts/PaymentsLayout/views/overview/components/BalanceCard.tsx +1 -1
- package/src/layouts/PaymentsLayout/views/overview/components/RecentPayments.tsx +1 -1
- package/src/layouts/PaymentsLayout/views/transactions/components/TransactionsList.tsx +1 -1
- package/src/layouts/ProfileLayout/components/ProfileForm.tsx +1 -1
- package/src/layouts/SupportLayout/SupportLayout.tsx +1 -1
- package/src/layouts/SupportLayout/components/TicketCard.tsx +1 -1
- package/src/layouts/SupportLayout/context/SupportLayoutContext.tsx +1 -1
- package/src/layouts/SupportLayout/index.ts +2 -0
- package/src/layouts/SupportLayout/types.ts +2 -4
- package/src/pages/index.ts +6 -0
- package/src/pages/legal/LegalPage.tsx +85 -0
- package/src/pages/legal/configs.ts +131 -0
- package/src/pages/legal/index.ts +24 -0
- package/src/pages/legal/pages.tsx +58 -0
- package/src/pages/legal/types.ts +15 -0
- package/src/snippets/Chat/ChatWidget.tsx +1 -1
- package/src/snippets/Chat/components/SessionList.tsx +1 -1
- package/src/snippets/Chat/index.tsx +1 -1
- package/src/snippets/Chat/types.ts +7 -5
- package/src/snippets/ContactForm/ContactForm.tsx +20 -8
- package/src/utils/index.ts +1 -0
- package/src/utils/og-image.ts +169 -0
- /package/src/components/{JsonLd.tsx → core/JsonLd.tsx} +0 -0
- /package/src/components/{LucideIcon.tsx → core/LucideIcon.tsx} +0 -0
- /package/src/components/{PageProgress.tsx → core/PageProgress.tsx} +0 -0
- /package/src/components/{Suspense.tsx → core/Suspense.tsx} +0 -0
- /package/src/components/{ErrorBoundary.tsx → errors/ErrorBoundary.tsx} +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/README.md +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/components/ErrorButtons.tsx +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/components/ErrorToast.tsx +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/hooks.ts +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/index.ts +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/providers/ErrorTrackingProvider.tsx +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/types.ts +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/utils/curl-generator.ts +0 -0
- /package/src/components/{ErrorsTracker → errors/ErrorsTracker}/utils/formatters.ts +0 -0
|
@@ -38,15 +38,16 @@
|
|
|
38
38
|
|
|
39
39
|
import React, { ReactNode, useMemo } from 'react';
|
|
40
40
|
import { usePathname } from 'next/navigation';
|
|
41
|
+
import { SWRConfig } from 'swr';
|
|
41
42
|
import { ThemeProvider, Toaster } from '@djangocfg/ui';
|
|
42
43
|
import { CentrifugoProvider } from '@djangocfg/centrifugo';
|
|
43
|
-
import { ErrorBoundary } from '../../components/ErrorBoundary';
|
|
44
|
+
import { ErrorBoundary } from '../../components/errors/ErrorBoundary';
|
|
44
45
|
import { AuthProvider, type AuthConfig } from '../../auth/context';
|
|
45
|
-
import { ErrorTrackingProvider, type ValidationErrorConfig, type CORSErrorConfig, type NetworkErrorConfig } from '../../components/ErrorsTracker';
|
|
46
|
+
import { ErrorTrackingProvider, type ValidationErrorConfig, type CORSErrorConfig, type NetworkErrorConfig } from '../../components/errors/ErrorsTracker';
|
|
46
47
|
import { AnalyticsProvider } from '../../snippets/Analytics';
|
|
47
|
-
import { PageProgress } from '../../components/PageProgress';
|
|
48
|
+
import { PageProgress } from '../../components/core/PageProgress';
|
|
48
49
|
import { UpdateNotifier } from '../../components/UpdateNotifier';
|
|
49
|
-
import { Suspense } from '../../components';
|
|
50
|
+
import { Suspense } from '../../components/core';
|
|
50
51
|
|
|
51
52
|
export type LayoutMode = 'public' | 'private' | 'admin';
|
|
52
53
|
|
|
@@ -295,16 +296,25 @@ export function AppLayout(props: AppLayoutProps) {
|
|
|
295
296
|
defaultTheme={getResolvedTheme()}
|
|
296
297
|
storageKey={theme?.storageKey}
|
|
297
298
|
>
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
299
|
+
<SWRConfig
|
|
300
|
+
value={{
|
|
301
|
+
// Default SWR configuration
|
|
302
|
+
revalidateOnFocus: true,
|
|
303
|
+
revalidateOnReconnect: true,
|
|
304
|
+
dedupingInterval: 2000,
|
|
305
|
+
}}
|
|
306
|
+
>
|
|
307
|
+
<AuthProvider config={auth}>
|
|
308
|
+
<ErrorTrackingProvider
|
|
309
|
+
validation={errorTracking?.validation}
|
|
310
|
+
cors={errorTracking?.cors}
|
|
311
|
+
network={errorTracking?.network}
|
|
312
|
+
onError={errorTracking?.onError}
|
|
313
|
+
>
|
|
314
|
+
<AppLayoutContent {...props} />
|
|
315
|
+
</ErrorTrackingProvider>
|
|
316
|
+
</AuthProvider>
|
|
317
|
+
</SWRConfig>
|
|
308
318
|
</ThemeProvider>
|
|
309
319
|
);
|
|
310
320
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
PaymentsProvider,
|
|
14
14
|
OverviewProvider,
|
|
15
15
|
RootPaymentsProvider,
|
|
16
|
-
} from '@djangocfg/
|
|
16
|
+
} from '@djangocfg/layouts/contexts';
|
|
17
17
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@djangocfg/ui';
|
|
18
18
|
import { Wallet, CreditCard, History } from 'lucide-react';
|
|
19
19
|
import { OverviewView } from './views/overview';
|
|
@@ -34,7 +34,7 @@ import { Plus, RefreshCw } from 'lucide-react';
|
|
|
34
34
|
import { useForm } from 'react-hook-form';
|
|
35
35
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
36
36
|
import { z } from 'zod';
|
|
37
|
-
import { usePaymentsContext, useRootPaymentsContext } from '@djangocfg/
|
|
37
|
+
import { usePaymentsContext, useRootPaymentsContext } from '@djangocfg/layouts/contexts';
|
|
38
38
|
import { PAYMENT_EVENTS, closePaymentsDialog } from '../events';
|
|
39
39
|
import { openPaymentDetailsDialog } from '../events';
|
|
40
40
|
import { paymentsLogger } from '../../../utils/logger';
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
Skeleton,
|
|
17
17
|
} from '@djangocfg/ui';
|
|
18
18
|
import { Wallet, RefreshCw, Plus } from 'lucide-react';
|
|
19
|
-
import { useOverviewContext } from '@djangocfg/
|
|
19
|
+
import { useOverviewContext } from '@djangocfg/layouts/contexts';
|
|
20
20
|
import { openCreatePaymentDialog } from '../../../events';
|
|
21
21
|
|
|
22
22
|
export const BalanceCard: React.FC = () => {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
Skeleton,
|
|
17
17
|
} from '@djangocfg/ui';
|
|
18
18
|
import { History, ExternalLink } from 'lucide-react';
|
|
19
|
-
import { useOverviewContext } from '@djangocfg/
|
|
19
|
+
import { useOverviewContext } from '@djangocfg/layouts/contexts';
|
|
20
20
|
import { openPaymentDetailsDialog } from '../../../events';
|
|
21
21
|
|
|
22
22
|
export const RecentPayments: React.FC = () => {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
Skeleton,
|
|
29
29
|
} from '@djangocfg/ui';
|
|
30
30
|
import { History, Search, Filter, RefreshCw, ArrowUpRight, ArrowDownLeft } from 'lucide-react';
|
|
31
|
-
import { useOverviewContext } from '@djangocfg/
|
|
31
|
+
import { useOverviewContext } from '@djangocfg/layouts/contexts';
|
|
32
32
|
|
|
33
33
|
export const TransactionsList: React.FC = () => {
|
|
34
34
|
const {
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
useAccountsContext,
|
|
24
24
|
PatchedUserProfileUpdateRequestSchema,
|
|
25
25
|
type PatchedUserProfileUpdateRequest
|
|
26
|
-
} from '
|
|
26
|
+
} from '../../../auth/context';
|
|
27
27
|
import { useAuth } from '../../../auth';
|
|
28
28
|
|
|
29
29
|
export const ProfileForm = () => {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
'use client';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { SupportProvider } from '@djangocfg/
|
|
10
|
+
import { SupportProvider } from '@djangocfg/layouts/contexts';
|
|
11
11
|
import { SupportLayoutProvider, useSupportLayoutContext } from './context';
|
|
12
12
|
import {
|
|
13
13
|
TicketList,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { Badge, Card, CardContent, cn } from '@djangocfg/ui';
|
|
10
10
|
import { Clock, MessageSquare } from 'lucide-react';
|
|
11
|
-
import type { Ticket } from '@djangocfg/
|
|
11
|
+
import type { Ticket } from '@djangocfg/layouts/contexts';
|
|
12
12
|
|
|
13
13
|
interface TicketCardProps {
|
|
14
14
|
ticket: Ticket;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
'use client';
|
|
7
7
|
|
|
8
8
|
import React, { createContext, useCallback, useContext, useEffect, useState, type ReactNode } from 'react';
|
|
9
|
-
import { useSupportContext, type Ticket } from '@djangocfg/
|
|
9
|
+
import { useSupportContext, type Ticket } from '@djangocfg/layouts/contexts';
|
|
10
10
|
import { CfgSupportTypes } from '@djangocfg/api';
|
|
11
11
|
import { supportLogger } from '../../../utils/logger';
|
|
12
12
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './SupportLayout';
|
|
2
2
|
export * from './context';
|
|
3
3
|
export * from './events';
|
|
4
|
+
// types.ts only contains UI-specific types (SupportUIState, TicketFormData)
|
|
5
|
+
// Ticket and Message are exported from @djangocfg/layouts/contexts
|
|
4
6
|
export * from './types';
|
|
5
7
|
export * from './components';
|
|
6
8
|
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Types for SupportLayout - combines API types with UI state
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Re-export API types
|
|
9
|
-
export type { Ticket, Message };
|
|
6
|
+
// Note: Ticket and Message types are exported from @djangocfg/layouts/contexts
|
|
7
|
+
// Import them directly: import type { Ticket, Message } from '@djangocfg/layouts/contexts';
|
|
10
8
|
|
|
11
9
|
// UI State
|
|
12
10
|
export interface SupportUIState {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LegalPage Component
|
|
3
|
+
*
|
|
4
|
+
* Reusable component for legal pages (Privacy, Terms, Cookies, Security)
|
|
5
|
+
* Accepts configuration for flexible content rendering
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { LegalPage } from '@djangocfg/layouts/components/legal';
|
|
10
|
+
* import { privacyConfig } from './config';
|
|
11
|
+
*
|
|
12
|
+
* export default function PrivacyPage() {
|
|
13
|
+
* return <LegalPage config={privacyConfig} />;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use client';
|
|
19
|
+
|
|
20
|
+
import React from 'react';
|
|
21
|
+
import {
|
|
22
|
+
Card,
|
|
23
|
+
CardHeader,
|
|
24
|
+
CardTitle,
|
|
25
|
+
CardContent,
|
|
26
|
+
} from '@djangocfg/ui/components';
|
|
27
|
+
import type { LegalPageConfig } from './types';
|
|
28
|
+
|
|
29
|
+
export interface LegalPageProps {
|
|
30
|
+
config: LegalPageConfig;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Format date for display
|
|
36
|
+
*/
|
|
37
|
+
function formatDate(date: string | Date | undefined): string {
|
|
38
|
+
if (!date) return '';
|
|
39
|
+
if (typeof date === 'string') return date;
|
|
40
|
+
return date.toISOString().split('T')[0];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* LegalPage Component
|
|
45
|
+
*/
|
|
46
|
+
export function LegalPage({ config, className }: LegalPageProps) {
|
|
47
|
+
const { title, lastUpdated, sections } = config;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div className={`container mx-auto max-w-4xl py-16 px-4 ${className || ''}`}>
|
|
51
|
+
<div className="flex flex-col gap-8">
|
|
52
|
+
{/* Header */}
|
|
53
|
+
<div className="flex flex-col gap-4">
|
|
54
|
+
<h1 className="text-4xl font-bold">{title}</h1>
|
|
55
|
+
{lastUpdated && (
|
|
56
|
+
<p className="text-lg text-muted-foreground">
|
|
57
|
+
Last updated: {formatDate(lastUpdated)}
|
|
58
|
+
</p>
|
|
59
|
+
)}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{/* Sections */}
|
|
63
|
+
{sections.map((section, index) => (
|
|
64
|
+
<Card key={index}>
|
|
65
|
+
<CardHeader>
|
|
66
|
+
<CardTitle>{section.title}</CardTitle>
|
|
67
|
+
</CardHeader>
|
|
68
|
+
<CardContent className="text-muted-foreground">
|
|
69
|
+
{Array.isArray(section.content) ? (
|
|
70
|
+
<div className="flex flex-col gap-2">
|
|
71
|
+
{section.content.map((paragraph, pIndex) => (
|
|
72
|
+
<p key={pIndex}>{paragraph}</p>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
) : (
|
|
76
|
+
<p>{section.content}</p>
|
|
77
|
+
)}
|
|
78
|
+
</CardContent>
|
|
79
|
+
</Card>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default legal page configurations
|
|
3
|
+
*
|
|
4
|
+
* Pre-configured content for common legal pages
|
|
5
|
+
* Can be customized or extended as needed
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { LegalPageConfig } from './types';
|
|
9
|
+
|
|
10
|
+
export const privacyConfig: LegalPageConfig = {
|
|
11
|
+
title: 'Privacy Policy',
|
|
12
|
+
sections: [
|
|
13
|
+
{
|
|
14
|
+
title: 'Information We Collect',
|
|
15
|
+
content: 'We collect information that you provide directly to us, including when you create an account, use our services, or communicate with us.',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'How We Use Your Information',
|
|
19
|
+
content: [
|
|
20
|
+
'We use the information we collect to:',
|
|
21
|
+
'Provide, maintain, and improve our services',
|
|
22
|
+
'Process transactions and send related information',
|
|
23
|
+
'Send technical notices and support messages',
|
|
24
|
+
'Respond to your comments and questions',
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: 'Information Sharing',
|
|
29
|
+
content: 'We do not share your personal information with third parties except as described in this privacy policy or with your consent.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: 'Data Security',
|
|
33
|
+
content: 'We take reasonable measures to help protect your personal information from loss, theft, misuse, unauthorized access, disclosure, alteration, and destruction.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'Your Rights',
|
|
37
|
+
content: 'You have the right to access, update, or delete your personal information at any time. Contact us if you wish to exercise these rights.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Changes to This Policy',
|
|
41
|
+
content: 'We may update this privacy policy from time to time. We will notify you of any changes by posting the new policy on this page.',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const termsConfig: LegalPageConfig = {
|
|
47
|
+
title: 'Terms of Service',
|
|
48
|
+
sections: [
|
|
49
|
+
{
|
|
50
|
+
title: '1. Acceptance of Terms',
|
|
51
|
+
content: 'By accessing and using this service, you accept and agree to be bound by the terms and provision of this agreement.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: '2. Use License',
|
|
55
|
+
content: 'Permission is granted to temporarily download one copy of the materials on our service for personal, non-commercial transitory viewing only.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: '3. Disclaimer',
|
|
59
|
+
content: 'The materials on our service are provided on an \'as is\' basis. We make no warranties, expressed or implied, and hereby disclaim and negate all other warranties including, without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: '4. Limitations',
|
|
63
|
+
content: 'In no event shall we or our suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on our service.',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: '5. Revisions',
|
|
67
|
+
content: 'We may revise these terms of service at any time without notice. By using this service you are agreeing to be bound by the then current version of these terms of service.',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const cookiesConfig: LegalPageConfig = {
|
|
73
|
+
title: 'Cookie Policy',
|
|
74
|
+
sections: [
|
|
75
|
+
{
|
|
76
|
+
title: 'What Are Cookies?',
|
|
77
|
+
content: 'Cookies are small text files that are placed on your device when you visit our website. They help us provide you with a better experience by remembering your preferences and understanding how you use our site.',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: 'Types of Cookies We Use',
|
|
81
|
+
content: [
|
|
82
|
+
'Essential Cookies: These cookies are necessary for the website to function properly.',
|
|
83
|
+
'Performance Cookies: These cookies help us understand how visitors interact with our website.',
|
|
84
|
+
'Functionality Cookies: These cookies allow us to remember choices you make and provide enhanced features.',
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: 'Managing Cookies',
|
|
89
|
+
content: 'Most web browsers allow you to control cookies through their settings. You can set your browser to refuse cookies or delete certain cookies. However, please note that if you disable cookies, some features of our website may not function properly.',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: 'Third-Party Cookies',
|
|
93
|
+
content: 'We may use third-party services that also use cookies. These third parties have their own privacy policies, and we do not accept any responsibility or liability for their policies.',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: 'Updates to This Policy',
|
|
97
|
+
content: 'We may update our Cookie Policy from time to time. Any changes will be posted on this page with an updated revision date.',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const securityConfig: LegalPageConfig = {
|
|
103
|
+
title: 'Security Policy',
|
|
104
|
+
sections: [
|
|
105
|
+
{
|
|
106
|
+
title: 'Our Commitment to Security',
|
|
107
|
+
content: 'We take the security of your data seriously. We implement industry-standard security measures to protect your personal information from unauthorized access, disclosure, alteration, and destruction.',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: 'Data Encryption',
|
|
111
|
+
content: 'All data transmitted between your device and our servers is encrypted using industry-standard SSL/TLS protocols. Sensitive data stored in our databases is encrypted at rest using advanced encryption standards.',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: 'Access Controls',
|
|
115
|
+
content: 'Access to user data is strictly limited to authorized personnel who require it to perform their job functions. We employ multi-factor authentication and regular access reviews to ensure that only authorized individuals can access sensitive information.',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
title: 'Security Monitoring',
|
|
119
|
+
content: 'We continuously monitor our systems for potential security threats and vulnerabilities. Our security team actively tracks and responds to any suspicious activity or potential security incidents.',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: 'Reporting Security Issues',
|
|
123
|
+
content: 'If you discover a security vulnerability or have concerns about our security practices, please report it to us immediately. We appreciate responsible disclosure and will work with you to address any legitimate security concerns.',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: 'Regular Security Updates',
|
|
127
|
+
content: 'We regularly update our systems and software to ensure that known security vulnerabilities are patched promptly. Our infrastructure undergoes periodic security audits and penetration testing to identify and address potential weaknesses.',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legal pages exports
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { LegalPage } from './LegalPage';
|
|
6
|
+
export type { LegalPageProps } from './LegalPage';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
PrivacyPage,
|
|
10
|
+
TermsPage,
|
|
11
|
+
CookiesPage,
|
|
12
|
+
SecurityPage,
|
|
13
|
+
} from './pages';
|
|
14
|
+
export type { LegalPageComponentProps } from './pages';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
privacyConfig,
|
|
18
|
+
termsConfig,
|
|
19
|
+
cookiesConfig,
|
|
20
|
+
securityConfig,
|
|
21
|
+
} from './configs';
|
|
22
|
+
|
|
23
|
+
export type { LegalPageConfig, LegalPageSection } from './types';
|
|
24
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-built legal page components
|
|
3
|
+
*
|
|
4
|
+
* Ready-to-use page components with default configurations
|
|
5
|
+
* Can be customized by passing custom config
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // app/legal/privacy/page.tsx
|
|
10
|
+
* import { PrivacyPage } from '@djangocfg/layouts/components/legal';
|
|
11
|
+
*
|
|
12
|
+
* export default PrivacyPage;
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
'use client';
|
|
17
|
+
|
|
18
|
+
import { LegalPage } from './LegalPage';
|
|
19
|
+
import {
|
|
20
|
+
privacyConfig,
|
|
21
|
+
termsConfig,
|
|
22
|
+
cookiesConfig,
|
|
23
|
+
securityConfig,
|
|
24
|
+
} from './configs';
|
|
25
|
+
import type { LegalPageConfig } from './types';
|
|
26
|
+
|
|
27
|
+
export interface LegalPageComponentProps {
|
|
28
|
+
config?: LegalPageConfig;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Privacy Policy Page
|
|
33
|
+
*/
|
|
34
|
+
export function PrivacyPage({ config }: LegalPageComponentProps = {}) {
|
|
35
|
+
return <LegalPage config={config || privacyConfig} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Terms of Service Page
|
|
40
|
+
*/
|
|
41
|
+
export function TermsPage({ config }: LegalPageComponentProps = {}) {
|
|
42
|
+
return <LegalPage config={config || termsConfig} />;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Cookie Policy Page
|
|
47
|
+
*/
|
|
48
|
+
export function CookiesPage({ config }: LegalPageComponentProps = {}) {
|
|
49
|
+
return <LegalPage config={config || cookiesConfig} />;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Security Policy Page
|
|
54
|
+
*/
|
|
55
|
+
export function SecurityPage({ config }: LegalPageComponentProps = {}) {
|
|
56
|
+
return <LegalPage config={config || securityConfig} />;
|
|
57
|
+
}
|
|
58
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legal page types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface LegalPageSection {
|
|
6
|
+
title: string;
|
|
7
|
+
content: string | string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface LegalPageConfig {
|
|
11
|
+
title: string;
|
|
12
|
+
lastUpdated?: string | Date;
|
|
13
|
+
sections: LegalPageSection[];
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Plus,
|
|
18
18
|
List,
|
|
19
19
|
} from 'lucide-react';
|
|
20
|
-
import { useKnowbaseChatContext, useKnowbaseSessionsContext, type ChatSource } from '@djangocfg/
|
|
20
|
+
import { useKnowbaseChatContext, useKnowbaseSessionsContext, type ChatSource } from '@djangocfg/layouts/contexts';
|
|
21
21
|
import { Enums } from '@djangocfg/api/cfg/generated';
|
|
22
22
|
import { chatLogger } from '../../utils/logger';
|
|
23
23
|
import { useChatUI } from './ChatUIContext';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Badge,
|
|
18
18
|
} from '@djangocfg/ui';
|
|
19
19
|
import { MessageSquare, Clock, Archive, Trash2, Loader2 } from 'lucide-react';
|
|
20
|
-
import { useKnowbaseSessionsContext } from '@djangocfg/
|
|
20
|
+
import { useKnowbaseSessionsContext } from '@djangocfg/layouts/contexts';
|
|
21
21
|
import { useInfiniteSessions } from '../hooks/useInfiniteSessions';
|
|
22
22
|
import type { SessionListProps } from '../types';
|
|
23
23
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
'use client';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { KnowbaseChatProvider, KnowbaseSessionsProvider } from '@djangocfg/
|
|
10
|
+
import { KnowbaseChatProvider, KnowbaseSessionsProvider } from '@djangocfg/layouts/contexts';
|
|
11
11
|
import { ChatUIProvider } from './ChatUIContext';
|
|
12
12
|
import { ChatWidget } from './ChatWidget';
|
|
13
13
|
import type { ChatWidgetProps } from './types';
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
* Type definitions for RAG-powered chat widget
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Import types from Schemas namespace - explicitly exported and works reliably
|
|
7
|
+
// Types are available via Schemas namespace even when direct exports have issues
|
|
8
|
+
import type { Schemas } from '@djangocfg/api';
|
|
9
|
+
|
|
10
|
+
// Extract types from Schemas namespace
|
|
11
|
+
export type ChatMessage = Schemas.ChatMessage;
|
|
12
|
+
export type ChatSource = Schemas.ChatSource;
|
|
7
13
|
|
|
8
14
|
// ─────────────────────────────────────────────────────────────────────────
|
|
9
15
|
// Extended Message Type (for UI with sources)
|
|
@@ -70,9 +76,5 @@ export interface SessionListProps {
|
|
|
70
76
|
className?: string;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
74
|
-
// Re-export types from API
|
|
75
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
76
79
|
|
|
77
|
-
export type { ChatSource, ChatMessage } from '@djangocfg/api/cfg/contexts';
|
|
78
80
|
|
|
@@ -145,20 +145,32 @@ function ContactFormInner({
|
|
|
145
145
|
|
|
146
146
|
// Watch form values and save to localStorage
|
|
147
147
|
const watchedValues = useWatch({ control: form.control });
|
|
148
|
+
const prevDraftRef = React.useRef<FormDraft>(draft);
|
|
148
149
|
|
|
149
150
|
useEffect(() => {
|
|
150
151
|
// Only save to localStorage after hydration to avoid unnecessary writes
|
|
151
152
|
if (!isHydrated) return;
|
|
152
153
|
|
|
153
154
|
const { name, email, company, subject, message } = watchedValues;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
const newDraft: FormDraft = {
|
|
156
|
+
name: name || '',
|
|
157
|
+
email: email || '',
|
|
158
|
+
company: company || '',
|
|
159
|
+
subject: subject || '',
|
|
160
|
+
message: message || '',
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Only update if draft actually changed to prevent infinite loop
|
|
164
|
+
const hasChanges =
|
|
165
|
+
prevDraftRef.current.name !== newDraft.name ||
|
|
166
|
+
prevDraftRef.current.email !== newDraft.email ||
|
|
167
|
+
prevDraftRef.current.company !== newDraft.company ||
|
|
168
|
+
prevDraftRef.current.subject !== newDraft.subject ||
|
|
169
|
+
prevDraftRef.current.message !== newDraft.message;
|
|
170
|
+
|
|
171
|
+
if (hasChanges && (name || email || company || subject || message)) {
|
|
172
|
+
prevDraftRef.current = newDraft;
|
|
173
|
+
setDraft(newDraft);
|
|
162
174
|
}
|
|
163
175
|
}, [watchedValues, setDraft, isHydrated]);
|
|
164
176
|
|