@extn/segi-js 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -25
- package/dist/cdn.global.js +25 -25
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +117 -13
- package/dist/index.mjs +106 -2
- package/dist/replay/index.d.mts +6 -8
- package/dist/replay/index.d.ts +6 -8
- package/dist/replay/index.js +159 -43
- package/dist/replay/index.mjs +135 -19
- package/dist/{rrweb-O2KFXCVA.mjs → rrweb-I4V7NHNY.mjs} +4 -4
- package/dist/{rrweb-VXG3W6SS.js → rrweb-XVHLVZYC.js} +6 -6
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -59,8 +59,7 @@ Segi.init({
|
|
|
59
59
|
An OWNER or ADMIN enables recording in the dashboard. Input mask modes:
|
|
60
60
|
`all` (default: all inputs), `sensitive` (password/email/tel/number), `none`
|
|
61
61
|
(password only). Use `segi-mask` to exclude DOM regions and SDK `blockRoutes`
|
|
62
|
-
for path prefixes; the
|
|
63
|
-
recorder. The recorder pauses after 3 minutes idle.
|
|
62
|
+
for path prefixes; the console deny-list additionally requires segi-js 0.2.16 / segi-nextjs 0.2.11 and the updated server. The recorder pauses after 3 minutes idle.
|
|
64
63
|
|
|
65
64
|
## CDN
|
|
66
65
|
|
|
@@ -75,33 +74,84 @@ Drop a `<script>` tag and skip the bundler:
|
|
|
75
74
|
|
|
76
75
|
The CDN bundle is error-only; use npm for replay.
|
|
77
76
|
|
|
78
|
-
## Local development / self-hosting
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
In the consuming Next.js app's `.env.local` (for NestJS, load the server
|
|
82
|
-
variables through your app's environment/configuration):
|
|
78
|
+
## Options and SDK support
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
| Option | Default / usage | Support |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| projectKey | Required project public key | Browser, Next.js server, NestJS |
|
|
83
|
+
| environment | Optional label, e.g. development or production | All three |
|
|
84
|
+
| release | Optional application version or commit ID | All three |
|
|
85
|
+
| beforeSend | Synchronous event transform; return null to drop | Browser only |
|
|
86
|
+
| maxBreadcrumbs | 50; use a nonnegative integer, 0 retains none | Browser only |
|
|
87
|
+
|
|
88
|
+
Next.js server and NestJS accept the shared option type, but do not execute
|
|
89
|
+
beforeSend or retain breadcrumbs. Filter and sanitize data before calling
|
|
90
|
+
server capture functions. beforeSend does not mask DOM recordings.
|
|
91
|
+
|
|
92
|
+
Browser captureException/captureMessage accept event context overrides such
|
|
93
|
+
as level, tags, extra and user. Server captureException/captureMessage accept
|
|
94
|
+
extra data as their second argument; it does not override event fields.
|
|
95
|
+
Server captureMessage uses info. Use named imports on Next.js server and an
|
|
96
|
+
injected SegiService on NestJS; setUser/setTag/addBreadcrumb are browser APIs.
|
|
97
|
+
|
|
98
|
+
Browser captureException accepts any value, not only Error instances (v0.2.17+).
|
|
99
|
+
Strings and numbers become the message; objects with a message (and optional
|
|
100
|
+
name/code/stack) keep those fields; event-like wrappers (`{ error }`, `{ reason }`)
|
|
101
|
+
are unwrapped; plain data is serialised. A value with nothing to report — `{}`,
|
|
102
|
+
`undefined`, `null`, an empty array — is dropped unless you pass
|
|
103
|
+
`{ message }` in the context, so a third-party callback handing you an empty
|
|
104
|
+
object no longer produces an "Error: {}" issue. `normalizeError(value)` is
|
|
105
|
+
exported if you want the same conversion in your own code.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
// Browser: include maxBreadcrumbs in your single initialization.
|
|
109
|
+
Segi.init({ projectKey: "segi_pk_live_xxxxx", maxBreadcrumbs: 30 });
|
|
110
|
+
Segi.addBreadcrumb({ type: "navigation", message: "Checkout opened",
|
|
111
|
+
timestamp: new Date().toISOString() });
|
|
112
|
+
Segi.setUser({ id: String(user.id) }); // after login
|
|
113
|
+
Segi.setUser(null); // after logout
|
|
89
114
|
```
|
|
90
115
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
116
|
+
## Recording option reference
|
|
117
|
+
|
|
118
|
+
| Option | Default / behavior |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| enabled | withReplay only; true by default. false skips replay activation, not errors. Project recording must also be enabled by OWNER/ADMIN. |
|
|
121
|
+
| sample | 100; probability from 0 to 100 percent. 20 selects approximately 20%. Initialization rolls again, including reloads; this is not error sampling. |
|
|
122
|
+
| blockRoutes | Empty array; pathname prefix match. /auth also matches /author. Configure before sensitive routes. |
|
|
123
|
+
| mask.inputs | all by default; sensitive masks password/email/tel/number; none still masks passwords. |
|
|
124
|
+
| mask.class | segi-mask; blocks the matching DOM region and descendants. |
|
|
125
|
+
| user | Next.js provider: { id, email? }; null clears identity; undefined leaves manual Segi.setUser management unchanged. |
|
|
126
|
+
|
|
127
|
+
SegiReplayProvider does not expose beforeSend/maxBreadcrumbs props. Use a
|
|
128
|
+
single Segi.init with withReplay if you need these browser options and replay.
|
|
129
|
+
SegiReplayProvider applies configuration at initial mount. Changes to user
|
|
130
|
+
are synchronized, but changing other props does not reinitialize the SDK.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// Add these options to the existing withReplay call, not another initializer.
|
|
134
|
+
replay: withReplay({ sample: 20, blockRoutes: ["/auth", "/account/payment"],
|
|
135
|
+
mask: { inputs: "all", class: "segi-mask" } })
|
|
136
|
+
|
|
137
|
+
Segi.replay.pause();
|
|
138
|
+
Segi.replay.resume();
|
|
139
|
+
Segi.replay.event("checkout_started", { itemCount: 2 });
|
|
140
|
+
Segi.replay.notifyRouteChange(); // after non-Next.js SPA navigation
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
pause/resume control DOM recording, not all error capture, and do not delete
|
|
144
|
+
previously collected data. Use blockRoutes for persistent route exclusions.
|
|
145
|
+
Custom event names are limited to 64 characters; meta must not contain passwords
|
|
146
|
+
or payment details. Events send only while replay is active and unpaused.
|
|
147
|
+
The Next.js provider reports pathname changes automatically. Other SPAs must
|
|
148
|
+
notify the SDK after the URL changes for page tracking and exclusions.
|
|
149
|
+
Starting on a blocked route defers replay. After rendering an allowed SPA page, notifyRouteChange starts it. Manual pause persists across navigation.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<SegiReplayProvider publicKey={process.env.NEXT_PUBLIC_SEGI_PROJECT_KEY!}
|
|
153
|
+
user={user ? { id: String(user.id) } : null} />
|
|
154
|
+
```
|
|
105
155
|
|
|
106
156
|
## Docs
|
|
107
157
|
|
|
@@ -113,3 +163,9 @@ Full integration guide: <https://segi.extn.ai/docs>
|
|
|
113
163
|
Copyright (c) 2026 Extension Co., Ltd. All rights reserved. Use of this package
|
|
114
164
|
is governed by the LICENSE file in this package and the segi service Terms of
|
|
115
165
|
Service at https://segi.extn.ai/tnc — it is **not** open source.
|
|
166
|
+
|
|
167
|
+
## Console exclusion policy compatibility
|
|
168
|
+
|
|
169
|
+
The source versions introducing console path exclusions are segi-js 0.2.16 and segi-nextjs 0.2.11; this does not certify npm publication. Deploy the updated server before upgrading the SDK. The SDK reads policy before collection, retries failures every 30 seconds, and records nothing until a valid response arrives. Error monitoring is independent.
|
|
170
|
+
|
|
171
|
+
Console paths and SDK blockRoutes are combined. Policy changes take effect on the next full page load, not immediately in open tabs. Prefix matching is case-sensitive: /auth also matches /author. Saved data is not deleted. On SPA navigation, change the URL before rendering excluded DOM; after rendering an allowed page call notifyRouteChange (automatic in the Next.js Provider). For routers rendering sensitive content before updating the URL, pause before transition or mask the content. Saving settings does not confirm SDK adoption.
|