From 85a40fc82e81869f1bd52a4cf603e3d566ee0ce5 Mon Sep 17 00:00:00 2001 From: Wynne Pirini Date: Fri, 30 Oct 2026 09:11:03 +1300 Subject: [PATCH] fix(ui): label and guard the "your own system" invite mode Follow-up to #158, which added invite_delivery 'none' without the wording and `guards agreed when it was designed. Four gaps, all in the event type editor: - The mode read "No one (you send your own)", a negation that looks like a mistake. It is now "Your own system", which reads as a deliberate choice. - Choosing it while email is not configured emails the booker nothing at all, and that is easy to do by accident and impossible to notice later, so it is confirmed once. The selection is held back until confirmed, and cancelling leaves the previous mode in place. - A permanent line says the setting applies to new bookings only, because the mode is copied onto a booking when it is created and later changes do not reach existing ones. - With an online location the booking still has a join link, and Calnode will not send it. The editor now says so and names location_value in the booking.created webhook, which is where an integration finds it. One implementation note: bits-ui keeps the clicked option as its internal selection even when the bound value is not changed, so after a cancel, re-picking the same option fired no change event and the dialog never reappeared. The Select is keyed on a counter that increments when a choice is declined, which remounts it against the current value. Verified in a browser: select, cancel, reselect, dialog reopens; confirm, the value applies; an online location shows the join-link warning. --- .../routes/event-types/[slug]/+page.svelte | 68 ++++++++++++++++--- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/frontend/src/routes/event-types/[slug]/+page.svelte b/frontend/src/routes/event-types/[slug]/+page.svelte index b626f6b3..c0aa46fa 100644 --- a/frontend/src/routes/event-types/[slug]/+page.svelte +++ b/frontend/src/routes/event-types/[slug]/+page.svelte @@ -17,6 +17,7 @@ import { saveOnCmdS } from '$lib/save-shortcut'; import QuestionsPanel from '$lib/components/event-types/QuestionsPanel.svelte'; import EmbedPanel from '$lib/components/event-types/EmbedPanel.svelte'; + import { ConfirmDialog } from '$lib/components/ui/confirm-dialog'; // Ordered by expected usage. 'custom_video' is retired from the picker but the // backend still renders any legacy event types that use it. @@ -43,7 +44,7 @@ const INVITE_DELIVERY = [ { value: 'calendar', label: "The host's calendar" }, { value: 'calnode', label: 'Calnode, from your workspace' }, - { value: 'none', label: 'No one (you send your own)' }, + { value: 'none', label: 'Your own system' }, ]; // ── Event type ─────────────────────────────────────────────────────────────── @@ -70,6 +71,8 @@ // Which connected provider can natively mint each online platform's link. const PLATFORM_PROVIDER: Record = { google_meet: 'google', teams: 'microsoft' }; const isOnlineMeeting = (t: string) => t === 'google_meet' || t === 'teams'; + // Any location that produces a join link the booker has to receive somehow. + const isOnlineLocation = (t: string) => isOnlineMeeting(t) || t === 'zoom' || t === 'livekit'; let form = $state({ display_order: 0, @@ -83,6 +86,28 @@ price_cents: 0, currency: 'usd', }); + // "Your own system" means Calnode sends the booker nothing at all. When email is not + // configured that is easy to pick by accident and impossible to notice later, so it is + // confirmed once rather than applied silently. + let confirmNoneOpen = $state(false); + let noneAcknowledged = $state(false); + // Remounts the Select when a choice is declined. bits-ui keeps the clicked option as its + // internal selection even though the bound value did not change, so re-picking it fires no + // change event and the dialog would never reopen. + let inviteSelectReset = $state(0); + + function requestInviteDelivery(v: string | undefined) { + if (!v) return; + const mode = v as EventType['invite_delivery']; + if (mode === 'none' && et?.invite_sender_ready === false && !noneAcknowledged) { + confirmNoneOpen = true; + inviteSelectReset += 1; + return; + } + form.invite_delivery = mode; + if (mode !== 'none') noneAcknowledged = false; + } + // Price is edited in major units (e.g. dollars); stored as integer cents. let priceMajor = $state('0'); @@ -758,16 +783,18 @@
- - - {INVITE_DELIVERY.find((o) => o.value === form.invite_delivery)?.label ?? 'Select…'} - - - {#each INVITE_DELIVERY as o} - {o.label} - {/each} - - + {#key inviteSelectReset} + + + {INVITE_DELIVERY.find((o) => o.value === form.invite_delivery)?.label ?? 'Select…'} + + + {#each INVITE_DELIVERY as o} + {o.label} + {/each} + + + {/key}

{#if form.invite_delivery === 'calnode'} @@ -783,12 +810,22 @@ {/if}

+

+ Applies to new bookings only. Existing bookings keep the method they were sent with. +

{#if form.invite_delivery === 'calnode' && et?.invite_sender_ready === false}

Email isn't set up, so bookers won't receive an invite. Add a sender in Settings → Email.

{/if} + {#if form.invite_delivery === 'none' && isOnlineLocation(form.location_type)} +

+ This event type books an online meeting, so every booking has a join link, and Calnode will + not send it to the booker. Pass its location_value from the + booking.created webhook in your own confirmation. +

+ {/if} @@ -1194,4 +1231,13 @@ {/if} + { form.invite_delivery = 'none'; noneAcknowledged = true; }} + /> + {/if}