@extn/segi-js
v0.2.11
Published
Browser JavaScript SDK for the segi error monitoring service
Downloads
164
Readme
@extn/segi-js
Browser JavaScript SDK for segi — error monitoring for teams that ship.
Install
pnpm add @extn/segi-js
# or: npm install @extn/segi-js
# or: yarn add @extn/segi-jsUse
import Segi from "@extn/segi-js";
Segi.init({
publicKey: "segi_pk_live_...",
// optional
environment: "production",
release: "1.4.2",
});
// anywhere
Segi.captureException(new Error("boom"));
Segi.captureMessage("checkout finished", { level: "info" });
Segi.setUser({ id: "user_123", email: "[email protected]" });
Segi.addBreadcrumb({ type: "click", message: "checkout button", timestamp: new Date().toISOString() });Segi.init() is idempotent — calling it twice on the same bundle is a no-op. Pass { force: true } to replace the running config.
Session recording (planned)
A separate, tree-shakeable replay module ships alongside the error SDK — importing only Segi won't pull rrweb. Opt in per app, gated by your plan's recording quota (Free 10 / Team 30 / Enterprise ∞ per project per month).
import Segi from "@extn/segi-js";
import { withReplay } from "@extn/segi-js/replay";
Segi.init({
publicKey: "segi_pk_live_...",
replay: withReplay({
enabled: true,
sample: 100, // 0–100 probabilistic gate
blockRoutes: ["/checkout", "/auth"],
mask: { inputs: "all", class: "segi-mask" },
}),
});
Segi.replay.pause(); // e.g. during a sensitive flow
Segi.replay.resume();Default protections (cannot be turned off from the SDK): rrweb input masking for password/email/tel/number/text inputs, 3-minute idle pause, project-level deny-list editable from the segi dashboard. Full design: docs/12-session-recording.md.
CDN
Drop a <script> tag and skip the bundler:
<script src="https://cdn.extn.ai/segi/segi.min.js"></script>
<script>
Segi.init({ publicKey: "segi_pk_live_..." });
</script>Docs
Full integration guide: https://segi.extn.ai/docs
Licence
Copyright (c) 2026 Extension Co., Ltd. All rights reserved. Use of this package is governed by the LICENSE file in this package and the segi service Terms of Service at https://segi.extn.ai/tnc — it is not open source.
