@pixelmatters/markup 1.0.1 → 1.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/README.md CHANGED
@@ -74,7 +74,7 @@ export default function App() {
74
74
  {/* your app */}
75
75
  <MarkupWidget
76
76
  apiUrl={import.meta.env.VITE_MARKUP_API_URL}
77
- apiKey={import.meta.env.VITE_MARKUP_KEY}
77
+ apiKey={import.meta.env.VITE_MARKUP_API_KEY}
78
78
  position="bottom-right" // optional
79
79
  theme="light" // optional
80
80
  />
@@ -131,7 +131,70 @@ The popup origin is validated against the project's `allowedDomains` before any
131
131
  1. Sign in to the Markup dashboard.
132
132
  2. Open your project → **Settings → API Keys**.
133
133
  3. Click **New key**, label it, and copy the raw key — it's shown once.
134
- 4. Open **Settings → Domains** and add the host domain (`app.example.com`, `*.staging.example.com`). `localhost` is auto-allowed in dev.
134
+ 4. Open **Settings → Domains** and add the host domain (`app.example.com`, `*.staging.example.com`). Production deployments do not auto-allow `localhost`; add it to the allowlist explicitly if you test against the deployment from `http://localhost`.
135
+
136
+ ## AI prompt
137
+
138
+ Paste the block below into Claude, ChatGPT, Cursor, or any other LLM and it'll wire the widget into your codebase end-to-end.
139
+
140
+ ````markdown
141
+ You are helping me install the **`@pixelmatters/markup`** feedback widget into my web app.
142
+
143
+ ## What it is
144
+
145
+ A drop-in feedback widget published on npm as `@pixelmatters/markup`. It mounts a floating action button that lets users pin threaded comments (and optional annotated screenshots) anywhere on the page. It runs inside a shadow DOM so it doesn't affect host CSS.
146
+
147
+ ## My credentials
148
+
149
+ - `apiUrl`: `https://<MY_DEPLOYMENT>.convex.site` ← replace with the value from Markup dashboard → Settings → Install
150
+ - `apiKey`: `markup_...` ← replace with a key from Markup dashboard → Settings → API Keys
151
+ Store these in environment variables (e.g. `VITE_MARKUP_API_URL`, `VITE_MARKUP_API_KEY`, or the equivalent for my framework). Do not hardcode them.
152
+
153
+ ## API
154
+
155
+ ```ts
156
+ import { init, destroy } from '@pixelmatters/markup'
157
+ // or:
158
+ import { MarkupWidget } from '@pixelmatters/markup/react'
159
+
160
+ init({
161
+ apiUrl: string, // required
162
+ apiKey: string, // required
163
+ position?: 'bottom-right' | 'bottom-left', // default 'bottom-right'
164
+ theme?: 'light' | 'dark' | 'auto', // default 'auto'
165
+ }) // returns a destroy() function — call it on unmount / logout / route teardown
166
+ ```
167
+
168
+ For a `<script>` tag drop-in (no bundler), use:
169
+
170
+ ```html
171
+ <script
172
+ type="module"
173
+ src="https://unpkg.com/@pixelmatters/markup"
174
+ data-markup-widget="true"
175
+ data-api-url="..."
176
+ data-api-key="..."
177
+ data-position="bottom-right"
178
+ ></script>
179
+ ```
180
+
181
+ The `data-markup-widget="true"` attribute is required.
182
+
183
+ ## Your task
184
+
185
+ 1. Detect my framework (React, Vue, Svelte, Next.js, plain HTML, etc.) by inspecting the project.
186
+ 2. Install `@pixelmatters/markup` with the package manager already in use (pnpm/npm/yarn).
187
+ 3. Wire the widget into the **root layout / app shell** so it shows on every page.
188
+ 4. Read `apiUrl` and `apiKey` from environment variables; create `.env.example` entries and update `.gitignore` if needed.
189
+ 5. For SPAs, ensure the widget is mounted once at the root (not per route) and unmounted via `destroy()` on logout.
190
+ 6. Show me a diff of the changes and a one-line note on how to verify (e.g. "run dev server, click the button in the bottom-right").
191
+
192
+ Constraints:
193
+
194
+ - Do **not** add CSS imports or provider components — the widget needs neither.
195
+ - Do **not** hardcode the key.
196
+ - If the project has a CSP, add `https://unpkg.com` to `script-src` only if I'm using the `<script>` tag path.
197
+ ````
135
198
 
136
199
  ## Browser support
137
200