{"_id":"@animal-id/partner-react","_rev":"2-96e77b405d4d28d82570b3bd52810521","name":"@animal-id/partner-react","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@animal-id/partner-react","version":"0.1.0","license":"MIT","_id":"@animal-id/partner-react@0.1.0","maintainers":[{"name":"animal-id","email":"vm@animal-id.net"}],"dist":{"shasum":"94543333d1015e0a87e34a0e90fd9d8d2b563dd2","tarball":"https://registry.npmjs.org/@animal-id/partner-react/-/partner-react-0.1.0.tgz","fileCount":8,"integrity":"sha512-OjAGJ+X87raEiHkq6peM4aDUEYJ8xv5vhV1MBzVnLgkS8xkO0HDWO5cQ5VMY+K2AlDB85w7h9K6io2C14PE9gQ==","signatures":[{"sig":"MEUCIDUacIaUIKZArcdDF94WjCSrJmvuKGmPsgI+fn6qYjRIAiEA8VVdA17SVkWynhBuER7DnVh90JycPNOxzNAT33luEMI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53018},"main":"./dist/index.cjs","type":"module","_from":"file:animal-id-partner-react-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"animal-id","email":"vm@animal-id.net"},"_resolved":"/private/var/folders/bd/q0ht6d8n3nn7p95597z0t7p40000gn/T/96a16c16442474adb7cfb7045c5d4be8/animal-id-partner-react-0.1.0.tgz","_integrity":"sha512-OjAGJ+X87raEiHkq6peM4aDUEYJ8xv5vhV1MBzVnLgkS8xkO0HDWO5cQ5VMY+K2AlDB85w7h9K6io2C14PE9gQ==","_npmVersion":"10.9.2","description":"React hooks for the Animal-ID Partner API (provider + query/mutation hooks).","directories":{},"sideEffects":false,"_nodeVersion":"22.16.0","dependencies":{"@animal-id/partner-core":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","react":"^18.3.1","react-dom":"^18.3.1","typescript":"^5.6.0","@types/react":"^18.3.0","@types/react-dom":"^18.3.1","@testing-library/react":"^16.1.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/partner-react_0.1.0_1781806632696_0.41651604386230945","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@animal-id/partner-react","version":"0.2.0","description":"React hooks for the Animal-ID Partner API (provider + query/mutation hooks).","license":"MIT","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,"engines":{"node":">=18"},"dependencies":{"@animal-id/partner-core":"0.2.0"},"peerDependencies":{"react":">=18"},"devDependencies":{"@testing-library/react":"^16.1.0","@types/react":"^18.3.0","@types/react-dom":"^18.3.1","react":"^18.3.1","react-dom":"^18.3.1","tsup":"^8.3.0","typescript":"^5.6.0"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit -p tsconfig.json","clean":"rm -rf dist"},"_id":"@animal-id/partner-react@0.2.0","_integrity":"sha512-8VzOu/Pm1bn1aSVAN7t7G/ruLitH/QJvNh3bQs3lphr6rFfUC871oJbPunjBtG744jwHFoYsWbQD9rWLbQ+jXA==","_resolved":"/private/var/folders/bd/q0ht6d8n3nn7p95597z0t7p40000gn/T/96374706259c802a6445e83056f54464/animal-id-partner-react-0.2.0.tgz","_from":"file:animal-id-partner-react-0.2.0.tgz","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-8VzOu/Pm1bn1aSVAN7t7G/ruLitH/QJvNh3bQs3lphr6rFfUC871oJbPunjBtG744jwHFoYsWbQD9rWLbQ+jXA==","shasum":"1efabed6ef12b836c609a08eea26e02e3c5c7b2d","tarball":"https://registry.npmjs.org/@animal-id/partner-react/-/partner-react-0.2.0.tgz","fileCount":8,"unpackedSize":56992,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBnmBB1gFMlPa6/0yVPUmQbswtG1sJ3hH2cj3UDfD+jyAiEAu/axHEuSB74bQy2cv7KVeslTb1t3s+lkV5OgYSHU72E="}]},"_npmUser":{"name":"animal-id","email":"vm@animal-id.net"},"directories":{},"maintainers":[{"name":"animal-id","email":"vm@animal-id.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/partner-react_0.2.0_1782836441012_0.8852206399990126"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-18T18:17:12.498Z","modified":"2026-06-30T16:20:41.250Z","0.1.0":"2026-06-18T18:17:12.849Z","0.2.0":"2026-06-30T16:20:41.150Z"},"license":"MIT","description":"React hooks for the Animal-ID Partner API (provider + query/mutation hooks).","maintainers":[{"name":"animal-id","email":"vm@animal-id.net"}],"readme":"# @animal-id/partner-react\n\nReact 18+ bindings for the Animal-ID Partner API. Works in plain React and Next.js\n(App or Pages Router — provider in a Client Component).\n\n```bash\npnpm add @animal-id/partner-react react\n```\n\n## Setup\n\n```tsx\nimport { AnimalIdProvider } from '@animal-id/partner-react';\n\n// Browser-safe config: point baseUrl at your backend proxy, or pass a custom `signer`.\n// Never embed the private key in the browser.\nexport function Providers({ children }: { children: React.ReactNode }) {\n  return <AnimalIdProvider config={{ baseUrl: '/api/animal-id' }}>{children}</AnimalIdProvider>;\n}\n```\n\nYou can also pass a ready `client={...}` instead of `config`.\n\n## Hooks\n\n**Queries** (auto-fetch, return `{ data, error, isLoading, isSuccess, isError, refetch }`):\n\n```tsx\nconst dicts = useDictionaries({ lang: 'uk' });\nconst animal = useAnimal(id);                       // skips while id is undefined\nconst pets = useAnimalsByOwner('jane@example.com');\nconst byChip = useAnimalsByIdentifier('microchip', value);\nconst history = useProcedures(animalId, { type: 10 });\n```\n\n**Mutations** (return `{ mutate, data, error, isLoading, isSuccess, isError, reset }`):\n\n```tsx\nconst { mutate: createOwner, isLoading } = useCreateOwner();\nawait createOwner({ email: 'jane@example.com', consent: { account_creation: true } });\n\nconst { mutate: createAnimal } = useCreateAnimal();\nconst { mutate: updateAnimal } = useUpdateAnimal();   // mutate({ id, input })\nconst { mutate: addProcedures } = useCreateProcedures(); // mutate({ animalId, body })\nconst { mutate: uploadPhoto } = useUploadPhoto();     // mutate({ animalId, input: { file } })\nconst { mutate: deletePhoto } = useDeletePhoto();     // mutate({ animalId, photoId })\nconst { mutate: searchOwner } = useSearchOwner();\n```\n\n`useAnimalIdClient()` returns the underlying `AnimalIdClient` for ad-hoc calls.\n\nThe generic `useQuery`/`useMutation` are exported too. They are intentionally\ncache-free — drop in TanStack Query if you want caching/dedup; the client methods\ncompose with it directly.\n\n> This package re-exports everything from `@animal-id/partner-core`, so you can\n> import types and the client from a single place.\n","readmeFilename":"README.md"}