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

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,220 @@
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
+ ### Feedback button placement
59
+
60
+ In **Project Settings → Feedback button**, choose the built-in button's position, text and
61
+ orientation. The SDK applies the settings on startup. An explicit `label` prop overrides the
62
+ project's text.
63
+
64
+ When **Avoid covering other controls** is on, mark the elements that the button should stay clear
65
+ of. It uses the preferred position whenever that spot is free.
66
+
67
+ ```tsx
68
+ <aside data-seaproof-avoid>
69
+ <HelpButton />
70
+ </aside>
71
+ ```
72
+
73
+ ## Diagnostics
74
+
75
+ The SDK keeps the last 500 entries in memory: `console` output, `fetch` and
76
+ `XMLHttpRequest` calls, and uncaught errors and unhandled promise rejections. Only the
77
+ method, the URL with query values replaced by `*`, the status and the duration are recorded
78
+ for each request; bodies and headers never are. The SDK's own calls are left out.
79
+ `client.log("...")` adds your own lines. Testers' reports include the entries as
80
+ `diagnostics.ndjson`, which the inbox shows as a timeline.
81
+
82
+ ```ts
83
+ createSeaproof({
84
+ apiKey,
85
+ diagnostics: { console: true, network: true, errors: true }, // or false
86
+ includeDiagnostics: true, // send also in production
87
+ reportCrashes: true, // report uncaught errors on their own
88
+ });
89
+ ```
90
+
91
+ ## Styling
92
+
93
+ You restyle the widget with CSS variables. Set them on `:root` or on any ancestor of the
94
+ widget:
95
+
96
+ ```css
97
+ :root {
98
+ --seaproof-primary: #6d28d9; /* launcher, send button */
99
+ --seaproof-on-primary: #fff;
100
+ --seaproof-surface: #fff; /* panel background */
101
+ --seaproof-surface-sunken: #edf2f5; /* tab track, conversation */
102
+ --seaproof-text: #111;
103
+ --seaproof-text-muted: #555;
104
+ --seaproof-border: #d4d4d8; /* dividers and cards */
105
+ --seaproof-border-strong: #71717a; /* text fields; keep 3:1 against the surface */
106
+ --seaproof-focus: #e8590c; /* focus ring */
107
+ --seaproof-radius: 16px; /* the panel; fields and buttons scale with it */
108
+ --seaproof-font: "Inter", sans-serif;
109
+ --seaproof-z-index: 1000;
110
+ }
111
+ ```
112
+
113
+ The widget is light by default. `<FeedbackWidget colorScheme="dark" />` uses Seaproof's dark
114
+ palette, and `"auto"` follows the visitor's system setting. Your variables win in every scheme.
115
+
116
+ A colour and logo set under **Branding** in the Seaproof admin are used without a release:
117
+ the colour fills in when you have not set `--seaproof-primary`, and the logo sits at the top of
118
+ the panel (`.seaproof-logo`). Turn both off with `branding: false` in the client options.
119
+
120
+ For anything else, you can target the stable classes `seaproof-launcher`, `seaproof-backdrop`,
121
+ `seaproof-panel`, `seaproof-type`, `seaproof-tabs`, `seaproof-footer`, `seaproof-primary` and
122
+ `seaproof-error`. The built-in
123
+ rules sit inside `:where()`, so any selector of yours wins without `!important`:
124
+
125
+ ```css
126
+ .seaproof-launcher { left: 20px; right: auto; }
127
+ ```
128
+
129
+ ## Without React
130
+
131
+ ```ts
132
+ import { captureScreenshot, createSeaproof } from "@seaproof/core";
133
+
134
+ const seaproof = createSeaproof({ apiKey: "sp_…" });
135
+ await seaproof.submit({
136
+ type: "bug",
137
+ description: "Checkout button does nothing",
138
+ attachments: [{ kind: "screenshot", file: await captureScreenshot() }],
139
+ });
140
+ ```
141
+
142
+ ## Screen recording
143
+
144
+ Testers get **Record the screen** in the widget, in browsers that support screen sharing
145
+ (desktop Chrome, Edge, Firefox and Safari; not mobile browsers). The browser asks what to
146
+ share, the widget hides, and a bar with a timer and **Stop** appears. The video (WebM, or MP4
147
+ in Safari) is attached when they stop, after 60 seconds at most. Offer it to end users with
148
+ `<FeedbackWidget recording />`, or use `ScreenRecorder` from `@seaproof/core` directly.
149
+
150
+ A recording shows everything on the shared surface: `data-seaproof-mask` only applies to
151
+ screenshots.
152
+
153
+ ## Replies and ideas
154
+
155
+ The widget gets two more tabs when they have content: **Your feedback**, where users read the
156
+ team's replies to what they sent from this browser and answer, and **Ideas**, where they vote
157
+ on ideas the team published. Pick the views with `<FeedbackWidget views={["send"]} />`.
158
+
159
+ No account is needed: the SDK creates a random reporter key per browser in `localStorage`
160
+ (pass `storage` to `createSeaproof` to use something else). Without React, the same calls are
161
+ on the client: `myFeedback()`, `myFeedbackItem(id)`, `sendMessage(id, body)`, `ideas()`,
162
+ `vote(id)`, `unvote(id)` and `hasUnreadReply(item)`.
163
+
164
+ To show a signed-in user their conversations on every device, turn on **Identity
165
+ verification** under API keys in the admin, sign the user's id on your backend
166
+ (`HMAC-SHA256(secret, userId)` as hex, never in the browser) and pass it along:
167
+
168
+ ```tsx
169
+ <FeedbackWidget reporter={{ externalId: user.id, name: user.name, userHash: user.seaproofHash }} />
170
+ // or, without the widget: client.identify({ externalId: user.id, userHash: user.seaproofHash });
171
+ ```
172
+
173
+ ## Seaproof Assist
174
+
175
+ The widget is a short conversation. The first message saves the report, so nothing is lost if
176
+ the user stops there; everything after it (more text, a marked-up screenshot, a recording) is
177
+ added to the same report. Without Assist, or when the plan's quota is used up, the widget asks
178
+ with fixed lines instead.
179
+
180
+ When the team turns Assist on in the admin, the widget helps while the user writes. Nothing
181
+ changes in your code.
182
+
183
+ - **Suggestions:** known problems and public ideas that look like the draft appear under the
184
+ text. "Same for me" sends the report linked to the known one, and ideas can be voted for
185
+ there. Only the title and summary the team made public are ever shown.
186
+ - **Follow-up questions:** after the report is saved, an AI model asks what it is missing, one
187
+ question at a time and at most five. The answers are added to the report. A slow or failing
188
+ model never stops a report.
189
+
190
+ Without React: `assistSettings()`, `suggest(text, type)`, `review(type, description, conversationId)`
191
+ (one id per draft from `newConversationId()`, so one draft counts as one Assist conversation), and
192
+ `linkedTo` on `submit()`. `addAttachments(id, files)` adds files to a report already sent.
193
+ ## When something fails
194
+
195
+ The SDK logs a console warning with what went wrong, the error code and a link to the fix, for
196
+ example `Seaproof: could not fetch the project for the API key. This API key is unknown or
197
+ revoked. … (sdk.key_invalid). How to fix: https://seaproof.io/docs/errors#sdk.key_invalid`. `SeaproofError` carries `code`, `status` and
198
+ `helpUrl`, and `describeError(error)` gives the same text. All codes:
199
+ [error reference](https://seaproof.io/docs/errors.md).
200
+
201
+ ## Using a coding agent
202
+
203
+ Agents find the docs at https://seaproof.io/llms.txt. Claude Code users can install the
204
+ Seaproof plugin, which adds an `add-seaproof` skill and the MCP server; there are rules for
205
+ Cursor and Copilot too. See [AI agents](https://seaproof.io/docs/ai-agents.md).
206
+
207
+ ## Privacy
208
+
209
+ Screenshots are taken in the browser. Elements with `data-seaproof-mask` and all password fields
210
+ are left out, so their content never leaves the device. Mark anything personal.
211
+
212
+ ## How a submission travels
213
+
214
+ 1. `POST /api/v1/sdk/feedback` with the text, context and a list of files (type and size only).
215
+ 2. The API answers with one presigned upload URL per file.
216
+ 3. The SDK `PUT`s each file straight to object storage, then reports it with
217
+ `POST /api/v1/sdk/feedback/{id}/attachments/{attachmentId}/uploaded`.
218
+
219
+ The object-storage bucket needs a CORS rule that allows `PUT` from any origin with a
220
+ `Content-Type` header.