@thebookingkit/core API
All exports from @thebookingkit/core.
Slot Engine
Section titled “Slot Engine”import { getAvailableSlots, isSlotAvailable } from "@thebookingkit/core";| Function | Description |
|---|---|
getAvailableSlots(rules, overrides, bookings, dateRange, timezone, options?) | Compute available time slots |
isSlotAvailable(rules, overrides, bookings, start, end) | Check if a specific slot is open |
RRULE Parser
Section titled “RRULE Parser”import { parseRecurrence, InvalidRRuleError } from "@thebookingkit/core";| Function | Description |
|---|---|
parseRecurrence(rrule, dateRange, startTime, endTime) | Expand RRULE into date occurrences |
Timezone
Section titled “Timezone”import { normalizeToUTC, utcToLocal, isValidTimezone, getTimezoneOffset, InvalidTimezoneError } from "@thebookingkit/core";Booking Limits
Section titled “Booking Limits”import { computeBookingLimits, filterSlotsByLimits } from "@thebookingkit/core";| Function | Description |
|---|---|
computeBookingLimits(config, existingBookings, dateRange) | Calculate remaining capacity |
filterSlotsByLimits(slots, config, existingBookings) | Remove slots that exceed limits |
Event Types
Section titled “Event Types”import { validateEventType, generateSlug, validateQuestionResponses, EventTypeValidationError } from "@thebookingkit/core";Confirmation Mode
Section titled “Confirmation Mode”import { getInitialBookingStatus, getAutoRejectDeadline, isPendingBookingOverdue, CONFIRMATION_TIMEOUT_HOURS } from "@thebookingkit/core";Booking Tokens
Section titled “Booking Tokens”import { generateBookingToken, verifyBookingToken } from "@thebookingkit/core";Auth Middleware
Section titled “Auth Middleware”import { withAuth, assertProviderOwnership, assertCustomerAccess } from "@thebookingkit/core";| Function | Description |
|---|---|
withAuth(handler, adapter, options?) | Wrap a handler with authentication |
assertProviderOwnership(session, providerId) | Assert the user owns the provider |
assertCustomerAccess(session, customerEmail) | Assert the user has access to the customer’s data |
Serialization Retry
Section titled “Serialization Retry”import { withSerializableRetry, SerializationRetryExhaustedError } from "@thebookingkit/core";Team Scheduling
Section titled “Team Scheduling”import { getTeamSlots, assignHost, resolveManagedEventType, isFieldLocked, propagateTemplateChanges } from "@thebookingkit/core";Payments
Section titled “Payments”import { evaluateCancellationFee, validateCancellationPolicy, computePaymentSummary, requiresPayment, hasNoShowFee, validatePaymentAmount, validateCurrency, formatPaymentAmount, PaymentValidationError } from "@thebookingkit/core";Workflows
Section titled “Workflows”import { resolveTemplateVariables, evaluateConditions, validateWorkflow, matchWorkflows, DEFAULT_TEMPLATES, TEMPLATE_VARIABLES, WorkflowValidationError } from "@thebookingkit/core";Webhooks
Section titled “Webhooks”import { signWebhookPayload, verifyWebhookSignature, createWebhookEnvelope, resolvePayloadTemplate, matchWebhookSubscriptions, getRetryDelay, isSuccessResponse, validateWebhookSubscription, WebhookValidationError, DEFAULT_RETRY_CONFIG, WEBHOOK_TRIGGERS, SIGNATURE_HEADER, TIMESTAMP_HEADER } from "@thebookingkit/core";Recurring Bookings
Section titled “Recurring Bookings”import { generateOccurrences, checkRecurringAvailability, cancelFutureOccurrences, isValidFrequency, RecurringBookingError } from "@thebookingkit/core";Seats / Group Bookings
Section titled “Seats / Group Bookings”import { computeSeatAvailability, canReserveSeat, isGroupEvent, computeGroupEventSummary, formatSeatCount, validateSeatReservation, SeatError } from "@thebookingkit/core";Notifications
Section titled “Notifications”import { sendConfirmationEmail, sendReminderEmail, sendCancellationEmail, sendRescheduleEmail, scheduleAutoReject, syncBookingToCalendar, deleteBookingFromCalendar, formatDateTimeForEmail, formatDurationForEmail } from "@thebookingkit/core";Email Templates
Section titled “Email Templates”import { interpolateTemplate, CONFIRMATION_EMAIL_HTML, CONFIRMATION_EMAIL_TEXT, REMINDER_EMAIL_HTML, CANCELLATION_EMAIL_HTML, RESCHEDULE_EMAIL_HTML } from "@thebookingkit/core";Routing Forms
Section titled “Routing Forms”import { validateRoutingForm, evaluateRoutingRules, validateRoutingResponses, computeRoutingAnalytics, RoutingFormValidationError } from "@thebookingkit/core";import { validateEmbedConfig, generateEmbedSnippet, generateAllSnippets, buildEmbedUrl, EmbedConfigError } from "@thebookingkit/core";REST API Utilities
Section titled “REST API Utilities”import { createErrorResponse, createSuccessResponse, createPaginatedResponse, generateApiKey, hashApiKey, verifyApiKey, hasScope, isKeyExpired, checkRateLimit, encodeCursor, decodeCursor, validateSlotQueryParams, parseSortParam, API_ERROR_CODES } from "@thebookingkit/core";CLI Utilities
Section titled “CLI Utilities”import { COMPONENT_REGISTRY, findComponent, resolveComponentDependencies, listComponents, createManifestEntry, hasLocalModifications, generateSlotkitConfig, generateEnvTemplate, parseMigrationFiles, getPendingMigrations, DEFAULT_MANIFEST } from "@thebookingkit/core";Multi-Tenancy
Section titled “Multi-Tenancy”import { resolveEffectiveSettings, getRolePermissions, roleHasPermission, assertOrgPermission, assertTenantScope, buildOrgBookingUrl, parseOrgBookingPath, TenantAuthorizationError, GLOBAL_DEFAULTS } from "@thebookingkit/core";Errors
Section titled “Errors”import { BookingConflictError, SerializationRetryExhaustedError, UnauthorizedError, ForbiddenError } from "@thebookingkit/core";Adapters
Section titled “Adapters”import type { AuthAdapter, EmailAdapter, CalendarAdapter, JobAdapter, PaymentAdapter, StorageAdapter, SmsAdapter } from "@thebookingkit/core";import { generateICSAttachment, JOB_NAMES } from "@thebookingkit/core";