@auticlabs/bulut 1.0.1 → 1.0.3
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.
- package/dist/embed.cjs +2 -2
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.js +2128 -1696
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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
|
|
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,agentName:c}){const u=e.useRef(null),a=e.useRef(`bulut-${Math.random().toString(36).slice(2,9)}`);return e.useEffect(()=>{const e=u.current;if(!e)return;const l=a.current;e.id=l;let i,d=!1;return(async()=>{const e=await Promise.resolve().then(()=>require("./embed.cjs"));d||(e.init({containerId:l,projectId:t,backendBaseUrl:r,model:o,voice:n,baseColor:s,agentName:c}),i=()=>e.destroy())})(),()=>{d=!0,null==i||i()}},[t,r,o,n,s,c]),e.createElement("div",{ref:u})}exports.Bulut=t,exports.default=t;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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":"
|
|
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 /** Agent display name (max 15 chars). */\r\n agentName?: 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 agentName,\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 agentName,\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, agentName]);\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","agentName","containerRef","useRef","containerIdRef","Math","random","toString","slice","useEffect","el","current","containerId","id","cleanup","destroyed","mod","Promise","resolve","then","require","init","destroy","createElement","ref"],"mappings":"qIAoCO,SAASA,GAAMC,UACpBA,EAAAC,eACAA,EAAAC,MACAA,EAAAC,MACAA,EAAAC,UACAA,EAAAC,UACAA,IAEA,MAAMC,EAAeC,EAAAA,OAAuB,MACtCC,EAAiBD,EAAAA,OACrB,SAASE,KAAKC,SAASC,SAAS,IAAIC,MAAM,EAAG,MAwC/C,OArCAC,EAAAA,UAAU,KACR,MAAMC,EAAKR,EAAaS,QACxB,IAAKD,EAAI,OAET,MAAME,EAAcR,EAAeO,QACnCD,EAAGG,GAAKD,EAER,IACIE,EADAC,GAAY,EAsBhB,MAjBA,WACE,MAAMC,QAAYC,QAAAC,UAAAC,KAAA,IAAAC,QAAO,gBACrBL,IAEJC,EAAIK,KAAK,CACPT,cACAhB,YACAC,iBACAC,QACAC,QACAC,YACAC,cAGFa,EAAU,IAAME,EAAIM,UACtB,EAfA,GAiBO,KACLP,GAAY,EACZ,MAAAD,GAAAA,MAED,CAAClB,EAAWC,EAAgBC,EAAOC,EAAOC,EAAWC,IAIjDsB,EAAAA,cAAc,MAAO,CAAEC,IAAKtB,GACrC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,8 @@ function Bulut({
|
|
|
5
5
|
backendBaseUrl,
|
|
6
6
|
model,
|
|
7
7
|
voice,
|
|
8
|
-
baseColor
|
|
8
|
+
baseColor,
|
|
9
|
+
agentName
|
|
9
10
|
}) {
|
|
10
11
|
const containerRef = useRef(null);
|
|
11
12
|
const containerIdRef = useRef(
|
|
@@ -27,7 +28,8 @@ function Bulut({
|
|
|
27
28
|
backendBaseUrl,
|
|
28
29
|
model,
|
|
29
30
|
voice,
|
|
30
|
-
baseColor
|
|
31
|
+
baseColor,
|
|
32
|
+
agentName
|
|
31
33
|
});
|
|
32
34
|
cleanup = () => mod.destroy();
|
|
33
35
|
})();
|
|
@@ -35,7 +37,7 @@ function Bulut({
|
|
|
35
37
|
destroyed = true;
|
|
36
38
|
cleanup == null ? void 0 : cleanup();
|
|
37
39
|
};
|
|
38
|
-
}, [projectId, backendBaseUrl, model, voice, baseColor]);
|
|
40
|
+
}, [projectId, backendBaseUrl, model, voice, baseColor, agentName]);
|
|
39
41
|
return createElement("div", { ref: containerRef });
|
|
40
42
|
}
|
|
41
43
|
export {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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":";
|
|
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 /** Agent display name (max 15 chars). */\r\n agentName?: 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 agentName,\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 agentName,\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, agentName]);\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":";AAoCO,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;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,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,WAAW,SAAS,CAAC;AAIlE,SAAO,cAAc,OAAO,EAAE,KAAK,cAAc;AACnD;"}
|