{"_id":"@aichatbot-saas/core","name":"@aichatbot-saas/core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aichatbot-saas/core","version":"0.1.0","description":"Framework-agnostic core (REST client, theme, headless chat controller) for the AIChatbot web SDKs.","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"}},"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/piyushshri01/chat-bot-saas.git","directory":"sdks/web-core"},"homepage":"https://github.com/piyushshri01/chat-bot-saas/tree/main/sdks/web-core#readme","bugs":{"url":"https://github.com/piyushshri01/chat-bot-saas/issues"},"keywords":["chatbot","ai","chat","sdk","aichatbot","support","headless"],"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.4.0"},"publishConfig":{"access":"public"},"_id":"@aichatbot-saas/core@0.1.0","gitHead":"e36cb372535432e87de61da448f13bf232ac9753","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-LQKFTW8clGJGKFN4IVp0OIpHCx/RFsRwNz1wm+T9DXDCZOj06ckqf38UrlDFkOZhlX66oChR9ZcM4vvg1ueLig==","shasum":"b7d5cc64642eae9e33c59b885fbe32fc55b99613","tarball":"https://registry.npmjs.org/@aichatbot-saas/core/-/core-0.1.0.tgz","fileCount":13,"unpackedSize":49399,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEJbx8a3xApqwbRgxdB1jZZK9ziejKvFMSSI9LOn0jRnAiBnnP4CkPp0ANz/S8bhHh82oOEWCwXkunQUruYEEAEG4Q=="}]},"_npmUser":{"name":"piyushshri01","email":"piyushshrimal94@gmail.com"},"directories":{},"maintainers":[{"name":"piyushshri01","email":"piyushshrimal94@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.1.0_1783318333470_0.5048380541439872"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T06:12:13.348Z","0.1.0":"2026-07-06T06:12:13.602Z","modified":"2026-07-06T06:12:13.794Z"},"maintainers":[{"name":"piyushshri01","email":"piyushshrimal94@gmail.com"}],"description":"Framework-agnostic core (REST client, theme, headless chat controller) for the AIChatbot web SDKs.","homepage":"https://github.com/piyushshri01/chat-bot-saas/tree/main/sdks/web-core#readme","keywords":["chatbot","ai","chat","sdk","aichatbot","support","headless"],"repository":{"type":"git","url":"git+https://github.com/piyushshri01/chat-bot-saas.git","directory":"sdks/web-core"},"bugs":{"url":"https://github.com/piyushshri01/chat-bot-saas/issues"},"license":"MIT","readme":"# @aichatbot-saas/core\n\nFramework-agnostic core for the AIChatbot **web** SDKs. It contains everything except\nthe UI: the REST client, the theme model, conversation persistence, and a headless\n**chat controller** that holds all behavior and exposes immutable state via a\n`subscribe()` pattern.\n\nThe React, Vue, and Angular packages all build on this — so the logic lives here once.\nYou can also use it standalone to build your own UI.\n\n> This is the shared dependency of [`@aichatbot-saas/react`](../react), [`@aichatbot-saas/vue`](../vue),\n> and [`@aichatbot-saas/angular`](../angular). For the full contract see [`../README.md`](../README.md).\n\n## Install\n\n```sh\nnpm install @aichatbot-saas/core\n```\n\n## Headless controller\n\n```ts\nimport { createChatController } from '@aichatbot-saas/core';\n\nconst chat = createChatController({\n  apiKey: 'pk_live_xxx',\n  apiUrl: 'https://api.you.com',\n  theme: { primaryColor: '#16a34a' }, // optional local overrides\n});\n\nconst unsubscribe = chat.subscribe((state) => {\n  // state: { status, config, theme, messages, suggestions, isTyping, sending, error }\n  render(state);\n});\n\nawait chat.start();          // load config, greeting, starter suggestions\nawait chat.send('Hi there'); // optimistic user bubble -> typing -> bot reply\n// chat.submitFeedback(botMessage, 'positive');\n// unsubscribe(); chat.destroy();\n```\n\nState is replaced (new object identity) on every change, so it plugs straight into\nReact's `useSyncExternalStore`, Vue reactivity, or Angular change detection.\n\n## Just the client\n\n```ts\nimport { AIChatbotClient } from '@aichatbot-saas/core';\n\nconst client = new AIChatbotClient({ apiKey: 'pk_live_xxx', apiUrl: 'https://api.you.com' });\nconst config = await client.fetchConfig();\nconst reply = await client.sendMessage({ text: 'Hello', conversationId: null });\n```\n\n## Exports\n\n- `createChatController(opts)` / `ChatController` — headless state machine\n- `AIChatbotClient` — REST client (`fetchConfig`, `fetchSuggestions`, `sendMessage`, `sendFeedback`)\n- `resolveTheme(config, overrides)`, `DEFAULT_THEME` — theme normalization\n- `getConversationId` / `setConversationId` / `isStorageAvailable` — SSR-safe persistence\n- `suggestionLabel` — normalize a suggestion (object-or-string) to a label\n- Types: `ChatConfig`, `ChatMessage`, `ChatResponse`, `ChatTheme`, `ChatState`, `Suggestion`, …\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-7ceccdcbdd479e50e5de7c5cf60617ed"}