@namiruai/vue 1.3.0 → 1.5.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 +0 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,6 @@ import { NamiruChat } from '@namiruai/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
|
-
}>, {
|
|
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
|
|
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
|
package/dist/index.esm.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": "AAAA,OACE,mBAAAA,EACA,OAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,KAAAC,
|
|
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
|
|
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,
|
|
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
|
}
|