@zinnect-test/embed-react
Version:
React package for embedding Zinnect booking widget
80 lines (69 loc) • 2.03 kB
TypeScript
/**
* @zinnect/embed-react
* TypeScript definitions for @zinnect/embed-react
*/
interface BookingApiConfig {
/** Namespace identifier for the booking instance */
namespace: string;
/** Origin URL for the booking API (optional, defaults to window.location.origin) */
origin?: string;
/** Custom embed.js URL (optional, defaults to {origin}/embed/embed.js) */
embedUrl?: string;
}
interface UIConfig {
/** Layout type: 'month', 'week', 'weekly', etc. */
layout?: string;
/** Background image URL */
bg_url?: string;
/** Title text */
title?: string;
/** Logo URL */
logo_url?: string;
/** Hide event type details */
hideEventTypeDetails?: boolean;
/** Brand color for light mode */
brandColorLight?: string;
/** Brand color for dark mode */
brandColorDark?: string;
/** Theme: 'auto', 'light', 'dark' */
theme?: string;
}
interface OpenBookingOptions {
/** Booking link URL */
bookingLink?: string;
/** UI configuration */
config?: UIConfig;
}
type BookingApiMethod = "ui" | "inline" | "open";
/**
* Booking API function returned by getBookingApi
*/
interface BookingApi {
/**
* Configure UI settings
* @param uiConfig - UI configuration object
*/
(method: "ui", uiConfig: UIConfig): void;
/**
* Set up inline booking on an element
* @param options - Inline booking options
*/
(method: "inline", options?: any): void;
/**
* Open booking modal programmatically
* @param options - Options for opening booking
*/
(method: "open", options?: OpenBookingOptions): void;
/**
* Generic method call
*/
(method: string, ...args: any[]): void;
}
/**
* Get the Booking API for a specific namespace
* @param config - Configuration object
* @returns Promise that resolves to Booking API function
*/
declare function getBookingApi(config: BookingApiConfig): Promise<BookingApi>;
export { getBookingApi as default, getBookingApi };
export type { BookingApi, BookingApiConfig, BookingApiMethod, OpenBookingOptions, UIConfig };