create-chaaskit 0.1.0
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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +25 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add-infra.d.ts +6 -0
- package/dist/commands/add-infra.d.ts.map +1 -0
- package/dist/commands/add-infra.js +160 -0
- package/dist/commands/add-infra.js.map +1 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +63 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/db-sync.d.ts +13 -0
- package/dist/commands/db-sync.d.ts.map +1 -0
- package/dist/commands/db-sync.js +108 -0
- package/dist/commands/db-sync.js.map +1 -0
- package/dist/commands/dev.d.ts +7 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +61 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +214 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/.env.example +24 -0
- package/dist/templates/README.md +81 -0
- package/dist/templates/app/components/AcceptInviteClient.tsx +10 -0
- package/dist/templates/app/components/AdminDashboardClient.tsx +10 -0
- package/dist/templates/app/components/AdminTeamClient.tsx +10 -0
- package/dist/templates/app/components/AdminTeamsClient.tsx +10 -0
- package/dist/templates/app/components/AdminUsersClient.tsx +10 -0
- package/dist/templates/app/components/ApiKeysClient.tsx +10 -0
- package/dist/templates/app/components/AutomationsClient.tsx +10 -0
- package/dist/templates/app/components/ChatClient.tsx +13 -0
- package/dist/templates/app/components/ClientOnly.tsx +6 -0
- package/dist/templates/app/components/DocumentsClient.tsx +10 -0
- package/dist/templates/app/components/OAuthConsentClient.tsx +10 -0
- package/dist/templates/app/components/PricingClient.tsx +10 -0
- package/dist/templates/app/components/TeamSettingsClient.tsx +10 -0
- package/dist/templates/app/components/VerifyEmailClient.tsx +10 -0
- package/dist/templates/app/entry.client.tsx +12 -0
- package/dist/templates/app/entry.server.tsx +67 -0
- package/dist/templates/app/root.tsx +91 -0
- package/dist/templates/app/routes/_index.tsx +82 -0
- package/dist/templates/app/routes/admin._index.tsx +57 -0
- package/dist/templates/app/routes/admin.teams.$teamId.tsx +57 -0
- package/dist/templates/app/routes/admin.teams._index.tsx +57 -0
- package/dist/templates/app/routes/admin.users.tsx +57 -0
- package/dist/templates/app/routes/api-keys.tsx +57 -0
- package/dist/templates/app/routes/automations.tsx +57 -0
- package/dist/templates/app/routes/chat._index.tsx +11 -0
- package/dist/templates/app/routes/chat.admin._index.tsx +10 -0
- package/dist/templates/app/routes/chat.admin.teams.$teamId.tsx +10 -0
- package/dist/templates/app/routes/chat.admin.teams._index.tsx +10 -0
- package/dist/templates/app/routes/chat.admin.users.tsx +10 -0
- package/dist/templates/app/routes/chat.api-keys.tsx +10 -0
- package/dist/templates/app/routes/chat.automations.tsx +10 -0
- package/dist/templates/app/routes/chat.documents.tsx +10 -0
- package/dist/templates/app/routes/chat.team.$teamId.settings.tsx +10 -0
- package/dist/templates/app/routes/chat.thread.$threadId.tsx +11 -0
- package/dist/templates/app/routes/chat.tsx +39 -0
- package/dist/templates/app/routes/documents.tsx +57 -0
- package/dist/templates/app/routes/invite.$token.tsx +10 -0
- package/dist/templates/app/routes/login.tsx +334 -0
- package/dist/templates/app/routes/oauth.consent.tsx +10 -0
- package/dist/templates/app/routes/pricing.tsx +10 -0
- package/dist/templates/app/routes/privacy.tsx +197 -0
- package/dist/templates/app/routes/register.tsx +398 -0
- package/dist/templates/app/routes/shared.$shareId.tsx +226 -0
- package/dist/templates/app/routes/team.$teamId.settings.tsx +57 -0
- package/dist/templates/app/routes/terms.tsx +173 -0
- package/dist/templates/app/routes/thread.$threadId.tsx +102 -0
- package/dist/templates/app/routes/verify-email.tsx +10 -0
- package/dist/templates/app/routes.ts +47 -0
- package/dist/templates/config/app.config.ts +216 -0
- package/dist/templates/docs/admin.md +257 -0
- package/dist/templates/docs/api-keys.md +403 -0
- package/dist/templates/docs/authentication.md +247 -0
- package/dist/templates/docs/configuration.md +1212 -0
- package/dist/templates/docs/custom-pages.md +466 -0
- package/dist/templates/docs/deployment.md +362 -0
- package/dist/templates/docs/development.md +411 -0
- package/dist/templates/docs/documents.md +293 -0
- package/dist/templates/docs/extensions.md +639 -0
- package/dist/templates/docs/index.md +139 -0
- package/dist/templates/docs/installation.md +286 -0
- package/dist/templates/docs/mcp.md +952 -0
- package/dist/templates/docs/native-tools.md +688 -0
- package/dist/templates/docs/queue.md +514 -0
- package/dist/templates/docs/scheduled-prompts.md +279 -0
- package/dist/templates/docs/settings.md +415 -0
- package/dist/templates/docs/slack.md +318 -0
- package/dist/templates/docs/styling.md +288 -0
- package/dist/templates/extensions/agents/.gitkeep +0 -0
- package/dist/templates/extensions/pages/.gitkeep +0 -0
- package/dist/templates/extensions/payment-plans/.gitkeep +0 -0
- package/dist/templates/index.html +16 -0
- package/dist/templates/infra-aws/.github/workflows/deploy.yml +95 -0
- package/dist/templates/infra-aws/README.md +207 -0
- package/dist/templates/infra-aws/bin/cdk.ts +18 -0
- package/dist/templates/infra-aws/cdk.json +43 -0
- package/dist/templates/infra-aws/config/deployment.ts +156 -0
- package/dist/templates/infra-aws/lib/chaaskit-stack.ts +419 -0
- package/dist/templates/infra-aws/package.json +27 -0
- package/dist/templates/infra-aws/scripts/build-app.sh +63 -0
- package/dist/templates/infra-aws/tsconfig.json +25 -0
- package/dist/templates/package.json +46 -0
- package/dist/templates/prisma/schema/base.prisma +584 -0
- package/dist/templates/prisma/schema/custom.prisma +24 -0
- package/dist/templates/prisma/schema.prisma +271 -0
- package/dist/templates/public/favicon.svg +4 -0
- package/dist/templates/public/logo.svg +4 -0
- package/dist/templates/react-router.config.ts +11 -0
- package/dist/templates/server.js +52 -0
- package/dist/templates/src/main.tsx +8 -0
- package/dist/templates/tsconfig.json +26 -0
- package/dist/templates/vite.config.ts +26 -0
- package/package.json +46 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Links,
|
|
3
|
+
Meta,
|
|
4
|
+
Outlet,
|
|
5
|
+
Scripts,
|
|
6
|
+
ScrollRestoration,
|
|
7
|
+
useLoaderData,
|
|
8
|
+
} from 'react-router';
|
|
9
|
+
import type { Route } from './+types/root';
|
|
10
|
+
import { config } from '../config/app.config';
|
|
11
|
+
import { generateThemeCSS, baseStyles } from '@chaaskit/client/ssr';
|
|
12
|
+
|
|
13
|
+
function getThemeFromCookie(cookieHeader: string | null, defaultTheme: string): string {
|
|
14
|
+
if (!cookieHeader) return defaultTheme;
|
|
15
|
+
const match = cookieHeader.match(/(?:^|;\s*)theme=([^;]*)/);
|
|
16
|
+
return match ? match[1] : defaultTheme;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function loader({ request }: Route.LoaderArgs) {
|
|
20
|
+
const cookieHeader = request.headers.get('Cookie');
|
|
21
|
+
const theme = getThemeFromCookie(cookieHeader, config.theming.defaultTheme);
|
|
22
|
+
return { config, theme };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function Root() {
|
|
26
|
+
const { config, theme } = useLoaderData<typeof loader>();
|
|
27
|
+
const themeCSS = generateThemeCSS(config, theme);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<html lang="en" data-theme={theme}>
|
|
31
|
+
<head>
|
|
32
|
+
<meta charSet="utf-8" />
|
|
33
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
34
|
+
<Meta />
|
|
35
|
+
<Links />
|
|
36
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
37
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
|
38
|
+
<link
|
|
39
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
40
|
+
rel="stylesheet"
|
|
41
|
+
/>
|
|
42
|
+
<style dangerouslySetInnerHTML={{ __html: themeCSS + baseStyles }} />
|
|
43
|
+
<ThemeScript serverTheme={theme} />
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
<Outlet />
|
|
47
|
+
<ScrollRestoration />
|
|
48
|
+
<Scripts />
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function ThemeScript({ serverTheme }: { serverTheme: string }) {
|
|
55
|
+
return (
|
|
56
|
+
<script
|
|
57
|
+
dangerouslySetInnerHTML={{
|
|
58
|
+
__html: `
|
|
59
|
+
(function() {
|
|
60
|
+
var storedTheme = localStorage.getItem('theme');
|
|
61
|
+
if (storedTheme && storedTheme !== '${serverTheme}') {
|
|
62
|
+
// localStorage has a different theme than server rendered - update DOM and sync cookie
|
|
63
|
+
document.documentElement.dataset.theme = storedTheme;
|
|
64
|
+
document.cookie = 'theme=' + storedTheme + ';path=/;max-age=31536000;SameSite=Lax';
|
|
65
|
+
} else if (!storedTheme) {
|
|
66
|
+
// No localStorage theme - sync server theme to localStorage
|
|
67
|
+
localStorage.setItem('theme', '${serverTheme}');
|
|
68
|
+
}
|
|
69
|
+
// If storedTheme === serverTheme, everything is already in sync
|
|
70
|
+
})();
|
|
71
|
+
`,
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
78
|
+
return (
|
|
79
|
+
<html lang="en">
|
|
80
|
+
<head>
|
|
81
|
+
<meta charSet="utf-8" />
|
|
82
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
83
|
+
<title>Error</title>
|
|
84
|
+
</head>
|
|
85
|
+
<body style={{ fontFamily: 'system-ui, sans-serif', padding: '2rem' }}>
|
|
86
|
+
<h1>Something went wrong</h1>
|
|
87
|
+
<p>{error instanceof Error ? error.message : 'Unknown error'}</p>
|
|
88
|
+
</body>
|
|
89
|
+
</html>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Route } from './+types/_index';
|
|
2
|
+
import { config } from '../../config/app.config';
|
|
3
|
+
|
|
4
|
+
export function meta({}: Route.MetaArgs) {
|
|
5
|
+
return [
|
|
6
|
+
{ title: config.app.name },
|
|
7
|
+
{ name: 'description', content: config.app.description },
|
|
8
|
+
];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Landing page route.
|
|
13
|
+
*
|
|
14
|
+
* Customize this page for your marketing content, or redirect to /chat
|
|
15
|
+
* if you don't need a separate landing page.
|
|
16
|
+
*
|
|
17
|
+
* For a marketing page example, see the chaaskit-app repository.
|
|
18
|
+
*/
|
|
19
|
+
export default function Index() {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
minHeight: '100vh',
|
|
28
|
+
padding: '2rem',
|
|
29
|
+
boxSizing: 'border-box',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<h1
|
|
34
|
+
style={{
|
|
35
|
+
fontSize: '3rem',
|
|
36
|
+
fontWeight: 'bold',
|
|
37
|
+
marginBottom: '1rem',
|
|
38
|
+
color: 'rgb(var(--color-text-primary))',
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
Welcome to {config.app.name}
|
|
42
|
+
</h1>
|
|
43
|
+
<p
|
|
44
|
+
style={{
|
|
45
|
+
fontSize: '1.25rem',
|
|
46
|
+
color: 'rgb(var(--color-text-secondary))',
|
|
47
|
+
marginBottom: '2rem',
|
|
48
|
+
maxWidth: '600px',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{config.app.description}
|
|
52
|
+
</p>
|
|
53
|
+
<div style={{ display: 'flex', gap: '1rem' }}>
|
|
54
|
+
<a
|
|
55
|
+
href="/chat"
|
|
56
|
+
style={{
|
|
57
|
+
padding: '0.75rem 1.5rem',
|
|
58
|
+
backgroundColor: 'rgb(var(--color-primary))',
|
|
59
|
+
color: 'white',
|
|
60
|
+
borderRadius: '0.5rem',
|
|
61
|
+
textDecoration: 'none',
|
|
62
|
+
fontWeight: 500,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
Get Started
|
|
66
|
+
</a>
|
|
67
|
+
<a
|
|
68
|
+
href="/login"
|
|
69
|
+
style={{
|
|
70
|
+
padding: '0.75rem 1.5rem',
|
|
71
|
+
border: '1px solid rgb(var(--color-border))',
|
|
72
|
+
borderRadius: '0.5rem',
|
|
73
|
+
textDecoration: 'none',
|
|
74
|
+
color: 'rgb(var(--color-text-primary))',
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
Sign In
|
|
78
|
+
</a>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Route } from './+types/admin._index';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { ClientOnly } from '../components/ClientOnly';
|
|
4
|
+
|
|
5
|
+
const AdminDashboardClient = lazy(() => import('../components/AdminDashboardClient'));
|
|
6
|
+
|
|
7
|
+
export function meta({}: Route.MetaArgs) {
|
|
8
|
+
return [{ title: 'Admin Dashboard' }];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function links() {
|
|
12
|
+
return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function AdminDashboard() {
|
|
16
|
+
return (
|
|
17
|
+
<ClientOnly fallback={<LoadingSkeleton />}>
|
|
18
|
+
{() => (
|
|
19
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
20
|
+
<AdminDashboardClient />
|
|
21
|
+
</Suspense>
|
|
22
|
+
)}
|
|
23
|
+
</ClientOnly>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function LoadingSkeleton() {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: '100vh',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
backgroundColor: 'rgb(var(--color-background))',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '2rem',
|
|
41
|
+
height: '2rem',
|
|
42
|
+
border: '2px solid rgb(var(--color-primary))',
|
|
43
|
+
borderTopColor: 'transparent',
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<style>
|
|
49
|
+
{`
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
to { transform: rotate(360deg); }
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
</style>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Route } from './+types/admin.teams.$teamId';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { ClientOnly } from '../components/ClientOnly';
|
|
4
|
+
|
|
5
|
+
const AdminTeamClient = lazy(() => import('../components/AdminTeamClient'));
|
|
6
|
+
|
|
7
|
+
export function meta({}: Route.MetaArgs) {
|
|
8
|
+
return [{ title: 'Admin - Team Details' }];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function links() {
|
|
12
|
+
return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function AdminTeamDetails() {
|
|
16
|
+
return (
|
|
17
|
+
<ClientOnly fallback={<LoadingSkeleton />}>
|
|
18
|
+
{() => (
|
|
19
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
20
|
+
<AdminTeamClient />
|
|
21
|
+
</Suspense>
|
|
22
|
+
)}
|
|
23
|
+
</ClientOnly>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function LoadingSkeleton() {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: '100vh',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
backgroundColor: 'rgb(var(--color-background))',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '2rem',
|
|
41
|
+
height: '2rem',
|
|
42
|
+
border: '2px solid rgb(var(--color-primary))',
|
|
43
|
+
borderTopColor: 'transparent',
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<style>
|
|
49
|
+
{`
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
to { transform: rotate(360deg); }
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
</style>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Route } from './+types/admin.teams._index';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { ClientOnly } from '../components/ClientOnly';
|
|
4
|
+
|
|
5
|
+
const AdminTeamsClient = lazy(() => import('../components/AdminTeamsClient'));
|
|
6
|
+
|
|
7
|
+
export function meta({}: Route.MetaArgs) {
|
|
8
|
+
return [{ title: 'Admin - Teams' }];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function links() {
|
|
12
|
+
return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function AdminTeams() {
|
|
16
|
+
return (
|
|
17
|
+
<ClientOnly fallback={<LoadingSkeleton />}>
|
|
18
|
+
{() => (
|
|
19
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
20
|
+
<AdminTeamsClient />
|
|
21
|
+
</Suspense>
|
|
22
|
+
)}
|
|
23
|
+
</ClientOnly>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function LoadingSkeleton() {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: '100vh',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
backgroundColor: 'rgb(var(--color-background))',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '2rem',
|
|
41
|
+
height: '2rem',
|
|
42
|
+
border: '2px solid rgb(var(--color-primary))',
|
|
43
|
+
borderTopColor: 'transparent',
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<style>
|
|
49
|
+
{`
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
to { transform: rotate(360deg); }
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
</style>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Route } from './+types/admin.users';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { ClientOnly } from '../components/ClientOnly';
|
|
4
|
+
|
|
5
|
+
const AdminUsersClient = lazy(() => import('../components/AdminUsersClient'));
|
|
6
|
+
|
|
7
|
+
export function meta({}: Route.MetaArgs) {
|
|
8
|
+
return [{ title: 'Admin - Users' }];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function links() {
|
|
12
|
+
return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function AdminUsers() {
|
|
16
|
+
return (
|
|
17
|
+
<ClientOnly fallback={<LoadingSkeleton />}>
|
|
18
|
+
{() => (
|
|
19
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
20
|
+
<AdminUsersClient />
|
|
21
|
+
</Suspense>
|
|
22
|
+
)}
|
|
23
|
+
</ClientOnly>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function LoadingSkeleton() {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: '100vh',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
backgroundColor: 'rgb(var(--color-background))',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '2rem',
|
|
41
|
+
height: '2rem',
|
|
42
|
+
border: '2px solid rgb(var(--color-primary))',
|
|
43
|
+
borderTopColor: 'transparent',
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<style>
|
|
49
|
+
{`
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
to { transform: rotate(360deg); }
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
</style>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Route } from './+types/api-keys';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { ClientOnly } from '../components/ClientOnly';
|
|
4
|
+
|
|
5
|
+
const ApiKeysClient = lazy(() => import('../components/ApiKeysClient'));
|
|
6
|
+
|
|
7
|
+
export function meta({}: Route.MetaArgs) {
|
|
8
|
+
return [{ title: 'API Keys' }];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function links() {
|
|
12
|
+
return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function ApiKeys() {
|
|
16
|
+
return (
|
|
17
|
+
<ClientOnly fallback={<LoadingSkeleton />}>
|
|
18
|
+
{() => (
|
|
19
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
20
|
+
<ApiKeysClient />
|
|
21
|
+
</Suspense>
|
|
22
|
+
)}
|
|
23
|
+
</ClientOnly>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function LoadingSkeleton() {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: '100vh',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
backgroundColor: 'rgb(var(--color-background))',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '2rem',
|
|
41
|
+
height: '2rem',
|
|
42
|
+
border: '2px solid rgb(var(--color-primary))',
|
|
43
|
+
borderTopColor: 'transparent',
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<style>
|
|
49
|
+
{`
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
to { transform: rotate(360deg); }
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
</style>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Route } from './+types/automations';
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { ClientOnly } from '../components/ClientOnly';
|
|
4
|
+
|
|
5
|
+
const AutomationsClient = lazy(() => import('../components/AutomationsClient'));
|
|
6
|
+
|
|
7
|
+
export function meta({}: Route.MetaArgs) {
|
|
8
|
+
return [{ title: 'Automations' }];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function links() {
|
|
12
|
+
return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Automations() {
|
|
16
|
+
return (
|
|
17
|
+
<ClientOnly fallback={<LoadingSkeleton />}>
|
|
18
|
+
{() => (
|
|
19
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
20
|
+
<AutomationsClient />
|
|
21
|
+
</Suspense>
|
|
22
|
+
)}
|
|
23
|
+
</ClientOnly>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function LoadingSkeleton() {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: '100vh',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
backgroundColor: 'rgb(var(--color-background))',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '2rem',
|
|
41
|
+
height: '2rem',
|
|
42
|
+
border: '2px solid rgb(var(--color-primary))',
|
|
43
|
+
borderTopColor: 'transparent',
|
|
44
|
+
borderRadius: '50%',
|
|
45
|
+
animation: 'spin 1s linear infinite',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<style>
|
|
49
|
+
{`
|
|
50
|
+
@keyframes spin {
|
|
51
|
+
to { transform: rotate(360deg); }
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
</style>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Chat',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/ChatRoute'),
|
|
6
|
+
skeleton: 'chat',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const meta = route.meta;
|
|
10
|
+
export const links = route.links;
|
|
11
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Admin Dashboard',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/AdminDashboardRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Admin - Team Details',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/AdminTeamRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Admin - Teams',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/AdminTeamsRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Admin - Users',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/AdminUsersRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'API Keys',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/ApiKeysRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Automations',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/AutomationsRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Documents',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/DocumentsRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Team Settings',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/TeamSettingsRoute'),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const meta = route.meta;
|
|
9
|
+
export const links = route.links;
|
|
10
|
+
export default route.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRoute } from '@chaaskit/client/ssr-utils';
|
|
2
|
+
|
|
3
|
+
const route = createRoute({
|
|
4
|
+
title: 'Chat',
|
|
5
|
+
load: () => import('@chaaskit/client/routes/ChatRoute'),
|
|
6
|
+
skeleton: 'chat',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const meta = route.meta;
|
|
10
|
+
export const links = route.links;
|
|
11
|
+
export default route.default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Route } from './+types/chat';
|
|
2
|
+
import { Outlet, redirect } from 'react-router';
|
|
3
|
+
import { config } from '../../config/app.config';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Layout route for all /chat/* routes.
|
|
7
|
+
*
|
|
8
|
+
* This handles authentication - if the user is not logged in,
|
|
9
|
+
* they are redirected to the login page.
|
|
10
|
+
*/
|
|
11
|
+
export async function loader({ request }: Route.LoaderArgs) {
|
|
12
|
+
const cookieHeader = request.headers.get('Cookie');
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(`${config.app.url}/api/auth/me`, {
|
|
16
|
+
headers: {
|
|
17
|
+
Cookie: cookieHeader || '',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
// Not authenticated, redirect to login
|
|
23
|
+
throw redirect('/login');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// If it's a redirect response, re-throw it
|
|
29
|
+
if (error instanceof Response) {
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
// For other errors (network, etc.), redirect to login
|
|
33
|
+
throw redirect('/login');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default function ChatLayout() {
|
|
38
|
+
return <Outlet />;
|
|
39
|
+
}
|