@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 +1 -59
- 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 +15 -3
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
|
|
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
|
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
|
|
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} 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
|
|
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
|
|
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} 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.
|
|
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": [
|
|
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": [
|
|
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"
|