@shogo-ai/email 1.4.1
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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/chunk-VPWVZHAC.js +882 -0
- package/dist/index.cjs +923 -0
- package/dist/index.d.cts +136 -0
- package/dist/index.d.ts +136 -0
- package/dist/index.js +37 -0
- package/dist/server.cjs +1059 -0
- package/dist/server.d.cts +109 -0
- package/dist/server.d.ts +109 -0
- package/dist/server.js +404 -0
- package/dist/types-CCHryvHe.d.cts +196 -0
- package/dist/types-CCHryvHe.d.ts +196 -0
- package/package.json +74 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { E as EmailTemplate } from './types-CCHryvHe.cjs';
|
|
2
|
+
export { a as EmailAddress, b as EmailConfig, c as EmailError, d as EmailErrorCode, e as EmailProviderType, f as EmailResult, I as IEmailProvider, g as IEmailService, O as OciEmailConfig, S as SendEmailParams, h as SendTemplateParams, i as SesConfig, j as SmtpConfig, T as TemplateRegistry, k as formatEmailAddress } from './types-CCHryvHe.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Email Template System
|
|
6
|
+
*
|
|
7
|
+
* Simple template system using {{variable}} interpolation.
|
|
8
|
+
* No dependencies - just string replacement.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Interpolate variables into a template string.
|
|
13
|
+
*
|
|
14
|
+
* Replaces {{variableName}} with the corresponding value from data.
|
|
15
|
+
* Supports nested access: {{user.name}} → data.user.name
|
|
16
|
+
*
|
|
17
|
+
* @param template - Template string with {{variable}} placeholders
|
|
18
|
+
* @param data - Data object with values to interpolate
|
|
19
|
+
* @returns Interpolated string
|
|
20
|
+
*/
|
|
21
|
+
declare function interpolate(template: string, data: Record<string, unknown>): string;
|
|
22
|
+
/**
|
|
23
|
+
* Strip HTML tags to create plain text version.
|
|
24
|
+
*
|
|
25
|
+
* @param html - HTML string
|
|
26
|
+
* @returns Plain text string
|
|
27
|
+
*/
|
|
28
|
+
declare function htmlToText(html: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Template registry class for managing email templates.
|
|
31
|
+
*/
|
|
32
|
+
declare class EmailTemplateRegistry {
|
|
33
|
+
private templates;
|
|
34
|
+
/**
|
|
35
|
+
* Register a template
|
|
36
|
+
*/
|
|
37
|
+
register<TData extends Record<string, unknown>>(template: EmailTemplate<TData>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get a template by name
|
|
40
|
+
*/
|
|
41
|
+
get(name: string): EmailTemplate | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a template exists
|
|
44
|
+
*/
|
|
45
|
+
has(name: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Render a template with data
|
|
48
|
+
*/
|
|
49
|
+
render<TData extends Record<string, unknown>>(name: string, data: TData): {
|
|
50
|
+
subject: string;
|
|
51
|
+
html: string;
|
|
52
|
+
text: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* List all registered template names
|
|
56
|
+
*/
|
|
57
|
+
list(): string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Built-in welcome email template
|
|
61
|
+
*/
|
|
62
|
+
declare const welcomeTemplate: EmailTemplate<{
|
|
63
|
+
name: string;
|
|
64
|
+
appName: string;
|
|
65
|
+
loginUrl?: string;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Built-in password reset email template
|
|
69
|
+
*/
|
|
70
|
+
declare const passwordResetTemplate: EmailTemplate<{
|
|
71
|
+
name?: string;
|
|
72
|
+
appName: string;
|
|
73
|
+
resetUrl: string;
|
|
74
|
+
expiresIn?: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Built-in invitation email template
|
|
78
|
+
*/
|
|
79
|
+
declare const invitationTemplate: EmailTemplate<{
|
|
80
|
+
inviterName: string;
|
|
81
|
+
resourceName: string;
|
|
82
|
+
resourceType?: string;
|
|
83
|
+
role?: string;
|
|
84
|
+
acceptUrl: string;
|
|
85
|
+
appName: string;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Built-in notification email template
|
|
89
|
+
*/
|
|
90
|
+
declare const notificationTemplate: EmailTemplate<{
|
|
91
|
+
title: string;
|
|
92
|
+
message: string;
|
|
93
|
+
actionUrl?: string;
|
|
94
|
+
actionText?: string;
|
|
95
|
+
appName: string;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* All built-in templates
|
|
99
|
+
*/
|
|
100
|
+
declare const builtinTemplates: EmailTemplate[];
|
|
101
|
+
/**
|
|
102
|
+
* Create a template registry with built-in templates pre-registered
|
|
103
|
+
*/
|
|
104
|
+
declare function createTemplateRegistry(): EmailTemplateRegistry;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Shared Shogo email layout.
|
|
108
|
+
* All templates wrap their content with this layout for consistent branding.
|
|
109
|
+
* Uses <style> block with CSS classes — no inline styles.
|
|
110
|
+
*/
|
|
111
|
+
declare const EMAIL_CONSTANTS: {
|
|
112
|
+
readonly APP_NAME: "Shogo";
|
|
113
|
+
readonly APP_URL: "https://shogo.ai";
|
|
114
|
+
readonly SUPPORT_EMAIL: "support@shogo.ai";
|
|
115
|
+
readonly LOGO_URL: "https://shogo.ai/assets/images/shogo-logo-email.png";
|
|
116
|
+
readonly LOGO_DARK_URL: "https://shogo.ai/assets/images/shogo-logo-dark-email.png";
|
|
117
|
+
readonly FOOTER_TEXT: "© {{currentYear}} Shogo. All rights reserved";
|
|
118
|
+
};
|
|
119
|
+
/** Dark overrides without media query — used by the preview tool to force dark mode. */
|
|
120
|
+
declare const DARK_STYLE_OVERRIDES: string;
|
|
121
|
+
declare function wrapInLayout(content: string): string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Shogo Email Templates
|
|
125
|
+
*
|
|
126
|
+
* All Shogo-branded transactional email templates.
|
|
127
|
+
* Uses <style> blocks with CSS classes — no inline styles.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
declare const allTemplates: EmailTemplate[];
|
|
131
|
+
/**
|
|
132
|
+
* Create a template registry pre-loaded with all Shogo templates.
|
|
133
|
+
*/
|
|
134
|
+
declare function createShogoTemplateRegistry(): EmailTemplateRegistry;
|
|
135
|
+
|
|
136
|
+
export { DARK_STYLE_OVERRIDES, EMAIL_CONSTANTS, EmailTemplate, EmailTemplateRegistry, builtinTemplates, createShogoTemplateRegistry, createTemplateRegistry, htmlToText, interpolate, invitationTemplate, notificationTemplate, passwordResetTemplate, allTemplates as shogoTemplates, welcomeTemplate, wrapInLayout };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { E as EmailTemplate } from './types-CCHryvHe.js';
|
|
2
|
+
export { a as EmailAddress, b as EmailConfig, c as EmailError, d as EmailErrorCode, e as EmailProviderType, f as EmailResult, I as IEmailProvider, g as IEmailService, O as OciEmailConfig, S as SendEmailParams, h as SendTemplateParams, i as SesConfig, j as SmtpConfig, T as TemplateRegistry, k as formatEmailAddress } from './types-CCHryvHe.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Email Template System
|
|
6
|
+
*
|
|
7
|
+
* Simple template system using {{variable}} interpolation.
|
|
8
|
+
* No dependencies - just string replacement.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Interpolate variables into a template string.
|
|
13
|
+
*
|
|
14
|
+
* Replaces {{variableName}} with the corresponding value from data.
|
|
15
|
+
* Supports nested access: {{user.name}} → data.user.name
|
|
16
|
+
*
|
|
17
|
+
* @param template - Template string with {{variable}} placeholders
|
|
18
|
+
* @param data - Data object with values to interpolate
|
|
19
|
+
* @returns Interpolated string
|
|
20
|
+
*/
|
|
21
|
+
declare function interpolate(template: string, data: Record<string, unknown>): string;
|
|
22
|
+
/**
|
|
23
|
+
* Strip HTML tags to create plain text version.
|
|
24
|
+
*
|
|
25
|
+
* @param html - HTML string
|
|
26
|
+
* @returns Plain text string
|
|
27
|
+
*/
|
|
28
|
+
declare function htmlToText(html: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Template registry class for managing email templates.
|
|
31
|
+
*/
|
|
32
|
+
declare class EmailTemplateRegistry {
|
|
33
|
+
private templates;
|
|
34
|
+
/**
|
|
35
|
+
* Register a template
|
|
36
|
+
*/
|
|
37
|
+
register<TData extends Record<string, unknown>>(template: EmailTemplate<TData>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get a template by name
|
|
40
|
+
*/
|
|
41
|
+
get(name: string): EmailTemplate | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a template exists
|
|
44
|
+
*/
|
|
45
|
+
has(name: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Render a template with data
|
|
48
|
+
*/
|
|
49
|
+
render<TData extends Record<string, unknown>>(name: string, data: TData): {
|
|
50
|
+
subject: string;
|
|
51
|
+
html: string;
|
|
52
|
+
text: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* List all registered template names
|
|
56
|
+
*/
|
|
57
|
+
list(): string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Built-in welcome email template
|
|
61
|
+
*/
|
|
62
|
+
declare const welcomeTemplate: EmailTemplate<{
|
|
63
|
+
name: string;
|
|
64
|
+
appName: string;
|
|
65
|
+
loginUrl?: string;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Built-in password reset email template
|
|
69
|
+
*/
|
|
70
|
+
declare const passwordResetTemplate: EmailTemplate<{
|
|
71
|
+
name?: string;
|
|
72
|
+
appName: string;
|
|
73
|
+
resetUrl: string;
|
|
74
|
+
expiresIn?: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Built-in invitation email template
|
|
78
|
+
*/
|
|
79
|
+
declare const invitationTemplate: EmailTemplate<{
|
|
80
|
+
inviterName: string;
|
|
81
|
+
resourceName: string;
|
|
82
|
+
resourceType?: string;
|
|
83
|
+
role?: string;
|
|
84
|
+
acceptUrl: string;
|
|
85
|
+
appName: string;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Built-in notification email template
|
|
89
|
+
*/
|
|
90
|
+
declare const notificationTemplate: EmailTemplate<{
|
|
91
|
+
title: string;
|
|
92
|
+
message: string;
|
|
93
|
+
actionUrl?: string;
|
|
94
|
+
actionText?: string;
|
|
95
|
+
appName: string;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* All built-in templates
|
|
99
|
+
*/
|
|
100
|
+
declare const builtinTemplates: EmailTemplate[];
|
|
101
|
+
/**
|
|
102
|
+
* Create a template registry with built-in templates pre-registered
|
|
103
|
+
*/
|
|
104
|
+
declare function createTemplateRegistry(): EmailTemplateRegistry;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Shared Shogo email layout.
|
|
108
|
+
* All templates wrap their content with this layout for consistent branding.
|
|
109
|
+
* Uses <style> block with CSS classes — no inline styles.
|
|
110
|
+
*/
|
|
111
|
+
declare const EMAIL_CONSTANTS: {
|
|
112
|
+
readonly APP_NAME: "Shogo";
|
|
113
|
+
readonly APP_URL: "https://shogo.ai";
|
|
114
|
+
readonly SUPPORT_EMAIL: "support@shogo.ai";
|
|
115
|
+
readonly LOGO_URL: "https://shogo.ai/assets/images/shogo-logo-email.png";
|
|
116
|
+
readonly LOGO_DARK_URL: "https://shogo.ai/assets/images/shogo-logo-dark-email.png";
|
|
117
|
+
readonly FOOTER_TEXT: "© {{currentYear}} Shogo. All rights reserved";
|
|
118
|
+
};
|
|
119
|
+
/** Dark overrides without media query — used by the preview tool to force dark mode. */
|
|
120
|
+
declare const DARK_STYLE_OVERRIDES: string;
|
|
121
|
+
declare function wrapInLayout(content: string): string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Shogo Email Templates
|
|
125
|
+
*
|
|
126
|
+
* All Shogo-branded transactional email templates.
|
|
127
|
+
* Uses <style> blocks with CSS classes — no inline styles.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
declare const allTemplates: EmailTemplate[];
|
|
131
|
+
/**
|
|
132
|
+
* Create a template registry pre-loaded with all Shogo templates.
|
|
133
|
+
*/
|
|
134
|
+
declare function createShogoTemplateRegistry(): EmailTemplateRegistry;
|
|
135
|
+
|
|
136
|
+
export { DARK_STYLE_OVERRIDES, EMAIL_CONSTANTS, EmailTemplate, EmailTemplateRegistry, builtinTemplates, createShogoTemplateRegistry, createTemplateRegistry, htmlToText, interpolate, invitationTemplate, notificationTemplate, passwordResetTemplate, allTemplates as shogoTemplates, welcomeTemplate, wrapInLayout };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DARK_STYLE_OVERRIDES,
|
|
3
|
+
EMAIL_CONSTANTS,
|
|
4
|
+
EmailError,
|
|
5
|
+
EmailTemplateRegistry,
|
|
6
|
+
allTemplates,
|
|
7
|
+
builtinTemplates,
|
|
8
|
+
createShogoTemplateRegistry,
|
|
9
|
+
createTemplateRegistry,
|
|
10
|
+
formatEmailAddress,
|
|
11
|
+
htmlToText,
|
|
12
|
+
interpolate,
|
|
13
|
+
invitationTemplate,
|
|
14
|
+
notificationTemplate,
|
|
15
|
+
passwordResetTemplate,
|
|
16
|
+
welcomeTemplate,
|
|
17
|
+
wrapInLayout
|
|
18
|
+
} from "./chunk-VPWVZHAC.js";
|
|
19
|
+
export {
|
|
20
|
+
DARK_STYLE_OVERRIDES,
|
|
21
|
+
EMAIL_CONSTANTS,
|
|
22
|
+
EmailError,
|
|
23
|
+
EmailTemplateRegistry,
|
|
24
|
+
builtinTemplates,
|
|
25
|
+
createShogoTemplateRegistry,
|
|
26
|
+
createTemplateRegistry,
|
|
27
|
+
formatEmailAddress,
|
|
28
|
+
htmlToText,
|
|
29
|
+
interpolate,
|
|
30
|
+
invitationTemplate,
|
|
31
|
+
notificationTemplate,
|
|
32
|
+
passwordResetTemplate,
|
|
33
|
+
allTemplates as shogoTemplates,
|
|
34
|
+
welcomeTemplate,
|
|
35
|
+
wrapInLayout
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=index.js.map
|