@releaseo/sdk-core
Host-page runtime package for the Releaseo update widget lifecycle, identity handoff, unread state, and open controls.
Install
npm install @releaseo/sdk-core
import releaseo from "@releaseo/sdk-core";
releaseo.init({ publishKey: "pk_live_xxx" });
Public API
| API | Purpose |
|---|---|
init(config) | Initialize runtime, fetch /sdk/config, and mount the launcher infrastructure. |
endpoint(endpoint) | Update the API endpoint at runtime. |
identify(userId, properties?) | Attach the current viewer to the SDK session. |
open() / close() | Control the widget drawer manually. |
logout() | Clear identity and keep the widget mounted in anonymous mode. |
reset() | Fully tear down iframe, launcher, identity, and runtime state. |
setMockData(posts) | Replace changelog mock data for preview/local flows. |
setMockFeatureRequests(items) | Replace feature request mock data for preview/local flows. |
settings | Read the latest resolved settings snapshot. |
Identity
Call identify() after your app knows the signed-in viewer.
await releaseo.identify("viewer_123", {
email: "[email protected]",
name: "Demo User",
workspaceId: "workspace_456",
plan: "startup",
});
Identity is persisted by the runtime with a default TTL of 30 days. Use
logout() when a user signs out, and use reset() for tenant, organization, or
project switches that need a clean SDK session.
Runtime callbacks
Subscribe to lifecycle callbacks when you need custom host behavior.
releaseo.on("ready", () => {
console.log("Releaseo is ready");
});
releaseo.on("error", (error) => {
console.error("[Releaseo]", error);
});
Useful callback groups include readiness, unread changes, state changes, identity errors, and bridge recovery notices.
Preview and mock mode
For demos or dashboard previews, initialize with mock changelog or feature request data. This lets the widget render without public network calls for those surfaces.
releaseo.init({
publishKey: "pk_demo",
mockFeatureRequests: [
{
id: "fr_1",
projectId: "proj_demo",
kind: "feature_request",
title: "Clearer export labels",
description: "Let customers request clearer export names.",
status: "open",
reviewStatus: "approved",
categoryId: "general",
category: {
id: "general",
value: "general",
label: "General",
color: "rgb(107, 114, 128)",
},
authorUserId: null,
authorName: "Anonymous",
authorEmail: null,
reviewedAt: null,
reviewedByUserId: null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
commentCount: 0,
upvotes: 12,
downvotes: 0,
score: 12,
},
],
});