From 9c2254215edbfd36d0d523624d8ddf5f8d9afe53 Mon Sep 17 00:00:00 2001 From: Karl Ludwig Weise Date: Wed, 14 Jan 2026 17:19:54 +0100 Subject: [PATCH 1/9] Added front-end flow to make email sending optional --- project.inlang/messages/de.json | 2 +- project.inlang/messages/en.json | 2 +- src/lib/client/appointment-crypto.ts | 5 +- .../ui/input-otp/input-otp-separator.svelte | 3 +- .../ui/input-otp/input-otp-slot.svelte | 2 +- .../input-otp-customized.svelte | 8 +++- src/lib/stores/pin-throttle.ts | 2 +- src/lib/types/public.ts | 1 + .../add-personal-data-form.svelte | 47 +++++++++++++------ 9 files changed, 48 insertions(+), 24 deletions(-) diff --git a/project.inlang/messages/de.json b/project.inlang/messages/de.json index 3d6bbdb..3c0496d 100644 --- a/project.inlang/messages/de.json +++ b/project.inlang/messages/de.json @@ -838,7 +838,7 @@ "description": "Nur Sie und {name} können diese Informationen sehen. Die Daten sind Ende-zu-Ende verschlüsselt." }, "email": { - "description": "Wir senden Ihnen eine Bestätigungs-E-Mail mit den Termindetails." + "notifyMe": "Benachrichtigen Sie mich über Änderungen per E-Mail" }, "phone": { "description": "Format: +491234567890. {name} kontaktiert Sie ggf. telefonisch, falls es Fragen/Änderungen zu Ihrem Termin gibt.", diff --git a/project.inlang/messages/en.json b/project.inlang/messages/en.json index 9372fa1..84f46ea 100644 --- a/project.inlang/messages/en.json +++ b/project.inlang/messages/en.json @@ -847,7 +847,7 @@ "description": "Only you and {name} will be able to access this information. It is end-to-end encrypted." }, "email": { - "description": "We will use this to send you the appointment details." + "notifyMe": "Notify me of changes by email" }, "phone": { "description": "Format: +1234567890. {name} may contact you by phone, if there are questions or changes regarding your appointment.", diff --git a/src/lib/client/appointment-crypto.ts b/src/lib/client/appointment-crypto.ts index 246d2c9..968a4e5 100644 --- a/src/lib/client/appointment-crypto.ts +++ b/src/lib/client/appointment-crypto.ts @@ -71,6 +71,7 @@ interface EncryptedData { export interface AppointmentData { name: string; email: string; + shareEmail: boolean; phone?: string; } @@ -319,7 +320,7 @@ export class UnifiedAppointmentCrypto { appointmentDate, duration, emailHash: this.emailHash, - clientEmail: appointmentData.email, + clientEmail: appointmentData.shareEmail ? appointmentData.email : undefined, clientLanguage, clientPublicKey: this.clientKeyPair?.publicKey, privateKeyShare: await this.getPrivateKeyShare(), @@ -336,7 +337,7 @@ export class UnifiedAppointmentCrypto { channelId, appointmentDate, duration, - clientEmail: appointmentData.email, + clientEmail: appointmentData.shareEmail ? appointmentData.email : undefined, clientLanguage, encryptedAppointment, }; diff --git a/src/lib/components/ui/input-otp/input-otp-separator.svelte b/src/lib/components/ui/input-otp/input-otp-separator.svelte index 3afee1e..1de932e 100644 --- a/src/lib/components/ui/input-otp/input-otp-separator.svelte +++ b/src/lib/components/ui/input-otp/input-otp-separator.svelte @@ -1,7 +1,6 @@ - + {#snippet children({ cells })} {#each cells.slice(0, 3) as cell (cell)} diff --git a/src/lib/stores/pin-throttle.ts b/src/lib/stores/pin-throttle.ts index 895317f..de8677e 100644 --- a/src/lib/stores/pin-throttle.ts +++ b/src/lib/stores/pin-throttle.ts @@ -24,7 +24,7 @@ const createPinThrottleStore = () => { failedAttempts: 0, }; - if (!browser) { + if (browser) { const stored = localStorage.getItem(STORAGE_KEY); if (stored) { try { diff --git a/src/lib/types/public.ts b/src/lib/types/public.ts index 9528cfc..9773a1a 100644 --- a/src/lib/types/public.ts +++ b/src/lib/types/public.ts @@ -40,6 +40,7 @@ export type TPublicAppointment = { }; data?: { name: string; + shareEmail: boolean; email: string; phone?: string; }; diff --git a/src/routes/(pages)/(clients)/book-appointment/[[id]]/(components)/add-personal-data-form/add-personal-data-form.svelte b/src/routes/(pages)/(clients)/book-appointment/[[id]]/(components)/add-personal-data-form/add-personal-data-form.svelte index 95120e9..c7e22c0 100644 --- a/src/routes/(pages)/(clients)/book-appointment/[[id]]/(components)/add-personal-data-form/add-personal-data-form.svelte +++ b/src/routes/(pages)/(clients)/book-appointment/[[id]]/(components)/add-personal-data-form/add-personal-data-form.svelte @@ -1,16 +1,17 @@ -