@bookla-app/react-client-sdk
Version:
React SDK for Bookla Client API
165 lines (164 loc) • 3.9 kB
TypeScript
export type ServiceType = "fixed" | "flexible" | "group" | "ticket" | "days";
export type BookingStatus = "confirmed" | "pending" | "cancelled" | "finished" | "no_show" | "rejected";
export interface ServiceResponse {
id: string;
companyID: string;
name: string;
type: ServiceType;
color: string;
createdAt: string;
updatedAt: string;
timeZone?: string;
settings?: ServiceSettings;
resources?: ResourceResponse[];
tickets?: TicketResponse[];
}
export interface ServiceSettings {
currency?: string;
bookingPolicy?: string;
duration?: string;
timeInterval?: string;
bufferBefore?: string;
bufferAfter?: string;
tax?: {
rate: number;
inclusive: boolean;
};
}
export interface ResourceResponse {
id: string;
companyID: string;
name: string;
color: string;
createdAt: string;
updatedAt: string;
services?: ServiceResponse[];
}
export interface TicketResponse {
id: string;
name: string;
}
export interface TimesResponse {
times: {
[resourceId: string]: TimeSlot[];
};
}
export interface DatesResponse {
dates: {
[resourceId: string]: string[];
};
timeZone: string;
}
export interface TimeSlot {
startTime: string;
duration: string;
price: {
amount: number;
comparedAmount: number;
currency: string;
};
}
export interface BookingListResponse {
bookings: BookingResponse[];
limit: number;
offset: number;
total: number;
}
export interface BookingResponse {
id: string;
companyID: string;
resourceID: string;
serviceID: string;
startTime: string;
endTime: string;
duration: string;
spots: number;
price?: number;
currency?: string;
type: ServiceType;
status: BookingStatus;
paymentURL?: string;
tickets?: {
[ticketID: string]: {
spots: number;
price: number;
comparedPrice?: number;
};
};
metaData?: {
[key: string]: any;
};
createdAt: string;
}
export interface SubscriptionContract {
id: string;
clientID: string;
subscriptionID: string;
status: string;
activeFrom: string;
duration: string;
limitations: {
bookingsCount?: number;
daysOfWeek?: number;
maxDuration?: string;
maxSpotsPerBooking?: number;
maxTicketsPerBooking?: Record<string, number>;
times?: Array<{
startTime: string;
endTime: string;
}>;
};
metaData?: Record<string, any>;
}
export interface SubscriptionCartResponse {
expiresAt: string;
items: SubscriptionContract[];
}
export interface PurchaseSubscriptionsResponse {
items: SubscriptionContract[];
price: number;
currency: string;
tax: number;
taxRate: number;
taxInclusive: boolean;
expiresAt: string;
paymentURL?: string;
}
export interface CompanySubscription {
id: string;
title: string;
price: number;
comparedPrice?: number;
currency: string;
duration: string;
availableFrom: string;
availableTo: string;
rRule?: string;
resourceIDs: string[];
serviceIDs: string[];
limitations: {
bookingsCount?: number;
daysOfWeek?: number;
maxDuration?: string;
maxSpotsPerBooking?: number;
maxTicketsPerBooking?: Record<string, number>;
times?: Array<{
startTime: string;
endTime: string;
}>;
};
metaData?: Record<string, any>;
}
export interface CodeValidateResponse {
canApply: boolean;
clientID: string;
clientEmail: string;
price: number;
pluginNameSpace: string;
pluginResponse?: Record<string, any>;
}
export interface ClientAuthResponse {
accessToken: string;
refreshToken: string;
expiresAt: string;
}