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}