Types
ts
import type {
ZaptimeConfig,
TimeSlot,
Day,
CustomField,
CustomFieldCollected,
ReservationResponse,
} from "@zaptime/core";ZaptimeConfig is also exported from @zaptime/vue3. See Zaptime Config.
TimeSlot
ts
interface TimeSlot {
start: string; // ISO 8601, UTC
end: string; // ISO 8601, UTC
seats: number; // remaining seats
calendarId: number;
title: string;
readableType: string;
}Day
ts
interface Day {
label: string;
date?: Date; // undefined for padding days from the previous month
isPast?: boolean;
isToday?: boolean;
isCurrentMonth?: boolean;
timeSlots?: TimeSlot[]; // undefined when the day has no availability
}CustomField
A field of the booking form as defined in the dashboard.
ts
type CustomField = {
uuid: string;
name: string;
label: string;
type:
| "text"
| "email"
| "phone"
| "number"
| "textarea"
| "switch"
| "checkbox"
| "select"
| "multiselect"
| "radio";
required: boolean;
mergeTag?: "FIRST_NAME" | "LAST_NAME" | "EMAIL" | "PHONE" | string;
placeholder?: string;
options?: string[];
value?: CustomFieldValue;
};
type CustomFieldValue = string | number | boolean | string[];CustomFieldCollected
What book, reserve and confirm accept under customFields.
ts
type CustomFieldCollected = {
uuid: string;
value?: CustomFieldValue;
};Location
ts
type Location = {
type: string; // "online" | "phone-call" | "in-person" | ...
value: string;
default?: boolean;
};Reservation
Returned in InitData.reservation when the config contains reservationUuid.
ts
type Reservation = {
uuid: string;
start: string;
end: string;
email: string;
firstName?: string;
lastName?: string;
location?: Location;
status: string;
};ReservationResponse
ts
interface ReservationResponse {
success: boolean;
data: {
uuid: string;
userId: number;
userName: string;
userEmail: string;
};
}InitData
The Ok value of fetchRemoteConfiguration.
ts
type InitData = {
configuration: Omit<ZaptimeConfig, "token">;
disabled: boolean;
eventTypeName: string;
isSubscribed: boolean;
locations?: Location[];
customFields?: CustomField[];
maxGuests?: number | null;
stripeConfig?: { price: number; currency: string; stripeAccountId: string };
reservation?: Reservation;
analytics?: { name: string; data: Record<string, any> }[];
};Errors
ts
class SlotNoLongerAvailableError extends Error {} // HTTP 409
class RescheduleNotAllowedError extends Error {} // HTTP 403See API functions.
