Back to arky.io

Booking Types

Booking module type definitions

Type definitions for the Booking module.

Service

interface Service {
  id: string;
  key: string;
  slug: Record<string, string>;
  businessId: string;
  blocks: Block[];
  taxonomies: TaxonomyEntry[];
  status: Status;
  createdAt: number;
  updatedAt: number;
}

Provider

interface Provider {
  id: string;
  key: string;
  slug: Record<string, string>;
  businessId: string;
  status: Status;
  audienceIds: string[];
  blocks: Block[];
  taxonomies: TaxonomyEntry[];
  timeline: ProviderTimelinePoint[];
  createdAt: number;
  updatedAt: number;
}

interface ProviderTimelinePoint {
  timestamp: number;
  booked: number;
}

ServiceProvider

Links a Service to a Provider with prices, durations, and working hours.

interface ServiceProvider {
  id: string;
  providerId: string;
  prices: Price[];
  durations: ServiceDuration[];
  audienceIds: string[];
  workingDays: Array<{
    day: string;
    workingHours: Array<{ from: number; to: number }>;
  }>;
  specificDates: Array<{
    date: number;
    workingHours: Array<{ from: number; to: number }>;
  }>;
  slotInterval: number;
  forms?: FormEntry[];
}

interface ServiceDuration {
  duration: number;     // minutes
  isPause?: boolean;
}

Booking

interface Booking {
  id: string;
  number: string;
  forms: FormEntry[];
  businessId: string;
  status: BookingStatus;
  workflowStatus: BookingWorkflowStatus;
  serviceIds: string[];
  providerIds: string[];
  payment: Payment;
  business?: Business;
  account?: any;
  items: BookingItem[];
  audienceId?: string;
  createdAt: number;
  lastModified: number;
}

type BookingStatus = 'active' | 'archived';

type BookingWorkflowStatus =
  | 'created'
  | 'pending'
  | 'authorized'
  | 'confirmed'
  | 'completed'
  | 'cancelled'
  | 'failed';
Note

status follows the active/archived split shared with orders. The lifecycle states (created, pending, confirmed, …) live on workflowStatus.

Booking Item

interface BookingItem {
  id: string;
  serviceId: string;
  providerId: string;
  businessId: string;
  bookingId: string;
  from: number;
  to: number;
  forms: FormEntry[];
  snapshot: BookingItemSnapshot;
}

interface BookingItemSnapshot {
  serviceKey: string;
  providerKey: string;
  price: Price;
}

Slot

A bookable slot returned by availability lookups.

interface Slot {
  id: string;
  serviceId: string;
  providerId: string;
  from: number;
  to: number;
  timeText: string;
  dateText: string;
}

Availability

interface AvailabilitySlot {
  from: number;
  to: number;
  spots: number;        // remaining capacity
}

interface DaySlots {
  date: string;         // YYYY-MM-DD
  slots: AvailabilitySlot[];
}

interface ProviderAvailability {
  providerId: string;
  providerKey: string;
  days: DaySlots[];
}

interface AvailabilityResponse {
  month: string;        // YYYY-MM
  providers: ProviderAvailability[];
}

Quote

interface BookingQuoteItem {
  serviceId: string;
  providerId: string;
  slots: SlotRange[];
}

interface SlotRange {
  from: number;
  to: number;
}

A booking quote is returned as the shared Quote type — see Core Types.

Cart Item (Client-Side)

interface BookingCartItem {
  id: string;
  serviceId: string;
  serviceName: string;
  date: string;
  from: number;
  to: number;
  timeText: string;
  providerId?: string;
  forms: any[];
}

Booking Store State

State held by the SDK booking store on the client.

interface BookingStoreState {
  currentStep: number;
  totalSteps: number;
  steps: Record<number, { name: string; labelKey: string }>;
  weekdays: string[];
  monthYear: string;
  days: any[];
  current: Date;
  selectedDate: string | null;
  slots: any[];
  selectedSlot: any | null;
  selectedProvider: any | null;
  providers: any[];
  loading: boolean;
  startDate: string | null;
  endDate: string | null;
  guestToken: string | null;
  service: any | null;
  business: Business | null;
  currency: string;
  bookingForms: FormEntry[];
  apiUrl: string;
  businessId: string;
  timezone: string;
  tzGroups: any;
  items: BookingCartItem[];
  allowedPaymentMethods: string[];
  paymentConfig: {
    provider: { publishableKey: string; currency: string } | null;
    enabled: boolean;
  };
}