@usepatch/widget 0.1.0

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 Sim Studio BV
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 ADDED
@@ -0,0 +1,53 @@
1
+ # @usepatch/widget
2
+
3
+ The embeddable feedback widget for [Patch](https://usepatch.dev). Drop it into your preview deployments and clients can pin comments directly on the page, no account required.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @usepatch/widget
9
+ ```
10
+
11
+ Requires React 19 or later.
12
+
13
+ ## Usage
14
+
15
+ Render the `Patch` component once, near the root of your app:
16
+
17
+ ```tsx
18
+ import { Patch } from "@usepatch/widget";
19
+
20
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
21
+ return (
22
+ <html>
23
+ <body>
24
+ {children}
25
+ <Patch />
26
+ </body>
27
+ </html>
28
+ );
29
+ }
30
+ ```
31
+
32
+ The widget needs your project token, found in your Patch project settings. It resolves in this order:
33
+
34
+ 1. The `projectToken` prop: `<Patch projectToken="pk_..." />`
35
+ 2. `NEXT_PUBLIC_PATCH_TOKEN` (Next.js)
36
+ 3. `VITE_PATCH_TOKEN` (Vite)
37
+
38
+ Project tokens are publishable keys, safe to expose in client-side code.
39
+
40
+ ## Props
41
+
42
+ | Prop | Type | Description |
43
+ | --- | --- | --- |
44
+ | `projectToken` | `string` | Project token. Overrides env-var resolution. |
45
+ | `apiBase` | `string` | Base URL for the Patch API. Defaults to `https://app.usepatch.dev`. |
46
+
47
+ ## How it works
48
+
49
+ The widget renders inside a shadow root, so its styles never collide with your app's. Visitors identify with just a name and email, leave pinned annotations, and reply in threads. You see everything in your Patch dashboard.
50
+
51
+ ## License
52
+
53
+ MIT