Add CC and BCC fields to email template (#169)
* Enhance email data template for cc/bcc * test(dataEncoding.test.ts): add test case for handling multiple emails in CC/BCC fields correctly in generateEmailData function test(dataEncoding.test.ts): add test case for identifying email links with multiple CC/BCC addresses in detectDataType function * Docs: Add @olvier as a contributor
This commit is contained in:
parent
e9912608ba
commit
817429b49e
@ -77,6 +77,13 @@
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/86856086?v=4",
|
||||
"profile": "https://github.com/seals187",
|
||||
"contributions": ["review"]
|
||||
},
|
||||
{
|
||||
"login": "olvier",
|
||||
"name": "olvier",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/13106409?v=4",
|
||||
"profile": "https://github.com/olvier",
|
||||
"contributions": ["review"]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 6,
|
||||
|
@ -213,6 +213,7 @@ Thank you for everyone here for taking their time out to improve MiniQR 🧡
|
||||
<td align="center" valign="top" width="16.66%"><a href="https://furycode.org/"><img src="https://avatars.githubusercontent.com/u/22378039?v=4?s=48" width="48px;" alt="Klemens Graf"/><br /><sub><b>Klemens Graf</b></sub></a><br /><a href="https://github.com/lyqht/mini-qr/commits?author=klemensgraf" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="16.66%"><a href="https://github.com/unililium"><img src="https://avatars.githubusercontent.com/u/3117172?v=4?s=48" width="48px;" alt="林都"/><br /><sub><b>林都</b></sub></a><br /><a href="https://github.com/lyqht/mini-qr/commits?author=unililium" title="Code">💻</a> <a href="#translation-unililium" title="Translation">🌍</a></td>
|
||||
<td align="center" valign="top" width="16.66%"><a href="https://github.com/seals187"><img src="https://avatars.githubusercontent.com/u/86856086?v=4?s=48" width="48px;" alt="seals187"/><br /><sub><b>seals187</b></sub></a><br /><a href="https://github.com/lyqht/mini-qr/pulls?q=is%3Apr+reviewed-by%3Aseals187" title="Reviewed Pull Requests">👀</a></td>
|
||||
<td align="center" valign="top" width="16.66%"><a href="https://github.com/olvier"><img src="https://avatars.githubusercontent.com/u/13106409?v=4?s=48" width="48px;" alt="olvier"/><br /><sub><b>olvier</b></sub></a><br /><a href="https://github.com/lyqht/mini-qr/pulls?q=is%3Apr+reviewed-by%3Aolvier" title="Reviewed Pull Requests">👀</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Грешка",
|
||||
"Failed to load changelog": "Неуспешно зареждане на списъка с промените",
|
||||
"Loading...": "Зареждане...",
|
||||
"th": "Тайландски"
|
||||
"th": "Тайландски",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Chyba",
|
||||
"Failed to load changelog": "Nepodařilo se načíst seznam změn",
|
||||
"Loading...": "Načítání...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Fejl",
|
||||
"Failed to load changelog": "Kunne ikke indlæse changelog",
|
||||
"Loading...": "Indlæser...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Fehler",
|
||||
"Failed to load changelog": "Changelog konnte nicht geladen werden",
|
||||
"Loading...": "Laden...",
|
||||
"th": "Thailändisch"
|
||||
"th": "Thailändisch",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Σφάλμα",
|
||||
"Failed to load changelog": "Απέτυχε να φορτώσει το changelog",
|
||||
"Loading...": "Φόρτωση...",
|
||||
"th": "Ταϊλάνδης"
|
||||
"th": "Ταϊλάνδης",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Viga",
|
||||
"Failed to load changelog": "Ei õnnestunud laadida muutuste logi",
|
||||
"Loading...": "Laadimine...",
|
||||
"th": "Tai"
|
||||
"th": "Tai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Virhe",
|
||||
"Failed to load changelog": "Changelogin lataaminen epäonnistui",
|
||||
"Loading...": "Ladataan...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Erreur",
|
||||
"Failed to load changelog": "Échec du chargement du changelog",
|
||||
"Loading...": "Chargement...",
|
||||
"th": "Thaïlande"
|
||||
"th": "Thaïlande",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Hiba",
|
||||
"Failed to load changelog": "Nem sikerült betölteni a changelogot",
|
||||
"Loading...": "Betöltés...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Kesalahan",
|
||||
"Failed to load changelog": "Gagal memuat log perubahan",
|
||||
"Loading...": "Memuat...",
|
||||
"th": "Thailand"
|
||||
"th": "Thailand",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Errore",
|
||||
"Failed to load changelog": "Caricamento del changelog fallito",
|
||||
"Loading...": "Caricamento...",
|
||||
"th": "Thailandese"
|
||||
"th": "Thailandese",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "エラー",
|
||||
"Failed to load changelog": "変更履歴の読み込みに失敗しました",
|
||||
"Loading...": "読み込み中...",
|
||||
"th": "タイ"
|
||||
"th": "タイ",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "오류",
|
||||
"Failed to load changelog": "변경 로그를 로드하지 못했습니다.",
|
||||
"Loading...": "로드 중...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Klaida",
|
||||
"Failed to load changelog": "Nepavyko įkelti pakeitimų žurnalo",
|
||||
"Loading...": "Pakraunama...",
|
||||
"th": "Tailando"
|
||||
"th": "Tailando",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
131
locales/lv.json
131
locales/lv.json
File diff suppressed because one or more lines are too long
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
131
locales/nb.json
131
locales/nb.json
File diff suppressed because one or more lines are too long
@ -238,5 +238,9 @@
|
||||
"Error": "Fout",
|
||||
"Failed to load changelog": "Changelog niet geladen",
|
||||
"Loading...": "Aan het laden...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Feil",
|
||||
"Failed to load changelog": "Kan ikke laste endringsloggen",
|
||||
"Loading...": "Laster...",
|
||||
"th": "Thailandsk"
|
||||
"th": "Thailandsk",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Błąd",
|
||||
"Failed to load changelog": "Nie udało się załadować dziennika zmian",
|
||||
"Loading...": "Ładowanie...",
|
||||
"th": "Tajski"
|
||||
"th": "Tajski",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -238,5 +238,9 @@
|
||||
"Error": "Erro",
|
||||
"Failed to load changelog": "Falha ao carregar o changelog",
|
||||
"Loading...": "Carregando...",
|
||||
"th": "Tailandês"
|
||||
"th": "Tailandês",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Eroare",
|
||||
"Failed to load changelog": "A eșuat încărcarea jurnalului de schimbări",
|
||||
"Loading...": "Încărcare...",
|
||||
"th": "Thailandeză"
|
||||
"th": "Thailandeză",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Ошибка",
|
||||
"Failed to load changelog": "Не удалось загрузить журнал изменений",
|
||||
"Loading...": "Загрузка...",
|
||||
"th": "Тайский"
|
||||
"th": "Тайский",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Chyba",
|
||||
"Failed to load changelog": "Nepodarilo sa načítať zoznam zmien",
|
||||
"Loading...": "Načítavanie...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
131
locales/sl.json
131
locales/sl.json
File diff suppressed because one or more lines are too long
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Fel",
|
||||
"Failed to load changelog": "Misslyckades med att ladda changelog",
|
||||
"Loading...": "Laddar...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "ข้อผิดพลาด",
|
||||
"Failed to load changelog": "ไม่สามารถโหลดประวัติการเปลี่ยนแปลงได้",
|
||||
"Loading...": "กำลังโหลด...",
|
||||
"th": "ไทย"
|
||||
"th": "ไทย",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Hata",
|
||||
"Failed to load changelog": "Değişiklik günlüğü yüklenemedi",
|
||||
"Loading...": "Yükleniyor...",
|
||||
"th": "Tayland"
|
||||
"th": "Tayland",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Помилка.",
|
||||
"Failed to load changelog": "Не вдалося завантажити журнал змін",
|
||||
"Loading...": "Завантаження...",
|
||||
"th": "Тайська"
|
||||
"th": "Тайська",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -238,5 +238,9 @@
|
||||
"Error": "Error",
|
||||
"Failed to load changelog": "Failed to load changelog",
|
||||
"Loading...": "Loading...",
|
||||
"th": "Thai"
|
||||
"th": "Thai",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -238,5 +238,9 @@
|
||||
"Error": "錯誤",
|
||||
"Failed to load changelog": "載入更新記錄失敗",
|
||||
"Loading...": "載入中...",
|
||||
"th": "泰語"
|
||||
"th": "泰語",
|
||||
"CC": "CC",
|
||||
"BCC": "BCC",
|
||||
"Optional CC": "Optional CC",
|
||||
"Optional BCC": "Optional BCC"
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ const urlData = ref('')
|
||||
const emailAddress = ref('')
|
||||
const emailSubject = ref('')
|
||||
const emailBody = ref('')
|
||||
const emailCc = ref('')
|
||||
const emailBcc = ref('')
|
||||
|
||||
// Phone refs
|
||||
const phoneNumber = ref('')
|
||||
@ -185,6 +187,8 @@ const detectAndSetDataType = (data: string) => {
|
||||
emailAddress.value = (result.parsedData.address as string) || ''
|
||||
emailSubject.value = (result.parsedData.subject as string) || ''
|
||||
emailBody.value = (result.parsedData.body as string) || ''
|
||||
emailCc.value = (result.parsedData.cc as string) || ''
|
||||
emailBcc.value = (result.parsedData.bcc as string) || ''
|
||||
break
|
||||
|
||||
case 'phone':
|
||||
@ -333,7 +337,9 @@ const generateDataString = () => {
|
||||
generatedString = generateEmailData({
|
||||
address: emailAddress.value,
|
||||
subject: emailSubject.value,
|
||||
body: emailBody.value
|
||||
body: emailBody.value,
|
||||
cc: emailCc.value,
|
||||
bcc: emailBcc.value
|
||||
})
|
||||
break
|
||||
case 'phone':
|
||||
@ -415,6 +421,8 @@ const fillWithExampleData = () => {
|
||||
emailAddress.value = 'test@example.com'
|
||||
emailSubject.value = 'QR Code Test'
|
||||
emailBody.value = 'This is a test email from MiniQR!'
|
||||
emailCc.value = 'cc@example.com'
|
||||
emailBcc.value = 'bcc@example.com'
|
||||
break
|
||||
case 'phone':
|
||||
phoneNumber.value = '+19876543210'
|
||||
@ -613,6 +621,22 @@ const closeModal = () => {
|
||||
<p v-if="isFieldInvalid('emailAddress')" class="mt-1 text-sm text-red-500">
|
||||
{{ t('Email address is required') }}
|
||||
</p>
|
||||
<label for="emailCc" class="label sr-only">{{ t('CC') }}</label>
|
||||
<input
|
||||
type="email"
|
||||
id="emailCc"
|
||||
v-model="emailCc"
|
||||
:placeholder="t('Optional CC')"
|
||||
class="text-input"
|
||||
/>
|
||||
<label for="emailBcc" class="label sr-only">{{ t('BCC') }}</label>
|
||||
<input
|
||||
type="email"
|
||||
id="emailBcc"
|
||||
v-model="emailBcc"
|
||||
:placeholder="t('Optional BCC')"
|
||||
class="text-input"
|
||||
/>
|
||||
<label for="emailSubject" class="label">{{ t('Subject') }}</label>
|
||||
<input
|
||||
type="text"
|
||||
|
@ -36,6 +36,9 @@ describe('Data Encoding Functions', () => {
|
||||
expect(generateEmailData({ address: 'test@example.com', body: 'Hello there' })).toBe(
|
||||
'mailto:test@example.com?body=Hello%20there'
|
||||
)
|
||||
expect(
|
||||
generateEmailData({ address: 'test@example.com', cc: 'a@test.com', bcc: 'b@test.com' })
|
||||
).toBe('mailto:test@example.com?cc=a%40test.com&bcc=b%40test.com')
|
||||
expect(
|
||||
generateEmailData({
|
||||
address: 'test@example.com',
|
||||
@ -43,9 +46,24 @@ describe('Data Encoding Functions', () => {
|
||||
body: 'Line 1\nLine 2'
|
||||
})
|
||||
).toBe('mailto:test@example.com?subject=Hi%20%26%20Bye&body=Line%201%0ALine%202')
|
||||
expect(
|
||||
generateEmailData({ address: 'test@example.com', subject: 'Hello', cc: 'a@test.com' })
|
||||
).toBe('mailto:test@example.com?subject=Hello&cc=a%40test.com')
|
||||
expect(generateEmailData({ address: '' })).toBe('')
|
||||
})
|
||||
|
||||
it('generateEmailData handles multiple emails in CC/BCC correctly', () => {
|
||||
expect(
|
||||
generateEmailData({
|
||||
address: 'test@example.com',
|
||||
cc: 'cc1@test.com,cc2@test.com',
|
||||
bcc: 'bcc1@test.com,bcc2@test.com'
|
||||
})
|
||||
).toBe(
|
||||
'mailto:test@example.com?cc=cc1%40test.com%2Ccc2%40test.com&bcc=bcc1%40test.com%2Cbcc2%40test.com'
|
||||
)
|
||||
})
|
||||
|
||||
it('generatePhoneData formats tel string correctly', () => {
|
||||
expect(generatePhoneData({ phone: '+123456789' })).toBe('tel:+123456789')
|
||||
expect(generatePhoneData({ phone: '' })).toBe('')
|
||||
@ -244,11 +262,27 @@ describe('Data Type Detection Functions', () => {
|
||||
})
|
||||
|
||||
it('detectDataType identifies email links', () => {
|
||||
const result = detectDataType('mailto:test@example.com?subject=Hello&body=Hi%20there')
|
||||
const result = detectDataType(
|
||||
'mailto:test@example.com?subject=Hello&body=Hi%20there&cc=cc@test.com&bcc=b@test.com'
|
||||
)
|
||||
expect(result.type).toBe('email')
|
||||
expect(result.parsedData.address).toBe('test@example.com')
|
||||
expect(result.parsedData.subject).toBe('Hello')
|
||||
expect(result.parsedData.body).toBe('Hi there')
|
||||
expect(result.parsedData.cc).toBe('cc@test.com')
|
||||
expect(result.parsedData.bcc).toBe('b@test.com')
|
||||
})
|
||||
|
||||
it('detectDataType identifies email links with multiple CC/BCC addresses', () => {
|
||||
const result = detectDataType(
|
||||
'mailto:test@example.com?subject=Hello&body=Hi%20there&cc=cc1@test.com,cc2@test.com&bcc=bcc1@test.com,bcc2@test.com'
|
||||
)
|
||||
expect(result.type).toBe('email')
|
||||
expect(result.parsedData.address).toBe('test@example.com')
|
||||
expect(result.parsedData.subject).toBe('Hello')
|
||||
expect(result.parsedData.body).toBe('Hi there')
|
||||
expect(result.parsedData.cc).toBe('cc1@test.com,cc2@test.com')
|
||||
expect(result.parsedData.bcc).toBe('bcc1@test.com,bcc2@test.com')
|
||||
})
|
||||
|
||||
it('detectDataType identifies phone numbers', () => {
|
||||
|
@ -79,17 +79,23 @@ export const generateUrlData = (data: { url: string }): string => {
|
||||
* @param {string} data.address - Email address of the recipient
|
||||
* @param {string} [data.subject] - Optional email subject
|
||||
* @param {string} [data.body] - Optional email body text
|
||||
* @param {string} [data.cc] - Optional CC recipients
|
||||
* @param {string} [data.bcc] - Optional BCC recipients
|
||||
* @returns {string} - Formatted mailto URI string
|
||||
*/
|
||||
export const generateEmailData = (data: {
|
||||
address: string
|
||||
subject?: string
|
||||
body?: string
|
||||
cc?: string
|
||||
bcc?: string
|
||||
}): string => {
|
||||
if (!data.address) return ''
|
||||
const parts: string[] = []
|
||||
if (data.subject) parts.push(`subject=${encodeURIComponent(data.subject)}`)
|
||||
if (data.body) parts.push(`body=${encodeURIComponent(data.body)}`)
|
||||
if (data.cc) parts.push(`cc=${encodeURIComponent(data.cc)}`)
|
||||
if (data.bcc) parts.push(`bcc=${encodeURIComponent(data.bcc)}`)
|
||||
return `mailto:${data.address}${parts.length > 0 ? '?' + parts.join('&') : ''}`
|
||||
}
|
||||
|
||||
@ -515,6 +521,8 @@ export const detectDataType = (
|
||||
const params = new URLSearchParams(emailParts[1])
|
||||
result.parsedData.subject = params.get('subject') || ''
|
||||
result.parsedData.body = params.get('body') || ''
|
||||
result.parsedData.cc = params.get('cc') || ''
|
||||
result.parsedData.bcc = params.get('bcc') || ''
|
||||
}
|
||||
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user