@tmlmobilidade/emails 20260713.2306.53 → 20260714.1322.11

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.
@@ -1,4 +1,5 @@
1
1
  export * from './generic-notification.js';
2
+ export * from './new-apex-file-notification.js';
2
3
  export * from './plan-approval-request.js';
3
4
  export * from './plan-approved.js';
4
5
  export * from './reset-password.js';
@@ -1,4 +1,5 @@
1
1
  export * from './generic-notification.js';
2
+ export * from './new-apex-file-notification.js';
2
3
  export * from './plan-approval-request.js';
3
4
  export * from './plan-approved.js';
4
5
  export * from './reset-password.js';
@@ -0,0 +1,19 @@
1
+ import { type SendEmailProps } from '../types.js';
2
+ import { type OperationalDate } from '@tmlmobilidade/types';
3
+ export declare const newApexFileNotificationSubject = "Novo ficheiro de configura\u00E7\u00E3o APEX";
4
+ export interface NewApexFileNotificationTemplateProps {
5
+ agencyName: string;
6
+ planId: string;
7
+ startDate: OperationalDate;
8
+ }
9
+ declare function NewApexFileNotificationTemplate({ agencyName, planId, startDate }: NewApexFileNotificationTemplateProps): import("react").JSX.Element;
10
+ declare namespace NewApexFileNotificationTemplate {
11
+ var PreviewProps: {
12
+ agencyName: string;
13
+ planId: string;
14
+ startDate: OperationalDate;
15
+ };
16
+ }
17
+ export default NewApexFileNotificationTemplate;
18
+ export declare const renderNewApexFileNotificationTemplate: (props: NewApexFileNotificationTemplateProps) => Promise<string>;
19
+ export declare const sendNewApexFileNotificationEmail: ({ attachments, data, to }: SendEmailProps<NewApexFileNotificationTemplateProps>) => Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* * */
3
+ import { Anchor } from '../components/Anchor/index.js';
4
+ import { Greeting } from '../components/Greeting/index.js';
5
+ import { Paragraph } from '../components/Paragraph/index.js';
6
+ import { Span } from '../components/Span/index.js';
7
+ import { Wrapper } from '../components/Wrapper/index.js';
8
+ import { emailProvider } from '../email.provider.js';
9
+ import { Dates } from '@tmlmobilidade/dates';
10
+ import { render } from 'react-email';
11
+ /* * */
12
+ export const newApexFileNotificationSubject = 'Novo ficheiro de configuração APEX';
13
+ /* * */
14
+ export default function NewApexFileNotificationTemplate({ agencyName, planId, startDate }) {
15
+ return (_jsxs(Wrapper, { previewMessage: "Notifica\u00E7\u00E3o de novo ficheiro de configura\u00E7\u00E3o APEX.", children: [_jsx(Greeting, { text: "Ol\u00E1 \uD83D\uDC4B" }), _jsxs(Paragraph, { children: ["Foi disponibilizado no GO um novo ficheiro de configura\u00E7\u00E3o APEX para o plano", _jsx(Anchor, { href: `https://go.tmlmobilidade.pt/plans/approved/${planId}`, spaceAfter: true, spaceBefore: true, text: planId }), "do operador", _jsx(Span, { spaceAfter: true, spaceBefore: true, weight: "bold", children: agencyName }), "com in\u00EDcio a", _jsx(Span, { spaceBefore: true, weight: "bold", children: Dates.fromOperationalDate(startDate, 'Europe/Lisbon').toLocaleString(Dates.FORMATS.DATE_FULL_WITH_YEAR, 'pt-PT') }), "."] }), _jsx(Paragraph, { bold: true, color: "success", children: "O ficheiro de configura\u00E7\u00E3o est\u00E1 em anexo neste email." }), _jsx(Paragraph, { children: "Se tiveres alguma quest\u00E3o, entra em contacto connosco via Email ou Teams." })] }));
16
+ }
17
+ ;
18
+ /* * */
19
+ NewApexFileNotificationTemplate.PreviewProps = {
20
+ agencyName: 'Operador 1',
21
+ planId: 'ABC56',
22
+ startDate: '20260101',
23
+ };
24
+ /* * */
25
+ export const renderNewApexFileNotificationTemplate = async (props) => {
26
+ return await render(_jsx(NewApexFileNotificationTemplate, { ...props }));
27
+ };
28
+ /* * */
29
+ export const sendNewApexFileNotificationEmail = async ({ attachments, data, to }) => {
30
+ await emailProvider.send({
31
+ attachments: attachments,
32
+ html: await renderNewApexFileNotificationTemplate(data),
33
+ subject: newApexFileNotificationSubject,
34
+ to: to,
35
+ });
36
+ };
package/dist/types.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ import { type Transport } from 'nodemailer';
1
2
  export interface SendEmailProps<T> {
3
+ attachments?: Transport['mailer']['options']['attachments'];
2
4
  data: T;
3
5
  to: string | string[];
4
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/emails",
3
- "version": "20260713.2306.53",
3
+ "version": "20260714.1322.11",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"