mountGlassHouse(options)
Returns Promise<GlassHouseEmbed>. Importing the entry is safe during server rendering; call the function in the browser after the target element mounts.
| Option | Use |
|---|---|
target · required | An empty, connected element or CSS selector. |
endpoint · required | Same-origin server base path, usually /api/glasshouse/. |
productId | Current purchasable product ID, or null. |
appearance | dark (default) or light. |
launch | help (default), chat or visual_layout. |
presentation | Help-menu copy, contact URL and optional product selectors. |
onCartChange | Callback with the store’s CartResult. |
Mount one GlassHouse interface per document.
Instance methods
| Method | Effect |
|---|---|
updateContext({ productId }) | Change the current product without remounting the interface. Pass null for a general page. |
destroy() | Unmount the interface and release its listeners and state. |
Product-card overlays
Opt in with selectors that match your storefront. Put data-product-id on each card and use the same ID as the catalogue.
<article class="plant-card" data-product-id="lavender-2l">
<!-- Your existing product content -->
</article>presentation: {
productCardSelector: '.plant-card',
productNameSelector: '.plant-card__name',
productImageSelector: '.plant-card__image',
contactUrl: '/contact',
}Package exports
| Import | Exports |
|---|---|
@superseeded/glasshouse | mountGlassHouse, browser option types. |
@superseeded/glasshouse/style.css | The interface stylesheet. |
@superseeded/glasshouse/server | createGlassHouseHandler, registerGlassHouseStore. |
@superseeded/glasshouse/node | createNodeHandler. |
@superseeded/glasshouse/types | StoreAdapter, StoreProduct, ShopperContext, CartResult and UI contracts. |
@superseeded/glasshouse/core | Deterministic product, recommendation and layout functions. |
Server options
createGlassHouseHandler(options) returns an asynchronous Request/Response handler.
| Option | Use |
|---|---|
origin | Required canonical storefront origin, without a trailing slash or path. |
merchantToken | Required server-held merchant credential. |
adapter | Required store catalogue and optional cart methods. |
resolveShopper, rateLimit, consumeNonce | Required callbacks explained in the server guide. |
basePath | Defaults to /api/glasshouse. Match the browser endpoint and server routing. |
onError | Optional server-side error handler for your logging system. |
Advanced service configuration
agentUrl overrides the default SuperSeeded service URL. callbackKeys overrides the trusted public signature-verification keys. Use these only for an intentionally configured service environment.