Provider & client
KitenzoProvider
Section titled “KitenzoProvider”Wrap your app once. It memoizes a KitenzoClient, auto-fetches shop settings, and makes both available to descendant hooks.
import { KitenzoProvider } from '@kitenzo/react';
function App() { return ( <KitenzoProvider apiKey={import.meta.env.VITE_KITENZO_API_KEY}> <Outlet /> </KitenzoProvider> );}Props — KitenzoProviderProps
Section titled “Props — KitenzoProviderProps”| Prop | Type | Default | Description |
|---|---|---|---|
apiKey | string | — (required) | Headless API key (kit_live_… / kit_test_…). |
apiVersion | string | 'v1' | API version segment. |
baseUrl | string | https://live.bb.eight-cdn.com/api/headless/v1 | Override the API base URL (e.g. for staging or local dev). When set, apiVersion is ignored. |
children | ReactNode | — | Your app. |
useKitenzo()
Section titled “useKitenzo()”Returns the KitenzoClient from the nearest provider. Throws if used outside <KitenzoProvider>.
const client = useKitenzo();const bundles = await client.listBundles();useSettings()
Section titled “useSettings()”Returns the shop’s ShopSettings ({ currency, moneyFormat, activeFeatures }) or null while loading.
const settings = useSettings();// settings?.moneyFormat → "${{amount}}"KitenzoClient (direct use)
Section titled “KitenzoClient (direct use)”You don’t need React to use the client — instantiate it anywhere (server loaders, scripts, other frameworks):
import { KitenzoClient } from '@kitenzo/core';
const client = new KitenzoClient({ apiKey: 'kit_live_…', // baseUrl: 'http://localhost:8123/api/headless/v1', // optional override});Constructor options — KitenzoClientOptions
Section titled “Constructor options — KitenzoClientOptions”| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | — (required) | Must start with kit_live_ or kit_test_. |
apiVersion | string | 'v1' | Must match v\d+. |
baseUrl | string | https://live.bb.eight-cdn.com/api/headless/v1 | Full base URL override. |
Methods
Section titled “Methods”| Method | Signature | Returns | Description |
|---|---|---|---|
listBundles | listBundles() | Promise<Bundle[]> | All published bundles (lightweight, no product data). |
getBundle | getBundle(id: number) | Promise<BundleDetail> | One bundle with sections, products and variants merged. |
submitBundle | submitBundle(bundle, selections, { countryCode? }) | Promise<SubmitBundleResult> | Validate the selection and create a configured bundle; returns variant/product, discount, subscription and pricing. |
getSettings | getSettings() | Promise<ShopSettings> | Shop currency, money format and active features. |
Errors are thrown as KitenzoError (with .status and .response). See TypeScript types for the return shapes.