@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.
Files changed (183) hide show
  1. package/dist/auth/auth.controller.d.ts +10 -10
  2. package/dist/auth/auth.service.d.ts +10 -10
  3. package/dist/dashboard/dashboard/dashboard.controller.d.ts +3 -0
  4. package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
  5. package/dist/dashboard/dashboard/dashboard.service.d.ts +3 -0
  6. package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
  7. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +12 -0
  8. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
  9. package/dist/dashboard/dashboard-component/dashboard-component.controller.js +22 -0
  10. package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
  11. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +15 -0
  12. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
  13. package/dist/dashboard/dashboard-component/dashboard-component.service.js +110 -3
  14. package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
  15. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +1 -0
  16. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
  17. package/dist/dashboard/dashboard-component/dto/create.dto.js +5 -0
  18. package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
  19. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +1 -0
  20. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
  21. package/dist/dashboard/dashboard-component/dto/update.dto.js +5 -0
  22. package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
  23. package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +1 -0
  24. package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts.map +1 -1
  25. package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +1 -0
  26. package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts.map +1 -1
  27. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +21 -1
  28. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
  29. package/dist/dashboard/dashboard-core/dashboard-core.controller.js +9 -0
  30. package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
  31. package/dist/dashboard/dashboard-core/dashboard-core.module.d.ts.map +1 -1
  32. package/dist/dashboard/dashboard-core/dashboard-core.module.js +6 -1
  33. package/dist/dashboard/dashboard-core/dashboard-core.module.js.map +1 -1
  34. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +180 -2
  35. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
  36. package/dist/dashboard/dashboard-core/dashboard-core.service.js +619 -9
  37. package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
  38. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +1 -0
  39. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
  40. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +1 -0
  41. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
  42. package/dist/file/file.controller.d.ts.map +1 -1
  43. package/dist/file/file.controller.js +16 -0
  44. package/dist/file/file.controller.js.map +1 -1
  45. package/dist/file/file.service.d.ts +7 -1
  46. package/dist/file/file.service.d.ts.map +1 -1
  47. package/dist/file/file.service.js +38 -1
  48. package/dist/file/file.service.js.map +1 -1
  49. package/dist/file/provider/s3.provider.d.ts +1 -0
  50. package/dist/file/provider/s3.provider.d.ts.map +1 -1
  51. package/dist/file/provider/s3.provider.js +38 -29
  52. package/dist/file/provider/s3.provider.js.map +1 -1
  53. package/dist/oauth/oauth.service.d.ts.map +1 -1
  54. package/dist/oauth/oauth.service.js +2 -1
  55. package/dist/oauth/oauth.service.js.map +1 -1
  56. package/dist/user/constants/user.constants.d.ts +1 -0
  57. package/dist/user/constants/user.constants.d.ts.map +1 -1
  58. package/dist/user/constants/user.constants.js +2 -1
  59. package/dist/user/constants/user.constants.js.map +1 -1
  60. package/dist/user/user.controller.d.ts +10 -10
  61. package/dist/user/user.service.d.ts +30 -30
  62. package/dist/user/user.service.d.ts.map +1 -1
  63. package/dist/user/user.service.js +2 -1
  64. package/dist/user/user.service.js.map +1 -1
  65. package/hedhog/data/dashboard_item.yaml +10 -10
  66. package/hedhog/data/route.yaml +20 -0
  67. package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +212 -34
  68. package/hedhog/frontend/app/dashboard/[slug]/types.ts.ejs +3 -0
  69. package/hedhog/frontend/app/dashboard/[slug]/widget-renderer.tsx.ejs +136 -23
  70. package/hedhog/frontend/app/dashboard/components/add-widget-selector-dialog.tsx.ejs +266 -85
  71. package/hedhog/frontend/app/dashboard/components/widgets/core..gitkeep.ejs +11 -0
  72. package/hedhog/frontend/app/dashboard/components/widgets/core.account-security.tsx.ejs +192 -0
  73. package/hedhog/frontend/app/dashboard/components/widgets/core.email-notifications.tsx.ejs +226 -0
  74. package/hedhog/frontend/app/dashboard/components/widgets/core.locale-config.tsx.ejs +168 -0
  75. package/hedhog/frontend/app/dashboard/components/widgets/core.mail-config.tsx.ejs +199 -0
  76. package/hedhog/frontend/app/dashboard/components/widgets/core.oauth-config.tsx.ejs +175 -0
  77. package/hedhog/frontend/app/dashboard/components/widgets/core.profile-card.tsx.ejs +186 -0
  78. package/hedhog/frontend/app/dashboard/components/widgets/core.storage-config.tsx.ejs +196 -0
  79. package/hedhog/frontend/app/dashboard/components/widgets/core.theme-config.tsx.ejs +213 -0
  80. package/hedhog/frontend/app/dashboard/components/widgets/core.user-roles.tsx.ejs +132 -0
  81. package/hedhog/frontend/app/dashboard/components/widgets/core.user-sessions.tsx.ejs +236 -0
  82. package/hedhog/frontend/app/dashboard/components/widgets/finance.alerts.tsx.ejs +108 -0
  83. package/hedhog/frontend/app/dashboard/components/widgets/finance.cash-balance-kpi.tsx.ejs +66 -0
  84. package/hedhog/frontend/app/dashboard/components/widgets/finance.cash-flow-chart.tsx.ejs +122 -0
  85. package/hedhog/frontend/app/dashboard/components/widgets/finance.default-kpi.tsx.ejs +63 -0
  86. package/hedhog/frontend/app/dashboard/components/widgets/finance.payable-30d-kpi.tsx.ejs +73 -0
  87. package/hedhog/frontend/app/dashboard/components/widgets/finance.receivable-30d-kpi.tsx.ejs +73 -0
  88. package/hedhog/frontend/app/dashboard/components/widgets/finance.upcoming-payable.tsx.ejs +123 -0
  89. package/hedhog/frontend/app/dashboard/components/widgets/finance.upcoming-receivable.tsx.ejs +118 -0
  90. package/hedhog/frontend/messages/en.json +93 -0
  91. package/hedhog/frontend/messages/pt.json +93 -0
  92. package/hedhog/frontend/public/dashboard-previews/.gitkeep +12 -0
  93. package/hedhog/frontend/public/dashboard-previews/account-security.png +0 -0
  94. package/hedhog/frontend/public/dashboard-previews/active-users-card.png +0 -0
  95. package/hedhog/frontend/public/dashboard-previews/activity-timeline.png +0 -0
  96. package/hedhog/frontend/public/dashboard-previews/cash-balance-kpi.png +0 -0
  97. package/hedhog/frontend/public/dashboard-previews/cash-flow-chart.png +0 -0
  98. package/hedhog/frontend/public/dashboard-previews/default-kpi.png +0 -0
  99. package/hedhog/frontend/public/dashboard-previews/email-notifications.png +0 -0
  100. package/hedhog/frontend/public/dashboard-previews/financial-alerts.png +0 -0
  101. package/hedhog/frontend/public/dashboard-previews/login-history-chart.png +0 -0
  102. package/hedhog/frontend/public/dashboard-previews/mail-sent-card.png +0 -0
  103. package/hedhog/frontend/public/dashboard-previews/mail-sent-chart.png +0 -0
  104. package/hedhog/frontend/public/dashboard-previews/menus-card.png +0 -0
  105. package/hedhog/frontend/public/dashboard-previews/payable-30d-kpi.png +0 -0
  106. package/hedhog/frontend/public/dashboard-previews/permissions-card.png +0 -0
  107. package/hedhog/frontend/public/dashboard-previews/permissions-chart.png +0 -0
  108. package/hedhog/frontend/public/dashboard-previews/profile-card.png +0 -0
  109. package/hedhog/frontend/public/dashboard-previews/receivable-30d-kpi.png +0 -0
  110. package/hedhog/frontend/public/dashboard-previews/routes-card.png +0 -0
  111. package/hedhog/frontend/public/dashboard-previews/session-activity-chart.png +0 -0
  112. package/hedhog/frontend/public/dashboard-previews/sessions-today-card.png +0 -0
  113. package/hedhog/frontend/public/dashboard-previews/stat-access-level.png +0 -0
  114. package/hedhog/frontend/public/dashboard-previews/stat-actions-today.png +0 -0
  115. package/hedhog/frontend/public/dashboard-previews/stat-consecutive-days.png +0 -0
  116. package/hedhog/frontend/public/dashboard-previews/stat-online-time.png +0 -0
  117. package/hedhog/frontend/public/dashboard-previews/upcoming-payable.png +0 -0
  118. package/hedhog/frontend/public/dashboard-previews/upcoming-receivable.png +0 -0
  119. package/hedhog/frontend/public/dashboard-previews/user-growth-chart.png +0 -0
  120. package/hedhog/frontend/public/dashboard-previews/user-roles.png +0 -0
  121. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/account-security.tsx.ejs +33 -29
  122. package/hedhog/frontend/widgets/active-users-card.tsx.ejs +58 -0
  123. package/hedhog/frontend/widgets/activity-timeline.tsx.ejs +223 -0
  124. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/email-notifications.tsx.ejs +85 -61
  125. package/hedhog/frontend/widgets/locale-config.tsx.ejs +168 -0
  126. package/hedhog/frontend/widgets/login-history-chart.tsx.ejs +115 -0
  127. package/hedhog/frontend/widgets/mail-config.tsx.ejs +199 -0
  128. package/hedhog/frontend/widgets/mail-sent-card.tsx.ejs +58 -0
  129. package/hedhog/frontend/widgets/mail-sent-chart.tsx.ejs +149 -0
  130. package/hedhog/frontend/widgets/menus-card.tsx.ejs +58 -0
  131. package/hedhog/frontend/widgets/oauth-config.tsx.ejs +175 -0
  132. package/hedhog/frontend/widgets/permissions-card.tsx.ejs +61 -0
  133. package/hedhog/frontend/widgets/permissions-chart.tsx.ejs +156 -0
  134. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/profile-card.tsx.ejs +3 -3
  135. package/hedhog/frontend/widgets/routes-card.tsx.ejs +58 -0
  136. package/hedhog/frontend/widgets/session-activity-chart.tsx.ejs +183 -0
  137. package/hedhog/frontend/widgets/sessions-today-card.tsx.ejs +62 -0
  138. package/hedhog/frontend/widgets/stat-access-level.tsx.ejs +57 -0
  139. package/hedhog/frontend/widgets/stat-actions-today.tsx.ejs +57 -0
  140. package/hedhog/frontend/widgets/stat-consecutive-days.tsx.ejs +57 -0
  141. package/hedhog/frontend/widgets/stat-online-time.tsx.ejs +57 -0
  142. package/hedhog/frontend/widgets/storage-config.tsx.ejs +196 -0
  143. package/hedhog/frontend/widgets/theme-config.tsx.ejs +213 -0
  144. package/hedhog/frontend/widgets/user-growth-chart.tsx.ejs +210 -0
  145. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-roles.tsx.ejs +12 -14
  146. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-sessions.tsx.ejs +1 -1
  147. package/hedhog/table/dashboard_component.yaml +7 -0
  148. package/hedhog/table/mail_sent_user.yaml +75 -0
  149. package/package.json +4 -4
  150. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +36 -12
  151. package/src/dashboard/dashboard-component/dashboard-component.service.ts +150 -3
  152. package/src/dashboard/dashboard-component/dto/create.dto.ts +4 -0
  153. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -0
  154. package/src/dashboard/dashboard-core/dashboard-core.controller.ts +5 -0
  155. package/src/dashboard/dashboard-core/dashboard-core.module.ts +6 -1
  156. package/src/dashboard/dashboard-core/dashboard-core.service.ts +874 -8
  157. package/src/file/file.controller.ts +37 -13
  158. package/src/file/file.service.ts +47 -5
  159. package/src/file/provider/s3.provider.ts +39 -29
  160. package/src/oauth/oauth.service.ts +8 -7
  161. package/src/user/constants/user.constants.ts +1 -0
  162. package/src/user/user.service.ts +2 -1
  163. package/hedhog/frontend/app/dashboard/components/widgets/locale-config.tsx.ejs +0 -309
  164. package/hedhog/frontend/app/dashboard/components/widgets/mail-config.tsx.ejs +0 -445
  165. package/hedhog/frontend/app/dashboard/components/widgets/oauth-config.tsx.ejs +0 -296
  166. package/hedhog/frontend/app/dashboard/components/widgets/storage-config.tsx.ejs +0 -340
  167. package/hedhog/frontend/app/dashboard/components/widgets/theme-config.tsx.ejs +0 -275
  168. /package/hedhog/frontend/app/dashboard/components/widgets/{active-users-card.tsx.ejs → core.active-users-card.tsx.ejs} +0 -0
  169. /package/hedhog/frontend/app/dashboard/components/widgets/{activity-timeline.tsx.ejs → core.activity-timeline.tsx.ejs} +0 -0
  170. /package/hedhog/frontend/app/dashboard/components/widgets/{login-history-chart.tsx.ejs → core.login-history-chart.tsx.ejs} +0 -0
  171. /package/hedhog/frontend/app/dashboard/components/widgets/{mail-sent-card.tsx.ejs → core.mail-sent-card.tsx.ejs} +0 -0
  172. /package/hedhog/frontend/app/dashboard/components/widgets/{mail-sent-chart.tsx.ejs → core.mail-sent-chart.tsx.ejs} +0 -0
  173. /package/hedhog/frontend/app/dashboard/components/widgets/{menus-card.tsx.ejs → core.menus-card.tsx.ejs} +0 -0
  174. /package/hedhog/frontend/app/dashboard/components/widgets/{permissions-card.tsx.ejs → core.permissions-card.tsx.ejs} +0 -0
  175. /package/hedhog/frontend/app/dashboard/components/widgets/{permissions-chart.tsx.ejs → core.permissions-chart.tsx.ejs} +0 -0
  176. /package/hedhog/frontend/app/dashboard/components/widgets/{routes-card.tsx.ejs → core.routes-card.tsx.ejs} +0 -0
  177. /package/hedhog/frontend/app/dashboard/components/widgets/{session-activity-chart.tsx.ejs → core.session-activity-chart.tsx.ejs} +0 -0
  178. /package/hedhog/frontend/app/dashboard/components/widgets/{sessions-today-card.tsx.ejs → core.sessions-today-card.tsx.ejs} +0 -0
  179. /package/hedhog/frontend/app/dashboard/components/widgets/{stat-access-level.tsx.ejs → core.stat-access-level.tsx.ejs} +0 -0
  180. /package/hedhog/frontend/app/dashboard/components/widgets/{stat-actions-today.tsx.ejs → core.stat-actions-today.tsx.ejs} +0 -0
  181. /package/hedhog/frontend/app/dashboard/components/widgets/{stat-consecutive-days.tsx.ejs → core.stat-consecutive-days.tsx.ejs} +0 -0
  182. /package/hedhog/frontend/app/dashboard/components/widgets/{stat-online-time.tsx.ejs → core.stat-online-time.tsx.ejs} +0 -0
  183. /package/hedhog/frontend/app/dashboard/components/widgets/{user-growth-chart.tsx.ejs → core.user-growth-chart.tsx.ejs} +0 -0
@@ -1,296 +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 {
13
- Collapsible,
14
- CollapsibleContent,
15
- CollapsibleTrigger,
16
- } from '@/components/ui/collapsible';
17
- import { Input } from '@/components/ui/input';
18
- import { Label } from '@/components/ui/label';
19
- import { Switch } from '@/components/ui/switch';
20
- import {
21
- CheckCircle2,
22
- ChevronDown,
23
- ExternalLink,
24
- KeyRound,
25
- XCircle,
26
- } from 'lucide-react';
27
- import { useState } from 'react';
28
-
29
- interface OAuthProvider {
30
- id: string;
31
- name: string;
32
- color: string;
33
- bgColor: string;
34
- icon: React.ReactNode;
35
- enabled: boolean;
36
- clientId: string;
37
- clientSecret: string;
38
- callbackUrl: string;
39
- scopes: string;
40
- docUrl: string;
41
- }
42
-
43
- const googleSvg = (
44
- <svg className="h-4 w-4" viewBox="0 0 24 24">
45
- <path
46
- d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
47
- fill="#4285F4"
48
- />
49
- <path
50
- d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
51
- fill="#34A853"
52
- />
53
- <path
54
- d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
55
- fill="#FBBC05"
56
- />
57
- <path
58
- d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
59
- fill="#EA4335"
60
- />
61
- </svg>
62
- );
63
-
64
- const githubSvg = (
65
- <svg className="h-4 w-4" viewBox="0 0 24 24" fill="currentColor">
66
- <path d="M12 0C5.37 0 0 5.37 0 12c0 5.3 3.44 9.8 8.2 11.39.6.11.82-.26.82-.58v-2.03c-3.34.73-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.09-.74.08-.73.08-.73 1.2.08 1.84 1.24 1.84 1.24 1.07 1.83 2.81 1.3 3.5 1 .11-.78.42-1.3.76-1.6-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.13-.3-.54-1.52.12-3.18 0 0 1.01-.32 3.3 1.23a11.5 11.5 0 0 1 6.02 0c2.28-1.55 3.29-1.23 3.29-1.23.66 1.66.25 2.88.12 3.18.77.84 1.24 1.91 1.24 3.22 0 4.61-2.81 5.63-5.48 5.92.43.37.81 1.1.81 2.22v3.29c0 .32.22.7.82.58C20.57 21.8 24 17.3 24 12c0-6.63-5.37-12-12-12z" />
67
- </svg>
68
- );
69
-
70
- const facebookSvg = (
71
- <svg className="h-4 w-4" viewBox="0 0 24 24" fill="#1877F2">
72
- <path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" />
73
- </svg>
74
- );
75
-
76
- const microsoftSvg = (
77
- <svg className="h-4 w-4" viewBox="0 0 24 24">
78
- <rect width="10.5" height="10.5" x="1" y="1" fill="#F25022" />
79
- <rect width="10.5" height="10.5" x="12.5" y="1" fill="#7FBA00" />
80
- <rect width="10.5" height="10.5" x="1" y="12.5" fill="#00A4EF" />
81
- <rect width="10.5" height="10.5" x="12.5" y="12.5" fill="#FFB900" />
82
- </svg>
83
- );
84
-
85
- const initialProviders: OAuthProvider[] = [
86
- {
87
- id: 'google',
88
- name: 'Google',
89
- color: 'text-foreground',
90
- bgColor: 'bg-red-50',
91
- icon: googleSvg,
92
- enabled: true,
93
- clientId: '123456789.apps.googleusercontent.com',
94
- clientSecret: '',
95
- callbackUrl: 'https://app.heroadmin.com/auth/callback/google',
96
- scopes: 'openid email profile',
97
- docUrl: 'https://console.cloud.google.com/apis/credentials',
98
- },
99
- {
100
- id: 'github',
101
- name: 'GitHub',
102
- color: 'text-foreground',
103
- bgColor: 'bg-gray-50',
104
- icon: githubSvg,
105
- enabled: true,
106
- clientId: 'Iv1.abc123def456',
107
- clientSecret: '',
108
- callbackUrl: 'https://app.heroadmin.com/auth/callback/github',
109
- scopes: 'read:user user:email',
110
- docUrl: 'https://github.com/settings/developers',
111
- },
112
- {
113
- id: 'facebook',
114
- name: 'Facebook',
115
- color: 'text-foreground',
116
- bgColor: 'bg-blue-50',
117
- icon: facebookSvg,
118
- enabled: false,
119
- clientId: '',
120
- clientSecret: '',
121
- callbackUrl: 'https://app.heroadmin.com/auth/callback/facebook',
122
- scopes: 'email public_profile',
123
- docUrl: 'https://developers.facebook.com/apps/',
124
- },
125
- {
126
- id: 'microsoft',
127
- name: 'Microsoft',
128
- color: 'text-foreground',
129
- bgColor: 'bg-sky-50',
130
- icon: microsoftSvg,
131
- enabled: false,
132
- clientId: '',
133
- clientSecret: '',
134
- callbackUrl: 'https://app.heroadmin.com/auth/callback/microsoft',
135
- scopes: 'openid email profile User.Read',
136
- docUrl:
137
- 'https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade',
138
- },
139
- ];
140
-
141
- export default function OAuthConfig() {
142
- const [providers, setProviders] = useState(initialProviders);
143
- const [openId, setOpenId] = useState<string | null>(null);
144
-
145
- function updateProvider(id: string, updates: Partial<OAuthProvider>) {
146
- setProviders((prev) =>
147
- prev.map((p) => (p.id === id ? { ...p, ...updates } : p))
148
- );
149
- }
150
-
151
- return (
152
- <Card className="h-full">
153
- <CardHeader>
154
- <div className="flex items-center gap-3">
155
- <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-amber-50">
156
- <KeyRound className="h-5 w-5 text-amber-600" />
157
- </div>
158
- <div>
159
- <CardTitle className="text-base">Autenticacao OAuth2</CardTitle>
160
- <CardDescription>
161
- Configure provedores de login social
162
- </CardDescription>
163
- </div>
164
- </div>
165
- </CardHeader>
166
- <CardContent className="space-y-3">
167
- {providers.map((p) => (
168
- <Collapsible
169
- key={p.id}
170
- open={openId === p.id}
171
- onOpenChange={(isOpen) => setOpenId(isOpen ? p.id : null)}
172
- >
173
- <div className="rounded-lg border">
174
- <CollapsibleTrigger asChild>
175
- <button
176
- type="button"
177
- className="flex w-full items-center gap-3 p-4 text-left transition-colors hover:bg-muted/50"
178
- >
179
- <div
180
- className={`flex h-9 w-9 items-center justify-center rounded-lg ${p.bgColor}`}
181
- >
182
- {p.icon}
183
- </div>
184
- <div className="flex-1">
185
- <div className="flex items-center gap-2">
186
- <span className="text-sm font-medium">{p.name}</span>
187
- {p.enabled ? (
188
- <Badge
189
- variant="secondary"
190
- className="bg-emerald-50 text-emerald-700 text-[10px]"
191
- >
192
- <CheckCircle2 className="mr-1 h-2.5 w-2.5" />
193
- Ativo
194
- </Badge>
195
- ) : (
196
- <Badge
197
- variant="secondary"
198
- className="text-[10px] text-muted-foreground"
199
- >
200
- <XCircle className="mr-1 h-2.5 w-2.5" />
201
- Inativo
202
- </Badge>
203
- )}
204
- </div>
205
- <span className="text-xs text-muted-foreground">
206
- {p.clientId
207
- ? `Client ID: ${p.clientId.slice(0, 16)}...`
208
- : 'Nao configurado'}
209
- </span>
210
- </div>
211
- <ChevronDown
212
- className={`h-4 w-4 text-muted-foreground transition-transform ${openId === p.id ? 'rotate-180' : ''}`}
213
- />
214
- </button>
215
- </CollapsibleTrigger>
216
- <CollapsibleContent>
217
- <div className="border-t px-4 pb-4 pt-4 space-y-4">
218
- <div className="flex items-center justify-between">
219
- <Label htmlFor={`${p.id}-enabled`} className="text-sm">
220
- Habilitar {p.name}
221
- </Label>
222
- <Switch
223
- id={`${p.id}-enabled`}
224
- checked={p.enabled}
225
- onCheckedChange={(checked) =>
226
- updateProvider(p.id, { enabled: checked })
227
- }
228
- />
229
- </div>
230
- <div className="space-y-2">
231
- <Label htmlFor={`${p.id}-client-id`}>Client ID</Label>
232
- <Input
233
- id={`${p.id}-client-id`}
234
- value={p.clientId}
235
- onChange={(e) =>
236
- updateProvider(p.id, { clientId: e.target.value })
237
- }
238
- className="font-mono text-sm"
239
- />
240
- </div>
241
- <div className="space-y-2">
242
- <Label htmlFor={`${p.id}-client-secret`}>
243
- Client Secret
244
- </Label>
245
- <Input
246
- id={`${p.id}-client-secret`}
247
- type="password"
248
- value={p.clientSecret}
249
- onChange={(e) =>
250
- updateProvider(p.id, { clientSecret: e.target.value })
251
- }
252
- className="font-mono text-sm"
253
- placeholder="********"
254
- />
255
- </div>
256
- <div className="space-y-2">
257
- <Label htmlFor={`${p.id}-callback`}>Callback URL</Label>
258
- <Input
259
- id={`${p.id}-callback`}
260
- value={p.callbackUrl}
261
- readOnly
262
- className="bg-muted font-mono text-sm"
263
- />
264
- </div>
265
- <div className="space-y-2">
266
- <Label htmlFor={`${p.id}-scopes`}>Scopes</Label>
267
- <Input
268
- id={`${p.id}-scopes`}
269
- value={p.scopes}
270
- onChange={(e) =>
271
- updateProvider(p.id, { scopes: e.target.value })
272
- }
273
- className="font-mono text-sm"
274
- />
275
- </div>
276
- <div className="flex items-center justify-between border-t pt-3">
277
- <a
278
- href={p.docUrl}
279
- target="_blank"
280
- rel="noopener noreferrer"
281
- className="flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
282
- >
283
- <ExternalLink className="h-3 w-3" />
284
- Abrir console do provedor
285
- </a>
286
- <Button size="sm">Salvar</Button>
287
- </div>
288
- </div>
289
- </CollapsibleContent>
290
- </div>
291
- </Collapsible>
292
- ))}
293
- </CardContent>
294
- </Card>
295
- );
296
- }
@@ -1,340 +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 {
22
- AlertCircle,
23
- CheckCircle2,
24
- Cloud,
25
- FolderOpen,
26
- HardDrive,
27
- } from 'lucide-react';
28
- import { useState } from 'react';
29
-
30
- type StorageProvider = 'local' | 's3' | 'gcs' | 'azure';
31
-
32
- const providerList: {
33
- value: StorageProvider;
34
- label: string;
35
- icon: React.ReactNode;
36
- description: string;
37
- }[] = [
38
- {
39
- value: 'local',
40
- label: 'Local',
41
- icon: <FolderOpen className="h-4 w-4" />,
42
- description: 'Disco do servidor',
43
- },
44
- {
45
- value: 's3',
46
- label: 'AWS S3',
47
- icon: <Cloud className="h-4 w-4" />,
48
- description: 'Amazon S3 Bucket',
49
- },
50
- {
51
- value: 'gcs',
52
- label: 'Google Cloud',
53
- icon: <Cloud className="h-4 w-4" />,
54
- description: 'Google Cloud Storage',
55
- },
56
- {
57
- value: 'azure',
58
- label: 'Azure Blob',
59
- icon: <Cloud className="h-4 w-4" />,
60
- description: 'Azure Blob Storage',
61
- },
62
- ];
63
-
64
- export default function StorageConfig() {
65
- const [provider, setProvider] = useState<StorageProvider>('local');
66
- const [localPath, setLocalPath] = useState('/var/data/uploads');
67
- const [localMaxSize, setLocalMaxSize] = useState('50');
68
-
69
- const [s3Bucket, setS3Bucket] = useState('');
70
- const [s3Region, setS3Region] = useState('us-east-1');
71
- const [s3AccessKey, setS3AccessKey] = useState('');
72
- const [s3SecretKey, setS3SecretKey] = useState('');
73
- const [s3Prefix, setS3Prefix] = useState('uploads/');
74
-
75
- const [gcsBucket, setGcsBucket] = useState('');
76
- const [gcsProjectId, setGcsProjectId] = useState('');
77
- const [gcsKeyFile, setGcsKeyFile] = useState('');
78
-
79
- const [azureAccount, setAzureAccount] = useState('');
80
- const [azureKey, setAzureKey] = useState('');
81
- const [azureContainer, setAzureContainer] = useState('');
82
- const [azureEndpoint, setAzureEndpoint] = useState('');
83
-
84
- return (
85
- <Card className="h-full">
86
- <CardHeader>
87
- <div className="flex items-center justify-between">
88
- <div className="flex items-center gap-3">
89
- <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-violet-50">
90
- <HardDrive className="h-5 w-5 text-violet-600" />
91
- </div>
92
- <div>
93
- <CardTitle className="text-base">
94
- Armazenamento de Arquivos
95
- </CardTitle>
96
- <CardDescription>
97
- Configure onde os arquivos do sistema serao armazenados
98
- </CardDescription>
99
- </div>
100
- </div>
101
- <Badge variant="secondary" className="bg-emerald-50 text-emerald-700">
102
- <CheckCircle2 className="mr-1 h-3 w-3" />
103
- Configurado
104
- </Badge>
105
- </div>
106
- </CardHeader>
107
- <CardContent className="space-y-6">
108
- {/* Provider Selector */}
109
- <div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
110
- {providerList.map((p) => (
111
- <button
112
- key={p.value}
113
- type="button"
114
- onClick={() => setProvider(p.value)}
115
- className={`flex flex-col items-center gap-1.5 rounded-lg border-2 p-3 text-center transition-all ${
116
- provider === p.value
117
- ? 'border-foreground bg-foreground/3'
118
- : 'border-border hover:border-foreground/20'
119
- }`}
120
- >
121
- <div
122
- className={`flex h-8 w-8 items-center justify-center rounded-full ${
123
- provider === p.value
124
- ? 'bg-foreground text-background'
125
- : 'bg-muted text-muted-foreground'
126
- }`}
127
- >
128
- {p.icon}
129
- </div>
130
- <span className="text-xs font-medium">{p.label}</span>
131
- </button>
132
- ))}
133
- </div>
134
-
135
- {/* Local Fields */}
136
- {provider === 'local' && (
137
- <div className="space-y-4">
138
- <div className="space-y-2">
139
- <Label htmlFor="local-path">Caminho do diretorio</Label>
140
- <Input
141
- id="local-path"
142
- value={localPath}
143
- onChange={(e) => setLocalPath(e.target.value)}
144
- placeholder="/var/data/uploads"
145
- className="font-mono text-sm"
146
- />
147
- </div>
148
- <div className="space-y-2">
149
- <Label htmlFor="local-max-size">
150
- Tamanho maximo por arquivo (MB)
151
- </Label>
152
- <Input
153
- id="local-max-size"
154
- type="number"
155
- value={localMaxSize}
156
- onChange={(e) => setLocalMaxSize(e.target.value)}
157
- />
158
- </div>
159
- <div className="rounded-lg border border-blue-200 bg-blue-50 p-3">
160
- <div className="flex items-start gap-2">
161
- <AlertCircle className="mt-0.5 h-4 w-4 text-blue-600" />
162
- <p className="text-xs text-blue-800">
163
- Certifique-se de que o diretorio existe e que o servidor tem
164
- permissoes de leitura e escrita.
165
- </p>
166
- </div>
167
- </div>
168
- </div>
169
- )}
170
-
171
- {/* AWS S3 Fields */}
172
- {provider === 's3' && (
173
- <div className="space-y-4">
174
- <div className="grid gap-4 sm:grid-cols-2">
175
- <div className="space-y-2">
176
- <Label htmlFor="s3-bucket">Bucket</Label>
177
- <Input
178
- id="s3-bucket"
179
- value={s3Bucket}
180
- onChange={(e) => setS3Bucket(e.target.value)}
181
- placeholder="meu-bucket"
182
- className="font-mono text-sm"
183
- />
184
- </div>
185
- <div className="space-y-2">
186
- <Label>Regiao</Label>
187
- <Select value={s3Region} onValueChange={setS3Region}>
188
- <SelectTrigger>
189
- <SelectValue />
190
- </SelectTrigger>
191
- <SelectContent>
192
- <SelectItem value="us-east-1">
193
- US East (N. Virginia)
194
- </SelectItem>
195
- <SelectItem value="us-west-2">US West (Oregon)</SelectItem>
196
- <SelectItem value="eu-west-1">EU (Ireland)</SelectItem>
197
- <SelectItem value="eu-central-1">EU (Frankfurt)</SelectItem>
198
- <SelectItem value="sa-east-1">
199
- South America (Sao Paulo)
200
- </SelectItem>
201
- </SelectContent>
202
- </Select>
203
- </div>
204
- </div>
205
- <div className="space-y-2">
206
- <Label htmlFor="s3-access-key">Access Key ID</Label>
207
- <Input
208
- id="s3-access-key"
209
- value={s3AccessKey}
210
- onChange={(e) => setS3AccessKey(e.target.value)}
211
- placeholder="AKIAIOSFODNN7EXAMPLE"
212
- className="font-mono text-sm"
213
- />
214
- </div>
215
- <div className="space-y-2">
216
- <Label htmlFor="s3-secret-key">Secret Access Key</Label>
217
- <Input
218
- id="s3-secret-key"
219
- type="password"
220
- value={s3SecretKey}
221
- onChange={(e) => setS3SecretKey(e.target.value)}
222
- className="font-mono text-sm"
223
- />
224
- </div>
225
- <div className="space-y-2">
226
- <Label htmlFor="s3-prefix">Prefixo (pasta)</Label>
227
- <Input
228
- id="s3-prefix"
229
- value={s3Prefix}
230
- onChange={(e) => setS3Prefix(e.target.value)}
231
- placeholder="uploads/"
232
- className="font-mono text-sm"
233
- />
234
- </div>
235
- </div>
236
- )}
237
-
238
- {/* Google Cloud Storage Fields */}
239
- {provider === 'gcs' && (
240
- <div className="space-y-4">
241
- <div className="grid gap-4 sm:grid-cols-2">
242
- <div className="space-y-2">
243
- <Label htmlFor="gcs-project-id">Project ID</Label>
244
- <Input
245
- id="gcs-project-id"
246
- value={gcsProjectId}
247
- onChange={(e) => setGcsProjectId(e.target.value)}
248
- placeholder="meu-projeto-123"
249
- className="font-mono text-sm"
250
- />
251
- </div>
252
- <div className="space-y-2">
253
- <Label htmlFor="gcs-bucket">Bucket</Label>
254
- <Input
255
- id="gcs-bucket"
256
- value={gcsBucket}
257
- onChange={(e) => setGcsBucket(e.target.value)}
258
- placeholder="meu-bucket-gcs"
259
- className="font-mono text-sm"
260
- />
261
- </div>
262
- </div>
263
- <div className="space-y-2">
264
- <Label htmlFor="gcs-key-file">
265
- Chave JSON da Service Account
266
- </Label>
267
- <textarea
268
- id="gcs-key-file"
269
- className="flex min-h-[100px] w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
270
- value={gcsKeyFile}
271
- onChange={(e) => setGcsKeyFile(e.target.value)}
272
- placeholder='{"type": "service_account", ...}'
273
- />
274
- </div>
275
- </div>
276
- )}
277
-
278
- {/* Azure Blob Storage Fields */}
279
- {provider === 'azure' && (
280
- <div className="space-y-4">
281
- <div className="grid gap-4 sm:grid-cols-2">
282
- <div className="space-y-2">
283
- <Label htmlFor="azure-account">Storage Account Name</Label>
284
- <Input
285
- id="azure-account"
286
- value={azureAccount}
287
- onChange={(e) => setAzureAccount(e.target.value)}
288
- placeholder="meuaccount"
289
- className="font-mono text-sm"
290
- />
291
- </div>
292
- <div className="space-y-2">
293
- <Label htmlFor="azure-container">Container</Label>
294
- <Input
295
- id="azure-container"
296
- value={azureContainer}
297
- onChange={(e) => setAzureContainer(e.target.value)}
298
- placeholder="arquivos"
299
- className="font-mono text-sm"
300
- />
301
- </div>
302
- </div>
303
- <div className="space-y-2">
304
- <Label htmlFor="azure-key">Access Key</Label>
305
- <Input
306
- id="azure-key"
307
- type="password"
308
- value={azureKey}
309
- onChange={(e) => setAzureKey(e.target.value)}
310
- className="font-mono text-sm"
311
- />
312
- </div>
313
- <div className="space-y-2">
314
- <Label htmlFor="azure-endpoint">
315
- Endpoint personalizado (opcional)
316
- </Label>
317
- <Input
318
- id="azure-endpoint"
319
- value={azureEndpoint}
320
- onChange={(e) => setAzureEndpoint(e.target.value)}
321
- placeholder="https://meuaccount.blob.core.windows.net"
322
- className="font-mono text-sm"
323
- />
324
- </div>
325
- </div>
326
- )}
327
-
328
- {/* Actions */}
329
- <div className="flex items-center justify-end border-t pt-4">
330
- <div className="flex gap-2">
331
- <Button variant="outline" size="sm">
332
- Testar conexao
333
- </Button>
334
- <Button size="sm">Salvar</Button>
335
- </div>
336
- </div>
337
- </CardContent>
338
- </Card>
339
- );
340
- }