{"_id":"@alldle/sdk","_rev":"2-1a9f1c5d3144dae6144ac6c4ee3a8fb7","name":"@alldle/sdk","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@alldle/sdk","version":"0.1.0","keywords":["alldle","sdk","wordle","dle","game"],"license":"MIT","_id":"@alldle/sdk@0.1.0","maintainers":[{"name":"customentity","email":"flavio.moreno941@gmail.com"}],"homepage":"https://www.alldle.net/sdk","bugs":{"url":"https://github.com/CustomEntity/AllDle/issues"},"dist":{"shasum":"238471becd54c6a933b2f6adc0743c1117ab1500","tarball":"https://registry.npmjs.org/@alldle/sdk/-/sdk-0.1.0.tgz","fileCount":10,"integrity":"sha512-rFok8w/GD+rmxiP+qtNCauh4GaJCbaeg73qnIxJmnQk3fNC1u0yVYLabydTqBSLUhWn2SJqGoh+i1K/AEr9w/A==","signatures":[{"sig":"MEQCIF7am7sFsoCy9Ugo/apISzQtZpnT6KykPTUcv1oM2xNRAiAgH7C0kHZ7/Zw1g2L+VY4dNbwu8w1jiq4dQsuXe+QTrw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76716},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"},"./sdk.js":"./dist/index.global.js"},"gitHead":"cb807cfacc9761d02231d38c00988704991f3f0b","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"customentity","email":"flavio.moreno941@gmail.com"},"repository":{"url":"git+https://github.com/CustomEntity/AllDle.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.6.1","description":"Official AllDle SDK for game creators — link your game to AllDle, track mode completions and user stats.","directories":{},"_nodeVersion":"24.10.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","typescript":"^5.9.3","@types/node":"^20.19.31","@repo/typescript-config":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1787690917427_0.3188163616542734","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@alldle/sdk","version":"0.1.1","description":"Official AllDle SDK for game creators — link your game to AllDle, track mode completions and user stats.","license":"MIT","homepage":"https://www.alldle.net/sdk","repository":{"type":"git","url":"git+https://github.com/CustomEntity/AllDle.git","directory":"packages/sdk"},"bugs":{"url":"https://github.com/CustomEntity/AllDle/issues"},"keywords":["alldle","sdk","wordle","dle","game"],"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"},"./sdk.js":"./dist/index.global.js"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"devDependencies":{"@repo/typescript-config":"workspace:*","@types/node":"^20.19.31","tsup":"^8.4.0","typescript":"^5.9.3"},"gitHead":"ffb1ae063e25b3cb44265cc424e937a0f66bfe7d","_id":"@alldle/sdk@0.1.1","_nodeVersion":"24.10.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-fa/6tRudVPSywxVhAzXm5ukbJ4XeFNxnPslJGJTdWRYkf4PgOwuwqghxKOWa7ejLlhbyCZLpS5Qi5xs9C1H8xA==","shasum":"a7e6e94f4a75d3d7287ed19815ae64dc621fb58e","tarball":"https://registry.npmjs.org/@alldle/sdk/-/sdk-0.1.1.tgz","fileCount":10,"unpackedSize":76785,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG/2+HkkN7DzRHJHNHX2ANCUEnWgi+m1OJJzK50fFZTQAiEA+kZ1LfC+NsdkLC4g+qnNUhE3JAu4OvEHUEFKEtzBh30="}]},"_npmUser":{"name":"customentity","email":"flavio.moreno941@gmail.com"},"directories":{},"maintainers":[{"name":"customentity","email":"flavio.moreno941@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.1_1787691436435_0.36069955497832407"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-25T20:48:37.309Z","modified":"2026-08-25T20:57:16.856Z","0.1.0":"2026-08-25T20:48:37.575Z","0.1.1":"2026-08-25T20:57:16.587Z"},"bugs":{"url":"https://github.com/CustomEntity/AllDle/issues"},"license":"MIT","homepage":"https://www.alldle.net/sdk","keywords":["alldle","sdk","wordle","dle","game"],"repository":{"type":"git","url":"git+https://github.com/CustomEntity/AllDle.git","directory":"packages/sdk"},"description":"Official AllDle SDK for game creators — link your game to AllDle, track mode completions and user stats.","maintainers":[{"name":"customentity","email":"flavio.moreno941@gmail.com"}],"readme":"# @alldle/sdk\n\nOfficial AllDle SDK for game creators. Link your game to AllDle, track mode completions and user stats — all client-side, no backend required.\n\n## Installation\n\n```bash\nnpm install @alldle/sdk\n# or via CDN (UMD build — coming soon)\n<script src=\"https://www.alldle.net/sdk.js\"></script>\n```\n\nOr from npm, if you have a bundler:\n\n```bash\nnpm i @alldle/sdk\n```\n\n## Quick start\n\n```javascript\nimport { AllDle } from '@alldle/sdk';\n\nconst alldle = new AllDle({ gameSlug: 'brawldle' });\n\n// 1. Connect — listens for the session postMessage from AllDle\n//    Returns the player's session, or null if they're not logged in.\nconst session = await alldle.connect();\n\nif (session) {\n  console.log(`Welcome ${session.displayName}!`);\n}\n\n// 2. Track a mode completion\n//    Call this after the player finishes a mode of your game.\nawait www.alldle.netpleteMode('classic', {\n  won: true,\n  attempts: 4,\n});\n\n// 3. Check if all modes are done today\nconst status = await alldle.getDailyStatus();\nif (status?.allModesCompleted) {\n  showCompletedBanner(); // \"Come back tomorrow!\"\n}\n```\n\n## How it works\n\nAllDle displays your game in an iframe. When the page loads, AllDle sends your game an **ephemeral session token** via `postMessage`. The SDK:\n\n1. Listens for the `ALLDLE_SESSION` message from AllDle.\n2. Uses the token to call AllDle's API on the player's behalf.\n3. Tracks mode completions in AllDle's database.\n\nYour game **never needs a backend** to integrate with AllDle.\n\n## API Reference\n\n### `new AllDle(options)`\n\n| Option | Type | Default | Description |\n|---|---|---|---|\n| `gameSlug` | `string` | — | **Required.** Your game's slug on AllDle. |\n| `apiBaseUrl` | `string` | `https://www.alldle.net/api` | Override for local dev. |\n| `connectTimeout` | `number` | `3000` | ms to wait for the session postMessage. |\n| `debug` | `boolean` | `false` | Enable console logging. |\n\n### `.connect()` → `Promise<AllDleSession \\| null>`\n\nWaits for AllDle to send the session token. Returns `null` if:\n- The game isn't running inside an AllDle iframe.\n- The player isn't logged in on AllDle.\n- The timeout is reached.\n\n### `.completeMode(mode, data)` → `Promise<void>`\n\nTracks that the player has completed a mode.\n\n| Param | Type | Description |\n|---|---|---|\n| `mode` | `string` | Mode name (e.g. `'classic'`, `'pixel'`, `'sound'`). Must match modes declared in your AllDle dashboard. |\n| `data.won` | `boolean` | Whether the player guessed correctly. |\n| `data.attempts` | `number?` | Number of attempts used. |\n| `data.metadata` | `object?` | Optional extra data (for future use). |\n\nErrors are swallowed silently — the SDK will never crash your game.\n\n### `.getDailyStatus()` → `Promise<DailyStatus \\| null>`\n\nReturns today's completion status for the current player.\n\n```typescript\ninterface DailyStatus {\n  allModesCompleted: boolean;\n  modes: Record<string, {\n    completed: boolean;\n    won?: boolean;\n    attempts?: number;\n    completedAt?: string; // ISO date string\n  }>;\n}\n```\n\n### `.getSession()` → `AllDleSession \\| null`\n\nReturns the current session synchronously (after `connect()`).\n\n### `.isAuthenticated()` → `boolean`\n\nReturns `true` if the player is logged in on AllDle.\n\n## Local development\n\nTo test without AllDle's iframe, you can mock the session:\n\n```javascript\nconst alldle = new AllDle({ \n  gameSlug: 'brawldle',\n  apiBaseUrl: 'http://localhost:3001/api',\n  debug: true, // See SDK logs in the console\n});\n\n// The connect() will return null in local dev (no iframe context).\n// Check alldle.isAuthenticated() before calling SDK methods.\nconst session = await alldle.connect();\n```\n\n## License\n\nMIT © AllDle\n","readmeFilename":"README.md"}