useLocations
An event type can offer one or more locations: an online meeting link, a phone call, an in-person address. The list comes from the remote configuration.
ts
import { useLocations } from "@zaptime/core";
const { locations, setLocations, isPhoneCall } = useLocations(calendarId?);Set locations
Called during initialization with locations from the remote configuration.
ts
setLocations(remote.locations);Locations
ts
type Location = {
type: string; // e.g. "online", "phone-call", "in-person"
value: string; // display value or provider key
default?: boolean;
};
locations.value; // Location[]Is phone call
true when one of the locations is a phone call. The built-in UI uses it to make the phone field mandatory.
ts
isPhoneCall.value;Booking with a location
book and reserve accept a location. When omitted, the first location of the event type is used.
ts
await book({
email,
location: locations.value.find((l) => l.default) ?? locations.value[0],
});Render a picker when there is more than one location and let the attendee choose.
