Skip to content

Commit de70226

Browse files
committed
Migrate to @seedcompany/nestjs-email v5
1 parent 3b65c22 commit de70226

18 files changed

+382
-371
lines changed

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"dependencies": {
3232
"@aws-sdk/client-s3": "^3.440.0",
3333
"@aws-sdk/s3-request-presigner": "^3.440.0",
34+
"@faire/mjml-react": "^3.5.0",
3435
"@faker-js/faker": "^9.7.0",
3536
"@fastify/compress": "^8.0.1",
3637
"@fastify/cookie": "^11.0.1",
@@ -51,7 +52,7 @@
5152
"@seedcompany/common": ">=0.19.1 <1",
5253
"@seedcompany/data-loader": "^2.0.1",
5354
"@seedcompany/nest": "^1.8.0",
54-
"@seedcompany/nestjs-email": "^4.3.0",
55+
"@seedcompany/nestjs-email": "^5.0.0-alpha.5",
5556
"@seedcompany/scripture": ">=0.8.0",
5657
"argon2": "^0.43.0",
5758
"aws-xray-sdk-core": "^3.5.3",
@@ -91,13 +92,14 @@
9192
"lru-cache": "^11.0.1",
9293
"luxon": "^3.5.0",
9394
"mime": "^4.0.7",
95+
"mjml": "^4.15.3",
9496
"nanoid": "^5.1.5",
9597
"neo4j-driver": "^5.28.1",
9698
"p-retry": "^6.2.1",
9799
"plur": "^5.1.0",
98100
"prismjs-terminal": "^1.2.3",
99-
"react": "^18.2.0",
100-
"react-dom": "^18.2.0",
101+
"react": "^19.1.0",
102+
"react-dom": "^19.1.0",
101103
"read-package-up": "^11.0.0",
102104
"reflect-metadata": "^0.2.2",
103105
"rimraf": "^6.0.1",
@@ -129,7 +131,7 @@
129131
"@types/luxon": "^3.6.2",
130132
"@types/node": "^22.7.8",
131133
"@types/prismjs": "^1.26.2",
132-
"@types/react": "^18.2.33",
134+
"@types/react": "^19.1.8",
133135
"@types/stack-trace": "^0.0.33",
134136
"@types/triple-beam": "^1.3.4",
135137
"@types/validator": "^13.11.5",

src/components/dbl-upload-notification/handlers/dbl-upload-notification.handler.ts renamed to src/components/dbl-upload-notification/handlers/dbl-upload-notification.handler.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
type NonEmptyArray,
66
setOf,
77
} from '@seedcompany/common';
8-
import { EmailService } from '@seedcompany/nestjs-email';
98
import {
109
Book,
1110
mergeVerseRanges,
@@ -23,6 +22,7 @@ import {
2322
ResourceLoader,
2423
} from '~/core';
2524
import { Identity } from '~/core/authentication';
25+
import { MailerService } from '~/core/email';
2626
import {
2727
type ProgressReport,
2828
ProgressReportStatus as Status,
@@ -49,7 +49,7 @@ export class DBLUploadNotificationHandler
4949
private readonly moduleRef: ModuleRef,
5050
private readonly resources: ResourceLoader,
5151
private readonly config: ConfigService,
52-
private readonly mailer: EmailService,
52+
private readonly mailer: MailerService,
5353
@Logger('progress-report:dbl-upload-notifier')
5454
private readonly logger: ILogger,
5555
) {}
@@ -123,13 +123,15 @@ export class DBLUploadNotificationHandler
123123
const to = props.recipient.email.value!;
124124
await this.mailer
125125
.withOptions({ send: !!this.config.email.notifyDblUpload })
126-
.render(DBLUpload, props)
127-
.with({
128-
to,
129-
...(this.config.email.notifyDblUpload && {
130-
'reply-to': this.config.email.notifyDblUpload.replyTo,
131-
}),
132-
})
126+
.compose(
127+
{
128+
to,
129+
...(this.config.email.notifyDblUpload && {
130+
'reply-to': this.config.email.notifyDblUpload.replyTo,
131+
}),
132+
},
133+
<DBLUpload {...props} />,
134+
)
133135
.send();
134136
}
135137
}
Lines changed: 84 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import { type NonEmptyArray } from '@seedcompany/common';
2-
import {
3-
Column,
4-
Text as Head,
5-
Section,
6-
Text,
7-
} from '@seedcompany/nestjs-email/templates';
82
import type { Verse } from '@seedcompany/scripture';
93
import type { Range } from '~/common';
10-
import { EmailTemplate } from '~/core/email/templates/base';
11-
import { useFrontendUrl } from '~/core/email/templates/frontend-url';
12-
import { LanguageRef } from '~/core/email/templates/user-ref';
4+
import { EmailTemplate, LanguageRef, Mjml, useFrontendUrl } from '~/core/email';
135
import { type Engagement } from '../../../components/engagement/dto';
146
import { type Language } from '../../../components/language/dto';
157
import { type Project } from '../../../components/project/dto';
@@ -29,133 +21,137 @@ export function DBLUpload(props: Props) {
2921
const languageName = language.name.value;
3022
return (
3123
<EmailTemplate title={`${languageName || 'Language'} needs a DBL upload`}>
32-
<Section>
33-
<Column>
34-
<Text>
24+
<Mjml.Section>
25+
<Mjml.Column>
26+
<Mjml.Text>
3527
<LanguageRef {...language} /> has recently indicated reaching some
3628
All Access goals via{' '}
3729
<a href={useFrontendUrl(`/engagements/${engagement.id}`)}>
3830
{project.name.value ?? 'Some Project'}
3931
</a>
4032
.
41-
</Text>
42-
<Text>
33+
</Mjml.Text>
34+
<Mjml.Text>
4335
Books:{' '}
4436
{completedBooks.map((range) => range.start.book.name).join(', ')}
45-
</Text>
46-
</Column>
47-
</Section>
48-
<Section>
49-
<Column>
50-
<Text>
37+
</Mjml.Text>
38+
</Mjml.Column>
39+
</Mjml.Section>
40+
<Mjml.Section>
41+
<Mjml.Column>
42+
<Mjml.Text>
5143
Our records identify you as the Field Project Manager (FPM), and
5244
we’d like to confirm the next steps for uploading the text to the
5345
Digital Bible Library (DBL).
54-
</Text>
55-
<Text>
46+
</Mjml.Text>
47+
<Mjml.Text>
5648
To move forward, we need a few details from you. Please have your
5749
field partner complete this short form to provide the necessary
5850
information indicated below:
59-
</Text>
60-
</Column>
61-
</Section>
62-
<Section>
63-
<Column>
64-
<Head>✅ First Step: Who will upload the Scripture to the DBL?</Head>
65-
<Text>
51+
</Mjml.Text>
52+
</Mjml.Column>
53+
</Mjml.Section>
54+
<Mjml.Section>
55+
<Mjml.Column>
56+
<Mjml.Text>
57+
✅ First Step: Who will upload the Scripture to the DBL?
58+
</Mjml.Text>
59+
<Mjml.Text>
6660
1. If someone is already responsible for uploading to the DBL,
6761
please let us know on the form so we can update our records and
6862
avoid unnecessary follow-ups.
69-
</Text>
70-
<Text>
63+
</Mjml.Text>
64+
<Mjml.Text>
7165
2. If you need Seed Company to upload it to the DBL, we will need
7266
additional information.
73-
</Text>
74-
</Column>
75-
</Section>
76-
<Section>
77-
<Column>
78-
<Head>✅ If Seed Company uploads to the DBL, please provide:</Head>
79-
<Text>
67+
</Mjml.Text>
68+
</Mjml.Column>
69+
</Mjml.Section>
70+
<Mjml.Section>
71+
<Mjml.Column>
72+
<Mjml.Text>
73+
✅ If Seed Company uploads to the DBL, please provide:
74+
</Mjml.Text>
75+
<Mjml.Text>
8076
🔹 Copyright Holder & Licensing Who will hold the copyright for
8177
this text in DBL?
82-
</Text>
83-
<Text>
78+
</Mjml.Text>
79+
<Mjml.Text>
8480
The copyright holder can be the field partner or Seed Company if
8581
needed.
86-
</Text>
87-
<Text>
82+
</Mjml.Text>
83+
<Mjml.Text>
8884
We also need to confirm the licensing options you prefer for
8985
distribution. More details on these options are included in the
9086
attached information sheet.
91-
</Text>
92-
</Column>
93-
</Section>
94-
<Section>
95-
<Column>
96-
<Text>
87+
</Mjml.Text>
88+
</Mjml.Column>
89+
</Mjml.Section>
90+
<Mjml.Section>
91+
<Mjml.Column>
92+
<Mjml.Text>
9793
🔹 Error-Free Text in Paratext – The text must pass Basic Checks in
9894
Paratext without errors.
99-
</Text>
100-
<Text>
95+
</Mjml.Text>
96+
<Mjml.Text>
10197
A quick way to verify is by printing the text to PDF format using
10298
PTXPrint (
10399
<a href="https://software.sil.org/ptxprint/">learn here</a>).
104100
Besides, our Investors love to see your progress and this is a great
105101
way to share it with them! 😊
106-
</Text>
107-
<Text>
102+
</Mjml.Text>
103+
<Mjml.Text>
108104
If errors appear, they must be fixed before we can proceed.
109-
</Text>
110-
</Column>
111-
</Section>
112-
<Section>
113-
<Column>
114-
<Text>
105+
</Mjml.Text>
106+
</Mjml.Column>
107+
</Mjml.Section>
108+
<Mjml.Section>
109+
<Mjml.Column>
110+
<Mjml.Text>
115111
🔹 Paratext Project Access – We need access to the project in
116112
Paratext.
117-
</Text>
118-
<Text>
113+
</Mjml.Text>
114+
<Mjml.Text>
119115
Please add SC DBL Admin to the project with the Consultant/Archivist
120116
role.
121-
</Text>
122-
<Text>
117+
</Mjml.Text>
118+
<Mjml.Text>
123119
This permission level is required for us to complete the upload.
124-
</Text>
125-
</Column>
126-
</Section>
127-
<Section>
128-
<Column>
129-
<Text>
120+
</Mjml.Text>
121+
</Mjml.Column>
122+
</Mjml.Section>
123+
<Mjml.Section>
124+
<Mjml.Column>
125+
<Mjml.Text>
130126
🔹 Books Ready for Upload – Please confirm which books are ready for
131127
DBL.
132-
</Text>
133-
<Text>
128+
</Mjml.Text>
129+
<Mjml.Text>
134130
We can upload an entire testament or individual books that have
135131
completed consultant checking.
136-
</Text>
137-
</Column>
138-
</Section>
139-
<Section>
140-
<Column>
141-
<Head>
132+
</Mjml.Text>
133+
</Mjml.Column>
134+
</Mjml.Section>
135+
<Mjml.Section>
136+
<Mjml.Column>
137+
<Mjml.Text>
142138
🔗{' '}
143139
<a href={dblFormUrl}>Seed Company DBL Publication Request Form</a>
144-
</Head>
145-
</Column>
146-
</Section>
147-
<Section>
148-
<Column>
149-
<Text>
140+
</Mjml.Text>
141+
</Mjml.Column>
142+
</Mjml.Section>
143+
<Mjml.Section>
144+
<Mjml.Column>
145+
<Mjml.Text>
150146
All of this information can be entered in the form linked above
151147
(with yellow highlight).
152-
</Text>
153-
<Text>
148+
</Mjml.Text>
149+
<Mjml.Text>
154150
Let me know if you have any questions—I’m happy to assist!
155-
</Text>
156-
<Text>Best regards, Darcie</Text>
157-
</Column>
158-
</Section>
151+
</Mjml.Text>
152+
<Mjml.Text>Best regards, Darcie</Mjml.Text>
153+
</Mjml.Column>
154+
</Mjml.Section>
159155
</EmailTemplate>
160156
);
161157
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { entries, mapEntries } from '@seedcompany/common';
2-
import { EmailService } from '@seedcompany/nestjs-email';
32
import { type RequireExactlyOne } from 'type-fest';
43
import { type ID, Role, type UnsecuredDto } from '~/common';
54
import {
@@ -10,6 +9,7 @@ import {
109
Logger,
1110
} from '~/core';
1211
import { Identity } from '~/core/authentication';
12+
import { MailerService } from '~/core/email';
1313
import {
1414
type ProgressReportStatusChangedProps as EmailReportStatusNotification,
1515
ProgressReportStatusChanged,
@@ -43,7 +43,7 @@ export class ProgressReportWorkflowNotificationHandler
4343
private readonly projectService: ProjectService,
4444
private readonly languageService: LanguageService,
4545
private readonly reportService: PeriodicReportService,
46-
private readonly emailService: EmailService,
46+
private readonly mailer: MailerService,
4747
private readonly workflowService: ProgressReportWorkflowService,
4848
@Logger('progress-report:status-change-notifier')
4949
private readonly logger: ILogger,
@@ -95,11 +95,12 @@ export class ProgressReportWorkflowNotificationHandler
9595

9696
for (const notification of notifications) {
9797
if (notification.recipient.email.value) {
98-
await this.emailService.send(
99-
notification.recipient.email.value,
100-
ProgressReportStatusChanged,
101-
notification,
102-
);
98+
await this.mailer
99+
.compose(
100+
notification.recipient.email.value,
101+
<ProgressReportStatusChanged {...notification} />,
102+
)
103+
.send();
103104
}
104105
}
105106
}

0 commit comments

Comments
 (0)