@commentary-dev/review-sdk
v0.1.2
Published
Browser SDK for Commentary Live Preview Reviews.
Maintainers
Readme
Commentary Review SDK
Browser SDK for Commentary Live Preview Reviews.
The SDK lets a preview app connect to Commentary, expose route changes, and let reviewers select UI elements for anchored comments. It is designed to run only in review or preview environments.
Framework Compatibility
The SDK does not depend on React, Next.js, Vue, Svelte, Angular, Astro, Vite, or any other frontend framework. It does require a real browser DOM with window, document, DOM events, selectors, element geometry, History or Hash routing events, iframe embedding, and postMessage.
Use it in any preview app that can load the browser bundle and render selectable DOM elements. Canvas-only, WebGL-only, native mobile, or server-only surfaces need additional app-specific metadata before Commentary can anchor element comments usefully.
Install
npm install @commentary-dev/review-sdkFor CDN usage, load the browser bundle:
<script src="https://cdn.commentary.dev/review-sdk/latest/commentary-review-sdk.js"></script>Usage
The browser bundle initializes itself when loaded. Configure the parent origin before the script when your review shell does not run at the default Commentary origin:
<script>
window.__COMMENTARY_PARENT_ORIGIN__ = "https://commentary.dev";
window.__COMMENTARY_PARENT_ORIGINS__ = ["https://commentary.dev", "https://staging.commentary.dev"];
window.__COMMENTARY_BUILD_ID__ = "preview-123";
window.__COMMENTARY_COMMIT_SHA__ = "abcdef123456";
</script>
<script src="https://cdn.commentary.dev/review-sdk/latest/commentary-review-sdk.js"></script>Use stable element attributes for the best anchors:
<button data-commentary-id="Billing.save">Save changes</button>Package Outputs
dist/commentary-review-sdk.js: self-initializing browser SDK.dist/index.d.ts: ambient browser configuration declarations.
Release
This package is published as @commentary-dev/review-sdk and mirrored to https://cdn.commentary.dev/review-sdk/.
