Type of deal
{(Object.keys(KIND_INFO) as BundleKind[]).map(k => (
set("kind", k)} aria-pressed={d.kind === k}
className={`text-left rounded-lg border p-2.5 transition-colors ${d.kind === k ? "border-brand-500 bg-brand-50 ring-1 ring-brand-500" : "hover:bg-gray-50"}`}>
{KIND_INFO[k].label}
{KIND_INFO[k].hint}
e.g. {KIND_INFO[k].example}
))}
{exact ? "Tickets in the bundle" : "Qualifying tickets"}
{!exact &&
Any of these count towards the deal.
}
{d.items.map((it, i) => {
const opt = options.find(o => o.id === it.eventOptionId);
const hasVariants = (opt?.variants || []).length > 0;
return (
{exact && (
<>
setItem(i, { quantity: e.target.value })} aria-label="Quantity" required />
×
>
)}
setItem(i, { eventOptionId: e.target.value, variantId: null })} aria-label="Ticket">
{options.map(o => {o.name} ({fmtRand(o.price)}) )}
set("items", d.items.filter((_, j) => j !== i))} disabled={d.items.length <= 1}
className="p-2 shrink-0 rounded-lg text-gray-400 hover:text-red-600 hover:bg-red-50 disabled:opacity-30 disabled:hover:bg-transparent" aria-label="Remove ticket">
{hasVariants && (
setItem(i, { variantId: e.target.value || null })} aria-label="Variant">
Any {opt?.name.toLowerCase()} variant
{(opt?.variants || []).map(v => {v.name} )}
)}
);
})}
set("items", [...d.items, { eventOptionId: options[0]?.id || "", variantId: null, quantity: "1" }])}
className="mt-2 inline-flex items-center gap-1 text-sm font-medium text-brand-700 hover:underline">
Add a ticket type
{!exact && (
{d.kind === "group" ? "Minimum tickets" : "Tickets per set"}
set("setSize", e.target.value)} required />
{d.kind === "free" && (
Free in each set
set("freeCount", e.target.value)} required />
)}
{d.kind === "group" && (
Group price
set("groupPricing", e.target.value as BundleGroupPricing)}>
Price per ticket
Percentage off
)}
)}
{d.kind === "free" ? (
{size > free && free > 0
? <>Buy {size - free}, get {free} free. In every {size} qualifying tickets, the cheapest {free === 1 ? "one is" : `${free} are`} free.>
: The set needs more tickets than are free. }
) : (
{priceLabel}
set("price", e.target.value)} required />
{d.kind === "group" ? (
{size >= 2 ? `From ${size} qualifying tickets, every one of them ` : "Every qualifying ticket "}
{d.groupPricing === "percent" ? `gets ${d.price || "…"}% off.` : `costs ${d.price === "" ? "…" : fmtRand(price)} (tickets already cheaper stay as they are).`}
) : (
<>
{exact ? "Separately" : "Dearest set"}
{fmtRand(standardValue)}
Bundle
{d.price === "" ? "—" : fmtRand(price)}
Saving
{d.price === "" ? "—" : fmtRand(Math.max(0, saving_))}
{d.price !== "" && saving_ <= 0 &&
The bundle isn't cheaper than the standard prices, so it won't apply unless prices change.
}
{!exact &&
The saving depends on which tickets are picked; it only applies when the set price is cheaper.
}
>
)}
)}
set("isActive", e.target.checked)} />
On sale Registrations that already have this bundle keep it if you turn it off later.
{error &&
{error}
}