@tmlmobilidade/emails 20251006.1413.25 → 20251006.1604.57-staging.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.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { FailedBackupEmailProps } from './src/emails/failed-backup.js';
2
+ import { NotificationEmailProps } from './src/emails/notification-email.js';
2
3
  import { PlanApprovalRequestEmailProps } from './src/emails/plan-approval-request.js';
3
4
  import { ResetPasswordEmailProps } from './src/emails/reset-password.js';
4
5
  import { SucessfulGtfsValidationEmailProps } from './src/emails/sucessful-gtfs-validation.js';
5
6
  import { UnsuccessfulGtfsValidationEmailProps } from './src/emails/unsucessful-gtfs-validation.js';
6
7
  import { WelcomeEmailProps } from './src/emails/welcome.js';
7
- export type { FailedBackupEmailProps, PlanApprovalRequestEmailProps, ResetPasswordEmailProps, SucessfulGtfsValidationEmailProps, UnsuccessfulGtfsValidationEmailProps, WelcomeEmailProps, };
8
+ export type { FailedBackupEmailProps, NotificationEmailProps, PlanApprovalRequestEmailProps, ResetPasswordEmailProps, SucessfulGtfsValidationEmailProps, UnsuccessfulGtfsValidationEmailProps, WelcomeEmailProps, };
8
9
  export * from './src/renderer.js';
9
10
  export interface SendEmailProps<T> {
10
11
  props: T;
@@ -15,3 +16,4 @@ export declare function sendResetPasswordEmail(props: SendEmailProps<ResetPasswo
15
16
  export declare function sendWelcomeEmail(props: SendEmailProps<WelcomeEmailProps>): Promise<void>;
16
17
  export declare function sendGtfsValidationEmail(props: SendEmailProps<SucessfulGtfsValidationEmailProps | UnsuccessfulGtfsValidationEmailProps>): Promise<void>;
17
18
  export declare function sendPlanApprovalRequestEmail(props: SendEmailProps<PlanApprovalRequestEmailProps>): Promise<void>;
19
+ export declare function sendNotificationEmail(props: SendEmailProps<NotificationEmailProps>): Promise<void>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* * */
2
2
  import { emailProvider } from './src/email.provider.js';
3
- import { RenderFailedBackupEmail, RenderPlanApprovalRequestEmail, RenderResetPasswordEmail, RenderSucessfulGtfsValidationEmail, RenderUnsuccessfulGtfsValidationEmail, RenderWelcomeEmail } from './src/renderer.js';
3
+ import { RenderEmailNotificationEmail, RenderFailedBackupEmail, RenderPlanApprovalRequestEmail, RenderResetPasswordEmail, RenderSucessfulGtfsValidationEmail, RenderUnsuccessfulGtfsValidationEmail, RenderWelcomeEmail } from './src/renderer.js';
4
4
  export * from './src/renderer.js';
5
5
  export async function sendFailedBackupEmail(props) {
6
6
  const emailHtml = await RenderFailedBackupEmail(props.props);
@@ -50,3 +50,12 @@ export async function sendPlanApprovalRequestEmail(props) {
50
50
  });
51
51
  }
52
52
  ;
53
+ export async function sendNotificationEmail(props) {
54
+ const emailHtml = await RenderEmailNotificationEmail(props.props);
55
+ await emailProvider.send({
56
+ html: emailHtml,
57
+ subject: 'Nova Notificação',
58
+ to: props.to,
59
+ });
60
+ }
61
+ ;
@@ -0,0 +1,10 @@
1
+ export interface NotificationEmailProps {
2
+ body: string;
3
+ href: string;
4
+ priority: string;
5
+ scope: string;
6
+ title: string;
7
+ topic: string;
8
+ }
9
+ export declare function NotificationEmail({ body, href, priority, scope, title, topic }: NotificationEmailProps): import("react/jsx-runtime").JSX.Element;
10
+ export default NotificationEmail;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* * */
3
+ import { EmailWrapper, InfoBox, styles } from '../components/index.js';
4
+ import { Button, Hr, Section, Text } from '@react-email/components';
5
+ /* * */
6
+ export function NotificationEmail({ body, href, priority, scope, title, topic }) {
7
+ //
8
+ //
9
+ // A. Setup variables
10
+ const priorityMap = {
11
+ high: 'Alta',
12
+ low: 'Baixa',
13
+ normal: 'Média',
14
+ };
15
+ //
16
+ // B. Render components
17
+ return (_jsx(EmailWrapper, { preview: "Nova notifica\u00E7\u00E3o", children: _jsxs(Section, { children: [_jsx(Text, { style: styles.text, children: "\uD83D\uDC4B Ol\u00E1," }), _jsx(Text, { style: styles.text, children: "Tens uma nova notifica\u00E7\u00E3o." }), _jsx(Hr, { style: { margin: '24px 0' } }), _jsxs(InfoBox, { variant: "info", children: [_jsx(Text, { style: { ...styles.text, margin: '0 0 12px 0' }, children: _jsx("strong", { children: "\uD83D\uDD14 Detalhes da Notifica\u00E7\u00E3o" }) }), _jsxs(Text, { style: { ...styles.text, margin: '8px 0' }, children: [_jsx("strong", { children: "Titulo:" }), ' ', title, _jsx("br", {}), _jsx("strong", { children: "Descri\u00E7\u00E3o:" }), ' ', body, _jsx("br", {}), _jsx("strong", { children: "Prioridade:" }), ' ', priorityMap[priority]] })] }), _jsx(Button, { href: href, style: styles.button, children: "Ver Notifica\u00E7\u00E3o" })] }) }));
18
+ //
19
+ }
20
+ ;
21
+ export default NotificationEmail;
@@ -1,4 +1,5 @@
1
1
  import { FailedBackupEmailProps } from './emails/failed-backup.js';
2
+ import { NotificationEmailProps } from './emails/notification-email.js';
2
3
  import { PlanApprovalRequestEmailProps } from './emails/plan-approval-request.js';
3
4
  import { ResetPasswordEmailProps } from './emails/reset-password.js';
4
5
  import { SucessfulGtfsValidationEmailProps } from './emails/sucessful-gtfs-validation.js';
@@ -10,3 +11,4 @@ export declare const RenderWelcomeEmail: (props: WelcomeEmailProps) => Promise<s
10
11
  export declare const RenderSucessfulGtfsValidationEmail: (props: SucessfulGtfsValidationEmailProps) => Promise<string>;
11
12
  export declare const RenderUnsuccessfulGtfsValidationEmail: (props: UnsuccessfulGtfsValidationEmailProps) => Promise<string>;
12
13
  export declare const RenderPlanApprovalRequestEmail: (props: PlanApprovalRequestEmailProps) => Promise<string>;
14
+ export declare const RenderEmailNotificationEmail: (props: NotificationEmailProps) => Promise<string>;
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { render } from '@react-email/components';
4
4
  /* * */
5
5
  import { FailedBackupEmail } from './emails/failed-backup.js';
6
+ import { NotificationEmail } from './emails/notification-email.js';
6
7
  import { PlanApprovalRequestEmail } from './emails/plan-approval-request.js';
7
8
  import { ResetPasswordEmail } from './emails/reset-password.js';
8
9
  import { SucessfulGtfsValidationEmail } from './emails/sucessful-gtfs-validation.js';
@@ -27,3 +28,6 @@ export const RenderUnsuccessfulGtfsValidationEmail = async (props) => {
27
28
  export const RenderPlanApprovalRequestEmail = async (props) => {
28
29
  return await render(_jsx(PlanApprovalRequestEmail, { ...props }));
29
30
  };
31
+ export const RenderEmailNotificationEmail = async (props) => {
32
+ return await render(_jsx(NotificationEmail, { ...props }));
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/emails",
3
- "version": "20251006.1413.25",
3
+ "version": "20251006.1604.57-staging.0",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",
@@ -41,7 +41,7 @@
41
41
  "@tmlmobilidade/utils": "*",
42
42
  "@types/nodemailer": "7.0.2",
43
43
  "browserslist": "4.26.3",
44
- "nodemailer": "7.0.7",
44
+ "nodemailer": "7.0.6",
45
45
  "react": "19.1.1",
46
46
  "react-email": "4.2.12"
47
47
  },
@@ -51,7 +51,7 @@
51
51
  "@tmlmobilidade/lib": "*",
52
52
  "@tmlmobilidade/tsconfig": "*",
53
53
  "@tmlmobilidade/types": "*",
54
- "@types/node": "24.7.0",
54
+ "@types/node": "24.6.1",
55
55
  "resolve-tspaths": "0.8.23",
56
56
  "rimraf": "6.0.1",
57
57
  "typescript": "5.9.3"