{"_id":"@1mn/react","_rev":"4-ee84073dcf7b962686e466423ec0c7d0","name":"@1mn/react","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@1mn/react","version":"0.1.0","keywords":["1mn","analytics","product-analytics","error-tracking","user-management","react","posthog","sentry","telemetry"],"author":{"name":"1mn"},"license":"MIT","_id":"@1mn/react@0.1.0","maintainers":[{"name":"1mn","email":"dan+1mn@leshem.co"}],"homepage":"https://github.com/usefulagents/1mn-sdk#readme","bugs":{"url":"https://github.com/usefulagents/1mn-sdk/issues"},"dist":{"shasum":"83265746464490b60de538ef5b616b81d0f83b06","tarball":"https://registry.npmjs.org/@1mn/react/-/react-0.1.0.tgz","fileCount":9,"integrity":"sha512-fznwhvYmDC9zKG6zzyflWR8tD1N2oL09j+e8WODcSDWYYg6S8v6sQCBFklt2GZaw5L3t/zqcgh2HWAGwNiluFA==","signatures":[{"sig":"MEUCIGO8V2H57SLIiDEfxYvhiEUvHgi6cuVSiWJXQkKsOMl5AiEAqMSyXPegigUWIccwpSgqU08o2nXE7bz5L1iZzVy4fTE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":110816},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"a97f551b97ac8482853be45837d434c770eecc33","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"1mn","email":"dan+1mn@leshem.co"},"repository":{"url":"git+https://github.com/usefulagents/1mn-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"React bindings for the 1mn SDK — embedded product analytics, error tracking, and user management (PostHog/Sentry-like). Self-contained: npm install + <OnemnProvider>, no snippet.","directories":{},"sideEffects":false,"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^2.1.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/react":"^19.0.0","@testing-library/react":"^16.1.0"},"peerDependencies":{"react":">=17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react_0.1.0_1781204360914_0.9999648149495957","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@1mn/react","version":"0.2.0","keywords":["1mn","analytics","product-analytics","error-tracking","user-management","react","posthog","sentry","telemetry"],"author":{"name":"1mn"},"license":"MIT","_id":"@1mn/react@0.2.0","maintainers":[{"name":"1mn","email":"dan+1mn@leshem.co"}],"homepage":"https://github.com/usefulagents/1mn-sdk#readme","bugs":{"url":"https://github.com/usefulagents/1mn-sdk/issues"},"dist":{"shasum":"90269f3162c191c1fcab99acdb428830bea220ac","tarball":"https://registry.npmjs.org/@1mn/react/-/react-0.2.0.tgz","fileCount":9,"integrity":"sha512-43Wzry7cBHFeJoYvjzbWEMppaSd/DOdXzxlnKs957wTQ2pArCZlT1/etcw+2947x+p9kFqBIPtMbhmP4U4Y1Uw==","signatures":[{"sig":"MEUCIGA60LNQmUTCcP8RgJAMz6bYVgZ9btJkePwoDMz0dIPrAiEAiRAiIHWA7VSiRed64crGR1Gi40yMtubkpgXKuOfAtyQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":158756},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"2995b54400c5f75207c374c06a377e5bf76d885d","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"1mn","email":"dan+1mn@leshem.co"},"repository":{"url":"git+https://github.com/usefulagents/1mn-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"React bindings for the 1mn SDK — embedded product analytics, error tracking, user management, and customer feedback (PostHog/Sentry-like). Self-contained: npm install + <OnemnProvider>, no snippet.","directories":{},"sideEffects":false,"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^2.1.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/react":"^19.0.0","@types/react-dom":"^19.2.3","@testing-library/react":"^16.1.0"},"peerDependencies":{"react":">=17.0.0","react-dom":">=17.0.0"},"peerDependenciesMeta":{"react-dom":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/react_0.2.0_1781439746285_0.6878186913887665","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@1mn/react","version":"0.3.0","keywords":["1mn","analytics","product-analytics","error-tracking","user-management","react","posthog","sentry","telemetry"],"author":{"name":"1mn"},"license":"MIT","_id":"@1mn/react@0.3.0","maintainers":[{"name":"1mn","email":"dan+1mn@leshem.co"}],"homepage":"https://github.com/usefulagents/1mn-sdk#readme","bugs":{"url":"https://github.com/usefulagents/1mn-sdk/issues"},"dist":{"shasum":"d473947424c58c356aca7a8895761997ec7ffaeb","tarball":"https://registry.npmjs.org/@1mn/react/-/react-0.3.0.tgz","fileCount":9,"integrity":"sha512-9Hqtr6BzKHxi7yRPNCFgWVp4LOZsPOBLguaYCPjHmU4FmcdxB7JmonTIGw8WXXHrTxVjzTyTOjm9IsAHfN58BA==","signatures":[{"sig":"MEUCIQCkv0EMQVsQxpNkpq1RJWtwVXj7kF43yZ/LQRKTvaGyNgIgC5wlSmmDFA5brrHtHv6yIVCW8sjJ6Y6xWNVUJCTv6/o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":162293},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"2995b54400c5f75207c374c06a377e5bf76d885d","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"1mn","email":"dan+1mn@leshem.co"},"repository":{"url":"git+https://github.com/usefulagents/1mn-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"React bindings for the 1mn SDK — embedded product analytics, error tracking, user management, and customer feedback (PostHog/Sentry-like). Self-contained: npm install + <OnemnProvider>, no snippet.","directories":{},"sideEffects":false,"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^2.1.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/react":"^19.0.0","@types/react-dom":"^19.2.3","@testing-library/react":"^16.1.0"},"peerDependencies":{"react":">=17.0.0","react-dom":">=17.0.0"},"peerDependenciesMeta":{"react-dom":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/react_0.3.0_1781554463434_0.19199737999028832","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@1mn/react","version":"0.4.0","description":"React bindings for the 1mn SDK — embedded product analytics, session replay, error tracking, user management, and customer feedback (PostHog/Sentry-like). Self-contained: npm install + <OnemnProvider>, no snippet.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"sideEffects":false,"scripts":{"build":"tsup","test":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"keywords":["1mn","analytics","product-analytics","error-tracking","user-management","react","posthog","sentry","telemetry"],"author":{"name":"1mn"},"license":"MIT","homepage":"https://github.com/usefulagents/1mn-sdk#readme","repository":{"type":"git","url":"git+https://github.com/usefulagents/1mn-sdk.git"},"bugs":{"url":"https://github.com/usefulagents/1mn-sdk/issues"},"peerDependencies":{"react":">=17.0.0","react-dom":">=17.0.0"},"peerDependenciesMeta":{"react-dom":{"optional":true}},"devDependencies":{"@testing-library/react":"^16.1.0","@types/react":"^19.0.0","@types/react-dom":"^19.2.3","jsdom":"^25.0.0","react":"^19.0.0","react-dom":"^19.0.0","tsup":"^8.3.0","typescript":"^5.7.0","vitest":"^2.1.0"},"publishConfig":{"access":"public"},"_id":"@1mn/react@0.4.0","gitHead":"d4997f8ce728ff9e68bbbf60f4ad17f3c7592a32","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-cDypmS2PbYRqHzXCthCDAkbZYIg4Wul33cowsKo34l7XoNgON/xFw2MmHCkIJRHMRwQmObWXX8p1fLfG+ffx0g==","shasum":"90953a28a91a1a29d77339eb31ea62d0cf7dfc27","tarball":"https://registry.npmjs.org/@1mn/react/-/react-0.4.0.tgz","fileCount":9,"unpackedSize":177837,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHXuDI39ZjFBS6kxSDTrzrKLl2OuNFPsmUS4KlyZtksmAiANFpMXsLlmJfUGFPiRpLz1sIL5R1fBOm8CZld9QXRGeg=="}]},"_npmUser":{"name":"1mn","email":"dan+1mn@leshem.co"},"directories":{},"maintainers":[{"name":"1mn","email":"dan+1mn@leshem.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react_0.4.0_1783319613899_0.8740837276698239"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-11T18:59:20.732Z","modified":"2026-07-06T06:33:34.159Z","0.1.0":"2026-06-11T18:59:21.107Z","0.2.0":"2026-06-14T12:22:26.420Z","0.3.0":"2026-06-15T20:14:23.691Z","0.4.0":"2026-07-06T06:33:34.049Z"},"bugs":{"url":"https://github.com/usefulagents/1mn-sdk/issues"},"author":{"name":"1mn"},"license":"MIT","homepage":"https://github.com/usefulagents/1mn-sdk#readme","keywords":["1mn","analytics","product-analytics","error-tracking","user-management","react","posthog","sentry","telemetry"],"repository":{"type":"git","url":"git+https://github.com/usefulagents/1mn-sdk.git"},"description":"React bindings for the 1mn SDK — embedded product analytics, session replay, error tracking, user management, and customer feedback (PostHog/Sentry-like). Self-contained: npm install + <OnemnProvider>, no snippet.","maintainers":[{"name":"1mn","email":"dan+1mn@leshem.co"}],"readme":"# @1mn/react\n\nReact bindings for the [1mn](https://1mn.ai) SDK — embedded **product analytics, error tracking,\nand user management** (PostHog/Sentry-like) for your React or Next.js app.\n\nSelf-contained: it bundles the SDK core, so `npm install` + one provider is all you need. No\nsnippet, no script tag.\n\n- 📈 **Analytics** — automatic pageviews (incl. SPA navigations), sessions, web vitals, and custom events.\n- 👥 **User management** — identify your signed-in users (with email) and watch them in your 1mn dashboard.\n- 🐛 **Errors** — uncaught exceptions and unhandled rejections captured and grouped automatically.\n- 💬 **Feedback** — a drop-in `<FeedbackWidget>` (or headless hook) that files customer feedback as tickets.\n- 🎬 **Session replay** — opt-in per key from your dashboard; the recorder (rrweb) lazy-loads only for sampled sessions, so it never touches this bundle's size. Off by default; inputs masked.\n- 🪶 ~9 KB, zero runtime dependencies, SSR-safe.\n\n## Install\n\n```bash\nnpm install @1mn/react\n```\n\n## Quickstart\n\nWrap your app once with `OnemnProvider` and pass your public key (`1mn_pk_…`, from the **Users** tab\nin your 1mn dashboard) plus your signed-in user:\n\n```tsx\nimport { OnemnProvider } from \"@1mn/react\";\n\nexport default function App({ children, user }) {\n  return (\n    <OnemnProvider apiKey=\"1mn_pk_xxx\" user={user}>\n      {children}\n    </OnemnProvider>\n  );\n}\n```\n\nThat's it — pageviews, web vitals, and errors are captured automatically, and `user` is identified\n(with `email`/`name`) whenever it's set. When `user` becomes `null` (logout) the SDK resets.\n\n### Custom events\n\n```tsx\nimport { useOnemn } from \"@1mn/react\";\n\nfunction CheckoutButton() {\n  const onemn = useOnemn();\n  return (\n    <button onClick={() => onemn.capture(\"checkout_started\", { plan: \"pro\" })}>\n      Upgrade\n    </button>\n  );\n}\n```\n\n### Customer feedback\n\nCollect in-app feedback with one component. Drop in the widget for a floating launcher + modal:\n\n```tsx\nimport { FeedbackWidget } from \"@1mn/react\";\n\n<FeedbackWidget />;\n```\n\nOr drive the modal from your own button (no launcher):\n\n```tsx\nimport { useState } from \"react\";\nimport { FeedbackWidget } from \"@1mn/react\";\n\nfunction Sidebar() {\n  const [open, setOpen] = useState(false);\n  return (\n    <>\n      <button onClick={() => setOpen(true)}>Feedback</button>\n      <FeedbackWidget launcher={false} open={open} onOpenChange={setOpen} />\n    </>\n  );\n}\n```\n\nPrefer your own UI? Use the headless hook (or `useOnemn().feedback`):\n\n```tsx\nimport { useFeedback } from \"@1mn/react\";\n\nconst { send } = useFeedback();\nsend(\"Love the new dashboard!\");\n```\n\nEach submission emits a `$feedback` event. In your 1mn dashboard these are filed as **feedback\ntickets** in your backlog for triage — they never trigger an autonomous agent run on their own.\n\n### Next.js (App Router)\n\n`OnemnProvider` is a client component — render it in a `\"use client\"` boundary (e.g. a\n`providers.tsx` wrapped around `children` in your root layout). It's SSR-safe: nothing runs until\nthe browser hydrates. `<FeedbackWidget>` is likewise a client component.\n\n### React Router 7 / Remix / TanStack Start (SSR)\n\n`OnemnProvider` is SSR-safe — render it from a **normal module** in your root route (e.g.\n`app/root.tsx`), wrapped around your `<Outlet />`:\n\n```tsx\n// app/root.tsx — a normal module, NOT a *.client.tsx file\nimport { OnemnProvider } from \"@1mn/react\";\nimport { useSession } from \"./lib/auth-client\";\n\nexport default function App() {\n  const { data: session } = useSession();\n  return (\n    <OnemnProvider apiKey=\"1mn_pk_xxx\" user={session?.user}>\n      <Outlet />\n    </OnemnProvider>\n  );\n}\n```\n\n> ⚠️ **Do not put `OnemnProvider` (or a wrapper around it) in a `*.client.tsx` file and render that\n> in the SSR tree.** React Router 7, Remix and Vite empty `*.client.*` modules in the server build,\n> so the import is `undefined` during SSR and React throws on `<undefined>` — **HTTP 500 on every\n> route.** `OnemnProvider` doesn't need to be client-only; it's already SSR-safe.\n\nIf your `user`/session hook is client-only (it lives in a `*.client.*` module, or is `undefined` on\nthe server), keep `OnemnProvider` SSR-safe and move just the identify call into a small child\nrendered behind a mounted guard (`useOnemn().identify(...)` inside a `useEffect`) — don't make the\nwhole provider client-only. After wiring it in, confirm the site still returns `200`, not `500`.\n\n## API\n\n### `<OnemnProvider apiKey host? user? >`\n\n| Prop     | Type                                              | Notes                                              |\n| -------- | ------------------------------------------------- | -------------------------------------------------- |\n| `apiKey` | `string`                                          | Your public key (`1mn_pk_…`). Required.            |\n| `host`   | `string`                                          | Ingest origin. Defaults to the 1mn collector.      |\n| `user`   | `{ id, email?, name? } \\| null`                   | Signed-in user. Identified when it has an email.   |\n\n### `useOnemn()`\n\nReturns `{ capture, identify, reset, set, feedback, optOut, optIn }`. Stable across renders;\nSSR-safe (no-ops on the server and before init).\n\n- `capture(event, properties?)` — a custom event.\n- `identify(id, set?, setOnce?)` — usually unnecessary if you pass `user` to the provider.\n- `set(properties)` — update person properties without re-identifying.\n- `feedback(message, properties?)` — send an in-app feedback/support message.\n- `reset()` — clear identity (logout); the provider does this for you when `user` clears.\n- `optOut()` / `optIn()` — stop / resume sending.\n\n### `<FeedbackWidget />`\n\nA drop-in feedback launcher + modal. All props optional:\n\n| Prop                | Type                                  | Notes                                                       |\n| ------------------- | ------------------------------------- | ----------------------------------------------------------- |\n| `launcher`          | `boolean`                             | Show the floating launcher button. Default `true`.          |\n| `open`              | `boolean`                             | Controlled open state. Omit for uncontrolled.               |\n| `onOpenChange`      | `(open: boolean) => void`             | Open/close callback.                                        |\n| `label`             | `string`                              | Launcher text. Default `\"Feedback\"`.                        |\n| `title`             | `string`                              | Modal heading. Default `\"Send feedback\"`.                   |\n| `description`       | `string`                              | Sub-text under the heading.                                 |\n| `placeholder`       | `string`                              | Textarea placeholder.                                       |\n| `position`          | `\"bottom-right\" \\| \"bottom-left\"`     | Launcher corner. Default `\"bottom-right\"`.                  |\n| `accentColor`       | `string`                              | Primary button / launcher color.                            |\n| `properties`        | `Record<string, unknown>`             | Extra props merged into the `$feedback` event.              |\n| `onSubmit`          | `(message: string) => void`           | Called after a successful send.                             |\n\n### `useFeedback()`\n\nReturns `{ send(message, properties?) }` for building your own feedback UI.\n\n### `getOnemn()`\n\nThe live client (or `null` on the server / before init), for non-component code.\n\n## Privacy\n\nBy default the SDK captures no DOM content (no autocapture) and no IP-derived geo, and ships\n`optOut()`. **Session replay** is the one exception and is **off unless you enable it** for your key\nin the 1mn dashboard: when on, it records the DOM/interactions of a sampled fraction of sessions via\nrrweb, with text inputs masked by default (add `onemn-block` / `onemn-mask` classes to hide regions).\n`optOut()` also stops recording. You are the data controller for your end-users' data — if you enable\nreplay, tell your visitors (EU/UK/CA consent).\n\n## License\n\nMIT — see [LICENSE](./LICENSE).\n","readmeFilename":"README.md"}