@zyther/tzmail 0.1.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +412 -79
  2. package/dist/core/enums/theme.enum.d.ts +11 -1
  3. package/dist/core/enums/theme.enum.d.ts.map +1 -1
  4. package/dist/core/enums/theme.enum.js +10 -0
  5. package/dist/core/interfaces/email.interface.d.ts +95 -5
  6. package/dist/core/interfaces/email.interface.d.ts.map +1 -1
  7. package/dist/core/interfaces/template.interface.d.ts +12 -1
  8. package/dist/core/interfaces/template.interface.d.ts.map +1 -1
  9. package/dist/factories/email-factory.d.ts +32 -6
  10. package/dist/factories/email-factory.d.ts.map +1 -1
  11. package/dist/factories/email-factory.js +110 -6
  12. package/dist/factories/template-factory.d.ts.map +1 -1
  13. package/dist/factories/template-factory.js +170 -60
  14. package/dist/index.d.ts +16 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +23 -1
  17. package/dist/providers/mailgun.transport.d.ts +10 -0
  18. package/dist/providers/mailgun.transport.d.ts.map +1 -0
  19. package/dist/providers/mailgun.transport.js +85 -0
  20. package/dist/providers/nodemailer.transport.d.ts +11 -0
  21. package/dist/providers/nodemailer.transport.d.ts.map +1 -0
  22. package/dist/providers/nodemailer.transport.js +23 -0
  23. package/dist/providers/provider-utils.d.ts +17 -0
  24. package/dist/providers/provider-utils.d.ts.map +1 -0
  25. package/dist/providers/provider-utils.js +89 -0
  26. package/dist/providers/provider.interface.d.ts +30 -0
  27. package/dist/providers/provider.interface.d.ts.map +1 -0
  28. package/dist/providers/provider.interface.js +2 -0
  29. package/dist/providers/sendgrid.transport.d.ts +10 -0
  30. package/dist/providers/sendgrid.transport.d.ts.map +1 -0
  31. package/dist/providers/sendgrid.transport.js +76 -0
  32. package/dist/queues/bullmq-email-queue.d.ts +153 -0
  33. package/dist/queues/bullmq-email-queue.d.ts.map +1 -0
  34. package/dist/queues/bullmq-email-queue.js +292 -0
  35. package/dist/services/attachment.service.d.ts +15 -37
  36. package/dist/services/attachment.service.d.ts.map +1 -1
  37. package/dist/services/attachment.service.js +58 -46
  38. package/dist/services/email.service.d.ts +22 -22
  39. package/dist/services/email.service.d.ts.map +1 -1
  40. package/dist/services/email.service.js +117 -33
  41. package/dist/services/template.service.d.ts +24 -111
  42. package/dist/services/template.service.d.ts.map +1 -1
  43. package/dist/services/template.service.js +273 -362
  44. package/dist/templates/base/color-accessibility.d.ts +4 -0
  45. package/dist/templates/base/color-accessibility.d.ts.map +1 -0
  46. package/dist/templates/base/color-accessibility.js +38 -0
  47. package/dist/templates/base/template-builder.d.ts +4 -1
  48. package/dist/templates/base/template-builder.d.ts.map +1 -1
  49. package/dist/templates/base/template-builder.js +276 -527
  50. package/dist/templates/themes/aurora.theme.d.ts +12 -0
  51. package/dist/templates/themes/aurora.theme.d.ts.map +1 -0
  52. package/dist/templates/themes/aurora.theme.js +88 -0
  53. package/dist/templates/themes/corporate.theme.d.ts +2 -1
  54. package/dist/templates/themes/corporate.theme.d.ts.map +1 -1
  55. package/dist/templates/themes/corporate.theme.js +139 -102
  56. package/dist/templates/themes/editorial.theme.d.ts +12 -0
  57. package/dist/templates/themes/editorial.theme.d.ts.map +1 -0
  58. package/dist/templates/themes/editorial.theme.js +90 -0
  59. package/dist/templates/themes/forest.theme.d.ts +12 -0
  60. package/dist/templates/themes/forest.theme.d.ts.map +1 -0
  61. package/dist/templates/themes/forest.theme.js +89 -0
  62. package/dist/templates/themes/glass.theme.d.ts +12 -0
  63. package/dist/templates/themes/glass.theme.d.ts.map +1 -0
  64. package/dist/templates/themes/glass.theme.js +88 -0
  65. package/dist/templates/themes/lavender.theme.d.ts +12 -0
  66. package/dist/templates/themes/lavender.theme.d.ts.map +1 -0
  67. package/dist/templates/themes/lavender.theme.js +91 -0
  68. package/dist/templates/themes/midnight.theme.d.ts +12 -0
  69. package/dist/templates/themes/midnight.theme.d.ts.map +1 -0
  70. package/dist/templates/themes/midnight.theme.js +91 -0
  71. package/dist/templates/themes/minimal.theme.d.ts +2 -1
  72. package/dist/templates/themes/minimal.theme.d.ts.map +1 -1
  73. package/dist/templates/themes/minimal.theme.js +142 -107
  74. package/dist/templates/themes/modern.theme.d.ts +2 -1
  75. package/dist/templates/themes/modern.theme.d.ts.map +1 -1
  76. package/dist/templates/themes/modern.theme.js +109 -74
  77. package/dist/templates/themes/monokai.theme.d.ts +2 -1
  78. package/dist/templates/themes/monokai.theme.d.ts.map +1 -1
  79. package/dist/templates/themes/monokai.theme.js +102 -66
  80. package/dist/templates/themes/neobrutal.theme.d.ts +12 -0
  81. package/dist/templates/themes/neobrutal.theme.d.ts.map +1 -0
  82. package/dist/templates/themes/neobrutal.theme.js +91 -0
  83. package/dist/templates/themes/ocean.theme.d.ts +12 -0
  84. package/dist/templates/themes/ocean.theme.d.ts.map +1 -0
  85. package/dist/templates/themes/ocean.theme.js +90 -0
  86. package/dist/templates/themes/pastel.theme.d.ts +12 -0
  87. package/dist/templates/themes/pastel.theme.d.ts.map +1 -0
  88. package/dist/templates/themes/pastel.theme.js +89 -0
  89. package/dist/templates/themes/sunset.theme.d.ts +12 -0
  90. package/dist/templates/themes/sunset.theme.d.ts.map +1 -0
  91. package/dist/templates/themes/sunset.theme.js +90 -0
  92. package/dist/templates/themes/system.theme.d.ts +2 -1
  93. package/dist/templates/themes/system.theme.d.ts.map +1 -1
  94. package/dist/templates/themes/system.theme.js +81 -47
  95. package/dist/templates/themes/theme.interface.d.ts +48 -0
  96. package/dist/templates/themes/theme.interface.d.ts.map +1 -1
  97. package/package.json +36 -14
  98. package/src/core/enums/template-part.enum.ts +7 -0
  99. package/src/core/enums/theme.enum.ts +18 -0
  100. package/src/core/interfaces/email.interface.ts +116 -0
  101. package/src/core/interfaces/template.interface.ts +71 -0
  102. package/src/factories/email-factory.ts +208 -0
  103. package/src/factories/template-factory.ts +201 -0
  104. package/src/index.ts +53 -0
  105. package/src/providers/mailgun.transport.ts +80 -0
  106. package/src/providers/nodemailer.transport.ts +20 -0
  107. package/src/providers/provider-utils.ts +91 -0
  108. package/src/providers/provider.interface.ts +26 -0
  109. package/src/providers/sendgrid.transport.ts +80 -0
  110. package/src/queues/bullmq-email-queue.ts +418 -0
  111. package/src/services/attachment.service.ts +98 -0
  112. package/src/services/email.service.ts +151 -0
  113. package/src/services/template.service.ts +431 -0
  114. package/src/templates/base/color-accessibility.ts +31 -0
  115. package/src/templates/base/template-builder.ts +438 -0
  116. package/src/templates/themes/aurora.theme.ts +91 -0
  117. package/src/templates/themes/corporate.theme.ts +156 -0
  118. package/src/templates/themes/editorial.theme.ts +93 -0
  119. package/src/templates/themes/forest.theme.ts +92 -0
  120. package/src/templates/themes/glass.theme.ts +91 -0
  121. package/src/templates/themes/lavender.theme.ts +94 -0
  122. package/src/templates/themes/midnight.theme.ts +94 -0
  123. package/src/templates/themes/minimal.theme.ts +158 -0
  124. package/src/templates/themes/modern.theme.ts +124 -0
  125. package/src/templates/themes/monokai.theme.ts +117 -0
  126. package/src/templates/themes/neobrutal.theme.ts +94 -0
  127. package/src/templates/themes/ocean.theme.ts +93 -0
  128. package/src/templates/themes/pastel.theme.ts +92 -0
  129. package/src/templates/themes/sunset.theme.ts +93 -0
  130. package/src/templates/themes/system.theme.ts +92 -0
  131. package/src/templates/themes/theme.interface.ts +95 -0
  132. package/src/tests/template.service.test.ts +1 -0
@@ -0,0 +1,93 @@
1
+ import { ThemeType } from '../../core/enums/theme.enum';
2
+ import { ITheme, IThemeColors, ITypography, ISpacing, IThemeEmailStyles } from './theme.interface';
3
+
4
+ export class SunsetTheme implements ITheme {
5
+ id = ThemeType.SUNSET;
6
+ name = 'Sunset';
7
+
8
+ light: IThemeColors = {
9
+ primary: '#A63F32',
10
+ secondary: '#8A5548',
11
+ background: '#FFF7F0',
12
+ text: '#38242E',
13
+ textMuted: '#755B60',
14
+ border: '#E8CFC4',
15
+ success: '#286B4D',
16
+ error: '#A52E35',
17
+ warning: '#81500A'
18
+ };
19
+
20
+ dark: IThemeColors = {
21
+ primary: '#FF927A',
22
+ secondary: '#E8B077',
23
+ background: '#211923',
24
+ text: '#FFF1E8',
25
+ textMuted: '#C8B3B8',
26
+ border: '#503842',
27
+ success: '#81D0A4',
28
+ error: '#FF8A91',
29
+ warning: '#F5C36B'
30
+ };
31
+
32
+ typography: ITypography = {
33
+ fontFamily: 'Arial, Helvetica, sans-serif',
34
+ fontSizes: {
35
+ small: '14px',
36
+ medium: '16px',
37
+ large: '18px',
38
+ xlarge: '26px'
39
+ },
40
+ fontWeights: {
41
+ normal: 400,
42
+ medium: 500,
43
+ bold: 700
44
+ }
45
+ };
46
+
47
+ spacing: ISpacing = {
48
+ xs: '6px',
49
+ sm: '12px',
50
+ md: '20px',
51
+ lg: '30px',
52
+ xl: '44px'
53
+ };
54
+
55
+ emailStyles: IThemeEmailStyles = {
56
+ maxWidthPx: 600,
57
+ container: {
58
+ borderColor: 'border',
59
+ borderWidth: '1px',
60
+ borderRadius: '12px',
61
+ boxShadow: '0 2px 8px rgba(0, 0, 0, 0.08)'
62
+ },
63
+ header: {
64
+ accentColor: 'primary',
65
+ accentWidth: '3px',
66
+ horizontalPadding: '30px',
67
+ logoColor: 'primary',
68
+ logoFontFamily: 'Georgia, "Times New Roman", serif',
69
+ logoTextTransform: 'uppercase',
70
+ logoLetterSpacing: '1.2px',
71
+ imageBorderRadius: '6px'
72
+ },
73
+ body: {
74
+ accentColor: 'secondary',
75
+ accentWidth: '2px',
76
+ borderRadius: '8px',
77
+ boxShadow: 'none',
78
+ horizontalPadding: '30px',
79
+ lineHeight: 1.6
80
+ },
81
+ button: {
82
+ appearance: 'solid',
83
+ borderRadius: '6px',
84
+ borderWidth: '1px',
85
+ boxShadow: 'none',
86
+ letterSpacing: '0.4px'
87
+ },
88
+ footer: {
89
+ accentColor: 'border',
90
+ accentWidth: '1px'
91
+ }
92
+ };
93
+ }
@@ -0,0 +1,92 @@
1
+
2
+ import { ThemeType } from '../../core/enums/theme.enum';
3
+ import { ITheme, IThemeEmailStyles } from './theme.interface';
4
+
5
+ export class SystemTheme implements ITheme {
6
+ id = ThemeType.SYSTEM;
7
+ name = 'System';
8
+
9
+ light = {
10
+ primary: '#3b82f6',
11
+ secondary: '#6b7280',
12
+ background: '#ffffff',
13
+ text: '#111827',
14
+ textMuted: '#6b7280',
15
+ border: '#e5e7eb',
16
+ success: '#10b981',
17
+ error: '#ef4444',
18
+ warning: '#f59e0b'
19
+ };
20
+
21
+ dark = {
22
+ primary: '#3b82f6',
23
+ secondary: '#9ca3af',
24
+ background: '#111827',
25
+ text: '#f9fafb',
26
+ textMuted: '#9ca3af',
27
+ border: '#374151',
28
+ success: '#10b981',
29
+ error: '#ef4444',
30
+ warning: '#f59e0b'
31
+ };
32
+
33
+ typography = {
34
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
35
+ fontSizes: {
36
+ small: '12px',
37
+ medium: '14px',
38
+ large: '16px',
39
+ xlarge: '20px'
40
+ },
41
+ fontWeights: {
42
+ normal: 400,
43
+ medium: 500,
44
+ bold: 700
45
+ }
46
+ };
47
+
48
+ spacing = {
49
+ xs: '4px',
50
+ sm: '8px',
51
+ md: '16px',
52
+ lg: '24px',
53
+ xl: '32px'
54
+ };
55
+
56
+ emailStyles: IThemeEmailStyles = {
57
+ maxWidthPx: 600,
58
+ container: {
59
+ borderColor: 'border',
60
+ borderWidth: '1px',
61
+ borderRadius: '8px',
62
+ boxShadow: '0 1px 3px rgba(0, 0, 0, 0.08)'
63
+ },
64
+ header: {
65
+ accentColor: 'primary',
66
+ accentWidth: '3px',
67
+ horizontalPadding: '24px',
68
+ logoColor: 'primary',
69
+ logoLetterSpacing: '0.01em',
70
+ imageBorderRadius: '4px'
71
+ },
72
+ body: {
73
+ accentColor: 'primary',
74
+ accentWidth: '2px',
75
+ borderRadius: '4px',
76
+ boxShadow: 'none',
77
+ horizontalPadding: '24px',
78
+ lineHeight: 1.6
79
+ },
80
+ button: {
81
+ appearance: 'solid',
82
+ borderRadius: '6px',
83
+ borderWidth: '0px',
84
+ boxShadow: 'none',
85
+ letterSpacing: '0.01em'
86
+ },
87
+ footer: {
88
+ accentColor: 'secondary',
89
+ accentWidth: '1px'
90
+ }
91
+ };
92
+ }
@@ -0,0 +1,95 @@
1
+ import { ThemeType } from "../../core/enums/theme.enum";
2
+
3
+ export type IThemeColorToken = 'primary' | 'secondary' | 'border' | 'none';
4
+ export type IThemeTextTransform = 'none' | 'uppercase' | 'capitalize';
5
+
6
+ /**
7
+ * Optional, email-client-conscious visual tokens used by TemplateBuilder.
8
+ * Existing custom ITheme implementations remain compatible when this is omitted.
9
+ */
10
+ export interface IThemeEmailStyles {
11
+ /** Fixed-width fallback for desktop email clients; the renderer also emits fluid width styles. */
12
+ maxWidthPx: number;
13
+ container: {
14
+ borderColor: IThemeColorToken;
15
+ borderWidth: string;
16
+ borderRadius: string;
17
+ boxShadow: string;
18
+ };
19
+ header: {
20
+ accentColor: IThemeColorToken;
21
+ accentWidth: string;
22
+ horizontalPadding: string;
23
+ logoColor: 'text' | 'primary' | 'secondary';
24
+ logoFontFamily?: string;
25
+ logoTextTransform?: IThemeTextTransform;
26
+ logoLetterSpacing?: string;
27
+ imageBorderRadius: string;
28
+ };
29
+ body: {
30
+ accentColor: IThemeColorToken;
31
+ accentWidth: string;
32
+ borderRadius: string;
33
+ boxShadow: string;
34
+ horizontalPadding: string;
35
+ lineHeight: number;
36
+ };
37
+ button: {
38
+ appearance: 'solid' | 'outline';
39
+ borderRadius: string;
40
+ borderWidth: string;
41
+ boxShadow: string;
42
+ textTransform?: IThemeTextTransform;
43
+ letterSpacing?: string;
44
+ };
45
+ footer: {
46
+ accentColor: IThemeColorToken;
47
+ accentWidth: string;
48
+ };
49
+ }
50
+
51
+ export interface ITheme {
52
+ id: ThemeType;
53
+ name: string;
54
+ light: IThemeColors;
55
+ dark: IThemeColors;
56
+ typography: ITypography;
57
+ spacing: ISpacing;
58
+ /** Optional structural style tokens; omitted tokens fall back to conservative email-safe defaults. */
59
+ emailStyles?: IThemeEmailStyles;
60
+ }
61
+
62
+ export interface IThemeColors {
63
+ primary: string;
64
+ secondary: string;
65
+ background: string;
66
+ text: string;
67
+ textMuted: string;
68
+ border: string;
69
+ success: string;
70
+ error: string;
71
+ warning: string;
72
+ }
73
+
74
+ export interface ITypography {
75
+ fontFamily: string;
76
+ fontSizes: {
77
+ small: string;
78
+ medium: string;
79
+ large: string;
80
+ xlarge: string;
81
+ };
82
+ fontWeights: {
83
+ normal: number;
84
+ medium: number;
85
+ bold: number;
86
+ };
87
+ }
88
+
89
+ export interface ISpacing {
90
+ xs: string;
91
+ sm: string;
92
+ md: string;
93
+ lg: string;
94
+ xl: string;
95
+ }
@@ -0,0 +1 @@
1
+