@brightweblabs/ui 1.5.2 → 1.5.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@brightweblabs/ui",
3
3
  "private": false,
4
- "version": "1.5.2",
4
+ "version": "1.5.3",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
7
7
  "files": [
@@ -35,6 +35,25 @@ test("invitation email creates an accessible branded HTML and text pair", () =>
35
35
  assert.doesNotMatch(email.html, /Verde & Filhos <Lda>/);
36
36
  assert.match(email.text, /Organização: Verde & Filhos <Lda>/);
37
37
  assert.match(email.text, /24 de agosto de 2026/);
38
+ assert.match(email.html, /Este convite foi enviado para ana@example\.com/);
39
+ });
40
+
41
+ test("transactional email can use non-invitation recipient wording", () => {
42
+ const email = buildInvitationEmail({
43
+ brandName: "BeGreen Consulting",
44
+ preheader: "A sua conta foi atualizada.",
45
+ eyebrow: "Aviso de segurança",
46
+ title: "Alteração concluída",
47
+ introduction: "A operação foi concluída.",
48
+ details: [{ label: "Estado", value: "Concluído" }],
49
+ recipientEmail: "ana@example.com",
50
+ recipientLabel: "Esta mensagem foi enviada para",
51
+ closingNote: "Se não reconhece esta mensagem, pode ignorá-la em segurança.",
52
+ });
53
+
54
+ assert.match(email.html, /Esta mensagem foi enviada para ana@example\.com/);
55
+ assert.match(email.text, /Esta mensagem foi enviada para ana@example\.com/);
56
+ assert.doesNotMatch(email.html, /convite/i);
38
57
  });
39
58
 
40
59
  test("email brand name follows the configured sender display name", () => {
@@ -90,6 +90,7 @@ export type TransactionalEmailContent = {
90
90
  actionUrl?: string;
91
91
  expiresLabel?: string | null;
92
92
  recipientEmail?: string;
93
+ recipientLabel?: string;
93
94
  closingNote?: string;
94
95
  palette?: Partial<TransactionalEmailPalette>;
95
96
  };
@@ -131,6 +132,7 @@ export function buildTransactionalEmail(content: TransactionalEmailContent): Tra
131
132
  const hasAction = Boolean(actionLabel && actionUrl);
132
133
  const expiresLabel = content.expiresLabel ? escapeHtml(content.expiresLabel) : null;
133
134
  const recipientEmail = content.recipientEmail ? escapeHtml(content.recipientEmail) : null;
135
+ const recipientLabel = escapeHtml(content.recipientLabel ?? "Este convite foi enviado para");
134
136
  const closingNote = escapeHtml(content.closingNote ?? "Se não reconhece este convite, pode ignorar esta mensagem em segurança.");
135
137
  const detailRows = content.details.map((detail, index) => `
136
138
  <tr>
@@ -198,7 +200,7 @@ export function buildTransactionalEmail(content: TransactionalEmailContent): Tra
198
200
  </td>
199
201
  </tr>
200
202
  </table>
201
- <p style="margin:18px auto 0;max-width:540px;color:${palette.mutedText};font-size:11px;line-height:1.6;text-align:center;">${closingNote}${recipientEmail ? `<br>Este convite foi enviado para ${recipientEmail}.` : ""}</p>
203
+ <p style="margin:18px auto 0;max-width:540px;color:${palette.mutedText};font-size:11px;line-height:1.6;text-align:center;">${closingNote}${recipientEmail ? `<br>${recipientLabel} ${recipientEmail}.` : ""}</p>
202
204
  </td>
203
205
  </tr>
204
206
  </table>
@@ -207,7 +209,7 @@ export function buildTransactionalEmail(content: TransactionalEmailContent): Tra
207
209
 
208
210
  const detailText = content.details.map((detail) => `${detail.label}: ${detail.value}`).join("\n");
209
211
  const actionText = hasAction ? `\n\n${content.actionLabel}:\n${content.actionUrl}` : "";
210
- const text = `${content.brandName}\n\n${content.title}\n\n${content.introduction}\n\n${detailText}${actionText}${content.expiresLabel ? `\n\nEste convite é válido até ${content.expiresLabel}.` : ""}\n\n${content.closingNote ?? "Se não reconhece este convite, pode ignorar esta mensagem em segurança."}${content.recipientEmail ? `\nEste convite foi enviado para ${content.recipientEmail}.` : ""}`;
212
+ const text = `${content.brandName}\n\n${content.title}\n\n${content.introduction}\n\n${detailText}${actionText}${content.expiresLabel ? `\n\nEste convite é válido até ${content.expiresLabel}.` : ""}\n\n${content.closingNote ?? "Se não reconhece este convite, pode ignorar esta mensagem em segurança."}${content.recipientEmail ? `\n${content.recipientLabel ?? "Este convite foi enviado para"} ${content.recipientEmail}.` : ""}`;
211
213
 
212
214
  return { html, text };
213
215
  }