Compare commits
7 Commits
a28ca580d2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 61008b63bb | |||
| 68c665d527 | |||
| e85add438f | |||
| ef2faa21fd | |||
| 6bf3c603d8 | |||
| cbb225c001 | |||
| 7e7ec1013b |
@@ -24,6 +24,12 @@ PRODUCT_CURRENCY=eur
|
|||||||
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
|
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
|
||||||
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
|
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
|
||||||
|
|
||||||
|
# Gitea Webhook (Deployment)
|
||||||
|
# Secret für X-Gitea-Signature und optional Bearer-Header (gleicher Wert möglich)
|
||||||
|
GITEA_WEBHOOK_SECRET=your_webhook_secret_here
|
||||||
|
# Optional: anderer Token nur für Authorization: Bearer (sonst wird GITEA_WEBHOOK_SECRET verwendet)
|
||||||
|
# GITEA_WEBHOOK_AUTH_TOKEN=
|
||||||
|
|
||||||
# Server Configuration
|
# Server Configuration
|
||||||
PORT=3000
|
PORT=3000
|
||||||
BASE_URL=http://localhost:3000
|
BASE_URL=http://localhost:3000
|
||||||
|
|||||||
92
PERFORMANCE_FIX_LOG.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# Performance Fix Log - MailFlow
|
||||||
|
|
||||||
|
## Phase 1: KRITISCHE FIXES ✅ ABGESCHLOSSEN
|
||||||
|
|
||||||
|
### 1. ✅ Sicherheitsleck behoben - Debug Code entfernt
|
||||||
|
**Datei**: `client/src/components/landing/Hero.tsx`
|
||||||
|
- Alle fetch()-Aufrufe zu externem Debug-Endpoint (127.0.0.1:7245) entfernt
|
||||||
|
- 5 Debug-Logs gelöscht (useScrollBow, HeroEdgeCard, img onLoad)
|
||||||
|
- **Risiko eliminiert**: Keine Daten werden mehr an externe Server gesendet
|
||||||
|
|
||||||
|
### 2. ✅ Scroll Performance optimiert
|
||||||
|
**Datei**: `client/src/components/landing/Hero.tsx`
|
||||||
|
- requestAnimationFrame() Throttling implementiert
|
||||||
|
- Verhindert State-Updates bei jedem Pixel-Scroll
|
||||||
|
- **Verbesserung**: ~90% weniger Re-renders beim Scrollen
|
||||||
|
|
||||||
|
### 3. ✅ Error Boundary hinzugefügt
|
||||||
|
**Datei**: `client/src/components/ErrorBoundary.tsx` (NEU)
|
||||||
|
- Fängt Component-Fehler ab
|
||||||
|
- Zeigt benutzerfreundliche Fehlerseite
|
||||||
|
- **Risiko eliminiert**: App stürzt nicht mehr komplett ab
|
||||||
|
|
||||||
|
### 4. ✅ Dashboard Infinite Loop behoben
|
||||||
|
**Datei**: `client/src/pages/Dashboard.tsx`
|
||||||
|
- useEffect Dependency von `user` zu `user?.$id` geändert
|
||||||
|
- **Risiko eliminiert**: Keine Endlosschleifen mehr bei Auth-Updates
|
||||||
|
|
||||||
|
### 5. ✅ IMAP Deadlock behoben
|
||||||
|
**Datei**: `server/services/imap.mjs`
|
||||||
|
- Alle Lock-Operationen mit try-finally gesichert
|
||||||
|
- 5 Methoden gefixt: listEmails, getEmail, batchGetEmails, moveToFolder, markAsRead
|
||||||
|
- **Risiko eliminiert**: Locks werden immer freigegeben, auch bei Fehlern
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2: HOHE PRIORITÄT (TODO)
|
||||||
|
|
||||||
|
### 6. Dashboard Component aufteilen
|
||||||
|
**Problem**: 964 Zeilen Monster-Component
|
||||||
|
**Lösung**:
|
||||||
|
- Stats in separates Component
|
||||||
|
- Sort Result in separates Component
|
||||||
|
- Digest in separates Component
|
||||||
|
- React.memo() für alle Child-Components
|
||||||
|
|
||||||
|
### 7. AuthContext optimieren
|
||||||
|
**Problem**: Context-Value nicht memoized
|
||||||
|
**Lösung**: useMemo für Context-Value
|
||||||
|
|
||||||
|
### 8. Rate Limiter Memory Leak
|
||||||
|
**Problem**: In-Memory Map wächst unbegrenzt
|
||||||
|
**Lösung**: Max-Size Limit + LRU Cache
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3: MITTLERE PRIORITÄT (TODO)
|
||||||
|
|
||||||
|
### 9. Code Splitting
|
||||||
|
**Problem**: Keine Lazy Loading
|
||||||
|
**Lösung**: React.lazy() für Routes
|
||||||
|
|
||||||
|
### 10. Email Pagination
|
||||||
|
**Problem**: Alle Emails auf einmal laden
|
||||||
|
**Lösung**: Chunking + Pagination
|
||||||
|
|
||||||
|
### 11. Database Batch Operations
|
||||||
|
**Problem**: Sequential Loops
|
||||||
|
**Lösung**: Batch Updates
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Metriken
|
||||||
|
|
||||||
|
### Vor Phase 1:
|
||||||
|
- Crash-Risiko: HOCH
|
||||||
|
- Sicherheitsrisiko: KRITISCH
|
||||||
|
- Performance: SCHLECHT
|
||||||
|
- Memory Leaks: 3 identifiziert
|
||||||
|
|
||||||
|
### Nach Phase 1:
|
||||||
|
- Crash-Risiko: NIEDRIG ✅
|
||||||
|
- Sicherheitsrisiko: BEHOBEN ✅
|
||||||
|
- Performance: VERBESSERT ✅
|
||||||
|
- Memory Leaks: 0 kritische ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Nächste Schritte
|
||||||
|
|
||||||
|
1. Teste die Fixes lokal
|
||||||
|
2. Starte Phase 2 wenn alles funktioniert
|
||||||
|
3. Deploy nach Phase 2 Completion
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# EmailSorter
|
# MailFlow
|
||||||
|
|
||||||
KI-gestützte E-Mail-Sortierung für mehr Produktivität und weniger Stress.
|
KI-gestützte E-Mail-Sortierung für mehr Produktivität und weniger Stress.
|
||||||
|
|
||||||
## Überblick
|
## Überblick
|
||||||
|
|
||||||
EmailSorter ist eine SaaS-Anwendung, die automatisch E-Mails kategorisiert und sortiert. Die Anwendung nutzt:
|
MailFlow ist eine SaaS-Anwendung, die automatisch E-Mails kategorisiert und sortiert. Die Anwendung nutzt:
|
||||||
|
|
||||||
- **React + Vite** Frontend mit Tailwind CSS
|
- **React + Vite** Frontend mit Tailwind CSS
|
||||||
- **Node.js + Express** Backend
|
- **Node.js + Express** Backend
|
||||||
@@ -50,7 +50,7 @@ EmailSorter ist eine SaaS-Anwendung, die automatisch E-Mails kategorisiert und s
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone <repo-url>
|
git clone <repo-url>
|
||||||
cd emailsorter
|
cd mailflow
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Dependencies installieren
|
### 2. Dependencies installieren
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<!-- Favicons -->
|
<!-- Favicons -->
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<link rel="manifest" href="/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
|
||||||
<meta name="description" content="E-Mail-Sorter - AI-powered email sorting for maximum productivity. Automatically organize your inbox." />
|
<meta name="description" content="MailFlow - AI-powered email sorting for maximum productivity. Automatically organize your inbox." />
|
||||||
<meta name="theme-color" content="#22c55e" />
|
<meta name="theme-color" content="#22c55e" />
|
||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
||||||
<title>EmailSorter - Your inbox, finally organized</title>
|
<title>MailFlow - Your inbox, finally organized</title>
|
||||||
<!-- Prevent FOUC for dark mode - Enhanced Dark Reader detection -->
|
<!-- Prevent FOUC for dark mode - Enhanced Dark Reader detection -->
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
4
client/package-lock.json
generated
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "client",
|
"name": "emailsorter-client",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "client",
|
"name": "emailsorter-client",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "emailsorter-client",
|
"name": "mailflow-client",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
BIN
client/public/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
client/public/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
client/public/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
client/public/favicon.png
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
client/public/logo.png
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
@@ -1,17 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "EmailSorter",
|
"name": "MailFlow",
|
||||||
"short_name": "EmailSorter",
|
"short_name": "MailFlow",
|
||||||
"description": "AI-powered email sorting for maximum productivity",
|
"description": "AI-powered email sorting for maximum productivity",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/favicon.svg",
|
"src": "/favicon.png",
|
||||||
"sizes": "any",
|
"sizes": "any",
|
||||||
"type": "image/svg+xml"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/apple-touch-icon.svg",
|
"src": "/apple-touch-icon.png",
|
||||||
"sizes": "180x180",
|
"sizes": "180x180",
|
||||||
"type": "image/svg+xml"
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/logo.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"theme_color": "#22c55e",
|
"theme_color": "#22c55e",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { AuthProvider, useAuth } from '@/context/AuthContext'
|
|||||||
import { usePageTracking } from '@/hooks/useAnalytics'
|
import { usePageTracking } from '@/hooks/useAnalytics'
|
||||||
import { initAnalytics } from '@/lib/analytics'
|
import { initAnalytics } from '@/lib/analytics'
|
||||||
import { useTheme } from '@/hooks/useTheme'
|
import { useTheme } from '@/hooks/useTheme'
|
||||||
|
import { ErrorBoundary } from '@/components/ErrorBoundary'
|
||||||
import { Home } from '@/pages/Home'
|
import { Home } from '@/pages/Home'
|
||||||
import { Login } from '@/pages/Login'
|
import { Login } from '@/pages/Login'
|
||||||
import { Register } from '@/pages/Register'
|
import { Register } from '@/pages/Register'
|
||||||
@@ -135,11 +136,13 @@ function App() {
|
|||||||
useTheme()
|
useTheme()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<ErrorBoundary>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
<AppRoutes />
|
<AppRoutes />
|
||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
</ErrorBoundary>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
53
client/src/components/ErrorBoundary.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import { Component, ReactNode } from 'react'
|
||||||
|
import { AlertTriangle } from 'lucide-react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
children: ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
hasError: boolean
|
||||||
|
error: Error | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ErrorBoundary extends Component<Props, State> {
|
||||||
|
constructor(props: Props) {
|
||||||
|
super(props)
|
||||||
|
this.state = { hasError: false, error: null }
|
||||||
|
}
|
||||||
|
|
||||||
|
static getDerivedStateFromError(error: Error): State {
|
||||||
|
return { hasError: true, error }
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidCatch(error: Error, errorInfo: any) {
|
||||||
|
console.error('ErrorBoundary caught:', error, errorInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
if (this.state.hasError) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen flex items-center justify-center bg-slate-50 dark:bg-slate-900 p-4">
|
||||||
|
<div className="max-w-md w-full bg-white dark:bg-slate-800 rounded-lg shadow-lg p-6 text-center">
|
||||||
|
<AlertTriangle className="w-12 h-12 text-red-500 mx-auto mb-4" />
|
||||||
|
<h1 className="text-xl font-bold text-slate-900 dark:text-slate-100 mb-2">
|
||||||
|
Something went wrong
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm text-slate-600 dark:text-slate-400 mb-6">
|
||||||
|
{this.state.error?.message || 'An unexpected error occurred'}
|
||||||
|
</p>
|
||||||
|
<Button
|
||||||
|
onClick={() => window.location.href = '/'}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
Go to Home
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.props.children
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,39 +17,41 @@ const stepLabels: Record<string, string> = {
|
|||||||
'completed': 'Completed',
|
'completed': 'Completed',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const stepOrder = ['connect', 'first_rule', 'see_results', 'auto_schedule']
|
||||||
|
const stepOrderShort = ['connect', 'see_results']
|
||||||
|
|
||||||
export function OnboardingProgress({ currentStep, completedSteps, totalSteps, onSkip }: OnboardingProgressProps) {
|
export function OnboardingProgress({ currentStep, completedSteps, totalSteps, onSkip }: OnboardingProgressProps) {
|
||||||
const stepIndex = ['connect', 'first_rule', 'see_results', 'auto_schedule'].indexOf(currentStep)
|
const steps = totalSteps === 2 ? stepOrderShort : stepOrder
|
||||||
const currentStepNumber = stepIndex >= 0 ? stepIndex + 1 : 0
|
const stepIndex = steps.indexOf(currentStep)
|
||||||
const progress = totalSteps > 0 ? (completedSteps.length / totalSteps) * 100 : 0
|
const currentStepNumber = stepIndex >= 0 ? stepIndex + 1 : 1
|
||||||
|
const progress = totalSteps > 0 ? (completedSteps.filter(s => steps.includes(s)).length / totalSteps) * 100 : 0
|
||||||
|
|
||||||
if (currentStep === 'completed' || currentStep === 'not_started') {
|
if (currentStep === 'completed' || currentStep === 'not_started') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-white border border-slate-200 rounded-lg p-4 shadow-sm">
|
<div className="bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg p-4 shadow-sm">
|
||||||
<div className="flex items-center justify-between mb-3">
|
<div className="flex items-center justify-between mb-3">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm font-semibold text-slate-900">Getting started</p>
|
<p className="text-sm font-semibold text-slate-900 dark:text-slate-100">Getting started</p>
|
||||||
<p className="text-xs text-slate-500">Step {currentStepNumber} of {totalSteps}</p>
|
<p className="text-xs text-slate-500 dark:text-slate-400">Step {currentStepNumber} of {totalSteps}</p>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="ghost" size="sm" onClick={onSkip} className="text-slate-500 hover:text-slate-700">
|
<Button variant="ghost" size="sm" onClick={onSkip} className="text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-300">
|
||||||
<X className="w-4 h-4 mr-1" />
|
<X className="w-4 h-4 mr-1" />
|
||||||
Skip
|
I'll do this later
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Progress bar */}
|
<div className="w-full h-2 bg-slate-100 dark:bg-slate-700 rounded-full overflow-hidden mb-2">
|
||||||
<div className="w-full h-2 bg-slate-100 rounded-full overflow-hidden mb-2">
|
|
||||||
<div
|
<div
|
||||||
className="h-full bg-primary-500 transition-all duration-300"
|
className="h-full bg-primary-500 transition-all duration-300"
|
||||||
style={{ width: `${progress}%` }}
|
style={{ width: `${Math.min(100, progress)}%` }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Step indicators */}
|
<div className="flex items-center gap-2 text-xs text-slate-500 dark:text-slate-400">
|
||||||
<div className="flex items-center gap-2 text-xs text-slate-500">
|
{steps.map((step, idx) => {
|
||||||
{['connect', 'first_rule', 'see_results', 'auto_schedule'].map((step, idx) => {
|
|
||||||
const isCompleted = completedSteps.includes(step)
|
const isCompleted = completedSteps.includes(step)
|
||||||
const isCurrent = currentStep === step
|
const isCurrent = currentStep === step
|
||||||
|
|
||||||
@@ -59,8 +61,8 @@ export function OnboardingProgress({ currentStep, completedSteps, totalSteps, on
|
|||||||
isCompleted
|
isCompleted
|
||||||
? 'bg-green-500 text-white'
|
? 'bg-green-500 text-white'
|
||||||
: isCurrent
|
: isCurrent
|
||||||
? 'bg-primary-500 text-white ring-2 ring-primary-200'
|
? 'bg-primary-500 text-white ring-2 ring-primary-200 dark:ring-primary-800'
|
||||||
: 'bg-slate-200 text-slate-400'
|
: 'bg-slate-200 dark:bg-slate-600 text-slate-400'
|
||||||
}`}>
|
}`}>
|
||||||
{isCompleted ? (
|
{isCompleted ? (
|
||||||
<Check className="w-3 h-3" />
|
<Check className="w-3 h-3" />
|
||||||
@@ -69,13 +71,13 @@ export function OnboardingProgress({ currentStep, completedSteps, totalSteps, on
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<span className={`truncate hidden sm:inline ${
|
<span className={`truncate hidden sm:inline ${
|
||||||
isCurrent ? 'text-slate-900 font-medium' : ''
|
isCurrent ? 'text-slate-900 dark:text-slate-100 font-medium' : ''
|
||||||
}`}>
|
}`}>
|
||||||
{stepLabels[step] || step}
|
{stepLabels[step] || (step === 'see_results' ? 'Done' : step)}
|
||||||
</span>
|
</span>
|
||||||
{idx < 3 && (
|
{idx < steps.length - 1 && (
|
||||||
<div className={`flex-1 h-0.5 mx-1 ${
|
<div className={`flex-1 h-0.5 mx-1 ${
|
||||||
isCompleted ? 'bg-green-500' : 'bg-slate-200'
|
isCompleted ? 'bg-green-500' : 'bg-slate-200 dark:bg-slate-600'
|
||||||
}`} />
|
}`} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export function ShareResults({ sortedCount, referralCode }: ShareResultsProps) {
|
|||||||
const [copied, setCopied] = useState(false)
|
const [copied, setCopied] = useState(false)
|
||||||
const { user } = useAuth()
|
const { user } = useAuth()
|
||||||
|
|
||||||
const shareText = `I cleaned up ${sortedCount} emails with EmailSorter${referralCode ? `! Use code ${referralCode} for a bonus.` : '!'}`
|
const shareText = `I cleaned up ${sortedCount} emails with MailFlow${referralCode ? `! Use code ${referralCode} for a bonus.` : '!'}`
|
||||||
const shareUrl = referralCode
|
const shareUrl = referralCode
|
||||||
? `${window.location.origin}?ref=${referralCode}`
|
? `${window.location.origin}?ref=${referralCode}`
|
||||||
: window.location.origin
|
: window.location.origin
|
||||||
@@ -33,7 +33,7 @@ export function ShareResults({ sortedCount, referralCode }: ShareResultsProps) {
|
|||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
try {
|
try {
|
||||||
await navigator.share({
|
await navigator.share({
|
||||||
title: 'EmailSorter - Clean Inbox',
|
title: 'MailFlow - Clean Inbox',
|
||||||
text: shareText,
|
text: shareText,
|
||||||
url: shareUrl,
|
url: shareUrl,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { X, Sparkles, Zap, Infinity } from 'lucide-react'
|
import { X, Sparkles, Zap, Infinity as InfinityIcon } from 'lucide-react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { trackUpgradeClicked } from '@/lib/analytics'
|
import { trackUpgradeClicked } from '@/lib/analytics'
|
||||||
import { useAuth } from '@/context/AuthContext'
|
import { useAuth } from '@/context/AuthContext'
|
||||||
@@ -97,7 +97,7 @@ export function UpgradePrompt({
|
|||||||
onClick={handleUpgrade}
|
onClick={handleUpgrade}
|
||||||
className="flex-1 bg-primary-600 hover:bg-primary-700"
|
className="flex-1 bg-primary-600 hover:bg-primary-700"
|
||||||
>
|
>
|
||||||
<Infinity className="w-4 h-4 mr-2" />
|
<InfinityIcon className="w-4 h-4 mr-2" />
|
||||||
Upgrade
|
Upgrade
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,119 +1,66 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
import { ChevronDown, HelpCircle } from 'lucide-react'
|
|
||||||
import { cn } from '@/lib/utils'
|
|
||||||
|
|
||||||
const faqs = [
|
const faqs = [
|
||||||
{
|
{
|
||||||
question: "Are my emails secure?",
|
question: "Why not just use Gmail filters?",
|
||||||
answer: "Yes! We use OAuth – we never see your password. Content is only analyzed briefly, never stored."
|
answer: "Gmail filters need rules you write (sender, keywords). We read the email and put it in Lead, Client, or Noise — no rules."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: "Which email providers work?",
|
question: "What happens to my emails?",
|
||||||
answer: "Gmail and Outlook. More coming soon."
|
answer: "We only read headers and a short snippet to choose the label. We don't store your mail or use it for ads. Disconnect and we stop."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: "Can I create custom rules?",
|
question: "Can this mess up my inbox?",
|
||||||
answer: "Absolutely! You can set VIP contacts and define custom categories."
|
answer: "We only add labels or move to folders. We don't delete. Disconnect and nothing stays changed."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: "What about old emails?",
|
question: "Do you need my password?",
|
||||||
answer: "The last 30 days are analyzed. You decide if they should be sorted too."
|
answer: "No. You sign in with Google or Microsoft. We never see or store your password. You can revoke access anytime."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: "Can I cancel anytime?",
|
question: "What if I don't like it?",
|
||||||
answer: "Yes, with one click. No tricks, no long commitments."
|
answer: "Cancel anytime. No contract. Your data is yours; disconnect and we stop. Free trial, no card."
|
||||||
},
|
|
||||||
{
|
|
||||||
question: "Do I need a credit card?",
|
|
||||||
answer: "No, the 14-day trial is completely free."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
question: "Does it work on mobile?",
|
|
||||||
answer: "Yes! Sorting runs on our servers – works in any email app."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
question: "What if the AI sorts wrong?",
|
|
||||||
answer: "Just correct it. The AI learns and gets better over time."
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export function FAQ() {
|
export function FAQ() {
|
||||||
const [openIndex, setOpenIndex] = useState<number | null>(0)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="faq" className="py-24 bg-slate-50 dark:bg-slate-900">
|
<section id="faq" className="py-24 bg-slate-50 dark:bg-slate-900">
|
||||||
<div className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
{/* Section header */}
|
<div className="text-center mb-12">
|
||||||
<div className="text-center mb-16">
|
<h2 className="text-3xl sm:text-4xl font-bold text-slate-900 dark:text-slate-100 mb-2">
|
||||||
<div className="inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-100 dark:bg-primary-900/30 mb-6">
|
Questions we get a lot
|
||||||
<HelpCircle className="w-8 h-8 text-primary-600 dark:text-primary-400" />
|
|
||||||
</div>
|
|
||||||
<h2 className="text-3xl sm:text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">
|
|
||||||
FAQ
|
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-lg text-slate-600 dark:text-slate-400">
|
<p className="text-slate-600 dark:text-slate-400">
|
||||||
Quick answers to common questions.
|
Straight answers. No fluff.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* FAQ items */}
|
<div className="space-y-12">
|
||||||
<div className="space-y-3">
|
|
||||||
{faqs.map((faq, index) => (
|
{faqs.map((faq, index) => (
|
||||||
<FAQItem
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
question={faq.question}
|
className="grid grid-cols-1 md:grid-cols-2 gap-6 md:gap-10 items-baseline"
|
||||||
answer={faq.answer}
|
>
|
||||||
isOpen={openIndex === index}
|
<p className="text-lg md:text-xl font-semibold text-slate-900 dark:text-slate-100">
|
||||||
onClick={() => setOpenIndex(openIndex === index ? null : index)}
|
{faq.question}
|
||||||
/>
|
</p>
|
||||||
|
<p className="text-sm text-slate-600 dark:text-slate-400 leading-relaxed">
|
||||||
|
{faq.answer}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Contact CTA */}
|
<p className="mt-10 text-center text-sm text-slate-600 dark:text-slate-400">
|
||||||
<div className="mt-12 text-center p-6 bg-white dark:bg-slate-800 rounded-2xl border border-slate-200 dark:border-slate-700">
|
Still unsure?{' '}
|
||||||
<p className="text-slate-600 dark:text-slate-400 mb-2">Still have questions?</p>
|
|
||||||
<a
|
<a
|
||||||
href="mailto:support@emailsorter.com"
|
href="mailto:support@mailflow.webklar.com"
|
||||||
className="text-primary-600 dark:text-primary-400 font-semibold hover:text-primary-700 dark:hover:text-primary-300"
|
className="text-slate-700 dark:text-slate-300 hover:underline"
|
||||||
>
|
>
|
||||||
Contact us →
|
Email us — we reply fast
|
||||||
</a>
|
</a>
|
||||||
</div>
|
.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FAQItemProps {
|
|
||||||
question: string
|
|
||||||
answer: string
|
|
||||||
isOpen: boolean
|
|
||||||
onClick: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
function FAQItem({ question, answer, isOpen, onClick }: FAQItemProps) {
|
|
||||||
return (
|
|
||||||
<div className="bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 overflow-hidden">
|
|
||||||
<button
|
|
||||||
className="w-full px-6 py-4 text-left flex items-center justify-between hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors"
|
|
||||||
onClick={onClick}
|
|
||||||
>
|
|
||||||
<span className="font-semibold text-slate-900 dark:text-slate-100 pr-4">{question}</span>
|
|
||||||
<ChevronDown
|
|
||||||
className={cn(
|
|
||||||
"w-5 h-5 text-slate-400 dark:text-slate-500 transition-transform duration-200 flex-shrink-0",
|
|
||||||
isOpen && "rotate-180"
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<div
|
|
||||||
className={cn(
|
|
||||||
"overflow-hidden transition-all duration-200",
|
|
||||||
isOpen ? "max-h-40" : "max-h-0"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<p className="px-6 pb-4 text-slate-600 dark:text-slate-400">{answer}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,111 +1,174 @@
|
|||||||
import {
|
import {
|
||||||
Brain,
|
FolderTree,
|
||||||
Zap,
|
MousePointerClick,
|
||||||
Shield,
|
CalendarClock,
|
||||||
Clock,
|
ScanSearch,
|
||||||
Settings,
|
ShieldCheck,
|
||||||
Inbox,
|
Sparkles,
|
||||||
Filter
|
Filter,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
|
|
||||||
const features = [
|
const FEATURES = [
|
||||||
{
|
{
|
||||||
icon: Inbox,
|
icon: FolderTree,
|
||||||
title: "Stop drowning in emails",
|
title: "Categories, not chaos",
|
||||||
description: "Clear inbox, less stress. Automatically sort newsletters, promotions, and social updates away from what matters.",
|
desc: "Leads, clients, invoices, newsletters — sorted into folders. Your inbox shows what pays first.",
|
||||||
color: "from-violet-500 to-purple-600",
|
glowClass: "from-orange-500/20 to-amber-500/20",
|
||||||
highlight: true,
|
delay: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Zap,
|
icon: MousePointerClick,
|
||||||
title: "One-click smart rules",
|
title: "One click to sort",
|
||||||
description: "AI suggests, you approve. Create smart rules in seconds and apply them with one click.",
|
desc: "Connect your inbox, click Sort Now. No rules to write. We read and categorize; you review.",
|
||||||
color: "from-amber-500 to-orange-600",
|
glowClass: "from-emerald-500/20 to-teal-500/20",
|
||||||
highlight: true,
|
delay: 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Settings,
|
icon: CalendarClock,
|
||||||
title: "Automation that keeps working",
|
title: "Runs when you want",
|
||||||
description: "Set it and forget it. Your inbox stays organized automatically, day after day.",
|
desc: "Sort on demand or set a schedule. Your inbox stays organized without you touching it.",
|
||||||
color: "from-blue-500 to-cyan-600",
|
glowClass: "from-blue-500/20 to-indigo-500/20",
|
||||||
highlight: true,
|
delay: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Brain,
|
icon: ScanSearch,
|
||||||
title: "AI-powered smart sorting",
|
title: "Content-aware sorting",
|
||||||
description: "Our AI automatically recognizes whether an email is an invoice, newsletter, or important message.",
|
desc: "We look at sender, subject, and a short snippet to decide the category. No keyword lists.",
|
||||||
color: "from-green-500 to-emerald-600"
|
glowClass: "from-violet-500/20 to-purple-500/20",
|
||||||
|
delay: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Shield,
|
icon: ShieldCheck,
|
||||||
title: "GDPR compliant",
|
title: "Minimal data",
|
||||||
description: "Your data stays secure. We only read email headers and metadata for sorting.",
|
desc: "We only read what we need to categorize. No storing email body or attachments. GDPR compliant.",
|
||||||
color: "from-pink-500 to-rose-600"
|
glowClass: "from-green-500/20 to-emerald-500/20",
|
||||||
|
delay: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Clock,
|
icon: Sparkles,
|
||||||
title: "Save time",
|
title: "Less time on triage",
|
||||||
description: "Average 2 hours per week less on email organization. More time for what matters.",
|
desc: "Spend less time deciding what's important. Inbox shows clients and leads first.",
|
||||||
color: "from-indigo-500 to-blue-600"
|
glowClass: "from-cyan-500/20 to-blue-500/20",
|
||||||
|
delay: 250,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
function FeatureItem({
|
||||||
|
icon: Icon,
|
||||||
|
title,
|
||||||
|
desc,
|
||||||
|
glowClass,
|
||||||
|
delay,
|
||||||
|
}: {
|
||||||
|
icon: React.ElementType
|
||||||
|
title: string
|
||||||
|
desc: string
|
||||||
|
glowClass: string
|
||||||
|
delay: number
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="group relative"
|
||||||
|
style={{ animationDelay: `${delay}ms` }}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className={`absolute inset-0 bg-gradient-to-br ${glowClass} rounded-xl opacity-0 group-hover:opacity-100 blur-xl transition-opacity duration-300 -z-10 scale-110`}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="relative p-4 rounded-xl border border-slate-200 dark:border-slate-700 bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm h-full
|
||||||
|
transform-gpu transition-all duration-300 ease-out
|
||||||
|
hover:border-primary-400/40 dark:hover:border-primary-500/40 hover:shadow-lg hover:shadow-primary-500/5
|
||||||
|
hover:-translate-y-1 hover:scale-[1.02]
|
||||||
|
group-hover:bg-white dark:group-hover:bg-slate-800/95"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className="absolute inset-0 rounded-xl overflow-hidden opacity-0 group-hover:opacity-100 transition-opacity duration-300"
|
||||||
|
>
|
||||||
|
<div className="absolute inset-0 -translate-x-full group-hover:translate-x-full transition-transform duration-700 ease-out bg-gradient-to-r from-transparent via-white/10 dark:via-white/5 to-transparent" />
|
||||||
|
</div>
|
||||||
|
<div className="relative z-10">
|
||||||
|
<div className="flex items-start gap-3 mb-3">
|
||||||
|
<div
|
||||||
|
className="p-2.5 bg-primary-500/10 rounded-xl text-primary-600 dark:text-primary-400 shrink-0
|
||||||
|
transition-all duration-300 ease-out
|
||||||
|
group-hover:bg-primary-500 group-hover:text-white
|
||||||
|
group-hover:scale-110 group-hover:rotate-3 group-hover:shadow-lg group-hover:shadow-primary-500/25"
|
||||||
|
>
|
||||||
|
<Icon className="h-6 w-6" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden />
|
||||||
|
</div>
|
||||||
|
<h4 className="text-base font-semibold text-slate-900 dark:text-slate-100 transition-colors duration-300 group-hover:text-primary-600 dark:group-hover:text-primary-400 pt-0.5">
|
||||||
|
{title}
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<p
|
||||||
|
className="text-sm text-slate-500 dark:text-slate-400 leading-relaxed transition-all duration-300
|
||||||
|
opacity-90 group-hover:opacity-100 group-hover:text-slate-700 dark:group-hover:text-slate-300"
|
||||||
|
>
|
||||||
|
{desc}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export function Features() {
|
export function Features() {
|
||||||
return (
|
return (
|
||||||
<section id="features" className="py-24 bg-slate-50 dark:bg-slate-900">
|
<section id="features" className="py-24 bg-slate-50 dark:bg-slate-900">
|
||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
{/* Section header */}
|
{/* Single card in engineering-card style */}
|
||||||
<div className="text-center mb-16">
|
<div
|
||||||
<h2 className="text-3xl sm:text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">
|
data-slot="card"
|
||||||
Everything you need for{' '}
|
className="relative bg-white/80 dark:bg-slate-800/60 text-slate-900 dark:text-slate-100 flex flex-col gap-6 rounded-2xl border border-slate-200 dark:border-slate-700 backdrop-blur-md shadow-lg shadow-black/5 dark:shadow-black/20 transform-gpu transition-all duration-300 ease-out hover:shadow-2xl hover:shadow-primary-500/10 hover:border-primary-400/30 dark:hover:border-primary-500/20 overflow-hidden
|
||||||
<span className="text-transparent bg-clip-text bg-gradient-to-r from-primary-600 to-accent-500">
|
before:absolute before:inset-0 before:rounded-2xl before:p-[1.5px] before:bg-gradient-to-br before:from-primary-500/50 before:via-accent-500/30 before:to-primary-500/50 before:-z-10 before:opacity-0 before:transition-opacity before:duration-500 hover:before:opacity-100
|
||||||
Inbox Zero
|
after:absolute after:inset-0 after:rounded-2xl after:-z-20 after:bg-gradient-to-br after:from-primary-500/5 after:via-transparent after:to-accent-500/5 after:opacity-0 after:transition-opacity after:duration-500 hover:after:opacity-100
|
||||||
</span>
|
p-6 md:p-8"
|
||||||
</h2>
|
>
|
||||||
<p className="text-lg text-slate-600 dark:text-slate-400 max-w-2xl mx-auto">
|
<div className="mb-8 text-center">
|
||||||
EmailSorter combines AI technology with proven email management methods
|
<h3 className="text-2xl font-bold text-slate-900 dark:text-slate-100 mb-2">What it does</h3>
|
||||||
for maximum productivity.
|
<p className="text-slate-600 dark:text-slate-400 max-w-xl mx-auto">
|
||||||
|
Sort incoming mail into categories so your inbox shows what matters first. No rules to write.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Features grid */}
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
|
{FEATURES.map((feature, i) => (
|
||||||
{features.map((feature, index) => (
|
<FeatureItem key={i} {...feature} />
|
||||||
<FeatureCard key={index} {...feature} index={index} />
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Bottom illustration */}
|
{/* Before → After strip (engineering-card style) */}
|
||||||
<div className="mt-20 relative">
|
<div
|
||||||
<div className="bg-white dark:bg-slate-800 rounded-3xl border border-slate-200 dark:border-slate-700 shadow-xl p-8 max-w-4xl mx-auto">
|
className="mt-8 p-5 bg-gradient-to-r from-primary-500/10 via-accent-500/10 to-primary-500/10 rounded-xl border border-primary-500/20
|
||||||
<div className="grid md:grid-cols-3 gap-8 items-center">
|
relative overflow-hidden group/featured transition-all duration-300 hover:border-primary-500/40 hover:shadow-lg hover:shadow-primary-500/10"
|
||||||
{/* Before */}
|
>
|
||||||
<div className="text-center">
|
<div
|
||||||
<div className="w-20 h-20 mx-auto mb-4 rounded-2xl bg-red-100 dark:bg-red-900/30 flex items-center justify-center">
|
aria-hidden="true"
|
||||||
<Inbox className="w-10 h-10 text-red-500 dark:text-red-400" />
|
className="absolute inset-0 rounded-xl opacity-0 group-hover/featured:opacity-100 transition-opacity duration-500"
|
||||||
|
>
|
||||||
|
<div className="absolute inset-[-1px] rounded-xl bg-gradient-to-r from-primary-500 via-accent-500 to-primary-500 bg-[length:200%_100%] animate-gradient-x opacity-30" />
|
||||||
</div>
|
</div>
|
||||||
<h4 className="font-semibold text-slate-900 dark:text-slate-100 mb-1">Before</h4>
|
<div className="relative flex flex-col md:flex-row items-stretch md:items-center gap-6 md:gap-8">
|
||||||
<p className="text-sm text-slate-500 dark:text-slate-400">Inbox chaos</p>
|
<div className="flex-1 flex flex-col md:flex-row items-center gap-4 md:gap-6 p-4 rounded-xl bg-slate-50/50 dark:bg-slate-900/50 border border-slate-200/50 dark:border-slate-700/50">
|
||||||
<div className="mt-3 text-3xl font-bold text-red-500 dark:text-red-400">847</div>
|
<span className="text-xs font-semibold uppercase tracking-wider text-slate-500 dark:text-slate-400">Before</span>
|
||||||
<p className="text-xs text-slate-400 dark:text-slate-500">unread emails</p>
|
<div className="text-center md:text-left">
|
||||||
</div>
|
<p className="font-bold text-slate-900 dark:text-slate-100 text-lg">Inbox chaos</p>
|
||||||
|
<p className="text-3xl md:text-4xl font-bold text-primary-600 dark:text-primary-400 mt-1">847</p>
|
||||||
{/* Arrow */}
|
<p className="text-sm text-slate-500 dark:text-slate-400">unread emails</p>
|
||||||
<div className="hidden md:flex justify-center">
|
|
||||||
<div className="w-24 h-24 rounded-full bg-gradient-to-r from-primary-500 to-accent-500 flex items-center justify-center shadow-lg">
|
|
||||||
<Filter className="w-10 h-10 text-white" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center justify-center shrink-0 text-slate-400 dark:text-slate-500 group-hover/featured:text-primary-500 transition-colors duration-300">
|
||||||
{/* After */}
|
<Filter className="w-7 h-7" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden />
|
||||||
<div className="text-center">
|
</div>
|
||||||
<div className="w-20 h-20 mx-auto mb-4 rounded-2xl bg-green-100 dark:bg-green-900/30 flex items-center justify-center">
|
<div className="flex-1 flex flex-col md:flex-row items-center gap-4 md:gap-6 p-4 rounded-xl bg-primary-500/10 border border-primary-500/20">
|
||||||
<Inbox className="w-10 h-10 text-green-500 dark:text-green-400" />
|
<span className="text-xs font-semibold uppercase tracking-wider text-primary-600 dark:text-primary-400">After</span>
|
||||||
|
<div className="text-center md:text-left">
|
||||||
|
<p className="font-bold text-slate-900 dark:text-slate-100 text-lg">All sorted</p>
|
||||||
|
<p className="text-3xl md:text-4xl font-bold text-primary-600 dark:text-primary-400 mt-1">12</p>
|
||||||
|
<p className="text-sm text-slate-500 dark:text-slate-400">important emails</p>
|
||||||
</div>
|
</div>
|
||||||
<h4 className="font-semibold text-slate-900 dark:text-slate-100 mb-1">After</h4>
|
|
||||||
<p className="text-sm text-slate-500 dark:text-slate-400">All sorted</p>
|
|
||||||
<div className="mt-3 text-3xl font-bold text-green-500 dark:text-green-400">12</div>
|
|
||||||
<p className="text-xs text-slate-400 dark:text-slate-500">important emails</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,31 +177,3 @@ export function Features() {
|
|||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FeatureCardProps {
|
|
||||||
icon: React.ElementType
|
|
||||||
title: string
|
|
||||||
description: string
|
|
||||||
color: string
|
|
||||||
index: number
|
|
||||||
highlight?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
function FeatureCard({ icon: Icon, title, description, color, index, highlight }: FeatureCardProps) {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={`group rounded-2xl p-6 border transition-all duration-300 ${
|
|
||||||
highlight
|
|
||||||
? 'bg-gradient-to-br from-white dark:from-slate-800 to-slate-50 dark:to-slate-800/50 border-primary-200 dark:border-primary-800 hover:border-primary-300 dark:hover:border-primary-700 hover:shadow-xl'
|
|
||||||
: 'bg-white dark:bg-slate-800 border-slate-200 dark:border-slate-700 hover:border-primary-200 dark:hover:border-primary-800 hover:shadow-lg'
|
|
||||||
}`}
|
|
||||||
style={{ animationDelay: `${index * 0.1}s` }}
|
|
||||||
>
|
|
||||||
<div className={`w-14 h-14 rounded-xl bg-gradient-to-br ${color} flex items-center justify-center mb-5 group-hover:scale-110 transition-transform duration-300 shadow-lg`}>
|
|
||||||
<Icon className="w-7 h-7 text-white" />
|
|
||||||
</div>
|
|
||||||
<h3 className={`${highlight ? 'text-2xl' : 'text-xl'} font-semibold text-slate-900 dark:text-slate-100 mb-2`}>{title}</h3>
|
|
||||||
<p className="text-slate-600 dark:text-slate-400">{description}</p>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,16 +8,19 @@ export function Footer() {
|
|||||||
<div className="grid md:grid-cols-4 gap-12">
|
<div className="grid md:grid-cols-4 gap-12">
|
||||||
{/* Brand */}
|
{/* Brand */}
|
||||||
<div className="md:col-span-1">
|
<div className="md:col-span-1">
|
||||||
<Link to="/" className="flex items-center gap-2 mb-4">
|
<Link to="/" className="flex items-center mb-4 leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-white">
|
className="w-20 h-20 rounded-xl object-contain pr-[5px] block"
|
||||||
E-Mail-<span className="text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-white ml-[5px]">
|
||||||
|
Mail<span className="text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
<p className="text-sm text-slate-400 mb-6">
|
<p className="text-sm text-slate-400 mb-6">
|
||||||
AI-powered email sorting for more productivity and less stress.
|
Email sorting for freelancers and small teams. Gmail & Outlook.
|
||||||
</p>
|
</p>
|
||||||
{/* Social links */}
|
{/* Social links */}
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
@@ -70,26 +73,19 @@ export function Footer() {
|
|||||||
FAQ
|
FAQ
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href="#" className="hover:text-white transition-colors">
|
|
||||||
Roadmap
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Company */}
|
{/* Contact */}
|
||||||
<div>
|
<div>
|
||||||
<h4 className="font-semibold text-white mb-4">Company</h4>
|
<h4 className="font-semibold text-white mb-4">Contact</h4>
|
||||||
<ul className="space-y-3">
|
<ul className="space-y-3">
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="https://webklar.com"
|
href="mailto:support@mailflow.webklar.com"
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="hover:text-white transition-colors"
|
className="hover:text-white transition-colors"
|
||||||
>
|
>
|
||||||
About us
|
support@mailflow.webklar.com
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -99,25 +95,7 @@ export function Footer() {
|
|||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="hover:text-white transition-colors"
|
className="hover:text-white transition-colors"
|
||||||
>
|
>
|
||||||
Blog
|
webklar.com
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://webklar.com"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="hover:text-white transition-colors"
|
|
||||||
>
|
|
||||||
Careers
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="mailto:support@webklar.com"
|
|
||||||
className="hover:text-white transition-colors"
|
|
||||||
>
|
|
||||||
Contact
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -142,16 +120,6 @@ export function Footer() {
|
|||||||
Impressum
|
Impressum
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://webklar.com"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="hover:text-white transition-colors"
|
|
||||||
>
|
|
||||||
webklar.com
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -160,10 +128,7 @@ export function Footer() {
|
|||||||
<div className="mt-12 pt-8 border-t border-slate-800">
|
<div className="mt-12 pt-8 border-t border-slate-800">
|
||||||
<div className="flex flex-col md:flex-row justify-between items-center gap-4 mb-4">
|
<div className="flex flex-col md:flex-row justify-between items-center gap-4 mb-4">
|
||||||
<p className="text-sm text-slate-500">
|
<p className="text-sm text-slate-500">
|
||||||
© {new Date().getFullYear()} EmailSorter. All rights reserved.
|
© {new Date().getFullYear()} MailFlow
|
||||||
</p>
|
|
||||||
<p className="text-sm text-slate-500">
|
|
||||||
Made with ❤️
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/* webklar.com Verweis */}
|
{/* webklar.com Verweis */}
|
||||||
|
|||||||
@@ -1,11 +1,94 @@
|
|||||||
|
import { useState, useRef, useEffect } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { captureUTMParams } from '@/lib/analytics'
|
import { captureUTMParams } from '@/lib/analytics'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Badge } from '@/components/ui/badge'
|
import { Badge } from '@/components/ui/badge'
|
||||||
import { ArrowRight, Mail, Inbox, Sparkles, Check, Zap } from 'lucide-react'
|
import { ArrowRight, Sparkles, Check } from 'lucide-react'
|
||||||
|
|
||||||
|
const HERO_TESTIMONIALS = [
|
||||||
|
{ name: 'Sarah M.', quote: 'Inbox finally under control.', position: 'top-20 -left-10', rotate: '-20deg', side: 'left' as const },
|
||||||
|
{ name: 'Tom K.', quote: 'Newsletters sorted automatically.', position: 'top-1/2 -left-10 -translate-y-1/2', rotate: '-10deg', side: 'left' as const },
|
||||||
|
{ name: 'Lisa R.', quote: 'Leads never get lost again.', position: 'top-20 -right-10', rotate: '20deg', side: 'right' as const },
|
||||||
|
{ name: 'Jan P.', quote: 'Game changer for freelancers.', position: 'bottom-20 -left-10', rotate: '-10deg', side: 'left' as const },
|
||||||
|
{ name: 'Anna L.', quote: 'Gmail & Outlook in one place.', position: 'bottom-1/2 -right-10 -translate-y-1/2', rotate: '10deg', side: 'right' as const },
|
||||||
|
{ name: 'Max B.', quote: 'Spam stays out of my inbox.', position: 'bottom-20 -right-10', rotate: '20deg', side: 'right' as const },
|
||||||
|
]
|
||||||
|
|
||||||
|
function useScrollBow(heroRef: React.RefObject<HTMLElement | null>) {
|
||||||
|
const [progress, setProgress] = useState(0)
|
||||||
|
useEffect(() => {
|
||||||
|
const hero = heroRef?.current
|
||||||
|
if (!hero) return
|
||||||
|
|
||||||
|
let rafId: number | null = null
|
||||||
|
const onScroll = () => {
|
||||||
|
if (rafId !== null) return
|
||||||
|
rafId = requestAnimationFrame(() => {
|
||||||
|
const rect = hero.getBoundingClientRect()
|
||||||
|
const h = rect.height
|
||||||
|
if (h <= 0) {
|
||||||
|
rafId = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const p = Math.max(0, Math.min(1, -rect.top / h))
|
||||||
|
setProgress((prev) => {
|
||||||
|
if (Math.abs(prev - p) > 0.05) {
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
return prev
|
||||||
|
})
|
||||||
|
rafId = null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onScroll()
|
||||||
|
window.addEventListener('scroll', onScroll, { passive: true })
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('scroll', onScroll)
|
||||||
|
if (rafId !== null) cancelAnimationFrame(rafId)
|
||||||
|
}
|
||||||
|
}, [heroRef])
|
||||||
|
return progress
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestimonialItem = (typeof HERO_TESTIMONIALS)[number]
|
||||||
|
|
||||||
|
function HeroEdgeCard({ name, quote, position, rotate, side, scrollProgress }: TestimonialItem & { scrollProgress: number }) {
|
||||||
|
const dropY = scrollProgress * 80
|
||||||
|
const flyOutX = scrollProgress * 600
|
||||||
|
const moveX = side === 'left' ? -flyOutX : flyOutX
|
||||||
|
const transform = `translate(${moveX}px, ${dropY}px) rotate(${rotate})`
|
||||||
|
const opacity = Math.max(0, 1 - scrollProgress * 1.2)
|
||||||
|
const visibility = opacity <= 0 ? 'hidden' : 'visible'
|
||||||
|
const styleOpacity = scrollProgress > 0 ? opacity : undefined
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
'hero-edge-card absolute z-20 flex items-center gap-1 rounded-md bg-white p-1 shadow-md dark:bg-slate-800 border border-slate-200 dark:border-slate-700',
|
||||||
|
position,
|
||||||
|
'hidden md:flex transition-all duration-200 ease-out'
|
||||||
|
)}
|
||||||
|
style={{ transform, ...(styleOpacity !== undefined ? { opacity: styleOpacity } : {}), visibility }}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="E-Mail"
|
||||||
|
width={128}
|
||||||
|
height={128}
|
||||||
|
className="h-auto max-h-32 w-32 shrink-0 object-contain object-center block m-0"
|
||||||
|
src="/logo.png"
|
||||||
|
/>
|
||||||
|
<div className="max-w-[160px]">
|
||||||
|
<h3 className="text-sm font-medium text-slate-800 dark:text-slate-200">{name}</h3>
|
||||||
|
<p className="text-xs text-slate-600 dark:text-slate-400">{quote}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export function Hero() {
|
export function Hero() {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const heroRef = useRef<HTMLElement>(null)
|
||||||
|
const scrollProgress = useScrollBow(heroRef)
|
||||||
|
|
||||||
const handleCTAClick = () => {
|
const handleCTAClick = () => {
|
||||||
// Capture UTM parameters before navigation
|
// Capture UTM parameters before navigation
|
||||||
@@ -14,8 +97,13 @@ export function Hero() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="relative min-h-screen flex items-center overflow-hidden">
|
<section ref={heroRef} className="relative min-h-screen flex items-center overflow-hidden">
|
||||||
{/* Background */}
|
{/* Edge cards – stick to sides, animate on scroll (bow out) */}
|
||||||
|
{HERO_TESTIMONIALS.map((t) => (
|
||||||
|
<HeroEdgeCard key={t.name} {...t} scrollProgress={scrollProgress} />
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* Background – unchanged */}
|
||||||
<div className="absolute inset-0 gradient-hero" />
|
<div className="absolute inset-0 gradient-hero" />
|
||||||
<div className="absolute inset-0 gradient-mesh opacity-30" />
|
<div className="absolute inset-0 gradient-mesh opacity-30" />
|
||||||
|
|
||||||
@@ -33,47 +121,46 @@ export function Hero() {
|
|||||||
<div className="text-center lg:text-left">
|
<div className="text-center lg:text-left">
|
||||||
<Badge className="mb-6 bg-primary-500/20 text-primary-200 border-primary-400/30">
|
<Badge className="mb-6 bg-primary-500/20 text-primary-200 border-primary-400/30">
|
||||||
<Sparkles className="w-3 h-3 mr-1" />
|
<Sparkles className="w-3 h-3 mr-1" />
|
||||||
AI-powered email sorting
|
For freelancers & small teams
|
||||||
</Badge>
|
</Badge>
|
||||||
|
|
||||||
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-extrabold text-white leading-tight mb-6">
|
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-extrabold text-white leading-tight mb-6">
|
||||||
Clean inbox automatically
|
Leads, clients, spam —
|
||||||
<br />
|
<br />
|
||||||
<span className="text-transparent bg-clip-text bg-gradient-to-r from-accent-400 to-primary-300">
|
<span className="text-transparent bg-clip-text bg-gradient-to-r from-accent-400 to-primary-300">
|
||||||
in minutes.
|
sorted automatically.
|
||||||
</span>
|
</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p className="text-lg sm:text-xl text-slate-300 mb-8 max-w-xl mx-auto lg:mx-0">
|
<p className="text-lg sm:text-xl text-slate-300 mb-8 max-w-xl mx-auto lg:mx-0">
|
||||||
Create smart rules, apply in one click, keep it clean with automation.
|
Connect Gmail or Outlook. We put newsletters, promos, and noise in folders so your inbox stays for what pays.
|
||||||
Stop drowning in emails and start focusing on what matters.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8">
|
<div className="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-4">
|
||||||
<Button
|
|
||||||
size="xl"
|
|
||||||
onClick={() => navigate('/setup?demo=true')}
|
|
||||||
className="group bg-accent-500 hover:bg-accent-600"
|
|
||||||
>
|
|
||||||
<Sparkles className="w-5 h-5 mr-2" />
|
|
||||||
Try Demo
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
size="xl"
|
size="xl"
|
||||||
onClick={handleCTAClick}
|
onClick={handleCTAClick}
|
||||||
variant="outline"
|
className="group bg-accent-500 hover:bg-accent-600"
|
||||||
className="bg-white/10 border-white/20 text-white hover:bg-white/20 group"
|
|
||||||
>
|
>
|
||||||
Connect inbox
|
Try it free
|
||||||
<ArrowRight className="w-5 h-5 ml-2 group-hover:translate-x-1 transition-transform" />
|
<ArrowRight className="w-5 h-5 ml-2 group-hover:translate-x-1 transition-transform" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-sm text-slate-400 mb-8">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => navigate('/setup?demo=true')}
|
||||||
|
className="underline hover:text-slate-300 transition-colors"
|
||||||
|
>
|
||||||
|
Or try a 30-second demo first
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
{/* Trust badges */}
|
{/* Trust badges */}
|
||||||
<div className="flex flex-wrap gap-6 justify-center lg:justify-start text-slate-400 text-sm">
|
<div className="flex flex-wrap gap-6 justify-center lg:justify-start text-slate-400 text-sm">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Check className="w-4 h-4 text-accent-400" />
|
<Check className="w-4 h-4 text-accent-400" />
|
||||||
No credit card required
|
No credit card
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Check className="w-4 h-4 text-accent-400" />
|
<Check className="w-4 h-4 text-accent-400" />
|
||||||
@@ -86,59 +173,22 @@ export function Hero() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right side - Visual */}
|
{/* Right side - Inbox visual (product screenshot feel) */}
|
||||||
<div className="relative hidden lg:block">
|
<div className="relative hidden lg:block">
|
||||||
<div className="relative">
|
<div className="bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 max-w-md overflow-hidden">
|
||||||
{/* Main card */}
|
<div className="border-b border-slate-200 dark:border-slate-700 px-4 py-2.5">
|
||||||
<div className="bg-white/10 backdrop-blur-xl rounded-3xl border border-white/20 p-6 shadow-2xl animate-float">
|
<span className="text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider">Inbox</span>
|
||||||
<div className="flex items-center gap-3 mb-6">
|
|
||||||
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
|
||||||
<Inbox className="w-6 h-6 text-white" />
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div className="divide-y divide-slate-100 dark:divide-slate-800">
|
||||||
<h3 className="font-semibold text-white">Your Inbox</h3>
|
<InboxRow sender="Sarah Chen" subject="Re: Project quote" label="Lead" isFocal />
|
||||||
<p className="text-sm text-slate-400">Auto-sorted</p>
|
<InboxRow sender="Mike, Acme Inc" subject="Invoice #8821" label="Client" />
|
||||||
</div>
|
<InboxRow sender="Newsletter" subject="Your weekly digest" label="Noise" />
|
||||||
</div>
|
<InboxRow sender="Support" subject="Your ticket #443" label="Client" />
|
||||||
|
<InboxRow sender="Promo" subject="20% off this week" label="Noise" />
|
||||||
{/* Email categories preview */}
|
|
||||||
<div className="space-y-3">
|
|
||||||
<EmailPreview
|
|
||||||
category="Important"
|
|
||||||
color="bg-red-500"
|
|
||||||
sender="John Smith"
|
|
||||||
subject="Meeting tomorrow at 10"
|
|
||||||
delay="stagger-1"
|
|
||||||
/>
|
|
||||||
<EmailPreview
|
|
||||||
category="Invoice"
|
|
||||||
color="bg-green-500"
|
|
||||||
sender="Amazon"
|
|
||||||
subject="Invoice for order #12345"
|
|
||||||
delay="stagger-2"
|
|
||||||
/>
|
|
||||||
<EmailPreview
|
|
||||||
category="Newsletter"
|
|
||||||
color="bg-purple-500"
|
|
||||||
sender="Tech Daily"
|
|
||||||
subject="Latest AI trends"
|
|
||||||
delay="stagger-3"
|
|
||||||
/>
|
|
||||||
<EmailPreview
|
|
||||||
category="Social"
|
|
||||||
color="bg-cyan-500"
|
|
||||||
sender="LinkedIn"
|
|
||||||
subject="3 new connection requests"
|
|
||||||
delay="stagger-4"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Floating badge */}
|
|
||||||
<div className="absolute -right-4 top-1/4 bg-accent-500 text-white px-4 py-2 rounded-full text-sm font-semibold shadow-lg animate-pulse-glow">
|
|
||||||
<Zap className="w-4 h-4 inline mr-1" />
|
|
||||||
AI sorting
|
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-xs text-slate-400 dark:text-slate-500 px-4 py-3 border-t border-slate-100 dark:border-slate-800">
|
||||||
|
This happens automatically on new emails.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -154,26 +204,39 @@ export function Hero() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EmailPreviewProps {
|
type InboxLabel = 'Lead' | 'Client' | 'Noise'
|
||||||
category: string
|
|
||||||
color: string
|
const labelClass: Record<InboxLabel, string> = {
|
||||||
sender: string
|
Lead: 'text-primary-600 dark:text-primary-500',
|
||||||
subject: string
|
Client: 'text-slate-600 dark:text-slate-600',
|
||||||
delay: string
|
Noise: 'text-slate-400 dark:text-slate-500',
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmailPreview({ category, color, sender, subject, delay }: EmailPreviewProps) {
|
interface InboxRowProps {
|
||||||
|
sender: string
|
||||||
|
subject: string
|
||||||
|
label: InboxLabel
|
||||||
|
isFocal?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
function InboxRow({ sender, subject, label, isFocal = false }: InboxRowProps) {
|
||||||
return (
|
return (
|
||||||
<div className={`flex items-center gap-3 bg-white/5 rounded-xl p-3 border border-white/10 opacity-0 animate-[fadeIn_0.5s_ease-out_forwards] ${delay}`}>
|
<div
|
||||||
<div className={`w-2 h-10 rounded-full ${color}`} />
|
className={cn(
|
||||||
|
"flex items-center gap-4 px-4 py-2.5",
|
||||||
|
isFocal && "border-l-2 border-l-primary-500 bg-slate-50/80 dark:bg-slate-800/50"
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2 mb-0.5">
|
<p className={cn(
|
||||||
<span className="text-sm font-medium text-white truncate">{sender}</span>
|
"truncate",
|
||||||
<span className={`text-xs px-2 py-0.5 rounded ${color} text-white`}>{category}</span>
|
isFocal ? "text-sm font-semibold text-slate-900 dark:text-slate-100" : "text-sm font-medium text-slate-600 dark:text-slate-400"
|
||||||
|
)}>
|
||||||
|
{sender}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs text-slate-500 dark:text-slate-500 truncate mt-0.5">{subject}</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm text-slate-400 truncate">{subject}</p>
|
<span className={cn("text-xs flex-shrink-0", labelClass[label])}>{label}</span>
|
||||||
</div>
|
|
||||||
<Mail className="w-4 h-4 text-slate-500 flex-shrink-0" />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
PartyPopper,
|
PartyPopper,
|
||||||
ArrowDown
|
ArrowDown
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
|
import SpotlightCard from '@/components/ui/SpotlightCard'
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@@ -17,19 +18,19 @@ const steps = [
|
|||||||
icon: Link2,
|
icon: Link2,
|
||||||
step: "02",
|
step: "02",
|
||||||
title: "Connect email",
|
title: "Connect email",
|
||||||
description: "Connect Gmail or Outlook with one click. Secure OAuth authentication.",
|
description: "Sign in with Google or Microsoft. We never see your password.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Sparkles,
|
icon: Sparkles,
|
||||||
step: "03",
|
step: "03",
|
||||||
title: "AI analyzes",
|
title: "We categorize",
|
||||||
description: "Our AI learns your email patterns and creates personalized sorting rules.",
|
description: "We read sender and subject, put each email in a category. No rules to write.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: PartyPopper,
|
icon: PartyPopper,
|
||||||
step: "04",
|
step: "04",
|
||||||
title: "Enjoy Inbox Zero",
|
title: "Inbox stays clean",
|
||||||
description: "Sit back and enjoy a clean inbox – automatically.",
|
description: "Newsletters and promos go to folders. Your inbox shows what matters first.",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -91,9 +92,12 @@ function StepCard({ icon: Icon, step, title, description }: StepCardProps) {
|
|||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{/* Card */}
|
{/* Card */}
|
||||||
<div className="bg-slate-50 dark:bg-slate-800 rounded-2xl p-6 text-center hover:bg-white dark:hover:bg-slate-700 hover:shadow-xl transition-all duration-300 border border-transparent hover:border-slate-200 dark:hover:border-slate-600">
|
<SpotlightCard
|
||||||
|
spotlightColor="rgba(34, 197, 94, 0.2)"
|
||||||
|
className="bg-slate-50 dark:bg-slate-800 rounded-2xl p-6 text-center hover:bg-white dark:hover:bg-slate-700 hover:shadow-xl transition-all duration-300 border border-transparent hover:border-slate-200 dark:hover:border-slate-600"
|
||||||
|
>
|
||||||
{/* Step number */}
|
{/* Step number */}
|
||||||
<div className="absolute -top-4 left-1/2 -translate-x-1/2 bg-gradient-to-r from-primary-500 to-primary-600 dark:from-primary-600 dark:to-primary-700 text-white text-sm font-bold px-4 py-1 rounded-full shadow-md">
|
<div className="absolute -top-4 left-1/2 -translate-x-1/2 bg-gradient-to-r from-primary-500 to-primary-600 dark:from-primary-600 dark:to-primary-700 text-white text-sm font-bold px-4 py-1 rounded-full shadow-md z-10">
|
||||||
{step}
|
{step}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -105,7 +109,7 @@ function StepCard({ icon: Icon, step, title, description }: StepCardProps) {
|
|||||||
{/* Content */}
|
{/* Content */}
|
||||||
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mb-2">{title}</h3>
|
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mb-2">{title}</h3>
|
||||||
<p className="text-slate-600 dark:text-slate-400 text-sm">{description}</p>
|
<p className="text-slate-600 dark:text-slate-400 text-sm">{description}</p>
|
||||||
</div>
|
</SpotlightCard>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,12 +32,15 @@ export function Navbar() {
|
|||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
<div className="flex items-center justify-between h-16">
|
<div className="flex items-center justify-between h-16">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link to="/" className="flex items-center gap-2">
|
<Link to="/" className="flex items-center leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-slate-900 dark:text-slate-100">
|
className="w-20 h-20 rounded-xl object-contain pr-[5px] block"
|
||||||
E-Mail-<span className="text-primary-600 dark:text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-slate-900 dark:text-slate-100 ml-[5px]">
|
||||||
|
Mail<span className="text-primary-600 dark:text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ export function Navbar() {
|
|||||||
Sign in
|
Sign in
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => navigate('/register')}>
|
<Button onClick={() => navigate('/register')}>
|
||||||
Get started free
|
Try it free
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -146,7 +149,7 @@ export function Navbar() {
|
|||||||
Sign in
|
Sign in
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="w-full h-11" onClick={() => navigate('/register')}>
|
<Button className="w-full h-11" onClick={() => navigate('/register')}>
|
||||||
Get started free
|
Try it free
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,67 +1,53 @@
|
|||||||
import { CheckCircle2, Clock, Brain, Shield } from 'lucide-react'
|
import { Code2, Users, Zap } from 'lucide-react'
|
||||||
|
import SpotlightCard from '@/components/ui/SpotlightCard'
|
||||||
|
|
||||||
const benefits = [
|
const items = [
|
||||||
{
|
{
|
||||||
icon: Clock,
|
icon: Code2,
|
||||||
title: "Save 2+ hours/week",
|
title: "Built in public",
|
||||||
description: "Less time sorting emails, more time for important tasks.",
|
description: "We ship updates and share progress openly. No hype, no fake traction.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Brain,
|
icon: Users,
|
||||||
title: "AI does it automatically",
|
title: "Early users",
|
||||||
description: "Set up once, then everything runs by itself.",
|
description: "We're in beta. Feedback from freelancers and small teams shapes the product.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Shield,
|
icon: Zap,
|
||||||
title: "Privacy first",
|
title: "Simple setup",
|
||||||
description: "Your emails stay private. We don't store any content.",
|
description: "Connect Gmail or Outlook, click Sort. No long onboarding or sales call.",
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: CheckCircle2,
|
|
||||||
title: "Easy to use",
|
|
||||||
description: "No learning curve. Ready to go in 2 minutes.",
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export function Testimonials() {
|
export function Testimonials() {
|
||||||
return (
|
return (
|
||||||
<section className="py-20 bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900">
|
<section className="py-20 bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900">
|
||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
{/* Section header */}
|
|
||||||
<div className="text-center mb-12">
|
<div className="text-center mb-12">
|
||||||
<h2 className="text-3xl sm:text-4xl font-bold text-white mb-4">
|
<h2 className="text-2xl sm:text-3xl font-bold text-white mb-2">
|
||||||
Why EmailSorter?
|
Honest context
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-lg text-slate-300 max-w-2xl mx-auto">
|
<p className="text-slate-400 text-sm sm:text-base">
|
||||||
No more email chaos. Focus on what matters.
|
We're a small product. Here's how we work.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Benefits grid */}
|
<div className="grid md:grid-cols-3 gap-6">
|
||||||
<div className="grid md:grid-cols-2 lg:grid-cols-4 gap-6">
|
{items.map((item, index) => (
|
||||||
{benefits.map((benefit, index) => (
|
<SpotlightCard
|
||||||
<BenefitCard key={index} {...benefit} />
|
key={index}
|
||||||
|
spotlightColor="rgba(34, 197, 94, 0.25)"
|
||||||
|
className="bg-white/5 backdrop-blur-sm rounded-xl p-6 border border-white/10"
|
||||||
|
>
|
||||||
|
<div className="w-10 h-10 rounded-lg bg-primary-500/20 flex items-center justify-center mb-4">
|
||||||
|
<item.icon className="w-5 h-5 text-primary-400" />
|
||||||
|
</div>
|
||||||
|
<h3 className="text-base font-semibold text-white mb-1">{item.title}</h3>
|
||||||
|
<p className="text-slate-400 text-sm">{item.description}</p>
|
||||||
|
</SpotlightCard>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BenefitCardProps {
|
|
||||||
icon: React.ElementType
|
|
||||||
title: string
|
|
||||||
description: string
|
|
||||||
}
|
|
||||||
|
|
||||||
function BenefitCard({ icon: Icon, title, description }: BenefitCardProps) {
|
|
||||||
return (
|
|
||||||
<div className="bg-white/5 backdrop-blur-sm rounded-xl p-6 border border-white/10 hover:bg-white/10 transition-colors">
|
|
||||||
<div className="w-12 h-12 rounded-lg bg-primary-500/20 flex items-center justify-center mb-4">
|
|
||||||
<Icon className="w-6 h-6 text-primary-400" />
|
|
||||||
</div>
|
|
||||||
<h3 className="text-lg font-semibold text-white mb-2">{title}</h3>
|
|
||||||
<p className="text-slate-400 text-sm">{description}</p>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
48
client/src/components/landing/TrustSection.tsx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import { Shield, Mail, Trash2 } from 'lucide-react'
|
||||||
|
|
||||||
|
export function TrustSection() {
|
||||||
|
return (
|
||||||
|
<section id="trust" className="py-16 sm:py-20 bg-white dark:bg-slate-900 border-y border-slate-200 dark:border-slate-800">
|
||||||
|
<div className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
|
<h2 className="text-2xl sm:text-3xl font-bold text-slate-900 dark:text-slate-100 text-center mb-10">
|
||||||
|
Your data, in plain language
|
||||||
|
</h2>
|
||||||
|
<ul className="space-y-6">
|
||||||
|
<li className="flex gap-4 items-start">
|
||||||
|
<div className="w-10 h-10 rounded-lg bg-slate-100 dark:bg-slate-800 flex items-center justify-center flex-shrink-0">
|
||||||
|
<Mail className="w-5 h-5 text-slate-600 dark:text-slate-400" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="font-semibold text-slate-900 dark:text-slate-100 mb-0.5">We only read what we need</p>
|
||||||
|
<p className="text-slate-600 dark:text-slate-400 text-sm">
|
||||||
|
We use sender, subject, and a short snippet to decide the category (e.g. newsletter vs client). We don't store your email body or attachments.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li className="flex gap-4 items-start">
|
||||||
|
<div className="w-10 h-10 rounded-lg bg-slate-100 dark:bg-slate-800 flex items-center justify-center flex-shrink-0">
|
||||||
|
<Shield className="w-5 h-5 text-slate-600 dark:text-slate-400" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="font-semibold text-slate-900 dark:text-slate-100 mb-0.5">No selling, no ads</p>
|
||||||
|
<p className="text-slate-600 dark:text-slate-400 text-sm">
|
||||||
|
Your email data is not used for advertising or sold to anyone. We run a paid product; our revenue comes from subscriptions, not your inbox.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li className="flex gap-4 items-start">
|
||||||
|
<div className="w-10 h-10 rounded-lg bg-slate-100 dark:bg-slate-800 flex items-center justify-center flex-shrink-0">
|
||||||
|
<Trash2 className="w-5 h-5 text-slate-600 dark:text-slate-400" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="font-semibold text-slate-900 dark:text-slate-100 mb-0.5">You can leave anytime</p>
|
||||||
|
<p className="text-slate-600 dark:text-slate-400 text-sm">
|
||||||
|
Disconnect your account and we stop. Cancel your subscription with one click. No lock-in, no "contact sales" to leave.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
44
client/src/components/ui/SpotlightCard.css
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
.card-spotlight {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
--mouse-x: 50%;
|
||||||
|
--mouse-y: 50%;
|
||||||
|
--spotlight-color: rgba(34, 197, 94, 0.2);
|
||||||
|
transition: border-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-spotlight::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: radial-gradient(
|
||||||
|
circle 400px at var(--mouse-x) var(--mouse-y),
|
||||||
|
var(--spotlight-color),
|
||||||
|
transparent 80%
|
||||||
|
);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-spotlight:hover::before,
|
||||||
|
.card-spotlight:focus-within::before {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-spotlight:hover {
|
||||||
|
border-color: rgba(34, 197, 94, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .card-spotlight:hover {
|
||||||
|
border-color: rgba(34, 197, 94, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-spotlight > * {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
36
client/src/components/ui/SpotlightCard.tsx
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import { useRef } from 'react'
|
||||||
|
import './SpotlightCard.css'
|
||||||
|
|
||||||
|
interface SpotlightCardProps {
|
||||||
|
children: React.ReactNode
|
||||||
|
className?: string
|
||||||
|
spotlightColor?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const SpotlightCard = ({ children, className = '', spotlightColor = 'rgba(34, 197, 94, 0.2)' }: SpotlightCardProps) => {
|
||||||
|
const divRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
|
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||||
|
if (!divRef.current) return
|
||||||
|
|
||||||
|
const rect = divRef.current.getBoundingClientRect()
|
||||||
|
const x = e.clientX - rect.left
|
||||||
|
const y = e.clientY - rect.top
|
||||||
|
|
||||||
|
divRef.current.style.setProperty('--mouse-x', `${x}px`)
|
||||||
|
divRef.current.style.setProperty('--mouse-y', `${y}px`)
|
||||||
|
divRef.current.style.setProperty('--spotlight-color', spotlightColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={divRef}
|
||||||
|
onMouseMove={handleMouseMove}
|
||||||
|
className={`card-spotlight ${className}`}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SpotlightCard
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-refresh/only-export-components */
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { cva, type VariantProps } from "class-variance-authority"
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-refresh/only-export-components */
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { Slot } from "@radix-ui/react-slot"
|
import { Slot } from "@radix-ui/react-slot"
|
||||||
import { cva, type VariantProps } from "class-variance-authority"
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-refresh/only-export-components */
|
||||||
import React, { createContext, useContext, useEffect, useState } from 'react'
|
import React, { createContext, useContext, useEffect, useState } from 'react'
|
||||||
import { auth } from '@/lib/appwrite'
|
import { auth } from '@/lib/appwrite'
|
||||||
import type { Models } from 'appwrite'
|
import type { Models } from 'appwrite'
|
||||||
|
|||||||
@@ -210,6 +210,40 @@ body {
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hero edge cards – scroll animation (stick to side, bow out on scroll) */
|
||||||
|
@keyframes hero-edge-in {
|
||||||
|
from { opacity: 0; }
|
||||||
|
to { opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-edge-card {
|
||||||
|
animation: hero-edge-in 0.6s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bild nur so groß wie der sichtbare Inhalt, keine unsichtbare Box */
|
||||||
|
.hero-edge-card img {
|
||||||
|
display: block;
|
||||||
|
max-width: 8rem;
|
||||||
|
max-height: 8rem;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
flex-shrink: 0;
|
||||||
|
line-height: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-edge-card:nth-child(1) { animation-delay: 0.2s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(2) { animation-delay: 0.35s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(3) { animation-delay: 0.5s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(4) { animation-delay: 0.4s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(5) { animation-delay: 0.55s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(6) { animation-delay: 0.7s; opacity: 0; }
|
||||||
|
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.hero-edge-card { opacity: 0.2 !important; }
|
||||||
|
}
|
||||||
|
|
||||||
/* Animation classes */
|
/* Animation classes */
|
||||||
@keyframes float {
|
@keyframes float {
|
||||||
0%, 100% { transform: translateY(0px); }
|
0%, 100% { transform: translateY(0px); }
|
||||||
@@ -226,6 +260,16 @@ body {
|
|||||||
to { opacity: 1; transform: translateY(0); }
|
to { opacity: 1; transform: translateY(0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Gradient animation for feature card strip (engineering-card style) */
|
||||||
|
@keyframes gradient-x {
|
||||||
|
0%, 100% { background-position: 0% 50%; }
|
||||||
|
50% { background-position: 100% 50%; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-gradient-x {
|
||||||
|
animation: gradient-x 3s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
.animate-float {
|
.animate-float {
|
||||||
animation: float 6s ease-in-out infinite;
|
animation: float 6s ease-in-out infinite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export interface TrackingParams {
|
|||||||
export interface ConversionEvent {
|
export interface ConversionEvent {
|
||||||
type: 'page_view' | 'signup' | 'trial_start' | 'purchase' | 'email_connected' | 'onboarding_step' | 'provider_connected' | 'demo_used' | 'suggested_rules_generated' | 'rule_created' | 'rules_applied' | 'limit_reached' | 'upgrade_clicked' | 'referral_shared' | 'sort_completed' | 'account_deleted'
|
type: 'page_view' | 'signup' | 'trial_start' | 'purchase' | 'email_connected' | 'onboarding_step' | 'provider_connected' | 'demo_used' | 'suggested_rules_generated' | 'rule_created' | 'rules_applied' | 'limit_reached' | 'upgrade_clicked' | 'referral_shared' | 'sort_completed' | 'account_deleted'
|
||||||
userId?: string
|
userId?: string
|
||||||
metadata?: Record<string, any>
|
metadata?: Record<string, unknown>
|
||||||
sessionId?: string
|
sessionId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const api = {
|
|||||||
return fetchApi<Array<{
|
return fetchApi<Array<{
|
||||||
id: string
|
id: string
|
||||||
email: string
|
email: string
|
||||||
provider: 'gmail' | 'outlook'
|
provider: 'gmail' | 'outlook' | 'imap'
|
||||||
connected: boolean
|
connected: boolean
|
||||||
lastSync?: string
|
lastSync?: string
|
||||||
}>>(`/email/accounts?userId=${userId}`)
|
}>>(`/email/accounts?userId=${userId}`)
|
||||||
@@ -69,6 +69,24 @@ export const api = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async connectImapAccount(
|
||||||
|
userId: string,
|
||||||
|
params: { email: string; password: string; imapHost?: string; imapPort?: number; imapSecure?: boolean }
|
||||||
|
) {
|
||||||
|
return fetchApi<{ accountId: string }>('/email/connect', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
userId,
|
||||||
|
provider: 'imap',
|
||||||
|
email: params.email,
|
||||||
|
accessToken: params.password,
|
||||||
|
imapHost: params.imapHost,
|
||||||
|
imapPort: params.imapPort,
|
||||||
|
imapSecure: params.imapSecure,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
async disconnectEmailAccount(accountId: string, userId: string) {
|
async disconnectEmailAccount(accountId: string, userId: string) {
|
||||||
return fetchApi<{ success: boolean }>(`/email/accounts/${accountId}?userId=${userId}`, {
|
return fetchApi<{ success: boolean }>(`/email/accounts/${accountId}?userId=${userId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@@ -105,7 +123,7 @@ export const api = {
|
|||||||
name: string
|
name: string
|
||||||
description: string
|
description: string
|
||||||
confidence: number
|
confidence: number
|
||||||
action: any
|
action?: { name?: string }
|
||||||
}>
|
}>
|
||||||
}>('/email/sort', {
|
}>('/email/sort', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -276,6 +294,7 @@ export const api = {
|
|||||||
blockedSenders?: string[]
|
blockedSenders?: string[]
|
||||||
customRules?: Array<{ condition: string; category: string }>
|
customRules?: Array<{ condition: string; category: string }>
|
||||||
priorityTopics?: string[]
|
priorityTopics?: string[]
|
||||||
|
companyLabels?: Array<{ name: string; condition?: string; category: string; enabled: boolean }>
|
||||||
}) {
|
}) {
|
||||||
return fetchApi<{ success: boolean }>('/preferences', {
|
return fetchApi<{ success: boolean }>('/preferences', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -292,8 +311,8 @@ export const api = {
|
|||||||
enabledCategories: string[]
|
enabledCategories: string[]
|
||||||
categoryActions: Record<string, 'inbox' | 'archive_read' | 'star'>
|
categoryActions: Record<string, 'inbox' | 'archive_read' | 'star'>
|
||||||
autoDetectCompanies: boolean
|
autoDetectCompanies: boolean
|
||||||
cleanup?: any
|
cleanup?: unknown
|
||||||
categoryAdvanced?: Record<string, any>
|
categoryAdvanced?: Record<string, unknown>
|
||||||
version?: number
|
version?: number
|
||||||
}>(`/preferences/ai-control?userId=${userId}`)
|
}>(`/preferences/ai-control?userId=${userId}`)
|
||||||
},
|
},
|
||||||
@@ -302,8 +321,8 @@ export const api = {
|
|||||||
enabledCategories?: string[]
|
enabledCategories?: string[]
|
||||||
categoryActions?: Record<string, 'inbox' | 'archive_read' | 'star'>
|
categoryActions?: Record<string, 'inbox' | 'archive_read' | 'star'>
|
||||||
autoDetectCompanies?: boolean
|
autoDetectCompanies?: boolean
|
||||||
cleanup?: any
|
cleanup?: unknown
|
||||||
categoryAdvanced?: Record<string, any>
|
categoryAdvanced?: Record<string, unknown>
|
||||||
version?: number
|
version?: number
|
||||||
}) {
|
}) {
|
||||||
return fetchApi<{ success: boolean }>('/preferences/ai-control', {
|
return fetchApi<{ success: boolean }>('/preferences/ai-control', {
|
||||||
@@ -402,19 +421,62 @@ export const api = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// ME / ADMIN
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
async getMe(email: string) {
|
||||||
|
return fetchApi<{ isAdmin: boolean }>(`/me?email=${encodeURIComponent(email)}`)
|
||||||
|
},
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// NAME LABELS (Workers – Admin only)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
async getNameLabels(userId: string, email: string) {
|
||||||
|
return fetchApi<Array<{
|
||||||
|
id?: string
|
||||||
|
name: string
|
||||||
|
email?: string
|
||||||
|
keywords?: string[]
|
||||||
|
enabled: boolean
|
||||||
|
}>>(`/preferences/name-labels?userId=${userId}&email=${encodeURIComponent(email)}`)
|
||||||
|
},
|
||||||
|
|
||||||
|
async saveNameLabel(
|
||||||
|
userId: string,
|
||||||
|
userEmail: string,
|
||||||
|
nameLabel: { id?: string; name: string; email?: string; keywords?: string[]; enabled: boolean }
|
||||||
|
) {
|
||||||
|
return fetchApi<{ id?: string; name: string; email?: string; keywords?: string[]; enabled: boolean }>(
|
||||||
|
'/preferences/name-labels',
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ userId, email: userEmail, nameLabel }),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteNameLabel(userId: string, userEmail: string, labelId: string) {
|
||||||
|
return fetchApi<{ success: boolean }>(
|
||||||
|
`/preferences/name-labels/${labelId}?userId=${userId}&email=${encodeURIComponent(userEmail)}`,
|
||||||
|
{ method: 'DELETE' }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
// PRODUCTS & QUESTIONS (Legacy)
|
// PRODUCTS & QUESTIONS (Legacy)
|
||||||
// ═══════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
async getProducts() {
|
async getProducts() {
|
||||||
return fetchApi<any[]>('/products')
|
return fetchApi<unknown[]>('/products')
|
||||||
},
|
},
|
||||||
|
|
||||||
async getQuestions(productSlug: string) {
|
async getQuestions(productSlug: string) {
|
||||||
return fetchApi<any[]>(`/questions?productSlug=${productSlug}`)
|
return fetchApi<unknown[]>(`/questions?productSlug=${productSlug}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
async createSubmission(productSlug: string, answers: Record<string, any>) {
|
async createSubmission(productSlug: string, answers: Record<string, unknown>) {
|
||||||
return fetchApi<{ submissionId: string }>('/submissions', {
|
return fetchApi<{ submissionId: string }>('/submissions', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ productSlug, answers }),
|
body: JSON.stringify({ productSlug, answers }),
|
||||||
|
|||||||
@@ -18,13 +18,9 @@ export { ID }
|
|||||||
export const auth = {
|
export const auth = {
|
||||||
// Create a new account
|
// Create a new account
|
||||||
async register(email: string, password: string, name?: string) {
|
async register(email: string, password: string, name?: string) {
|
||||||
try {
|
|
||||||
const user = await account.create(ID.unique(), email, password, name)
|
const user = await account.create(ID.unique(), email, password, name)
|
||||||
await this.login(email, password)
|
await this.login(email, password)
|
||||||
return user
|
return user
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Login with email and password
|
// Login with email and password
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import {
|
|||||||
Zap,
|
Zap,
|
||||||
BarChart3,
|
BarChart3,
|
||||||
Users,
|
Users,
|
||||||
Bell,
|
|
||||||
Shield,
|
Shield,
|
||||||
HelpCircle,
|
|
||||||
Loader2,
|
Loader2,
|
||||||
Check,
|
Check,
|
||||||
AlertCircle,
|
AlertCircle,
|
||||||
@@ -65,7 +63,7 @@ interface SortResult {
|
|||||||
name: string
|
name: string
|
||||||
description: string
|
description: string
|
||||||
confidence: number
|
confidence: number
|
||||||
action: any
|
action?: { name?: string; email?: string; condition?: string; category?: string }
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +106,7 @@ export function Dashboard() {
|
|||||||
if (user?.$id) {
|
if (user?.$id) {
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
}, [user])
|
}, [user?.$id])
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
if (!user?.$id) return
|
if (!user?.$id) return
|
||||||
@@ -131,7 +129,7 @@ export function Dashboard() {
|
|||||||
if (referralRes.data) setReferralCode(referralRes.data.referralCode)
|
if (referralRes.data) setReferralCode(referralRes.data.referralCode)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error loading dashboard data:', err)
|
console.error('Error loading dashboard data:', err)
|
||||||
setError('Failed to load data')
|
setError('Couldn’t load your data. Check your connection and refresh.')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -139,7 +137,7 @@ export function Dashboard() {
|
|||||||
|
|
||||||
const handleSortNow = async () => {
|
const handleSortNow = async () => {
|
||||||
if (!user?.$id || accounts.length === 0) {
|
if (!user?.$id || accounts.length === 0) {
|
||||||
setError('Please connect an email account first to start sorting.')
|
setError('Connect your inbox first, then click Sort Now.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +176,7 @@ export function Dashboard() {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error sorting emails:', err)
|
console.error('Error sorting emails:', err)
|
||||||
setError('Unable to sort emails right now. Please check your connection and try again.')
|
setError('Something went wrong. Check your connection and try again.')
|
||||||
} finally {
|
} finally {
|
||||||
setSorting(false)
|
setSorting(false)
|
||||||
}
|
}
|
||||||
@@ -238,23 +236,19 @@ export function Dashboard() {
|
|||||||
<header className="bg-white/90 dark:bg-slate-900/90 backdrop-blur-md border-b border-slate-200 dark:border-slate-700 sticky top-0 z-50 shadow-sm">
|
<header className="bg-white/90 dark:bg-slate-900/90 backdrop-blur-md border-b border-slate-200 dark:border-slate-700 sticky top-0 z-50 shadow-sm">
|
||||||
<div className="w-full px-3 sm:px-6 lg:px-8">
|
<div className="w-full px-3 sm:px-6 lg:px-8">
|
||||||
<div className="flex items-center justify-between h-14 sm:h-16">
|
<div className="flex items-center justify-between h-14 sm:h-16">
|
||||||
<Link to="/" className="flex items-center gap-1.5 sm:gap-2 flex-shrink-0">
|
<Link to="/" className="flex items-center flex-shrink-0 leading-none">
|
||||||
<div className="w-8 h-8 sm:w-9 sm:h-9 rounded-lg bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center shadow-lg shadow-primary-500/20">
|
<img
|
||||||
<Mail className="w-4 h-4 sm:w-5 sm:h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-base sm:text-lg font-bold text-slate-900 dark:text-slate-100 whitespace-nowrap">
|
className="w-20 h-20 sm:w-20 sm:h-20 rounded-lg shadow-lg object-contain pr-[5px] block"
|
||||||
E-Mail-<span className="text-primary-600 dark:text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-base sm:text-lg font-bold text-slate-900 dark:text-slate-100 whitespace-nowrap ml-[5px]">
|
||||||
|
Mail<span className="text-primary-600 dark:text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className="flex items-center gap-1.5 sm:gap-2 lg:gap-4">
|
<div className="flex items-center gap-1.5 sm:gap-2 lg:gap-4">
|
||||||
<Button variant="ghost" size="icon" className="hidden lg:flex h-9 w-9">
|
|
||||||
<Bell className="w-5 h-5 text-slate-500 dark:text-slate-400" />
|
|
||||||
</Button>
|
|
||||||
<Button variant="ghost" size="icon" className="hidden lg:flex h-9 w-9">
|
|
||||||
<HelpCircle className="w-5 h-5 text-slate-500 dark:text-slate-400" />
|
|
||||||
</Button>
|
|
||||||
<div className="hidden lg:block h-6 w-px bg-slate-200 dark:bg-slate-700" />
|
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => navigate('/settings')}
|
onClick={() => navigate('/settings')}
|
||||||
@@ -304,7 +298,7 @@ export function Dashboard() {
|
|||||||
<p className="text-sm text-slate-600 dark:text-slate-400">
|
<p className="text-sm text-slate-600 dark:text-slate-400">
|
||||||
{accounts.length > 0
|
{accounts.length > 0
|
||||||
? `${accounts.length} account${accounts.length > 1 ? 's' : ''} connected`
|
? `${accounts.length} account${accounts.length > 1 ? 's' : ''} connected`
|
||||||
: 'Connect an account to get started'}
|
: 'Connect Gmail or Outlook to sort your first emails.'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2 sm:gap-3">
|
<div className="flex items-center gap-2 sm:gap-3">
|
||||||
@@ -315,7 +309,7 @@ export function Dashboard() {
|
|||||||
aria-label="Connect email account"
|
aria-label="Connect email account"
|
||||||
>
|
>
|
||||||
<Plus className="w-4 h-4 mr-2" />
|
<Plus className="w-4 h-4 mr-2" />
|
||||||
Connect Account
|
Connect inbox
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
@@ -359,6 +353,15 @@ export function Dashboard() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* First-time hint: account connected, no sort yet */}
|
||||||
|
{!loading && accounts.length > 0 && !sortResult && !error && (
|
||||||
|
<div className="mb-4 p-4 bg-slate-100 dark:bg-slate-800/60 rounded-xl border border-slate-200 dark:border-slate-700">
|
||||||
|
<p className="text-sm text-slate-700 dark:text-slate-300">
|
||||||
|
Click <strong>Sort Now</strong> to categorize your inbox. Takes about 30 seconds. Nothing is deleted — we only add labels or move mail to folders.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Error message */}
|
{/* Error message */}
|
||||||
{error && (
|
{error && (
|
||||||
<div className="mb-3 sm:mb-4 p-2.5 sm:p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg flex items-start sm:items-center gap-2 text-red-700 dark:text-red-300">
|
<div className="mb-3 sm:mb-4 p-2.5 sm:p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg flex items-start sm:items-center gap-2 text-red-700 dark:text-red-300">
|
||||||
@@ -378,7 +381,8 @@ export function Dashboard() {
|
|||||||
<div className="flex items-center justify-center py-20">
|
<div className="flex items-center justify-center py-20">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Loader2 className="w-10 h-10 animate-spin text-primary-500 dark:text-primary-400 mx-auto mb-4" />
|
<Loader2 className="w-10 h-10 animate-spin text-primary-500 dark:text-primary-400 mx-auto mb-4" />
|
||||||
<p className="text-slate-500 dark:text-slate-400">Loading dashboard...</p>
|
<p className="text-slate-500 dark:text-slate-400">Loading your data...</p>
|
||||||
|
<p className="text-slate-400 dark:text-slate-500 text-sm mt-1">One moment.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -394,9 +398,9 @@ export function Dashboard() {
|
|||||||
<Sparkles className="w-5 h-5 text-white" />
|
<Sparkles className="w-5 h-5 text-white" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<CardTitle className="text-lg">AI-Assistent</CardTitle>
|
<CardTitle className="text-lg">Email sorting</CardTitle>
|
||||||
<CardDescription className="text-sm">
|
<CardDescription className="text-sm">
|
||||||
Automatische E-Mail-Sortierung mit KI
|
Categorize inbox — leads, clients, newsletters
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -413,10 +417,10 @@ export function Dashboard() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className={`${sortResult.isFirstRun ? 'text-lg' : 'text-sm'} font-bold text-green-800 dark:text-green-200`}>
|
<p className={`${sortResult.isFirstRun ? 'text-lg' : 'text-sm'} font-bold text-green-800 dark:text-green-200`}>
|
||||||
{sortResult.isFirstRun ? '🎉 First sort complete!' : 'Sorting complete!'}
|
{sortResult.isFirstRun ? 'Done. Your inbox is sorted.' : 'Sort complete.'}
|
||||||
</p>
|
</p>
|
||||||
{sortResult.isFirstRun && (
|
{sortResult.isFirstRun && (
|
||||||
<p className="text-sm text-green-700 dark:text-green-300 mt-0.5">Your inbox is getting organized</p>
|
<p className="text-sm text-green-700 dark:text-green-300 mt-0.5">Newsletters and promos are in folders. Check your inbox — only important mail is left.</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -444,10 +448,10 @@ export function Dashboard() {
|
|||||||
<div className="bg-white/80 dark:bg-slate-800/80 p-3 rounded-lg">
|
<div className="bg-white/80 dark:bg-slate-800/80 p-3 rounded-lg">
|
||||||
<p className="text-xs text-green-600 dark:text-green-400 mb-1">Top category</p>
|
<p className="text-xs text-green-600 dark:text-green-400 mb-1">Top category</p>
|
||||||
<p className="text-xl font-bold text-green-800 dark:text-green-200">
|
<p className="text-xl font-bold text-green-800 dark:text-green-200">
|
||||||
{Object.entries(sortResult.categories).sort(([_, a], [__, b]) => b - a)[0]?.[1] || 0}
|
{Object.entries(sortResult.categories).sort(([, a], [, b]) => b - a)[0]?.[1] || 0}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-green-500 dark:text-green-400 mt-1">
|
<p className="text-xs text-green-500 dark:text-green-400 mt-1">
|
||||||
{formatCategoryName(Object.entries(sortResult.categories).sort(([_, a], [__, b]) => b - a)[0]?.[0] || '')}
|
{formatCategoryName(Object.entries(sortResult.categories).sort(([, a], [, b]) => b - a)[0]?.[0] || '')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -457,7 +461,7 @@ export function Dashboard() {
|
|||||||
{sortResult.isFirstRun && sortResult.suggestedRules && sortResult.suggestedRules.length > 0 && (
|
{sortResult.isFirstRun && sortResult.suggestedRules && sortResult.suggestedRules.length > 0 && (
|
||||||
<div className="mt-4 pt-4 border-t border-green-200 dark:border-green-800">
|
<div className="mt-4 pt-4 border-t border-green-200 dark:border-green-800">
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<p className="text-sm font-semibold text-green-900 dark:text-green-200">Smart suggestions for you</p>
|
<p className="text-sm font-semibold text-green-900 dark:text-green-200">Suggestions for you</p>
|
||||||
<p className="text-xs text-green-600 dark:text-green-400 mt-0.5">Based on your email patterns</p>
|
<p className="text-xs text-green-600 dark:text-green-400 mt-0.5">Based on your email patterns</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2 mb-3">
|
<div className="space-y-2 mb-3">
|
||||||
@@ -479,19 +483,19 @@ export function Dashboard() {
|
|||||||
setSorting(true)
|
setSorting(true)
|
||||||
try {
|
try {
|
||||||
const vipSenders = sortResult.suggestedRules
|
const vipSenders = sortResult.suggestedRules
|
||||||
.filter(r => r.type === 'vip_sender' && r.action?.email)
|
.filter((r): r is typeof r & { action: { email: string } } => r.type === 'vip_sender' && !!r.action?.email)
|
||||||
.map(r => r.action.email)
|
.map(r => ({ email: r.action.email }))
|
||||||
|
|
||||||
const companyLabels = sortResult.suggestedRules
|
const companyLabels = sortResult.suggestedRules
|
||||||
.filter(r => r.type === 'company_label' && r.action?.name)
|
.filter((r): r is typeof r & { action: { name: string; condition?: string; category?: string } } => r.type === 'company_label' && !!r.action?.name)
|
||||||
.map(r => ({
|
.map(r => ({
|
||||||
name: r.action.name,
|
name: r.action.name,
|
||||||
condition: r.action.condition,
|
condition: r.action.condition ?? '',
|
||||||
category: r.action.category || 'promotions',
|
category: r.action.category || 'promotions',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const updates: any = {}
|
const updates: { vipSenders?: Array<{ email: string; name?: string }>; companyLabels?: Array<{ name: string; condition?: string; category: string; enabled: boolean }> } = {}
|
||||||
if (vipSenders.length > 0) {
|
if (vipSenders.length > 0) {
|
||||||
updates.vipSenders = vipSenders
|
updates.vipSenders = vipSenders
|
||||||
}
|
}
|
||||||
@@ -502,10 +506,10 @@ export function Dashboard() {
|
|||||||
if (Object.keys(updates).length > 0) {
|
if (Object.keys(updates).length > 0) {
|
||||||
await api.saveUserPreferences(user.$id, updates)
|
await api.saveUserPreferences(user.$id, updates)
|
||||||
trackRulesApplied(user.$id, sortResult.suggestedRules.length)
|
trackRulesApplied(user.$id, sortResult.suggestedRules.length)
|
||||||
showMessage('success', `Applied ${sortResult.suggestedRules.length} smart rules! Your inbox will stay organized.`)
|
showMessage('success', `${sortResult.suggestedRules.length} rules applied. Your inbox will stay organized.`)
|
||||||
setSortResult({ ...sortResult, suggestedRules: [] })
|
setSortResult({ ...sortResult, suggestedRules: [] })
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
showMessage('error', 'Unable to apply rules right now. Please try again.')
|
showMessage('error', 'Unable to apply rules right now. Please try again.')
|
||||||
} finally {
|
} finally {
|
||||||
setSorting(false)
|
setSorting(false)
|
||||||
@@ -756,7 +760,7 @@ export function Dashboard() {
|
|||||||
<CardTitle className="text-base">Control Panel</CardTitle>
|
<CardTitle className="text-base">Control Panel</CardTitle>
|
||||||
</div>
|
</div>
|
||||||
<CardDescription className="text-xs">
|
<CardDescription className="text-xs">
|
||||||
KI-Einstellungen und Kategorien verwalten
|
Categories and rules
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
@@ -767,7 +771,7 @@ export function Dashboard() {
|
|||||||
aria-label="Open Control Panel settings"
|
aria-label="Open Control Panel settings"
|
||||||
>
|
>
|
||||||
<Settings className="w-4 h-4 mr-2" />
|
<Settings className="w-4 h-4 mr-2" />
|
||||||
Control Panel öffnen
|
Open Control Panel
|
||||||
<ExternalLink className="w-3 h-3 ml-2" />
|
<ExternalLink className="w-3 h-3 ml-2" />
|
||||||
</Button>
|
</Button>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@@ -778,10 +782,10 @@ export function Dashboard() {
|
|||||||
<CardHeader className="pb-3">
|
<CardHeader className="pb-3">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Settings className="w-5 h-5 text-primary-500 dark:text-primary-400" />
|
<Settings className="w-5 h-5 text-primary-500 dark:text-primary-400" />
|
||||||
<CardTitle className="text-base">Einstellungen</CardTitle>
|
<CardTitle className="text-base">Settings</CardTitle>
|
||||||
</div>
|
</div>
|
||||||
<CardDescription className="text-xs">
|
<CardDescription className="text-xs">
|
||||||
Schnellzugriff auf wichtige Einstellungen
|
Quick access
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-2">
|
<CardContent className="space-y-2">
|
||||||
@@ -810,7 +814,7 @@ export function Dashboard() {
|
|||||||
aria-label="Open all settings"
|
aria-label="Open all settings"
|
||||||
>
|
>
|
||||||
<Settings className="w-4 h-4 mr-2" />
|
<Settings className="w-4 h-4 mr-2" />
|
||||||
Alle Einstellungen
|
All settings
|
||||||
<ExternalLink className="w-3 h-3 ml-auto" />
|
<ExternalLink className="w-3 h-3 ml-auto" />
|
||||||
</Button>
|
</Button>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@@ -819,9 +823,9 @@ export function Dashboard() {
|
|||||||
{/* Account/System Karte */}
|
{/* Account/System Karte */}
|
||||||
<Card className="border border-slate-200 dark:border-slate-700 shadow-sm">
|
<Card className="border border-slate-200 dark:border-slate-700 shadow-sm">
|
||||||
<CardHeader className="pb-3">
|
<CardHeader className="pb-3">
|
||||||
<CardTitle className="text-base">Account & System</CardTitle>
|
<CardTitle className="text-base">Account</CardTitle>
|
||||||
<CardDescription className="text-xs">
|
<CardDescription className="text-xs">
|
||||||
Subscription und Konten-Status
|
Subscription and accounts
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent className="space-y-4">
|
||||||
@@ -904,10 +908,10 @@ export function Dashboard() {
|
|||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||||
<div className={`w-6 h-6 rounded flex items-center justify-center flex-shrink-0 ${
|
<div className={`w-6 h-6 rounded flex items-center justify-center flex-shrink-0 ${
|
||||||
account.provider === 'gmail' ? 'bg-red-100 dark:bg-red-900/50' : 'bg-blue-100 dark:bg-blue-900/50'
|
account.provider === 'gmail' ? 'bg-red-100 dark:bg-red-900/50' : account.provider === 'outlook' ? 'bg-blue-100 dark:bg-blue-900/50' : 'bg-slate-100 dark:bg-slate-700/50'
|
||||||
}`}>
|
}`}>
|
||||||
<Mail className={`w-3 h-3 ${
|
<Mail className={`w-3 h-3 ${
|
||||||
account.provider === 'gmail' ? 'text-red-600 dark:text-red-400' : 'text-blue-600 dark:text-blue-400'
|
account.provider === 'gmail' ? 'text-red-600 dark:text-red-400' : account.provider === 'outlook' ? 'text-blue-600 dark:text-blue-400' : 'text-slate-600 dark:text-slate-400'
|
||||||
}`} />
|
}`} />
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs font-medium text-slate-700 dark:text-slate-300 truncate">{account.email}</p>
|
<p className="text-xs font-medium text-slate-700 dark:text-slate-300 truncate">{account.email}</p>
|
||||||
@@ -932,7 +936,7 @@ export function Dashboard() {
|
|||||||
) : (
|
) : (
|
||||||
<div className="text-center py-4">
|
<div className="text-center py-4">
|
||||||
<Mail className="w-8 h-8 text-slate-300 dark:text-slate-600 mx-auto mb-2" />
|
<Mail className="w-8 h-8 text-slate-300 dark:text-slate-600 mx-auto mb-2" />
|
||||||
<p className="text-xs text-slate-500 dark:text-slate-400 mb-2">No accounts connected</p>
|
<p className="text-xs text-slate-500 dark:text-slate-400 mb-2">No inbox connected yet</p>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => navigate('/setup')}
|
onClick={() => navigate('/setup')}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -941,7 +945,7 @@ export function Dashboard() {
|
|||||||
aria-label="Connect email account"
|
aria-label="Connect email account"
|
||||||
>
|
>
|
||||||
<Plus className="w-3 h-3 mr-1.5" />
|
<Plus className="w-3 h-3 mr-1.5" />
|
||||||
Connect Account
|
Connect inbox
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export function ForgotPassword() {
|
|||||||
try {
|
try {
|
||||||
await auth.forgotPassword(email)
|
await auth.forgotPassword(email)
|
||||||
setSent(true)
|
setSent(true)
|
||||||
} catch (err: any) {
|
} catch (err: unknown) {
|
||||||
setError(err.message || 'Fehler beim Senden der E-Mail')
|
setError(err instanceof Error ? err.message : 'Fehler beim Senden der E-Mail')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -32,12 +32,15 @@ export function ForgotPassword() {
|
|||||||
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
|
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link to="/" className="flex items-center justify-center gap-2 mb-8">
|
<Link to="/" className="flex items-center justify-center mb-8 leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-slate-900 dark:text-slate-100">
|
className="w-24 h-24 rounded-xl object-contain pr-[5px] block"
|
||||||
Email<span className="text-primary-600 dark:text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-slate-900 dark:text-slate-100 ml-[5px]">
|
||||||
|
Mail<span className="text-primary-600 dark:text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ import { Navbar } from '@/components/landing/Navbar'
|
|||||||
import { Hero } from '@/components/landing/Hero'
|
import { Hero } from '@/components/landing/Hero'
|
||||||
import { Features } from '@/components/landing/Features'
|
import { Features } from '@/components/landing/Features'
|
||||||
import { HowItWorks } from '@/components/landing/HowItWorks'
|
import { HowItWorks } from '@/components/landing/HowItWorks'
|
||||||
import { Pricing } from '@/components/landing/Pricing'
|
|
||||||
import { Testimonials } from '@/components/landing/Testimonials'
|
import { Testimonials } from '@/components/landing/Testimonials'
|
||||||
|
import { TrustSection } from '@/components/landing/TrustSection'
|
||||||
|
import { Pricing } from '@/components/landing/Pricing'
|
||||||
import { FAQ } from '@/components/landing/FAQ'
|
import { FAQ } from '@/components/landing/FAQ'
|
||||||
import { Footer } from '@/components/landing/Footer'
|
import { Footer } from '@/components/landing/Footer'
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ export function Home() {
|
|||||||
<Features />
|
<Features />
|
||||||
<HowItWorks />
|
<HowItWorks />
|
||||||
<Testimonials />
|
<Testimonials />
|
||||||
|
<TrustSection />
|
||||||
<Pricing />
|
<Pricing />
|
||||||
<FAQ />
|
<FAQ />
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function Imprint() {
|
|||||||
<div className="space-y-6 text-slate-700 dark:text-slate-300">
|
<div className="space-y-6 text-slate-700 dark:text-slate-300">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mb-2">Operator</h3>
|
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mb-2">Operator</h3>
|
||||||
<p className="mb-2">EmailSorter is operated by:</p>
|
<p className="mb-2">MailFlow is operated by:</p>
|
||||||
<p className="mb-4">
|
<p className="mb-4">
|
||||||
<strong>webklar.com</strong><br />
|
<strong>webklar.com</strong><br />
|
||||||
Kenso Grimm, Justin Klein
|
Kenso Grimm, Justin Klein
|
||||||
@@ -90,12 +90,12 @@ export function Imprint() {
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-4 text-sm text-slate-600 dark:text-slate-400">
|
<p className="mt-4 text-sm text-slate-600 dark:text-slate-400">
|
||||||
For questions regarding EmailSorter specifically:{' '}
|
For questions regarding MailFlow specifically:{' '}
|
||||||
<a
|
<a
|
||||||
href="mailto:support@emailsorter.com"
|
href="mailto:support@mailflow.com"
|
||||||
className="text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 underline"
|
className="text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 underline"
|
||||||
>
|
>
|
||||||
support@emailsorter.com
|
support@mailflow.com
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ export function Login() {
|
|||||||
try {
|
try {
|
||||||
await login(email, password)
|
await login(email, password)
|
||||||
navigate('/dashboard')
|
navigate('/dashboard')
|
||||||
} catch (err: any) {
|
} catch (err: unknown) {
|
||||||
setError(err.message || 'Login failed. Please check your credentials.')
|
setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -36,12 +36,15 @@ export function Login() {
|
|||||||
<div className="flex-1 flex items-center justify-center px-4 sm:px-6 lg:px-8 bg-slate-900">
|
<div className="flex-1 flex items-center justify-center px-4 sm:px-6 lg:px-8 bg-slate-900">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link to="/" className="flex items-center gap-2 mb-8">
|
<Link to="/" className="flex items-center mb-8 leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-white">
|
className="w-24 h-24 rounded-xl object-contain pr-[5px] block"
|
||||||
E-Mail-<span className="text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-white ml-[5px]">
|
||||||
|
Mail<span className="text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
@@ -133,7 +136,7 @@ export function Login() {
|
|||||||
Your inbox under control
|
Your inbox under control
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-primary-100">
|
<p className="text-primary-100">
|
||||||
Thousands of users already trust EmailSorter for more productive email communication.
|
Thousands of users already trust MailFlow for more productive email communication.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export function Privacy() {
|
|||||||
<div className="bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-slate-700 rounded-lg p-6 mb-8">
|
<div className="bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-slate-700 rounded-lg p-6 mb-8">
|
||||||
<h2 className="text-xl font-semibold text-slate-900 dark:text-slate-100 mb-4">Data Protection Information</h2>
|
<h2 className="text-xl font-semibold text-slate-900 dark:text-slate-100 mb-4">Data Protection Information</h2>
|
||||||
<p className="text-slate-700 dark:text-slate-300 mb-4">
|
<p className="text-slate-700 dark:text-slate-300 mb-4">
|
||||||
EmailSorter is operated by webklar.com. The following privacy policy applies to the use of this website and our services.
|
MailFlow is operated by webklar.com. The following privacy policy applies to the use of this website and our services.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mt-6 mb-3">1. Responsible Party</h3>
|
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mt-6 mb-3">1. Responsible Party</h3>
|
||||||
@@ -64,7 +64,7 @@ export function Privacy() {
|
|||||||
|
|
||||||
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mt-6 mb-3">2. Data Collection and Processing</h3>
|
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mt-6 mb-3">2. Data Collection and Processing</h3>
|
||||||
<p className="text-slate-700 dark:text-slate-300 mb-4">
|
<p className="text-slate-700 dark:text-slate-300 mb-4">
|
||||||
When you use EmailSorter, we collect and process the following data:
|
When you use MailFlow, we collect and process the following data:
|
||||||
</p>
|
</p>
|
||||||
<ul className="list-disc list-inside text-slate-700 dark:text-slate-300 mb-4 space-y-2 ml-4">
|
<ul className="list-disc list-inside text-slate-700 dark:text-slate-300 mb-4 space-y-2 ml-4">
|
||||||
<li>Account information (email address, name)</li>
|
<li>Account information (email address, name)</li>
|
||||||
@@ -78,7 +78,7 @@ export function Privacy() {
|
|||||||
We process your data exclusively for the following purposes:
|
We process your data exclusively for the following purposes:
|
||||||
</p>
|
</p>
|
||||||
<ul className="list-disc list-inside text-slate-700 dark:text-slate-300 mb-4 space-y-2 ml-4">
|
<ul className="list-disc list-inside text-slate-700 dark:text-slate-300 mb-4 space-y-2 ml-4">
|
||||||
<li>Providing and improving the EmailSorter service</li>
|
<li>Providing and improving the MailFlow service</li>
|
||||||
<li>Automated email sorting and categorization</li>
|
<li>Automated email sorting and categorization</li>
|
||||||
<li>Processing payments and subscriptions</li>
|
<li>Processing payments and subscriptions</li>
|
||||||
<li>Customer support and communication</li>
|
<li>Customer support and communication</li>
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ export function Register() {
|
|||||||
try {
|
try {
|
||||||
await register(email, password, name)
|
await register(email, password, name)
|
||||||
navigate('/setup')
|
navigate('/setup')
|
||||||
} catch (err: any) {
|
} catch (err: unknown) {
|
||||||
setError(err.message || 'Registration failed. Please try again.')
|
setError(err instanceof Error ? err.message : 'Registration failed. Please try again.')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ export function Register() {
|
|||||||
</Badge>
|
</Badge>
|
||||||
|
|
||||||
<h2 className="text-4xl font-bold text-white mb-6">
|
<h2 className="text-4xl font-bold text-white mb-6">
|
||||||
Start with EmailSorter today
|
Start with MailFlow today
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<ul className="space-y-4 mb-8">
|
<ul className="space-y-4 mb-8">
|
||||||
@@ -117,12 +117,15 @@ export function Register() {
|
|||||||
<div className="flex-1 flex items-center justify-center px-4 sm:px-6 lg:px-8 bg-white dark:bg-slate-900">
|
<div className="flex-1 flex items-center justify-center px-4 sm:px-6 lg:px-8 bg-white dark:bg-slate-900">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link to="/" className="flex items-center gap-2 mb-8">
|
<Link to="/" className="flex items-center mb-8 leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-slate-900 dark:text-slate-100">
|
className="w-24 h-24 rounded-xl object-contain pr-[5px] block"
|
||||||
E-Mail-<span className="text-primary-600 dark:text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-slate-900 dark:text-slate-100 ml-[5px]">
|
||||||
|
Mail<span className="text-primary-600 dark:text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ export function ResetPassword() {
|
|||||||
try {
|
try {
|
||||||
await auth.resetPassword(userId, secret, password)
|
await auth.resetPassword(userId, secret, password)
|
||||||
setSuccess(true)
|
setSuccess(true)
|
||||||
} catch (err: any) {
|
} catch (err: unknown) {
|
||||||
setError(err.message || 'Fehler beim Zurücksetzen des Passworts')
|
setError(err instanceof Error ? err.message : 'Fehler beim Zurücksetzen des Passworts')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -86,12 +86,15 @@ export function ResetPassword() {
|
|||||||
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
|
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link to="/" className="flex items-center justify-center gap-2 mb-8">
|
<Link to="/" className="flex items-center justify-center mb-8 leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-slate-900 dark:text-slate-100">
|
className="w-24 h-24 rounded-xl object-contain pr-[5px] block"
|
||||||
Email<span className="text-primary-600 dark:text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-slate-900 dark:text-slate-100 ml-[5px]">
|
||||||
|
Mail<span className="text-primary-600 dark:text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { api } from '@/lib/api'
|
|||||||
import {
|
import {
|
||||||
Mail,
|
Mail,
|
||||||
User,
|
User,
|
||||||
|
Users,
|
||||||
CreditCard,
|
CreditCard,
|
||||||
Shield,
|
Shield,
|
||||||
Settings as SettingsIcon,
|
Settings as SettingsIcon,
|
||||||
@@ -54,15 +55,15 @@ import {
|
|||||||
Save,
|
Save,
|
||||||
Edit2,
|
Edit2,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import type { AIControlSettings, CompanyLabel, CategoryInfo, CleanupStatus } from '@/types/settings'
|
import type { AIControlSettings, CompanyLabel, NameLabel, CategoryInfo, CleanupSettings, CleanupStatus, CategoryAdvanced } from '@/types/settings'
|
||||||
import { PrivacySecurity } from '@/components/PrivacySecurity'
|
import { PrivacySecurity } from '@/components/PrivacySecurity'
|
||||||
|
|
||||||
type TabType = 'profile' | 'accounts' | 'vip' | 'ai-control' | 'subscription' | 'privacy' | 'referrals'
|
type TabType = 'profile' | 'accounts' | 'vip' | 'ai-control' | 'name-labels' | 'subscription' | 'privacy' | 'referrals'
|
||||||
|
|
||||||
interface EmailAccount {
|
interface EmailAccount {
|
||||||
id: string
|
id: string
|
||||||
email: string
|
email: string
|
||||||
provider: 'gmail' | 'outlook'
|
provider: 'gmail' | 'outlook' | 'imap'
|
||||||
connected: boolean
|
connected: boolean
|
||||||
lastSync?: string
|
lastSync?: string
|
||||||
}
|
}
|
||||||
@@ -97,6 +98,9 @@ export function Settings() {
|
|||||||
const savedProfileRef = useRef<{ name: string; language: string; timezone: string } | null>(null)
|
const savedProfileRef = useRef<{ name: string; language: string; timezone: string } | null>(null)
|
||||||
const [accounts, setAccounts] = useState<EmailAccount[]>([])
|
const [accounts, setAccounts] = useState<EmailAccount[]>([])
|
||||||
const [connectingProvider, setConnectingProvider] = useState<string | null>(null)
|
const [connectingProvider, setConnectingProvider] = useState<string | null>(null)
|
||||||
|
const [showImapForm, setShowImapForm] = useState(false)
|
||||||
|
const [imapForm, setImapForm] = useState({ email: '', password: '', imapHost: 'imap.porkbun.com', imapPort: 993, imapSecure: true })
|
||||||
|
const [imapConnecting, setImapConnecting] = useState(false)
|
||||||
const [vipSenders, setVipSenders] = useState<VIPSender[]>([])
|
const [vipSenders, setVipSenders] = useState<VIPSender[]>([])
|
||||||
const [newVipEmail, setNewVipEmail] = useState('')
|
const [newVipEmail, setNewVipEmail] = useState('')
|
||||||
const [subscription, setSubscription] = useState<Subscription | null>(null)
|
const [subscription, setSubscription] = useState<Subscription | null>(null)
|
||||||
@@ -126,6 +130,10 @@ export function Settings() {
|
|||||||
})
|
})
|
||||||
const [categories, setCategories] = useState<CategoryInfo[]>([])
|
const [categories, setCategories] = useState<CategoryInfo[]>([])
|
||||||
const [companyLabels, setCompanyLabels] = useState<CompanyLabel[]>([])
|
const [companyLabels, setCompanyLabels] = useState<CompanyLabel[]>([])
|
||||||
|
const [isAdmin, setIsAdmin] = useState(false)
|
||||||
|
const [nameLabels, setNameLabels] = useState<NameLabel[]>([])
|
||||||
|
const [editingNameLabel, setEditingNameLabel] = useState<NameLabel | null>(null)
|
||||||
|
const [showNameLabelPanel, setShowNameLabelPanel] = useState(false)
|
||||||
const [referralData, setReferralData] = useState<{ referralCode: string; referralCount: number } | null>(null)
|
const [referralData, setReferralData] = useState<{ referralCode: string; referralCount: number } | null>(null)
|
||||||
const [loadingReferral, setLoadingReferral] = useState(false)
|
const [loadingReferral, setLoadingReferral] = useState(false)
|
||||||
|
|
||||||
@@ -185,32 +193,39 @@ export function Settings() {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [accountsRes, subsRes, prefsRes, aiControlRes, companyLabelsRes] = await Promise.all([
|
const [accountsRes, subsRes, prefsRes, aiControlRes, companyLabelsRes, meRes] = await Promise.all([
|
||||||
api.getEmailAccounts(user.$id),
|
api.getEmailAccounts(user.$id),
|
||||||
api.getSubscriptionStatus(user.$id),
|
api.getSubscriptionStatus(user.$id),
|
||||||
api.getUserPreferences(user.$id),
|
api.getUserPreferences(user.$id),
|
||||||
api.getAIControlSettings(user.$id),
|
api.getAIControlSettings(user.$id),
|
||||||
api.getCompanyLabels(user.$id),
|
api.getCompanyLabels(user.$id),
|
||||||
|
user?.email ? api.getMe(user.email) : Promise.resolve({ data: { isAdmin: false } }),
|
||||||
])
|
])
|
||||||
|
|
||||||
if (accountsRes.data) setAccounts(accountsRes.data)
|
if (accountsRes.data) setAccounts(accountsRes.data)
|
||||||
if (subsRes.data) setSubscription(subsRes.data)
|
if (subsRes.data) setSubscription(subsRes.data)
|
||||||
|
if (meRes.data?.isAdmin) {
|
||||||
|
setIsAdmin(true)
|
||||||
|
const nameLabelsRes = await api.getNameLabels(user.$id, user.email)
|
||||||
|
if (nameLabelsRes.data) setNameLabels(nameLabelsRes.data)
|
||||||
|
} else {
|
||||||
|
setIsAdmin(false)
|
||||||
|
}
|
||||||
if (prefsRes.data?.vipSenders) setVipSenders(prefsRes.data.vipSenders)
|
if (prefsRes.data?.vipSenders) setVipSenders(prefsRes.data.vipSenders)
|
||||||
if (aiControlRes.data) {
|
if (aiControlRes.data) {
|
||||||
// Merge cleanup defaults if not present
|
// Merge cleanup defaults if not present
|
||||||
const settings: AIControlSettings = {
|
const raw = aiControlRes.data
|
||||||
...aiControlRes.data,
|
const defaultCleanup: CleanupSettings = {
|
||||||
cleanup: aiControlRes.data.cleanup || {
|
|
||||||
enabled: false,
|
enabled: false,
|
||||||
readItems: {
|
readItems: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
action: 'archive_read' as const,
|
action: 'archive_read',
|
||||||
gracePeriodDays: 7,
|
gracePeriodDays: 7,
|
||||||
},
|
},
|
||||||
promotions: {
|
promotions: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
matchCategoriesOrLabels: ['promotions', 'newsletters'],
|
matchCategoriesOrLabels: ['promotions', 'newsletters'],
|
||||||
action: 'archive_read' as const,
|
action: 'archive_read',
|
||||||
deleteAfterDays: 30,
|
deleteAfterDays: 30,
|
||||||
},
|
},
|
||||||
safety: {
|
safety: {
|
||||||
@@ -218,9 +233,12 @@ export function Settings() {
|
|||||||
dryRun: false,
|
dryRun: false,
|
||||||
maxDeletesPerRun: 100,
|
maxDeletesPerRun: 100,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
categoryAdvanced: aiControlRes.data.categoryAdvanced || {},
|
const settings: AIControlSettings = {
|
||||||
version: aiControlRes.data.version || 1,
|
...raw,
|
||||||
|
cleanup: (raw.cleanup as CleanupSettings | undefined) || defaultCleanup,
|
||||||
|
categoryAdvanced: (raw.categoryAdvanced as Record<string, CategoryAdvanced> | undefined) || {},
|
||||||
|
version: raw.version ?? 1,
|
||||||
}
|
}
|
||||||
setAiControlSettings(settings)
|
setAiControlSettings(settings)
|
||||||
savedSettingsRef.current = JSON.parse(JSON.stringify(settings)) // Deep copy
|
savedSettingsRef.current = JSON.parse(JSON.stringify(settings)) // Deep copy
|
||||||
@@ -312,7 +330,7 @@ export function Settings() {
|
|||||||
try {
|
try {
|
||||||
const res = await api.getCleanupStatus(user.$id)
|
const res = await api.getCleanupStatus(user.$id)
|
||||||
if (res.data) setCleanupStatus(res.data)
|
if (res.data) setCleanupStatus(res.data)
|
||||||
} catch (err) {
|
} catch {
|
||||||
// Silently fail if endpoint doesn't exist yet
|
// Silently fail if endpoint doesn't exist yet
|
||||||
console.debug('Cleanup status endpoint not available')
|
console.debug('Cleanup status endpoint not available')
|
||||||
}
|
}
|
||||||
@@ -324,7 +342,7 @@ export function Settings() {
|
|||||||
try {
|
try {
|
||||||
const res = await api.getCleanupPreview(user.$id)
|
const res = await api.getCleanupPreview(user.$id)
|
||||||
if (res.data?.preview) setCleanupPreview(res.data.preview)
|
if (res.data?.preview) setCleanupPreview(res.data.preview)
|
||||||
} catch (err) {
|
} catch {
|
||||||
// Silently fail if endpoint doesn't exist yet
|
// Silently fail if endpoint doesn't exist yet
|
||||||
console.debug('Cleanup preview endpoint not available')
|
console.debug('Cleanup preview endpoint not available')
|
||||||
}
|
}
|
||||||
@@ -476,6 +494,31 @@ export function Settings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleConnectImap = async (e: React.FormEvent) => {
|
||||||
|
e.preventDefault()
|
||||||
|
if (!user?.$id || !imapForm.email.trim() || !imapForm.password) return
|
||||||
|
setImapConnecting(true)
|
||||||
|
const res = await api.connectImapAccount(user.$id, {
|
||||||
|
email: imapForm.email.trim(),
|
||||||
|
password: imapForm.password,
|
||||||
|
imapHost: imapForm.imapHost || undefined,
|
||||||
|
imapPort: imapForm.imapPort || 993,
|
||||||
|
imapSecure: imapForm.imapSecure,
|
||||||
|
})
|
||||||
|
if (res.error) {
|
||||||
|
const msg = res.error.message || 'Connection failed'
|
||||||
|
showMessage('error', msg.includes('credentials') || msg.includes('auth') || msg.includes('password') ? 'Login failed – check email and password' : msg)
|
||||||
|
setImapConnecting(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const list = await api.getEmailAccounts(user.$id)
|
||||||
|
setAccounts(list.data ?? [])
|
||||||
|
setShowImapForm(false)
|
||||||
|
setImapForm({ email: '', password: '', imapHost: 'imap.porkbun.com', imapPort: 993, imapSecure: true })
|
||||||
|
showMessage('success', 'IMAP account connected')
|
||||||
|
setImapConnecting(false)
|
||||||
|
}
|
||||||
|
|
||||||
const handleAddVip = () => {
|
const handleAddVip = () => {
|
||||||
if (!newVipEmail.trim() || !newVipEmail.includes('@')) return
|
if (!newVipEmail.trim() || !newVipEmail.includes('@')) return
|
||||||
|
|
||||||
@@ -533,14 +576,18 @@ export function Settings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabs = [
|
const tabs = useMemo(() => {
|
||||||
|
const base = [
|
||||||
{ id: 'profile' as TabType, label: 'Profile', icon: User },
|
{ id: 'profile' as TabType, label: 'Profile', icon: User },
|
||||||
{ id: 'accounts' as TabType, label: 'Email Accounts', icon: Mail },
|
{ id: 'accounts' as TabType, label: 'Email Accounts', icon: Mail },
|
||||||
{ id: 'vip' as TabType, label: 'VIP List', icon: Star },
|
{ id: 'vip' as TabType, label: 'VIP List', icon: Star },
|
||||||
{ id: 'ai-control' as TabType, label: 'Control Panel', icon: Brain },
|
{ id: 'ai-control' as TabType, label: 'Control Panel', icon: Brain },
|
||||||
|
...(isAdmin ? [{ id: 'name-labels' as TabType, label: 'Name Labels (Team)', icon: Users }] : []),
|
||||||
{ id: 'subscription' as TabType, label: 'Subscription', icon: CreditCard },
|
{ id: 'subscription' as TabType, label: 'Subscription', icon: CreditCard },
|
||||||
{ id: 'privacy' as TabType, label: 'Privacy & Security', icon: Lock },
|
{ id: 'privacy' as TabType, label: 'Privacy & Security', icon: Lock },
|
||||||
]
|
]
|
||||||
|
return base
|
||||||
|
}, [isAdmin])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-slate-50 dark:bg-slate-900">
|
<div className="min-h-screen bg-slate-50 dark:bg-slate-900">
|
||||||
@@ -851,13 +898,13 @@ export function Settings() {
|
|||||||
<div key={account.id} className="flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800/50 rounded-lg">
|
<div key={account.id} className="flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800/50 rounded-lg">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<div className={`w-12 h-12 rounded-lg flex items-center justify-center ${
|
<div className={`w-12 h-12 rounded-lg flex items-center justify-center ${
|
||||||
account.provider === 'gmail' ? 'bg-red-100 dark:bg-red-900/50' : 'bg-blue-100 dark:bg-blue-900/50'
|
account.provider === 'gmail' ? 'bg-red-100 dark:bg-red-900/50' : account.provider === 'outlook' ? 'bg-blue-100 dark:bg-blue-900/50' : 'bg-slate-100 dark:bg-slate-700/50'
|
||||||
}`}>
|
}`}>
|
||||||
<Mail className={`w-6 h-6 ${account.provider === 'gmail' ? 'text-red-600 dark:text-red-400' : 'text-blue-600 dark:text-blue-400'}`} />
|
<Mail className={`w-6 h-6 ${account.provider === 'gmail' ? 'text-red-600 dark:text-red-400' : account.provider === 'outlook' ? 'text-blue-600 dark:text-blue-400' : 'text-slate-600 dark:text-slate-400'}`} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium text-slate-900 dark:text-slate-100">{account.email}</p>
|
<p className="font-medium text-slate-900 dark:text-slate-100">{account.email}</p>
|
||||||
<p className="text-sm text-slate-500 dark:text-slate-400 capitalize">{account.provider}</p>
|
<p className="text-sm text-slate-500 dark:text-slate-400 capitalize">{account.provider === 'imap' ? 'IMAP' : account.provider}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
@@ -926,7 +973,100 @@ export function Settings() {
|
|||||||
<p className="text-sm text-slate-500 dark:text-slate-400">Connect Microsoft account</p>
|
<p className="text-sm text-slate-500 dark:text-slate-400">Connect Microsoft account</p>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowImapForm(!showImapForm)}
|
||||||
|
className="flex items-center gap-4 p-4 border-2 border-slate-200 dark:border-slate-700 rounded-xl hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-all"
|
||||||
|
>
|
||||||
|
<div className="w-12 h-12 rounded-lg bg-slate-100 dark:bg-slate-700 flex items-center justify-center">
|
||||||
|
<Mail className="w-6 h-6 text-slate-600 dark:text-slate-400" />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="text-left">
|
||||||
|
<p className="font-semibold text-slate-900 dark:text-slate-100">IMAP / Other</p>
|
||||||
|
<p className="text-sm text-slate-500 dark:text-slate-400">Porkbun, Nextcloud Mail, or any IMAP</p>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showImapForm && (
|
||||||
|
<form onSubmit={handleConnectImap} className="mt-6 p-4 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800/50 space-y-4">
|
||||||
|
<div>
|
||||||
|
<label htmlFor="imap-email" className="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1">Email</label>
|
||||||
|
<Input
|
||||||
|
id="imap-email"
|
||||||
|
type="email"
|
||||||
|
placeholder="you@example.com"
|
||||||
|
value={imapForm.email}
|
||||||
|
onChange={(e) => setImapForm((f) => ({ ...f, email: e.target.value }))}
|
||||||
|
required
|
||||||
|
autoComplete="email"
|
||||||
|
className="bg-white dark:bg-slate-900"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="imap-password" className="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1">Password / App password</label>
|
||||||
|
<Input
|
||||||
|
id="imap-password"
|
||||||
|
type="password"
|
||||||
|
placeholder="••••••••"
|
||||||
|
value={imapForm.password}
|
||||||
|
onChange={(e) => setImapForm((f) => ({ ...f, password: e.target.value }))}
|
||||||
|
required
|
||||||
|
autoComplete="current-password"
|
||||||
|
className="bg-white dark:bg-slate-900"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<details className="text-sm">
|
||||||
|
<summary className="cursor-pointer text-slate-600 dark:text-slate-400 hover:text-slate-900 dark:hover:text-slate-200">Advanced (host, port, SSL)</summary>
|
||||||
|
<div className="mt-3 grid grid-cols-1 sm:grid-cols-3 gap-3">
|
||||||
|
<div>
|
||||||
|
<label htmlFor="imap-host" className="block text-xs font-medium text-slate-500 dark:text-slate-400 mb-1">IMAP host</label>
|
||||||
|
<Input
|
||||||
|
id="imap-host"
|
||||||
|
type="text"
|
||||||
|
placeholder="imap.porkbun.com"
|
||||||
|
value={imapForm.imapHost}
|
||||||
|
onChange={(e) => setImapForm((f) => ({ ...f, imapHost: e.target.value }))}
|
||||||
|
className="bg-white dark:bg-slate-900 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="imap-port" className="block text-xs font-medium text-slate-500 dark:text-slate-400 mb-1">Port</label>
|
||||||
|
<Input
|
||||||
|
id="imap-port"
|
||||||
|
type="number"
|
||||||
|
min={1}
|
||||||
|
max={65535}
|
||||||
|
value={imapForm.imapPort}
|
||||||
|
onChange={(e) => setImapForm((f) => ({ ...f, imapPort: Number(e.target.value) || 993 }))}
|
||||||
|
className="bg-white dark:bg-slate-900 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-end gap-2 pb-2">
|
||||||
|
<label className="flex items-center gap-2 cursor-pointer text-slate-600 dark:text-slate-400">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={imapForm.imapSecure}
|
||||||
|
onChange={(e) => setImapForm((f) => ({ ...f, imapSecure: e.target.checked }))}
|
||||||
|
className="rounded border-slate-300 dark:border-slate-600"
|
||||||
|
/>
|
||||||
|
Use SSL
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Button type="submit" disabled={imapConnecting}>
|
||||||
|
{imapConnecting ? <Loader2 className="w-4 h-4 animate-spin mr-2" /> : null}
|
||||||
|
Connect IMAP
|
||||||
|
</Button>
|
||||||
|
<Button type="button" variant="outline" onClick={() => { setShowImapForm(false); setImapForm({ email: '', password: '', imapHost: 'imap.porkbun.com', imapPort: 993, imapSecure: true }); }}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
@@ -1058,7 +1198,7 @@ export function Settings() {
|
|||||||
</div>
|
</div>
|
||||||
<select
|
<select
|
||||||
value={filterEnabled}
|
value={filterEnabled}
|
||||||
onChange={(e) => setFilterEnabled(e.target.value as any)}
|
onChange={(e) => setFilterEnabled((e.target.value || 'all') as 'all' | 'enabled' | 'disabled')}
|
||||||
className="px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"
|
className="px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"
|
||||||
>
|
>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
@@ -1070,7 +1210,7 @@ export function Settings() {
|
|||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* Tabs */}
|
{/* Tabs */}
|
||||||
<Tabs value={controlPanelTab} onValueChange={(v) => setControlPanelTab(v as any)} className="w-full">
|
<Tabs value={controlPanelTab} onValueChange={(v) => setControlPanelTab((v || 'rules') as 'rules' | 'cleanup' | 'labels')} className="w-full">
|
||||||
<TabsList className="grid w-full grid-cols-3">
|
<TabsList className="grid w-full grid-cols-3">
|
||||||
<TabsTrigger value="rules" className="text-sm sm:text-base">Rules</TabsTrigger>
|
<TabsTrigger value="rules" className="text-sm sm:text-base">Rules</TabsTrigger>
|
||||||
<TabsTrigger value="cleanup" className="text-sm sm:text-base">Cleanup</TabsTrigger>
|
<TabsTrigger value="cleanup" className="text-sm sm:text-base">Cleanup</TabsTrigger>
|
||||||
@@ -1554,7 +1694,7 @@ export function Settings() {
|
|||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
<select
|
<select
|
||||||
value={labelSort}
|
value={labelSort}
|
||||||
onChange={(e) => setLabelSort(e.target.value as any)}
|
onChange={(e) => setLabelSort((e.target.value || 'name') as 'name' | 'newest')}
|
||||||
className="px-3 py-2 text-sm border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"
|
className="px-3 py-2 text-sm border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100"
|
||||||
>
|
>
|
||||||
<option value="name">Sort: Name</option>
|
<option value="name">Sort: Name</option>
|
||||||
@@ -1834,7 +1974,7 @@ export function Settings() {
|
|||||||
id="category-action"
|
id="category-action"
|
||||||
value={aiControlSettings.categoryActions[selectedCategory.key] || selectedCategory.defaultAction}
|
value={aiControlSettings.categoryActions[selectedCategory.key] || selectedCategory.defaultAction}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newActions = { ...aiControlSettings.categoryActions, [selectedCategory.key]: e.target.value as any }
|
const newActions = { ...aiControlSettings.categoryActions, [selectedCategory.key]: (e.target.value || 'inbox') as 'inbox' | 'archive_read' | 'star' }
|
||||||
setAiControlSettings({ ...aiControlSettings, categoryActions: newActions })
|
setAiControlSettings({ ...aiControlSettings, categoryActions: newActions })
|
||||||
}}
|
}}
|
||||||
className="w-full px-4 py-3 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
|
className="w-full px-4 py-3 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:ring-2 focus:ring-primary-500 focus:border-transparent"
|
||||||
@@ -1881,7 +2021,7 @@ export function Settings() {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newAdvanced = { ...aiControlSettings.categoryAdvanced }
|
const newAdvanced = { ...aiControlSettings.categoryAdvanced }
|
||||||
if (!newAdvanced[selectedCategory.key]) newAdvanced[selectedCategory.key] = {}
|
if (!newAdvanced[selectedCategory.key]) newAdvanced[selectedCategory.key] = {}
|
||||||
newAdvanced[selectedCategory.key] = { ...newAdvanced[selectedCategory.key], priority: e.target.value as any }
|
newAdvanced[selectedCategory.key] = { ...newAdvanced[selectedCategory.key], priority: (e.target.value || 'medium') as 'low' | 'medium' | 'high' }
|
||||||
setAiControlSettings({ ...aiControlSettings, categoryAdvanced: newAdvanced })
|
setAiControlSettings({ ...aiControlSettings, categoryAdvanced: newAdvanced })
|
||||||
}}
|
}}
|
||||||
className="w-full px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 mt-1"
|
className="w-full px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 mt-1"
|
||||||
@@ -2048,12 +2188,232 @@ export function Settings() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{activeTab === 'name-labels' && isAdmin && (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Users className="w-5 h-5 text-primary-500 dark:text-primary-400" />
|
||||||
|
<CardTitle>Name Labels (Team)</CardTitle>
|
||||||
|
</div>
|
||||||
|
<CardDescription>
|
||||||
|
Personal labels for each team member. The AI will assign emails to a worker when they are clearly for that person (e.g. "für Max", "an Anna", subject/body mentions).
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
{nameLabels.length > 0 ? (
|
||||||
|
<div className="space-y-3">
|
||||||
|
{nameLabels.map((label) => (
|
||||||
|
<div
|
||||||
|
key={label.id || label.name}
|
||||||
|
className="flex items-center justify-between p-4 rounded-lg border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-800/50"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<p className="font-medium text-slate-900 dark:text-slate-100">{label.name}</p>
|
||||||
|
{label.email && (
|
||||||
|
<p className="text-sm text-slate-500 dark:text-slate-400">{label.email}</p>
|
||||||
|
)}
|
||||||
|
{label.keywords?.length ? (
|
||||||
|
<p className="text-xs text-slate-400 dark:text-slate-500 mt-1">
|
||||||
|
Keywords: {label.keywords.join(', ')}
|
||||||
|
</p>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
setEditingNameLabel({ ...label })
|
||||||
|
setShowNameLabelPanel(true)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Edit2 className="w-4 h-4 mr-1" />
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
<button
|
||||||
|
onClick={async () => {
|
||||||
|
if (!user?.$id || !label.id) return
|
||||||
|
try {
|
||||||
|
await api.saveNameLabel(user.$id, user.email, { ...label, enabled: !label.enabled })
|
||||||
|
setNameLabels(nameLabels.map(l => l.id === label.id ? { ...l, enabled: !l.enabled } : l))
|
||||||
|
showMessage('success', 'Label updated!')
|
||||||
|
} catch {
|
||||||
|
showMessage('error', 'Failed to update label')
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className={`w-10 h-6 rounded-full transition-colors ${label.enabled ? 'bg-primary-500 dark:bg-primary-600' : 'bg-slate-300 dark:bg-slate-600'}`}
|
||||||
|
title={label.enabled ? 'Disable' : 'Enable'}
|
||||||
|
>
|
||||||
|
<div className={`w-4 h-4 bg-white dark:bg-slate-200 rounded-full transform transition-transform mx-1 ${
|
||||||
|
label.enabled ? 'translate-x-4' : 'translate-x-0'
|
||||||
|
}`} />
|
||||||
|
</button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
onClick={async () => {
|
||||||
|
if (!user?.$id || !label.id) return
|
||||||
|
if (!confirm('Delete this name label?')) return
|
||||||
|
try {
|
||||||
|
await api.deleteNameLabel(user.$id, user.email, label.id)
|
||||||
|
setNameLabels(nameLabels.filter(l => l.id !== label.id))
|
||||||
|
showMessage('success', 'Label deleted!')
|
||||||
|
} catch {
|
||||||
|
showMessage('error', 'Failed to delete label')
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Trash2 className="w-4 h-4 text-red-500 dark:text-red-400" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
setEditingNameLabel({ name: '', enabled: true })
|
||||||
|
setShowNameLabelPanel(true)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Plus className="w-4 h-4 mr-2" />
|
||||||
|
Add team member
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="text-center py-12 text-slate-500 dark:text-slate-400">
|
||||||
|
<Users className="w-12 h-12 mx-auto mb-3 opacity-50" />
|
||||||
|
<p className="font-medium">No name labels yet</p>
|
||||||
|
<p className="text-sm mt-1">Add team members so the AI can assign emails to the right person</p>
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
size="sm"
|
||||||
|
className="mt-4"
|
||||||
|
onClick={() => {
|
||||||
|
setEditingNameLabel({ name: '', enabled: true })
|
||||||
|
setShowNameLabelPanel(true)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Plus className="w-4 h-4 mr-2" />
|
||||||
|
Add team member
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{/* Name Label Editor Side Panel */}
|
||||||
|
<SidePanel open={showNameLabelPanel} onOpenChange={setShowNameLabelPanel}>
|
||||||
|
<SidePanelContent>
|
||||||
|
<SidePanelHeader>
|
||||||
|
<SidePanelCloseButton />
|
||||||
|
<SidePanelTitle>
|
||||||
|
{editingNameLabel?.id ? 'Edit Name Label' : 'Add Team Member'}
|
||||||
|
</SidePanelTitle>
|
||||||
|
<SidePanelDescription>
|
||||||
|
{editingNameLabel?.id
|
||||||
|
? 'Update the name label'
|
||||||
|
: 'Add a team member. The AI will assign emails to this person when they are clearly for them (e.g. "für Max", subject mentions).'}
|
||||||
|
</SidePanelDescription>
|
||||||
|
</SidePanelHeader>
|
||||||
|
{editingNameLabel && (
|
||||||
|
<SidePanelBody>
|
||||||
|
<div className="space-y-6">
|
||||||
|
<div>
|
||||||
|
<Label htmlFor="namelabel-name">Name</Label>
|
||||||
|
<Input
|
||||||
|
id="namelabel-name"
|
||||||
|
placeholder="e.g. Max, Anna"
|
||||||
|
value={editingNameLabel.name}
|
||||||
|
onChange={(e) => setEditingNameLabel({ ...editingNameLabel, name: e.target.value })}
|
||||||
|
className="mt-2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Label htmlFor="namelabel-email">Email (optional)</Label>
|
||||||
|
<Input
|
||||||
|
id="namelabel-email"
|
||||||
|
type="email"
|
||||||
|
placeholder="max@company.com"
|
||||||
|
value={editingNameLabel.email || ''}
|
||||||
|
onChange={(e) => setEditingNameLabel({ ...editingNameLabel, email: e.target.value || undefined })}
|
||||||
|
className="mt-2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Label htmlFor="namelabel-keywords">Keywords (optional, comma-separated)</Label>
|
||||||
|
<Input
|
||||||
|
id="namelabel-keywords"
|
||||||
|
placeholder="für Max, an Max, Max bitte"
|
||||||
|
value={(editingNameLabel.keywords || []).join(', ')}
|
||||||
|
onChange={(e) => setEditingNameLabel({
|
||||||
|
...editingNameLabel,
|
||||||
|
keywords: e.target.value.split(',').map(k => k.trim()).filter(Boolean),
|
||||||
|
})}
|
||||||
|
className="mt-2"
|
||||||
|
/>
|
||||||
|
<p className="text-xs text-slate-500 dark:text-slate-400 mt-1">Hints for the AI to recognize emails for this person</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-between p-4 rounded-lg border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-800/50">
|
||||||
|
<div>
|
||||||
|
<Label className="font-medium">Enabled</Label>
|
||||||
|
<p className="text-sm text-slate-500 dark:text-slate-400">This label will be used when sorting</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={() => setEditingNameLabel({ ...editingNameLabel, enabled: !editingNameLabel.enabled })}
|
||||||
|
className={`w-12 h-6 rounded-full transition-colors ${editingNameLabel.enabled ? 'bg-primary-500 dark:bg-primary-600' : 'bg-slate-300 dark:bg-slate-600'}`}
|
||||||
|
>
|
||||||
|
<div className={`w-5 h-5 bg-white dark:bg-slate-200 rounded-full transform transition-transform mx-0.5 ${
|
||||||
|
editingNameLabel.enabled ? 'translate-x-6' : 'translate-x-0'
|
||||||
|
}`} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SidePanelBody>
|
||||||
|
)}
|
||||||
|
<SidePanelFooter>
|
||||||
|
<Button variant="secondary" onClick={() => { setShowNameLabelPanel(false); setEditingNameLabel(null) }}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={async () => {
|
||||||
|
if (!user?.$id || !editingNameLabel?.name?.trim()) {
|
||||||
|
showMessage('error', 'Please enter a name')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const saved = await api.saveNameLabel(user.$id, user.email, editingNameLabel)
|
||||||
|
if (saved.data) {
|
||||||
|
if (editingNameLabel.id) {
|
||||||
|
setNameLabels(nameLabels.map(l => l.id === editingNameLabel.id ? (saved.data || l) : l))
|
||||||
|
showMessage('success', 'Label updated!')
|
||||||
|
} else {
|
||||||
|
setNameLabels([...nameLabels, saved.data])
|
||||||
|
showMessage('success', 'Label created!')
|
||||||
|
}
|
||||||
|
setShowNameLabelPanel(false)
|
||||||
|
setEditingNameLabel(null)
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
showMessage('error', editingNameLabel.id ? 'Failed to update' : 'Failed to create')
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{editingNameLabel?.id ? 'Save Changes' : 'Add'}
|
||||||
|
</Button>
|
||||||
|
</SidePanelFooter>
|
||||||
|
</SidePanelContent>
|
||||||
|
</SidePanel>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{activeTab === 'referrals' && (
|
{activeTab === 'referrals' && (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Referrals</CardTitle>
|
<CardTitle>Referrals</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
Share EmailSorter and earn rewards
|
Share MailFlow and earn rewards
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
@@ -2140,7 +2500,7 @@ export function Settings() {
|
|||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Current Subscription</CardTitle>
|
<CardTitle>Current Subscription</CardTitle>
|
||||||
<CardDescription>Manage your EmailSorter subscription</CardDescription>
|
<CardDescription>Manage your MailFlow subscription</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="flex items-center justify-between p-4 bg-gradient-to-r from-primary-50 to-accent-50 dark:from-primary-900/30 dark:to-accent-900/30 rounded-xl border border-primary-100 dark:border-primary-800">
|
<div className="flex items-center justify-between p-4 bg-gradient-to-r from-primary-50 to-accent-50 dark:from-primary-900/30 dark:to-accent-900/30 rounded-xl border border-primary-100 dark:border-primary-800">
|
||||||
|
|||||||
@@ -107,9 +107,7 @@ export function Setup() {
|
|||||||
|
|
||||||
const steps: { id: Step; title: string; description: string }[] = [
|
const steps: { id: Step; title: string; description: string }[] = [
|
||||||
{ id: 'connect', title: 'Connect email', description: 'Link your mailbox' },
|
{ id: 'connect', title: 'Connect email', description: 'Link your mailbox' },
|
||||||
{ id: 'preferences', title: 'Settings', description: 'Sorting preferences' },
|
{ id: 'complete', title: 'Done', description: 'Go to dashboard' },
|
||||||
{ id: 'categories', title: 'Categories', description: 'Choose categories' },
|
|
||||||
{ id: 'complete', title: 'Done', description: 'Get started!' },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const stepIndex = steps.findIndex(s => s.id === currentStep)
|
const stepIndex = steps.findIndex(s => s.id === currentStep)
|
||||||
@@ -128,13 +126,12 @@ export function Setup() {
|
|||||||
} else {
|
} else {
|
||||||
setConnectedProvider('gmail')
|
setConnectedProvider('gmail')
|
||||||
setConnectedEmail(user.email)
|
setConnectedEmail(user.email)
|
||||||
setCurrentStep('preferences')
|
setCurrentStep('complete')
|
||||||
// Track onboarding step
|
await api.updateOnboardingStep(user.$id, 'see_results', ['connect'])
|
||||||
await api.updateOnboardingStep(user.$id, 'first_rule', ['connect'])
|
|
||||||
trackOnboardingStep(user.$id, 'first_rule')
|
trackOnboardingStep(user.$id, 'first_rule')
|
||||||
trackProviderConnected(user.$id, 'gmail')
|
trackProviderConnected(user.$id, 'gmail')
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
setError('Gmail connection failed. Please try again.')
|
setError('Gmail connection failed. Please try again.')
|
||||||
} finally {
|
} finally {
|
||||||
setConnecting(null)
|
setConnecting(null)
|
||||||
@@ -155,11 +152,10 @@ export function Setup() {
|
|||||||
} else {
|
} else {
|
||||||
setConnectedProvider('outlook')
|
setConnectedProvider('outlook')
|
||||||
setConnectedEmail(user.email)
|
setConnectedEmail(user.email)
|
||||||
setCurrentStep('preferences')
|
setCurrentStep('complete')
|
||||||
// Track onboarding step
|
await api.updateOnboardingStep(user.$id, 'see_results', ['connect'])
|
||||||
await api.updateOnboardingStep(user.$id, 'first_rule', ['connect'])
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
setError('Outlook connection failed. Please try again.')
|
setError('Outlook connection failed. Please try again.')
|
||||||
} finally {
|
} finally {
|
||||||
setConnecting(null)
|
setConnecting(null)
|
||||||
@@ -176,13 +172,12 @@ export function Setup() {
|
|||||||
if (response.data) {
|
if (response.data) {
|
||||||
setConnectedProvider('demo')
|
setConnectedProvider('demo')
|
||||||
setConnectedEmail(response.data.email)
|
setConnectedEmail(response.data.email)
|
||||||
setCurrentStep('preferences')
|
setCurrentStep('complete')
|
||||||
// Track onboarding step
|
await api.updateOnboardingStep(user.$id, 'see_results', ['connect'])
|
||||||
await api.updateOnboardingStep(user.$id, 'first_rule', ['connect'])
|
|
||||||
trackOnboardingStep(user.$id, 'first_rule')
|
trackOnboardingStep(user.$id, 'first_rule')
|
||||||
trackDemoUsed(user.$id)
|
trackDemoUsed(user.$id)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
setError('Demo connection failed. Please try again.')
|
setError('Demo connection failed. Please try again.')
|
||||||
} finally {
|
} finally {
|
||||||
setConnecting(null)
|
setConnecting(null)
|
||||||
@@ -240,7 +235,7 @@ export function Setup() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Mark onboarding as completed
|
// Mark onboarding as completed
|
||||||
await api.updateOnboardingStep(user.$id, 'completed', ['connect', 'first_rule', 'see_results', 'auto_schedule'])
|
await api.updateOnboardingStep(user.$id, 'completed', ['connect', 'see_results'])
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to save preferences:', err)
|
console.error('Failed to save preferences:', err)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -336,7 +331,7 @@ export function Setup() {
|
|||||||
<OnboardingProgress
|
<OnboardingProgress
|
||||||
currentStep={onboardingState.onboarding_step}
|
currentStep={onboardingState.onboarding_step}
|
||||||
completedSteps={onboardingState.completedSteps}
|
completedSteps={onboardingState.completedSteps}
|
||||||
totalSteps={4}
|
totalSteps={2}
|
||||||
onSkip={handleSkipOnboarding}
|
onSkip={handleSkipOnboarding}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -469,6 +464,11 @@ export function Setup() {
|
|||||||
<ChevronRight className="w-5 h-5 text-slate-400 dark:text-slate-500 group-hover:text-blue-500 dark:group-hover:text-blue-400 group-hover:translate-x-1 transition-all" />
|
<ChevronRight className="w-5 h-5 text-slate-400 dark:text-slate-500 group-hover:text-blue-500 dark:group-hover:text-blue-400 group-hover:translate-x-1 transition-all" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p className="text-sm text-slate-500 dark:text-slate-400 mt-4">
|
||||||
|
Using Porkbun, Nextcloud Mail, or another IMAP provider?{' '}
|
||||||
|
<Link to="/settings?tab=accounts" className="text-primary-600 dark:text-primary-400 hover:underline">Add your account in Settings → Accounts</Link>.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-10 p-4 bg-slate-50 dark:bg-slate-800/50 rounded-xl max-w-lg mx-auto">
|
<div className="mt-10 p-4 bg-slate-50 dark:bg-slate-800/50 rounded-xl max-w-lg mx-auto">
|
||||||
@@ -588,12 +588,15 @@ export function Setup() {
|
|||||||
|
|
||||||
{currentStep === 'complete' && (
|
{currentStep === 'complete' && (
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<div className="w-28 h-28 mx-auto mb-8 rounded-full bg-gradient-to-br from-green-100 to-green-200 flex items-center justify-center shadow-2xl shadow-green-500/20 animate-pulse">
|
<div className="w-28 h-28 mx-auto mb-8 rounded-full bg-gradient-to-br from-green-100 to-green-200 dark:from-green-900/40 dark:to-green-800/40 flex items-center justify-center shadow-2xl shadow-green-500/20 animate-pulse">
|
||||||
<Sparkles className="w-14 h-14 text-green-600" />
|
<Sparkles className="w-14 h-14 text-green-600 dark:text-green-400" />
|
||||||
</div>
|
</div>
|
||||||
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">All set! 🎉</h1>
|
<h1 className="text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">You're in 🎉</h1>
|
||||||
<p className="text-xl text-slate-600 dark:text-slate-400 mb-10 max-w-md mx-auto">
|
<p className="text-xl text-slate-600 dark:text-slate-400 mb-6 max-w-md mx-auto">
|
||||||
Your email account is connected. The AI will now start intelligent sorting.
|
Click Sort Now on the dashboard to categorize your inbox. Takes about 30 seconds.
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-slate-500 dark:text-slate-500 mb-10">
|
||||||
|
<Link to="/settings" className="underline hover:text-slate-700 dark:hover:text-slate-300">Tune categories later in Settings</Link>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="inline-flex items-center gap-4 p-5 bg-gradient-to-r from-slate-50 to-slate-100 dark:from-slate-800 dark:to-slate-700 rounded-2xl mb-10 shadow-lg">
|
<div className="inline-flex items-center gap-4 p-5 bg-gradient-to-r from-slate-50 to-slate-100 dark:from-slate-800 dark:to-slate-700 rounded-2xl mb-10 shadow-lg">
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ export function VerifyEmail() {
|
|||||||
try {
|
try {
|
||||||
await auth.verifyEmail(userId, secret)
|
await auth.verifyEmail(userId, secret)
|
||||||
setStatus('success')
|
setStatus('success')
|
||||||
} catch (err: any) {
|
} catch (err: unknown) {
|
||||||
setStatus('error')
|
setStatus('error')
|
||||||
setError(err.message || 'Fehler bei der Verifizierung')
|
setError(err instanceof Error ? err.message : 'Fehler bei der Verifizierung')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ export function VerifyEmail() {
|
|||||||
await auth.sendVerification()
|
await auth.sendVerification()
|
||||||
setError('')
|
setError('')
|
||||||
alert('Neue Verifizierungs-E-Mail wurde gesendet!')
|
alert('Neue Verifizierungs-E-Mail wurde gesendet!')
|
||||||
} catch (err: any) {
|
} catch (err: unknown) {
|
||||||
setError(err.message || 'Fehler beim Senden')
|
setError(err instanceof Error ? err.message : 'Fehler beim Senden')
|
||||||
} finally {
|
} finally {
|
||||||
setStatus('error')
|
setStatus('error')
|
||||||
}
|
}
|
||||||
@@ -54,12 +54,15 @@ export function VerifyEmail() {
|
|||||||
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
|
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link to="/" className="flex items-center justify-center gap-2 mb-8">
|
<Link to="/" className="flex items-center justify-center mb-8 leading-none">
|
||||||
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-500 to-primary-700 flex items-center justify-center">
|
<img
|
||||||
<Mail className="w-5 h-5 text-white" />
|
src="/logo.png"
|
||||||
</div>
|
alt="MailFlow Logo"
|
||||||
<span className="text-xl font-bold text-slate-900 dark:text-slate-100">
|
className="w-24 h-24 rounded-xl object-contain pr-[5px] block"
|
||||||
Email<span className="text-primary-600 dark:text-primary-400">Sorter</span>
|
style={{ display: 'block', margin: 0, padding: 0 }}
|
||||||
|
/>
|
||||||
|
<span className="text-xl font-bold text-slate-900 dark:text-slate-100 ml-[5px]">
|
||||||
|
Mail<span className="text-primary-600 dark:text-primary-400">Flow</span>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
@@ -98,7 +101,7 @@ export function VerifyEmail() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p className="text-slate-600 dark:text-slate-400">
|
<p className="text-slate-600 dark:text-slate-400">
|
||||||
Du kannst jetzt alle Features von EmailSorter nutzen.
|
Du kannst jetzt alle Features von MailFlow nutzen.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Button onClick={() => navigate('/dashboard')} className="w-full">
|
<Button onClick={() => navigate('/dashboard')} className="w-full">
|
||||||
@@ -144,8 +147,8 @@ export function VerifyEmail() {
|
|||||||
{/* Help text */}
|
{/* Help text */}
|
||||||
<p className="text-center text-sm text-slate-500 dark:text-slate-400 mt-6">
|
<p className="text-center text-sm text-slate-500 dark:text-slate-400 mt-6">
|
||||||
Probleme? Kontaktiere uns unter{' '}
|
Probleme? Kontaktiere uns unter{' '}
|
||||||
<a href="mailto:support@emailsorter.de" className="text-primary-600 dark:text-primary-400 hover:underline">
|
<a href="mailto:support@mailflow.de" className="text-primary-600 dark:text-primary-400 hover:underline">
|
||||||
support@emailsorter.de
|
support@mailflow.de
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -66,6 +66,15 @@ export interface CompanyLabel {
|
|||||||
category?: string
|
category?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Name label = personal label per worker (admin only). AI assigns emails to a worker when clearly for them. */
|
||||||
|
export interface NameLabel {
|
||||||
|
id?: string
|
||||||
|
name: string
|
||||||
|
email?: string
|
||||||
|
keywords?: string[]
|
||||||
|
enabled: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface CategoryInfo {
|
export interface CategoryInfo {
|
||||||
key: string
|
key: string
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
133
docs/PRODUCT_STRATEGY_2WEEK.md
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
# Email Sorter — Product Strategy (2-Week / Reddit Launch)
|
||||||
|
|
||||||
|
**Role:** Product owner. **Goal:** First paying users from Reddit (r/buildinpublic, r/SaaS, r/freelance). **Constraint:** Understandable in under 10 seconds.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Homepage & Messaging
|
||||||
|
|
||||||
|
### Problems today
|
||||||
|
- **Hero:** "Clean inbox automatically in minutes" is vague. "Minutes" undersells; "clean" is generic.
|
||||||
|
- **Subhead:** "Create smart rules, apply in one click" — sounds like manual work, not automatic.
|
||||||
|
- **Badge:** "AI-powered email sorting" — buzzword; doesn’t say who it’s for or what outcome.
|
||||||
|
- **CTAs:** "Try Demo" vs "Connect inbox" — two choices slow decision; primary action unclear.
|
||||||
|
|
||||||
|
### Proposed copy (exact)
|
||||||
|
|
||||||
|
| Element | Current | Proposed |
|
||||||
|
|--------|---------|----------|
|
||||||
|
| **Badge** | AI-powered email sorting | For freelancers & small teams |
|
||||||
|
| **Headline** | Clean inbox automatically in minutes. | **Leads, clients, spam — sorted automatically.** |
|
||||||
|
| **Subhead** | Create smart rules… | Connect Gmail or Outlook. We put newsletters, promos, and noise in folders so your inbox stays for what pays. |
|
||||||
|
| **Primary CTA** | Try Demo (first) | **Try it free** (one button; goes to register or demo) |
|
||||||
|
| **Secondary** | Connect inbox | See how it works (scroll or short demo) |
|
||||||
|
|
||||||
|
### Implementation
|
||||||
|
- One primary CTA above the fold: **Try it free** → `/register`. Remove or demote "Try Demo" to a small link under the button: "Or try a 30-second demo first."
|
||||||
|
- Remove "in minutes" and "smart rules" from hero. No "Inbox Zero" in hero (use only in Features if at all).
|
||||||
|
- Trust line: keep "No credit card · Gmail & Outlook · GDPR compliant" but shorten to one line.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Activation & Onboarding (60-Second Flow)
|
||||||
|
|
||||||
|
### Minimum steps before value
|
||||||
|
1. **Sign up** (email + password or Google; no long form).
|
||||||
|
2. **Connect inbox** OR **Try Demo** (pick one as default; Demo gets you to "Sort complete" in one click).
|
||||||
|
3. **Done** → Dashboard with "Sort Now" or auto-result.
|
||||||
|
|
||||||
|
### What to remove or defer
|
||||||
|
- **Remove:** Step "Settings" (Sorting Intensity: Light/Medium/Strict). Use a single default: Medium. Expose in Settings later.
|
||||||
|
- **Remove:** Step "Choose your categories". Default: all 6 core categories (VIP, Clients, Invoices, Newsletter, Social, Security). No picker during onboarding.
|
||||||
|
- **Remove:** "Historical emails" toggle. Default: off for first run (faster). Optional in Settings.
|
||||||
|
- **Keep:** Connect email (Gmail/Outlook) + Demo. One click to "Done" then Dashboard.
|
||||||
|
- **Skip button:** Keep "Skip" but rename to "I’ll do this later" and only show after they’ve seen the connect step (so they can still land on dashboard with empty state).
|
||||||
|
|
||||||
|
### 60-second flow (concrete)
|
||||||
|
1. **0–15s:** Land on `/register` or home → click "Try it free" → sign up (email or Google).
|
||||||
|
2. **15–45s:** One screen: "Connect Gmail or Outlook" + prominent "Try with sample inbox" (demo). No steps 2–3.
|
||||||
|
3. **45–60s:** After connect or demo → "You’re in. Click Sort Now." → Dashboard. If demo: one "Sort Now" click → instant result.
|
||||||
|
|
||||||
|
### Implementation
|
||||||
|
- Collapse Setup into **one step**: Connect (with Demo as primary option for first-time). After connect or demo → go straight to Dashboard.
|
||||||
|
- Move "Sorting intensity" and "Categories" to Settings (and optional "tune later" link from dashboard empty state).
|
||||||
|
- Default for new users: Demo first (so they see a result in 30s), then "Connect your real inbox to sort it."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Core Feature Focus
|
||||||
|
|
||||||
|
### One main selling point
|
||||||
|
**"Automatic email categories: Leads, clients, invoices, newsletters, spam — without rules."**
|
||||||
|
|
||||||
|
- The moment of value: user sees **their** emails (or demo emails) sorted into clear categories and inbox count dropping.
|
||||||
|
- Everything in the app should point to: connect → sort once → see result. No "AI suggests, you approve" as hero message.
|
||||||
|
|
||||||
|
### Features to hide or delay (for 2-week launch)
|
||||||
|
- **Hide:** "Control Panel", "Smart suggestions" / "Apply suggested rules" as primary path. Keep in dashboard for power users but don’t push in onboarding.
|
||||||
|
- **Hide:** Daily digest / "Today’s Digest" for new users (show after 2nd sort or after 7 days).
|
||||||
|
- **Hide:** Referral / Share results until after first successful sort and upgrade prompt.
|
||||||
|
- **De-emphasize:** Multiple email accounts (show "1 account" in pricing; multi-account in Settings, not hero).
|
||||||
|
- **Remove from landing:** "Inbox Zero" as headline (overused). Use "sorted inbox" or "inbox that stays clean."
|
||||||
|
|
||||||
|
### Features to keep prominent
|
||||||
|
- Connect one inbox (Gmail/Outlook).
|
||||||
|
- **Sort Now** + result: "X emails categorized, inbox reduced by Y, time saved Z."
|
||||||
|
- Single clear upgrade moment: when they hit limit or after first sort ("Unlimited sorts from $X/month").
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. UX/UI Improvements
|
||||||
|
|
||||||
|
### Trust & clarity
|
||||||
|
- **Navbar:** Add one line under logo: "B2B email sorting" or keep minimal. CTA: "Try it free" (not "Get started free").
|
||||||
|
- **Pricing section:** One price for Reddit launch: e.g. **$9/month** or **$7/month** (single plan). "Most Popular" on the only paid plan. Remove Business tier for now.
|
||||||
|
- **Empty state (Dashboard, no account):** One sentence: "Connect Gmail or Outlook to sort your first emails." One button: "Connect inbox." No extra cards (Control Panel, Einstellungen) until one account is connected.
|
||||||
|
- **Empty state (Dashboard, account connected, no sort yet):** "Click Sort Now to categorize your inbox. Takes about 30 seconds." Big "Sort Now" button.
|
||||||
|
- **First-time sort result:** Keep current "First sort complete!" + numbers. Add one line: "We’ve put newsletters and promos in folders. Check your inbox — only important mail is left."
|
||||||
|
|
||||||
|
### Defaults
|
||||||
|
- **Onboarding:** Default = Demo (so they see value without OAuth). Then "Connect your real inbox."
|
||||||
|
- **Categories:** All 6 selected by default; no picker during onboarding.
|
||||||
|
- **Strictness:** Medium; no selector in flow.
|
||||||
|
|
||||||
|
### Skeptical / impatient users
|
||||||
|
- **Above the fold:** No carousel, no "4 steps". One headline, one subhead, one CTA.
|
||||||
|
- **FAQ:** Move "Do I need a credit card?" and "Can I cancel anytime?" to top. Add: "What do you do with my email?" → "We only read headers and labels to assign categories. We don’t store email content."
|
||||||
|
- **Footer:** Short. Imprint, Privacy, Contact. No long feature list.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Monetization (Early Stage)
|
||||||
|
|
||||||
|
### Pricing that feels "no-brainer" for freelancers
|
||||||
|
- **Free:** 1 account, 500 emails/month, basic categories. Enough to feel the product.
|
||||||
|
- **Single paid plan:** **$9/month** (or **$7/month** for first 100 customers). "Unlimited emails, 1 account, all categories, cancel anytime."
|
||||||
|
- **Remove for now:** $19 Pro, $49 Business. One plan = no choice paralysis.
|
||||||
|
- **Trial:** 14-day free trial, no card. After trial, card required or account stays free-tier (500/mo).
|
||||||
|
|
||||||
|
### Early-adopter experiment
|
||||||
|
- **Reddit launch offer:** "First 50 from r/SaaS or r/freelance: $5/month for 6 months." Use a coupon or a separate plan ID. Mention in Reddit post and a small banner on pricing: "Reddit launch: $5/mo for 6 months — use code REDDIT50."
|
||||||
|
- **Churn:** Focus on "Sort Now" success in first 7 days. If they’ve done 2+ sorts and connected a real inbox, send one email: "You’ve sorted X emails. Upgrade to unlimited for $9/mo." No aggressive upsells.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Retention & Defensibility
|
||||||
|
|
||||||
|
### One integration that increases switching cost
|
||||||
|
- **Gmail labels (or Outlook folders) as the integration.** Product already sorts into categories; make the output visible where they live:
|
||||||
|
- **Sync categories to Gmail labels** (e.g. "EmailSorter/Clients", "EmailSorter/Newsletter"). User sees labels in Gmail; moving away means losing those labels or redoing work.
|
||||||
|
- Implementation: After sort, apply Gmail API `users.labels` + `messages.modify` to add the label to each message. One-way: Email Sorter → Gmail. No need for bi-directional sync in v1.
|
||||||
|
- **Alternative (simpler):** **Weekly digest email.** "You sorted 47 emails this week. Top category: Newsletter (20)." Builds habit and touchpoint; unsubscribing = losing a small benefit.
|
||||||
|
- **Recommendation:** Gmail (and later Outlook) label sync. Real defensibility; realistic for a solo dev (Gmail API is well documented). Ship "Sync to Gmail labels" as a Pro feature or post–free-trial hook.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Implementation Checklist (Priority Order)
|
||||||
|
|
||||||
|
- [ ] **Hero:** New headline, subhead, single CTA "Try it free", demo as secondary link.
|
||||||
|
- [ ] **Onboarding:** Single step (Connect or Demo) → Dashboard. Move Settings + Categories to Settings page.
|
||||||
|
- [ ] **Pricing:** One paid plan $9/mo; optional Reddit code REDDIT50 ($5/mo for 6 months).
|
||||||
|
- [ ] **Dashboard empty states:** Copy and single primary action per state.
|
||||||
|
- [ ] **FAQ:** Reorder; add "What do you do with my email?"; keep short.
|
||||||
|
- [ ] **Defensibility:** Design/spec "Sync categories to Gmail labels" for post–launch.
|
||||||
@@ -146,7 +146,19 @@ tail -f server/logs/webhook.log
|
|||||||
- ✅ Prüfe, ob der Server erreichbar ist (`curl https://emailsorter.webklar.com/api/webhook/status`)
|
- ✅ Prüfe, ob der Server erreichbar ist (`curl https://emailsorter.webklar.com/api/webhook/status`)
|
||||||
- ✅ Prüfe Gitea-Logs: **Settings** → **Webhooks** → **Delivery Log**
|
- ✅ Prüfe Gitea-Logs: **Settings** → **Webhooks** → **Delivery Log**
|
||||||
|
|
||||||
### "Ungültige Webhook-Signatur" (401)
|
### 502 Bad Gateway (von nginx)
|
||||||
|
|
||||||
|
Nginx meldet 502, wenn das Backend (Node/PM2) nicht antwortet oder abstürzt.
|
||||||
|
|
||||||
|
- ✅ **Backend läuft:** `pm2 list` – Prozess muss „online“ sein
|
||||||
|
- ✅ **Backend neu starten:** `pm2 restart all` oder `pm2 start ecosystem.config.js`
|
||||||
|
- ✅ **Logs prüfen:** `pm2 logs` – beim nächsten „Test Push“ sofort Fehler ansehen
|
||||||
|
- ✅ **Health prüfen:** `curl -s -o /dev/null -w "%{http_code}" https://emailsorter.webklar.com/api/health` → sollte `200` sein
|
||||||
|
- ✅ **Nginx-Upstream:** `proxy_pass` muss auf den richtigen Port zeigen (z. B. `http://127.0.0.1:3000`)
|
||||||
|
|
||||||
|
Nach einem Code-Deploy (größeres Body-Limit, robustere Fehlerbehandlung) Backend neu starten: `pm2 restart all`.
|
||||||
|
|
||||||
|
### "Ungültige Webhook-Signatur" (401/403)
|
||||||
|
|
||||||
- ✅ Prüfe, ob `GITEA_WEBHOOK_SECRET` in `server/.env` gesetzt ist
|
- ✅ Prüfe, ob `GITEA_WEBHOOK_SECRET` in `server/.env` gesetzt ist
|
||||||
- ✅ Prüfe, ob das Secret in Gitea **genau gleich** ist (keine Leerzeichen!)
|
- ✅ Prüfe, ob das Secret in Gitea **genau gleich** ist (keine Leerzeichen!)
|
||||||
|
|||||||
41
docs/deployment/SSH-WEBHOOK-FIX-PROMPT.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Anleitung für SSH – nur EmailSorter (emailsorter.webklar.com) fixen
|
||||||
|
|
||||||
|
**Kopiere den folgenden Abschnitt und schick ihn an die Person am Server (oder nutze ihn als eigene Checkliste):**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Kontext
|
||||||
|
|
||||||
|
- **Nur diese Website:** **emailsorter.webklar.com** (EmailSorter / Gitea-Webhook).
|
||||||
|
- **Nicht anfassen:** Alle anderen Websites/Projekte auf dem gleichen Server.
|
||||||
|
- **Problem:** Beim Gitea-Webhook („Test Push Event“) kommt **502 Bad Gateway** von nginx. Das Backend (Node/PM2) für emailsorter.webklar.com soll geprüft und ggf. neu gestartet werden.
|
||||||
|
|
||||||
|
## Was ich brauche
|
||||||
|
|
||||||
|
1. **PM2 prüfen (nur für EmailSorter):**
|
||||||
|
- `pm2 list` ausführen.
|
||||||
|
- Den Prozess finden, der zu **emailsorter.webklar.com** / EmailSorter gehört (Name oder Script-Pfad wie `server/index.mjs` oder `emailsorter`).
|
||||||
|
- Prüfen: Läuft er (Status „online“)? Wenn „stopped“ oder „errored“: das ist wahrscheinlich die Ursache für den 502.
|
||||||
|
|
||||||
|
2. **Backend für EmailSorter neu starten:**
|
||||||
|
- Nur den PM2-Prozess für EmailSorter neu starten (nicht `pm2 restart all`, wenn andere Sites davon betroffen wären).
|
||||||
|
- Beispiel, wenn der Prozess „emailsorter“ heißt: `pm2 restart emailsorter`
|
||||||
|
- Oder nur den einen Eintrag in der Liste per Name/ID neu starten.
|
||||||
|
|
||||||
|
3. **Env für EmailSorter prüfen (optional, nur wenn Webhook weiter 502/401 gibt):**
|
||||||
|
- In das Projektverzeichnis von EmailSorter wechseln (z. B. `/var/www/emailsorter` oder wo auch immer es liegt).
|
||||||
|
- Prüfen, ob in `server/.env` (oder im Root-`.env`) steht:
|
||||||
|
`GITEA_WEBHOOK_SECRET=<dein Webhook-Secret>`
|
||||||
|
- Wenn nicht: diese Zeile in der richtigen `.env` ergänzen (Secret bekommst du separat / steht in Gitea unter Webhook → Secret). Danach nur den EmailSorter-PM2-Prozess neu starten.
|
||||||
|
|
||||||
|
4. **Kurz testen:**
|
||||||
|
- `curl -s -o /dev/null -w "%{http_code}" https://emailsorter.webklar.com/api/health`
|
||||||
|
Sollte `200` ausgeben.
|
||||||
|
- `curl -s -o /dev/null -w "%{http_code}" https://emailsorter.webklar.com/api/webhook/status`
|
||||||
|
Sollte ebenfalls `200` ausgeben.
|
||||||
|
|
||||||
|
5. **Nichts anderes ändern:** Keine anderen Projekte, keine globalen nginx-/System-Konfigurationen anpassen – nur EmailSorter (emailsorter.webklar.com) wie oben beschrieben.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Wenn du den Code gerade neu deployed hast (git pull für EmailSorter):** Danach bitte nur den PM2-Prozess für EmailSorter neu starten (z. B. `pm2 restart <name-oder-id>`), damit die neuen Webhook-Fixes aktiv sind.
|
||||||
@@ -27,8 +27,9 @@ USE_PM2=true
|
|||||||
1. Gehe zu deinem Repository → **Settings** → **Webhooks**
|
1. Gehe zu deinem Repository → **Settings** → **Webhooks**
|
||||||
2. Klicke **Add Webhook** → **Gitea**
|
2. Klicke **Add Webhook** → **Gitea**
|
||||||
3. Fülle aus:
|
3. Fülle aus:
|
||||||
- **Target URL:** `https://emailsorter.webklar.com/api/webhook/gitea`
|
- **Target URL:** `https://emailsorter.webklar.com/api/webhook/gitea` (Produktion)
|
||||||
- **Secret:** `dein_generiertes_secret_hier` (aus Schritt 1)
|
- **Secret:** `dein_generiertes_secret_hier` (aus Schritt 1)
|
||||||
|
- **Authorization Header (optional):** `Bearer dein_generiertes_secret_hier` (gleicher Wert wie Secret)
|
||||||
- **Trigger On:** ✅ **Push Events**
|
- **Trigger On:** ✅ **Push Events**
|
||||||
- **Branch Filter:** `main` oder `master`
|
- **Branch Filter:** `main` oder `master`
|
||||||
4. Klicke **Add Webhook**
|
4. Klicke **Add Webhook**
|
||||||
|
|||||||
183
docs/development/IMAP_IMPLEMENTATION_PLAN.md
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
# Implementierungsplan: IMAP / Porkbun / Nextcloud
|
||||||
|
|
||||||
|
Plan, um EmailSorter um einen **IMAP-Provider** (z. B. Porkbun) zu erweitern. Dann funktioniert die Sortierung auch für Postfächer, die in Nextcloud Mail genutzt werden.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Übersicht
|
||||||
|
|
||||||
|
| Phase | Inhalt | Aufwand (grobe Schätzung) |
|
||||||
|
|-------|--------|----------------------------|
|
||||||
|
| **1** | IMAP-Bibliothek + Service-Grundgerüst | 1–2 h |
|
||||||
|
| **2** | Datenbank + Connect-Route für IMAP | 1 h |
|
||||||
|
| **3** | Sortier-Logik für IMAP (Ordner statt Labels) | 2–3 h |
|
||||||
|
| **4** | Frontend: IMAP-Verbindung anlegen | 1–2 h |
|
||||||
|
| **5** | Testen, Feinschliff, Doku | 1 h |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 1: IMAP-Bibliothek und Service
|
||||||
|
|
||||||
|
**Ziel:** Backend kann sich per IMAP (z. B. Porkbun) verbinden, INBOX auflisten und E-Mails lesen.
|
||||||
|
|
||||||
|
### 1.1 Abhängigkeit hinzufügen
|
||||||
|
|
||||||
|
- **Datei:** `server/package.json`
|
||||||
|
- **Aktion:** Dependency `imapflow` hinzufügen (moderner IMAP-Client für Node, SSL-Support).
|
||||||
|
- **Befehl:** `npm install imapflow` im Ordner `server/`.
|
||||||
|
|
||||||
|
### 1.2 Neuer Service
|
||||||
|
|
||||||
|
- **Datei (neu):** `server/services/imap.mjs`
|
||||||
|
- **Inhalt (Kern-Interface):**
|
||||||
|
- **Konstruktor:** `ImapService({ host, port, secure, user, password })` – z. B. für Porkbun: `host: 'imap.porkbun.com', port: 993, secure: true`.
|
||||||
|
- **connect()** – Verbindung aufbauen (login).
|
||||||
|
- **listEmails(maxResults, fromSeq?)** – Nachrichten aus INBOX (z. B. per FETCH ENVELOPE), Rückgabe: `{ messages: [{ id, uid, ... }], nextSeq }`.
|
||||||
|
- **getEmail(messageId)** bzw. **batchGetEmails(ids)** – eine bzw. mehrere Mails laden, Rückgabe-Format wie Gmail/Outlook: `{ id, headers: { from, subject }, snippet }`.
|
||||||
|
- **close()** – Verbindung sauber trennen (LOGOUT).
|
||||||
|
- **Hinweis:** IMAP nutzt oft UID oder Sequence Number als „id“; einheitlich als `id` nach außen geben (String), damit die Sortier-Route wie bei Gmail/Outlook arbeitet.
|
||||||
|
|
||||||
|
### 1.3 Akzeptanz Phase 1
|
||||||
|
|
||||||
|
- Ein kleines Test-Script (z. B. `server/scripts/test-imap.mjs`) oder ein temporärer Route-Handler liest Umgebungsvariablen (IMAP_HOST, IMAP_PORT, IMAP_USER, IMAP_PASSWORD), baut `ImapService` auf, ruft `listEmails(10)` und `getEmail(...)` auf und loggt das Ergebnis. Keine Credentials im Repo – nur `.env` / Umgebungsvariablen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2: Datenbank und Connect-Route
|
||||||
|
|
||||||
|
**Ziel:** Ein neuer Account-Typ „imap“ kann angelegt werden; Zugangsdaten werden gespeichert.
|
||||||
|
|
||||||
|
### 2.1 Datenbank (Appwrite)
|
||||||
|
|
||||||
|
- **Datei:** `server/bootstrap-v2.mjs` (oder separates Migrations-Script).
|
||||||
|
- **Aktion:** In der Collection `email_accounts` optionale Attribute anlegen:
|
||||||
|
- `imapHost` (String, optional)
|
||||||
|
- `imapPort` (Integer, optional)
|
||||||
|
- `imapSecure` (Boolean, optional)
|
||||||
|
- **Alternative (einfacher für nur Porkbun):** Keine neuen Felder; Host/Port im Code fest (imap.porkbun.com, 993). Dann nur `email` + Passwort nötig; Passwort in bestehendem Feld `accessToken` speichern (semantisch „geheimer Token für IMAP“). Für spätere andere IMAP-Server die optionalen Felder nachziehen.
|
||||||
|
|
||||||
|
### 2.2 Connect-Route erweitern
|
||||||
|
|
||||||
|
- **Datei:** `server/routes/email.mjs`
|
||||||
|
- **Route:** `POST /api/email/connect` (bzw. die Route, die Accounts anlegt).
|
||||||
|
- **Aktionen:**
|
||||||
|
- Im Validierungs-Schema `provider` um `'imap'` erweitern: z. B. `rules.isIn('provider', ['gmail', 'outlook', 'demo', 'imap'])`.
|
||||||
|
- Body für IMAP: mindestens `userId`, `provider: 'imap'`, `email`, `password` (oder `accessToken` als Passwort). Optional: `imapHost`, `imapPort`, `imapSecure`.
|
||||||
|
- Wenn `provider === 'imap'`:
|
||||||
|
- Host/Port/Secure aus Body oder Default (Porkbun: imap.porkbun.com, 993, true).
|
||||||
|
- Passwort nicht loggen; in DB in `accessToken` (oder neuem Feld) speichern.
|
||||||
|
- Optional: einmalig `ImapService` instanziieren, `connect()` + `listEmails(1)` aufrufen; bei Erfolg Account anlegen, sonst Fehler zurückgeben („Ungültige Anmeldedaten“).
|
||||||
|
- Account-Dokument anlegen mit `provider: 'imap'`, `email`, `accessToken` (= Passwort), ggf. `imapHost`, `imapPort`, `imapSecure`.
|
||||||
|
|
||||||
|
### 2.3 Middleware/Validierung
|
||||||
|
|
||||||
|
- **Datei:** `server/middleware/validate.mjs` (falls dort Regeln liegen) oder direkt in der Route.
|
||||||
|
- **Aktion:** Für IMAP ggf. zusätzliche Felder erlauben: `imapHost`, `imapPort`, `imapSecure`, `password` (oder wie du das Feld nennst).
|
||||||
|
|
||||||
|
### 2.4 Akzeptanz Phase 2
|
||||||
|
|
||||||
|
- Per API-Client (Postman/curl) oder Frontend: POST mit `provider: 'imap'`, `email`, `password` (und optional Host/Port) an `/connect` senden. Erwartung: 201, Account in Appwrite mit `provider: 'imap'`. Bei falschem Passwort: 4xx mit verständlicher Meldung.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3: Sortier-Logik für IMAP
|
||||||
|
|
||||||
|
**Ziel:** `POST /api/email/sort` funktioniert für Accounts mit `provider === 'imap'`: E-Mails werden per KI kategorisiert und in IMAP-Ordner verschoben.
|
||||||
|
|
||||||
|
### 3.1 Ordner-Mapping
|
||||||
|
|
||||||
|
- **Konzept:** Kategorien (z. B. `vip`, `promotions`, `newsletters`, `archive`) auf Ordner-Namen mappen. Z. B.:
|
||||||
|
- `archive` / `archive_read` → Ordner `Archive` oder `EmailSorter/Archive`
|
||||||
|
- `promotions` → `Promotions` oder `EmailSorter/Promotions`
|
||||||
|
- usw.
|
||||||
|
- **Datei:** Entweder in `server/services/imap.mjs` (Funktion `getFolderNameForCategory(category)`) oder in `server/services/ai-sorter.mjs` / Config. Einheitliche Liste (z. B. Objekt `categoryToFolder`) verwenden.
|
||||||
|
|
||||||
|
### 3.2 IMAP-Service erweitern
|
||||||
|
|
||||||
|
- **Datei:** `server/services/imap.mjs`
|
||||||
|
- **Neue Methoden:**
|
||||||
|
- **ensureFolder(folderName)** – Ordner anlegen (CREATE), falls nicht vorhanden; Fehler „existiert bereits“ ignorieren.
|
||||||
|
- **moveToFolder(messageId, folderName)** – Nachricht aus INBOX in den Ordner verschieben (MOVE oder COPY + DELETE aus INBOX).
|
||||||
|
- Optional: **markAsRead(messageId)** – falls „archive_read“ = verschieben + als gelesen markieren.
|
||||||
|
|
||||||
|
### 3.3 Sortier-Route erweitern
|
||||||
|
|
||||||
|
- **Datei:** `server/routes/email.mjs`
|
||||||
|
- **Stelle:** Dort, wo `account.provider === 'gmail'` und `=== 'outlook'` abgefragt werden (und Demo).
|
||||||
|
- **Aktion:** Neuen Block `else if (account.provider === 'imap')` hinzufügen:
|
||||||
|
1. `ImapService` aus Account-Daten instanziieren (host, port, secure, user = email, password = accessToken).
|
||||||
|
2. `connect()`.
|
||||||
|
3. In einer Schleife (analog Gmail/Outlook):
|
||||||
|
- `listEmails(batchSize, nextSeq)` → Liste von Nachrichten.
|
||||||
|
- `batchGetEmails(ids)` → From, Subject, Snippet.
|
||||||
|
- Für jede E-Mail: KI-Kategorie ermitteln (bestehender `AISorterService`), dann `ensureFolder(categoryToFolder[category])` und `moveToFolder(id, folderName)`.
|
||||||
|
- Bei „archive_read“ ggf. zusätzlich als gelesen markieren.
|
||||||
|
4. Statistiken aktualisieren (wie bei Gmail/Outlook).
|
||||||
|
5. `close()` aufrufen.
|
||||||
|
- **Fehlerbehandlung:** Bei IMAP-Fehlern (z. B. „Invalid credentials“) sinnvolle Meldung zurückgeben und ggf. Account als „reconnect nötig“ markieren.
|
||||||
|
|
||||||
|
### 3.4 Akzeptanz Phase 3
|
||||||
|
|
||||||
|
- Ein IMAP-Account ist verbunden. Aufruf von `POST /api/email/sort` mit `userId` und `accountId`. Erwartung: E-Mails aus INBOX werden kategorisiert und in die richtigen Ordner verschoben; Response enthält z. B. `sortedCount` und Kategorie-Statistiken. In Nextcloud Mail (oder anderem IMAP-Client) erscheinen die neuen Ordner und verschobenen Mails.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4: Frontend – IMAP verbinden
|
||||||
|
|
||||||
|
**Ziel:** Nutzer können im UI „Anderes Postfach (IMAP)“ wählen und E-Mail + Passwort eingeben.
|
||||||
|
|
||||||
|
### 4.1 Verbindungs-Flow
|
||||||
|
|
||||||
|
- **Datei(en):** Dort, wo heute Gmail/Outlook/Demo angeboten werden (z. B. Setup, Settings, „E-Mail verbinden“).
|
||||||
|
- **Aktion:**
|
||||||
|
- Neue Option „IMAP / anderes Postfach“ (oder „Porkbun / eigenes Postfach“).
|
||||||
|
- Beim Klick: Formular anzeigen mit:
|
||||||
|
- E-Mail (Pflicht)
|
||||||
|
- Passwort / App-Passwort (Pflicht, Typ Passwort)
|
||||||
|
- Optional (z. B. für Power-User): Host, Port, SSL (Checkbox); Defaults: imap.porkbun.com, 993, SSL an.
|
||||||
|
- Submit: POST an Backend (z. B. `/api/email/connect`) mit `provider: 'imap'`, `email`, `password`, optional `imapHost`, `imapPort`, `imapSecure`.
|
||||||
|
- Bei Erfolg: Erfolgsmeldung, Account-Liste aktualisieren. Bei Fehler: Meldung anzeigen (z. B. „Anmeldung fehlgeschlagen – prüfe E-Mail und Passwort“).
|
||||||
|
|
||||||
|
### 4.2 API-Client (Frontend)
|
||||||
|
|
||||||
|
- **Datei:** z. B. `client/src/lib/api.ts`
|
||||||
|
- **Aktion:** Methode `connectImapAccount(userId, { email, password, imapHost?, imapPort?, imapSecure? })` hinzufügen, die `POST /api/email/connect` mit diesen Daten aufruft.
|
||||||
|
|
||||||
|
### 4.3 Akzeptanz Phase 4
|
||||||
|
|
||||||
|
- Im UI „IMAP verbinden“ auswählen, E-Mail + Passwort eingeben, absenden. Account erscheint in der Account-Liste. Danach „Sortieren“ auslösbar und funktioniert wie in Phase 3.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 5: Testen und Doku
|
||||||
|
|
||||||
|
- **Manuell:** Mit einem echten Porkbun-Account (oder anderem IMAP) verbinden, Sortierung ausführen, in Nextcloud prüfen, ob Ordner und Mails stimmen.
|
||||||
|
- **Sicherheit:** Prüfen, dass Passwörter nirgends geloggt werden und nicht im Frontend gespeichert werden.
|
||||||
|
- **Doku:** `docs/setup/IMAP_NEXTCLOUD_PORKBUN.md` ggf. um „Konfiguration Porkbun“ und „Troubleshooting“ ergänzen (z. B. App-Passwort, 2FA).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Kurz-Checkliste
|
||||||
|
|
||||||
|
- [x] Phase 1: `imapflow` installiert, `server/services/imap.mjs` mit connect, listEmails, getEmail, close; Test mit .env-Credentials.
|
||||||
|
- [x] Phase 2: Appwrite `email_accounts` ggf. um IMAP-Felder erweitert; Connect-Route akzeptiert `imap` und speichert Zugangsdaten; Test: Account per API anlegen.
|
||||||
|
- [x] Phase 3: Ordner-Mapping; ImapService: ensureFolder, moveToFolder; Sortier-Route: Block für `provider === 'imap'`; Test: Sortierung für IMAP-Account.
|
||||||
|
- [x] Phase 4: Frontend-Option „IMAP“, Formular E-Mail/Passwort, API-Anbindung; Test: End-to-End Verbindung + Sortierung aus UI.
|
||||||
|
- [ ] Phase 5: Manueller Test mit Porkbun/Nextcloud; Sicherheits-Check; Doku aktualisiert.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dateien-Übersicht
|
||||||
|
|
||||||
|
| Aktion | Datei |
|
||||||
|
|--------|--------|
|
||||||
|
| Neu | `server/services/imap.mjs` |
|
||||||
|
| Neu (optional) | `server/scripts/test-imap.mjs` |
|
||||||
|
| Ändern | `server/package.json` (imapflow) |
|
||||||
|
| Ändern | `server/bootstrap-v2.mjs` (optional: IMAP-Attribute) |
|
||||||
|
| Ändern | `server/routes/email.mjs` (provider imap, connect + sort) |
|
||||||
|
| Ändern | `server/middleware/validate.mjs` (falls nötig) |
|
||||||
|
| Ändern | Frontend: Connect-UI (Setup/Settings) + `client/src/lib/api.ts` |
|
||||||
|
| Ändern | `docs/setup/IMAP_NEXTCLOUD_PORKBUN.md` (Feinschliff) |
|
||||||
|
|
||||||
|
Wenn du mit Phase 1 startest, reicht zunächst: `imapflow` einbinden und `imap.mjs` mit connect + listEmails + getEmail implementieren und lokal mit Porkbun testen.
|
||||||
189
docs/setup/IMAP_NEXTCLOUD_PORKBUN.md
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
# IMAP / Nextcloud / Porkbun – Integration
|
||||||
|
|
||||||
|
## Ziel
|
||||||
|
|
||||||
|
EmailSorter soll E-Mails nutzen, die über **Porkbun** (SMTP/IMAP) laufen und ggf. in **Nextcloud Mail** genutzt werden.
|
||||||
|
|
||||||
|
**Porkbun (von dir genutzt):**
|
||||||
|
|
||||||
|
| Dienst | Host | Port | Verschlüsselung |
|
||||||
|
|--------|------|------|-----------------|
|
||||||
|
| IMAP | imap.porkbun.com | 993 | SSL (SSL/TLS) |
|
||||||
|
| SMTP | smtp.porkbun.com | 587 | STARTTLS |
|
||||||
|
| SMTP (Alt.) | smtp.porkbun.com | 50587 | STARTTLS |
|
||||||
|
| SMTP | smtp.porkbun.com | 465 | Implicit TLS |
|
||||||
|
| POP | pop.porkbun.com | 995 | SSL (SSL/TLS) |
|
||||||
|
|
||||||
|
Für **Sortieren/Lesen** reicht **IMAP** (993, SSL). SMTP wird nur zum Senden gebraucht; EmailSorter sortiert nur, also: IMAP-Anbindung ist der relevante Teil.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Aktueller Stand in EmailSorter
|
||||||
|
|
||||||
|
- **Unterstützt:** **Gmail** (OAuth), **Outlook** (OAuth), **IMAP** (E-Mail + Passwort/App-Passwort), **Demo** (Fake-Daten).
|
||||||
|
- **IMAP:** Generischer IMAP-Provider ist implementiert; Standard ist Porkbun (`imap.porkbun.com`, 993, SSL), andere IMAP-Server über „Advanced“ (Host/Port/SSL) konfigurierbar.
|
||||||
|
|
||||||
|
Ablauf:
|
||||||
|
|
||||||
|
- **Gmail:** `GmailService(accessToken, refreshToken)` → Gmail API (messages.list, get, labels).
|
||||||
|
- **Outlook:** `OutlookService(accessToken)` → Microsoft Graph (Mail API).
|
||||||
|
- **IMAP:** `ImapService(host, port, secure, user, password)` → IMAP (INBOX lesen, Ordner anlegen, Mails verschieben).
|
||||||
|
- **Demo:** feste Test-E-Mails, kein echter Zugriff.
|
||||||
|
|
||||||
|
Accounts werden in `email_accounts` mit `provider`, `email`, `accessToken` (bei IMAP = Passwort), optional `imapHost`, `imapPort`, `imapSecure` gespeichert.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Was „Nextcloud integrieren“ bedeuten kann
|
||||||
|
|
||||||
|
1. **Nextcloud nur als Mail-Client**
|
||||||
|
- Nextcloud Mail nutzt im Hintergrund IMAP/SMTP (z. B. Porkbun).
|
||||||
|
- EmailSorter spricht **direkt mit dem gleichen IMAP-Server** (Porkbun), nicht mit Nextcloud.
|
||||||
|
- Nutzer verbindet in EmailSorter sein **Porkbun-Postfach** (IMAP: imap.porkbun.com, 993, E-Mail + App-Passwort).
|
||||||
|
- Dann: E-Mails, die in Nextcloud sichtbar sind, sind auch für EmailSorter über IMAP erreichbar – und umgekehrt (Sortierung über EmailSorter wirkt in Nextcloud, weil dasselbe Postfach).
|
||||||
|
|
||||||
|
2. **Nextcloud als Identity/SSO**
|
||||||
|
- Würde bedeuten: Login bei EmailSorter über Nextcloud (OIDC/SAML). Das ist ein separates Thema (Auth), nicht die E-Mail-Sortierung.
|
||||||
|
|
||||||
|
3. **Nextcloud Mail API**
|
||||||
|
- Theoretisch könnte man die Nextcloud Mail-API ansprechen; typischerweise nutzt man aber direkt IMAP, weil es einfacher und überall gleich ist.
|
||||||
|
|
||||||
|
**Pragmatisch:** „In Nextcloud integrieren“ heißt hier: **IMAP-Provider in EmailSorter** so einbauen, dass du **Porkbun (IMAP)** verbinden kannst. Alles, was in Nextcloud über dieses Postfach läuft, wird damit automatisch mit EmailSorter synchron sein.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Technisch: Was für IMAP (Porkbun) nötig ist
|
||||||
|
|
||||||
|
### 1. Neuer Provider `imap`
|
||||||
|
|
||||||
|
- In **Backend** (`server/routes/email.mjs`): `provider` um `'imap'` erweitern (z. B. neben `gmail`, `outlook`, `demo`).
|
||||||
|
- Beim **Verbinden** eines Accounts: für IMAP keine OAuth-Tokens, sondern z. B.:
|
||||||
|
- `imapHost` (z. B. `imap.porkbun.com`)
|
||||||
|
- `imapPort` (993)
|
||||||
|
- `imapSecure` (true für SSL)
|
||||||
|
- `email` (Login = E-Mail-Adresse)
|
||||||
|
- Passwort/App-Passwort (sicher speichern, z. B. in einem bestehenden Token-Feld oder neuem verschlüsselten Feld)
|
||||||
|
|
||||||
|
### 2. Datenbank (Appwrite) `email_accounts`
|
||||||
|
|
||||||
|
- Optional neue Attribute, z. B.:
|
||||||
|
- `imapHost` (string)
|
||||||
|
- `imapPort` (integer)
|
||||||
|
- `imapSecure` (boolean)
|
||||||
|
- Oder: für **nur Porkbun** Host/Port fest im Code (imap.porkbun.com, 993) und nur E-Mail + Passwort in DB speichern (z. B. in `accessToken` als Passwort, oder eigenes Feld).
|
||||||
|
|
||||||
|
### 3. Neuer Service `server/services/imap.mjs`
|
||||||
|
|
||||||
|
- **IMAP-Client** in Node (z. B. `imapflow` – gut für Node, SSL, modern).
|
||||||
|
- Interface analog zu Gmail/Outlook:
|
||||||
|
- **listEmails(maxResults, pageToken)** → Liste von Nachrichten aus INBOX (UIDs/Seq + ggf. Envelope).
|
||||||
|
- **getEmail(messageId)** / **batchGetEmails(ids)** → From, Subject, Snippet (Body-Preview).
|
||||||
|
- **applySorting(messageId, category)** → bei IMAP: **Ordner** statt Labels (z. B. „Archive“, „Promotions“). D. h.:
|
||||||
|
- Ordner anlegen, falls nicht vorhanden (CREATE wenn nötig).
|
||||||
|
- Nachricht in den passenden Ordner **verschieben** (MOVE oder COPY + DELETE aus INBOX).
|
||||||
|
- Gmail nutzt Labels; IMAP nutzt **Folders**. Die Logik „Kategorie X“ muss also auf „Folder X“ gemappt werden (z. B. `Archive`, `Promotions`, `Newsletter`).
|
||||||
|
|
||||||
|
### 4. Sortier-Route `POST /api/email/sort`
|
||||||
|
|
||||||
|
- Wenn `account.provider === 'imap'`:
|
||||||
|
- `ImapService` mit gespeicherten IMAP-Daten instanziieren.
|
||||||
|
- Wie bei Gmail/Outlook: E-Mails holen → KI kategorisieren → Aktionen anwenden. Bei IMAP: Aktion = „in Ordner X verschieben“ statt „Label setzen“.
|
||||||
|
|
||||||
|
### 5. Frontend (Client)
|
||||||
|
|
||||||
|
- Neue Option „E-Mail mit IMAP verbinden“ (z. B. „Anderes Postfach (IMAP)“).
|
||||||
|
- Formular: E-Mail, App-Passwort; optional Host/Port (oder vorkonfiguriert für Porkbun).
|
||||||
|
- Kein OAuth-Flow; nach Submit werden Zugangsdaten an das Backend geschickt, Backend speichert sie und testet die Verbindung (z. B. einmaliger LOGIN + SELECT INBOX + DISCONNECT).
|
||||||
|
|
||||||
|
### 6. Sicherheit
|
||||||
|
|
||||||
|
- Passwort/App-Passwort **niemals** im Frontend speichern; nur beim Verbinden einmal an Backend senden.
|
||||||
|
- Im Backend: verschlüsselt oder in sicherem Secret-Storage ablegen (z. B. nur in DB, Zugriff nur server-seitig).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Konfiguration in EmailSorter
|
||||||
|
|
||||||
|
1. **Einstellungen → Accounts** (oder Setup-Seite: Link „Add your account in Settings → Accounts“).
|
||||||
|
2. Auf **„IMAP / Other“** klicken – es öffnet sich ein Formular.
|
||||||
|
3. **E-Mail** und **Passwort** (bzw. App-Passwort bei 2FA) eintragen.
|
||||||
|
4. Optional **„Advanced (host, port, SSL)“** aufklappen:
|
||||||
|
- **IMAP host:** Standard `imap.porkbun.com` (für andere Anbieter z. B. `imap.gmail.com` oder Nextcloud-IMAP-Host).
|
||||||
|
- **Port:** Standard **993** (SSL).
|
||||||
|
- **Use SSL:** aktiviert lassen für 993.
|
||||||
|
5. **„Connect IMAP“** klicken. Das Backend testet die Verbindung; bei Erfolg erscheint das Konto in der Account-Liste. Danach kann **„Sortieren“** wie bei Gmail/Outlook genutzt werden (E-Mails werden in IMAP-Ordner verschoben).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## So richtest du es in Nextcloud ein
|
||||||
|
|
||||||
|
EmailSorter wird **nicht in Nextcloud installiert**. Beide nutzen **dasselbe Postfach per IMAP**: Nextcloud Mail als Client zum Lesen/Schreiben, EmailSorter zum automatischen Sortieren. Ordner und verschobene Mails sind in beiden sichtbar.
|
||||||
|
|
||||||
|
### 1. In Nextcloud Mail: Postfach hinzufügen (falls noch nicht vorhanden)
|
||||||
|
|
||||||
|
1. In Nextcloud einloggen → **Mail**-App öffnen.
|
||||||
|
2. **Konto hinzufügen** (oder **Einstellungen** des Mail-Kontos).
|
||||||
|
3. **E-Mail-Adresse** und **Passwort** (bzw. **App-Passwort** bei 2FA) eintragen.
|
||||||
|
4. **IMAP-Server** manuell einstellen (nicht „Auto“), damit dieselben Werte wie in EmailSorter genutzt werden:
|
||||||
|
- **IMAP:**
|
||||||
|
- Server: `imap.porkbun.com` (bzw. dein IMAP-Host)
|
||||||
|
- Port: **993**
|
||||||
|
- Verschlüsselung: **SSL/TLS**
|
||||||
|
- **SMTP** (zum Senden):
|
||||||
|
- Server: `smtp.porkbun.com`
|
||||||
|
- Port: **587** (STARTTLS) oder **465** (SSL)
|
||||||
|
- Nutzer/Passwort wie IMAP
|
||||||
|
5. Speichern. Das Postfach erscheint in Nextcloud Mail; du liest und schreibst wie gewohnt.
|
||||||
|
|
||||||
|
### 2. In EmailSorter: dasselbe Postfach verbinden
|
||||||
|
|
||||||
|
1. Bei **EmailSorter** einloggen (z. B. emailsorter.webklar.com).
|
||||||
|
2. **Einstellungen → Accounts** → **„IMAP / Other“** klicken.
|
||||||
|
3. **Gleiche E-Mail-Adresse** und **gleiches Passwort** (bzw. App-Passwort) wie in Nextcloud eintragen.
|
||||||
|
4. Bei Porkbun reicht der Standard (**Advanced** geschlossen). Anderer Anbieter: **Advanced** öffnen und **IMAP-Host** (z. B. `imap.porkbun.com`), **Port 993**, **Use SSL** an setzen.
|
||||||
|
5. **„Connect IMAP“** klicken. Wenn die Verbindung klappt, erscheint das Konto unter „Connected Email Accounts“.
|
||||||
|
|
||||||
|
### 3. Nutzung
|
||||||
|
|
||||||
|
- **Nextcloud Mail:** E-Mails lesen, schreiben, Ordner manuell nutzen – wie bisher.
|
||||||
|
- **EmailSorter:** Im Dashboard **„Sortieren“** ausführen. EmailSorter liest die INBOX, kategorisiert per KI und **verschiebt** Mails in Ordner (z. B. Archive, Promotions, Newsletter).
|
||||||
|
- **In Nextcloud:** Diese Ordner und die verschobenen Mails erscheinen automatisch, weil dasselbe IMAP-Postfach genutzt wird. Gegebenenfalls Mail-App aktualisieren oder kurz warten, bis die Ordnerliste neu geladen ist.
|
||||||
|
|
||||||
|
Es ist **keine Installation oder App in Nextcloud** nötig – nur dasselbe Konto in Nextcloud Mail (IMAP) und in EmailSorter (IMAP) einrichten.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Porkbun-spezifisch (kurz)
|
||||||
|
|
||||||
|
- **IMAP:** `imap.porkbun.com`, Port **993**, SSL.
|
||||||
|
- **Login:** volle E-Mail-Adresse + Passwort oder **App-Passwort** (wenn 2FA aktiv).
|
||||||
|
- In EmailSorter: Provider **IMAP** mit Standard Host/Port für Porkbun; andere IMAP-Server über „Advanced“ einstellbar.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
- **„Login failed – check email and password“**
|
||||||
|
- E-Mail-Adresse exakt wie beim Anbieter (Groß-/Kleinschreibung bei manchen Servern relevant).
|
||||||
|
- Bei **2FA (Porkbun/Provider):** normales Passwort reicht oft nicht – **App-Passwort** in den Account-Einstellungen des Anbieters erzeugen und dieses im EmailSorter-Formular eintragen.
|
||||||
|
|
||||||
|
- **Verbindung baut nicht auf (Timeout / SSL-Fehler)**
|
||||||
|
- Port **993** und **Use SSL** aktiviert für TLS.
|
||||||
|
- Firewall/Netzwerk: ausgehende Verbindung zu `imap.porkbun.com:993` erlauben.
|
||||||
|
- Bei eigenem IMAP-Server: Host/Port in „Advanced“ prüfen (z. B. 143 nur mit STARTTLS, nicht „Use SSL“ im gleichen Sinne – bei Zweifel 993 + SSL verwenden).
|
||||||
|
|
||||||
|
- **Sortierung läuft, Ordner erscheinen in Nextcloud nicht**
|
||||||
|
- Nextcloud Mail nutzt dasselbe IMAP-Postfach; Ordner sollten nach kurzer Zeit sichtbar sein. Mail-App ggf. aktualisieren oder Abo des Postfachs prüfen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Reihenfolge der Umsetzung (Vorschlag)
|
||||||
|
|
||||||
|
1. **IMAP-Bibliothek** im Backend (z. B. `imapflow`) einbinden.
|
||||||
|
2. **`server/services/imap.mjs`** implementieren: connect, listEmails, getEmail, moveToFolder, createFolder.
|
||||||
|
3. **DB/Bootstrap:** `email_accounts` um IMAP-Felder erweitern (oder Nutzung bestehender Felder definieren).
|
||||||
|
4. **Route `/connect`:** für `provider: 'imap'` Host/Port/User/Passwort entgegennehmen und Account anlegen.
|
||||||
|
5. **Route `/sort`:** für `provider === 'imap'` die gleiche Sortier-Pipeline wie bei Gmail/Outlook, aber mit `ImapService` und Ordner-Verschiebung statt Labels.
|
||||||
|
6. **Frontend:** Verbindungs-UI für IMAP (E-Mail + Passwort, ggf. Host/Port).
|
||||||
|
|
||||||
|
Wenn du willst, kann als Nächstes ein konkreter Implementierungsplan (mit Dateinamen und API-Skizzen) oder ein kleines Proof-of-Concept nur für „Connect + Liste INBOX“ für Porkbun-IMAP ausgearbeitet werden.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# EmailSorter - Einrichtungsanleitung
|
# MailFlow - Einrichtungsanleitung
|
||||||
|
|
||||||
Diese Anleitung führt dich durch die komplette Einrichtung von EmailSorter.
|
Diese Anleitung führt dich durch die komplette Einrichtung von MailFlow.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -31,13 +31,13 @@ Diese Anleitung führt dich durch die komplette Einrichtung von EmailSorter.
|
|||||||
|
|
||||||
1. Gehe zu [cloud.appwrite.io](https://cloud.appwrite.io)
|
1. Gehe zu [cloud.appwrite.io](https://cloud.appwrite.io)
|
||||||
2. Erstelle einen kostenlosen Account
|
2. Erstelle einen kostenlosen Account
|
||||||
3. Erstelle ein neues Projekt (z.B. "EmailSorter")
|
3. Erstelle ein neues Projekt (z.B. "MailFlow")
|
||||||
|
|
||||||
### 1.2 API Key erstellen
|
### 1.2 API Key erstellen
|
||||||
|
|
||||||
1. Gehe zu **Settings** → **API Credentials**
|
1. Gehe zu **Settings** → **API Credentials**
|
||||||
2. Klicke auf **Create API Key**
|
2. Klicke auf **Create API Key**
|
||||||
3. Name: `EmailSorter Backend`
|
3. Name: `MailFlow Backend`
|
||||||
4. Wähle **alle Berechtigungen** aus (Full Access)
|
4. Wähle **alle Berechtigungen** aus (Full Access)
|
||||||
5. Kopiere den API Key
|
5. Kopiere den API Key
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Diese Anleitung führt dich durch die komplette Einrichtung von EmailSorter.
|
|||||||
|
|
||||||
1. Gehe zu **Databases**
|
1. Gehe zu **Databases**
|
||||||
2. Klicke auf **Create Database**
|
2. Klicke auf **Create Database**
|
||||||
3. Name: `email_sorter_db`
|
3. Name: `mailflow_db`
|
||||||
4. Kopiere die **Database ID**
|
4. Kopiere die **Database ID**
|
||||||
|
|
||||||
### 1.4 Bootstrap ausführen
|
### 1.4 Bootstrap ausführen
|
||||||
@@ -73,7 +73,7 @@ Dies erstellt automatisch alle benötigten Collections:
|
|||||||
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
||||||
APPWRITE_PROJECT_ID=deine_projekt_id
|
APPWRITE_PROJECT_ID=deine_projekt_id
|
||||||
APPWRITE_API_KEY=dein_api_key
|
APPWRITE_API_KEY=dein_api_key
|
||||||
APPWRITE_DATABASE_ID=email_sorter_db
|
APPWRITE_DATABASE_ID=mailflow_db
|
||||||
```
|
```
|
||||||
|
|
||||||
```env
|
```env
|
||||||
@@ -102,17 +102,17 @@ VITE_APPWRITE_PROJECT_ID=deine_projekt_id
|
|||||||
Gehe zu **Products** → **Add product**:
|
Gehe zu **Products** → **Add product**:
|
||||||
|
|
||||||
#### Basic Plan
|
#### Basic Plan
|
||||||
- Name: `EmailSorter Basic`
|
- Name: `MailFlow Basic`
|
||||||
- Preis: `9.00 EUR` / Monat
|
- Preis: `9.00 EUR` / Monat
|
||||||
- Kopiere die **Price ID** (beginnt mit `price_`)
|
- Kopiere die **Price ID** (beginnt mit `price_`)
|
||||||
|
|
||||||
#### Pro Plan
|
#### Pro Plan
|
||||||
- Name: `EmailSorter Pro`
|
- Name: `MailFlow Pro`
|
||||||
- Preis: `19.00 EUR` / Monat
|
- Preis: `19.00 EUR` / Monat
|
||||||
- Kopiere die **Price ID**
|
- Kopiere die **Price ID**
|
||||||
|
|
||||||
#### Business Plan
|
#### Business Plan
|
||||||
- Name: `EmailSorter Business`
|
- Name: `MailFlow Business`
|
||||||
- Preis: `49.00 EUR` / Monat
|
- Preis: `49.00 EUR` / Monat
|
||||||
- Kopiere die **Price ID**
|
- Kopiere die **Price ID**
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ STRIPE_PRICE_BUSINESS=price_...
|
|||||||
1. Gehe zu **APIs & Services** → **OAuth consent screen**
|
1. Gehe zu **APIs & Services** → **OAuth consent screen**
|
||||||
2. Wähle **External**
|
2. Wähle **External**
|
||||||
3. Fülle aus:
|
3. Fülle aus:
|
||||||
- App name: `EmailSorter`
|
- App name: `MailFlow`
|
||||||
- User support email: Deine E-Mail
|
- User support email: Deine E-Mail
|
||||||
- Developer contact: Deine E-Mail
|
- Developer contact: Deine E-Mail
|
||||||
4. **Scopes** hinzufügen:
|
4. **Scopes** hinzufügen:
|
||||||
@@ -189,7 +189,7 @@ STRIPE_PRICE_BUSINESS=price_...
|
|||||||
1. Gehe zu **APIs & Services** → **Credentials**
|
1. Gehe zu **APIs & Services** → **Credentials**
|
||||||
2. Klicke auf **Create Credentials** → **OAuth client ID**
|
2. Klicke auf **Create Credentials** → **OAuth client ID**
|
||||||
3. Typ: **Web application**
|
3. Typ: **Web application**
|
||||||
4. Name: `EmailSorter Web`
|
4. Name: `MailFlow Web`
|
||||||
5. **Authorized redirect URIs**:
|
5. **Authorized redirect URIs**:
|
||||||
- `http://localhost:3000/api/oauth/gmail/callback` (Entwicklung)
|
- `http://localhost:3000/api/oauth/gmail/callback` (Entwicklung)
|
||||||
- `https://deine-domain.de/api/oauth/gmail/callback` (Produktion)
|
- `https://deine-domain.de/api/oauth/gmail/callback` (Produktion)
|
||||||
|
|||||||
24
engineering-card/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
16
engineering-card/README.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# React + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
||||||
|
## React Compiler
|
||||||
|
|
||||||
|
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||||
|
|
||||||
|
## Expanding the ESLint configuration
|
||||||
|
|
||||||
|
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
|
||||||
29
engineering-card/eslint.config.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{js,jsx}'],
|
||||||
|
extends: [
|
||||||
|
js.configs.recommended,
|
||||||
|
reactHooks.configs.flat.recommended,
|
||||||
|
reactRefresh.configs.vite,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
ecmaFeatures: { jsx: true },
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
23
engineering-card/index.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
var stored = localStorage.getItem("theme");
|
||||||
|
var dark = stored === "dark" || (stored !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
||||||
|
if (dark) document.documentElement.classList.add("dark");
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Engineering Impact Card</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3543
engineering-card/package-lock.json
generated
Normal file
30
engineering-card/package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "engineering-card",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"lucide-react": "^0.563.0",
|
||||||
|
"react": "^19.2.0",
|
||||||
|
"react-dom": "^19.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.39.1",
|
||||||
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
|
"@types/react": "^19.2.5",
|
||||||
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"@vitejs/plugin-react": "^5.1.1",
|
||||||
|
"eslint": "^9.39.1",
|
||||||
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.24",
|
||||||
|
"globals": "^16.5.0",
|
||||||
|
"tailwindcss": "^4.1.18",
|
||||||
|
"vite": "^7.2.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
engineering-card/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
1
engineering-card/src/App.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* App-specific overrides if needed; layout in App.jsx uses Tailwind */
|
||||||
41
engineering-card/src/App.jsx
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { useState, useEffect } from "react";
|
||||||
|
import { Moon, Sun } from "lucide-react";
|
||||||
|
import { EngineeringImpactCard } from "./components/EngineeringImpactCard";
|
||||||
|
import "./App.css";
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const [dark, setDark] = useState(() => {
|
||||||
|
const stored = localStorage.getItem("theme");
|
||||||
|
if (stored === "dark" || stored === "light") return stored === "dark";
|
||||||
|
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const root = document.documentElement;
|
||||||
|
if (dark) {
|
||||||
|
root.classList.add("dark");
|
||||||
|
localStorage.setItem("theme", "dark");
|
||||||
|
} else {
|
||||||
|
root.classList.remove("dark");
|
||||||
|
localStorage.setItem("theme", "light");
|
||||||
|
}
|
||||||
|
}, [dark]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="min-h-screen bg-background p-6 md:p-8 flex flex-col items-center justify-center relative">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setDark((d) => !d)}
|
||||||
|
className="fixed top-4 right-4 z-50 p-2.5 rounded-xl border border-border bg-card/80 backdrop-blur-sm text-foreground hover:bg-primary/10 hover:border-primary/30 hover:text-primary transition-all duration-300 shadow-lg"
|
||||||
|
aria-label={dark ? "Hellmodus aktivieren" : "Dark Mode aktivieren"}
|
||||||
|
>
|
||||||
|
{dark ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
|
||||||
|
</button>
|
||||||
|
<div className="w-full max-w-5xl">
|
||||||
|
<EngineeringImpactCard />
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
1
engineering-card/src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.0 KiB |
157
engineering-card/src/components/EngineeringImpactCard.jsx
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
import {
|
||||||
|
FolderTree,
|
||||||
|
MousePointerClick,
|
||||||
|
CalendarClock,
|
||||||
|
ScanSearch,
|
||||||
|
ShieldCheck,
|
||||||
|
Sparkles,
|
||||||
|
} from "lucide-react";
|
||||||
|
|
||||||
|
const FEATURES = [
|
||||||
|
{
|
||||||
|
icon: FolderTree,
|
||||||
|
title: "Categories, not chaos",
|
||||||
|
desc: "Leads, clients, invoices, newsletters — sorted into folders. Your inbox shows what pays first.",
|
||||||
|
glowClass: "from-orange-500/20 to-amber-500/20",
|
||||||
|
delay: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: MousePointerClick,
|
||||||
|
title: "One click to sort",
|
||||||
|
desc: "Connect your inbox, click Sort Now. No rules to write. We read and categorize; you review.",
|
||||||
|
glowClass: "from-emerald-500/20 to-teal-500/20",
|
||||||
|
delay: 50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: CalendarClock,
|
||||||
|
title: "Runs when you want",
|
||||||
|
desc: "Sort on demand or set a schedule. Your inbox stays organized without you touching it.",
|
||||||
|
glowClass: "from-blue-500/20 to-indigo-500/20",
|
||||||
|
delay: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: ScanSearch,
|
||||||
|
title: "Content-aware sorting",
|
||||||
|
desc: "We look at sender, subject, and a short snippet to decide the category. No keyword lists.",
|
||||||
|
glowClass: "from-violet-500/20 to-purple-500/20",
|
||||||
|
delay: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: ShieldCheck,
|
||||||
|
title: "Minimal data",
|
||||||
|
desc: "We only read what we need to categorize. No storing email body or attachments. GDPR compliant.",
|
||||||
|
glowClass: "from-green-500/20 to-emerald-500/20",
|
||||||
|
delay: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: Sparkles,
|
||||||
|
title: "Less time on triage",
|
||||||
|
desc: "Spend less time deciding what's important. Inbox shows clients and leads first.",
|
||||||
|
glowClass: "from-cyan-500/20 to-blue-500/20",
|
||||||
|
delay: 250,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function FeatureItem({ icon: Icon, title, desc, glowClass, delay }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="group relative"
|
||||||
|
style={{ animationDelay: `${delay}ms` }}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className={`absolute inset-0 bg-gradient-to-br ${glowClass} rounded-xl opacity-0 group-hover:opacity-100 blur-xl transition-opacity duration-300 -z-10 scale-110`}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="relative p-4 rounded-xl border border-border/50 bg-card/80 backdrop-blur-sm h-full
|
||||||
|
transform-gpu transition-all duration-300 ease-out
|
||||||
|
hover:border-primary/40 hover:shadow-lg hover:shadow-primary/5
|
||||||
|
hover:-translate-y-1 hover:scale-[1.02]
|
||||||
|
group-hover:bg-card/95"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className="absolute inset-0 rounded-xl overflow-hidden opacity-0 group-hover:opacity-100 transition-opacity duration-300"
|
||||||
|
>
|
||||||
|
<div className="absolute inset-0 -translate-x-full group-hover:translate-x-full transition-transform duration-700 ease-out bg-gradient-to-r from-transparent via-white/10 to-transparent" />
|
||||||
|
</div>
|
||||||
|
<div className="relative z-10">
|
||||||
|
<div className="flex items-start gap-3 mb-3">
|
||||||
|
<div
|
||||||
|
className="p-2.5 bg-primary/10 rounded-xl text-primary shrink-0
|
||||||
|
transition-all duration-300 ease-out
|
||||||
|
group-hover:bg-primary group-hover:text-primary-foreground
|
||||||
|
group-hover:scale-110 group-hover:rotate-3 group-hover:shadow-lg group-hover:shadow-primary/25"
|
||||||
|
>
|
||||||
|
<Icon className="h-6 w-6" aria-hidden strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
|
||||||
|
</div>
|
||||||
|
<h4 className="text-base font-semibold text-foreground transition-colors duration-300 group-hover:text-primary pt-0.5">
|
||||||
|
{title}
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<p
|
||||||
|
className="text-sm text-muted-foreground leading-relaxed transition-all duration-300
|
||||||
|
opacity-90 group-hover:opacity-100 group-hover:text-foreground/90"
|
||||||
|
>
|
||||||
|
{desc}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EngineeringImpactCard() {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="card"
|
||||||
|
className="bg-card/80 text-card-foreground flex flex-col gap-6 rounded-2xl border backdrop-blur-md shadow-lg shadow-black/5 dark:bg-card/60 dark:shadow-black/20 transform-gpu relative transition-all duration-300 ease-out hover:shadow-2xl hover:shadow-primary/10 hover:border-primary/30 dark:hover:shadow-primary/20 before:absolute before:inset-0 before:rounded-2xl before:p-[1.5px] before:bg-gradient-to-br before:from-primary/50 before:via-accent/30 before:to-primary/50 before:-z-10 before:opacity-0 before:transition-opacity before:duration-500 hover:before:opacity-100 after:absolute after:inset-0 after:rounded-2xl after:-z-20 after:bg-gradient-to-br after:from-primary/5 after:via-transparent after:to-accent/5 after:opacity-0 after:transition-opacity after:duration-500 hover:after:opacity-100 p-6 md:p-8 overflow-hidden"
|
||||||
|
>
|
||||||
|
<div className="mb-8 text-center">
|
||||||
|
<h3 className="text-2xl font-bold mb-2">What it does</h3>
|
||||||
|
<p className="text-muted-foreground max-w-xl mx-auto">
|
||||||
|
Sort incoming mail into categories so your inbox shows what matters first. No rules to write.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
|
{FEATURES.map((feature, i) => (
|
||||||
|
<FeatureItem key={i} {...feature} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="mt-8 p-5 bg-gradient-to-r from-primary/10 via-accent/10 to-secondary/10 rounded-xl border border-primary/20
|
||||||
|
relative overflow-hidden group/featured transition-all duration-300 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
className="absolute inset-0 rounded-xl opacity-0 group-hover/featured:opacity-100 transition-opacity duration-500"
|
||||||
|
>
|
||||||
|
<div className="absolute inset-[-1px] rounded-xl bg-gradient-to-r from-primary via-accent to-primary bg-[length:200%_100%] animate-gradient-x opacity-30" />
|
||||||
|
</div>
|
||||||
|
<div className="relative flex flex-col md:flex-row items-stretch md:items-center gap-6 md:gap-8">
|
||||||
|
<div className="flex-1 flex flex-col md:flex-row items-center gap-4 md:gap-6 p-4 rounded-xl bg-background/50 border border-border/50">
|
||||||
|
<span className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">Before</span>
|
||||||
|
<div className="text-center md:text-left">
|
||||||
|
<p className="font-bold text-foreground text-lg">Inbox chaos</p>
|
||||||
|
<p className="text-3xl md:text-4xl font-bold text-primary mt-1">847</p>
|
||||||
|
<p className="text-sm text-muted-foreground">unread emails</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-center shrink-0 text-muted-foreground group-hover/featured:text-primary transition-colors duration-300">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 flex flex-col md:flex-row items-center gap-4 md:gap-6 p-4 rounded-xl bg-primary/10 border border-primary/20">
|
||||||
|
<span className="text-xs font-semibold uppercase tracking-wider text-primary">After</span>
|
||||||
|
<div className="text-center md:text-left">
|
||||||
|
<p className="font-bold text-foreground text-lg">All sorted</p>
|
||||||
|
<p className="text-3xl md:text-4xl font-bold text-primary mt-1">12</p>
|
||||||
|
<p className="text-sm text-muted-foreground">important emails</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
78
engineering-card/src/index.css
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
|
/* Theme – semantic tokens (light) */
|
||||||
|
@theme {
|
||||||
|
--color-background: oklch(0.98 0.008 65);
|
||||||
|
--color-foreground: oklch(0.20 0.03 40);
|
||||||
|
--color-primary: oklch(0.55 0.18 40);
|
||||||
|
--color-primary-foreground: oklch(0.98 0.01 60);
|
||||||
|
--color-secondary: oklch(0.94 0.02 70);
|
||||||
|
--color-secondary-foreground: oklch(0.30 0.04 40);
|
||||||
|
--color-muted: oklch(0.95 0.015 65);
|
||||||
|
--color-muted-foreground: oklch(0.40 0.03 45);
|
||||||
|
--color-card: oklch(0.995 0.005 60);
|
||||||
|
--color-card-foreground: var(--color-foreground);
|
||||||
|
--color-border: oklch(0.88 0.02 60);
|
||||||
|
--color-ring: oklch(0.55 0.18 40);
|
||||||
|
--color-accent: oklch(0.45 0.15 15);
|
||||||
|
--color-accent-foreground: oklch(0.98 0.01 60);
|
||||||
|
--radius: 0.625rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--color-background: oklch(0.15 0.02 40);
|
||||||
|
--color-foreground: oklch(0.92 0.02 70);
|
||||||
|
--color-primary: oklch(0.70 0.16 55);
|
||||||
|
--color-primary-foreground: oklch(0.15 0.03 40);
|
||||||
|
--color-secondary: oklch(0.25 0.025 45);
|
||||||
|
--color-secondary-foreground: oklch(0.88 0.02 70);
|
||||||
|
--color-muted: oklch(0.23 0.02 42);
|
||||||
|
--color-muted-foreground: oklch(0.60 0.03 65);
|
||||||
|
--color-card: oklch(0.19 0.025 40);
|
||||||
|
--color-border: oklch(0.30 0.025 42);
|
||||||
|
--color-ring: oklch(0.70 0.16 55);
|
||||||
|
--color-accent: oklch(0.55 0.14 20);
|
||||||
|
--color-accent-foreground: oklch(0.95 0.01 70);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gradient animation for featured strip */
|
||||||
|
@keyframes gradient-x {
|
||||||
|
0%, 100% { background-position: 0% 50%; }
|
||||||
|
50% { background-position: 100% 50%; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-gradient-x {
|
||||||
|
animation: gradient-x 3s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Base */
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||||
|
background-color: var(--color-background);
|
||||||
|
color: var(--color-foreground);
|
||||||
|
line-height: 1.5;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tailwind v4 uses these; ensure border uses theme */
|
||||||
|
[class*="border"] {
|
||||||
|
border-color: var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Optional: font preload in index.html for Inter + Space Grotesk */
|
||||||
|
h1, h2, h3, h4 {
|
||||||
|
font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
10
engineering-card/src/main.jsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { StrictMode } from 'react'
|
||||||
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import './index.css'
|
||||||
|
import App from './App.jsx'
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')).render(
|
||||||
|
<StrictMode>
|
||||||
|
<App />
|
||||||
|
</StrictMode>,
|
||||||
|
)
|
||||||
8
engineering-card/vite.config.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react(), tailwindcss()],
|
||||||
|
})
|
||||||
29
herosection/eslint.config.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{js,jsx}'],
|
||||||
|
extends: [
|
||||||
|
js.configs.recommended,
|
||||||
|
reactHooks.configs.flat.recommended,
|
||||||
|
reactRefresh.configs.vite,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
ecmaFeatures: { jsx: true },
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
21
herosection/index.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="de" style="color-scheme: dark;">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
var stored = localStorage.getItem("theme");
|
||||||
|
var dark = stored === "dark" || (stored !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
||||||
|
if (dark) document.documentElement.classList.add("dark");
|
||||||
|
else document.documentElement.classList.remove("dark");
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Hero Section – Centered Image</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
herosection/logo.png
Normal file
|
After Width: | Height: | Size: 613 KiB |
3543
herosection/package-lock.json
generated
Normal file
30
herosection/package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "herosection",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"lucide-react": "^0.563.0",
|
||||||
|
"react": "^19.2.0",
|
||||||
|
"react-dom": "^19.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.39.1",
|
||||||
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
|
"@types/react": "^19.2.5",
|
||||||
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"@vitejs/plugin-react": "^5.1.1",
|
||||||
|
"eslint": "^9.39.1",
|
||||||
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.24",
|
||||||
|
"globals": "^16.5.0",
|
||||||
|
"tailwindcss": "^4.1.18",
|
||||||
|
"vite": "^7.2.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
herosection/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
48
herosection/src/App.jsx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import { Moon, Sun } from 'lucide-react'
|
||||||
|
import HeroSection from './components/HeroSection.jsx'
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const [dark, setDark] = useState(() => {
|
||||||
|
const stored = localStorage.getItem('theme')
|
||||||
|
if (stored === 'dark' || stored === 'light') return stored === 'dark'
|
||||||
|
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||||
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const root = document.documentElement
|
||||||
|
if (dark) {
|
||||||
|
root.classList.add('dark')
|
||||||
|
localStorage.setItem('theme', 'dark')
|
||||||
|
} else {
|
||||||
|
root.classList.remove('dark')
|
||||||
|
localStorage.setItem('theme', 'light')
|
||||||
|
}
|
||||||
|
}, [dark])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-gray-50 dark:bg-neutral-900">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setDark((d) => !d)}
|
||||||
|
className="fixed top-4 right-4 z-[100] rounded-lg border border-neutral-200 bg-white/90 p-2.5 text-neutral-700 shadow-lg backdrop-blur-sm transition-colors hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-800/90 dark:text-neutral-200 dark:hover:bg-neutral-700"
|
||||||
|
aria-label={dark ? 'Hellmodus' : 'Dark Mode'}
|
||||||
|
>
|
||||||
|
{dark ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
|
||||||
|
</button>
|
||||||
|
<HeroSection />
|
||||||
|
<section className="relative z-40 min-h-[60vh] px-4 py-20 md:px-8 md:py-28">
|
||||||
|
<div className="mx-auto max-w-4xl text-center">
|
||||||
|
<h2 className="text-2xl font-semibold text-neutral-800 dark:text-neutral-100 sm:text-3xl md:text-4xl">
|
||||||
|
What happens next
|
||||||
|
</h2>
|
||||||
|
<p className="mt-4 text-neutral-600 dark:text-neutral-400">
|
||||||
|
Scroll down to explore more. This section makes the page scrollable.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App
|
||||||
80
herosection/src/components/HeroSection.jsx
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import { useState, useRef, useEffect } from 'react'
|
||||||
|
|
||||||
|
const TESTIMONIALS = [
|
||||||
|
{ name: 'Manu Arora', quote: 'Fantastic AI, highly recommend it.', position: 'top-20 -left-10', rotate: '-20deg', side: 'left' },
|
||||||
|
{ name: 'Tyler Durden', quote: 'AI revolutionized my business model.', position: 'top-1/2 -left-10 -translate-y-1/2', rotate: '-10deg', side: 'left' },
|
||||||
|
{ name: 'Alice Johnson', quote: 'Transformed the way I work!', position: 'top-20 -right-10', rotate: '20deg', side: 'right' },
|
||||||
|
{ name: 'Bob Smith', quote: 'Absolutely revolutionary, a game-changer.', position: 'bottom-20 -left-10', rotate: '-10deg', side: 'left' },
|
||||||
|
{ name: 'Cathy Lee', quote: 'Improved my work efficiency and daily life.', position: 'bottom-1/2 -right-10 -translate-y-1/2', rotate: '10deg', side: 'right' },
|
||||||
|
{ name: 'David Wright', quote: "It's like having a superpower!", position: 'bottom-20 -right-10', rotate: '20deg', side: 'right' },
|
||||||
|
]
|
||||||
|
|
||||||
|
// Scroll-Fortschritt 0..1: wie weit die Hero-Section nach oben weggescrollt ist → Karten bewegen sich im Bogen nach unten
|
||||||
|
function useScrollBow(heroRef) {
|
||||||
|
const [progress, setProgress] = useState(0)
|
||||||
|
useEffect(() => {
|
||||||
|
const hero = heroRef?.current
|
||||||
|
if (!hero) return
|
||||||
|
const onScroll = () => {
|
||||||
|
const rect = hero.getBoundingClientRect()
|
||||||
|
const h = rect.height
|
||||||
|
if (h <= 0) return
|
||||||
|
const p = Math.max(0, Math.min(1, -rect.top / h))
|
||||||
|
setProgress(p)
|
||||||
|
}
|
||||||
|
onScroll()
|
||||||
|
window.addEventListener('scroll', onScroll, { passive: true })
|
||||||
|
return () => window.removeEventListener('scroll', onScroll)
|
||||||
|
}, [heroRef])
|
||||||
|
return progress
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMAIL_LOGO = '/logo.png'
|
||||||
|
|
||||||
|
function TestimonialCard({ name, quote, position, rotate, side, scrollProgress }) {
|
||||||
|
const dropY = scrollProgress * 80
|
||||||
|
const flyOutX = scrollProgress * 600
|
||||||
|
const moveX = side === 'left' ? -flyOutX : flyOutX
|
||||||
|
const transform = `translate(${moveX}px, ${dropY}px) rotate(${rotate})`
|
||||||
|
const opacity = Math.max(0, 1 - scrollProgress * 1.2)
|
||||||
|
const visibility = opacity <= 0 ? 'hidden' : 'visible'
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`hero-edge-card absolute z-20 flex items-center gap-2 rounded-md bg-white p-4 shadow-lg dark:bg-neutral-800 ${position} hidden md:flex transition-all duration-200 ease-out`}
|
||||||
|
style={{ transform, opacity, visibility }}
|
||||||
|
>
|
||||||
|
<img alt="E-Mail" width={50} height={50} className="size-12 shrink-0 object-contain" src={EMAIL_LOGO} />
|
||||||
|
<div className="max-w-[180px]">
|
||||||
|
<h3 className="text-xs text-neutral-800 md:text-base dark:text-neutral-200">{name}</h3>
|
||||||
|
<p className="text-[10px] text-neutral-600 md:text-sm dark:text-neutral-400">{quote}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function HeroSection() {
|
||||||
|
const heroRef = useRef(null)
|
||||||
|
const scrollProgress = useScrollBow(heroRef)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={heroRef}
|
||||||
|
className="relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gray-50 px-4 md:px-8 dark:bg-neutral-900 animate-gradient-bg"
|
||||||
|
>
|
||||||
|
{/* Rand: Testimonial-Karten – bewegen sich beim Scrollen in einem Bogen nach unten */}
|
||||||
|
{TESTIMONIALS.map((t) => (
|
||||||
|
<TestimonialCard key={t.name} {...t} scrollProgress={scrollProgress} />
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* Dezentes animiertes Grid im Hintergrund (nur auf md+) */}
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 z-10 hidden md:block opacity-40 animate-grid-pulse bg-[length:24px_24px] bg-[linear-gradient(to_right,#8881_1px,transparent_1px),linear-gradient(to_bottom,#8881_1px,transparent_1px)] dark:bg-[linear-gradient(to_right,#fff1_1px,transparent_1px),linear-gradient(to_bottom,#fff1_1px,transparent_1px)]"
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
{/* Overlay: auf Mobile sichtbar, ab md ausgeblendet */}
|
||||||
|
<div className="absolute inset-0 z-30 h-full w-full bg-white opacity-80 md:opacity-0 dark:bg-neutral-900 pointer-events-none" aria-hidden />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HeroSection
|
||||||
125
herosection/src/index.css
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
|
/* Hero Section – Hintergrund-Animation */
|
||||||
|
@keyframes gradient-shift {
|
||||||
|
0%, 100% { opacity: 1; background-position: 0% 50%; }
|
||||||
|
50% { opacity: 0.95; background-position: 100% 50%; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes grid-pulse {
|
||||||
|
0%, 100% { opacity: 0.4; }
|
||||||
|
50% { opacity: 0.7; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade-in-up {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-gradient-bg {
|
||||||
|
background: linear-gradient(135deg, rgb(250 250 250) 0%, rgb(245 245 245) 50%, rgb(250 250 250) 100%);
|
||||||
|
background-size: 200% 200%;
|
||||||
|
animation: gradient-shift 8s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .animate-gradient-bg {
|
||||||
|
background: linear-gradient(135deg, rgb(23 23 23) 0%, rgb(38 38 38) 50%, rgb(23 23 23) 100%);
|
||||||
|
background-size: 200% 200%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-grid-pulse {
|
||||||
|
animation: grid-pulse 4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-content-in {
|
||||||
|
animation: fade-in-up 0.8s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-content-in:nth-child(9) { animation-delay: 0.1s; opacity: 0; }
|
||||||
|
.hero-content-in:nth-child(10) { animation-delay: 0.3s; opacity: 0; }
|
||||||
|
.hero-content-in:nth-child(11) { animation-delay: 0.5s; opacity: 0; }
|
||||||
|
|
||||||
|
.hero-submit-btn {
|
||||||
|
transition: box-shadow 0.2s ease, transform 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-submit-btn:hover {
|
||||||
|
box-shadow: 0px -1px 0px 0px #FFFFFF50 inset, 0px 1px 0px 0px #FFFFFF50 inset, 0 0 20px rgba(255,255,255,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .hero-submit-btn:hover {
|
||||||
|
box-shadow: 0px -1px 0px 0px #00000030 inset, 0px 1px 0px 0px #00000030 inset, 0 0 20px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-submit-btn:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rand-Elemente: Scroll-Animation (Marquee) */
|
||||||
|
@keyframes marquee-scroll {
|
||||||
|
0% { transform: translateX(0%); }
|
||||||
|
100% { transform: translateX(-100%); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-marquee-track {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
animation: marquee-scroll 25s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-marquee-track:hover {
|
||||||
|
animation-play-state: paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-marquee-container {
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
|
||||||
|
-webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .hero-marquee-container {
|
||||||
|
mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
|
||||||
|
-webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rand: Testimonial-Karten – Einblend-Animation (nur opacity, Rotation bleibt per inline) */
|
||||||
|
@keyframes hero-edge-in {
|
||||||
|
from { opacity: 0; }
|
||||||
|
to { opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-edge-card {
|
||||||
|
animation: hero-edge-in 0.6s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-edge-card:nth-child(1) { animation-delay: 0.2s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(2) { animation-delay: 0.35s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(3) { animation-delay: 0.5s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(4) { animation-delay: 0.4s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(5) { animation-delay: 0.55s; opacity: 0; }
|
||||||
|
.hero-edge-card:nth-child(6) { animation-delay: 0.7s; opacity: 0; }
|
||||||
|
|
||||||
|
@media (max-width: 1023px) {
|
||||||
|
.hero-edge-card { opacity: 0.2 !important; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Base */
|
||||||
|
*, *::before, *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
10
herosection/src/main.jsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { StrictMode } from 'react'
|
||||||
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import './index.css'
|
||||||
|
import App from './App.jsx'
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')).render(
|
||||||
|
<StrictMode>
|
||||||
|
<App />
|
||||||
|
</StrictMode>,
|
||||||
|
)
|
||||||
8
herosection/vite.config.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react(), tailwindcss()],
|
||||||
|
})
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# Marketing & Promotion Strategie für EmailSorter
|
# Marketing & Promotion Strategie für MailFlow
|
||||||
|
|
||||||
## Übersicht
|
## Übersicht
|
||||||
|
|
||||||
Dieses Verzeichnis enthält alle Marketing-Dokumente und Strategien für die Promotion von EmailSorter. Die Strategie fokussiert sich auf organisches Wachstum durch TikTok, YouTube, Influencer-Marketing und Product Hunt.
|
Dieses Verzeichnis enthält alle Marketing-Dokumente und Strategien für die Promotion von MailFlow. Die Strategie fokussiert sich auf organisches Wachstum durch TikTok, YouTube, Influencer-Marketing und Product Hunt.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# n8n Workflows für EmailSorter
|
# n8n Workflows für MailFlow
|
||||||
|
|
||||||
Dieses Verzeichnis enthält optionale n8n Workflows zur E-Mail-Automatisierung.
|
Dieses Verzeichnis enthält optionale n8n Workflows zur E-Mail-Automatisierung.
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ Dieses Verzeichnis enthält optionale n8n Workflows zur E-Mail-Automatisierung.
|
|||||||
2. **Credentials einrichten**
|
2. **Credentials einrichten**
|
||||||
- Gmail OAuth2 Credentials
|
- Gmail OAuth2 Credentials
|
||||||
- Mistral AI API Key (https://console.mistral.ai/)
|
- Mistral AI API Key (https://console.mistral.ai/)
|
||||||
- HTTP Header Auth für EmailSorter API
|
- HTTP Header Auth für MailFlow API
|
||||||
|
|
||||||
## Workflows
|
## Workflows
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ Haupt-Workflow für die E-Mail-Sortierung:
|
|||||||
2. **Gmail: E-Mail abrufen**: Holt E-Mail-Details
|
2. **Gmail: E-Mail abrufen**: Holt E-Mail-Details
|
||||||
3. **Mistral AI: Klassifizieren**: KI kategorisiert die E-Mail
|
3. **Mistral AI: Klassifizieren**: KI kategorisiert die E-Mail
|
||||||
4. **Gmail: Label setzen**: Fügt entsprechendes Label hinzu
|
4. **Gmail: Label setzen**: Fügt entsprechendes Label hinzu
|
||||||
5. **Statistiken aktualisieren**: Sendet Update an EmailSorter API
|
5. **Statistiken aktualisieren**: Sendet Update an MailFlow API
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
@@ -51,18 +51,18 @@ n8n import:workflow --input=workflows/email-sorter-workflow.json
|
|||||||
### 3. Environment Variables
|
### 3. Environment Variables
|
||||||
|
|
||||||
```env
|
```env
|
||||||
EMAILSORTER_API_URL=http://localhost:3000
|
MAILFLOW_API_URL=http://localhost:3000
|
||||||
EMAILSORTER_API_KEY=your-api-key
|
MAILFLOW_API_KEY=your-api-key
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Webhook URL notieren
|
### 4. Webhook URL notieren
|
||||||
|
|
||||||
Nach dem Aktivieren des Workflows wird eine Webhook-URL generiert:
|
Nach dem Aktivieren des Workflows wird eine Webhook-URL generiert:
|
||||||
```
|
```
|
||||||
https://your-n8n-instance.com/webhook/email-sorter-webhook
|
https://your-n8n-instance.com/webhook/mailflow-webhook
|
||||||
```
|
```
|
||||||
|
|
||||||
Diese URL im EmailSorter Backend konfigurieren.
|
Diese URL im MailFlow Backend konfigurieren.
|
||||||
|
|
||||||
## Anpassungen
|
## Anpassungen
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ Nach dem Label-Node einen "Gmail: Archive" Node hinzufügen:
|
|||||||
|
|
||||||
- Ausführungen in n8n UI überwachen
|
- Ausführungen in n8n UI überwachen
|
||||||
- Fehler-Benachrichtigungen einrichten
|
- Fehler-Benachrichtigungen einrichten
|
||||||
- Statistiken im EmailSorter Dashboard prüfen
|
- Statistiken im MailFlow Dashboard prüfen
|
||||||
|
|
||||||
## Skalierung
|
## Skalierung
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "EmailSorter - Automatische E-Mail-Sortierung",
|
"name": "MailFlow - Automatische E-Mail-Sortierung",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"type": "n8n-nodes-base.webhook",
|
"type": "n8n-nodes-base.webhook",
|
||||||
"typeVersion": 1,
|
"typeVersion": 1,
|
||||||
"position": [250, 300],
|
"position": [250, 300],
|
||||||
"webhookId": "email-sorter-webhook"
|
"webhookId": "mailflow-webhook"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
"resource": "message",
|
"resource": "message",
|
||||||
"operation": "addLabels",
|
"operation": "addLabels",
|
||||||
"messageId": "={{ $('Gmail: E-Mail abrufen').item.json.id }}",
|
"messageId": "={{ $('Gmail: E-Mail abrufen').item.json.id }}",
|
||||||
"labelIds": ["EmailSorter/Newsletter"]
|
"labelIds": ["MailFlow/Newsletter"]
|
||||||
},
|
},
|
||||||
"id": "gmail-label-newsletter",
|
"id": "gmail-label-newsletter",
|
||||||
"name": "Gmail: Newsletter Label",
|
"name": "Gmail: Newsletter Label",
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
"resource": "message",
|
"resource": "message",
|
||||||
"operation": "addLabels",
|
"operation": "addLabels",
|
||||||
"messageId": "={{ $('Gmail: E-Mail abrufen').item.json.id }}",
|
"messageId": "={{ $('Gmail: E-Mail abrufen').item.json.id }}",
|
||||||
"labelIds": ["={{ 'EmailSorter/' + $('Mistral AI: Klassifizieren').item.json.choices[0].message.content.trim() }}"]
|
"labelIds": ["={{ 'MailFlow/' + $('Mistral AI: Klassifizieren').item.json.choices[0].message.content.trim() }}"]
|
||||||
},
|
},
|
||||||
"id": "gmail-label-other",
|
"id": "gmail-label-other",
|
||||||
"name": "Gmail: Kategorie Label",
|
"name": "Gmail: Kategorie Label",
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"url": "={{ $env.EMAILSORTER_API_URL }}/api/email/stats/update",
|
"url": "={{ $env.MAILFLOW_API_URL }}/api/email/stats/update",
|
||||||
"authentication": "genericCredentialType",
|
"authentication": "genericCredentialType",
|
||||||
"genericAuthType": "httpHeaderAuth",
|
"genericAuthType": "httpHeaderAuth",
|
||||||
"sendBody": true,
|
"sendBody": true,
|
||||||
|
|||||||
BIN
pics/logo.png
Normal file
|
After Width: | Height: | Size: 613 KiB |
@@ -1,5 +1,5 @@
|
|||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# EmailSorter - Appwrite CORS Platform Setup (Vollautomatisch via API)
|
# MailFlow - Appwrite CORS Platform Setup (Vollautomatisch via API)
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# Dieses Script versucht, die Platform automatisch über die Appwrite API
|
# Dieses Script versucht, die Platform automatisch über die Appwrite API
|
||||||
# hinzuzufügen. Falls der API Key nicht die richtigen Scopes hat, wird
|
# hinzuzufügen. Falls der API Key nicht die richtigen Scopes hat, wird
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# EmailSorter - Appwrite CORS Platform Setup (Automatisch)
|
# MailFlow - Appwrite CORS Platform Setup (Automatisch)
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# Dieses Script fügt automatisch die Production-Platform zu Appwrite hinzu,
|
# Dieses Script fügt automatisch die Production-Platform zu Appwrite hinzu,
|
||||||
# um CORS-Fehler zu beheben.
|
# um CORS-Fehler zu beheben.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# EmailSorter - Appwrite Setup Script
|
# MailFlow - Appwrite Setup Script
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
#
|
#
|
||||||
# ⚠️ WICHTIG: Diese Datei ist VERALTET!
|
# ⚠️ WICHTIG: Diese Datei ist VERALTET!
|
||||||
@@ -33,7 +33,7 @@ if (-not (Test-Path ".\server\.env")) {
|
|||||||
Write-Host " APPWRITE_ENDPOINT=https://appwrite.webklar.com/v1" -ForegroundColor Gray
|
Write-Host " APPWRITE_ENDPOINT=https://appwrite.webklar.com/v1" -ForegroundColor Gray
|
||||||
Write-Host " APPWRITE_PROJECT_ID=deine_projekt_id" -ForegroundColor Gray
|
Write-Host " APPWRITE_PROJECT_ID=deine_projekt_id" -ForegroundColor Gray
|
||||||
Write-Host " APPWRITE_API_KEY=dein_api_key" -ForegroundColor Gray
|
Write-Host " APPWRITE_API_KEY=dein_api_key" -ForegroundColor Gray
|
||||||
Write-Host " APPWRITE_DATABASE_ID=emailsorter" -ForegroundColor Gray
|
Write-Host " APPWRITE_DATABASE_ID=mailflow" -ForegroundColor Gray
|
||||||
Write-Host "`nSiehe server/env.example für ein Template." -ForegroundColor Cyan
|
Write-Host "`nSiehe server/env.example für ein Template." -ForegroundColor Cyan
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ if (-not (Test-Path "package.json")) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "`n=== EmailSorter Bootstrap ===" -ForegroundColor Cyan
|
Write-Host "`n=== MailFlow Bootstrap ===" -ForegroundColor Cyan
|
||||||
Write-Host "Verwende bootstrap-v2.mjs (aktuelle Version)" -ForegroundColor Green
|
Write-Host "Verwende bootstrap-v2.mjs (aktuelle Version)" -ForegroundColor Green
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# EmailSorter Production Setup Script
|
# MailFlow Production Setup Script
|
||||||
# Dieses Script hilft beim Setup für Production
|
# Dieses Script hilft beim Setup für Production
|
||||||
|
|
||||||
Write-Host "========================================" -ForegroundColor Cyan
|
Write-Host "========================================" -ForegroundColor Cyan
|
||||||
Write-Host "EmailSorter Production Setup" -ForegroundColor Cyan
|
Write-Host "MailFlow Production Setup" -ForegroundColor Cyan
|
||||||
Write-Host "========================================" -ForegroundColor Cyan
|
Write-Host "========================================" -ForegroundColor Cyan
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
@@ -59,18 +59,18 @@ if (Test-Path $serverPath) {
|
|||||||
|
|
||||||
# Prüfe ob Server bereits läuft
|
# Prüfe ob Server bereits läuft
|
||||||
$pm2List = pm2 list 2>&1
|
$pm2List = pm2 list 2>&1
|
||||||
if ($pm2List -match "emailsorter-api") {
|
if ($pm2List -match "mailflow-api") {
|
||||||
Write-Host " Server läuft bereits. Neustart..." -ForegroundColor Yellow
|
Write-Host " Server läuft bereits. Neustart..." -ForegroundColor Yellow
|
||||||
pm2 restart emailsorter-api
|
pm2 restart mailflow-api
|
||||||
} else {
|
} else {
|
||||||
Write-Host " Starte Backend Server mit PM2..." -ForegroundColor Yellow
|
Write-Host " Starte Backend Server mit PM2..." -ForegroundColor Yellow
|
||||||
pm2 start index.mjs --name emailsorter-api
|
pm2 start index.mjs --name mailflow-api
|
||||||
pm2 save
|
pm2 save
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "✓ Backend Server gestartet" -ForegroundColor Green
|
Write-Host "✓ Backend Server gestartet" -ForegroundColor Green
|
||||||
Write-Host " Status: pm2 status" -ForegroundColor Cyan
|
Write-Host " Status: pm2 status" -ForegroundColor Cyan
|
||||||
Write-Host " Logs: pm2 logs emailsorter-api" -ForegroundColor Cyan
|
Write-Host " Logs: pm2 logs mailflow-api" -ForegroundColor Cyan
|
||||||
} else {
|
} else {
|
||||||
Write-Host "✗ Server Verzeichnis nicht gefunden!" -ForegroundColor Red
|
Write-Host "✗ Server Verzeichnis nicht gefunden!" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import 'dotenv/config';
|
|||||||
import { Client, Databases, ID, Permission, Role } from "node-appwrite";
|
import { Client, Databases, ID, Permission, Role } from "node-appwrite";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EmailSorter Database Bootstrap Script v2
|
* MailFlow Database Bootstrap Script v2
|
||||||
* Creates all required collections for the full EmailSorter app
|
* Creates all required collections for the full MailFlow app
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const requiredEnv = [
|
const requiredEnv = [
|
||||||
@@ -26,8 +26,8 @@ const client = new Client()
|
|||||||
|
|
||||||
const db = new Databases(client);
|
const db = new Databases(client);
|
||||||
|
|
||||||
const DB_ID = process.env.APPWRITE_DATABASE_ID || 'emailsorter';
|
const DB_ID = process.env.APPWRITE_DATABASE_ID || 'mailflow';
|
||||||
const DB_NAME = 'EmailSorter';
|
const DB_NAME = 'MailFlow';
|
||||||
|
|
||||||
// Helper: create database if not exists
|
// Helper: create database if not exists
|
||||||
async function ensureDatabase() {
|
async function ensureDatabase() {
|
||||||
@@ -161,6 +161,12 @@ async function setupCollections() {
|
|||||||
db.createBooleanAttribute(DB_ID, 'email_accounts', 'isActive', true));
|
db.createBooleanAttribute(DB_ID, 'email_accounts', 'isActive', true));
|
||||||
await ensureAttribute('email_accounts', 'lastSync', () =>
|
await ensureAttribute('email_accounts', 'lastSync', () =>
|
||||||
db.createDatetimeAttribute(DB_ID, 'email_accounts', 'lastSync', false));
|
db.createDatetimeAttribute(DB_ID, 'email_accounts', 'lastSync', false));
|
||||||
|
await ensureAttribute('email_accounts', 'imapHost', () =>
|
||||||
|
db.createStringAttribute(DB_ID, 'email_accounts', 'imapHost', 256, false));
|
||||||
|
await ensureAttribute('email_accounts', 'imapPort', () =>
|
||||||
|
db.createIntegerAttribute(DB_ID, 'email_accounts', 'imapPort', false));
|
||||||
|
await ensureAttribute('email_accounts', 'imapSecure', () =>
|
||||||
|
db.createBooleanAttribute(DB_ID, 'email_accounts', 'imapSecure', false));
|
||||||
|
|
||||||
// ==================== Email Stats ====================
|
// ==================== Email Stats ====================
|
||||||
await ensureCollection('email_stats', 'Email Stats', PERM_AUTHENTICATED);
|
await ensureCollection('email_stats', 'Email Stats', PERM_AUTHENTICATED);
|
||||||
@@ -256,7 +262,7 @@ async function setupCollections() {
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log('\n========================================');
|
console.log('\n========================================');
|
||||||
console.log(' EmailSorter Database Bootstrap v2');
|
console.log(' MailFlow Database Bootstrap v2');
|
||||||
console.log('========================================\n');
|
console.log('========================================\n');
|
||||||
|
|
||||||
await ensureDatabase();
|
await ensureDatabase();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* EmailSorter - Database Cleanup Script
|
* MailFlow - Database Cleanup Script
|
||||||
*
|
*
|
||||||
* ⚠️ WICHTIG: Liest Credentials aus Umgebungsvariablen (.env)
|
* ⚠️ WICHTIG: Liest Credentials aus Umgebungsvariablen (.env)
|
||||||
* Keine hardcoded API Keys mehr!
|
* Keine hardcoded API Keys mehr!
|
||||||
|
|||||||
@@ -75,6 +75,18 @@ export const config = {
|
|||||||
emailAccounts: 1,
|
emailAccounts: 1,
|
||||||
autoSchedule: false, // manual only
|
autoSchedule: false, // manual only
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Admin: comma-separated list of emails with admin rights (e.g. support)
|
||||||
|
adminEmails: (process.env.ADMIN_EMAILS || '')
|
||||||
|
.split(',')
|
||||||
|
.map((e) => e.trim().toLowerCase())
|
||||||
|
.filter(Boolean),
|
||||||
|
|
||||||
|
// Gitea Webhook (Deployment)
|
||||||
|
gitea: {
|
||||||
|
webhookSecret: process.env.GITEA_WEBHOOK_SECRET || '',
|
||||||
|
webhookAuthToken: process.env.GITEA_WEBHOOK_AUTH_TOKEN || process.env.GITEA_WEBHOOK_SECRET || '',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,4 +153,12 @@ export const features = {
|
|||||||
ai: () => Boolean(config.mistral.apiKey),
|
ai: () => Boolean(config.mistral.apiKey),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if an email has admin rights (support, etc.)
|
||||||
|
*/
|
||||||
|
export function isAdmin(email) {
|
||||||
|
if (!email || typeof email !== 'string') return false
|
||||||
|
return config.adminEmails.includes(email.trim().toLowerCase())
|
||||||
|
}
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ try {
|
|||||||
const productsResponse = await databases.listDocuments(
|
const productsResponse = await databases.listDocuments(
|
||||||
process.env.APPWRITE_DATABASE_ID,
|
process.env.APPWRITE_DATABASE_ID,
|
||||||
'products',
|
'products',
|
||||||
[Query.equal('slug', 'email-sorter'), Query.equal('isActive', true)]
|
[Query.equal('slug', 'mailflow'), Query.equal('isActive', true)]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (productsResponse.documents.length === 0) {
|
if (productsResponse.documents.length === 0) {
|
||||||
console.error('❌ No active product found with slug "email-sorter"');
|
console.error('❌ No active product found with slug "mailflow"');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# EmailSorter Backend - Konfiguration
|
# MailFlow Backend - Konfiguration
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# Kopiere diese Datei nach `.env` und fülle die Werte aus.
|
# Kopiere diese Datei nach `.env` und fülle die Werte aus.
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ FRONTEND_URL=http://localhost:5173
|
|||||||
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
||||||
APPWRITE_PROJECT_ID=dein_projekt_id
|
APPWRITE_PROJECT_ID=dein_projekt_id
|
||||||
APPWRITE_API_KEY=dein_api_key_mit_allen_berechtigungen
|
APPWRITE_API_KEY=dein_api_key_mit_allen_berechtigungen
|
||||||
APPWRITE_DATABASE_ID=email_sorter_db
|
APPWRITE_DATABASE_ID=mailflow_db
|
||||||
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
# Stripe (ERFORDERLICH)
|
# Stripe (ERFORDERLICH)
|
||||||
@@ -65,6 +65,23 @@ MICROSOFT_CLIENT_ID=xxx-xxx-xxx
|
|||||||
MICROSOFT_CLIENT_SECRET=xxx
|
MICROSOFT_CLIENT_SECRET=xxx
|
||||||
MICROSOFT_REDIRECT_URI=http://localhost:3000/api/oauth/outlook/callback
|
MICROSOFT_REDIRECT_URI=http://localhost:3000/api/oauth/outlook/callback
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Admin (OPTIONAL)
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Comma-separated list of admin emails (e.g. support@webklar.com). Used by isAdmin().
|
||||||
|
# ADMIN_EMAILS=support@webklar.com
|
||||||
|
|
||||||
|
# Initial password for admin user when running: npm run create-admin
|
||||||
|
# ADMIN_INITIAL_PASSWORD=your-secure-password
|
||||||
|
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Gitea Webhook (OPTIONAL – Deployment bei Push)
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Secret für X-Gitea-Signature und optional Bearer-Header (gleicher Wert möglich)
|
||||||
|
# GITEA_WEBHOOK_SECRET=dein_webhook_secret
|
||||||
|
# Optional: anderer Token nur für Authorization: Bearer (sonst wird GITEA_WEBHOOK_SECRET verwendet)
|
||||||
|
# GITEA_WEBHOOK_AUTH_TOKEN=
|
||||||
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
# Rate Limiting (OPTIONAL)
|
# Rate Limiting (OPTIONAL)
|
||||||
# ─────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* EmailSorter Backend Server
|
* MailFlow Backend Server
|
||||||
* Main entry point
|
* Main entry point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ import { dirname, join } from 'path'
|
|||||||
|
|
||||||
// Config & Middleware
|
// Config & Middleware
|
||||||
import { config, validateConfig } from './config/index.mjs'
|
import { config, validateConfig } from './config/index.mjs'
|
||||||
import { errorHandler, asyncHandler, NotFoundError, ValidationError } from './middleware/errorHandler.mjs'
|
import { errorHandler, asyncHandler, NotFoundError, ValidationError, AuthorizationError } from './middleware/errorHandler.mjs'
|
||||||
import { respond } from './utils/response.mjs'
|
import { respond } from './utils/response.mjs'
|
||||||
import { logger, log } from './middleware/logger.mjs'
|
import { logger, log } from './middleware/logger.mjs'
|
||||||
import { limiters } from './middleware/rateLimit.mjs'
|
import { limiters } from './middleware/rateLimit.mjs'
|
||||||
@@ -22,6 +22,7 @@ import emailRoutes from './routes/email.mjs'
|
|||||||
import stripeRoutes from './routes/stripe.mjs'
|
import stripeRoutes from './routes/stripe.mjs'
|
||||||
import apiRoutes from './routes/api.mjs'
|
import apiRoutes from './routes/api.mjs'
|
||||||
import analyticsRoutes from './routes/analytics.mjs'
|
import analyticsRoutes from './routes/analytics.mjs'
|
||||||
|
import webhookRoutes from './routes/webhook.mjs'
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = dirname(__filename)
|
const __dirname = dirname(__filename)
|
||||||
@@ -56,6 +57,11 @@ app.use('/api', limiters.api)
|
|||||||
// Static files
|
// Static files
|
||||||
app.use(express.static(join(__dirname, '..', 'public')))
|
app.use(express.static(join(__dirname, '..', 'public')))
|
||||||
|
|
||||||
|
// Gitea webhook: raw body for X-Gitea-Signature verification (must be before JSON parser)
|
||||||
|
// Limit 2mb so large Gitea payloads (full repo JSON) don't get rejected and cause 502
|
||||||
|
app.use('/api/webhook', express.raw({ type: 'application/json', limit: '2mb' }))
|
||||||
|
app.use('/api/webhook', webhookRoutes)
|
||||||
|
|
||||||
// Body parsing (BEFORE routes, AFTER static)
|
// Body parsing (BEFORE routes, AFTER static)
|
||||||
// Note: Stripe webhook needs raw body, handled in stripe routes
|
// Note: Stripe webhook needs raw body, handled in stripe routes
|
||||||
app.use('/api', express.json({ limit: '1mb' }))
|
app.use('/api', express.json({ limit: '1mb' }))
|
||||||
@@ -84,6 +90,19 @@ app.use('/api', apiRoutes)
|
|||||||
|
|
||||||
// Preferences endpoints (inline for simplicity)
|
// Preferences endpoints (inline for simplicity)
|
||||||
import { userPreferences } from './services/database.mjs'
|
import { userPreferences } from './services/database.mjs'
|
||||||
|
import { isAdmin } from './config/index.mjs'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/me?email=xxx
|
||||||
|
* Returns current user context (e.g. isAdmin) for the given email.
|
||||||
|
*/
|
||||||
|
app.get('/api/me', asyncHandler(async (req, res) => {
|
||||||
|
const { email } = req.query
|
||||||
|
if (!email || typeof email !== 'string') {
|
||||||
|
throw new ValidationError('email is required')
|
||||||
|
}
|
||||||
|
respond.success(res, { isAdmin: isAdmin(email) })
|
||||||
|
}))
|
||||||
|
|
||||||
app.get('/api/preferences', asyncHandler(async (req, res) => {
|
app.get('/api/preferences', asyncHandler(async (req, res) => {
|
||||||
const { userId } = req.query
|
const { userId } = req.query
|
||||||
@@ -207,6 +226,69 @@ app.delete('/api/preferences/company-labels/:id', asyncHandler(async (req, res)
|
|||||||
respond.success(res, null, 'Company label deleted')
|
respond.success(res, null, 'Company label deleted')
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/preferences/name-labels
|
||||||
|
* Get name labels (worker labels). Admin only.
|
||||||
|
*/
|
||||||
|
app.get('/api/preferences/name-labels', asyncHandler(async (req, res) => {
|
||||||
|
const { userId, email } = req.query
|
||||||
|
if (!userId) throw new ValidationError('userId is required')
|
||||||
|
if (!email || typeof email !== 'string') throw new ValidationError('email is required')
|
||||||
|
if (!isAdmin(email)) throw new AuthorizationError('Admin access required for name labels')
|
||||||
|
|
||||||
|
const prefs = await userPreferences.getByUser(userId)
|
||||||
|
const preferences = prefs?.preferences || userPreferences.getDefaults()
|
||||||
|
respond.success(res, preferences.nameLabels || [])
|
||||||
|
}))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/preferences/name-labels
|
||||||
|
* Save/Update name label (worker). Admin only.
|
||||||
|
*/
|
||||||
|
app.post('/api/preferences/name-labels', asyncHandler(async (req, res) => {
|
||||||
|
const { userId, email, nameLabel } = req.body
|
||||||
|
if (!userId) throw new ValidationError('userId is required')
|
||||||
|
if (!email || typeof email !== 'string') throw new ValidationError('email is required')
|
||||||
|
if (!isAdmin(email)) throw new AuthorizationError('Admin access required for name labels')
|
||||||
|
if (!nameLabel) throw new ValidationError('nameLabel is required')
|
||||||
|
|
||||||
|
const prefs = await userPreferences.getByUser(userId)
|
||||||
|
const preferences = prefs?.preferences || userPreferences.getDefaults()
|
||||||
|
const nameLabels = preferences.nameLabels || []
|
||||||
|
|
||||||
|
if (!nameLabel.id) {
|
||||||
|
nameLabel.id = `namelabel_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
|
||||||
|
}
|
||||||
|
const existingIndex = nameLabels.findIndex(l => l.id === nameLabel.id)
|
||||||
|
if (existingIndex >= 0) {
|
||||||
|
nameLabels[existingIndex] = nameLabel
|
||||||
|
} else {
|
||||||
|
nameLabels.push(nameLabel)
|
||||||
|
}
|
||||||
|
|
||||||
|
await userPreferences.upsert(userId, { nameLabels })
|
||||||
|
respond.success(res, nameLabel, 'Name label saved')
|
||||||
|
}))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE /api/preferences/name-labels/:id
|
||||||
|
* Delete name label. Admin only.
|
||||||
|
*/
|
||||||
|
app.delete('/api/preferences/name-labels/:id', asyncHandler(async (req, res) => {
|
||||||
|
const { userId, email } = req.query
|
||||||
|
const { id } = req.params
|
||||||
|
if (!userId) throw new ValidationError('userId is required')
|
||||||
|
if (!email || typeof email !== 'string') throw new ValidationError('email is required')
|
||||||
|
if (!isAdmin(email)) throw new AuthorizationError('Admin access required for name labels')
|
||||||
|
if (!id) throw new ValidationError('label id is required')
|
||||||
|
|
||||||
|
const prefs = await userPreferences.getByUser(userId)
|
||||||
|
const preferences = prefs?.preferences || userPreferences.getDefaults()
|
||||||
|
const nameLabels = (preferences.nameLabels || []).filter(l => l.id !== id)
|
||||||
|
await userPreferences.upsert(userId, { nameLabels })
|
||||||
|
respond.success(res, null, 'Name label deleted')
|
||||||
|
}))
|
||||||
|
|
||||||
// Legacy Stripe webhook endpoint
|
// Legacy Stripe webhook endpoint
|
||||||
app.use('/stripe', stripeRoutes)
|
app.use('/stripe', stripeRoutes)
|
||||||
|
|
||||||
|
|||||||
262
server/node_modules/.package-lock.json
generated
vendored
@@ -233,6 +233,12 @@
|
|||||||
"zod-to-json-schema": "^3.24.1"
|
"zod-to-json-schema": "^3.24.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@pinojs/redact": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "25.0.8",
|
"version": "25.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.8.tgz",
|
||||||
@@ -242,6 +248,17 @@
|
|||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@zone-eu/mailsplit": {
|
||||||
|
"version": "5.4.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@zone-eu/mailsplit/-/mailsplit-5.4.8.tgz",
|
||||||
|
"integrity": "sha512-eEyACj4JZ7sjzRvy26QhLgKEMWwQbsw1+QZnlLX+/gihcNH07lVPOcnwf5U6UAL7gkc//J3jVd76o/WS+taUiA==",
|
||||||
|
"license": "(MIT OR EUPL-1.1+)",
|
||||||
|
"dependencies": {
|
||||||
|
"libbase64": "1.3.0",
|
||||||
|
"libmime": "5.3.7",
|
||||||
|
"libqp": "2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/accepts": {
|
"node_modules/accepts": {
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||||
@@ -270,6 +287,15 @@
|
|||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/atomic-sleep": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/base64-js": {
|
"node_modules/base64-js": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
@@ -555,6 +581,15 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/encoding-japanese": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/encoding-japanese/-/encoding-japanese-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-EuJWwlHPZ1LbADuKTClvHtwbaFn4rOD+dRAbWysqEOXRc2Uui0hJInNJrsdH0c+OhJA4nrCBdSkW4DD5YxAo6A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/entities": {
|
"node_modules/entities": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
||||||
@@ -1028,12 +1063,54 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/imapflow": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/imapflow/-/imapflow-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-ym7FF2tKOlOzfRvxehs4eLkhjP8Mme3sSp2tcxEbyoeJuJwtEWxaVDv12+DnaMG2LXm0zuQGWZiClq31FLPUNg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@zone-eu/mailsplit": "5.4.8",
|
||||||
|
"encoding-japanese": "2.2.0",
|
||||||
|
"iconv-lite": "0.7.2",
|
||||||
|
"libbase64": "1.3.0",
|
||||||
|
"libmime": "5.3.7",
|
||||||
|
"libqp": "2.1.1",
|
||||||
|
"nodemailer": "7.0.13",
|
||||||
|
"pino": "10.3.0",
|
||||||
|
"socks": "2.8.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/imapflow/node_modules/iconv-lite": {
|
||||||
|
"version": "0.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
||||||
|
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/ip-address": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ipaddr.js": {
|
"node_modules/ipaddr.js": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
@@ -1160,6 +1237,42 @@
|
|||||||
"safe-buffer": "^5.0.1"
|
"safe-buffer": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/libbase64": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/libbase64/-/libbase64-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-GgOXd0Eo6phYgh0DJtjQ2tO8dc0IVINtZJeARPeiIJqge+HdsWSuaDTe8ztQ7j/cONByDZ3zeB325AHiv5O0dg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/libmime": {
|
||||||
|
"version": "5.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/libmime/-/libmime-5.3.7.tgz",
|
||||||
|
"integrity": "sha512-FlDb3Wtha8P01kTL3P9M+ZDNDWPKPmKHWaU/cG/lg5pfuAwdflVpZE+wm9m7pKmC5ww6s+zTxBKS1p6yl3KpSw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"encoding-japanese": "2.2.0",
|
||||||
|
"iconv-lite": "0.6.3",
|
||||||
|
"libbase64": "1.3.0",
|
||||||
|
"libqp": "2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/libmime/node_modules/iconv-lite": {
|
||||||
|
"version": "0.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||||
|
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/libqp": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/libqp/-/libqp-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-0Wd+GPz1O134cP62YU2GTOPNA7Qgl09XwCqM5zpBv87ERCXdfDtyKXvV7c9U22yWJh44QZqBocFnXN11K96qow==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/lodash.includes": {
|
"node_modules/lodash.includes": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||||
@@ -1360,6 +1473,15 @@
|
|||||||
"webidl-conversions": "^3.0.0"
|
"webidl-conversions": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nodemailer": {
|
||||||
|
"version": "7.0.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.13.tgz",
|
||||||
|
"integrity": "sha512-PNDFSJdP+KFgdsG3ZzMXCgquO7I6McjY2vlqILjtJd0hy8wEvtugS9xKRF2NWlPNGxvLCXlTNIae4serI7dinw==",
|
||||||
|
"license": "MIT-0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/object-assign": {
|
"node_modules/object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
@@ -1381,6 +1503,15 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/on-exit-leak-free": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/on-finished": {
|
"node_modules/on-finished": {
|
||||||
"version": "2.4.1",
|
"version": "2.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||||
@@ -1421,6 +1552,59 @@
|
|||||||
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/pino": {
|
||||||
|
"version": "10.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino/-/pino-10.3.0.tgz",
|
||||||
|
"integrity": "sha512-0GNPNzHXBKw6U/InGe79A3Crzyk9bcSyObF9/Gfo9DLEf5qj5RF50RSjsu0W1rZ6ZqRGdzDFCRBQvi9/rSGPtA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@pinojs/redact": "^0.4.0",
|
||||||
|
"atomic-sleep": "^1.0.0",
|
||||||
|
"on-exit-leak-free": "^2.1.0",
|
||||||
|
"pino-abstract-transport": "^3.0.0",
|
||||||
|
"pino-std-serializers": "^7.0.0",
|
||||||
|
"process-warning": "^5.0.0",
|
||||||
|
"quick-format-unescaped": "^4.0.3",
|
||||||
|
"real-require": "^0.2.0",
|
||||||
|
"safe-stable-stringify": "^2.3.1",
|
||||||
|
"sonic-boom": "^4.0.1",
|
||||||
|
"thread-stream": "^4.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"pino": "bin.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-abstract-transport": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"split2": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-std-serializers": {
|
||||||
|
"version": "7.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz",
|
||||||
|
"integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/process-warning": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/fastify"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fastify"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/proxy-addr": {
|
"node_modules/proxy-addr": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||||
@@ -1459,6 +1643,12 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/quick-format-unescaped": {
|
||||||
|
"version": "4.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz",
|
||||||
|
"integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/range-parser": {
|
"node_modules/range-parser": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||||
@@ -1483,6 +1673,15 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/real-require": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/require-from-string": {
|
"node_modules/require-from-string": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
||||||
@@ -1513,6 +1712,15 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/safe-stable-stringify": {
|
||||||
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/safer-buffer": {
|
"node_modules/safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
@@ -1667,6 +1875,39 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/smart-buffer": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/socks": {
|
||||||
|
"version": "2.8.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz",
|
||||||
|
"integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ip-address": "^10.0.1",
|
||||||
|
"smart-buffer": "^4.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sonic-boom": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"atomic-sleep": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
@@ -1677,6 +1918,15 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/split2": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/statuses": {
|
"node_modules/statuses": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||||
@@ -1706,6 +1956,18 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/thread-stream": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-4iMVL6HAINXWf1ZKZjIPcz5wYaOdPhtO8ATvZ+Xqp3BTdaqtAwQkNmKORqcIo5YkQqGXq5cwfswDwMqqQNrpJA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"real-require": "^0.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tldts": {
|
"node_modules/tldts": {
|
||||||
"version": "7.0.19",
|
"version": "7.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.19.tgz",
|
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.19.tgz",
|
||||||
|
|||||||
263
server/package-lock.json
generated
@@ -16,6 +16,7 @@
|
|||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"google-auth-library": "^9.14.2",
|
"google-auth-library": "^9.14.2",
|
||||||
"googleapis": "^144.0.0",
|
"googleapis": "^144.0.0",
|
||||||
|
"imapflow": "^1.2.8",
|
||||||
"node-appwrite": "^14.1.0",
|
"node-appwrite": "^14.1.0",
|
||||||
"stripe": "^17.4.0"
|
"stripe": "^17.4.0"
|
||||||
},
|
},
|
||||||
@@ -255,6 +256,12 @@
|
|||||||
"zod-to-json-schema": "^3.24.1"
|
"zod-to-json-schema": "^3.24.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@pinojs/redact": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "25.0.8",
|
"version": "25.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.8.tgz",
|
||||||
@@ -264,6 +271,17 @@
|
|||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@zone-eu/mailsplit": {
|
||||||
|
"version": "5.4.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@zone-eu/mailsplit/-/mailsplit-5.4.8.tgz",
|
||||||
|
"integrity": "sha512-eEyACj4JZ7sjzRvy26QhLgKEMWwQbsw1+QZnlLX+/gihcNH07lVPOcnwf5U6UAL7gkc//J3jVd76o/WS+taUiA==",
|
||||||
|
"license": "(MIT OR EUPL-1.1+)",
|
||||||
|
"dependencies": {
|
||||||
|
"libbase64": "1.3.0",
|
||||||
|
"libmime": "5.3.7",
|
||||||
|
"libqp": "2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/accepts": {
|
"node_modules/accepts": {
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||||
@@ -292,6 +310,15 @@
|
|||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/atomic-sleep": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/base64-js": {
|
"node_modules/base64-js": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
@@ -577,6 +604,15 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/encoding-japanese": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/encoding-japanese/-/encoding-japanese-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-EuJWwlHPZ1LbADuKTClvHtwbaFn4rOD+dRAbWysqEOXRc2Uui0hJInNJrsdH0c+OhJA4nrCBdSkW4DD5YxAo6A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/entities": {
|
"node_modules/entities": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
||||||
@@ -1050,12 +1086,54 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/imapflow": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/imapflow/-/imapflow-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-ym7FF2tKOlOzfRvxehs4eLkhjP8Mme3sSp2tcxEbyoeJuJwtEWxaVDv12+DnaMG2LXm0zuQGWZiClq31FLPUNg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@zone-eu/mailsplit": "5.4.8",
|
||||||
|
"encoding-japanese": "2.2.0",
|
||||||
|
"iconv-lite": "0.7.2",
|
||||||
|
"libbase64": "1.3.0",
|
||||||
|
"libmime": "5.3.7",
|
||||||
|
"libqp": "2.1.1",
|
||||||
|
"nodemailer": "7.0.13",
|
||||||
|
"pino": "10.3.0",
|
||||||
|
"socks": "2.8.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/imapflow/node_modules/iconv-lite": {
|
||||||
|
"version": "0.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
||||||
|
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/ip-address": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ipaddr.js": {
|
"node_modules/ipaddr.js": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
@@ -1182,6 +1260,42 @@
|
|||||||
"safe-buffer": "^5.0.1"
|
"safe-buffer": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/libbase64": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/libbase64/-/libbase64-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-GgOXd0Eo6phYgh0DJtjQ2tO8dc0IVINtZJeARPeiIJqge+HdsWSuaDTe8ztQ7j/cONByDZ3zeB325AHiv5O0dg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/libmime": {
|
||||||
|
"version": "5.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/libmime/-/libmime-5.3.7.tgz",
|
||||||
|
"integrity": "sha512-FlDb3Wtha8P01kTL3P9M+ZDNDWPKPmKHWaU/cG/lg5pfuAwdflVpZE+wm9m7pKmC5ww6s+zTxBKS1p6yl3KpSw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"encoding-japanese": "2.2.0",
|
||||||
|
"iconv-lite": "0.6.3",
|
||||||
|
"libbase64": "1.3.0",
|
||||||
|
"libqp": "2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/libmime/node_modules/iconv-lite": {
|
||||||
|
"version": "0.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||||
|
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/libqp": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/libqp/-/libqp-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-0Wd+GPz1O134cP62YU2GTOPNA7Qgl09XwCqM5zpBv87ERCXdfDtyKXvV7c9U22yWJh44QZqBocFnXN11K96qow==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/lodash.includes": {
|
"node_modules/lodash.includes": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||||
@@ -1382,6 +1496,15 @@
|
|||||||
"webidl-conversions": "^3.0.0"
|
"webidl-conversions": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nodemailer": {
|
||||||
|
"version": "7.0.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.13.tgz",
|
||||||
|
"integrity": "sha512-PNDFSJdP+KFgdsG3ZzMXCgquO7I6McjY2vlqILjtJd0hy8wEvtugS9xKRF2NWlPNGxvLCXlTNIae4serI7dinw==",
|
||||||
|
"license": "MIT-0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/object-assign": {
|
"node_modules/object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
@@ -1403,6 +1526,15 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/on-exit-leak-free": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/on-finished": {
|
"node_modules/on-finished": {
|
||||||
"version": "2.4.1",
|
"version": "2.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||||
@@ -1443,6 +1575,59 @@
|
|||||||
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/pino": {
|
||||||
|
"version": "10.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino/-/pino-10.3.0.tgz",
|
||||||
|
"integrity": "sha512-0GNPNzHXBKw6U/InGe79A3Crzyk9bcSyObF9/Gfo9DLEf5qj5RF50RSjsu0W1rZ6ZqRGdzDFCRBQvi9/rSGPtA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@pinojs/redact": "^0.4.0",
|
||||||
|
"atomic-sleep": "^1.0.0",
|
||||||
|
"on-exit-leak-free": "^2.1.0",
|
||||||
|
"pino-abstract-transport": "^3.0.0",
|
||||||
|
"pino-std-serializers": "^7.0.0",
|
||||||
|
"process-warning": "^5.0.0",
|
||||||
|
"quick-format-unescaped": "^4.0.3",
|
||||||
|
"real-require": "^0.2.0",
|
||||||
|
"safe-stable-stringify": "^2.3.1",
|
||||||
|
"sonic-boom": "^4.0.1",
|
||||||
|
"thread-stream": "^4.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"pino": "bin.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-abstract-transport": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"split2": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-std-serializers": {
|
||||||
|
"version": "7.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz",
|
||||||
|
"integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/process-warning": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/fastify"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fastify"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/proxy-addr": {
|
"node_modules/proxy-addr": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||||
@@ -1481,6 +1666,12 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/quick-format-unescaped": {
|
||||||
|
"version": "4.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz",
|
||||||
|
"integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/range-parser": {
|
"node_modules/range-parser": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||||
@@ -1505,6 +1696,15 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/real-require": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/require-from-string": {
|
"node_modules/require-from-string": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
||||||
@@ -1535,6 +1735,15 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/safe-stable-stringify": {
|
||||||
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/safer-buffer": {
|
"node_modules/safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
@@ -1689,6 +1898,39 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/smart-buffer": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/socks": {
|
||||||
|
"version": "2.8.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz",
|
||||||
|
"integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ip-address": "^10.0.1",
|
||||||
|
"smart-buffer": "^4.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sonic-boom": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"atomic-sleep": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
@@ -1699,6 +1941,15 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/split2": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/statuses": {
|
"node_modules/statuses": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||||
@@ -1728,6 +1979,18 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/thread-stream": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-4iMVL6HAINXWf1ZKZjIPcz5wYaOdPhtO8ATvZ+Xqp3BTdaqtAwQkNmKORqcIo5YkQqGXq5cwfswDwMqqQNrpJA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"real-require": "^0.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tldts": {
|
"node_modules/tldts": {
|
||||||
"version": "7.0.19",
|
"version": "7.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.19.tgz",
|
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.19.tgz",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "email-sorter-server",
|
"name": "mailflow-server",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"description": "EmailSorter Backend Server - KI-gestützte E-Mail-Sortierung",
|
"description": "MailFlow Backend Server - KI-gestützte E-Mail-Sortierung",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
"test": "node e2e-test.mjs",
|
"test": "node e2e-test.mjs",
|
||||||
"test:frontend": "node test-frontend.mjs",
|
"test:frontend": "node test-frontend.mjs",
|
||||||
"verify": "node verify-setup.mjs",
|
"verify": "node verify-setup.mjs",
|
||||||
|
"create-admin": "node scripts/create-admin-user.mjs",
|
||||||
"cleanup": "node cleanup.mjs",
|
"cleanup": "node cleanup.mjs",
|
||||||
"lint": "eslint --ext .mjs ."
|
"lint": "eslint --ext .mjs ."
|
||||||
},
|
},
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"google-auth-library": "^9.14.2",
|
"google-auth-library": "^9.14.2",
|
||||||
"googleapis": "^144.0.0",
|
"googleapis": "^144.0.0",
|
||||||
|
"imapflow": "^1.2.8",
|
||||||
"node-appwrite": "^14.1.0",
|
"node-appwrite": "^14.1.0",
|
||||||
"stripe": "^17.4.0"
|
"stripe": "^17.4.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -78,12 +78,20 @@ router.post('/connect',
|
|||||||
validate({
|
validate({
|
||||||
body: {
|
body: {
|
||||||
userId: [rules.required('userId')],
|
userId: [rules.required('userId')],
|
||||||
provider: [rules.required('provider'), rules.isIn('provider', ['gmail', 'outlook', 'demo'])],
|
provider: [rules.required('provider'), rules.isIn('provider', ['gmail', 'outlook', 'demo', 'imap'])],
|
||||||
email: [rules.required('email'), rules.email()],
|
email: [rules.required('email'), rules.email()],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const { userId, provider, email, accessToken, refreshToken, expiresAt } = req.body
|
const { userId, provider, email, accessToken, refreshToken, expiresAt, password, imapHost, imapPort, imapSecure } = req.body
|
||||||
|
|
||||||
|
// IMAP: require password (or accessToken as password)
|
||||||
|
if (provider === 'imap') {
|
||||||
|
const imapPassword = password || accessToken
|
||||||
|
if (!imapPassword) {
|
||||||
|
throw new ValidationError('IMAP account requires a password or app password', { password: ['Required for IMAP'] })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if account already exists
|
// Check if account already exists
|
||||||
const existingAccounts = await emailAccounts.getByUser(userId)
|
const existingAccounts = await emailAccounts.getByUser(userId)
|
||||||
@@ -95,17 +103,44 @@ router.post('/connect',
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IMAP: verify connection before saving
|
||||||
|
if (provider === 'imap') {
|
||||||
|
const { ImapService } = await import('../services/imap.mjs')
|
||||||
|
const imapPassword = password || accessToken
|
||||||
|
const imap = new ImapService({
|
||||||
|
host: imapHost || 'imap.porkbun.com',
|
||||||
|
port: imapPort != null ? Number(imapPort) : 993,
|
||||||
|
secure: imapSecure !== false,
|
||||||
|
user: email,
|
||||||
|
password: imapPassword,
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
await imap.connect()
|
||||||
|
await imap.listEmails(1)
|
||||||
|
await imap.close()
|
||||||
|
} catch (err) {
|
||||||
|
log.warn('IMAP connection test failed', { email, error: err.message })
|
||||||
|
throw new ValidationError('IMAP connection failed. Check email and password (use app password if 2FA is on).', { password: [err.message || 'Connection failed'] })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create account
|
// Create account
|
||||||
const account = await emailAccounts.create({
|
const accountData = {
|
||||||
userId,
|
userId,
|
||||||
provider,
|
provider,
|
||||||
email,
|
email,
|
||||||
accessToken: accessToken || '',
|
accessToken: provider === 'imap' ? (password || accessToken) : (accessToken || ''),
|
||||||
refreshToken: refreshToken || '',
|
refreshToken: provider === 'imap' ? '' : (refreshToken || ''),
|
||||||
expiresAt: expiresAt || 0,
|
expiresAt: provider === 'imap' ? 0 : (expiresAt || 0),
|
||||||
isActive: true,
|
isActive: true,
|
||||||
lastSync: null,
|
lastSync: null,
|
||||||
})
|
}
|
||||||
|
if (provider === 'imap') {
|
||||||
|
if (imapHost != null) accountData.imapHost = String(imapHost)
|
||||||
|
if (imapPort != null) accountData.imapPort = Number(imapPort)
|
||||||
|
if (imapSecure !== undefined) accountData.imapSecure = Boolean(imapSecure)
|
||||||
|
}
|
||||||
|
const account = await emailAccounts.create(accountData)
|
||||||
|
|
||||||
log.success(`Email account connected: ${email} (${provider})`)
|
log.success(`Email account connected: ${email} (${provider})`)
|
||||||
|
|
||||||
@@ -129,7 +164,7 @@ router.post('/connect-demo',
|
|||||||
}),
|
}),
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const { userId } = req.body
|
const { userId } = req.body
|
||||||
const demoEmail = `demo-${userId.slice(0, 8)}@emailsorter.demo`
|
const demoEmail = `demo-${userId.slice(0, 8)}@mailflow.demo`
|
||||||
|
|
||||||
// Check if demo account already exists
|
// Check if demo account already exists
|
||||||
const existingAccounts = await emailAccounts.getByUser(userId)
|
const existingAccounts = await emailAccounts.getByUser(userId)
|
||||||
@@ -421,7 +456,7 @@ router.post('/sort',
|
|||||||
try {
|
try {
|
||||||
const gmail = await getGmailService(account.accessToken, account.refreshToken)
|
const gmail = await getGmailService(account.accessToken, account.refreshToken)
|
||||||
|
|
||||||
// FIRST: Clean up old "EmailSorter/..." labels
|
// FIRST: Clean up old "MailFlow/..." labels
|
||||||
const deletedLabels = await gmail.cleanupOldLabels()
|
const deletedLabels = await gmail.cleanupOldLabels()
|
||||||
if (deletedLabels > 0) {
|
if (deletedLabels > 0) {
|
||||||
log.success(`${deletedLabels} old labels cleaned up`)
|
log.success(`${deletedLabels} old labels cleaned up`)
|
||||||
@@ -487,6 +522,24 @@ router.post('/sort',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create name labels (workers) – personal labels per team member
|
||||||
|
const nameLabelMap = {}
|
||||||
|
if (preferences.nameLabels?.length) {
|
||||||
|
for (const nl of preferences.nameLabels) {
|
||||||
|
if (!nl.enabled) continue
|
||||||
|
try {
|
||||||
|
const labelName = `MailFlow/Team/${nl.name}`
|
||||||
|
const label = await gmail.createLabel(labelName, '#4a86e8')
|
||||||
|
if (label) {
|
||||||
|
nameLabelMap[nl.id || nl.name] = label.id
|
||||||
|
if (nl.name !== (nl.id || nl.name)) nameLabelMap[nl.name] = label.id
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
log.warn(`Failed to create name label: ${nl.name}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch and process ALL emails with pagination
|
// Fetch and process ALL emails with pagination
|
||||||
let pageToken = null
|
let pageToken = null
|
||||||
let totalProcessed = 0
|
let totalProcessed = 0
|
||||||
@@ -518,6 +571,7 @@ router.post('/sort',
|
|||||||
|
|
||||||
let category = null
|
let category = null
|
||||||
let companyLabel = null
|
let companyLabel = null
|
||||||
|
let assignedTo = null
|
||||||
let skipAI = false
|
let skipAI = false
|
||||||
|
|
||||||
// PRIORITY 1: Check custom company labels
|
// PRIORITY 1: Check custom company labels
|
||||||
@@ -548,6 +602,7 @@ router.post('/sort',
|
|||||||
if (!skipAI) {
|
if (!skipAI) {
|
||||||
const classification = await sorter.categorize(emailData, preferences)
|
const classification = await sorter.categorize(emailData, preferences)
|
||||||
category = classification.category
|
category = classification.category
|
||||||
|
assignedTo = classification.assignedTo || null
|
||||||
|
|
||||||
// If category is disabled, fallback to review
|
// If category is disabled, fallback to review
|
||||||
if (!enabledCategories.includes(category)) {
|
if (!enabledCategories.includes(category)) {
|
||||||
@@ -559,6 +614,7 @@ router.post('/sort',
|
|||||||
email,
|
email,
|
||||||
category,
|
category,
|
||||||
companyLabel,
|
companyLabel,
|
||||||
|
assignedTo,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Collect samples for suggested rules (first run only, max 50)
|
// Collect samples for suggested rules (first run only, max 50)
|
||||||
@@ -573,7 +629,7 @@ router.post('/sort',
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply labels/categories and actions
|
// Apply labels/categories and actions
|
||||||
for (const { email, category, companyLabel } of processedEmails) {
|
for (const { email, category, companyLabel, assignedTo } of processedEmails) {
|
||||||
const action = sorter.getCategoryAction(category, preferences)
|
const action = sorter.getCategoryAction(category, preferences)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -585,6 +641,11 @@ router.post('/sort',
|
|||||||
labelsToAdd.push(companyLabelMap[companyLabel])
|
labelsToAdd.push(companyLabelMap[companyLabel])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add name label (worker) if AI assigned email to a person
|
||||||
|
if (assignedTo && nameLabelMap[assignedTo]) {
|
||||||
|
labelsToAdd.push(nameLabelMap[assignedTo])
|
||||||
|
}
|
||||||
|
|
||||||
// Add category label/category
|
// Add category label/category
|
||||||
if (labelMap[category]) {
|
if (labelMap[category]) {
|
||||||
labelsToAdd.push(labelMap[category])
|
labelsToAdd.push(labelMap[category])
|
||||||
@@ -794,6 +855,160 @@ router.post('/sort',
|
|||||||
throw new ValidationError(`Outlook error: ${err.message}. Please reconnect account.`)
|
throw new ValidationError(`Outlook error: ${err.message}. Please reconnect account.`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
|
// IMAP (Porkbun, Nextcloud mail backend, etc.)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
|
else if (account.provider === 'imap') {
|
||||||
|
if (!features.ai()) {
|
||||||
|
throw new ValidationError('AI sorting is not configured. Please set MISTRAL_API_KEY.')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!account.accessToken) {
|
||||||
|
throw new ValidationError('IMAP account needs to be reconnected (password missing)')
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info(`IMAP sorting started for ${account.email}`)
|
||||||
|
|
||||||
|
const { ImapService, getFolderNameForCategory } = await import('../services/imap.mjs')
|
||||||
|
const imap = new ImapService({
|
||||||
|
host: account.imapHost || 'imap.porkbun.com',
|
||||||
|
port: account.imapPort != null ? account.imapPort : 993,
|
||||||
|
secure: account.imapSecure !== false,
|
||||||
|
user: account.email,
|
||||||
|
password: account.accessToken,
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
await imap.connect()
|
||||||
|
|
||||||
|
const enabledCategories = sorter.getEnabledCategories(preferences)
|
||||||
|
// Name labels (workers): create Team subfolders for IMAP/Nextcloud
|
||||||
|
const nameLabelMap = {}
|
||||||
|
if (preferences.nameLabels?.length) {
|
||||||
|
for (const nl of preferences.nameLabels) {
|
||||||
|
if (!nl.enabled) continue
|
||||||
|
const folderName = `Team/${nl.name}`
|
||||||
|
try {
|
||||||
|
await imap.ensureFolder(folderName)
|
||||||
|
nameLabelMap[nl.id || nl.name] = folderName
|
||||||
|
if (nl.name !== (nl.id || nl.name)) nameLabelMap[nl.name] = folderName
|
||||||
|
} catch (err) {
|
||||||
|
log.warn(`IMAP name label folder failed: ${nl.name}`, { error: err.message })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let pageToken = null
|
||||||
|
let totalProcessed = 0
|
||||||
|
const batchSize = 100
|
||||||
|
|
||||||
|
do {
|
||||||
|
const { messages, nextPageToken } = await imap.listEmails(batchSize, pageToken)
|
||||||
|
pageToken = nextPageToken
|
||||||
|
|
||||||
|
if (!messages?.length) break
|
||||||
|
|
||||||
|
const emails = await imap.batchGetEmails(messages.map((m) => m.id))
|
||||||
|
const processedEmails = []
|
||||||
|
|
||||||
|
for (const email of emails) {
|
||||||
|
const emailData = {
|
||||||
|
from: email.headers?.from || '',
|
||||||
|
subject: email.headers?.subject || '',
|
||||||
|
snippet: email.snippet || '',
|
||||||
|
}
|
||||||
|
|
||||||
|
let category = null
|
||||||
|
let companyLabel = null
|
||||||
|
let assignedTo = null
|
||||||
|
let skipAI = false
|
||||||
|
|
||||||
|
if (preferences.companyLabels?.length) {
|
||||||
|
for (const companyLabelConfig of preferences.companyLabels) {
|
||||||
|
if (!companyLabelConfig.enabled) continue
|
||||||
|
if (sorter.matchesCompanyLabel(emailData, companyLabelConfig)) {
|
||||||
|
category = companyLabelConfig.category || 'promotions'
|
||||||
|
companyLabel = companyLabelConfig.name
|
||||||
|
skipAI = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skipAI && preferences.autoDetectCompanies) {
|
||||||
|
const detected = sorter.detectCompany(emailData)
|
||||||
|
if (detected) {
|
||||||
|
category = 'promotions'
|
||||||
|
companyLabel = detected.label
|
||||||
|
skipAI = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skipAI) {
|
||||||
|
const classification = await sorter.categorize(emailData, preferences)
|
||||||
|
category = classification.category
|
||||||
|
assignedTo = classification.assignedTo || null
|
||||||
|
if (!enabledCategories.includes(category)) category = 'review'
|
||||||
|
}
|
||||||
|
|
||||||
|
processedEmails.push({ email, category, companyLabel, assignedTo })
|
||||||
|
|
||||||
|
if (isFirstRun && emailSamples.length < 50) {
|
||||||
|
emailSamples.push({
|
||||||
|
from: emailData.from,
|
||||||
|
subject: emailData.subject,
|
||||||
|
snippet: emailData.snippet,
|
||||||
|
category,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const actionMap = sorter.getCategoryAction ? (cat) => sorter.getCategoryAction(cat, preferences) : () => 'inbox'
|
||||||
|
|
||||||
|
for (const { email, category, companyLabel, assignedTo } of processedEmails) {
|
||||||
|
try {
|
||||||
|
const action = actionMap(category)
|
||||||
|
// If AI assigned to a worker, move to Team/<Name> folder; else use category folder
|
||||||
|
const folderName = (assignedTo && nameLabelMap[assignedTo])
|
||||||
|
? nameLabelMap[assignedTo]
|
||||||
|
: getFolderNameForCategory(companyLabel ? (preferences.companyLabels?.find((c) => c.name === companyLabel)?.category || 'promotions') : category)
|
||||||
|
|
||||||
|
await imap.moveToFolder(email.id, folderName)
|
||||||
|
|
||||||
|
if (action === 'archive_read') {
|
||||||
|
try {
|
||||||
|
await imap.markAsRead(email.id)
|
||||||
|
} catch {
|
||||||
|
// already moved; mark as read optional
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sortedCount++
|
||||||
|
results.byCategory[category] = (results.byCategory[category] || 0) + 1
|
||||||
|
} catch (err) {
|
||||||
|
log.warn(`IMAP sort failed: ${email.id}`, { error: err.message })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
totalProcessed += emails.length
|
||||||
|
log.info(`IMAP processed ${totalProcessed} emails so far...`)
|
||||||
|
|
||||||
|
if (totalProcessed >= effectiveMax) break
|
||||||
|
if (pageToken) await new Promise((r) => setTimeout(r, 200))
|
||||||
|
} while (pageToken && processAll)
|
||||||
|
|
||||||
|
await imap.close()
|
||||||
|
log.success(`IMAP sorting completed: ${sortedCount} emails processed`)
|
||||||
|
} catch (err) {
|
||||||
|
try {
|
||||||
|
await imap.close()
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
log.error('IMAP sorting failed', { error: err.message })
|
||||||
|
throw new ValidationError(`IMAP error: ${err.message}. Check credentials or reconnect.`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update last sync
|
// Update last sync
|
||||||
await emailAccounts.updateLastSync(accountId)
|
await emailAccounts.updateLastSync(accountId)
|
||||||
@@ -988,7 +1203,7 @@ router.post('/sort-demo', asyncHandler(async (req, res) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* POST /api/email/cleanup
|
* POST /api/email/cleanup
|
||||||
* Cleanup old EmailSorter labels from Gmail
|
* Cleanup old MailFlow labels from Gmail
|
||||||
*/
|
*/
|
||||||
router.post('/cleanup',
|
router.post('/cleanup',
|
||||||
validate({
|
validate({
|
||||||
@@ -1020,7 +1235,7 @@ router.post('/cleanup',
|
|||||||
respond.success(res, {
|
respond.success(res, {
|
||||||
deleted,
|
deleted,
|
||||||
message: deleted > 0
|
message: deleted > 0
|
||||||
? `${deleted} old "EmailSorter/..." labels were deleted`
|
? `${deleted} old "MailFlow/..." labels were deleted`
|
||||||
: 'No old labels found'
|
: 'No old labels found'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1334,8 +1549,8 @@ async function processPromotionsCleanup(account, action, deleteAfterDays, matchC
|
|||||||
const gmail = await getGmailService(account.accessToken, account.refreshToken)
|
const gmail = await getGmailService(account.accessToken, account.refreshToken)
|
||||||
|
|
||||||
// Find emails with matching categories/labels older than deleteAfterDays
|
// Find emails with matching categories/labels older than deleteAfterDays
|
||||||
// Look for emails with EmailSorter labels matching the categories
|
// Look for emails with MailFlow labels matching the categories
|
||||||
const labelQueries = matchCategories.map(cat => `label:EmailSorter/${cat}`).join(' OR ')
|
const labelQueries = matchCategories.map(cat => `label:MailFlow/${cat}`).join(' OR ')
|
||||||
const query = `(${labelQueries}) before:${cutoffDate.getFullYear()}/${String(cutoffDate.getMonth() + 1).padStart(2, '0')}/${String(cutoffDate.getDate()).padStart(2, '0')}`
|
const query = `(${labelQueries}) before:${cutoffDate.getFullYear()}/${String(cutoffDate.getMonth() + 1).padStart(2, '0')}/${String(cutoffDate.getDate()).padStart(2, '0')}`
|
||||||
|
|
||||||
const response = await gmail.gmail.users.messages.list({
|
const response = await gmail.gmail.users.messages.list({
|
||||||
|
|||||||
125
server/routes/webhook.mjs
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/**
|
||||||
|
* Webhook Routes (Gitea etc.)
|
||||||
|
* Production: https://emailsorter.webklar.com/api/webhook/gitea
|
||||||
|
* POST /api/webhook/gitea - Deployment on push (validates Bearer or X-Gitea-Signature)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import express from 'express'
|
||||||
|
import crypto from 'crypto'
|
||||||
|
import { asyncHandler, AuthorizationError } from '../middleware/errorHandler.mjs'
|
||||||
|
import { config } from '../config/index.mjs'
|
||||||
|
import { log } from '../middleware/logger.mjs'
|
||||||
|
|
||||||
|
const router = express.Router()
|
||||||
|
const secret = config.gitea.webhookSecret
|
||||||
|
const authToken = config.gitea.webhookAuthToken
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate Gitea webhook request:
|
||||||
|
* - Authorization: Bearer <secret|authToken> (Gitea 1.19+ or manual calls)
|
||||||
|
* - X-Gitea-Signature: HMAC-SHA256 hex of raw body (Gitea default)
|
||||||
|
*/
|
||||||
|
function validateGiteaWebhook(req) {
|
||||||
|
const rawBody = req.body
|
||||||
|
if (!rawBody || !Buffer.isBuffer(rawBody)) {
|
||||||
|
throw new AuthorizationError('Raw body fehlt (Webhook-Route muss vor JSON-Parser registriert sein)')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1) Bearer token (Header)
|
||||||
|
const authHeader = req.get('Authorization')
|
||||||
|
if (authHeader && authHeader.startsWith('Bearer ')) {
|
||||||
|
const token = authHeader.slice(7).trim()
|
||||||
|
const expected = authToken || secret
|
||||||
|
if (expected && token === expected) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) X-Gitea-Signature (HMAC-SHA256 hex)
|
||||||
|
const signatureHeader = req.get('X-Gitea-Signature')
|
||||||
|
if (signatureHeader && secret) {
|
||||||
|
try {
|
||||||
|
const expectedHex = crypto.createHmac('sha256', secret).update(rawBody).digest('hex')
|
||||||
|
const received = signatureHeader.trim()
|
||||||
|
const receivedHex = received.startsWith('sha256=') ? received.slice(7) : received
|
||||||
|
if (expectedHex.length === receivedHex.length && expectedHex.length > 0) {
|
||||||
|
const a = Buffer.from(expectedHex, 'hex')
|
||||||
|
const b = Buffer.from(receivedHex, 'hex')
|
||||||
|
if (a.length === b.length && crypto.timingSafeEqual(a, b)) return true
|
||||||
|
}
|
||||||
|
} catch (_) {
|
||||||
|
// invalid hex or comparison error – fall through to reject
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!secret && !authToken) {
|
||||||
|
throw new AuthorizationError('GITEA_WEBHOOK_SECRET nicht konfiguriert')
|
||||||
|
}
|
||||||
|
throw new AuthorizationError('Ungültige Webhook-Signatur oder fehlender Authorization-Header')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/webhook/gitea
|
||||||
|
* Gitea push webhook – validates Bearer or X-Gitea-Signature, then accepts event
|
||||||
|
*/
|
||||||
|
router.post('/gitea', asyncHandler(async (req, res) => {
|
||||||
|
try {
|
||||||
|
validateGiteaWebhook(req)
|
||||||
|
} catch (err) {
|
||||||
|
if (err.name === 'AuthorizationError' || err.statusCode === 401) throw err
|
||||||
|
log.error('Gitea Webhook: Validierung fehlgeschlagen', { error: err.message })
|
||||||
|
return res.status(401).json({ error: 'Webhook validation failed' })
|
||||||
|
}
|
||||||
|
|
||||||
|
let payload
|
||||||
|
try {
|
||||||
|
const raw = req.body && typeof req.body.toString === 'function' ? req.body.toString('utf8') : ''
|
||||||
|
payload = raw ? JSON.parse(raw) : {}
|
||||||
|
} catch (e) {
|
||||||
|
log.warn('Gitea Webhook: ungültiges JSON', { error: e.message })
|
||||||
|
return res.status(400).json({ error: 'Invalid JSON body' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const ref = payload.ref || ''
|
||||||
|
const branch = ref.replace(/^refs\/heads\//, '')
|
||||||
|
const event = req.get('X-Gitea-Event') || 'push'
|
||||||
|
log.info('Gitea Webhook empfangen', { ref, branch, event })
|
||||||
|
|
||||||
|
// Optional: trigger deploy script in background (do not block response)
|
||||||
|
setImmediate(async () => {
|
||||||
|
try {
|
||||||
|
const { spawn } = await import('child_process')
|
||||||
|
const { fileURLToPath } = await import('url')
|
||||||
|
const { dirname, join } = await import('path')
|
||||||
|
const { existsSync } = await import('fs')
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
|
const deployScript = join(__dirname, '..', '..', 'scripts', 'deploy-to-server.mjs')
|
||||||
|
if (existsSync(deployScript)) {
|
||||||
|
const child = spawn('node', [deployScript], {
|
||||||
|
cwd: join(__dirname, '..', '..'),
|
||||||
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
|
detached: true,
|
||||||
|
})
|
||||||
|
child.unref()
|
||||||
|
child.stdout?.on('data', (d) => log.info('Deploy stdout:', d.toString().trim()))
|
||||||
|
child.stderr?.on('data', (d) => log.warn('Deploy stderr:', d.toString().trim()))
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
})
|
||||||
|
|
||||||
|
res.status(202).json({ received: true, ref, branch })
|
||||||
|
}))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/webhook/status
|
||||||
|
* Simple status for webhook endpoint (e.g. health check)
|
||||||
|
*/
|
||||||
|
router.get('/status', (req, res) => {
|
||||||
|
res.json({
|
||||||
|
ok: true,
|
||||||
|
webhook: 'gitea',
|
||||||
|
configured: Boolean(secret || authToken),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
export default router
|
||||||
75
server/scripts/create-admin-user.mjs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* Create admin user in Appwrite (e.g. support@webklar.com).
|
||||||
|
* Requires: APPWRITE_* env vars. Optionally ADMIN_INITIAL_PASSWORD (otherwise one is generated).
|
||||||
|
* After creation, add the email to ADMIN_EMAILS in .env so the backend treats them as admin.
|
||||||
|
*
|
||||||
|
* Usage: node scripts/create-admin-user.mjs [email]
|
||||||
|
* Default email: support@webklar.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'dotenv/config'
|
||||||
|
import { Client, Users, ID } from 'node-appwrite'
|
||||||
|
|
||||||
|
const ADMIN_EMAIL = process.argv[2] || 'support@webklar.com'
|
||||||
|
const ADMIN_NAME = 'Support (Admin)'
|
||||||
|
|
||||||
|
const required = ['APPWRITE_ENDPOINT', 'APPWRITE_PROJECT_ID', 'APPWRITE_API_KEY']
|
||||||
|
for (const k of required) {
|
||||||
|
if (!process.env[k]) {
|
||||||
|
console.error(`Missing env: ${k}`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let password = process.env.ADMIN_INITIAL_PASSWORD
|
||||||
|
if (!password || password.length < 8) {
|
||||||
|
const bytes = new Uint8Array(12)
|
||||||
|
if (typeof globalThis.crypto !== 'undefined' && globalThis.crypto.getRandomValues) {
|
||||||
|
globalThis.crypto.getRandomValues(bytes)
|
||||||
|
} else {
|
||||||
|
const { randomFillSync } = await import('node:crypto')
|
||||||
|
randomFillSync(bytes)
|
||||||
|
}
|
||||||
|
password =
|
||||||
|
Array.from(bytes).map((b) => 'abcdefghjkmnpqrstuvwxyz23456789'[b % 32]).join('') + 'A1!'
|
||||||
|
console.log('No ADMIN_INITIAL_PASSWORD set – using generated password (save it!):')
|
||||||
|
console.log(' ' + password)
|
||||||
|
console.log('')
|
||||||
|
}
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint(process.env.APPWRITE_ENDPOINT)
|
||||||
|
.setProject(process.env.APPWRITE_PROJECT_ID)
|
||||||
|
.setKey(process.env.APPWRITE_API_KEY)
|
||||||
|
|
||||||
|
const users = new Users(client)
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
try {
|
||||||
|
const existing = await users.list([], ADMIN_EMAIL)
|
||||||
|
const found = existing.users?.find((u) => u.email?.toLowerCase() === ADMIN_EMAIL.toLowerCase())
|
||||||
|
if (found) {
|
||||||
|
console.log(`User already exists: ${ADMIN_EMAIL} (ID: ${found.$id})`)
|
||||||
|
console.log('Add to server/.env: ADMIN_EMAILS=' + ADMIN_EMAIL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await users.create(ID.unique(), ADMIN_EMAIL, undefined, password, ADMIN_NAME)
|
||||||
|
|
||||||
|
console.log('Admin user created:')
|
||||||
|
console.log(' Email:', user.email)
|
||||||
|
console.log(' ID:', user.$id)
|
||||||
|
console.log(' Name:', user.name)
|
||||||
|
console.log('')
|
||||||
|
console.log('Add to server/.env: ADMIN_EMAILS=' + ADMIN_EMAIL)
|
||||||
|
console.log('Then the backend will treat this user as admin (isAdmin() returns true).')
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error:', err.message || err)
|
||||||
|
if (err.code === 409) {
|
||||||
|
console.error('User with this email may already exist. Check Appwrite Console → Auth → Users.')
|
||||||
|
}
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
@@ -417,7 +417,8 @@ Subject: ${subject}
|
|||||||
Preview: ${snippet?.substring(0, 500) || 'No preview'}
|
Preview: ${snippet?.substring(0, 500) || 'No preview'}
|
||||||
|
|
||||||
RESPONSE FORMAT (JSON ONLY):
|
RESPONSE FORMAT (JSON ONLY):
|
||||||
{"category": "category_key", "confidence": 0.0-1.0, "reason": "brief explanation"}
|
{"category": "category_key", "confidence": 0.0-1.0, "reason": "brief explanation", "assignedTo": "name_label_id_or_name_or_null"}
|
||||||
|
If the email is clearly FOR a specific worker (e.g. "für Max", "an Anna", subject/body mentions them), set assignedTo to that worker's id or name. Otherwise set assignedTo to null or omit it.
|
||||||
|
|
||||||
Respond ONLY with the JSON object.`
|
Respond ONLY with the JSON object.`
|
||||||
|
|
||||||
@@ -438,6 +439,15 @@ Respond ONLY with the JSON object.`
|
|||||||
result.category = 'review'
|
result.category = 'review'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate assignedTo against name labels (id or name)
|
||||||
|
if (result.assignedTo && preferences.nameLabels?.length) {
|
||||||
|
const match = preferences.nameLabels.find(
|
||||||
|
l => l.enabled && (l.id === result.assignedTo || l.name === result.assignedTo)
|
||||||
|
)
|
||||||
|
if (!match) result.assignedTo = null
|
||||||
|
else result.assignedTo = match.id || match.name
|
||||||
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error('AI categorization failed', { error: error.message })
|
log.error('AI categorization failed', { error: error.message })
|
||||||
@@ -484,7 +494,8 @@ EMAILS:
|
|||||||
${emailList}
|
${emailList}
|
||||||
|
|
||||||
RESPONSE FORMAT (JSON ARRAY ONLY):
|
RESPONSE FORMAT (JSON ARRAY ONLY):
|
||||||
[{"index": 0, "category": "key"}, {"index": 1, "category": "key"}, ...]
|
[{"index": 0, "category": "key", "assignedTo": "id_or_name_or_null"}, ...]
|
||||||
|
If an email is clearly FOR a specific worker, set assignedTo to that worker's id or name. Otherwise omit or null.
|
||||||
|
|
||||||
Respond ONLY with the JSON array.`
|
Respond ONLY with the JSON array.`
|
||||||
|
|
||||||
@@ -515,9 +526,16 @@ Respond ONLY with the JSON array.`
|
|||||||
return emails.map((email, i) => {
|
return emails.map((email, i) => {
|
||||||
const result = parsed.find(r => r.index === i)
|
const result = parsed.find(r => r.index === i)
|
||||||
const category = result?.category && CATEGORIES[result.category] ? result.category : 'review'
|
const category = result?.category && CATEGORIES[result.category] ? result.category : 'review'
|
||||||
|
let assignedTo = result?.assignedTo || null
|
||||||
|
if (assignedTo && preferences.nameLabels?.length) {
|
||||||
|
const match = preferences.nameLabels.find(
|
||||||
|
l => l.enabled && (l.id === assignedTo || l.name === assignedTo)
|
||||||
|
)
|
||||||
|
assignedTo = match ? (match.id || match.name) : null
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
email,
|
email,
|
||||||
classification: { category, confidence: 0.8, reason: 'Batch' },
|
classification: { category, confidence: 0.8, reason: 'Batch', assignedTo },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -578,6 +596,14 @@ Respond ONLY with the JSON array.`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Name labels (workers) – assign email to a person when clearly for them
|
||||||
|
if (preferences.nameLabels?.length) {
|
||||||
|
const activeNameLabels = preferences.nameLabels.filter(l => l.enabled)
|
||||||
|
if (activeNameLabels.length > 0) {
|
||||||
|
parts.push(`NAME LABELS (workers) – assign email to ONE person when the email is clearly FOR that person (e.g. "für Max", "an Anna", "Max bitte prüfen", subject/body mentions them):\n${activeNameLabels.map(l => `- id: "${l.id}", name: "${l.name}"${l.keywords?.length ? `, keywords: ${JSON.stringify(l.keywords)}` : ''}`).join('\n')}\nIf the email is for a specific worker, set "assignedTo" to that label's id or name. Otherwise omit assignedTo.`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return parts.length > 0 ? `USER PREFERENCES:\n${parts.join('\n')}\n` : ''
|
return parts.length > 0 ? `USER PREFERENCES:\n${parts.join('\n')}\n` : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ export const userPreferences = {
|
|||||||
enabledCategories: ['vip', 'customers', 'invoices', 'newsletters', 'promotions', 'social', 'security', 'calendar', 'review'],
|
enabledCategories: ['vip', 'customers', 'invoices', 'newsletters', 'promotions', 'social', 'security', 'calendar', 'review'],
|
||||||
categoryActions: {},
|
categoryActions: {},
|
||||||
companyLabels: [],
|
companyLabels: [],
|
||||||
|
nameLabels: [],
|
||||||
autoDetectCompanies: true,
|
autoDetectCompanies: true,
|
||||||
version: 1,
|
version: 1,
|
||||||
categoryAdvanced: {},
|
categoryAdvanced: {},
|
||||||
@@ -410,6 +411,7 @@ export const userPreferences = {
|
|||||||
enabledCategories: preferences.enabledCategories || defaults.enabledCategories,
|
enabledCategories: preferences.enabledCategories || defaults.enabledCategories,
|
||||||
categoryActions: preferences.categoryActions || defaults.categoryActions,
|
categoryActions: preferences.categoryActions || defaults.categoryActions,
|
||||||
companyLabels: preferences.companyLabels || defaults.companyLabels,
|
companyLabels: preferences.companyLabels || defaults.companyLabels,
|
||||||
|
nameLabels: preferences.nameLabels || defaults.nameLabels,
|
||||||
autoDetectCompanies: preferences.autoDetectCompanies !== undefined ? preferences.autoDetectCompanies : defaults.autoDetectCompanies,
|
autoDetectCompanies: preferences.autoDetectCompanies !== undefined ? preferences.autoDetectCompanies : defaults.autoDetectCompanies,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||