@auticlabs/bulut 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M34.5 34.5L1.5 1.5M34.5 1.5L1.5 34.5" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="10" height="20" viewBox="0 0 33 47" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.83332 45.5H23.5M30.8333 18.0001V21.6667C30.8333 29.7334 24.2333 36.3334 16.1666 36.3334M16.1666 36.3334C8.09999 36.3334 1.5 29.7334 1.5 21.6667V18.0001M16.1666 36.3334V45.5M16.1666 1.50009C15.2023 1.49523 14.2465 1.6816 13.3546 2.04841C12.4626 2.41523 11.6523 2.95521 10.9704 3.63714C10.2884 4.31907 9.74845 5.12942 9.38164 6.02133C9.01482 6.91325 8.82846 7.86903 8.83332 8.83341V21.5521C8.83332 25.5855 12.1562 29 16.1666 29C20.177 29 23.5 25.6771 23.5 21.5521V8.83341C23.5 4.70842 20.2916 1.50009 16.1666 1.50009Z" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M25.7578 9.93185C25.0145 10.2976 24.7084 11.1966 25.0741 11.94C25.4398 12.6833 26.3389 12.9894 27.0822 12.6237L26.42 11.2778L25.7578 9.93185ZM38.6 27.7222C38.6 26.8938 37.9284 26.2222 37.1 26.2222C36.2716 26.2222 35.6 26.8938 35.6 27.7222H37.1H38.6ZM20.36 0.438678C19.7738 -0.146743 18.8241 -0.14615 18.2387 0.440003C17.6533 1.02615 17.6539 1.9759 18.24 2.56132L19.3 1.5L20.36 0.438678ZM28.2 10.3889L29.26 11.4502C29.5417 11.1689 29.7 10.787 29.7 10.3889C29.7 9.99074 29.5417 9.60892 29.26 9.32756L28.2 10.3889ZM18.24 18.2164C17.6539 18.8019 17.6533 19.7516 18.2387 20.3378C18.8241 20.9239 19.7738 20.9245 20.36 20.3391L19.3 19.2778L18.24 18.2164ZM26.42 11.2778C27.0822 12.6237 27.0832 12.6232 27.0841 12.6227C27.0845 12.6226 27.0854 12.6221 27.0861 12.6218C27.0875 12.6211 27.0889 12.6204 27.0904 12.6196C27.0933 12.6182 27.0964 12.6166 27.0998 12.6149C27.1065 12.6115 27.114 12.6077 27.1222 12.6034C27.1386 12.5948 27.1583 12.5842 27.1806 12.5717C27.2245 12.5472 27.2821 12.5132 27.347 12.4701C27.459 12.3957 27.6702 12.244 27.859 12.0092C28.0401 11.7839 28.3584 11.2768 28.2356 10.5913C28.1131 9.90805 27.6362 9.51727 27.3224 9.32753C26.7369 8.97344 25.8532 8.78692 24.7247 8.6619C23.5186 8.52827 21.7833 8.44444 19.3 8.44444V9.94444V11.4444C21.7318 11.4444 23.344 11.5273 24.3944 11.6437C25.5224 11.7686 25.8044 11.9154 25.7701 11.8947C25.732 11.8716 25.3771 11.6475 25.2826 11.1205C25.1878 10.5913 25.4401 10.23 25.5207 10.1297C25.609 10.0198 25.6853 9.97231 25.6875 9.9709C25.6975 9.96425 25.7065 9.95888 25.7155 9.95385C25.7203 9.95114 25.726 9.94806 25.7328 9.94453C25.7362 9.94274 25.7399 9.94081 25.7441 9.93871C25.7461 9.93766 25.7483 9.93656 25.7506 9.93542C25.7518 9.93485 25.7529 9.93427 25.7541 9.93367C25.7547 9.93338 25.7557 9.93292 25.7559 9.93277C25.7569 9.93231 25.7578 9.93185 26.42 11.2778ZM19.3 9.94444V8.44444C15.4832 8.44444 11.752 9.57482 8.57822 11.6929L9.41086 12.9405L10.2435 14.1882C12.9241 12.3994 16.0758 11.4444 19.3 11.4444V9.94444ZM9.41086 12.9405L8.57822 11.6929C5.40438 13.8109 2.93039 16.8216 1.46939 20.3443L2.85495 20.919L4.24052 21.4936C5.474 18.5194 7.56294 15.9771 10.2435 14.1882L9.41086 12.9405ZM2.85495 20.919L1.46939 20.3443C0.00837755 23.8671 -0.373919 27.7436 0.370922 31.4835L1.84203 31.1905L3.31314 30.8975C2.68434 27.7403 3.00705 24.4677 4.24052 21.4936L2.85495 20.919ZM1.84203 31.1905L0.370922 31.4835C1.11576 35.2234 2.95422 38.6584 5.65351 41.3543L6.71351 40.293L7.7735 39.2317C5.49405 36.9551 3.94193 34.0547 3.31314 30.8975L1.84203 31.1905ZM6.71351 40.293L5.65351 41.3543C8.35278 44.0502 11.7916 45.8859 15.5351 46.6296L15.8274 45.1584L16.1197 43.6871C12.9574 43.0589 10.053 41.5083 7.7735 39.2317L6.71351 40.293ZM15.8274 45.1584L15.5351 46.6296C19.2786 47.3733 23.1588 46.9917 26.6852 45.5328L26.1118 44.1467L25.5384 42.7607C22.5597 43.9929 19.2819 44.3154 16.1197 43.6871L15.8274 45.1584ZM26.1118 44.1467L26.6852 45.5328C30.2116 44.074 33.2259 41.6033 35.3469 38.4331L34.1002 37.599L32.8534 36.7649C31.0626 39.4418 28.517 41.5284 25.5384 42.7607L26.1118 44.1467ZM34.1002 37.599L35.3469 38.4331C37.4678 35.2628 38.6 31.5354 38.6 27.7222H37.1H35.6C35.6 30.9412 34.6443 34.0881 32.8534 36.7649L34.1002 37.599ZM19.3 1.5L18.24 2.56132L27.14 11.4502L28.2 10.3889L29.26 9.32756L20.36 0.438678L19.3 1.5ZM28.2 10.3889L27.14 9.32756L18.24 18.2164L19.3 19.2778L20.36 20.3391L29.26 11.4502L28.2 10.3889Z" fill="black"/>
3
+ </svg>
package/dist/index.cjs ADDED
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react");function t({projectId:t,backendBaseUrl:r,model:o,voice:n,baseColor:s}){const c=e.useRef(null),u=e.useRef(`bulut-${Math.random().toString(36).slice(2,9)}`);return e.useEffect(()=>{const e=c.current;if(!e)return;const l=u.current;e.id=l;let i,a=!1;return(async()=>{const e=await Promise.resolve().then(()=>require("./embed.cjs"));a||(e.init({containerId:l,projectId:t,backendBaseUrl:r,model:o,voice:n,baseColor:s}),i=()=>e.destroy())})(),()=>{a=!0,null==i||i()}},[t,r,o,n,s]),e.createElement("div",{ref:c})}exports.Bulut=t,exports.default=t;
3
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/react.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { createElement, useEffect, useRef } from 'react';\r\n\r\nexport type BulutVoice = 'zeynep' | 'ali';\r\n\r\nexport interface BulutProps {\r\n /** The project ID for your Bulut instance (required). */\r\n projectId: string;\r\n /** Backend API URL. Defaults to `\"http://localhost:8000\"`. */\r\n backendBaseUrl?: string;\r\n /** LLM model identifier. */\r\n model?: string;\r\n /** Voice for TTS output. */\r\n voice?: BulutVoice;\r\n /** Primary theme colour as hex, e.g. `\"#6C03C1\"`. */\r\n baseColor?: string;\r\n}\r\n\r\n/**\r\n * `<Bulut>` – drop-in React / Next.js chatbot widget.\r\n *\r\n * Renders the Bulut floating chat widget inside a Shadow DOM container\r\n * so its styles never leak into your application.\r\n *\r\n * @example\r\n * ```tsx\r\n * import { Bulut } from 'bulut';\r\n *\r\n * export default function Page() {\r\n * return <Bulut projectId=\"proj_abc123\" />;\r\n * }\r\n * ```\r\n */\r\nexport function Bulut({\r\n projectId,\r\n backendBaseUrl,\r\n model,\r\n voice,\r\n baseColor,\r\n}: BulutProps) {\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const containerIdRef = useRef(\r\n `bulut-${Math.random().toString(36).slice(2, 9)}`,\r\n );\r\n\r\n useEffect(() => {\r\n const el = containerRef.current;\r\n if (!el) return;\r\n\r\n const containerId = containerIdRef.current;\r\n el.id = containerId;\r\n\r\n let destroyed = false;\r\n let cleanup: (() => void) | undefined;\r\n\r\n // Dynamic import keeps the Preact widget code out of the SSR bundle\r\n // and avoids `window`/`document` references at import time.\r\n (async () => {\r\n const mod = await import('./index');\r\n if (destroyed) return;\r\n\r\n mod.init({\r\n containerId,\r\n projectId,\r\n backendBaseUrl,\r\n model,\r\n voice,\r\n baseColor,\r\n });\r\n\r\n cleanup = () => mod.destroy();\r\n })();\r\n\r\n return () => {\r\n destroyed = true;\r\n cleanup?.();\r\n };\r\n }, [projectId, backendBaseUrl, model, voice, baseColor]);\r\n\r\n // Plain createElement – no JSX – so this file stays free of the\r\n // Preact JSX transform and keeps real React imports.\r\n return createElement('div', { ref: containerRef });\r\n}\r\n\r\nexport default Bulut;\r\n"],"names":["Bulut","projectId","backendBaseUrl","model","voice","baseColor","containerRef","useRef","containerIdRef","Math","random","toString","slice","useEffect","el","current","containerId","id","cleanup","destroyed","mod","Promise","resolve","then","require","init","destroy","createElement","ref"],"mappings":"qIAkCO,SAASA,GAAMC,UACpBA,EAAAC,eACAA,EAAAC,MACAA,EAAAC,MACAA,EAAAC,UACAA,IAEA,MAAMC,EAAeC,EAAAA,OAAuB,MACtCC,EAAiBD,EAAAA,OACrB,SAASE,KAAKC,SAASC,SAAS,IAAIC,MAAM,EAAG,MAuC/C,OApCAC,EAAAA,UAAU,KACR,MAAMC,EAAKR,EAAaS,QACxB,IAAKD,EAAI,OAET,MAAME,EAAcR,EAAeO,QACnCD,EAAGG,GAAKD,EAER,IACIE,EADAC,GAAY,EAqBhB,MAhBA,WACE,MAAMC,QAAYC,QAAAC,UAAAC,KAAA,IAAAC,QAAO,gBACrBL,IAEJC,EAAIK,KAAK,CACPT,cACAf,YACAC,iBACAC,QACAC,QACAC,cAGFa,EAAU,IAAME,EAAIM,UACtB,EAdA,GAgBO,KACLP,GAAY,EACZ,MAAAD,GAAAA,MAED,CAACjB,EAAWC,EAAgBC,EAAOC,EAAOC,IAItCsB,EAAAA,cAAc,MAAO,CAAEC,IAAKtB,GACrC"}
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ import { useRef, useEffect, createElement } from "react";
3
+ function Bulut({
4
+ projectId,
5
+ backendBaseUrl,
6
+ model,
7
+ voice,
8
+ baseColor
9
+ }) {
10
+ const containerRef = useRef(null);
11
+ const containerIdRef = useRef(
12
+ `bulut-${Math.random().toString(36).slice(2, 9)}`
13
+ );
14
+ useEffect(() => {
15
+ const el = containerRef.current;
16
+ if (!el) return;
17
+ const containerId = containerIdRef.current;
18
+ el.id = containerId;
19
+ let destroyed = false;
20
+ let cleanup;
21
+ (async () => {
22
+ const mod = await import("./embed.js");
23
+ if (destroyed) return;
24
+ mod.init({
25
+ containerId,
26
+ projectId,
27
+ backendBaseUrl,
28
+ model,
29
+ voice,
30
+ baseColor
31
+ });
32
+ cleanup = () => mod.destroy();
33
+ })();
34
+ return () => {
35
+ destroyed = true;
36
+ cleanup == null ? void 0 : cleanup();
37
+ };
38
+ }, [projectId, backendBaseUrl, model, voice, baseColor]);
39
+ return createElement("div", { ref: containerRef });
40
+ }
41
+ export {
42
+ Bulut,
43
+ Bulut as default
44
+ };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/react.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { createElement, useEffect, useRef } from 'react';\r\n\r\nexport type BulutVoice = 'zeynep' | 'ali';\r\n\r\nexport interface BulutProps {\r\n /** The project ID for your Bulut instance (required). */\r\n projectId: string;\r\n /** Backend API URL. Defaults to `\"http://localhost:8000\"`. */\r\n backendBaseUrl?: string;\r\n /** LLM model identifier. */\r\n model?: string;\r\n /** Voice for TTS output. */\r\n voice?: BulutVoice;\r\n /** Primary theme colour as hex, e.g. `\"#6C03C1\"`. */\r\n baseColor?: string;\r\n}\r\n\r\n/**\r\n * `<Bulut>` – drop-in React / Next.js chatbot widget.\r\n *\r\n * Renders the Bulut floating chat widget inside a Shadow DOM container\r\n * so its styles never leak into your application.\r\n *\r\n * @example\r\n * ```tsx\r\n * import { Bulut } from 'bulut';\r\n *\r\n * export default function Page() {\r\n * return <Bulut projectId=\"proj_abc123\" />;\r\n * }\r\n * ```\r\n */\r\nexport function Bulut({\r\n projectId,\r\n backendBaseUrl,\r\n model,\r\n voice,\r\n baseColor,\r\n}: BulutProps) {\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const containerIdRef = useRef(\r\n `bulut-${Math.random().toString(36).slice(2, 9)}`,\r\n );\r\n\r\n useEffect(() => {\r\n const el = containerRef.current;\r\n if (!el) return;\r\n\r\n const containerId = containerIdRef.current;\r\n el.id = containerId;\r\n\r\n let destroyed = false;\r\n let cleanup: (() => void) | undefined;\r\n\r\n // Dynamic import keeps the Preact widget code out of the SSR bundle\r\n // and avoids `window`/`document` references at import time.\r\n (async () => {\r\n const mod = await import('./index');\r\n if (destroyed) return;\r\n\r\n mod.init({\r\n containerId,\r\n projectId,\r\n backendBaseUrl,\r\n model,\r\n voice,\r\n baseColor,\r\n });\r\n\r\n cleanup = () => mod.destroy();\r\n })();\r\n\r\n return () => {\r\n destroyed = true;\r\n cleanup?.();\r\n };\r\n }, [projectId, backendBaseUrl, model, voice, baseColor]);\r\n\r\n // Plain createElement – no JSX – so this file stays free of the\r\n // Preact JSX transform and keeps real React imports.\r\n return createElement('div', { ref: containerRef });\r\n}\r\n\r\nexport default Bulut;\r\n"],"names":[],"mappings":";AAkCO,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,eAAe,OAAuB,IAAI;AAChD,QAAM,iBAAiB;AAAA,IACrB,SAAS,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAAA,EAAA;AAGjD,YAAU,MAAM;AACd,UAAM,KAAK,aAAa;AACxB,QAAI,CAAC,GAAI;AAET,UAAM,cAAc,eAAe;AACnC,OAAG,KAAK;AAER,QAAI,YAAY;AAChB,QAAI;AAIJ,KAAC,YAAY;AACX,YAAM,MAAM,MAAM,OAAO,YAAS;AAClC,UAAI,UAAW;AAEf,UAAI,KAAK;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAED,gBAAU,MAAM,IAAI,QAAA;AAAA,IACtB,GAAA;AAEA,WAAO,MAAM;AACX,kBAAY;AACZ;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,gBAAgB,OAAO,OAAO,SAAS,CAAC;AAIvD,SAAO,cAAc,OAAO,EAAE,KAAK,cAAc;AACnD;"}
package/index.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ export type BulutVoice = 'zeynep' | 'ali';
2
+
3
+ export interface BulutProps {
4
+ /** The project ID for your Bulut instance (required). */
5
+ projectId: string;
6
+ /** LLM model identifier. */
7
+ model?: string;
8
+ /** Voice for TTS output. */
9
+ voice?: BulutVoice;
10
+ /** Primary theme colour as hex, e.g. `"#6C03C1"`. */
11
+ baseColor?: string;
12
+ }
13
+
14
+ /**
15
+ * Drop-in React / Next.js chatbot widget.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { Bulut } from 'bulut';
20
+ *
21
+ * export default function Page() {
22
+ * return <Bulut projectId="proj_abc123" />;
23
+ * }
24
+ * ```
25
+ */
26
+ export declare function Bulut(props: BulutProps): JSX.Element;
27
+
28
+ export default Bulut;
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@auticlabs/bulut",
3
+ "version": "1.0.0",
4
+ "description": "Bulut – a lightweight AI chatbot widget for React, Next.js and Vite applications",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./index.d.ts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "./embed": {
21
+ "import": "./dist/embed.js",
22
+ "require": "./dist/embed.cjs"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "index.d.ts",
28
+ "README.md"
29
+ ],
30
+ "sideEffects": false,
31
+ "scripts": {
32
+ "dev": "vite",
33
+ "build": "vite build",
34
+ "preview": "vite preview",
35
+ "test": "vitest run",
36
+ "prepublishOnly": "npm run build"
37
+ },
38
+ "keywords": [
39
+ "chatbot",
40
+ "widget",
41
+ "react",
42
+ "nextjs",
43
+ "vite",
44
+ "preact",
45
+ "embeddable",
46
+ "ai"
47
+ ],
48
+ "author": "",
49
+ "license": "MIT",
50
+ "peerDependencies": {
51
+ "react": ">=17.0.0",
52
+ "react-dom": ">=17.0.0"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "react": {
56
+ "optional": false
57
+ },
58
+ "react-dom": {
59
+ "optional": false
60
+ }
61
+ },
62
+ "devDependencies": {
63
+ "@preact/preset-vite": "^2.8.1",
64
+ "@types/react": "^18.2.0",
65
+ "@types/react-dom": "^18.2.0",
66
+ "preact": "^10.19.3",
67
+ "react": "^18.2.0",
68
+ "react-dom": "^18.2.0",
69
+ "streaming-json": "^0.1.4",
70
+ "terser": "^5.27.0",
71
+ "typescript": "^5.3.3",
72
+ "vite": "^5.0.11",
73
+ "vitest": "^2.1.9"
74
+ }
75
+ }