Load the SDK
A Site without a build step loads the SDK with a script tag, before any script that uses it. The script defines theliteshop global:
liteshop global in a Site
that uses the script tag, add
/// <reference types="@liteshop.ai/sdk/global" /> to a TypeScript file.
Call the SDK from event handlers or effects that run in the browser, not while a
page is prerendered.
liteshop.forms.submit
Sends a Visitor’s answers to a declared Form.
For details, see Forms.
liteshop.bookings.getAvailability
Returns which dates or slots of an Offer a Visitor can request.
The response always includes
offerId, from, to, and unit:
- For a
nightlyordailyOffer,dateslists{ date, available }for each date. - For a
timedOffer,slotslists{ start, end, available }.startandendare ISO 8601 times with the Site’s time-zone offset, such as2027-06-01T09:00:00+02:00.
liteshop.bookings.request
Sends a Booking Request for an Offer. The Owner confirms or declines it; the
request doesn’t block the dates until the Owner confirms it.
For details, see Bookings.
liteshop.catalogue.list
Returns the published Catalogue Items and collections.
id, kind (product or service), name, optional
description, optional price (amount in minor units and currency),
optional images (Site-relative URLs, main image first) and image (the main
image), maximumQuantity, and available. available is false when the
Owner tracks stock and none is left. name and description are objects keyed
by language. Each collection has id, name, and the ordered items IDs.
liteshop.catalogue.request
Sends a request for one Catalogue Item. The Owner confirms or declines it and
arranges payment outside Liteshop.
The SDK sends the page language from
<html lang>. For details, see
Catalogue.
Errors
When Liteshop rejects a call, the promise rejects with an error that has these properties:Errors for all methods
Field errors
Forms, Booking Requests, and catalogue requests check each value against its declared field, and report these codes with the field’s ID infield:
VALUES_INVALID, FIELD_UNDECLARED, FIELD_REQUIRED, FIELD_TYPE_INVALID,
FIELD_TOO_SHORT, FIELD_TOO_LONG, FIELD_EMAIL_INVALID,
FIELD_BELOW_MINIMUM, FIELD_ABOVE_MAXIMUM, and FIELD_OPTION_INVALID.