@releaseo/sdk-core

Host-page runtime package for Releaseo widget lifecycle, identity, events, and telemetry.

Install

npm install @releaseo/sdk-core
import releaseo from "@releaseo/sdk-core";

releaseo.init({ publishKey: "pk_live_xxx" });

Public API

APIPurpose
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.
track(eventName, payload?)Send custom analytics events through the configured analytics endpoint.
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.
on(eventName, handler) / off(...)Subscribe to runtime events.
settingsRead the latest resolved settings snapshot.

Identity

Call identify() after your app knows the signed-in user.

await releaseo.identify("u_123", {
  email: "amina@example.com",
  name: "Amina",
  tenantId: "tenant_acme",
  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.

Events

Use track() for product events you want available in Releaseo analytics.

await releaseo.track("billing_plan_viewed", {
  plan: "pro",
  source: "settings",
});

Runtime telemetry is batched by the SDK and sent to the configured analytics endpoint. The current runtime batches up to 10 events or a 2 second window, with rate limiting for custom events.

Runtime events

Subscribe to lifecycle events when you need custom host behavior.

releaseo.on("ready", () => {
  console.log("Releaseo is ready");
});

releaseo.on("error", (error) => {
  console.error("[Releaseo]", error);
});

Useful event groups include readiness, unread changes, state changes, identity errors, and bridge recovery events.

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: "Saved dashboard export presets",
      description: "Let users save recurring export setups.",
      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,
    },
  ],
});