{"_id":"@achado/client","_rev":"2-e8ad3b3ba621c119169a1253db64654c","name":"@achado/client","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@achado/client","version":"0.0.1","keywords":["analytics","tracking","achado","javascript","typescript","client"],"author":{"name":"Achado"},"license":"MIT","_id":"@achado/client@0.0.1","maintainers":[{"name":"achado","email":"achadolabs@gmail.com"}],"homepage":"https://github.com/achado/js-monorepo","bugs":{"url":"https://github.com/achado/js-monorepo/issues"},"dist":{"shasum":"14b4db762578c0391e050f8661f3fc0e2292191d","tarball":"https://registry.npmjs.org/@achado/client/-/client-0.0.1.tgz","fileCount":11,"integrity":"sha512-U9es0lspEvxG/oaZcGxOYqMcPcSjlL4fB/cRkyfvJSMeV9d0uRPsqoXJMEIz+lqF2caBdi3mYIrUZmnRMId0Hg==","signatures":[{"sig":"MEUCIQCowbp0XwZfN1BwmKKM3OaDyebY/eKb0mLfc+zo3AtiVQIge1T8o67tkNNsJU2Bco+oO3XwEW+t3CE4Y57yF7Qonbs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15470},"main":"dist/index.js","type":"commonjs","_from":"file:achado-client-0.0.1.tgz","types":"dist/types/index.d.ts","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"scripts":{"dev":"rollup -c -w","lint":"eslint src --ext .ts,.tsx","test":"vitest","build":"rollup -c","clean":"rm -rf dist","test:watch":"vitest --watch","type-check":"tsc --noEmit"},"_npmUser":{"name":"achado","email":"achadolabs@gmail.com"},"_resolved":"/tmp/a0ec95fd998ae7acd924fee0a2e4f6ff/achado-client-0.0.1.tgz","_integrity":"sha512-U9es0lspEvxG/oaZcGxOYqMcPcSjlL4fB/cRkyfvJSMeV9d0uRPsqoXJMEIz+lqF2caBdi3mYIrUZmnRMId0Hg==","repository":{"url":"git+https://github.com/achado/js-monorepo.git","type":"git","directory":"packages/client"},"_npmVersion":"10.9.3","description":"Achado JavaScript client for web applications","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","dependencies":{"@achado/core":"0.0.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.4.0","typescript":"^5.4.2","@types/node":"^20.11.19"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.1_1759924668206_0.4798457720954712","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@achado/client","version":"0.0.2","type":"commonjs","description":"Achado JavaScript client for web applications","main":"dist/index.js","module":"dist/index.esm.js","types":"dist/types/index.d.ts","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js","types":"./dist/types/index.d.ts"},"./package.json":"./package.json"},"sideEffects":false,"dependencies":{"@achado/core":"0.0.2"},"devDependencies":{"@types/node":"^20.11.19","typescript":"^5.4.2","vitest":"^1.4.0"},"keywords":["analytics","tracking","achado","javascript","typescript","client"],"author":{"name":"Achado"},"license":"MIT","homepage":"https://github.com/achado/js-monorepo","repository":{"type":"git","url":"git+https://github.com/achado/js-monorepo.git","directory":"packages/client"},"scripts":{"build":"rollup -c","dev":"rollup -c -w","clean":"rm -rf dist","test":"vitest","test:watch":"vitest --watch","lint":"eslint src --ext .ts,.tsx","type-check":"tsc --noEmit"},"_id":"@achado/client@0.0.2","bugs":{"url":"https://github.com/achado/js-monorepo/issues"},"_integrity":"sha512-4BU5LIMKXmc4TzXoENXX3qQyGrCLvhUsiOh0lK1tg7TloZlP2roAE+06c7JnBPEZl4DZyQQZ6Fj5QZ5mneHKNA==","_resolved":"/tmp/8d368098a5e521281177264cb1e08046/achado-client-0.0.2.tgz","_from":"file:achado-client-0.0.2.tgz","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-4BU5LIMKXmc4TzXoENXX3qQyGrCLvhUsiOh0lK1tg7TloZlP2roAE+06c7JnBPEZl4DZyQQZ6Fj5QZ5mneHKNA==","shasum":"b252ef9ac837e8e530c38ffc9d435535779ffb6f","tarball":"https://registry.npmjs.org/@achado/client/-/client-0.0.2.tgz","fileCount":11,"unpackedSize":15470,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDDJeznlhO56pg+brN7Io5lk3RI3sIuzL+TQq7y6RM2yAIgR/2Gn0Dt5nr7zKtLni/DPmr1a+j6a1eAZitraoN+Wnk="}]},"_npmUser":{"name":"achado","email":"achadolabs@gmail.com"},"directories":{},"maintainers":[{"name":"achado","email":"achadolabs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.0.2_1759937318803_0.8668176640018681"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-08T11:57:48.098Z","modified":"2025-10-08T15:28:39.228Z","0.0.1":"2025-10-08T11:57:48.383Z","0.0.2":"2025-10-08T15:28:39.039Z"},"bugs":{"url":"https://github.com/achado/js-monorepo/issues"},"author":{"name":"Achado"},"license":"MIT","homepage":"https://github.com/achado/js-monorepo","keywords":["analytics","tracking","achado","javascript","typescript","client"],"repository":{"type":"git","url":"git+https://github.com/achado/js-monorepo.git","directory":"packages/client"},"description":"Achado JavaScript client for web applications","maintainers":[{"name":"achado","email":"achadolabs@gmail.com"}],"readme":"# @achado/client\n\nConsumer-facing Achado JavaScript SDK package. This package provides a clean, simplified API for integrating Achado analytics into your web applications.\n\n## Overview\n\n`@achado/client` is the recommended package for most users. It acts as the consumer-facing API layer (similar to 's js-client package) while importing functionality from the internal `@achado/core` package.\n\n## Installation\n\n```bash\nnpm install @achado/client\n# or\npnpm add @achado/client\n# or\nyarn add @achado/client\n```\n\n## Quick Start\n\n### Basic Usage\n\n```typescript\nimport { AchadoClient, initialize } from '@achado/client';\n\n// Option 1: Quick initialization (recommended)\nconst client = await initialize({\n  apiKey: 'your-api-key-here',\n  debug: true,\n});\n\n// Option 2: Manual initialization\nconst client = new AchadoClient({\n  apiKey: 'your-api-key-here',\n  debug: true,\n});\nawait client.initialize();\n\n// Track events\nclient.track('user_signed_up', {\n  plan: 'pro',\n  source: 'landing_page',\n});\n\n// Identify users\nclient.identify('user-123', {\n  name: 'John Doe',\n  email: 'john@example.com',\n  plan: 'pro',\n});\n```\n\n### With Plugins\n\n```typescript\nimport { AchadoClient } from '@achado/client';\nimport { WebAnalyticsPlugin } from '@achado/web-analytics';\nimport { SessionReplayPlugin } from '@achado/session-replay';\n\nconst webAnalytics = new WebAnalyticsPlugin({\n  enablePageViews: true,\n  enableClickTracking: true,\n});\n\nconst sessionReplay = new SessionReplayPlugin({\n  enabled: true,\n  sampleRate: 0.1, // Record 10% of sessions\n});\n\nconst client = new AchadoClient({\n  apiKey: 'your-api-key-here',\n  plugins: [webAnalytics, sessionReplay],\n});\n\nawait client.initialize();\n```\n\n## API Reference\n\n### Core Exports\n\n```typescript\n// Main client class\nexport { AchadoClient } from '@achado/core';\n\n// Type definitions\nexport type {\n  AchadoConfig,\n  AchadoEvent,\n  AchadoUser,\n  Logger,\n  StorageAdapter,\n  Plugin,\n  PluginContext,\n} from '@achado/core';\n\n// Utility functions\nexport {\n  generateId,\n  generateSessionId,\n  generateAnonymousId,\n  getCurrentTimestamp,\n} from '@achado/core';\n\n// Global access and debugging\nexport { _getAchadoGlobal } from '@achado/core';\n\n// Version information\nexport { SDK_VERSION, getClientMetadata } from '@achado/core';\n\n// Plugin base class\nexport type { BasePlugin } from '@achado/core';\n```\n\n### Convenience Functions\n\n#### `initialize(config: AchadoConfig): Promise<AchadoClient>`\n\nQuick initialization function that creates and initializes a client in one step:\n\n```typescript\nconst client = await initialize({\n  apiKey: 'your-api-key',\n  debug: true,\n  userId: 'user-123',\n});\n```\n\n#### `instance(apiKey?: string): AchadoClient | undefined`\n\nGlobal instance accessor for debugging and multi-client scenarios:\n\n```typescript\n// Get the default instance\nconst client = instance();\n\n// Get a specific instance by API key\nconst specificClient = instance('your-api-key');\n```\n\n## Global Access\n\nFor debugging purposes, you can access Achado instances globally:\n\n```javascript\n// In browser console\nwindow.__ACHADO__.instance(); // Get default instance\nwindow.__ACHADO__.instance('your-api-key'); // Get specific instance\nwindow.__ACHADO__.instances; // See all instances\n```\n\n## TypeScript Support\n\nThis package includes full TypeScript definitions. All types are re-exported from the core package for convenience:\n\n```typescript\nimport type { AchadoConfig, AchadoEvent, AchadoUser } from '@achado/client';\n\nconst config: AchadoConfig = {\n  apiKey: 'your-api-key',\n  debug: true,\n};\n\nconst user: AchadoUser = {\n  userId: 'user-123',\n  anonymousId: 'anon-456',\n  sessionId: 'session-789',\n  properties: {},\n  traits: {},\n};\n```\n\n## Relationship to @achado/core\n\nThis package serves as the consumer-facing API layer:\n\n- **@achado/client**: Public API for end users (this package)\n- **@achado/core**: Internal infrastructure and implementation\n\nThis separation follows the same pattern as 's architecture:\n\n- 's `js-client` ≈ Achado' `client`\n- 's `client-core` ≈ Achado' `core`\n\n## Tree Shaking\n\nThis package is designed to be tree-shakable. Only the functions and classes you import will be included in your bundle:\n\n```typescript\n// Only imports the client class and initialize function\nimport { AchadoClient, initialize } from '@achado/client';\n\n// Only imports type definitions (zero runtime cost)\nimport type { AchadoConfig } from '@achado/client';\n```\n\n## Examples\n\n- [Vanilla JavaScript Example](../../examples/vanilla-js)\n- [Tree Shaking Examples](../../examples)\n\n## Advanced Usage\n\nFor advanced use cases, you can import directly from `@achado/core`:\n\n```typescript\n// Direct core imports for advanced users\nimport { AchadoLogger, NetworkManager } from '@achado/core';\n```\n\nHowever, for most applications, the client package provides everything you need.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}