@duabalabs/sellub-embed
Drop a Sellub-powered storefront into any HTML page with one <script> tag
and one function call. Designed for partner sites, marketing landings and
“buy” buttons that don’t want to ship a full React app.
Status: v0.1 ships the API surface and a stub renderer (“Loading Sellub storefront…”). The lazy-loaded iframe + Shop API binding lands in v0.2 — see package-status.
Install
CDN:
<script src="https://cdn.jsdelivr.net/npm/@duabalabs/sellub-embed/dist/index.global.js"></script>…or as an npm dependency:
pnpm add @duabalabs/sellub-embedMount
<div id="sellub"></div>
<script>
window.mountSellubEmbed({
target: "#sellub",
channelToken: "nenaboateng",
apiUrl: "https://api.sellub.com/shop-api",
});
</script>…or from an ES module:
import { mountSellubEmbed } from "@duabalabs/sellub-embed";
const handle = mountSellubEmbed({
target: document.getElementById("sellub")!,
channelToken: "nenaboateng",
currency: "GHS",
});
// Later
handle.refresh();
handle.destroy();Options
| Option | Type | Notes |
|---|---|---|
target | HTMLElement | string | DOM element or selector to mount into |
channelToken | string | Sellub channel for the storefront |
apiUrl | string? | Defaults to https://api.sellub.com/shop-api |
currency | string? | Optional override; otherwise channel default |
Returned handle
| Method | Purpose |
|---|---|
destroy() | Unmount and free DOM |
refresh() | Re-fetch (e.g. after a price change) |
Securing your channel
mountSellubEmbed uses your channel’s publishable scope only — it needs
no secret. Configure the Allowed Origins field on the channel
(Settings → API & embeds) so only your sites can mount the embed.
Why an iframe (eventually)?
Once the v0.2 renderer lands the embed will lazy-load a sandboxed iframe
pointing at https://embed.sellub.com/<channelToken>. This isolates the
storefront’s CSS/JS from the host page and lets us ship UI updates without
asking integrators to bump the npm version.
Related
sellub-client— for headless integrations where you build the UI yourself.- Multi-tenancy — how channel tokens map to seller storefronts.