type Primitive = number | string | boolean | bigint | symbol | null | undefined; type Tags = Record; type Context = Record; type Contexts = Record; interface SpanContextData { traceId: string; spanId: string; } interface Span { spanContext(): SpanContextData; end(): void; } interface SpanOptions { name: string; tags?: Tags; } interface Breadcrumb { type?: string; category?: string; message: string; level?: 'info' | 'warning' | 'error'; data?: Record; } interface CaptureContext { level?: 'info' | 'warning' | 'error'; tags?: Tags; contexts?: Contexts; } interface MonitoringClient { /** * Captures an exception event and sends it to Sentry. * @param error The error to capture * @param captureContext Optional additional data to attach to the Sentry e vent. * @returns the id of the captured Sentry event. */ captureException(error: unknown, captureContext?: CaptureContext): string; /** * Captures a message event and sends it to Sentry. * @param message The message to capture * @param captureContext Define the level of the message or pass in additional data to attach to the message. * @returns the id of the captured message. */ captureMessage(message: string, captureContext?: CaptureContext): string; /** * Wraps a function with a span and finishes the span after the function is done. The created span is the active span and will be used as parent by other spans created inside the function, as long as the function is executed while the scope is active. * @param spanOptions The options for the span * @param callback The function to wrap with a span * @returns The return value of the callback */ startSpan(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): T; /** * Records a new breadcrumb which will be attached to future events. * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash. * @param breadcrumb The breadcrumb to record. */ addBreadcrumb(breadcrumb: Breadcrumb): void; } type HostModule = { __type: 'host'; create(host: H): T; }; type HostModuleAPI> = T extends HostModule ? U : never; type Host$1 = { channel?: { observeState(callback: (props: unknown, environment: Environment) => unknown): { disconnect: () => void; } | Promise<{ disconnect: () => void; }>; }; environment?: Environment; /** * Optional name of the environment, use for logging */ name?: string; /** * Optional bast url to use for API requests, for example `www.wixapis.com` */ apiBaseUrl?: string; /** * Optional function to get a monitoring client */ getMonitoringClient?: () => MonitoringClient; /** * Possible data to be provided by every host, for cross cutting concerns * like internationalization, billing, etc. */ essentials?: { /** * The language of the currently viewed session */ language?: string; /** * The locale of the currently viewed session */ locale?: string; /** * Any headers that should be passed through to the API requests */ passThroughHeaders?: Record; }; }; type HTTPMethod = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'; type RESTFunctionDescriptor any = (...args: any[]) => any> = (httpClient: HttpClient) => T; interface HttpClient { request(req: RequestOptionsFactory): Promise>; fetchWithAuth: typeof fetch; wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise; getActiveToken?: () => string | undefined; } type RequestOptionsFactory = (context: any) => RequestOptions; type HttpResponse = { data: T; status: number; statusText: string; headers: any; request?: any; }; type RequestOptions<_TResponse = any, Data = any> = { method: HTTPMethod; url: string; data?: Data; params?: URLSearchParams; } & APIMetadata; type APIMetadata = { methodFqn?: string; entityFqdn?: string; packageName?: string; }; type BuildRESTFunction = T extends RESTFunctionDescriptor ? U : never; type EventDefinition = { __type: 'event-definition'; type: Type; isDomainEvent?: boolean; transformations?: (envelope: unknown) => Payload; __payload: Payload; }; declare function EventDefinition(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): () => EventDefinition; type EventHandler = (payload: T['__payload']) => void | Promise; type BuildEventDefinition> = (handler: EventHandler) => void; type ServicePluginMethodInput = { request: any; metadata: any; }; type ServicePluginContract = Record unknown | Promise>; type ServicePluginMethodMetadata = { name: string; primaryHttpMappingPath: string; transformations: { fromREST: (...args: unknown[]) => ServicePluginMethodInput; toREST: (...args: unknown[]) => unknown; }; }; type ServicePluginDefinition = { __type: 'service-plugin-definition'; componentType: string; methods: ServicePluginMethodMetadata[]; __contract: Contract; }; declare function ServicePluginDefinition(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition; type BuildServicePluginDefinition> = (implementation: T['__contract']) => void; declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error"; type RequestContext = { isSSR: boolean; host: string; protocol?: string; }; type ResponseTransformer = (data: any, headers?: any) => any; /** * Ambassador request options types are copied mostly from AxiosRequestConfig. * They are copied and not imported to reduce the amount of dependencies (to reduce install time). * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315 */ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; type AmbassadorRequestOptions = { _?: T; url?: string; method?: Method; params?: any; data?: any; transformResponse?: ResponseTransformer | ResponseTransformer[]; }; type AmbassadorFactory = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions) & { __isAmbassador: boolean; }; type AmbassadorFunctionDescriptor = AmbassadorFactory; type BuildAmbassadorFunction = T extends AmbassadorFunctionDescriptor ? (req: Request) => Promise : never; declare global { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. interface SymbolConstructor { readonly observable: symbol; } } declare const emptyObjectSymbol: unique symbol; /** Represents a strictly empty plain object, the `{}` value. When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)). @example ``` import type {EmptyObject} from 'type-fest'; // The following illustrates the problem with `{}`. const foo1: {} = {}; // Pass const foo2: {} = []; // Pass const foo3: {} = 42; // Pass const foo4: {} = {a: 1}; // Pass // With `EmptyObject` only the first case is valid. const bar1: EmptyObject = {}; // Pass const bar2: EmptyObject = 42; // Fail const bar3: EmptyObject = []; // Fail const bar4: EmptyObject = {a: 1}; // Fail ``` Unfortunately, `Record`, `Record` and `Record` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}. @category Object */ type EmptyObject = {[emptyObjectSymbol]?: never}; /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 Use-cases: - If you want to make a conditional branch based on the result of a comparison of two types. @example ``` import type {IsEqual} from 'type-fest'; // This type returns a boolean for whether the given array includes the given item. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. type Includes = Value extends readonly [Value[0], ...infer rest] ? IsEqual extends true ? true : Includes : false; ``` @category Type Guard @category Utilities */ type IsEqual = (() => G extends A & G | G ? 1 : 2) extends (() => G extends B & G | G ? 1 : 2) ? true : false; /** Filter out keys from an object. Returns `never` if `Exclude` is strictly equal to `Key`. Returns `never` if `Key` extends `Exclude`. Returns `Key` otherwise. @example ``` type Filtered = Filter<'foo', 'foo'>; //=> never ``` @example ``` type Filtered = Filter<'bar', string>; //=> never ``` @example ``` type Filtered = Filter<'bar', 'foo'>; //=> 'bar' ``` @see {Except} */ type Filter = IsEqual extends true ? never : (KeyType extends ExcludeType ? never : KeyType); type ExceptOptions = { /** Disallow assigning non-specified properties. Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. @default false */ requireExactProps?: boolean; }; /** Create a type from an object type without certain keys. We recommend setting the `requireExactProps` option to `true`. This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). @example ``` import type {Except} from 'type-fest'; type Foo = { a: number; b: string; }; type FooWithoutA = Except; //=> {b: string} const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; //=> errors: 'a' does not exist in type '{ b: string; }' type FooWithoutB = Except; //=> {a: number} & Partial> const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; //=> errors at 'b': Type 'string' is not assignable to type 'undefined'. // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures. // Consider the following example: type UserData = { [metadata: string]: string; email: string; name: string; role: 'admin' | 'user'; }; // `Omit` clearly doesn't behave as expected in this case: type PostPayload = Omit; //=> type PostPayload = { [x: string]: string; [x: number]: string; } // In situations like this, `Except` works better. // It simply removes the `email` key while preserving all the other keys. type PostPayload = Except; //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; } ``` @category Object */ type Except = { [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial> : {}); /** Returns a boolean for whether the given type is `never`. @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919 @link https://stackoverflow.com/a/53984913/10292952 @link https://www.zhenghao.io/posts/ts-never Useful in type utilities, such as checking if something does not occur. @example ``` import type {IsNever, And} from 'type-fest'; // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts type AreStringsEqual = And< IsNever> extends true ? true : false, IsNever> extends true ? true : false >; type EndIfEqual = AreStringsEqual extends true ? never : void; function endIfEqual(input: I, output: O): EndIfEqual { if (input === output) { process.exit(0); } } endIfEqual('abc', 'abc'); //=> never endIfEqual('abc', '123'); //=> void ``` @category Type Guard @category Utilities */ type IsNever = [T] extends [never] ? true : false; /** An if-else-like type that resolves depending on whether the given type is `never`. @see {@link IsNever} @example ``` import type {IfNever} from 'type-fest'; type ShouldBeTrue = IfNever; //=> true type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>; //=> 'bar' ``` @category Type Guard @category Utilities */ type IfNever = ( IsNever extends true ? TypeIfNever : TypeIfNotNever ); /** Extract the keys from a type where the value type of the key extends the given `Condition`. Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. @example ``` import type {ConditionalKeys} from 'type-fest'; interface Example { a: string; b: string | number; c?: string; d: {}; } type StringKeysOnly = ConditionalKeys; //=> 'a' ``` To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. @example ``` import type {ConditionalKeys} from 'type-fest'; type StringKeysAndUndefined = ConditionalKeys; //=> 'a' | 'c' ``` @category Object */ type ConditionalKeys = { // Map through all the keys of the given base type. [Key in keyof Base]-?: // Pick only keys with types extending the given `Condition` type. Base[Key] extends Condition // Retain this key // If the value for the key extends never, only include it if `Condition` also extends never ? IfNever, Key> // Discard this key since the condition fails. : never; // Convert the produced object into a union type of the keys which passed the conditional test. }[keyof Base]; /** Exclude keys from a shape that matches the given `Condition`. This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. @example ``` import type {Primitive, ConditionalExcept} from 'type-fest'; class Awesome { name: string; successes: number; failures: bigint; run() {} } type ExceptPrimitivesFromAwesome = ConditionalExcept; //=> {run: () => void} ``` @example ``` import type {ConditionalExcept} from 'type-fest'; interface Example { a: string; b: string | number; c: () => void; d: {}; } type NonStringKeysOnly = ConditionalExcept; //=> {b: string | number; c: () => void; d: {}} ``` @category Object */ type ConditionalExcept = Except< Base, ConditionalKeys >; /** * Descriptors are objects that describe the API of a module, and the module * can either be a REST module or a host module. * This type is recursive, so it can describe nested modules. */ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule | EventDefinition | ServicePluginDefinition | { [key: string]: Descriptors | PublicMetadata | any; }; /** * This type takes in a descriptors object of a certain Host (including an `unknown` host) * and returns an object with the same structure, but with all descriptors replaced with their API. * Any non-descriptor properties are removed from the returned object, including descriptors that * do not match the given host (as they will not work with the given host). */ type BuildDescriptors | undefined, Depth extends number = 5> = { done: T; recurse: T extends { __type: typeof SERVICE_PLUGIN_ERROR_TYPE; } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction : T extends RESTFunctionDescriptor ? BuildRESTFunction : T extends EventDefinition ? BuildEventDefinition : T extends ServicePluginDefinition ? BuildServicePluginDefinition : T extends HostModule ? HostModuleAPI : ConditionalExcept<{ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors : never; }, EmptyObject>; }[Depth extends -1 ? 'done' : 'recurse']; type PublicMetadata = { PACKAGE_NAME?: string; }; declare global { interface ContextualClient { } } /** * A type used to create concerete types from SDK descriptors in * case a contextual client is available. */ type MaybeContext = globalThis.ContextualClient extends { host: Host$1; } ? BuildDescriptors : T; declare global { /** * A global interface to set the exposure toggle for the SDK. * @example * ```ts * declare global { * interface SDKExposureToggle { * alpha: true; * } * } */ interface SDKExposureToggle { } } type WixNamespace = string; interface Channel { observeState(callback: (props: unknown, environment: Environment) => unknown): { disconnect: () => void; } | Promise<{ disconnect: () => void; }>; } interface WebsiteChannel extends Channel { invoke: (args: { namespace: WixNamespace; method: string; args: unknown[]; }) => Promise; getAccessToken: () => Promise; } type Host = { channel: WebsiteChannel; environment?: Environment; }; /** * An object that contains address information. */ interface Address { /** * Full text address comprised of street name and number, city, subdivision, country, and postal code. * @requiredField formatted */ formatted: string; /** * Address coordinates. * @requiredField location * @servicePath wix-bookings-frontend.AddressCoordinates */ location: AddressCoordinates; /** * Address street address. * @requiredField streetAddress * @servicePath wix-bookings-frontend.StreetAddress */ streetAddress: StreetAddress; /** * Address city. * @requiredField city */ city: string; /** * Address subdivision, state, prefecture, or province. * @requiredField subdivision */ subdivision: string; /** * Address country. * @requiredField country */ country: string; /** * Address postal code. * @requiredField postalCode */ postalCode: string; } /** * An object that contains the geographic coordinates of the address. */ interface AddressCoordinates { /** * Address latitude. * @requiredField latitude */ latitude: number; /** * Address longitude. * @requiredField longitude */ longitude: number; } /** * An object used when calling getServiceAvailability() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/get-service-availability) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/get-service-availability)) * containing options for which slots should be returned. */ interface AvailabilityOptions { /** * Start date and time of the slots * to be returned. Defaults to the current date and time. */ startDateTime?: Date; /** * End date and time of the slots to * be returned. Defaults to one week from `startDateTime`, which is one week * from the current date and time if `startDateTime` is also omitted. */ endDateTime?: Date; } /** * An object used when calling checkoutBooking() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/checkout-booking) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/checkout-booking)) * containing information about the slot to be booked. */ interface BookingInfo { /** * The slot to be booked. * @requiredField slot * @servicePath wix-bookings-frontend.Slot */ slot: Slot; /** * List of form field values required to book the session. * @requiredField formFields * @servicePath wix-bookings-frontend.FormField */ formFields: FormField[]; /** * Number of spots to book. Default: `1` */ numberOfSpots?: number; } /** * An object representing the result of a call to checkoutBooking() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/checkout-booking) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/checkout-booking)). */ interface BookingResult { /** * ID of the booking that was checked out. * @requiredField bookingId */ bookingId: string; /** * Status of the booking that was checked out. * One of: * * + `"Confirmed"`: Payment was successful or payment is to be done offline. * + `"Pending Payment"`: Payment is pending. * + `"Terminated"`: Payment failed or was cancelled. * @requiredField status */ status: string; } /** * An object describing the business location. */ interface BusinessLocation { /** * Business location ID. * @requiredField id */ id: string; /** * Business location name. * @requiredField name */ name: string; /** * Business location description. * @requiredField description */ description: string; /** * An object describing the address. * @requiredField address * @servicePath wix-bookings-frontend.Address */ address: Address; } /** * An object returned after calling getCheckoutOptions() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/get-checkout-options) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/get-checkout-options)) * containing information about the available payment options for the service and the logged-in user. */ interface CheckoutMethod { /** * Available checkout methods. * @requiredField options * @servicePath wix-bookings-frontend.CheckoutMethodOption */ options: CheckoutMethodOption[]; } /** * An object returned after calling getCheckoutOptions() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/get-checkout-options) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/get-checkout-options)) * containing information about the available payment options for the service and the logged-in user. */ interface CheckoutMethodOption { /** * Type of the available payment option. Valid options are: * * + `"wixPay_Online"`: For online collections. * + `"wixPay_Offline"`: For offline collections. * + `"package"`: For a package-type pricing plan. * + `"membership"`: For a membership-type pricing plan. * @requiredField type */ type: string; /** * Name of the plan package or membership. For booking with pricing plans only. */ planName?: string; /** * Order ID of the plan package or membership. For booking with pricing plans only. */ planOrderId?: string; /** * ID of the benefit provided by the plan package. For booking with package-type pricing plans only. */ benefitId?: string; /** * Number of sessions remaining in the plan package. For booking with package-type pricing plans only. */ remainingCredits?: number; /** * Number of sessions initially provided with the plan package. For booking with package-type pricing plans only. */ totalCredits?: number; /** * Date by which the plan package or membership expires. For booking with pricing plans only. */ planExpiration?: Date; } /** * An object used to request checkout options for the service. Currently, you can request the checkout options using the ID of a slot. */ interface CheckoutOptionOptions { /** * Unique slot identifier. * @requiredField slotId */ slotId: string; /** * Member ID ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/members/introduction) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-v2/members/introduction)) for the customer making the booking. Used for retrieving valid payment plans for the customer for the selected slot. * @requiredField userId */ userId: string; } /** * An object that defines a booking window for limiting when a member can book a slot. For example, * you can prevent members from booking a service too far in advance, because perhaps the service might * be discontinued by then. Or, you can prevent members from booking a service right before it starts, as * this would make it hard to schedule resources. */ interface Constraints { /** * Date from which a member is allowed to book a slot. * @requiredField bookableFrom */ bookableFrom: Date; /** * Date until which a member is allowed to book a slot. * @requiredField bookableUntil */ bookableUntil: Date; } /** * An object used when calling checkoutBooking() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/checkout-booking) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/checkout-booking)) * containing values for form fields required to book the session. */ interface FormField { /** * ID of the form field from the **form** property in the **Booking/Services** collection. * @requiredField _id */ _id: string; /** * Form field value. * @requiredField value */ value: string; } /** * The location where a service is offered. */ interface Location { /** * Location type. Valid options are: * - `"OWNER_BUSINESS"`: The business address set by the merchant. This type is set when choosing **Business Address** in the Service Details page of a site's dashboard, and populates the `businessLocation` object. * - `"OWNER_CUSTOM"`: A custom address set by the merchant. This type is set when choosing **Custom Location** in the Service Details page of a site's dashboard, and populates the `locationText` property. * - `"CUSTOM"`: An address set for the individual booking, usually chosen by the customer and entered in the booking form. * @requiredField type */ type: string; /** * Text describing the location. * @requiredField locationText */ locationText: string; /** * An object describing the business location. * @requiredField businessLocation * @servicePath wix-bookings-frontend.BusinessLocation */ businessLocation: BusinessLocation; } /** * An object used when calling checkoutBooking() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/checkout-booking) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/checkout-booking)) * containing details about the pricing plan used to pay for the booking. */ interface PaidPlan { /** * Order ID of the plan package or membership. For booking with pricing plans only. */ planOrderId?: string; /** * ID of the benefit provided by the plan package. For booking with package-type pricing plans only. */ benefitId?: string; } /** * An object used when calling checkoutBooking() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/checkout-booking) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/checkout-booking)) * containing information about the payment options. */ interface PaymentOptions { /** * Type of payment. Valid options are: * * + `"wixPay_Online"`: For online collections. * + `"wixPay_Offline"`: For offline collections. * + `"package"`: For a package-type pricing plan. * + `"membership"`: For a membership-type pricing plan. * @requiredField paymentType */ paymentType: string; /** * A coupon code to be used with the payment. */ couponCode?: string; /** * Information about the pricing plan used to pay for the booking. * @servicePath wix-bookings-frontend.PaidPlan */ paidPlan?: PaidPlan; } /** * An object returned from [`getServiceAvailability()`](#getServiceAvailability) * containing the available bookings slots. */ interface ServiceAvailability { /** * List of the available slots. * * Max: 500 slots * @requiredField slots * @servicePath wix-bookings-frontend.Slot */ slots: Slot[]; } /** * An object representing a booking slot. */ interface Slot { /** * Unique slot identifier. * @requiredField _id */ _id: string; /** * Starting date and time of the slot. * @requiredField startDateTime */ startDateTime: Date; /** * Ending date and time of the slot. * @requiredField endDateTime */ endDateTime: Date; /** * ID of the service that the slot belongs to. * @requiredField serviceId */ serviceId: string; /** * Maximum number of participants that can book the service for this slot. * @requiredField capacity */ capacity: number; /** * Number of remaining spots that can be booked for the slot. * @requiredField remainingSpots */ remainingSpots: number; /** * ID of the slot's staff member. * @requiredField staffMemberId */ staffMemberId: string; /** * The location where this slot is offered. * @requiredField location * @servicePath wix-bookings-frontend.Location */ location: Location; /** * Whether the slot can be booked right now, meaning today's date is within the booking window defined by `constraints`. Not available for courses. * @requiredField bookable */ bookable: boolean; /** * The dates between which the slot can be booked. The constraints define the booking window. The booking window prevents site members from booking way in advance or just right before the slot starts. Not available for courses. * @requiredField constraints * @servicePath wix-bookings-frontend.Constraints */ constraints: Constraints; } /** * An object representing information about the street name and street number of an address. */ interface StreetAddress { /** * Address street name. * @requiredField name */ name: string; /** * Address street number. * @requiredField number */ number: string; } /** * **Deprecated.** * Checkout Booking has been replaced with [Create Booking](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/create-booking) and Wix eCommerce's [Create Checkout](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/create-checkout) SDK methods and will be removed on March 31, 2026. * * To understand how `checkoutBooking()` is used in a typical booking lifecycle, * see Typical Booking Lifecycle ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/sample-flow) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/sample-flow)). * * Call `checkoutBooking()` with a `BookingInfo` object that * contains the slot to book, values for all the form fields, and * the number of spots to book. * * The form fields contain additional information required for the booking. * * If the service being checked out is not a free service, you also need to specify * a `PaymentOptions` object containing information about the * method of payment and any coupon codes. If an online method of payment is specified, * a payment popup is presented for the customer to input payment information, such * as credit card information. The method's returned Promise resolves after the * customer finishes entering the payment information and the service has been successfully * booked. If no payment or an offline method of payment is specified, the payment * popup is not presented and the Promise resolves when the service has been * successfully booked. * * If a service is configured as a paid service in a site's dashboard, attempting * to perform a checkout as if it is a free service results in an error. * * When a service is booked successfully: * * + A site contact is automatically created or appended ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/crm/contacts/append-or-create-contact) | [Velo](https://dev.wix.com/docs/velo/apis/wix-crm-frontend/contacts/append-or-create-contact)) with the provided booking information. * + An email is sent to the merchant about the new booking. * + An email is sent to the customer confirming that the service was booked. * * * > **Note:** * To use `checkoutBooking()` a site must have a [Business Premium Plan](https://support.wix.com/en/article/upgrading-wix-bookings). * @param bookingInfo - Information about the slot to be booked. * @requiredField bookingInfo * @servicePath wix-bookings-frontend.BookingInfo * @param options - Information about the payment method and coupon codes. * @servicePath wix-bookings-frontend.PaymentOptions * @returns Fulfilled - Results of the booking checkout. * @servicePath wix-bookings-frontend.BookingResult */ declare function checkoutBooking(bookingInfo: BookingInfo, options?: PaymentOptions): Promise; /** * **Deprecated.** * Get Checkout Options will be removed on March 31, 2026. By default, no replacement is needed as the eCommerce purchase flow handles payment options automatically. However, [eCommerce SDK APIs](https://dev.wix.com/docs/sdk/backend-modules/ecom/introduction) are available for custom payment flow implementations. See the [End-to-End Booking Flows](https://dev.wix.com/docs/sdk/backend-modules/bookings/end-to-end-booking-flows) for complete implementation examples. * * To understand how `getCheckoutOptions()` is used in a typical booking lifecycle, * see Typical Booking Lifecycle ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/sample-flow) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/sample-flow)). * * The specified `checkoutOptionOptions` object contains the slot ID for the service. Typically, you retrieve the slot ID with the getServiceAvailability() ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/get-service-availability) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/get-service-availability)) * method. * * `getCheckoutOptions()` returns the options available for the specified user. For example, if the customer has not * purchased any pricing plans, pricing plans are not returned even if there are pricing plans associated with the service. * @param checkoutOptionOptions - An object containing the information needed to identify the service for which to list the possible checkout options. Currently, you can request the checkout options using the ID of a slot. * @requiredField checkoutOptionOptions * @servicePath wix-bookings-frontend.CheckoutOptionOptions * @returns Fulfilled - The available payment options for the service and the logged-in user. * Rejected - Checkout payment options error object. * @servicePath wix-bookings-frontend.CheckoutMethod */ declare function getCheckoutOptions(checkoutOptionOptions: CheckoutOptionOptions): Promise; /** * **Deprecated.** * Get Service Availability has been replaced with [Time Slots](https://dev.wix.com/docs/sdk/backend-modules/bookings/time-slots/introduction) SDK methods and will be removed on March 31, 2026. Depending on your [service type](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/about-service-types), use the appropriate Time Slots API to replace it. See the [End-to-End Booking Flows](https://dev.wix.com/docs/sdk/backend-modules/bookings/end-to-end-booking-flows) for implementation examples. * * > **Note:** `location` in the slot object is not yet available to all sites. * * Service availability means different things for the different service types ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/about-service-types) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-v2/services/introduction)): * * + **Appointments**: See [here](https://support.wix.com/en/article/setting-availability-for-appointments-in-wix-bookings) to * understand what affects the availability of an appointment. An * appointment is returned as available if it meets the conditions outlined in the * article linked above and the appointment slot's time falls within the time specified by the * `AvailabilityOptions` or within the default time frame if no options are specified. * + **Classes**: A class slot is returned as available if the slot's * time falls within the time specified by the `AvailabilityOptions` or within * the default time frame if no options are specified. * + **Courses**: The first session slot from a set of course sessions is returned * as available if the first course slot's time falls within the time specified by the * `AvailabilityOptions` or within the default time frame if no options are specified. * * To understand how `getServiceAvailability()` is used in a typical booking lifecycle, * see Typical Booking Lifecycle ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/bookings/sample-flow) | [Velo](https://dev.wix.com/docs/velo/apis/wix-bookings-frontend/sample-flow)). * * The specified `serviceId` must be an ID from the site's **Bookings/Services** * collection. Typically, you retrieve the ID from the collection using a * query or through a dataset. * * Optionally, you can specify an `AvailabilityOptions` * object that defines a date range for which slots should be returned. If you * do not specify an `AvailabilityOptions` object, the * default date range is from the date and time the method is called until one * week later. * @param serviceId - The ID of the service for which to check slot availability. * @requiredField serviceId * @param options - Options that refine which slots should be returned. * @servicePath wix-bookings-frontend.AvailabilityOptions * @returns Fulfilled - A list of available slots. * Rejected - Bookings error object. * @servicePath wix-bookings-frontend.ServiceAvailability */ declare function getServiceAvailability(serviceId: string, options?: AvailabilityOptions): Promise; declare const bookingsSdkModuleRuntime_checkoutBooking: typeof checkoutBooking; declare const bookingsSdkModuleRuntime_getCheckoutOptions: typeof getCheckoutOptions; declare const bookingsSdkModuleRuntime_getServiceAvailability: typeof getServiceAvailability; declare namespace bookingsSdkModuleRuntime { export { bookingsSdkModuleRuntime_checkoutBooking as checkoutBooking, bookingsSdkModuleRuntime_getCheckoutOptions as getCheckoutOptions, bookingsSdkModuleRuntime_getServiceAvailability as getServiceAvailability }; } type Methods = { [P in keyof T as T[P] extends Function ? P : never]: T[P]; }; declare const bookingsRuntime: MaybeContext, Host> & Methods>; export { bookingsRuntime as bookings };