@commentlayer/sdk
v0.1.0
Published
Vanilla TypeScript SDK for adding CommentLayer comments and guided tests to any website.
Downloads
121
Maintainers
Readme
@commentlayer/sdk
Vanilla TypeScript SDK for adding CommentLayer to any website or prototype.
It supports:
- Comment layer: Figma-style pins, threads, replies, and resolved state.
- Guided layer: participant name, optional screeners, tasks, done/stuck, and follow-up questions.
- Shadow DOM UI isolation.
- Script tag or npm import.
Install
npm install @commentlayer/sdknpm usage
import { initCommentLayer } from "@commentlayer/sdk";
initCommentLayer({
sessionToken: "pub_xxx",
apiBaseUrl: "https://your-commentlayer-app.com"
});Use a side-panel guided runner:
initCommentLayer({
sessionToken: "pub_xxx",
apiBaseUrl: "https://your-commentlayer-app.com",
guidedPlacement: "panel"
});Script tag usage
<script
src="https://your-commentlayer-app.com/sdk/commentlayer.iife.js"
data-session-token="pub_xxx"
async
></script>Side-panel guided runner:
<script
src="https://your-commentlayer-app.com/sdk/commentlayer.iife.js"
data-session-token="pub_xxx"
data-guided-placement="panel"
async
></script>Options
type CommentLayerOptions = {
sessionToken: string;
apiBaseUrl?: string;
guidedPlacement?: "overlay" | "panel";
};Build
npm run buildThe package emits:
dist/index.jsfor ESMdist/index.cjsfor CommonJSdist/index.d.tsfor TypeScriptdist/commentlayer.iife.jsfor script tags/CDNs
