{"_id":"@byebot/svelte","_rev":"3-8bc9fabab6720981c41e857fa3f78253","name":"@byebot/svelte","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@byebot/svelte","version":"1.0.0","keywords":["captcha","byebot","svelte","sveltekit","bot-detection"],"author":{"name":"Byebot"},"license":"MIT","_id":"@byebot/svelte@1.0.0","maintainers":[{"name":"shigshag","email":"schlusseldieb@gmail.com"}],"homepage":"https://byebot.de","bugs":{"url":"https://github.com/ByeBot-Integrations/Svelte/issues"},"dist":{"shasum":"bd5030a4e11558bf9b4ff3956f6b5d3881f64850","tarball":"https://registry.npmjs.org/@byebot/svelte/-/svelte-1.0.0.tgz","fileCount":10,"integrity":"sha512-DykAcmtnx/EP8OFSVOMAQbUBUSlbtqZgF6f8tfB7EMHpmJKD97L0p1gFJI4Ej5dW3mjfUW7bYROH0KOkgUrTBA==","signatures":[{"sig":"MEYCIQDH6k3BWxZB4b4ZazcGqMGmgkdE73ZjRmRdXElQq0pHswIhAMjG8d1NAnqDjLw1IOmDZOtZjImJRifXpkaoR7F8D7i5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8863},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","svelte":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","svelte":"./dist/index.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"gitHead":"d15ad675bb5ccb3af248f1b481105733da45d29f","scripts":{"dev":"vite dev","build":"vite build && npm run package","check":"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json","package":"svelte-kit sync && svelte-package -o dist","prepublishOnly":"npm run package"},"_npmUser":{"name":"shigshag","email":"schlusseldieb@gmail.com"},"repository":{"url":"git+https://github.com/ByeBot-Integrations/Svelte.git","type":"git"},"_npmVersion":"11.12.0","description":"Svelte/SvelteKit integration for Byebot","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.0","svelte":"^5.0.0","typescript":"^5.3.0","svelte-check":"^4.0.0","@sveltejs/kit":"^2.0.0","@sveltejs/package":"^2.0.0","@sveltejs/adapter-auto":"^3.0.0","@sveltejs/vite-plugin-svelte":"^3.0.0"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/svelte_1.0.0_1774555053264_0.7669471072909855","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@byebot/svelte","version":"1.1.0","keywords":["captcha","byebot","svelte","sveltekit","bot-detection"],"author":{"name":"Byebot"},"license":"MIT","_id":"@byebot/svelte@1.1.0","maintainers":[{"name":"shigshag","email":"schlusseldieb@gmail.com"}],"homepage":"https://byebot.de","bugs":{"url":"https://github.com/ByeBot-Integrations/Svelte/issues"},"dist":{"shasum":"ee30a0fef3720678ebfdc78b8bff81b4512ae36e","tarball":"https://registry.npmjs.org/@byebot/svelte/-/svelte-1.1.0.tgz","fileCount":10,"integrity":"sha512-/uhOH0dG05BQuyn51BfAvGuSz7qcIqEzNoI7JoQCjkV7hF5pmWjFrv990OuEjQHDv1efc5jZjlgIs0kcdll6Dg==","signatures":[{"sig":"MEQCIC0fOaC5oXoznLklOMOtxPzqwJB3ivFaxk/cXCRu0vs7AiAO7JOjXNMs7ST4NH5CUVcKWA045ZGJ7wcB1yWWmbc8LA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9808},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","svelte":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","svelte":"./dist/index.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"gitHead":"d15ad675bb5ccb3af248f1b481105733da45d29f","scripts":{"dev":"vite dev","build":"vite build && npm run package","check":"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json","package":"svelte-kit sync && svelte-package -o dist","prepublishOnly":"npm run package"},"_npmUser":{"name":"shigshag","email":"schlusseldieb@gmail.com"},"repository":{"url":"git+https://github.com/ByeBot-Integrations/Svelte.git","type":"git"},"_npmVersion":"11.13.0","description":"Svelte/SvelteKit integration for Byebot","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.0.0","svelte":"^5.0.0","typescript":"^5.3.0","svelte-check":"^4.0.0","@sveltejs/kit":"^2.0.0","@sveltejs/package":"^2.0.0","@sveltejs/adapter-auto":"^3.0.0","@sveltejs/vite-plugin-svelte":"^3.0.0"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/svelte_1.1.0_1777068014432_0.45128332794034876","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@byebot/svelte","version":"1.1.1","description":"Svelte/SvelteKit integration for Byebot","author":{"name":"Byebot"},"homepage":"https://byebot.de","type":"module","svelte":"./dist/index.js","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","svelte":"./dist/index.js","import":"./dist/index.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"scripts":{"dev":"vite dev","build":"vite build && npm run package","package":"svelte-kit sync && svelte-package -o dist","prepublishOnly":"npm run package","check":"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"devDependencies":{"@sveltejs/adapter-auto":"^3.0.0","@sveltejs/kit":"^2.0.0","@sveltejs/package":"^2.0.0","@sveltejs/vite-plugin-svelte":"^3.0.0","svelte":"^5.0.0","svelte-check":"^4.0.0","typescript":"^5.3.0","vite":"^5.0.0"},"keywords":["captcha","byebot","svelte","sveltekit","bot-detection"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ByeBot-Integrations/Svelte.git"},"gitHead":"d15ad675bb5ccb3af248f1b481105733da45d29f","_id":"@byebot/svelte@1.1.1","bugs":{"url":"https://github.com/ByeBot-Integrations/Svelte/issues"},"_nodeVersion":"22.22.2","_npmVersion":"11.13.0","dist":{"integrity":"sha512-xHbjL1xQmbl0vMuO7sLNJ8FtvPuLT+7ZC+9IMD8r3hG84BGoJZ3vKjy6V1s3nozPRfu28AvN/m4qVEiCQ2bl9w==","shasum":"e3aa5facf3d2f33df0049f6f8dc546846db3be60","tarball":"https://registry.npmjs.org/@byebot/svelte/-/svelte-1.1.1.tgz","fileCount":10,"unpackedSize":11310,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDxx2/KBb6ybHG0SaUdn9NgDcLs/kP9Ro3ZV5VDcbI3LAiBVBc1iLk5Xcz55H8dpP3mReYQi8rinOZrRQoMRmaVXnw=="}]},"_npmUser":{"name":"shigshag","email":"schlusseldieb@gmail.com"},"directories":{},"maintainers":[{"name":"shigshag","email":"schlusseldieb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/svelte_1.1.1_1777070321468_0.9974334698281302"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-26T19:57:33.161Z","modified":"2026-04-24T22:38:41.726Z","1.0.0":"2026-03-26T19:57:33.419Z","1.1.0":"2026-04-24T22:00:14.572Z","1.1.1":"2026-04-24T22:38:41.597Z"},"bugs":{"url":"https://github.com/ByeBot-Integrations/Svelte/issues"},"author":{"name":"Byebot"},"license":"MIT","homepage":"https://byebot.de","keywords":["captcha","byebot","svelte","sveltekit","bot-detection"],"repository":{"type":"git","url":"git+https://github.com/ByeBot-Integrations/Svelte.git"},"description":"Svelte/SvelteKit integration for Byebot","maintainers":[{"name":"shigshag","email":"schlusseldieb@gmail.com"}],"readme":"# @byebot/svelte\n\nSvelte/SvelteKit integration for Byebot.\n\nGitHub: https://github.com/ByeBot-Integrations/Svelte\n\n## Installation\n\n```bash\nnpm install @byebot/svelte\n```\n\n## Usage\n\n### Basic Form (Recommended)\n\nThe captcha token is automatically added as a hidden `byebot-token` field when the user completes verification.\n\n```svelte\n<script>\n  import { Byebot } from '@byebot/svelte';\n</script>\n\n<form action=\"/api/login\" method=\"POST\">\n  <input name=\"email\" type=\"email\" />\n  <input name=\"password\" type=\"password\" />\n  <Byebot siteKey=\"your-site-key\" />\n  <button type=\"submit\">Login</button>\n</form>\n```\n\n### Svelte 5 — Callback Prop\n\nUse `onVerify` for Svelte 5 runes-mode parents:\n\n```svelte\n<script lang=\"ts\">\n  import { Byebot } from '@byebot/svelte';\n\n  let isVerified = $state(false);\n  let token = $state<string | null>(null);\n\n  function handleVerify(t: string) {\n    token = t;\n    isVerified = true;\n  }\n</script>\n\n<Byebot siteKey=\"your-site-key\" onVerify={handleVerify} />\n<button disabled={!isVerified}>Submit</button>\n```\n\n### Svelte 4 / Legacy Mode — Event Directive\n\n`on:verify` still works for Svelte 4 parents and Svelte 5 legacy-mode parents.\nFor runes-mode parents, use `onVerify` above.\n\n```svelte\n<script>\n  import { Byebot } from '@byebot/svelte';\n\n  let isVerified = false;\n\n  function handleVerify(event) {\n    console.log('Token:', event.detail);\n    isVerified = true;\n  }\n</script>\n\n<Byebot siteKey=\"your-site-key\" on:verify={handleVerify} />\n<button disabled={!isVerified}>Submit</button>\n```\n\n## Server-Side Validation\n\nValidate the `byebot-token` from the form submission:\n\n```typescript\n// src/routes/api/login/+server.ts\nimport { validateByebotToken } from \"@byebot/svelte/server\";\nimport { json, error } from \"@sveltejs/kit\";\n\nexport const POST = async ({ request }) => {\n  const formData = await request.formData();\n  const token = formData.get(\"byebot-token\") as string;\n\n  const result = await validateByebotToken({\n    apiKey: process.env.BYEBOT_API_KEY!,\n    token,\n  });\n\n  if (!result.valid) {\n    throw error(403, \"Captcha failed\");\n  }\n\n  // Captcha valid - proceed with login\n  const email = formData.get(\"email\");\n  const password = formData.get(\"password\");\n  // ...\n\n  return json({ success: true });\n};\n```\n\n## API\n\n### `<Byebot />`\n\n| Prop       | Type                      | Required | Description                                           |\n| ---------- | ------------------------- | -------- | ----------------------------------------------------- |\n| `siteKey`  | `string`                  | Yes      | Your site key from the dashboard                      |\n| `onVerify` | `(token: string) => void` | No       | Called on verification success. Use for runes parents |\n\n| Event    | Payload  | Description                                                                     |\n| -------- | -------- | ------------------------------------------------------------------------------- |\n| `verify` | `string` | Svelte 4 / legacy mode. Prefer `onVerify` prop for Svelte 5 runes-mode parents |\n\n### `validateByebotToken(options)`\n\n| Option   | Type     | Required |\n| -------- | -------- | -------- |\n| `apiKey` | `string` | Yes      |\n| `token`  | `string` | Yes      |\n\nReturns: `Promise<{ valid: boolean, message?: string, rawResponse?: unknown }>`\n","readmeFilename":"README.md"}