{"_id":"@anon-dot-com/frontend","_rev":"5-b86aa254b97afacf27e6807993097bd1","name":"@anon-dot-com/frontend","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"@anon-dot-com/frontend","version":"0.0.1","_id":"@anon-dot-com/frontend@0.0.1","maintainers":[{"name":"anon-admin","email":"admin-github@team.anon.com"},{"name":"kai-anon","email":"kai@team.anon.com"},{"name":"jesse-anon","email":"jesse@team.anon.com"},{"name":"the_danbot","email":"dan@team.anon.com"}],"dist":{"shasum":"a4fb63071b476d2b0456ffebcdf29d08e38e95c9","tarball":"https://registry.npmjs.org/@anon-dot-com/frontend/-/frontend-0.0.1.tgz","fileCount":9,"integrity":"sha512-yvsa1VkAF49qedVvPoHUrkiXMOaPp3VLh88tEPhlwoTjQFIt/3SttKkF/vPtKWbR9UJGppPXANpWr4Jbck4/Bw==","signatures":[{"sig":"MEUCIDUcdGlnj7eEJsENEZJLQh2jssZU9Z2pqV7BQ4lOVX9HAiEArwES/MOZWpxM7uAN+xNpbsGmGLlU1kYCTMU3lFurAJU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33973},"main":"dist/index.umd.js","type":"module","_from":"file:anon-dot-com-frontend-0.0.1.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.umd.js"}},"scripts":{"dev":"vite","fix":"eslint \"src/**/*.{ts,tsx}\" --fix && prettier --write \"src/**/*.{ts,tsx}\"","lint":"eslint src --ext .ts","build":"tsc && vite build","format":"prettier --write \"src/**/*.{ts,tsx}\"","preview":"vite preview"},"_npmUser":{"name":"jesse-anon","email":"jesse@team.anon.com"},"_resolved":"/private/var/folders/z9/29zxpnd54fd_fqx56bprrmwc0000gn/T/d799864134557d256e858d2a7c185220/anon-dot-com-frontend-0.0.1.tgz","_integrity":"sha512-yvsa1VkAF49qedVvPoHUrkiXMOaPp3VLh88tEPhlwoTjQFIt/3SttKkF/vPtKWbR9UJGppPXANpWr4Jbck4/Bw==","_npmVersion":"11.4.2","description":"Anon.com frontend library for embedding the migration modal in your application","directories":{},"_nodeVersion":"24.4.1","dependencies":{"vite-plugin-dts":"^4.5.4"},"_hasShrinkwrap":false,"devDependencies":{"vite":"7.0.6","vitest":"3.2.4","typescript":"5.7.3"},"_npmOperationalInternal":{"tmp":"tmp/frontend_0.0.1_1754718346310_0.03373632322336828","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@anon-dot-com/frontend","version":"0.0.2","_id":"@anon-dot-com/frontend@0.0.2","maintainers":[{"name":"anon-admin","email":"admin-github@team.anon.com"},{"name":"kai-anon","email":"kai@team.anon.com"},{"name":"jesse-anon","email":"jesse@team.anon.com"},{"name":"the_danbot","email":"dan@team.anon.com"}],"dist":{"shasum":"81d1b1476ed7a2b099796584fb9cc7ea37a9425a","tarball":"https://registry.npmjs.org/@anon-dot-com/frontend/-/frontend-0.0.2.tgz","fileCount":9,"integrity":"sha512-SGudmXuFWnXoZNsTNhdoAC3116iOnodOygbj/5rUzSsiWtmVKin4MxK/oEPnz9OpvFY9ABpfQUP6CTCyPODD1Q==","signatures":[{"sig":"MEUCIQC+zuqF3++ZAuS7ue5CwqkmAAGD3GOdUK45ZVnq/ot+CQIgN9aTkUyot89Iwha1fJlV/sEgcjDAy0dYP3A7W6Smbuk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34094},"main":"dist/index.umd.cjs","type":"module","_from":"file:anon-dot-com-frontend-0.0.2.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.umd.cjs"}},"scripts":{"dev":"vite","fix":"eslint \"src/**/*.{ts,tsx}\" --fix && prettier --write \"src/**/*.{ts,tsx}\"","lint":"eslint src --ext .ts","build":"tsc && vite build","format":"prettier --write \"src/**/*.{ts,tsx}\"","preview":"vite preview"},"_npmUser":{"name":"jesse-anon","email":"jesse@team.anon.com"},"_resolved":"/private/var/folders/z9/29zxpnd54fd_fqx56bprrmwc0000gn/T/491305855b909494cdf12ba4c59221bc/anon-dot-com-frontend-0.0.2.tgz","_integrity":"sha512-SGudmXuFWnXoZNsTNhdoAC3116iOnodOygbj/5rUzSsiWtmVKin4MxK/oEPnz9OpvFY9ABpfQUP6CTCyPODD1Q==","_npmVersion":"11.4.2","description":"Anon.com frontend library for embedding the migration modal in your application","directories":{},"_nodeVersion":"24.4.1","dependencies":{"vite-plugin-dts":"^4.5.4"},"_hasShrinkwrap":false,"devDependencies":{"vite":"7.0.6","vitest":"3.2.4","typescript":"5.7.3"},"_npmOperationalInternal":{"tmp":"tmp/frontend_0.0.2_1755017681348_0.8518842363491821","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@anon-dot-com/frontend","version":"0.0.3","license":"Apache-2.0","_id":"@anon-dot-com/frontend@0.0.3","maintainers":[{"name":"anon-admin","email":"admin-github@team.anon.com"},{"name":"kai-anon","email":"kai@team.anon.com"},{"name":"jesse-anon","email":"jesse@team.anon.com"},{"name":"the_danbot","email":"dan@team.anon.com"}],"dist":{"shasum":"645fcb52ec5a3f0d203a57f23e3d4101c483b30b","tarball":"https://registry.npmjs.org/@anon-dot-com/frontend/-/frontend-0.0.3.tgz","fileCount":10,"integrity":"sha512-RoCv5E4NdwVy7zaxx3IbKmHT1wipE+d5wGsRsIvoUrKMO32J0bbN/2lCgygKiSBrQmI9iogleIM6gJZ9Kf++bg==","signatures":[{"sig":"MEQCIDO0/dojtWNv4yYTPOBD1EVr3NwrMGC6VVJE9Q+WyCVwAiBX9mp8CMmyNfYEbLjgc8pz5+YhckojgBWHRiO3LzTwcw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46023},"main":"dist/index.umd.cjs","type":"module","_from":"file:anon-dot-com-frontend-0.0.3.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.umd.cjs"}},"scripts":{"dev":"vite","fix":"eslint \"src/**/*.{ts,tsx}\" --fix && prettier --write \"src/**/*.{ts,tsx}\"","lint":"eslint src --ext .ts","build":"tsc && vite build","format":"prettier --write \"src/**/*.{ts,tsx}\"","preview":"vite preview"},"_npmUser":{"name":"jesse-anon","email":"jesse@team.anon.com"},"_resolved":"/private/var/folders/z9/29zxpnd54fd_fqx56bprrmwc0000gn/T/ffba866b6eb092323f3b25db327afb1b/anon-dot-com-frontend-0.0.3.tgz","_integrity":"sha512-RoCv5E4NdwVy7zaxx3IbKmHT1wipE+d5wGsRsIvoUrKMO32J0bbN/2lCgygKiSBrQmI9iogleIM6gJZ9Kf++bg==","_npmVersion":"11.4.2","description":"Anon.com frontend library for embedding the migration modal in your application","directories":{},"_nodeVersion":"24.4.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"7.0.6","vitest":"3.2.4","typescript":"5.7.3","vite-plugin-dts":"^4.5.4"},"_npmOperationalInternal":{"tmp":"tmp/frontend_0.0.3_1755197765118_0.13894585488295608","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@anon-dot-com/frontend","version":"1.0.0","license":"Apache-2.0","type":"module","description":"Anon.com frontend library for embedding the migration modal in your application","main":"dist/index.umd.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.umd.cjs"}},"publishConfig":{"access":"public"},"devDependencies":{"typescript":"5.7.3","vite":"7.0.6","vitest":"3.2.4","vite-plugin-dts":"^4.5.4"},"dependencies":{},"scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","lint":"eslint src --ext .ts","fix":"eslint \"src/**/*.{ts,tsx}\" --fix && prettier --write \"src/**/*.{ts,tsx}\"","format":"prettier --write \"src/**/*.{ts,tsx}\""},"_id":"@anon-dot-com/frontend@1.0.0","_integrity":"sha512-hk6vJePkBgG6BUcopNsaky+DdYop1U0zl2q3d7CIPDl4i+36Pl4hUbQ93fgnSZMX3vgQC7Hm7axcxb6snjMyrg==","_resolved":"/private/var/folders/z9/29zxpnd54fd_fqx56bprrmwc0000gn/T/1b51a817d1b8a3f665f42937b804e764/anon-dot-com-frontend-1.0.0.tgz","_from":"file:anon-dot-com-frontend-1.0.0.tgz","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-hk6vJePkBgG6BUcopNsaky+DdYop1U0zl2q3d7CIPDl4i+36Pl4hUbQ93fgnSZMX3vgQC7Hm7axcxb6snjMyrg==","shasum":"22e83962565e80a8059645c281249c841e9d8fc5","tarball":"https://registry.npmjs.org/@anon-dot-com/frontend/-/frontend-1.0.0.tgz","fileCount":10,"unpackedSize":55199,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIASESSLTM5+Yj4sANOM+NvuwtrP3r4kq30nu8hi2UvHjAiEAmlY3Hv6wMuQVRpCulJd920b0TYndiKAuQyEO5Ale1GM="}]},"_npmUser":{"name":"jesse-anon","email":"jesse@team.anon.com"},"directories":{},"maintainers":[{"name":"anon-admin","email":"admin-github@team.anon.com"},{"name":"kai-anon","email":"kai@team.anon.com"},{"name":"jesse-anon","email":"jesse@team.anon.com"},{"name":"the_danbot","email":"dan@team.anon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/frontend_1.0.0_1758323675755_0.9616469319260752"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-09T05:45:46.138Z","modified":"2025-09-19T23:14:36.234Z","0.0.1":"2025-08-09T05:45:46.508Z","0.0.2":"2025-08-12T16:54:41.550Z","0.0.3":"2025-08-14T18:56:05.322Z","1.0.0":"2025-09-19T23:14:35.972Z"},"license":"Apache-2.0","description":"Anon.com frontend library for embedding the migration modal in your application","maintainers":[{"name":"anon-admin","email":"admin-github@team.anon.com"},{"name":"kai-anon","email":"kai@team.anon.com"},{"name":"jesse-anon","email":"jesse@team.anon.com"},{"name":"the_danbot","email":"dan@team.anon.com"}],"readme":"# `@anon-dot-com/frontend` Package\n\nA lightweight JavaScript library that provides an embeddable authentication interface for the Anon Enterprise Data Migration platform. This package allows third-party applications to integrate Anon's migration capabilities directly into their user experience through a secure iframe modal.\n\n## Overview\n\nThe `@anon-dot-com/frontend` package creates a responsive iframe modal that displays the Anon migration interface within any web application. It handles user authentication, migration status checking, and provides a seamless integration experience with event-driven communication.\n\n## Installation\n\n```bash\nnpm install @anon-dot-com/frontend\n```\n\n## Usage\n\n### Basic Integration\n\n```javascript\nimport { init, startModal } from '@anon-dot-com/frontend';\n\n// Initialize the Anon Link (finds existing migration)\nawait init({\n  onEvent: (event) => {\n    console.log('Migration event:', event);\n  }\n});\n\n// Start a new migration\nawait startModal({\n  linkToken: 'your-link-token-here', // Get this from your server\n  userId: 'user@example.com',\n  onEvent: (event) => {\n    console.log('Migration event:', event);\n  }\n});\n```\n\n### Advanced Configuration\n\n```javascript\nimport { init } from '@anon-dot-com/frontend';\n\nawait init({\n  linkToken,\n  userId: 'user@example.com',\n  sourceProviders: ['gusto', 'rippling'], // Pre-configure source providers\n  target: '#migration-container', // Custom target element\n  onEvent: (event) => {\n    switch (event.event.type) {\n      case 'migration_modal.completed':\n        console.log('Migration completed:', event.event.data);\n        break;\n      case 'migration_modal.failed':\n        console.log('Migration failed:', event.event.data);\n        break;\n    }\n  }\n});\n```\n\n### Global Script Usage\n\nIf you're not using a module bundler, you can include the library as a global script:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@anon-dot-com/frontend/index.umd.js\"></script>\n<script>\n  window.Anon.init({\n    onEvent: (event) => {\n      console.log('Migration event:', event);\n    }\n  });\n</script>\n```\n\n## API Reference\n\n### `init(options: AnonInitOptions)`\n\nFinds an existing modal link for the user and creates an iframe to display it. The modal will be hidden initially and shown based on migration status.\n\n### `startModal(options: AnonLinkOptions)`\n\nCreates a new modal link for the user and immediately shows the iframe modal.\n\n### `AnonInitOptions`\n\n| Property | Type | Required | Description |\n|----------|------|----------|-------------|\n| `onEvent` | `(event: EventData) => void` | No | Callback for migration events |\n| `target` | `string` | No | CSS selector for target element (defaults to \"body\") |\n\n### `AnonLinkOptions`\n\n| Property | Type | Required | Description |\n|----------|------|----------|-------------|\n| `linkToken` | `string` | Yes | Token generated by the /api/v1/link-token endpoint |\n| `userId` | `string` | Yes | User identifier (UUID or email address) |\n| `sourceProviders` | `string[]` | No | Pre-configured source providers for migration |\n| `onEvent` | `(event: EventData) => void` | No | Callback for migration events |\n| `target` | `string` | No | CSS selector for target element (defaults to \"body\") |\n\n### Event Structure\n\nThe `onEvent` callback receives events with the following structure:\n\n```typescript\ntype AnonEventData = {\n  source: 'anon_modal';\n  event: {\n    type: string;\n    data: any;\n  };\n};\n```\n\n## Backend Requirements\n\nYour backend needs to implement the following endpoint:\n\n| Endpoint | Method | Purpose |\n|----------|--------|---------|\n| `/api/anon/link-token` | POST | Generate a link token for frontend authentication |\n\n## Architecture Flow\n\nThe following diagram illustrates the authentication flow:\n\n```mermaid\nsequenceDiagram\n    participant Client as Client App\n    participant Frontend as @anon-dot-com/frontend\n    participant Backend as Your Backend\n    participant Worker as Anon Worker API\n    participant Dashboard as Anon Dashboard\n\n    Note over Client,Dashboard: Authentication Flow\n    Client->>Backend: POST /api/anon/link-token\n    Backend->>Worker: POST /api/v1/link-token (with API key)\n    Worker-->>Backend: {link_token: \"link-token-xxx\"}\n    Backend-->>Client: {link_token: \"link-token-xxx\"}\n    \n    Note over Client,Dashboard: Starting Migration\n    Client->>Frontend: startModal({userId, linkToken})\n    Frontend->>Worker: POST /api/v1/access-token {link_token}\n    Worker-->>Frontend: {access_token: \"access-token-xxx\"} + Set-Cookie\n    Frontend->>Frontend: Store access token in localStorage\n    Frontend->>Worker: POST /api/v1/migration-modal (with access token)\n    Worker-->>Frontend: {url: \"https://dashboard.anon.com/modal/abc123\"}\n    Frontend->>Frontend: createIframe(url, visible: true)\n    Frontend-->>Client: Migration modal displayed\n\n    Note over Client,Dashboard: Resuming Migration  \n    Client->>Frontend: init({onEvent})\n    Frontend->>Frontend: Check localStorage for options & access token\n    Frontend->>Worker: GET /api/v1/migration-modal (with access token)\n    Worker-->>Frontend: {url: \"https://dashboard.anon.com/modal/abc123\", status}\n    Frontend->>Frontend: createIframe(url, visible: false/true based on status)\n    Frontend-->>Client: Migration resumed or completed\n```","readmeFilename":"README.md"}