@selorax/platform
v0.1.12
Published
SeloraX platform client islands (cart, variant selector, checkout, …).
Readme
@selorax/platform
The platform-provided client islands (interactive React components) for SeloraX Pages storefronts.
npm i @selorax/platform0.1.0 · pre-1.0.
What it is
SeloraX Pages renders mostly static, server-rendered HTML/TSX. Where a storefront needs real interactivity — quantity steppers, variant selection, add-to-cart, the cart view, checkout — it uses these 'use client' island components. Tenant pages import them by name; the runtime resolves @selorax/platform and Next hydrates them in the browser.
The components are intentionally platform-provided (not tenant-authored): they integrate with the cart SDK and the same-origin commerce proxies, so they behave consistently across every store.
Components
| Component | What it does |
|---|---|
| QuantityPicker | +/- quantity stepper (local state) |
| VariantSelector | option selection → resolves the composite SKU |
| AddToCart | adds the resolved SKU to the cart |
| ProductCard | product tile with add / "choose options" |
| CartView | live mini-cart — qty, remove, subtotal |
| CheckoutForm | maps the cart → a COD order, shows confirmation |
| PostPurchaseOffer | post-order upsell |
import { QuantityPicker, AddToCart, CartView } from '@selorax/platform';Notes
- Client components (
'use client') — they hydrate in the browser.react/react-domare peer dependencies. - They expect the cart SDK on the page:
window.SeloraX.cart, mounted by@selorax/runtime'scart-sdkscript (/selorax-cart.js). Without it, add-to-cart is a no-op. - Commerce actions go through the runtime's same-origin proxies (
/api/cart/enrich,/api/checkout,/api/orders/modify), which forward to the storefront API. - You normally get this package transitively via
@selorax/runtime/ aselorax-pages buildoutput; install it directly only if you're assembling the runtime yourself.
Part of SeloraX Pages
@selorax/data · @selorax/runtime · @selorax/platform · @selorax/compiler · @selorax/pages-cli
