@hed-hog/core 0.0.297 → 0.0.299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth.controller.d.ts +10 -10
- package/dist/auth/auth.service.d.ts +10 -10
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +3 -0
- package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.d.ts +3 -0
- package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +12 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js +22 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +15 -0
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +110 -3
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +1 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js +5 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +1 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.js +5 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +21 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +9 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.module.js +6 -1
- package/dist/dashboard/dashboard-core/dashboard-core.module.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +180 -2
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +619 -9
- package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +1 -0
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
- package/dist/file/file.controller.d.ts.map +1 -1
- package/dist/file/file.controller.js +16 -0
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +7 -1
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +38 -1
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts +1 -0
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +38 -29
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts.map +1 -1
- package/dist/oauth/oauth.service.js +2 -1
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/user/constants/user.constants.d.ts +1 -0
- package/dist/user/constants/user.constants.d.ts.map +1 -1
- package/dist/user/constants/user.constants.js +2 -1
- package/dist/user/constants/user.constants.js.map +1 -1
- package/dist/user/user.controller.d.ts +10 -10
- package/dist/user/user.service.d.ts +30 -30
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +2 -1
- package/dist/user/user.service.js.map +1 -1
- package/hedhog/data/dashboard_item.yaml +10 -10
- package/hedhog/data/route.yaml +20 -0
- package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +212 -34
- package/hedhog/frontend/app/dashboard/[slug]/types.ts.ejs +3 -0
- package/hedhog/frontend/app/dashboard/[slug]/widget-renderer.tsx.ejs +136 -23
- package/hedhog/frontend/app/dashboard/components/add-widget-selector-dialog.tsx.ejs +266 -85
- package/hedhog/frontend/app/dashboard/components/widgets/core..gitkeep.ejs +11 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.account-security.tsx.ejs +192 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.email-notifications.tsx.ejs +226 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.locale-config.tsx.ejs +168 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.mail-config.tsx.ejs +199 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.oauth-config.tsx.ejs +175 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.profile-card.tsx.ejs +186 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.storage-config.tsx.ejs +196 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.theme-config.tsx.ejs +213 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.user-roles.tsx.ejs +132 -0
- package/hedhog/frontend/app/dashboard/components/widgets/core.user-sessions.tsx.ejs +236 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.alerts.tsx.ejs +108 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.cash-balance-kpi.tsx.ejs +66 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.cash-flow-chart.tsx.ejs +122 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.default-kpi.tsx.ejs +63 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.payable-30d-kpi.tsx.ejs +73 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.receivable-30d-kpi.tsx.ejs +73 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.upcoming-payable.tsx.ejs +123 -0
- package/hedhog/frontend/app/dashboard/components/widgets/finance.upcoming-receivable.tsx.ejs +118 -0
- package/hedhog/frontend/messages/en.json +93 -0
- package/hedhog/frontend/messages/pt.json +93 -0
- package/hedhog/frontend/public/dashboard-previews/.gitkeep +12 -0
- package/hedhog/frontend/public/dashboard-previews/account-security.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/active-users-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/activity-timeline.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/cash-balance-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/cash-flow-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/default-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/email-notifications.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/financial-alerts.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/login-history-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/mail-sent-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/mail-sent-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/menus-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/payable-30d-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/permissions-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/permissions-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/profile-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/receivable-30d-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/routes-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/session-activity-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/sessions-today-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-access-level.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-actions-today.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-consecutive-days.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-online-time.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/upcoming-payable.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/upcoming-receivable.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/user-growth-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/user-roles.png +0 -0
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/account-security.tsx.ejs +33 -29
- package/hedhog/frontend/widgets/active-users-card.tsx.ejs +58 -0
- package/hedhog/frontend/widgets/activity-timeline.tsx.ejs +223 -0
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/email-notifications.tsx.ejs +85 -61
- package/hedhog/frontend/widgets/locale-config.tsx.ejs +168 -0
- package/hedhog/frontend/widgets/login-history-chart.tsx.ejs +115 -0
- package/hedhog/frontend/widgets/mail-config.tsx.ejs +199 -0
- package/hedhog/frontend/widgets/mail-sent-card.tsx.ejs +58 -0
- package/hedhog/frontend/widgets/mail-sent-chart.tsx.ejs +149 -0
- package/hedhog/frontend/widgets/menus-card.tsx.ejs +58 -0
- package/hedhog/frontend/widgets/oauth-config.tsx.ejs +175 -0
- package/hedhog/frontend/widgets/permissions-card.tsx.ejs +61 -0
- package/hedhog/frontend/widgets/permissions-chart.tsx.ejs +156 -0
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/profile-card.tsx.ejs +3 -3
- package/hedhog/frontend/widgets/routes-card.tsx.ejs +58 -0
- package/hedhog/frontend/widgets/session-activity-chart.tsx.ejs +183 -0
- package/hedhog/frontend/widgets/sessions-today-card.tsx.ejs +62 -0
- package/hedhog/frontend/widgets/stat-access-level.tsx.ejs +57 -0
- package/hedhog/frontend/widgets/stat-actions-today.tsx.ejs +57 -0
- package/hedhog/frontend/widgets/stat-consecutive-days.tsx.ejs +57 -0
- package/hedhog/frontend/widgets/stat-online-time.tsx.ejs +57 -0
- package/hedhog/frontend/widgets/storage-config.tsx.ejs +196 -0
- package/hedhog/frontend/widgets/theme-config.tsx.ejs +213 -0
- package/hedhog/frontend/widgets/user-growth-chart.tsx.ejs +210 -0
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-roles.tsx.ejs +12 -14
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-sessions.tsx.ejs +1 -1
- package/hedhog/table/dashboard_component.yaml +7 -0
- package/hedhog/table/mail_sent_user.yaml +75 -0
- package/package.json +4 -4
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +36 -12
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +150 -3
- package/src/dashboard/dashboard-component/dto/create.dto.ts +4 -0
- package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -0
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +5 -0
- package/src/dashboard/dashboard-core/dashboard-core.module.ts +6 -1
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +874 -8
- package/src/file/file.controller.ts +37 -13
- package/src/file/file.service.ts +47 -5
- package/src/file/provider/s3.provider.ts +39 -29
- package/src/oauth/oauth.service.ts +8 -7
- package/src/user/constants/user.constants.ts +1 -0
- package/src/user/user.service.ts +2 -1
- package/hedhog/frontend/app/dashboard/components/widgets/locale-config.tsx.ejs +0 -309
- package/hedhog/frontend/app/dashboard/components/widgets/mail-config.tsx.ejs +0 -445
- package/hedhog/frontend/app/dashboard/components/widgets/oauth-config.tsx.ejs +0 -296
- package/hedhog/frontend/app/dashboard/components/widgets/storage-config.tsx.ejs +0 -340
- package/hedhog/frontend/app/dashboard/components/widgets/theme-config.tsx.ejs +0 -275
- /package/hedhog/frontend/app/dashboard/components/widgets/{active-users-card.tsx.ejs → core.active-users-card.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{activity-timeline.tsx.ejs → core.activity-timeline.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{login-history-chart.tsx.ejs → core.login-history-chart.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{mail-sent-card.tsx.ejs → core.mail-sent-card.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{mail-sent-chart.tsx.ejs → core.mail-sent-chart.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{menus-card.tsx.ejs → core.menus-card.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{permissions-card.tsx.ejs → core.permissions-card.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{permissions-chart.tsx.ejs → core.permissions-chart.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{routes-card.tsx.ejs → core.routes-card.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{session-activity-chart.tsx.ejs → core.session-activity-chart.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{sessions-today-card.tsx.ejs → core.sessions-today-card.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{stat-access-level.tsx.ejs → core.stat-access-level.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{stat-actions-today.tsx.ejs → core.stat-actions-today.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{stat-consecutive-days.tsx.ejs → core.stat-consecutive-days.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{stat-online-time.tsx.ejs → core.stat-online-time.tsx.ejs} +0 -0
- /package/hedhog/frontend/app/dashboard/components/widgets/{user-growth-chart.tsx.ejs → core.user-growth-chart.tsx.ejs} +0 -0
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Badge } from '@/components/ui/badge';
|
|
4
|
-
import { Button } from '@/components/ui/button';
|
|
5
|
-
import {
|
|
6
|
-
Card,
|
|
7
|
-
CardContent,
|
|
8
|
-
CardDescription,
|
|
9
|
-
CardHeader,
|
|
10
|
-
CardTitle,
|
|
11
|
-
} from '@/components/ui/card';
|
|
12
|
-
import { Input } from '@/components/ui/input';
|
|
13
|
-
import { Label } from '@/components/ui/label';
|
|
14
|
-
import {
|
|
15
|
-
Select,
|
|
16
|
-
SelectContent,
|
|
17
|
-
SelectItem,
|
|
18
|
-
SelectTrigger,
|
|
19
|
-
SelectValue,
|
|
20
|
-
} from '@/components/ui/select';
|
|
21
|
-
import { Switch } from '@/components/ui/switch';
|
|
22
|
-
import { AlertCircle, CheckCircle2, Mail, Send, Server } from 'lucide-react';
|
|
23
|
-
import { useState } from 'react';
|
|
24
|
-
|
|
25
|
-
type EmailProvider = 'smtp' | 'gmail' | 'aws_ses';
|
|
26
|
-
|
|
27
|
-
interface SmtpConfig {
|
|
28
|
-
host: string;
|
|
29
|
-
port: string;
|
|
30
|
-
username: string;
|
|
31
|
-
password: string;
|
|
32
|
-
encryption: 'tls' | 'ssl' | 'none';
|
|
33
|
-
fromName: string;
|
|
34
|
-
fromEmail: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface GmailConfig {
|
|
38
|
-
clientId: string;
|
|
39
|
-
clientSecret: string;
|
|
40
|
-
refreshToken: string;
|
|
41
|
-
fromName: string;
|
|
42
|
-
fromEmail: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface AwsSesConfig {
|
|
46
|
-
accessKeyId: string;
|
|
47
|
-
secretAccessKey: string;
|
|
48
|
-
region: string;
|
|
49
|
-
fromName: string;
|
|
50
|
-
fromEmail: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const initialSmtp: SmtpConfig = {
|
|
54
|
-
host: 'smtp.empresa.com',
|
|
55
|
-
port: '587',
|
|
56
|
-
username: 'noreply@empresa.com',
|
|
57
|
-
password: '',
|
|
58
|
-
encryption: 'tls',
|
|
59
|
-
fromName: 'HeroAdmin',
|
|
60
|
-
fromEmail: 'noreply@empresa.com',
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const initialGmail: GmailConfig = {
|
|
64
|
-
clientId: '',
|
|
65
|
-
clientSecret: '',
|
|
66
|
-
refreshToken: '',
|
|
67
|
-
fromName: 'HeroAdmin',
|
|
68
|
-
fromEmail: '',
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const initialAwsSes: AwsSesConfig = {
|
|
72
|
-
accessKeyId: '',
|
|
73
|
-
secretAccessKey: '',
|
|
74
|
-
region: 'us-east-1',
|
|
75
|
-
fromName: 'HeroAdmin',
|
|
76
|
-
fromEmail: '',
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const providers: {
|
|
80
|
-
value: EmailProvider;
|
|
81
|
-
label: string;
|
|
82
|
-
icon: React.ReactNode;
|
|
83
|
-
description: string;
|
|
84
|
-
}[] = [
|
|
85
|
-
{
|
|
86
|
-
value: 'smtp',
|
|
87
|
-
label: 'SMTP',
|
|
88
|
-
icon: <Server className="h-4 w-4" />,
|
|
89
|
-
description: 'Servidor SMTP personalizado',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
value: 'gmail',
|
|
93
|
-
label: 'Gmail',
|
|
94
|
-
icon: <Mail className="h-4 w-4" />,
|
|
95
|
-
description: 'API do Google Gmail',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
value: 'aws_ses',
|
|
99
|
-
label: 'AWS SES',
|
|
100
|
-
icon: <Send className="h-4 w-4" />,
|
|
101
|
-
description: 'Amazon Simple Email Service',
|
|
102
|
-
},
|
|
103
|
-
];
|
|
104
|
-
|
|
105
|
-
export default function EmailConfig() {
|
|
106
|
-
const [provider, setProvider] = useState<EmailProvider>('smtp');
|
|
107
|
-
const [smtp, setSmtp] = useState(initialSmtp);
|
|
108
|
-
const [gmail, setGmail] = useState(initialGmail);
|
|
109
|
-
const [awsSes, setAwsSes] = useState(initialAwsSes);
|
|
110
|
-
const [testSent, setTestSent] = useState(false);
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<Card className="h-full">
|
|
114
|
-
<CardHeader>
|
|
115
|
-
<div className="flex items-center justify-between">
|
|
116
|
-
<div className="flex items-center gap-3">
|
|
117
|
-
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-blue-50">
|
|
118
|
-
<Mail className="h-5 w-5 text-blue-600" />
|
|
119
|
-
</div>
|
|
120
|
-
<div>
|
|
121
|
-
<CardTitle className="text-base">Envio de E-mails</CardTitle>
|
|
122
|
-
<CardDescription>
|
|
123
|
-
Configure o provedor de e-mail do sistema
|
|
124
|
-
</CardDescription>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
<Badge variant="secondary" className="bg-emerald-50 text-emerald-700">
|
|
128
|
-
<CheckCircle2 className="mr-1 h-3 w-3" />
|
|
129
|
-
Ativo
|
|
130
|
-
</Badge>
|
|
131
|
-
</div>
|
|
132
|
-
</CardHeader>
|
|
133
|
-
<CardContent className="space-y-6">
|
|
134
|
-
{/* Provider Selector */}
|
|
135
|
-
<div className="grid grid-cols-3 gap-3">
|
|
136
|
-
{providers.map((p) => (
|
|
137
|
-
<button
|
|
138
|
-
key={p.value}
|
|
139
|
-
type="button"
|
|
140
|
-
onClick={() => setProvider(p.value)}
|
|
141
|
-
className={`flex flex-col items-center gap-2 rounded-lg border-2 p-4 text-center transition-all ${
|
|
142
|
-
provider === p.value
|
|
143
|
-
? 'border-foreground bg-foreground/3'
|
|
144
|
-
: 'border-border hover:border-foreground/20'
|
|
145
|
-
}`}
|
|
146
|
-
>
|
|
147
|
-
<div
|
|
148
|
-
className={`flex h-9 w-9 items-center justify-center rounded-full ${
|
|
149
|
-
provider === p.value
|
|
150
|
-
? 'bg-foreground text-background'
|
|
151
|
-
: 'bg-muted text-muted-foreground'
|
|
152
|
-
}`}
|
|
153
|
-
>
|
|
154
|
-
{p.icon}
|
|
155
|
-
</div>
|
|
156
|
-
<span className="text-sm font-medium">{p.label}</span>
|
|
157
|
-
<span className="text-xs text-muted-foreground">
|
|
158
|
-
{p.description}
|
|
159
|
-
</span>
|
|
160
|
-
</button>
|
|
161
|
-
))}
|
|
162
|
-
</div>
|
|
163
|
-
|
|
164
|
-
{/* SMTP Fields */}
|
|
165
|
-
{provider === 'smtp' && (
|
|
166
|
-
<div className="space-y-4">
|
|
167
|
-
<div className="grid gap-4 sm:grid-cols-2">
|
|
168
|
-
<div className="space-y-2">
|
|
169
|
-
<Label htmlFor="smtp-host">Servidor SMTP</Label>
|
|
170
|
-
<Input
|
|
171
|
-
id="smtp-host"
|
|
172
|
-
value={smtp.host}
|
|
173
|
-
onChange={(e) => setSmtp({ ...smtp, host: e.target.value })}
|
|
174
|
-
placeholder="smtp.exemplo.com"
|
|
175
|
-
/>
|
|
176
|
-
</div>
|
|
177
|
-
<div className="space-y-2">
|
|
178
|
-
<Label htmlFor="smtp-port">Porta</Label>
|
|
179
|
-
<Input
|
|
180
|
-
id="smtp-port"
|
|
181
|
-
value={smtp.port}
|
|
182
|
-
onChange={(e) => setSmtp({ ...smtp, port: e.target.value })}
|
|
183
|
-
placeholder="587"
|
|
184
|
-
/>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
<div className="grid gap-4 sm:grid-cols-2">
|
|
188
|
-
<div className="space-y-2">
|
|
189
|
-
<Label htmlFor="smtp-user">Usuario</Label>
|
|
190
|
-
<Input
|
|
191
|
-
id="smtp-user"
|
|
192
|
-
value={smtp.username}
|
|
193
|
-
onChange={(e) =>
|
|
194
|
-
setSmtp({ ...smtp, username: e.target.value })
|
|
195
|
-
}
|
|
196
|
-
/>
|
|
197
|
-
</div>
|
|
198
|
-
<div className="space-y-2">
|
|
199
|
-
<Label htmlFor="smtp-pass">Senha</Label>
|
|
200
|
-
<Input
|
|
201
|
-
id="smtp-pass"
|
|
202
|
-
type="password"
|
|
203
|
-
value={smtp.password}
|
|
204
|
-
onChange={(e) =>
|
|
205
|
-
setSmtp({ ...smtp, password: e.target.value })
|
|
206
|
-
}
|
|
207
|
-
placeholder="********"
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
<div className="space-y-2">
|
|
212
|
-
<Label>Criptografia</Label>
|
|
213
|
-
<Select
|
|
214
|
-
value={smtp.encryption}
|
|
215
|
-
onValueChange={(val: 'tls' | 'ssl' | 'none') =>
|
|
216
|
-
setSmtp({ ...smtp, encryption: val })
|
|
217
|
-
}
|
|
218
|
-
>
|
|
219
|
-
<SelectTrigger>
|
|
220
|
-
<SelectValue />
|
|
221
|
-
</SelectTrigger>
|
|
222
|
-
<SelectContent>
|
|
223
|
-
<SelectItem value="tls">TLS (Recomendado)</SelectItem>
|
|
224
|
-
<SelectItem value="ssl">SSL</SelectItem>
|
|
225
|
-
<SelectItem value="none">Nenhuma</SelectItem>
|
|
226
|
-
</SelectContent>
|
|
227
|
-
</Select>
|
|
228
|
-
</div>
|
|
229
|
-
<div className="grid gap-4 sm:grid-cols-2">
|
|
230
|
-
<div className="space-y-2">
|
|
231
|
-
<Label htmlFor="smtp-from-name">Nome do remetente</Label>
|
|
232
|
-
<Input
|
|
233
|
-
id="smtp-from-name"
|
|
234
|
-
value={smtp.fromName}
|
|
235
|
-
onChange={(e) =>
|
|
236
|
-
setSmtp({ ...smtp, fromName: e.target.value })
|
|
237
|
-
}
|
|
238
|
-
/>
|
|
239
|
-
</div>
|
|
240
|
-
<div className="space-y-2">
|
|
241
|
-
<Label htmlFor="smtp-from-email">E-mail do remetente</Label>
|
|
242
|
-
<Input
|
|
243
|
-
id="smtp-from-email"
|
|
244
|
-
type="email"
|
|
245
|
-
value={smtp.fromEmail}
|
|
246
|
-
onChange={(e) =>
|
|
247
|
-
setSmtp({ ...smtp, fromEmail: e.target.value })
|
|
248
|
-
}
|
|
249
|
-
/>
|
|
250
|
-
</div>
|
|
251
|
-
</div>
|
|
252
|
-
</div>
|
|
253
|
-
)}
|
|
254
|
-
|
|
255
|
-
{/* Gmail Fields */}
|
|
256
|
-
{provider === 'gmail' && (
|
|
257
|
-
<div className="space-y-4">
|
|
258
|
-
<div className="rounded-lg border border-amber-200 bg-amber-50 p-3">
|
|
259
|
-
<div className="flex items-start gap-2">
|
|
260
|
-
<AlertCircle className="mt-0.5 h-4 w-4 text-amber-600" />
|
|
261
|
-
<p className="text-xs text-amber-800">
|
|
262
|
-
Configure as credenciais OAuth2 no Google Cloud Console.
|
|
263
|
-
Habilite a API do Gmail e gere o Client ID e Secret.
|
|
264
|
-
</p>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
<div className="space-y-2">
|
|
268
|
-
<Label htmlFor="gmail-client-id">Client ID</Label>
|
|
269
|
-
<Input
|
|
270
|
-
id="gmail-client-id"
|
|
271
|
-
value={gmail.clientId}
|
|
272
|
-
onChange={(e) =>
|
|
273
|
-
setGmail({ ...gmail, clientId: e.target.value })
|
|
274
|
-
}
|
|
275
|
-
placeholder="xxxxx.apps.googleusercontent.com"
|
|
276
|
-
className="font-mono text-sm"
|
|
277
|
-
/>
|
|
278
|
-
</div>
|
|
279
|
-
<div className="space-y-2">
|
|
280
|
-
<Label htmlFor="gmail-client-secret">Client Secret</Label>
|
|
281
|
-
<Input
|
|
282
|
-
id="gmail-client-secret"
|
|
283
|
-
type="password"
|
|
284
|
-
value={gmail.clientSecret}
|
|
285
|
-
onChange={(e) =>
|
|
286
|
-
setGmail({ ...gmail, clientSecret: e.target.value })
|
|
287
|
-
}
|
|
288
|
-
placeholder="GOCSPX-..."
|
|
289
|
-
className="font-mono text-sm"
|
|
290
|
-
/>
|
|
291
|
-
</div>
|
|
292
|
-
<div className="space-y-2">
|
|
293
|
-
<Label htmlFor="gmail-refresh-token">Refresh Token</Label>
|
|
294
|
-
<Input
|
|
295
|
-
id="gmail-refresh-token"
|
|
296
|
-
type="password"
|
|
297
|
-
value={gmail.refreshToken}
|
|
298
|
-
onChange={(e) =>
|
|
299
|
-
setGmail({ ...gmail, refreshToken: e.target.value })
|
|
300
|
-
}
|
|
301
|
-
className="font-mono text-sm"
|
|
302
|
-
/>
|
|
303
|
-
</div>
|
|
304
|
-
<div className="grid gap-4 sm:grid-cols-2">
|
|
305
|
-
<div className="space-y-2">
|
|
306
|
-
<Label htmlFor="gmail-from-name">Nome do remetente</Label>
|
|
307
|
-
<Input
|
|
308
|
-
id="gmail-from-name"
|
|
309
|
-
value={gmail.fromName}
|
|
310
|
-
onChange={(e) =>
|
|
311
|
-
setGmail({ ...gmail, fromName: e.target.value })
|
|
312
|
-
}
|
|
313
|
-
/>
|
|
314
|
-
</div>
|
|
315
|
-
<div className="space-y-2">
|
|
316
|
-
<Label htmlFor="gmail-from-email">E-mail do remetente</Label>
|
|
317
|
-
<Input
|
|
318
|
-
id="gmail-from-email"
|
|
319
|
-
type="email"
|
|
320
|
-
value={gmail.fromEmail}
|
|
321
|
-
onChange={(e) =>
|
|
322
|
-
setGmail({ ...gmail, fromEmail: e.target.value })
|
|
323
|
-
}
|
|
324
|
-
placeholder="email@gmail.com"
|
|
325
|
-
/>
|
|
326
|
-
</div>
|
|
327
|
-
</div>
|
|
328
|
-
</div>
|
|
329
|
-
)}
|
|
330
|
-
|
|
331
|
-
{/* AWS SES Fields */}
|
|
332
|
-
{provider === 'aws_ses' && (
|
|
333
|
-
<div className="space-y-4">
|
|
334
|
-
<div className="space-y-2">
|
|
335
|
-
<Label htmlFor="ses-access-key">Access Key ID</Label>
|
|
336
|
-
<Input
|
|
337
|
-
id="ses-access-key"
|
|
338
|
-
value={awsSes.accessKeyId}
|
|
339
|
-
onChange={(e) =>
|
|
340
|
-
setAwsSes({ ...awsSes, accessKeyId: e.target.value })
|
|
341
|
-
}
|
|
342
|
-
placeholder="AKIAIOSFODNN7EXAMPLE"
|
|
343
|
-
className="font-mono text-sm"
|
|
344
|
-
/>
|
|
345
|
-
</div>
|
|
346
|
-
<div className="space-y-2">
|
|
347
|
-
<Label htmlFor="ses-secret-key">Secret Access Key</Label>
|
|
348
|
-
<Input
|
|
349
|
-
id="ses-secret-key"
|
|
350
|
-
type="password"
|
|
351
|
-
value={awsSes.secretAccessKey}
|
|
352
|
-
onChange={(e) =>
|
|
353
|
-
setAwsSes({ ...awsSes, secretAccessKey: e.target.value })
|
|
354
|
-
}
|
|
355
|
-
className="font-mono text-sm"
|
|
356
|
-
/>
|
|
357
|
-
</div>
|
|
358
|
-
<div className="space-y-2">
|
|
359
|
-
<Label>Regiao</Label>
|
|
360
|
-
<Select
|
|
361
|
-
value={awsSes.region}
|
|
362
|
-
onValueChange={(val) => setAwsSes({ ...awsSes, region: val })}
|
|
363
|
-
>
|
|
364
|
-
<SelectTrigger>
|
|
365
|
-
<SelectValue />
|
|
366
|
-
</SelectTrigger>
|
|
367
|
-
<SelectContent>
|
|
368
|
-
<SelectItem value="us-east-1">
|
|
369
|
-
US East (N. Virginia)
|
|
370
|
-
</SelectItem>
|
|
371
|
-
<SelectItem value="us-west-2">US West (Oregon)</SelectItem>
|
|
372
|
-
<SelectItem value="eu-west-1">EU (Ireland)</SelectItem>
|
|
373
|
-
<SelectItem value="eu-central-1">EU (Frankfurt)</SelectItem>
|
|
374
|
-
<SelectItem value="sa-east-1">
|
|
375
|
-
South America (Sao Paulo)
|
|
376
|
-
</SelectItem>
|
|
377
|
-
<SelectItem value="ap-southeast-1">
|
|
378
|
-
Asia Pacific (Singapore)
|
|
379
|
-
</SelectItem>
|
|
380
|
-
</SelectContent>
|
|
381
|
-
</Select>
|
|
382
|
-
</div>
|
|
383
|
-
<div className="grid gap-4 sm:grid-cols-2">
|
|
384
|
-
<div className="space-y-2">
|
|
385
|
-
<Label htmlFor="ses-from-name">Nome do remetente</Label>
|
|
386
|
-
<Input
|
|
387
|
-
id="ses-from-name"
|
|
388
|
-
value={awsSes.fromName}
|
|
389
|
-
onChange={(e) =>
|
|
390
|
-
setAwsSes({ ...awsSes, fromName: e.target.value })
|
|
391
|
-
}
|
|
392
|
-
/>
|
|
393
|
-
</div>
|
|
394
|
-
<div className="space-y-2">
|
|
395
|
-
<Label htmlFor="ses-from-email">E-mail do remetente</Label>
|
|
396
|
-
<Input
|
|
397
|
-
id="ses-from-email"
|
|
398
|
-
type="email"
|
|
399
|
-
value={awsSes.fromEmail}
|
|
400
|
-
onChange={(e) =>
|
|
401
|
-
setAwsSes({ ...awsSes, fromEmail: e.target.value })
|
|
402
|
-
}
|
|
403
|
-
placeholder="noreply@seudominio.com"
|
|
404
|
-
/>
|
|
405
|
-
</div>
|
|
406
|
-
</div>
|
|
407
|
-
</div>
|
|
408
|
-
)}
|
|
409
|
-
|
|
410
|
-
{/* Actions */}
|
|
411
|
-
<div className="flex items-center justify-between border-t pt-4">
|
|
412
|
-
<div className="flex items-center gap-2">
|
|
413
|
-
<Switch id="email-active" defaultChecked />
|
|
414
|
-
<Label
|
|
415
|
-
htmlFor="email-active"
|
|
416
|
-
className="text-sm text-muted-foreground"
|
|
417
|
-
>
|
|
418
|
-
Envio de e-mails ativo
|
|
419
|
-
</Label>
|
|
420
|
-
</div>
|
|
421
|
-
<div className="flex gap-2">
|
|
422
|
-
<Button
|
|
423
|
-
variant="outline"
|
|
424
|
-
size="sm"
|
|
425
|
-
onClick={() => {
|
|
426
|
-
setTestSent(true);
|
|
427
|
-
setTimeout(() => setTestSent(false), 3000);
|
|
428
|
-
}}
|
|
429
|
-
>
|
|
430
|
-
{testSent ? (
|
|
431
|
-
<>
|
|
432
|
-
<CheckCircle2 className="mr-1 h-3.5 w-3.5 text-emerald-600" />
|
|
433
|
-
Enviado
|
|
434
|
-
</>
|
|
435
|
-
) : (
|
|
436
|
-
'Enviar teste'
|
|
437
|
-
)}
|
|
438
|
-
</Button>
|
|
439
|
-
<Button size="sm">Salvar</Button>
|
|
440
|
-
</div>
|
|
441
|
-
</div>
|
|
442
|
-
</CardContent>
|
|
443
|
-
</Card>
|
|
444
|
-
);
|
|
445
|
-
}
|