@namiruai/vue 1.0.0 → 1.2.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/dist/index.d.ts CHANGED
@@ -1,37 +1,8 @@
1
- import { type PropType } from "vue";
2
- import type { PreChatCustomConfig } from "@namiruai/chat";
3
1
  export declare const NamiruChat: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
2
  agentId: {
5
3
  type: StringConstructor;
6
4
  required: true;
7
5
  };
8
- serverUrl: {
9
- type: StringConstructor;
10
- };
11
- mode: {
12
- type: PropType<"button" | "inline">;
13
- };
14
- position: {
15
- type: PropType<"bottom-left" | "bottom-right">;
16
- };
17
- preChatEnabled: {
18
- type: BooleanConstructor;
19
- };
20
- preChatTemplate: {
21
- type: PropType<"ecommerce" | "saas" | "services" | "custom" | null>;
22
- };
23
- preChatCustom: {
24
- type: PropType<PreChatCustomConfig>;
25
- };
26
- greetingDelay: {
27
- type: NumberConstructor;
28
- };
29
- width: {
30
- type: StringConstructor;
31
- };
32
- height: {
33
- type: StringConstructor;
34
- };
35
6
  }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
7
  [key: string]: any;
37
8
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("leadCapture" | "feedback" | "sessionStart" | "sessionEnd")[], "leadCapture" | "feedback" | "sessionStart" | "sessionEnd", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -39,39 +10,10 @@ export declare const NamiruChat: import("vue").DefineComponent<import("vue").Ext
39
10
  type: StringConstructor;
40
11
  required: true;
41
12
  };
42
- serverUrl: {
43
- type: StringConstructor;
44
- };
45
- mode: {
46
- type: PropType<"button" | "inline">;
47
- };
48
- position: {
49
- type: PropType<"bottom-left" | "bottom-right">;
50
- };
51
- preChatEnabled: {
52
- type: BooleanConstructor;
53
- };
54
- preChatTemplate: {
55
- type: PropType<"ecommerce" | "saas" | "services" | "custom" | null>;
56
- };
57
- preChatCustom: {
58
- type: PropType<PreChatCustomConfig>;
59
- };
60
- greetingDelay: {
61
- type: NumberConstructor;
62
- };
63
- width: {
64
- type: StringConstructor;
65
- };
66
- height: {
67
- type: StringConstructor;
68
- };
69
13
  }>> & Readonly<{
70
14
  onLeadCapture?: ((...args: any[]) => any) | undefined;
71
15
  onFeedback?: ((...args: any[]) => any) | undefined;
72
16
  onSessionStart?: ((...args: any[]) => any) | undefined;
73
17
  onSessionEnd?: ((...args: any[]) => any) | undefined;
74
- }>, {
75
- preChatEnabled: boolean;
76
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
77
19
  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 l,onMounted as C,onBeforeUnmount as m,watch as h,h as g}from"vue";var y=d({name:"NamiruChat",props:{agentId:{type:String,required:!0},serverUrl:{type:String},mode:{type:String},position:{type:String},preChatEnabled:{type:Boolean},preChatTemplate:{type:String},preChatCustom:{type:Object},greetingDelay:{type:Number},width:{type:String},height:{type:String}},emits:["leadCapture","feedback","sessionStart","sessionEnd"],setup(e,{emit:n}){let r=l(null),a=l(null);async function o(){let{init:i}=await import("@namiruai/chat"),u={agentId:e.agentId,serverUrl:e.serverUrl,mode:e.mode,position:e.position,container:e.mode==="inline"?r.value??void 0:void 0,preChatEnabled:e.preChatEnabled,preChatTemplate:e.preChatTemplate,preChatCustom:e.preChatCustom,greetingDelay:e.greetingDelay,width:e.width,height:e.height,onLeadCapture:t=>n("leadCapture",t),onFeedback:t=>n("feedback",t),onSessionStart:t=>n("sessionStart",t),onSessionEnd:t=>n("sessionEnd",t)};a.value=i(u)}return C(()=>{o()}),m(()=>{a.value?.destroy(),a.value=null}),h(()=>e.agentId,()=>{a.value?.destroy(),a.value=null,o()}),h(()=>[e.serverUrl,e.mode,e.position,e.preChatEnabled,e.preChatTemplate,e.preChatCustom,e.greetingDelay,e.width,e.height],()=>{a.value?.updateConfig({serverUrl:e.serverUrl,mode:e.mode,position:e.position,preChatEnabled:e.preChatEnabled,preChatTemplate:e.preChatTemplate,preChatCustom:e.preChatCustom,greetingDelay:e.greetingDelay,width:e.width,height:e.height})}),()=>{let i=e.mode==="inline"?{width:"100%",height:"100%"}:void 0;return g("div",{ref:r,style:i})}}});export{y as NamiruChat};
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};
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 type PropType,\n} from \"vue\";\nimport type {\n NamiruChatConfig,\n NamiruChatInstance,\n LeadCaptureData,\n PreChatCustomConfig,\n} from \"@namiruai/chat\";\n\nexport const NamiruChat = defineComponent({\n name: \"NamiruChat\",\n props: {\n agentId: { type: String, required: true },\n serverUrl: { type: String },\n mode: { type: String as PropType<\"button\" | \"inline\"> },\n position: { type: String as PropType<\"bottom-left\" | \"bottom-right\"> },\n preChatEnabled: { type: Boolean },\n preChatTemplate: {\n type: String as PropType<\n \"ecommerce\" | \"saas\" | \"services\" | \"custom\" | null\n >,\n },\n preChatCustom: { type: Object as PropType<PreChatCustomConfig> },\n greetingDelay: { type: Number },\n width: { type: String },\n height: { type: String },\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 serverUrl: props.serverUrl,\n mode: props.mode,\n position: props.position,\n container:\n props.mode === \"inline\" ? containerRef.value ?? undefined : undefined,\n preChatEnabled: props.preChatEnabled,\n preChatTemplate: props.preChatTemplate,\n preChatCustom: props.preChatCustom,\n greetingDelay: props.greetingDelay,\n width: props.width,\n 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 // Other prop changes trigger updateConfig\n watch(\n () => [\n props.serverUrl,\n props.mode,\n props.position,\n props.preChatEnabled,\n props.preChatTemplate,\n props.preChatCustom,\n props.greetingDelay,\n props.width,\n props.height,\n ],\n () => {\n instance.value?.updateConfig({\n serverUrl: props.serverUrl,\n mode: props.mode,\n position: props.position,\n preChatEnabled: props.preChatEnabled,\n preChatTemplate: props.preChatTemplate,\n preChatCustom: props.preChatCustom,\n greetingDelay: props.greetingDelay,\n width: props.width,\n height: props.height,\n });\n }\n );\n\n return () => {\n const style =\n props.mode === \"inline\"\n ? { width: \"100%\", height: \"100%\" }\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,MAQA,IAAMC,EAAaN,EAAgB,CACxC,KAAM,aACN,MAAO,CACL,QAAS,CAAE,KAAM,OAAQ,SAAU,EAAK,EACxC,UAAW,CAAE,KAAM,MAAO,EAC1B,KAAM,CAAE,KAAM,MAAwC,EACtD,SAAU,CAAE,KAAM,MAAmD,EACrE,eAAgB,CAAE,KAAM,OAAQ,EAChC,gBAAiB,CACf,KAAM,MAGR,EACA,cAAe,CAAE,KAAM,MAAwC,EAC/D,cAAe,CAAE,KAAM,MAAO,EAC9B,MAAO,CAAE,KAAM,MAAO,EACtB,OAAQ,CAAE,KAAM,MAAO,CACzB,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,UAAWA,EAAM,UACjB,KAAMA,EAAM,KACZ,SAAUA,EAAM,SAChB,UACEA,EAAM,OAAS,SAAWE,EAAa,OAAS,OAAY,OAC9D,eAAgBF,EAAM,eACtB,gBAAiBA,EAAM,gBACvB,cAAeA,EAAM,cACrB,cAAeA,EAAM,cACrB,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,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,EAGAP,EACE,IAAM,CACJG,EAAM,UACNA,EAAM,KACNA,EAAM,SACNA,EAAM,eACNA,EAAM,gBACNA,EAAM,cACNA,EAAM,cACNA,EAAM,MACNA,EAAM,MACR,EACA,IAAM,CACJG,EAAS,OAAO,aAAa,CAC3B,UAAWH,EAAM,UACjB,KAAMA,EAAM,KACZ,SAAUA,EAAM,SAChB,eAAgBA,EAAM,eACtB,gBAAiBA,EAAM,gBACvB,cAAeA,EAAM,cACrB,cAAeA,EAAM,cACrB,MAAOA,EAAM,MACb,OAAQA,EAAM,MAChB,CAAC,CACH,CACF,EAEO,IAAM,CACX,IAAMU,EACJV,EAAM,OAAS,SACX,CAAE,MAAO,OAAQ,OAAQ,MAAO,EAChC,OACN,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"]
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"]
7
7
  }
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var C=Object.create;var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of g(t))!y.call(e,r)&&r!==n&&l(e,r,{get:()=>t[r],enumerable:!(i=m(t,r))||i.enumerable});return e};var f=(e,t,n)=>(n=e!=null?C(s(e)):{},u(t||!e||!e.__esModule?l(n,"default",{value:e,enumerable:!0}):n,e)),v=e=>u(l({},"__esModule",{value:!0}),e);var S={};c(S,{NamiruChat:()=>b});module.exports=v(S);var a=require("vue"),b=(0,a.defineComponent)({name:"NamiruChat",props:{agentId:{type:String,required:!0},serverUrl:{type:String},mode:{type:String},position:{type:String},preChatEnabled:{type:Boolean},preChatTemplate:{type:String},preChatCustom:{type:Object},greetingDelay:{type:Number},width:{type:String},height:{type:String}},emits:["leadCapture","feedback","sessionStart","sessionEnd"],setup(e,{emit:t}){let n=(0,a.ref)(null),i=(0,a.ref)(null);async function r(){let{init:h}=await import("@namiruai/chat"),d={agentId:e.agentId,serverUrl:e.serverUrl,mode:e.mode,position:e.position,container:e.mode==="inline"?n.value??void 0:void 0,preChatEnabled:e.preChatEnabled,preChatTemplate:e.preChatTemplate,preChatCustom:e.preChatCustom,greetingDelay:e.greetingDelay,width:e.width,height:e.height,onLeadCapture:o=>t("leadCapture",o),onFeedback:o=>t("feedback",o),onSessionStart:o=>t("sessionStart",o),onSessionEnd:o=>t("sessionEnd",o)};i.value=h(d)}return(0,a.onMounted)(()=>{r()}),(0,a.onBeforeUnmount)(()=>{i.value?.destroy(),i.value=null}),(0,a.watch)(()=>e.agentId,()=>{i.value?.destroy(),i.value=null,r()}),(0,a.watch)(()=>[e.serverUrl,e.mode,e.position,e.preChatEnabled,e.preChatTemplate,e.preChatCustom,e.greetingDelay,e.width,e.height],()=>{i.value?.updateConfig({serverUrl:e.serverUrl,mode:e.mode,position:e.position,preChatEnabled:e.preChatEnabled,preChatTemplate:e.preChatTemplate,preChatCustom:e.preChatCustom,greetingDelay:e.greetingDelay,width:e.width,height:e.height})}),()=>{let h=e.mode==="inline"?{width:"100%",height:"100%"}:void 0;return(0,a.h)("div",{ref:n,style:h})}}});
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})}});
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 type PropType,\n} from \"vue\";\nimport type {\n NamiruChatConfig,\n NamiruChatInstance,\n LeadCaptureData,\n PreChatCustomConfig,\n} from \"@namiruai/chat\";\n\nexport const NamiruChat = defineComponent({\n name: \"NamiruChat\",\n props: {\n agentId: { type: String, required: true },\n serverUrl: { type: String },\n mode: { type: String as PropType<\"button\" | \"inline\"> },\n position: { type: String as PropType<\"bottom-left\" | \"bottom-right\"> },\n preChatEnabled: { type: Boolean },\n preChatTemplate: {\n type: String as PropType<\n \"ecommerce\" | \"saas\" | \"services\" | \"custom\" | null\n >,\n },\n preChatCustom: { type: Object as PropType<PreChatCustomConfig> },\n greetingDelay: { type: Number },\n width: { type: String },\n height: { type: String },\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 serverUrl: props.serverUrl,\n mode: props.mode,\n position: props.position,\n container:\n props.mode === \"inline\" ? containerRef.value ?? undefined : undefined,\n preChatEnabled: props.preChatEnabled,\n preChatTemplate: props.preChatTemplate,\n preChatCustom: props.preChatCustom,\n greetingDelay: props.greetingDelay,\n width: props.width,\n 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 // Other prop changes trigger updateConfig\n watch(\n () => [\n props.serverUrl,\n props.mode,\n props.position,\n props.preChatEnabled,\n props.preChatTemplate,\n props.preChatCustom,\n props.greetingDelay,\n props.width,\n props.height,\n ],\n () => {\n instance.value?.updateConfig({\n serverUrl: props.serverUrl,\n mode: props.mode,\n position: props.position,\n preChatEnabled: props.preChatEnabled,\n preChatTemplate: props.preChatTemplate,\n preChatCustom: props.preChatCustom,\n greetingDelay: props.greetingDelay,\n width: props.width,\n height: props.height,\n });\n }\n );\n\n return () => {\n const style =\n props.mode === \"inline\"\n ? { width: \"100%\", height: \"100%\" }\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,eAQMF,KAAa,mBAAgB,CACxC,KAAM,aACN,MAAO,CACL,QAAS,CAAE,KAAM,OAAQ,SAAU,EAAK,EACxC,UAAW,CAAE,KAAM,MAAO,EAC1B,KAAM,CAAE,KAAM,MAAwC,EACtD,SAAU,CAAE,KAAM,MAAmD,EACrE,eAAgB,CAAE,KAAM,OAAQ,EAChC,gBAAiB,CACf,KAAM,MAGR,EACA,cAAe,CAAE,KAAM,MAAwC,EAC/D,cAAe,CAAE,KAAM,MAAO,EAC9B,MAAO,CAAE,KAAM,MAAO,EACtB,OAAQ,CAAE,KAAM,MAAO,CACzB,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,UAAWA,EAAM,UACjB,KAAMA,EAAM,KACZ,SAAUA,EAAM,SAChB,UACEA,EAAM,OAAS,SAAWE,EAAa,OAAS,OAAY,OAC9D,eAAgBF,EAAM,eACtB,gBAAiBA,EAAM,gBACvB,cAAeA,EAAM,cACrB,cAAeA,EAAM,cACrB,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,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,KAGA,SACE,IAAM,CACJJ,EAAM,UACNA,EAAM,KACNA,EAAM,SACNA,EAAM,eACNA,EAAM,gBACNA,EAAM,cACNA,EAAM,cACNA,EAAM,MACNA,EAAM,MACR,EACA,IAAM,CACJG,EAAS,OAAO,aAAa,CAC3B,UAAWH,EAAM,UACjB,KAAMA,EAAM,KACZ,SAAUA,EAAM,SAChB,eAAgBA,EAAM,eACtB,gBAAiBA,EAAM,gBACvB,cAAeA,EAAM,cACrB,cAAeA,EAAM,cACrB,MAAOA,EAAM,MACb,OAAQA,EAAM,MAChB,CAAC,CACH,CACF,EAEO,IAAM,CACX,IAAMU,EACJV,EAAM,OAAS,SACX,CAAE,MAAO,OAAQ,OAAQ,MAAO,EAChC,OACN,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"]
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"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiruai/vue",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Vue wrapper for Namiru AI chat widget",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -12,7 +12,11 @@
12
12
  "types": "./dist/index.d.ts"
13
13
  }
14
14
  },
15
- "files": ["dist", "LICENSE", "README.md"],
15
+ "files": [
16
+ "dist",
17
+ "LICENSE",
18
+ "README.md"
19
+ ],
16
20
  "sideEffects": false,
17
21
  "license": "MIT",
18
22
  "author": "Namiru <hello@namiru.ai>",
@@ -21,7 +25,15 @@
21
25
  "type": "git",
22
26
  "url": "https://github.com/namiru-ai/namiru"
23
27
  },
24
- "keywords": ["vue", "chat", "widget", "ai", "customer-support", "chatbot", "namiru"],
28
+ "keywords": [
29
+ "vue",
30
+ "chat",
31
+ "widget",
32
+ "ai",
33
+ "customer-support",
34
+ "chatbot",
35
+ "namiru"
36
+ ],
25
37
  "scripts": {
26
38
  "build": "node build.js",
27
39
  "dev": "node build.js --watch"