@seaproof/core 0.0.0-stage → 0.1.0-beta.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eonic Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,244 @@
1
- # Temporary Holding Version
1
+ # Seaproof for React and the web
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Two packages:
4
+
5
+ - `@seaproof/react`: a feedback button and dialog for React apps.
6
+ - `@seaproof/core`: the client underneath, for any web app or framework.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install @seaproof/react # React apps (includes @seaproof/core)
12
+ npm install @seaproof/core # any other web app
13
+ ```
14
+
15
+ Create a project and a **test** API key in the [Seaproof admin](https://app.seaproof.io) first,
16
+ and add where the app runs (such as `http://localhost:5173`) under **Allowed websites** on the
17
+ key so other sites cannot use it. Keep the key in `.env.local`, out of git:
18
+
19
+ ```sh
20
+ VITE_SEAPROOF_KEY=sp_...
21
+ ```
22
+
23
+ > **Beta.** While Seaproof is in beta, apps report to a test deployment rather than
24
+ > https://api.seaproof.io. Pass its address as `endpoint` (a prop on `SeaproofProvider`, an
25
+ > option to `createSeaproof`), for example `endpoint={import.meta.env.VITE_SEAPROOF_ENDPOINT}`.
26
+ > The admin's install steps and the MCP tool `get_sdk_setup` show the right address.
27
+
28
+ ## React
29
+
30
+ ```tsx
31
+ import { FeedbackWidget, SeaproofProvider } from "@seaproof/react";
32
+
33
+ <SeaproofProvider
34
+ apiKey={import.meta.env.VITE_SEAPROOF_KEY}
35
+ appVersion={import.meta.env.VITE_APP_VERSION}
36
+ commit={import.meta.env.VITE_COMMIT_SHA} // optional: links reports to the build
37
+ >
38
+ <App />
39
+ <FeedbackWidget />
40
+ </SeaproofProvider>;
41
+ ```
42
+
43
+ Start the app: with a test key, a **Feedback** button appears in the corner. Step-by-step
44
+ guides: [React](https://seaproof.io/docs/react.md), [Next.js](https://seaproof.io/docs/nextjs.md).
45
+ A runnable app is in [examples/react-vite](https://github.com/eoniclabs/seaproof-sdk/tree/main/examples/react-vite).
46
+
47
+ Open it from your own button with `useSeaproof().open()` and `<FeedbackWidget launcher={false} />`.
48
+
49
+ ## Testers and end users
50
+
51
+ The SDK reads the API key's environment. You name your environments per project in the
52
+ Seaproof admin (Dev, QA, UAT, Prod...), and each is in test or production mode. With a key in
53
+ a test-mode environment, the floating **Feedback** button is shown and the diagnostics are
54
+ attached to reports. With a key in a production-mode environment, neither happens, and you open the widget from your own button with
55
+ `useSeaproof().open()`. You can override this with `mode: "tester" | "production"` and
56
+ `<FeedbackWidget launcher={true} />`.
57
+
58
+ ### Tester sign-in and Do it now
59
+
60
+ With a test or staging key, the test strip at the top of the widget offers **Sign in as
61
+ tester**. The tester enters their own e-mail address and the six-digit code Seaproof sends to
62
+ it, so the team knows who reported even on a shared test account. The session is kept in the
63
+ browser for 30 days, and the strip shows the tester's name and group with **Sign out**. Testers
64
+ in a group that may use the fast track also get a **Do it now** checkbox, for the types their
65
+ group may use (`canFastTrackType(tester, type)`). Who may sign in, and what each group may do, is set up under **Reporters** in the
66
+ admin; see [fast track](../../docs/fast-track.md). Production keys never show sign-in or send a
67
+ session.
68
+
69
+ ### Feedback button placement
70
+
71
+ In **Project Settings → Feedback button**, choose the built-in button's position, text and
72
+ orientation. The SDK applies the settings on startup. An explicit `label` prop overrides the
73
+ project's text.
74
+
75
+ When **Avoid covering other controls** is on, mark the elements that the button should stay clear
76
+ of. It uses the preferred position whenever that spot is free.
77
+
78
+ ```tsx
79
+ <aside data-seaproof-avoid>
80
+ <HelpButton />
81
+ </aside>
82
+ ```
83
+
84
+ ## Diagnostics
85
+
86
+ The SDK keeps the last 500 entries in memory: `console` output, `fetch` and
87
+ `XMLHttpRequest` calls, and uncaught errors and unhandled promise rejections. Only the
88
+ method, the URL with query values replaced by `*`, the status and the duration are recorded
89
+ for each request; bodies and headers never are. The SDK's own calls are left out.
90
+ `client.log("...")` adds your own lines. Testers' reports include the entries as
91
+ `diagnostics.ndjson`, which the inbox shows as a timeline.
92
+
93
+ ```ts
94
+ createSeaproof({
95
+ apiKey,
96
+ diagnostics: { console: true, network: true, errors: true }, // or false
97
+ includeDiagnostics: true, // send also in production
98
+ reportErrors: true, // errors to the Errors page, also in production
99
+ });
100
+ ```
101
+
102
+ ### Errors
103
+
104
+ Uncaught errors and unhandled rejections go to the project's **Errors** page, grouped by problem
105
+ and linked to reports sent in the same page load. They are on by default for test keys and off for
106
+ production keys; `reportErrors: true` or `false` decides yourself. Until the key's environment is
107
+ known, errors wait. Send errors your app catches with `client.captureException(error, { fingerprint, context })`.
108
+ `client.sessionId` is the id that links reports and errors. `reportCrashes` is deprecated: it turns
109
+ on `reportErrors`, and errors no longer become inbox reports. See
110
+ [Errors in context](https://seaproof.io/docs/error-tracking.md).
111
+
112
+ ## Styling
113
+
114
+ You restyle the widget with CSS variables. Set them on `:root` or on any ancestor of the
115
+ widget:
116
+
117
+ ```css
118
+ :root {
119
+ --seaproof-primary: #6d28d9; /* launcher, send button */
120
+ --seaproof-on-primary: #fff;
121
+ --seaproof-surface: #fff; /* panel background */
122
+ --seaproof-surface-sunken: #edf2f5; /* tab track, conversation */
123
+ --seaproof-text: #111;
124
+ --seaproof-text-muted: #555;
125
+ --seaproof-border: #d4d4d8; /* dividers and cards */
126
+ --seaproof-border-strong: #71717a; /* text fields; keep 3:1 against the surface */
127
+ --seaproof-focus: #e8590c; /* focus ring */
128
+ --seaproof-radius: 16px; /* the panel; fields and buttons scale with it */
129
+ --seaproof-font: "Inter", sans-serif;
130
+ --seaproof-z-index: 1000;
131
+ }
132
+ ```
133
+
134
+ The widget is light by default. `<FeedbackWidget colorScheme="dark" />` uses Seaproof's dark
135
+ palette, and `"auto"` follows the visitor's system setting. Your variables win in every scheme.
136
+
137
+ A colour and logo set under **Branding** in the Seaproof admin are used without a release:
138
+ the colour fills in when you have not set `--seaproof-primary`, and the logo sits at the top of
139
+ the panel (`.seaproof-logo`). Turn both off with `branding: false` in the client options.
140
+
141
+ On the Free and Team plans, a small "Powered by seaproof" link sits at the bottom of the panel
142
+ (`.seaproof-powered`). The plan decides it on the server; Business and Enterprise leave it out.
143
+
144
+ For anything else, you can target the stable classes `seaproof-launcher`, `seaproof-backdrop`,
145
+ `seaproof-panel`, `seaproof-type`, `seaproof-tabs`, `seaproof-footer`, `seaproof-primary` and
146
+ `seaproof-error`. The built-in
147
+ rules sit inside `:where()`, so any selector of yours wins without `!important`:
148
+
149
+ ```css
150
+ .seaproof-launcher { left: 20px; right: auto; }
151
+ ```
152
+
153
+ ## Without React
154
+
155
+ ```ts
156
+ import { captureScreenshot, createSeaproof } from "@seaproof/core";
157
+
158
+ const seaproof = createSeaproof({ apiKey: "sp_…" });
159
+ await seaproof.submit({
160
+ type: "bug",
161
+ description: "Checkout button does nothing",
162
+ attachments: [{ kind: "screenshot", file: await captureScreenshot() }],
163
+ });
164
+ ```
165
+
166
+ ## Screen recording
167
+
168
+ Testers get **Record the screen** in the widget, in browsers that support screen sharing
169
+ (desktop Chrome, Edge, Firefox and Safari; not mobile browsers). The browser asks what to
170
+ share, the widget hides, and a bar with a timer and **Stop** appears. The video (WebM, or MP4
171
+ in Safari) is attached when they stop, after 60 seconds at most. Offer it to end users with
172
+ `<FeedbackWidget recording />`, or use `ScreenRecorder` from `@seaproof/core` directly.
173
+
174
+ A recording shows everything on the shared surface: `data-seaproof-mask` only applies to
175
+ screenshots.
176
+
177
+ ## Replies and ideas
178
+
179
+ The widget gets two more tabs when they have content: **Your feedback**, where users read the
180
+ team's replies to what they sent from this browser and answer, and **Ideas**, where they vote
181
+ on ideas the team published. Pick the views with `<FeedbackWidget views={["send"]} />`.
182
+
183
+ No account is needed: the SDK creates a random reporter key per browser in `localStorage`
184
+ (pass `storage` to `createSeaproof` to use something else). Without React, the same calls are
185
+ on the client: `myFeedback()`, `myFeedbackItem(id)`, `sendMessage(id, body)`, `ideas()`,
186
+ `vote(id)`, `unvote(id)` and `hasUnreadReply(item)`.
187
+
188
+ To show a signed-in user their conversations on every device, turn on **Identity
189
+ verification** under API keys in the admin, sign the user's id on your backend
190
+ (`HMAC-SHA256(secret, userId)` as hex, never in the browser) and pass it along:
191
+
192
+ ```tsx
193
+ <FeedbackWidget reporter={{ externalId: user.id, name: user.name, userHash: user.seaproofHash }} />
194
+ // or, without the widget: client.identify({ externalId: user.id, userHash: user.seaproofHash });
195
+ ```
196
+
197
+ ## Seaproof Assist
198
+
199
+ The widget is a short conversation. The first message saves the report, so nothing is lost if
200
+ the user stops there; everything after it (more text, a marked-up screenshot, a recording) is
201
+ added to the same report. Without Assist, or when the plan's quota is used up, the widget asks
202
+ with fixed lines instead.
203
+
204
+ When the team turns Assist on in the admin, the widget helps while the user writes. Nothing
205
+ changes in your code.
206
+
207
+ - **Suggestions:** known problems and public ideas that look like the draft appear under the
208
+ text. "Same for me" sends the report linked to the known one, and ideas can be voted for
209
+ there. Only the title and summary the team made public are ever shown.
210
+ - **Follow-up questions:** after the report is saved, an AI model asks what it is missing, one
211
+ question at a time and at most five. The answers are added to the report. A slow or failing
212
+ model never stops a report.
213
+
214
+ Without React: `assistSettings()`, `suggest(text, type)`, `review(type, description, conversationId)`
215
+ (one id per draft from `newConversationId()`, so one draft counts as one Assist conversation), and
216
+ `linkedTo` on `submit()`. `addAttachments(id, files)` adds files to a report already sent.
217
+ ## When something fails
218
+
219
+ The SDK logs a console warning with what went wrong, the error code and a link to the fix, for
220
+ example `Seaproof: could not fetch the project for the API key. This API key is unknown or
221
+ revoked. … (sdk.key_invalid). How to fix: https://seaproof.io/docs/errors#sdk.key_invalid`. `SeaproofError` carries `code`, `status` and
222
+ `helpUrl`, and `describeError(error)` gives the same text. All codes:
223
+ [error reference](https://seaproof.io/docs/errors.md).
224
+
225
+ ## Using a coding agent
226
+
227
+ Agents find the docs at https://seaproof.io/llms.txt. Claude Code users can install the
228
+ Seaproof plugin, which adds an `add-seaproof` skill and the MCP server; there are rules for
229
+ Cursor and Copilot too. See [AI agents](https://seaproof.io/docs/ai-agents.md).
230
+
231
+ ## Privacy
232
+
233
+ Screenshots are taken in the browser. Elements with `data-seaproof-mask` and all password fields
234
+ are left out, so their content never leaves the device. Mark anything personal.
235
+
236
+ ## How a submission travels
237
+
238
+ 1. `POST /api/v1/sdk/feedback` with the text, context and a list of files (type and size only).
239
+ 2. The API answers with one presigned upload URL per file.
240
+ 3. The SDK `PUT`s each file straight to object storage, then reports it with
241
+ `POST /api/v1/sdk/feedback/{id}/attachments/{attachmentId}/uploaded`.
242
+
243
+ The object-storage bucket needs a CORS rule that allows `PUT` from any origin with a
244
+ `Content-Type` header.