@kormsen-engineering/hos-storefront
v0.1.0
Published
Typed client of the Kormsen Hospitality OS Storefront API (events, baskets, orders, the waiting list) for venue websites, with its Zod contract.
Readme
@kormsen-engineering/hos-storefront
The typed client of the Kormsen Hospitality OS Storefront API, for a venue's own website: events on
sale, pre-sale codes, baskets, checkout, the guest's booking and the waiting list. It ships the Storefront
contract too (Zod schemas and types such as Basket, StorefrontEvent and StorefrontOrder).
npm install @kormsen-engineering/hos-storefrontimport { createStorefrontClient, isDefinedError, safe } from "@kormsen-engineering/hos-storefront";
const shop = createStorefrontClient({
baseUrl: "https://api.example.com",
publishableKey: "pk_live_…", // the venue's publishable key: safe in a browser
});
const events = await shop.storefront.events.list({});
const [error, event] = await safe(shop.storefront.events.get({ id: "ser_…" }));- Each call is the documented REST request (
/storefront/<version>/…). The API version is in the path (API_VERSION); a breaking change goes only into a new dated version. - Writes send an
Idempotency-Key. Pass your own to retry safely:shop.storefront.baskets.placeOrder(input, { context: { idempotencyKey } }). - Guest secrets (basket, manage and waiting-list tokens) are headers: add them with your own
fetch. termsAcceptanceandtermsRequiredhelp with the venue's ticket terms at checkout.
Only the Storefront API is in this package. The Admin API is internal to Kormsen.
ESM only. Works in browsers and in Node 22 or newer.
Licence
MIT, © Kormsen Ltd. See LICENSE.
