strapi-plugin-magic-mail 2.2.4 → 2.2.5

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 (70) hide show
  1. package/dist/server/index.js +1 -1
  2. package/dist/server/index.mjs +1 -1
  3. package/package.json +1 -3
  4. package/admin/jsconfig.json +0 -10
  5. package/admin/src/components/AddAccountModal.jsx +0 -1943
  6. package/admin/src/components/Initializer.jsx +0 -14
  7. package/admin/src/components/LicenseGuard.jsx +0 -475
  8. package/admin/src/components/PluginIcon.jsx +0 -5
  9. package/admin/src/hooks/useAuthRefresh.js +0 -44
  10. package/admin/src/hooks/useLicense.js +0 -158
  11. package/admin/src/index.js +0 -87
  12. package/admin/src/pages/Analytics.jsx +0 -762
  13. package/admin/src/pages/App.jsx +0 -111
  14. package/admin/src/pages/EmailDesigner/EditorPage.jsx +0 -1424
  15. package/admin/src/pages/EmailDesigner/TemplateList.jsx +0 -1807
  16. package/admin/src/pages/HomePage.jsx +0 -1170
  17. package/admin/src/pages/LicensePage.jsx +0 -430
  18. package/admin/src/pages/RoutingRules.jsx +0 -1141
  19. package/admin/src/pages/Settings.jsx +0 -603
  20. package/admin/src/pluginId.js +0 -3
  21. package/admin/src/translations/de.json +0 -71
  22. package/admin/src/translations/en.json +0 -70
  23. package/admin/src/translations/es.json +0 -71
  24. package/admin/src/translations/fr.json +0 -71
  25. package/admin/src/translations/pt.json +0 -71
  26. package/admin/src/utils/fetchWithRetry.js +0 -123
  27. package/admin/src/utils/getTranslation.js +0 -5
  28. package/admin/src/utils/theme.js +0 -85
  29. package/server/jsconfig.json +0 -10
  30. package/server/src/bootstrap.js +0 -157
  31. package/server/src/config/features.js +0 -260
  32. package/server/src/config/index.js +0 -9
  33. package/server/src/content-types/email-account/schema.json +0 -93
  34. package/server/src/content-types/email-event/index.js +0 -8
  35. package/server/src/content-types/email-event/schema.json +0 -57
  36. package/server/src/content-types/email-link/index.js +0 -8
  37. package/server/src/content-types/email-link/schema.json +0 -49
  38. package/server/src/content-types/email-log/index.js +0 -8
  39. package/server/src/content-types/email-log/schema.json +0 -106
  40. package/server/src/content-types/email-template/schema.json +0 -74
  41. package/server/src/content-types/email-template-version/schema.json +0 -60
  42. package/server/src/content-types/index.js +0 -33
  43. package/server/src/content-types/routing-rule/schema.json +0 -59
  44. package/server/src/controllers/accounts.js +0 -229
  45. package/server/src/controllers/analytics.js +0 -361
  46. package/server/src/controllers/controller.js +0 -26
  47. package/server/src/controllers/email-designer.js +0 -474
  48. package/server/src/controllers/index.js +0 -21
  49. package/server/src/controllers/license.js +0 -269
  50. package/server/src/controllers/oauth.js +0 -474
  51. package/server/src/controllers/routing-rules.js +0 -129
  52. package/server/src/controllers/test.js +0 -301
  53. package/server/src/destroy.js +0 -27
  54. package/server/src/index.js +0 -25
  55. package/server/src/middlewares/index.js +0 -3
  56. package/server/src/policies/index.js +0 -3
  57. package/server/src/register.js +0 -5
  58. package/server/src/routes/admin.js +0 -469
  59. package/server/src/routes/content-api.js +0 -37
  60. package/server/src/routes/index.js +0 -9
  61. package/server/src/services/account-manager.js +0 -329
  62. package/server/src/services/analytics.js +0 -512
  63. package/server/src/services/email-designer.js +0 -717
  64. package/server/src/services/email-router.js +0 -1446
  65. package/server/src/services/index.js +0 -17
  66. package/server/src/services/license-guard.js +0 -423
  67. package/server/src/services/oauth.js +0 -515
  68. package/server/src/services/service.js +0 -7
  69. package/server/src/utils/encryption.js +0 -81
  70. package/server/src/utils/logger.js +0 -84
@@ -1,70 +0,0 @@
1
- {
2
- "plugin.name": "MagicMail",
3
- "plugin.description": "Email Business Suite for Strapi v5",
4
-
5
- "tabs.accounts": "Email Accounts",
6
- "tabs.routing": "Routing Rules",
7
- "tabs.license": "License",
8
-
9
- "accounts.title": "Email Accounts",
10
- "accounts.subtitle": "Manage multiple email accounts with Smart Routing",
11
- "accounts.add": "Add Account",
12
- "accounts.edit": "Edit Account",
13
- "accounts.delete": "Delete Account",
14
- "accounts.test": "Test",
15
- "accounts.empty": "No email accounts yet",
16
- "accounts.emptyDescription": "Add your first email account to get started",
17
-
18
- "stats.emailsToday": "Sent Today",
19
- "stats.totalSent": "Total Sent",
20
- "stats.activeAccounts": "Active Accounts",
21
-
22
- "providers.smtp": "SMTP",
23
- "providers.gmail": "Gmail OAuth",
24
- "providers.microsoft": "Microsoft OAuth",
25
- "providers.yahoo": "Yahoo Mail OAuth",
26
- "providers.sendgrid": "SendGrid",
27
- "providers.mailgun": "Mailgun",
28
-
29
- "routing.title": "Routing Rules",
30
- "routing.subtitle": "Define intelligent routing rules for email sending",
31
- "routing.add": "Create Rule",
32
- "routing.edit": "Edit Rule",
33
- "routing.delete": "Delete Rule",
34
- "routing.empty": "No routing rules yet",
35
- "routing.emptyDescription": "Create your first routing rule",
36
-
37
- "license.title": "License Management",
38
- "license.subtitle": "Manage your MagicMail license",
39
- "license.active": "License Active",
40
- "license.inactive": "No Active License",
41
- "license.demo": "Demo Mode",
42
- "license.generate": "Generate Free License",
43
- "license.activate": "Activate License",
44
- "license.key": "License Key",
45
- "license.email": "Email Address",
46
- "license.copyKey": "Copy Key",
47
- "license.download": "Download as TXT",
48
- "license.refresh": "Refresh Status",
49
-
50
- "features.premium": "Premium Features",
51
- "features.advanced": "Advanced Features",
52
- "features.enterprise": "Enterprise Features",
53
-
54
- "notifications.accountCreated": "Email account created successfully",
55
- "notifications.accountUpdated": "Email account updated successfully",
56
- "notifications.accountDeleted": "Email account deleted successfully",
57
- "notifications.testSuccess": "Test email sent successfully",
58
- "notifications.testFailed": "Test email failed",
59
- "notifications.ruleCreated": "Routing rule created successfully",
60
- "notifications.ruleUpdated": "Routing rule updated successfully",
61
- "notifications.ruleDeleted": "Routing rule deleted successfully",
62
- "notifications.licenseActivated": "License activated successfully",
63
- "notifications.licenseCopied": "License key copied",
64
- "notifications.error": "An error occurred",
65
-
66
- "errors.noAccounts": "No email accounts available",
67
- "errors.providerNotAllowed": "This provider requires a higher license",
68
- "errors.accountLimitReached": "Account limit reached. Upgrade required",
69
- "errors.ruleLimitReached": "Rule limit reached. Upgrade required"
70
- }
@@ -1,71 +0,0 @@
1
- {
2
- "plugin.name": "MagicMail",
3
- "plugin.description": "Suite de Email Business para Strapi v5",
4
-
5
- "tabs.accounts": "Cuentas de Email",
6
- "tabs.routing": "Reglas de Enrutamiento",
7
- "tabs.license": "Licencia",
8
-
9
- "accounts.title": "Cuentas de Email",
10
- "accounts.subtitle": "Administra múltiples cuentas de email con Smart Routing",
11
- "accounts.add": "Agregar cuenta",
12
- "accounts.edit": "Editar cuenta",
13
- "accounts.delete": "Eliminar cuenta",
14
- "accounts.test": "Probar",
15
- "accounts.empty": "No hay cuentas de email",
16
- "accounts.emptyDescription": "Agrega tu primera cuenta de email para comenzar",
17
-
18
- "stats.emailsToday": "Enviados hoy",
19
- "stats.totalSent": "Total enviado",
20
- "stats.activeAccounts": "Cuentas activas",
21
-
22
- "providers.smtp": "SMTP",
23
- "providers.gmail": "Gmail OAuth",
24
- "providers.microsoft": "Microsoft OAuth",
25
- "providers.yahoo": "Yahoo Mail OAuth",
26
- "providers.sendgrid": "SendGrid",
27
- "providers.mailgun": "Mailgun",
28
-
29
- "routing.title": "Reglas de Enrutamiento",
30
- "routing.subtitle": "Define reglas inteligentes para el envío de emails",
31
- "routing.add": "Crear regla",
32
- "routing.edit": "Editar regla",
33
- "routing.delete": "Eliminar regla",
34
- "routing.empty": "No hay reglas de enrutamiento",
35
- "routing.emptyDescription": "Crea tu primera regla de enrutamiento",
36
-
37
- "license.title": "Gestión de Licencia",
38
- "license.subtitle": "Administra tu licencia de MagicMail",
39
- "license.active": "Licencia activa",
40
- "license.inactive": "Sin licencia activa",
41
- "license.demo": "Modo demo",
42
- "license.generate": "Generar licencia gratuita",
43
- "license.activate": "Activar licencia",
44
- "license.key": "Clave de licencia",
45
- "license.email": "Correo electrónico",
46
- "license.copyKey": "Copiar clave",
47
- "license.download": "Descargar como TXT",
48
- "license.refresh": "Actualizar estado",
49
-
50
- "features.premium": "Funciones Premium",
51
- "features.advanced": "Funciones Avanzadas",
52
- "features.enterprise": "Funciones Enterprise",
53
-
54
- "notifications.accountCreated": "Cuenta de email creada exitosamente",
55
- "notifications.accountUpdated": "Cuenta de email actualizada exitosamente",
56
- "notifications.accountDeleted": "Cuenta de email eliminada exitosamente",
57
- "notifications.testSuccess": "Email de prueba enviado exitosamente",
58
- "notifications.testFailed": "Falló el email de prueba",
59
- "notifications.ruleCreated": "Regla de enrutamiento creada exitosamente",
60
- "notifications.ruleUpdated": "Regla de enrutamiento actualizada exitosamente",
61
- "notifications.ruleDeleted": "Regla de enrutamiento eliminada exitosamente",
62
- "notifications.licenseActivated": "Licencia activada exitosamente",
63
- "notifications.licenseCopied": "Clave de licencia copiada",
64
- "notifications.error": "Ocurrió un error",
65
-
66
- "errors.noAccounts": "No hay cuentas de email disponibles",
67
- "errors.providerNotAllowed": "Este proveedor requiere una licencia superior",
68
- "errors.accountLimitReached": "Límite de cuentas alcanzado. Actualización requerida",
69
- "errors.ruleLimitReached": "Límite de reglas alcanzado. Actualización requerida"
70
- }
71
-
@@ -1,71 +0,0 @@
1
- {
2
- "plugin.name": "MagicMail",
3
- "plugin.description": "Suite Email Business pour Strapi v5",
4
-
5
- "tabs.accounts": "Comptes Email",
6
- "tabs.routing": "Règles de Routage",
7
- "tabs.license": "Licence",
8
-
9
- "accounts.title": "Comptes Email",
10
- "accounts.subtitle": "Gérez plusieurs comptes email avec Smart Routing",
11
- "accounts.add": "Ajouter un compte",
12
- "accounts.edit": "Modifier le compte",
13
- "accounts.delete": "Supprimer le compte",
14
- "accounts.test": "Tester",
15
- "accounts.empty": "Aucun compte email",
16
- "accounts.emptyDescription": "Ajoutez votre premier compte email pour commencer",
17
-
18
- "stats.emailsToday": "Envoyés aujourd'hui",
19
- "stats.totalSent": "Total envoyé",
20
- "stats.activeAccounts": "Comptes actifs",
21
-
22
- "providers.smtp": "SMTP",
23
- "providers.gmail": "Gmail OAuth",
24
- "providers.microsoft": "Microsoft OAuth",
25
- "providers.yahoo": "Yahoo Mail OAuth",
26
- "providers.sendgrid": "SendGrid",
27
- "providers.mailgun": "Mailgun",
28
-
29
- "routing.title": "Règles de Routage",
30
- "routing.subtitle": "Définissez des règles intelligentes pour l'envoi d'emails",
31
- "routing.add": "Créer une règle",
32
- "routing.edit": "Modifier la règle",
33
- "routing.delete": "Supprimer la règle",
34
- "routing.empty": "Aucune règle de routage",
35
- "routing.emptyDescription": "Créez votre première règle de routage",
36
-
37
- "license.title": "Gestion de Licence",
38
- "license.subtitle": "Gérez votre licence MagicMail",
39
- "license.active": "Licence active",
40
- "license.inactive": "Aucune licence active",
41
- "license.demo": "Mode démo",
42
- "license.generate": "Générer une licence gratuite",
43
- "license.activate": "Activer la licence",
44
- "license.key": "Clé de licence",
45
- "license.email": "Adresse email",
46
- "license.copyKey": "Copier la clé",
47
- "license.download": "Télécharger en TXT",
48
- "license.refresh": "Actualiser le statut",
49
-
50
- "features.premium": "Fonctionnalités Premium",
51
- "features.advanced": "Fonctionnalités Avancées",
52
- "features.enterprise": "Fonctionnalités Enterprise",
53
-
54
- "notifications.accountCreated": "Compte email créé avec succès",
55
- "notifications.accountUpdated": "Compte email mis à jour avec succès",
56
- "notifications.accountDeleted": "Compte email supprimé avec succès",
57
- "notifications.testSuccess": "Email de test envoyé avec succès",
58
- "notifications.testFailed": "Échec de l'email de test",
59
- "notifications.ruleCreated": "Règle de routage créée avec succès",
60
- "notifications.ruleUpdated": "Règle de routage mise à jour avec succès",
61
- "notifications.ruleDeleted": "Règle de routage supprimée avec succès",
62
- "notifications.licenseActivated": "Licence activée avec succès",
63
- "notifications.licenseCopied": "Clé de licence copiée",
64
- "notifications.error": "Une erreur s'est produite",
65
-
66
- "errors.noAccounts": "Aucun compte email disponible",
67
- "errors.providerNotAllowed": "Ce fournisseur nécessite une licence supérieure",
68
- "errors.accountLimitReached": "Limite de comptes atteinte. Mise à niveau requise",
69
- "errors.ruleLimitReached": "Limite de règles atteinte. Mise à niveau requise"
70
- }
71
-
@@ -1,71 +0,0 @@
1
- {
2
- "plugin.name": "MagicMail",
3
- "plugin.description": "Suite de Email Business para Strapi v5",
4
-
5
- "tabs.accounts": "Contas de Email",
6
- "tabs.routing": "Regras de Roteamento",
7
- "tabs.license": "Licença",
8
-
9
- "accounts.title": "Contas de Email",
10
- "accounts.subtitle": "Gerencie várias contas de email com Smart Routing",
11
- "accounts.add": "Adicionar conta",
12
- "accounts.edit": "Editar conta",
13
- "accounts.delete": "Excluir conta",
14
- "accounts.test": "Testar",
15
- "accounts.empty": "Nenhuma conta de email",
16
- "accounts.emptyDescription": "Adicione sua primeira conta de email para começar",
17
-
18
- "stats.emailsToday": "Enviados hoje",
19
- "stats.totalSent": "Total enviado",
20
- "stats.activeAccounts": "Contas ativas",
21
-
22
- "providers.smtp": "SMTP",
23
- "providers.gmail": "Gmail OAuth",
24
- "providers.microsoft": "Microsoft OAuth",
25
- "providers.yahoo": "Yahoo Mail OAuth",
26
- "providers.sendgrid": "SendGrid",
27
- "providers.mailgun": "Mailgun",
28
-
29
- "routing.title": "Regras de Roteamento",
30
- "routing.subtitle": "Defina regras inteligentes para envio de emails",
31
- "routing.add": "Criar regra",
32
- "routing.edit": "Editar regra",
33
- "routing.delete": "Excluir regra",
34
- "routing.empty": "Nenhuma regra de roteamento",
35
- "routing.emptyDescription": "Crie sua primeira regra de roteamento",
36
-
37
- "license.title": "Gerenciamento de Licença",
38
- "license.subtitle": "Gerencie sua licença MagicMail",
39
- "license.active": "Licença ativa",
40
- "license.inactive": "Nenhuma licença ativa",
41
- "license.demo": "Modo demo",
42
- "license.generate": "Gerar licença gratuita",
43
- "license.activate": "Ativar licença",
44
- "license.key": "Chave de licença",
45
- "license.email": "Endereço de email",
46
- "license.copyKey": "Copiar chave",
47
- "license.download": "Baixar como TXT",
48
- "license.refresh": "Atualizar status",
49
-
50
- "features.premium": "Recursos Premium",
51
- "features.advanced": "Recursos Avançados",
52
- "features.enterprise": "Recursos Enterprise",
53
-
54
- "notifications.accountCreated": "Conta de email criada com sucesso",
55
- "notifications.accountUpdated": "Conta de email atualizada com sucesso",
56
- "notifications.accountDeleted": "Conta de email excluída com sucesso",
57
- "notifications.testSuccess": "Email de teste enviado com sucesso",
58
- "notifications.testFailed": "Falha no email de teste",
59
- "notifications.ruleCreated": "Regra de roteamento criada com sucesso",
60
- "notifications.ruleUpdated": "Regra de roteamento atualizada com sucesso",
61
- "notifications.ruleDeleted": "Regra de roteamento excluída com sucesso",
62
- "notifications.licenseActivated": "Licença ativada com sucesso",
63
- "notifications.licenseCopied": "Chave de licença copiada",
64
- "notifications.error": "Ocorreu um erro",
65
-
66
- "errors.noAccounts": "Nenhuma conta de email disponível",
67
- "errors.providerNotAllowed": "Este provedor requer uma licença superior",
68
- "errors.accountLimitReached": "Limite de contas atingido. Atualização necessária",
69
- "errors.ruleLimitReached": "Limite de regras atingido. Atualização necessária"
70
- }
71
-
@@ -1,123 +0,0 @@
1
- /**
2
- * Fetch wrapper with automatic token refresh on 401
3
- * Retries failed requests after token refresh
4
- */
5
- export const createFetchWithRetry = (fetchClient) => {
6
- let isRefreshing = false;
7
- let refreshPromise = null;
8
-
9
- const refresh = async () => {
10
- if (isRefreshing) {
11
- // Wait for ongoing refresh
12
- return refreshPromise;
13
- }
14
-
15
- isRefreshing = true;
16
- refreshPromise = (async () => {
17
- try {
18
- // Hit a protected endpoint to trigger token refresh
19
- const response = await fetch('/admin/users/me', {
20
- method: 'GET',
21
- credentials: 'include',
22
- headers: {
23
- 'Content-Type': 'application/json',
24
- },
25
- });
26
-
27
- if (response.ok) {
28
- console.debug('[Fetch Retry] Token refreshed successfully');
29
- return true;
30
- }
31
- return false;
32
- } catch (error) {
33
- console.error('[Fetch Retry] Token refresh failed:', error);
34
- // Redirect to login on persistent failure
35
- window.location.href = '/admin/auth/login';
36
- return false;
37
- } finally {
38
- isRefreshing = false;
39
- refreshPromise = null;
40
- }
41
- })();
42
-
43
- return refreshPromise;
44
- };
45
-
46
- return {
47
- get: async (url, options = {}) => {
48
- try {
49
- return await fetchClient.get(url, options);
50
- } catch (error) {
51
- if (error.response?.status === 401) {
52
- const refreshed = await refresh();
53
- if (refreshed) {
54
- return await fetchClient.get(url, options);
55
- }
56
- throw error;
57
- }
58
- throw error;
59
- }
60
- },
61
-
62
- post: async (url, data, options = {}) => {
63
- try {
64
- return await fetchClient.post(url, data, options);
65
- } catch (error) {
66
- if (error.response?.status === 401) {
67
- const refreshed = await refresh();
68
- if (refreshed) {
69
- return await fetchClient.post(url, data, options);
70
- }
71
- throw error;
72
- }
73
- throw error;
74
- }
75
- },
76
-
77
- put: async (url, data, options = {}) => {
78
- try {
79
- return await fetchClient.put(url, data, options);
80
- } catch (error) {
81
- if (error.response?.status === 401) {
82
- const refreshed = await refresh();
83
- if (refreshed) {
84
- return await fetchClient.put(url, data, options);
85
- }
86
- throw error;
87
- }
88
- throw error;
89
- }
90
- },
91
-
92
- patch: async (url, data, options = {}) => {
93
- try {
94
- return await fetchClient.patch(url, data, options);
95
- } catch (error) {
96
- if (error.response?.status === 401) {
97
- const refreshed = await refresh();
98
- if (refreshed) {
99
- return await fetchClient.patch(url, data, options);
100
- }
101
- throw error;
102
- }
103
- throw error;
104
- }
105
- },
106
-
107
- del: async (url, options = {}) => {
108
- try {
109
- return await fetchClient.del(url, options);
110
- } catch (error) {
111
- if (error.response?.status === 401) {
112
- const refreshed = await refresh();
113
- if (refreshed) {
114
- return await fetchClient.del(url, options);
115
- }
116
- throw error;
117
- }
118
- throw error;
119
- }
120
- },
121
- };
122
- };
123
-
@@ -1,5 +0,0 @@
1
- import { PLUGIN_ID } from '../pluginId';
2
-
3
- const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
4
-
5
- export { getTranslation };
@@ -1,85 +0,0 @@
1
- /**
2
- * Theme Utilities for Dark Mode Support
3
- *
4
- * IMPORTANT: For Dark Mode to work properly, use props.theme in styled-components:
5
- *
6
- * Example:
7
- * background: ${props => props.theme.colors.neutral0};
8
- * color: ${props => props.theme.colors.neutral800};
9
- * border: 1px solid ${props => props.theme.colors.neutral200};
10
- *
11
- * Strapi's ThemeProvider automatically switches these values between Light and Dark mode.
12
- *
13
- * Use the static `theme` object below ONLY for:
14
- * - Gradients (which don't change between light/dark)
15
- * - Shadows
16
- * - Spacing
17
- * - Border radius
18
- * - Transitions
19
- */
20
-
21
- // Static design tokens (for non-theme-dependent values)
22
- export const theme = {
23
- colors: {
24
- primary: {
25
- 50: '#F0F9FF',
26
- 100: '#E0F2FE',
27
- 200: '#BAE6FD',
28
- 500: '#0EA5E9',
29
- 600: '#0284C7',
30
- 700: '#0369A1',
31
- },
32
- secondary: {
33
- 50: '#FAF5FF',
34
- 100: '#F3E8FF',
35
- 500: '#A855F7',
36
- 600: '#9333EA',
37
- },
38
- success: {
39
- 50: '#F0FDF4',
40
- 100: '#DCFCE7',
41
- 500: '#22C55E',
42
- 600: '#16A34A',
43
- 700: '#15803D',
44
- },
45
- warning: {
46
- 50: '#FFFBEB',
47
- 100: '#FEF3C7',
48
- 500: '#F59E0B',
49
- 600: '#D97706',
50
- },
51
- danger: {
52
- 50: '#FEF2F2',
53
- 100: '#FEE2E2',
54
- 500: '#EF4444',
55
- 600: '#DC2626',
56
- },
57
- },
58
- shadows: {
59
- sm: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)',
60
- md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)',
61
- lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)',
62
- xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)',
63
- },
64
- transitions: {
65
- fast: '150ms cubic-bezier(0.4, 0, 0.2, 1)',
66
- normal: '300ms cubic-bezier(0.4, 0, 0.2, 1)',
67
- slow: '500ms cubic-bezier(0.4, 0, 0.2, 1)',
68
- },
69
- spacing: {
70
- xs: '4px',
71
- sm: '8px',
72
- md: '16px',
73
- lg: '24px',
74
- xl: '32px',
75
- '2xl': '48px',
76
- },
77
- borderRadius: {
78
- sm: '6px',
79
- md: '8px',
80
- lg: '12px',
81
- xl: '16px',
82
- }
83
- };
84
-
85
- export default theme;
@@ -1,10 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es6",
4
- "module": "commonjs",
5
- "allowSyntheticDefaultImports": true,
6
- "esModuleInterop": true
7
- },
8
- "include": ["./src/**/*.js"],
9
- "exclude": ["node_modules"]
10
- }
@@ -1,157 +0,0 @@
1
- 'use strict';
2
-
3
- const { createLogger } = require('./utils/logger');
4
-
5
- /**
6
- * Bootstrap: Initialize MagicMail plugin
7
- * Sets up email account counter resets and health checks
8
- * OVERRIDES Strapi's native email service with MagicMail router
9
- */
10
-
11
- module.exports = async ({ strapi }) => {
12
- const log = createLogger(strapi);
13
-
14
- log.info('[BOOTSTRAP] Starting...');
15
-
16
- try {
17
- // Initialize License Guard
18
- const licenseGuardService = strapi.plugin('magic-mail').service('license-guard');
19
-
20
- // Wait a bit for all services to be ready
21
- setTimeout(async () => {
22
- const licenseStatus = await licenseGuardService.initialize();
23
-
24
- if (!licenseStatus.valid && licenseStatus.demo) {
25
- log.error('╔════════════════════════════════════════════════════════════════╗');
26
- log.error('║ [ERROR] MAGICMAIL - NO VALID LICENSE ║');
27
- log.error('║ ║');
28
- log.error('║ This plugin requires a valid license to operate. ║');
29
- log.error('║ Please activate your license via Admin UI: ║');
30
- log.error('║ Go to MagicMail → License tab ║');
31
- log.error('║ ║');
32
- log.error('║ Click "Generate Free License" to get started! ║');
33
- log.error('╚════════════════════════════════════════════════════════════════╝');
34
- } else if (licenseStatus.gracePeriod) {
35
- log.warn('[WARNING] Running on grace period (license server unreachable)');
36
- }
37
- // No additional log here, as initialize() already outputs the license box
38
- }, 2000);
39
-
40
- const accountManager = strapi.plugin('magic-mail').service('account-manager');
41
- const emailRouter = strapi.plugin('magic-mail').service('email-router');
42
-
43
- // ============================================================
44
- // OVERRIDE STRAPI'S NATIVE EMAIL SERVICE
45
- // ============================================================
46
-
47
- // Try to get email service (support both v4 and v5 APIs)
48
- const originalEmailService = strapi.plugin('email')?.service?.('email') ||
49
- strapi.plugins?.email?.services?.email;
50
-
51
- if (originalEmailService && originalEmailService.send) {
52
- const originalSend = originalEmailService.send.bind(originalEmailService);
53
-
54
- // Override the send method
55
- originalEmailService.send = async (emailData) => {
56
- log.info('[EMAIL] Intercepted from native Strapi service');
57
- log.debug('Email data:', {
58
- to: emailData.to,
59
- subject: emailData.subject,
60
- templateId: emailData.templateId,
61
- hasHtml: !!emailData.html,
62
- hasText: !!emailData.text,
63
- });
64
-
65
- try {
66
- // Map 'data' to 'templateData' for backward compatibility
67
- if (emailData.data && !emailData.templateData) {
68
- emailData.templateData = emailData.data;
69
- }
70
-
71
- // Route through MagicMail
72
- const result = await emailRouter.send(emailData);
73
-
74
- log.info('[SUCCESS] Email routed successfully through MagicMail');
75
- return result;
76
- } catch (magicMailError) {
77
- log.warn('[WARNING] MagicMail routing failed, falling back to original service');
78
- log.error('Error:', magicMailError.message);
79
-
80
- // Fallback to original Strapi email service
81
- return await originalSend(emailData);
82
- }
83
- };
84
-
85
- log.info('[SUCCESS] Native email service overridden!');
86
- log.info('[INFO] All strapi.plugins.email.services.email.send() calls will route through MagicMail');
87
- } else {
88
- log.warn('[WARNING] Native email service not found - MagicMail will work standalone');
89
- log.warn('[INFO] Make sure @strapi/plugin-email is installed');
90
- }
91
-
92
- // ============================================================
93
- // COUNTER RESET SCHEDULES
94
- // ============================================================
95
-
96
- // Reset hourly counters every hour
97
- const hourlyResetInterval = setInterval(async () => {
98
- try {
99
- if (!strapi || !strapi.plugin) {
100
- console.warn('Strapi not available for hourly reset');
101
- return;
102
- }
103
- const accountMgr = strapi.plugin('magic-mail').service('account-manager');
104
- await accountMgr.resetCounters('hourly');
105
- log.info('[RESET] Hourly counters reset');
106
- } catch (err) {
107
- console.error('Hourly reset error:', err.message);
108
- }
109
- }, 60 * 60 * 1000); // Every hour
110
-
111
- // Store interval for cleanup
112
- if (!global.magicMailIntervals) global.magicMailIntervals = {};
113
- global.magicMailIntervals.hourly = hourlyResetInterval;
114
-
115
- // Reset daily counters at midnight
116
- const now = new Date();
117
- const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);
118
- const msUntilMidnight = midnight - now;
119
-
120
- setTimeout(async () => {
121
- try {
122
- if (!strapi || !strapi.plugin) {
123
- console.warn('Strapi not available for daily reset');
124
- return;
125
- }
126
- const accountMgr = strapi.plugin('magic-mail').service('account-manager');
127
- await accountMgr.resetCounters('daily');
128
- log.info('[RESET] Daily counters reset');
129
-
130
- // Then set daily interval
131
- const dailyResetInterval = setInterval(async () => {
132
- try {
133
- if (!strapi || !strapi.plugin) {
134
- console.warn('Strapi not available for daily reset');
135
- return;
136
- }
137
- const accountMgr = strapi.plugin('magic-mail').service('account-manager');
138
- await accountMgr.resetCounters('daily');
139
- log.info('[RESET] Daily counters reset');
140
- } catch (err) {
141
- console.error('Daily reset error:', err.message);
142
- }
143
- }, 24 * 60 * 60 * 1000); // Every 24 hours
144
-
145
- // Store interval for cleanup
146
- global.magicMailIntervals.daily = dailyResetInterval;
147
- } catch (err) {
148
- console.error('Initial daily reset error:', err.message);
149
- }
150
- }, msUntilMidnight);
151
-
152
- log.info('[SUCCESS] Counter reset schedules initialized');
153
- log.info('[SUCCESS] Bootstrap complete');
154
- } catch (err) {
155
- log.error('[ERROR] Bootstrap error:', err);
156
- }
157
- };