SellubSDKssellub-embed

@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.

npm

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-embed

Mount

<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

OptionTypeNotes
targetHTMLElement | stringDOM element or selector to mount into
channelTokenstringSellub channel for the storefront
apiUrlstring?Defaults to https://api.sellub.com/shop-api
currencystring?Optional override; otherwise channel default

Returned handle

MethodPurpose
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.

  • sellub-client — for headless integrations where you build the UI yourself.
  • Multi-tenancy — how channel tokens map to seller storefronts.