@namiruai/vue 1.2.0 → 1.4.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.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @namiru/vue
1
+ # @namiruai/vue
2
2
 
3
3
  Vue 3 wrapper for the [Namiru.ai](https://namiru.ai) chat widget -- add AI customer support to your Vue app.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @namiru/vue
8
+ npm install @namiruai/vue
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -14,7 +14,7 @@ npm install @namiru/vue
14
14
 
15
15
  ```vue
16
16
  <script setup>
17
- import { NamiruChat } from '@namiru/vue';
17
+ import { NamiruChat } from '@namiruai/vue';
18
18
  </script>
19
19
 
20
20
  <template>
@@ -29,7 +29,7 @@ import { NamiruChat } from '@namiru/vue';
29
29
 
30
30
  ```vue
31
31
  <script setup>
32
- import { NamiruChat } from '@namiru/vue';
32
+ import { NamiruChat } from '@namiruai/vue';
33
33
  </script>
34
34
 
35
35
  <template>
@@ -51,7 +51,6 @@ import { NamiruChat } from '@namiru/vue';
51
51
  | Prop | Type | Description |
52
52
  |------|------|-------------|
53
53
  | `agent-id` | `string` | **Required.** Your Namiru agent ID. |
54
- | `server-url` | `string` | Custom server URL (defaults to Namiru cloud). |
55
54
  | `mode` | `'button' \| 'inline'` | Display mode. Default: `'button'`. |
56
55
  | `position` | `'bottom-left' \| 'bottom-right'` | Button position. Default: `'bottom-right'`. |
57
56
  | `width` | `string` | Width for inline mode. |
package/dist/index.d.ts CHANGED
@@ -1,8 +1,25 @@
1
+ import { type PropType } from "vue";
1
2
  export declare const NamiruChat: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
3
  agentId: {
3
4
  type: StringConstructor;
4
5
  required: true;
5
6
  };
7
+ mode: {
8
+ type: PropType<"button" | "inline">;
9
+ default: undefined;
10
+ };
11
+ position: {
12
+ type: PropType<"bottom-right" | "bottom-left">;
13
+ default: undefined;
14
+ };
15
+ width: {
16
+ type: StringConstructor;
17
+ default: undefined;
18
+ };
19
+ height: {
20
+ type: StringConstructor;
21
+ default: undefined;
22
+ };
6
23
  }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
24
  [key: string]: any;
8
25
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("leadCapture" | "feedback" | "sessionStart" | "sessionEnd")[], "leadCapture" | "feedback" | "sessionStart" | "sessionEnd", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -10,10 +27,31 @@ export declare const NamiruChat: import("vue").DefineComponent<import("vue").Ext
10
27
  type: StringConstructor;
11
28
  required: true;
12
29
  };
30
+ mode: {
31
+ type: PropType<"button" | "inline">;
32
+ default: undefined;
33
+ };
34
+ position: {
35
+ type: PropType<"bottom-right" | "bottom-left">;
36
+ default: undefined;
37
+ };
38
+ width: {
39
+ type: StringConstructor;
40
+ default: undefined;
41
+ };
42
+ height: {
43
+ type: StringConstructor;
44
+ default: undefined;
45
+ };
13
46
  }>> & Readonly<{
14
47
  onLeadCapture?: ((...args: any[]) => any) | undefined;
15
48
  onFeedback?: ((...args: any[]) => any) | undefined;
16
49
  onSessionStart?: ((...args: any[]) => any) | undefined;
17
50
  onSessionEnd?: ((...args: any[]) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
51
+ }>, {
52
+ mode: "button" | "inline";
53
+ position: "bottom-right" | "bottom-left";
54
+ width: string;
55
+ height: string;
56
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
57
  export type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from "@namiruai/chat";
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{defineComponent as d,ref as i,onMounted as l,onBeforeUnmount as c,watch as m,h as C}from"vue";var f=d({name:"NamiruChat",props:{agentId:{type:String,required:!0}},emits:["leadCapture","feedback","sessionStart","sessionEnd"],setup(e,{emit:t}){let o=i(null),n=i(null);async function r(){let{init:u}=await import("@namiruai/chat"),s={agentId:e.agentId,onLeadCapture:a=>t("leadCapture",a),onFeedback:a=>t("feedback",a),onSessionStart:a=>t("sessionStart",a),onSessionEnd:a=>t("sessionEnd",a)};n.value=u(s)}return l(()=>{r()}),c(()=>{n.value?.destroy(),n.value=null}),m(()=>e.agentId,()=>{n.value?.destroy(),n.value=null,r()}),()=>C("div",{ref:o})}});export{f as NamiruChat};
1
+ import{defineComponent as h,ref as d,onMounted as l,onBeforeUnmount as s,watch as f,h as m}from"vue";var c=h({name:"NamiruChat",props:{agentId:{type:String,required:!0},mode:{type:String,default:void 0},position:{type:String,default:void 0},width:{type:String,default:void 0},height:{type:String,default:void 0}},emits:["leadCapture","feedback","sessionStart","sessionEnd"],setup(t,{emit:i}){let u=d(null),n=d(null);async function o(){let{init:a}=await import("@namiruai/chat"),r={agentId:t.agentId,...t.mode&&{mode:t.mode},...t.position&&{position:t.position},...t.width&&{width:t.width},...t.height&&{height:t.height},onLeadCapture:e=>i("leadCapture",e),onFeedback:e=>i("feedback",e),onSessionStart:e=>i("sessionStart",e),onSessionEnd:e=>i("sessionEnd",e)};n.value=a(r)}return l(()=>{o()}),s(()=>{n.value?.destroy(),n.value=null}),f(()=>t.agentId,()=>{n.value?.destroy(),n.value=null,o()}),()=>{let a=t.mode==="inline"?{width:t.width,height:t.height}:void 0;return m("div",{ref:u,style:a})}}});export{c as NamiruChat};
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import {\n defineComponent,\n ref,\n onMounted,\n onBeforeUnmount,\n watch,\n h,\n} from \"vue\";\nimport type {\n NamiruChatConfig,\n NamiruChatInstance,\n LeadCaptureData,\n} from \"@namiruai/chat\";\n\nexport const NamiruChat = defineComponent({\n name: \"NamiruChat\",\n props: {\n agentId: { type: String, required: true },\n },\n emits: [\"leadCapture\", \"feedback\", \"sessionStart\", \"sessionEnd\"],\n setup(props, { emit }) {\n const containerRef = ref<HTMLElement | null>(null);\n const instance = ref<NamiruChatInstance | null>(null);\n\n async function initialize() {\n const { init } = await import(\"@namiruai/chat\");\n\n const config: NamiruChatConfig = {\n agentId: props.agentId,\n onLeadCapture: (lead: LeadCaptureData) => emit(\"leadCapture\", lead),\n onFeedback: (rating: \"up\" | \"down\") => emit(\"feedback\", rating),\n onSessionStart: (id: string) => emit(\"sessionStart\", id),\n onSessionEnd: (id: string) => emit(\"sessionEnd\", id),\n };\n\n instance.value = init(config);\n }\n\n onMounted(() => {\n initialize();\n });\n\n onBeforeUnmount(() => {\n instance.value?.destroy();\n instance.value = null;\n });\n\n // agentId change triggers full re-init\n watch(\n () => props.agentId,\n () => {\n instance.value?.destroy();\n instance.value = null;\n initialize();\n }\n );\n\n return () => {\n return h(\"div\", { ref: containerRef });\n };\n },\n});\n\nexport type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from \"@namiruai/chat\";\n"],
5
- "mappings": "AAAA,OACE,mBAAAA,EACA,OAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,KAAAC,MACK,MAOA,IAAMC,EAAaN,EAAgB,CACxC,KAAM,aACN,MAAO,CACL,QAAS,CAAE,KAAM,OAAQ,SAAU,EAAK,CAC1C,EACA,MAAO,CAAC,cAAe,WAAY,eAAgB,YAAY,EAC/D,MAAMO,EAAO,CAAE,KAAAC,CAAK,EAAG,CACrB,IAAMC,EAAeR,EAAwB,IAAI,EAC3CS,EAAWT,EAA+B,IAAI,EAEpD,eAAeU,GAAa,CAC1B,GAAM,CAAE,KAAAC,CAAK,EAAI,KAAM,QAAO,gBAAgB,EAExCC,EAA2B,CAC/B,QAASN,EAAM,QACf,cAAgBO,GAA0BN,EAAK,cAAeM,CAAI,EAClE,WAAaC,GAA0BP,EAAK,WAAYO,CAAM,EAC9D,eAAiBC,GAAeR,EAAK,eAAgBQ,CAAE,EACvD,aAAeA,GAAeR,EAAK,aAAcQ,CAAE,CACrD,EAEAN,EAAS,MAAQE,EAAKC,CAAM,CAC9B,CAEA,OAAAX,EAAU,IAAM,CACdS,EAAW,CACb,CAAC,EAEDR,EAAgB,IAAM,CACpBO,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,IACnB,CAAC,EAGDN,EACE,IAAMG,EAAM,QACZ,IAAM,CACJG,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,KACjBC,EAAW,CACb,CACF,EAEO,IACEN,EAAE,MAAO,CAAE,IAAKI,CAAa,CAAC,CAEzC,CACF,CAAC",
6
- "names": ["defineComponent", "ref", "onMounted", "onBeforeUnmount", "watch", "h", "NamiruChat", "props", "emit", "containerRef", "instance", "initialize", "init", "config", "lead", "rating", "id"]
4
+ "sourcesContent": ["import {\n defineComponent,\n ref,\n onMounted,\n onBeforeUnmount,\n watch,\n h,\n type PropType,\n} from \"vue\";\nimport type {\n NamiruChatConfig,\n NamiruChatInstance,\n LeadCaptureData,\n} from \"@namiruai/chat\";\n\nexport const NamiruChat = defineComponent({\n name: \"NamiruChat\",\n props: {\n agentId: { type: String, required: true },\n mode: { type: String as PropType<\"button\" | \"inline\">, default: undefined },\n position: { type: String as PropType<\"bottom-right\" | \"bottom-left\">, default: undefined },\n width: { type: String, default: undefined },\n height: { type: String, default: undefined },\n },\n emits: [\"leadCapture\", \"feedback\", \"sessionStart\", \"sessionEnd\"],\n setup(props, { emit }) {\n const containerRef = ref<HTMLElement | null>(null);\n const instance = ref<NamiruChatInstance | null>(null);\n\n async function initialize() {\n const { init } = await import(\"@namiruai/chat\");\n\n const config: NamiruChatConfig = {\n agentId: props.agentId,\n ...(props.mode && { mode: props.mode }),\n ...(props.position && { position: props.position }),\n ...(props.width && { width: props.width }),\n ...(props.height && { height: props.height }),\n onLeadCapture: (lead: LeadCaptureData) => emit(\"leadCapture\", lead),\n onFeedback: (rating: \"up\" | \"down\") => emit(\"feedback\", rating),\n onSessionStart: (id: string) => emit(\"sessionStart\", id),\n onSessionEnd: (id: string) => emit(\"sessionEnd\", id),\n };\n\n instance.value = init(config);\n }\n\n onMounted(() => {\n initialize();\n });\n\n onBeforeUnmount(() => {\n instance.value?.destroy();\n instance.value = null;\n });\n\n // agentId change triggers full re-init\n watch(\n () => props.agentId,\n () => {\n instance.value?.destroy();\n instance.value = null;\n initialize();\n }\n );\n\n return () => {\n const style = props.mode === \"inline\"\n ? { width: props.width, height: props.height }\n : undefined;\n return h(\"div\", { ref: containerRef, style });\n };\n },\n});\n\nexport type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from \"@namiruai/chat\";\n"],
5
+ "mappings": "AAAA,OACE,mBAAAA,EACA,OAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,KAAAC,MAEK,MAOA,IAAMC,EAAaN,EAAgB,CACxC,KAAM,aACN,MAAO,CACL,QAAS,CAAE,KAAM,OAAQ,SAAU,EAAK,EACxC,KAAM,CAAE,KAAM,OAAyC,QAAS,MAAU,EAC1E,SAAU,CAAE,KAAM,OAAoD,QAAS,MAAU,EACzF,MAAO,CAAE,KAAM,OAAQ,QAAS,MAAU,EAC1C,OAAQ,CAAE,KAAM,OAAQ,QAAS,MAAU,CAC7C,EACA,MAAO,CAAC,cAAe,WAAY,eAAgB,YAAY,EAC/D,MAAMO,EAAO,CAAE,KAAAC,CAAK,EAAG,CACrB,IAAMC,EAAeR,EAAwB,IAAI,EAC3CS,EAAWT,EAA+B,IAAI,EAEpD,eAAeU,GAAa,CAC1B,GAAM,CAAE,KAAAC,CAAK,EAAI,KAAM,QAAO,gBAAgB,EAExCC,EAA2B,CAC/B,QAASN,EAAM,QACf,GAAIA,EAAM,MAAQ,CAAE,KAAMA,EAAM,IAAK,EACrC,GAAIA,EAAM,UAAY,CAAE,SAAUA,EAAM,QAAS,EACjD,GAAIA,EAAM,OAAS,CAAE,MAAOA,EAAM,KAAM,EACxC,GAAIA,EAAM,QAAU,CAAE,OAAQA,EAAM,MAAO,EAC3C,cAAgBO,GAA0BN,EAAK,cAAeM,CAAI,EAClE,WAAaC,GAA0BP,EAAK,WAAYO,CAAM,EAC9D,eAAiBC,GAAeR,EAAK,eAAgBQ,CAAE,EACvD,aAAeA,GAAeR,EAAK,aAAcQ,CAAE,CACrD,EAEAN,EAAS,MAAQE,EAAKC,CAAM,CAC9B,CAEA,OAAAX,EAAU,IAAM,CACdS,EAAW,CACb,CAAC,EAEDR,EAAgB,IAAM,CACpBO,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,IACnB,CAAC,EAGDN,EACE,IAAMG,EAAM,QACZ,IAAM,CACJG,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,KACjBC,EAAW,CACb,CACF,EAEO,IAAM,CACX,IAAMM,EAAQV,EAAM,OAAS,SACzB,CAAE,MAAOA,EAAM,MAAO,OAAQA,EAAM,MAAO,EAC3C,OACJ,OAAOF,EAAE,MAAO,CAAE,IAAKI,EAAc,MAAAQ,CAAM,CAAC,CAC9C,CACF,CACF,CAAC",
6
+ "names": ["defineComponent", "ref", "onMounted", "onBeforeUnmount", "watch", "h", "NamiruChat", "props", "emit", "containerRef", "instance", "initialize", "init", "config", "lead", "rating", "id", "style"]
7
7
  }
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.create;var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var h=(a,n)=>{for(var e in n)u(a,e,{get:n[e],enumerable:!0})},s=(a,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of C(n))!f.call(a,i)&&i!==e&&u(a,i,{get:()=>n[i],enumerable:!(r=m(n,i))||r.enumerable});return a};var g=(a,n,e)=>(e=a!=null?c(p(a)):{},s(n||!a||!a.__esModule?u(e,"default",{value:a,enumerable:!0}):e,a)),N=a=>s(u({},"__esModule",{value:!0}),a);var v={};h(v,{NamiruChat:()=>I});module.exports=N(v);var t=require("vue"),I=(0,t.defineComponent)({name:"NamiruChat",props:{agentId:{type:String,required:!0}},emits:["leadCapture","feedback","sessionStart","sessionEnd"],setup(a,{emit:n}){let e=(0,t.ref)(null),r=(0,t.ref)(null);async function i(){let{init:d}=await import("@namiruai/chat"),l={agentId:a.agentId,onLeadCapture:o=>n("leadCapture",o),onFeedback:o=>n("feedback",o),onSessionStart:o=>n("sessionStart",o),onSessionEnd:o=>n("sessionEnd",o)};r.value=d(l)}return(0,t.onMounted)(()=>{i()}),(0,t.onBeforeUnmount)(()=>{r.value?.destroy(),r.value=null}),(0,t.watch)(()=>a.agentId,()=>{r.value?.destroy(),r.value=null,i()}),()=>(0,t.h)("div",{ref:e})}});
1
+ "use strict";var s=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var i in e)u(t,i,{get:e[i],enumerable:!0})},h=(t,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!c.call(t,o)&&o!==i&&u(t,o,{get:()=>e[o],enumerable:!(a=f(e,o))||a.enumerable});return t};var y=(t,e,i)=>(i=t!=null?s(g(t)):{},h(e||!t||!t.__esModule?u(i,"default",{value:t,enumerable:!0}):i,t)),p=t=>h(u({},"__esModule",{value:!0}),t);var w={};C(w,{NamiruChat:()=>S});module.exports=p(w);var n=require("vue"),S=(0,n.defineComponent)({name:"NamiruChat",props:{agentId:{type:String,required:!0},mode:{type:String,default:void 0},position:{type:String,default:void 0},width:{type:String,default:void 0},height:{type:String,default:void 0}},emits:["leadCapture","feedback","sessionStart","sessionEnd"],setup(t,{emit:e}){let i=(0,n.ref)(null),a=(0,n.ref)(null);async function o(){let{init:r}=await import("@namiruai/chat"),l={agentId:t.agentId,...t.mode&&{mode:t.mode},...t.position&&{position:t.position},...t.width&&{width:t.width},...t.height&&{height:t.height},onLeadCapture:d=>e("leadCapture",d),onFeedback:d=>e("feedback",d),onSessionStart:d=>e("sessionStart",d),onSessionEnd:d=>e("sessionEnd",d)};a.value=r(l)}return(0,n.onMounted)(()=>{o()}),(0,n.onBeforeUnmount)(()=>{a.value?.destroy(),a.value=null}),(0,n.watch)(()=>t.agentId,()=>{a.value?.destroy(),a.value=null,o()}),()=>{let r=t.mode==="inline"?{width:t.width,height:t.height}:void 0;return(0,n.h)("div",{ref:i,style:r})}}});
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import {\n defineComponent,\n ref,\n onMounted,\n onBeforeUnmount,\n watch,\n h,\n} from \"vue\";\nimport type {\n NamiruChatConfig,\n NamiruChatInstance,\n LeadCaptureData,\n} from \"@namiruai/chat\";\n\nexport const NamiruChat = defineComponent({\n name: \"NamiruChat\",\n props: {\n agentId: { type: String, required: true },\n },\n emits: [\"leadCapture\", \"feedback\", \"sessionStart\", \"sessionEnd\"],\n setup(props, { emit }) {\n const containerRef = ref<HTMLElement | null>(null);\n const instance = ref<NamiruChatInstance | null>(null);\n\n async function initialize() {\n const { init } = await import(\"@namiruai/chat\");\n\n const config: NamiruChatConfig = {\n agentId: props.agentId,\n onLeadCapture: (lead: LeadCaptureData) => emit(\"leadCapture\", lead),\n onFeedback: (rating: \"up\" | \"down\") => emit(\"feedback\", rating),\n onSessionStart: (id: string) => emit(\"sessionStart\", id),\n onSessionEnd: (id: string) => emit(\"sessionEnd\", id),\n };\n\n instance.value = init(config);\n }\n\n onMounted(() => {\n initialize();\n });\n\n onBeforeUnmount(() => {\n instance.value?.destroy();\n instance.value = null;\n });\n\n // agentId change triggers full re-init\n watch(\n () => props.agentId,\n () => {\n instance.value?.destroy();\n instance.value = null;\n initialize();\n }\n );\n\n return () => {\n return h(\"div\", { ref: containerRef });\n };\n },\n});\n\nexport type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from \"@namiruai/chat\";\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAOO,eAOMF,KAAa,mBAAgB,CACxC,KAAM,aACN,MAAO,CACL,QAAS,CAAE,KAAM,OAAQ,SAAU,EAAK,CAC1C,EACA,MAAO,CAAC,cAAe,WAAY,eAAgB,YAAY,EAC/D,MAAMG,EAAO,CAAE,KAAAC,CAAK,EAAG,CACrB,IAAMC,KAAe,OAAwB,IAAI,EAC3CC,KAAW,OAA+B,IAAI,EAEpD,eAAeC,GAAa,CAC1B,GAAM,CAAE,KAAAC,CAAK,EAAI,KAAM,QAAO,gBAAgB,EAExCC,EAA2B,CAC/B,QAASN,EAAM,QACf,cAAgBO,GAA0BN,EAAK,cAAeM,CAAI,EAClE,WAAaC,GAA0BP,EAAK,WAAYO,CAAM,EAC9D,eAAiBC,GAAeR,EAAK,eAAgBQ,CAAE,EACvD,aAAeA,GAAeR,EAAK,aAAcQ,CAAE,CACrD,EAEAN,EAAS,MAAQE,EAAKC,CAAM,CAC9B,CAEA,sBAAU,IAAM,CACdF,EAAW,CACb,CAAC,KAED,mBAAgB,IAAM,CACpBD,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,IACnB,CAAC,KAGD,SACE,IAAMH,EAAM,QACZ,IAAM,CACJG,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,KACjBC,EAAW,CACb,CACF,EAEO,OACE,KAAE,MAAO,CAAE,IAAKF,CAAa,CAAC,CAEzC,CACF,CAAC",
6
- "names": ["src_exports", "__export", "NamiruChat", "__toCommonJS", "import_vue", "props", "emit", "containerRef", "instance", "initialize", "init", "config", "lead", "rating", "id"]
4
+ "sourcesContent": ["import {\n defineComponent,\n ref,\n onMounted,\n onBeforeUnmount,\n watch,\n h,\n type PropType,\n} from \"vue\";\nimport type {\n NamiruChatConfig,\n NamiruChatInstance,\n LeadCaptureData,\n} from \"@namiruai/chat\";\n\nexport const NamiruChat = defineComponent({\n name: \"NamiruChat\",\n props: {\n agentId: { type: String, required: true },\n mode: { type: String as PropType<\"button\" | \"inline\">, default: undefined },\n position: { type: String as PropType<\"bottom-right\" | \"bottom-left\">, default: undefined },\n width: { type: String, default: undefined },\n height: { type: String, default: undefined },\n },\n emits: [\"leadCapture\", \"feedback\", \"sessionStart\", \"sessionEnd\"],\n setup(props, { emit }) {\n const containerRef = ref<HTMLElement | null>(null);\n const instance = ref<NamiruChatInstance | null>(null);\n\n async function initialize() {\n const { init } = await import(\"@namiruai/chat\");\n\n const config: NamiruChatConfig = {\n agentId: props.agentId,\n ...(props.mode && { mode: props.mode }),\n ...(props.position && { position: props.position }),\n ...(props.width && { width: props.width }),\n ...(props.height && { height: props.height }),\n onLeadCapture: (lead: LeadCaptureData) => emit(\"leadCapture\", lead),\n onFeedback: (rating: \"up\" | \"down\") => emit(\"feedback\", rating),\n onSessionStart: (id: string) => emit(\"sessionStart\", id),\n onSessionEnd: (id: string) => emit(\"sessionEnd\", id),\n };\n\n instance.value = init(config);\n }\n\n onMounted(() => {\n initialize();\n });\n\n onBeforeUnmount(() => {\n instance.value?.destroy();\n instance.value = null;\n });\n\n // agentId change triggers full re-init\n watch(\n () => props.agentId,\n () => {\n instance.value?.destroy();\n instance.value = null;\n initialize();\n }\n );\n\n return () => {\n const style = props.mode === \"inline\"\n ? { width: props.width, height: props.height }\n : undefined;\n return h(\"div\", { ref: containerRef, style });\n };\n },\n});\n\nexport type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from \"@namiruai/chat\";\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,eAOMF,KAAa,mBAAgB,CACxC,KAAM,aACN,MAAO,CACL,QAAS,CAAE,KAAM,OAAQ,SAAU,EAAK,EACxC,KAAM,CAAE,KAAM,OAAyC,QAAS,MAAU,EAC1E,SAAU,CAAE,KAAM,OAAoD,QAAS,MAAU,EACzF,MAAO,CAAE,KAAM,OAAQ,QAAS,MAAU,EAC1C,OAAQ,CAAE,KAAM,OAAQ,QAAS,MAAU,CAC7C,EACA,MAAO,CAAC,cAAe,WAAY,eAAgB,YAAY,EAC/D,MAAMG,EAAO,CAAE,KAAAC,CAAK,EAAG,CACrB,IAAMC,KAAe,OAAwB,IAAI,EAC3CC,KAAW,OAA+B,IAAI,EAEpD,eAAeC,GAAa,CAC1B,GAAM,CAAE,KAAAC,CAAK,EAAI,KAAM,QAAO,gBAAgB,EAExCC,EAA2B,CAC/B,QAASN,EAAM,QACf,GAAIA,EAAM,MAAQ,CAAE,KAAMA,EAAM,IAAK,EACrC,GAAIA,EAAM,UAAY,CAAE,SAAUA,EAAM,QAAS,EACjD,GAAIA,EAAM,OAAS,CAAE,MAAOA,EAAM,KAAM,EACxC,GAAIA,EAAM,QAAU,CAAE,OAAQA,EAAM,MAAO,EAC3C,cAAgBO,GAA0BN,EAAK,cAAeM,CAAI,EAClE,WAAaC,GAA0BP,EAAK,WAAYO,CAAM,EAC9D,eAAiBC,GAAeR,EAAK,eAAgBQ,CAAE,EACvD,aAAeA,GAAeR,EAAK,aAAcQ,CAAE,CACrD,EAEAN,EAAS,MAAQE,EAAKC,CAAM,CAC9B,CAEA,sBAAU,IAAM,CACdF,EAAW,CACb,CAAC,KAED,mBAAgB,IAAM,CACpBD,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,IACnB,CAAC,KAGD,SACE,IAAMH,EAAM,QACZ,IAAM,CACJG,EAAS,OAAO,QAAQ,EACxBA,EAAS,MAAQ,KACjBC,EAAW,CACb,CACF,EAEO,IAAM,CACX,IAAMM,EAAQV,EAAM,OAAS,SACzB,CAAE,MAAOA,EAAM,MAAO,OAAQA,EAAM,MAAO,EAC3C,OACJ,SAAO,KAAE,MAAO,CAAE,IAAKE,EAAc,MAAAQ,CAAM,CAAC,CAC9C,CACF,CACF,CAAC",
6
+ "names": ["src_exports", "__export", "NamiruChat", "__toCommonJS", "import_vue", "props", "emit", "containerRef", "instance", "initialize", "init", "config", "lead", "rating", "id", "style"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiruai/vue",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Vue wrapper for Namiru AI chat widget",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",