Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 57 additions & 11 deletions frontend/src/routes/event-types/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 ───────────────────────────────────────────────────────────────
Expand All @@ -70,6 +71,8 @@
// Which connected provider can natively mint each online platform's link.
const PLATFORM_PROVIDER: Record<string, string> = { 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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isOnlineLocation omits link and the legacy custom_video, even though both produce a join link the booker needs the same way (the comment above it says "any location that produces a join link"). With none and no email, a link event type delivers the booker nothing and this warning never appears — deliberate, or an oversight?


let form = $state({
display_order: 0,
Expand All @@ -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');

Expand Down Expand Up @@ -758,16 +783,18 @@
<div class="grid grid-cols-2 gap-4">
<div class="space-y-1.5">
<Label for="et-invite">Sent by</Label>
<Select.Root type="single" bind:value={form.invite_delivery}>
<Select.Trigger id="et-invite" class="w-full">
{INVITE_DELIVERY.find((o) => o.value === form.invite_delivery)?.label ?? 'Select…'}
</Select.Trigger>
<Select.Content>
{#each INVITE_DELIVERY as o}
<Select.Item value={o.value} label={o.label}>{o.label}</Select.Item>
{/each}
</Select.Content>
</Select.Root>
{#key inviteSelectReset}
<Select.Root type="single" value={form.invite_delivery} onValueChange={requestInviteDelivery}>
<Select.Trigger id="et-invite" class="w-full">
{INVITE_DELIVERY.find((o) => o.value === form.invite_delivery)?.label ?? 'Select…'}
</Select.Trigger>
<Select.Content>
{#each INVITE_DELIVERY as o}
<Select.Item value={o.value} label={o.label}>{o.label}</Select.Item>
{/each}
</Select.Content>
</Select.Root>
{/key}
</div>
<p class="self-end text-xs text-muted-foreground">
{#if form.invite_delivery === 'calnode'}
Expand All @@ -783,12 +810,22 @@
{/if}
</p>
</div>
<p class="mt-2 text-xs text-muted-foreground">
Applies to new bookings only. Existing bookings keep the method they were sent with.
</p>
{#if form.invite_delivery === 'calnode' && et?.invite_sender_ready === false}
<p class="mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800">
Email isn't set up, so bookers won't receive an invite. Add a sender in
<a href="{base}/settings/email" class="underline">Settings → Email</a>.
</p>
{/if}
{#if form.invite_delivery === 'none' && isOnlineLocation(form.location_type)}
<p class="mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800">
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 <code class="font-mono">location_value</code> from the
<code class="font-mono">booking.created</code> webhook in your own confirmation.
Comment on lines +822 to +826

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This claim is only true when email is not configured. Under invite_delivery = 'none' the backend only detaches the .ics; the booker's confirmation email still goes out and renders LocationValue (the minted join link) in its body, so on the common email-configured setup the warning tells operators their integration must deliver a link Calnode already delivers.

Technical details
# Join-link warning contradicts actual `none` delivery

## Affected sites
- `frontend/src/routes/event-types/[slug]/+page.svelte:822-827` — warning renders for every `none` selection, regardless of `et.invite_sender_ready`.
- `internal/handler/invite_delivery.go:94-98` — `applyInviteDelivery` for `InviteByNone` sets only `d.AttachICS = false`; it does not suppress the email or clear `LocationValue`.
- `internal/mailer/html.go:76` / `internal/mailer/booking.go:442-443,471-472,524-525` — the booker email body includes `LocationValue`.
- `internal/handler/templates/book.html:773` — the post-booking confirmation page also shows `location_value` on screen.

## Required outcome
- The copy must be accurate in both configurations: email configured (Calnode's confirmation email still carries the join link, only the calendar invite is withheld) and email not configured (the booker receives nothing from Calnode).
- Either gate this block on `et?.invite_sender_ready === false` like the adjacent `calnode` warning, or reword it to say Calnode's email still shows the link while no calendar invite is sent.

## Open questions for the human
- Should the webhook guidance appear only when the operator is replacing Calnode's confirmation entirely, or always as a pointer?

</p>
{/if}
</div>

<!-- Price -->
Expand Down Expand Up @@ -1194,4 +1231,13 @@
</div>
{/if}

<ConfirmDialog
bind:open={confirmNoneOpen}
title="Send the booker no invite at all?"
description="Email is not set up in this workspace, so Calnode will not email the booker anything for this event type, and the host's calendar will not invite them either. The booker only hears from you if your own system sends the confirmation."
confirmText="Use my own system"
cancelText="Cancel"
onConfirm={() => { form.invite_delivery = 'none'; noneAcknowledged = true; }}
/>

{/if}
Loading