@namiruai/angular 1.12.0 → 1.13.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,2 +1 @@
1
1
  export { NamiruChatComponent } from "./namiru-chat.component";
2
- export type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from "./namiru-chat.component";
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var n=(r,e,t,s)=>{for(var a=s>1?void 0:s?m(e,t):e,h=r.length-1,c;h>=0;h--)(c=r[h])&&(a=(s?c(e,t,a):c(a))||a);return s&&a&&u(e,t,a),a};import{Component as p,EventEmitter as d,Input as o,Output as g,ViewChild as f}from"@angular/core";var l="https://namiru.ai/widget.js";function w(){return new Promise((r,e)=>{if(window.NamiruChat){r();return}let t=document.querySelector(`script[src="${l}"]`);if(t){t.addEventListener("load",()=>r()),t.addEventListener("error",()=>e(new Error("Failed to load Namiru widget script")));return}let s=document.createElement("script");s.src=l,s.async=!0,s.onload=()=>r(),s.onerror=()=>e(new Error("Failed to load Namiru widget script")),document.head.appendChild(s)})}var i=class{constructor(){this.leadCapture=new d;this.feedback=new d;this.sessionStart=new d;this.sessionEnd=new d;this.instance=null}async ngOnInit(){if(await w(),!window.NamiruChat)return;let e={agentId:this.agentId,...this.mode&&{mode:this.mode},...this.position&&{position:this.position},...this.width&&{width:this.width},...this.height&&{height:this.height},onLeadCapture:t=>this.leadCapture.emit(t),onFeedback:t=>this.feedback.emit(t),onSessionStart:t=>this.sessionStart.emit(t),onSessionEnd:t=>this.sessionEnd.emit(t)};this.instance=window.NamiruChat.init(e)}ngOnChanges(e){this.instance&&e.agentId&&!e.agentId.firstChange&&(this.instance.destroy(),this.ngOnInit())}ngOnDestroy(){this.instance?.destroy(),this.instance=null}};n([o()],i.prototype,"agentId",2),n([o()],i.prototype,"mode",2),n([o()],i.prototype,"position",2),n([o()],i.prototype,"width",2),n([o()],i.prototype,"height",2),n([g()],i.prototype,"leadCapture",2),n([g()],i.prototype,"feedback",2),n([g()],i.prototype,"sessionStart",2),n([g()],i.prototype,"sessionEnd",2),n([f("container",{static:!0})],i.prototype,"containerRef",2),i=n([p({selector:"namiru-chat",standalone:!0,template:`<div #container [style.width]="mode === 'inline' ? width : null" [style.height]="mode === 'inline' ? height : null"></div>`})],i);export{i as NamiruChatComponent};
1
+ var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var e=(s,i,r,n)=>{for(var d=n>1?void 0:n?g(i,r):i,a=s.length-1,h;a>=0;a--)(h=s[a])&&(d=(n?h(i,r,d):h(d))||d);return n&&d&&c(i,r,d),d};import{Component as w,Input as o,ViewChild as u}from"@angular/core";var l="https://namiru.ai/widget.js";function m(){return new Promise((s,i)=>{if(window.NamiruChat){s();return}let r=document.querySelector(`script[src="${l}"]`);if(r){r.addEventListener("load",()=>s()),r.addEventListener("error",()=>i(new Error("Failed to load Namiru widget script")));return}let n=document.createElement("script");n.src=l,n.async=!0,n.onload=()=>s(),n.onerror=()=>i(new Error("Failed to load Namiru widget script")),document.head.appendChild(n)})}var t=class{constructor(){this.instance=null}async ngOnInit(){await m(),window.NamiruChat&&(this.instance=window.NamiruChat.init({agentId:this.agentId,...this.mode&&{mode:this.mode},...this.position&&{position:this.position},...this.width&&{width:this.width},...this.height&&{height:this.height}}))}ngOnChanges(i){this.instance&&i.agentId&&!i.agentId.firstChange&&(this.instance.destroy(),this.ngOnInit())}ngOnDestroy(){this.instance?.destroy(),this.instance=null}};e([o()],t.prototype,"agentId",2),e([o()],t.prototype,"mode",2),e([o()],t.prototype,"position",2),e([o()],t.prototype,"width",2),e([o()],t.prototype,"height",2),e([u("container",{static:!0})],t.prototype,"containerRef",2),t=e([w({selector:"namiru-chat",standalone:!0,template:`<div #container [style.width]="mode === 'inline' ? width : null" [style.height]="mode === 'inline' ? height : null"></div>`})],t);export{t as NamiruChatComponent};
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/namiru-chat.component.ts"],
4
- "sourcesContent": ["import {\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n} from \"@angular/core\";\n\nexport interface LeadCaptureData {\n email?: string;\n name?: string;\n phone?: string;\n company?: string;\n}\n\nexport interface NamiruChatConfig {\n agentId: string;\n mode?: \"button\" | \"inline\";\n position?: \"bottom-right\" | \"bottom-left\";\n width?: string;\n height?: string;\n container?: HTMLElement;\n serverUrl?: string;\n wsUrl?: string;\n onLeadCapture?: (lead: LeadCaptureData) => void;\n onFeedback?: (rating: \"up\" | \"down\") => void;\n onSessionStart?: (sessionId: string) => void;\n onSessionEnd?: (sessionId: string) => void;\n}\n\nexport interface NamiruChatInstance {\n destroy: () => void;\n updateConfig: (config: Partial<NamiruChatConfig>) => void;\n}\n\ndeclare global {\n interface Window {\n NamiruChat?: {\n init: (config: NamiruChatConfig) => NamiruChatInstance;\n };\n }\n}\n\nconst WIDGET_SCRIPT_URL = \"https://namiru.ai/widget.js\";\n\nfunction loadWidgetScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (window.NamiruChat) { resolve(); return; }\n const existing = document.querySelector(`script[src=\"${WIDGET_SCRIPT_URL}\"]`);\n if (existing) {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => reject(new Error(\"Failed to load Namiru widget script\")));\n return;\n }\n const script = document.createElement(\"script\");\n script.src = WIDGET_SCRIPT_URL;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"Failed to load Namiru widget script\"));\n document.head.appendChild(script);\n });\n}\n\n@Component({\n selector: \"namiru-chat\",\n standalone: true,\n template: `<div #container [style.width]=\"mode === 'inline' ? width : null\" [style.height]=\"mode === 'inline' ? height : null\"></div>`,\n})\nexport class NamiruChatComponent implements OnInit, OnDestroy, OnChanges {\n @Input() agentId!: string;\n @Input() mode?: \"button\" | \"inline\";\n @Input() position?: \"bottom-right\" | \"bottom-left\";\n @Input() width?: string;\n @Input() height?: string;\n\n @Output() leadCapture = new EventEmitter<LeadCaptureData>();\n @Output() feedback = new EventEmitter<\"up\" | \"down\">();\n @Output() sessionStart = new EventEmitter<string>();\n @Output() sessionEnd = new EventEmitter<string>();\n\n @ViewChild(\"container\", { static: true }) containerRef!: ElementRef;\n\n private instance: NamiruChatInstance | null = null;\n\n async ngOnInit(): Promise<void> {\n await loadWidgetScript();\n if (!window.NamiruChat) return;\n\n const config: NamiruChatConfig = {\n agentId: this.agentId,\n ...(this.mode && { mode: this.mode }),\n ...(this.position && { position: this.position }),\n ...(this.width && { width: this.width }),\n ...(this.height && { height: this.height }),\n onLeadCapture: (lead) => this.leadCapture.emit(lead),\n onFeedback: (rating) => this.feedback.emit(rating),\n onSessionStart: (id) => this.sessionStart.emit(id),\n onSessionEnd: (id) => this.sessionEnd.emit(id),\n };\n\n this.instance = window.NamiruChat.init(config);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.instance) return;\n if (changes[\"agentId\"] && !changes[\"agentId\"].firstChange) {\n this.instance.destroy();\n this.ngOnInit();\n }\n }\n\n ngOnDestroy(): void {\n this.instance?.destroy();\n this.instance = null;\n }\n}\n"],
5
- "mappings": "wMAAA,OACE,aAAAA,EAEA,gBAAAC,EACA,SAAAC,EAIA,UAAAC,EAEA,aAAAC,MACK,gBAqCP,IAAMC,EAAoB,8BAE1B,SAASC,GAAkC,CACzC,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtC,GAAI,OAAO,WAAY,CAAED,EAAQ,EAAG,MAAQ,CAC5C,IAAME,EAAW,SAAS,cAAc,eAAeJ,CAAiB,IAAI,EAC5E,GAAII,EAAU,CACZA,EAAS,iBAAiB,OAAQ,IAAMF,EAAQ,CAAC,EACjDE,EAAS,iBAAiB,QAAS,IAAMD,EAAO,IAAI,MAAM,q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ACAO,EAAA,CAARC,EAAM,GAJIR,EAIF,qBACAO,EAAA,CAARC,EAAM,GALIR,EAKF,sBAECO,EAAA,CAATE,EAAO,GAPGT,EAOD,2BACAO,EAAA,CAATE,EAAO,GARGT,EAQD,wBACAO,EAAA,CAATE,EAAO,GATGT,EASD,4BACAO,EAAA,CAATE,EAAO,GAVGT,EAUD,0BAEgCO,EAAA,CAAzCG,EAAU,YAAa,CAAE,OAAQ,EAAK,CAAC,GAZ7BV,EAY+B,4BAZ/BA,EAANO,EAAA,CALNI,EAAU,CACT,SAAU,cACV,WAAY,GACZ,SAAU,4HACZ,CAAC,GACYX",
6
- "names": ["Component", "EventEmitter", "Input", "Output", "ViewChild", "WIDGET_SCRIPT_URL", "loadWidgetScript", "resolve", "reject", "existing", "script", "NamiruChatComponent", "EventEmitter", "config", "lead", "rating", "id", "changes", "__decorateClass", "Input", "Output", "ViewChild", "Component"]
4
+ "sourcesContent": ["import {\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n ViewChild,\n} from \"@angular/core\";\n\ndeclare global {\n interface Window {\n NamiruChat?: {\n init: (config: Record<string, unknown>) => { destroy: () => void };\n };\n }\n}\n\nconst WIDGET_SCRIPT_URL = \"https://namiru.ai/widget.js\";\n\nfunction loadWidgetScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (window.NamiruChat) { resolve(); return; }\n const existing = document.querySelector(`script[src=\"${WIDGET_SCRIPT_URL}\"]`);\n if (existing) {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => reject(new Error(\"Failed to load Namiru widget script\")));\n return;\n }\n const script = document.createElement(\"script\");\n script.src = WIDGET_SCRIPT_URL;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"Failed to load Namiru widget script\"));\n document.head.appendChild(script);\n });\n}\n\n@Component({\n selector: \"namiru-chat\",\n standalone: true,\n template: `<div #container [style.width]=\"mode === 'inline' ? width : null\" [style.height]=\"mode === 'inline' ? height : null\"></div>`,\n})\nexport class NamiruChatComponent implements OnInit, OnDestroy, OnChanges {\n @Input() agentId!: string;\n @Input() mode?: \"button\" | \"inline\";\n @Input() position?: \"bottom-right\" | \"bottom-left\";\n @Input() width?: string;\n @Input() height?: string;\n\n @ViewChild(\"container\", { static: true }) containerRef!: ElementRef;\n\n private instance: { destroy: () => void } | null = null;\n\n async ngOnInit(): Promise<void> {\n await loadWidgetScript();\n if (!window.NamiruChat) return;\n\n this.instance = window.NamiruChat.init({\n agentId: this.agentId,\n ...(this.mode && { mode: this.mode }),\n ...(this.position && { position: this.position }),\n ...(this.width && { width: this.width }),\n ...(this.height && { height: this.height }),\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.instance) return;\n if (changes[\"agentId\"] && !changes[\"agentId\"].firstChange) {\n this.instance.destroy();\n this.ngOnInit();\n }\n }\n\n ngOnDestroy(): void {\n this.instance?.destroy();\n this.instance = null;\n }\n}\n"],
5
+ "mappings": "wMAAA,OACE,aAAAA,EAEA,SAAAC,EAKA,aAAAC,MACK,gBAUP,IAAMC,EAAoB,8BAE1B,SAASC,GAAkC,CACzC,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtC,GAAI,OAAO,WAAY,CAAED,EAAQ,EAAG,MAAQ,CAC5C,IAAME,EAAW,SAAS,cAAc,eAAeJ,CAAiB,IAAI,EAC5E,GAAII,EAAU,CACZA,EAAS,iBAAiB,OAAQ,IAAMF,EAAQ,CAAC,EACjDE,EAAS,iBAAiB,QAAS,IAAMD,EAAO,IAAI,MAAM,qCAAqC,CAAC,CAAC,EACjG,MACF,CACA,IAAME,EAAS,SAAS,cAAc,QAAQ,EAC9CA,EAAO,IAAML,EACbK,EAAO,MAAQ,GACfA,EAAO,OAAS,IAAMH,EAAQ,EAC9BG,EAAO,QAAU,IAAMF,EAAO,IAAI,MAAM,qCAAqC,CAAC,EAC9E,SAAS,KAAK,YAAYE,CAAM,CAClC,CAAC,CACH,CAOO,IAAMC,EAAN,KAAkE,CAAlE,cASL,KAAQ,SAA2C,KAEnD,MAAM,UAA0B,CAC9B,MAAML,EAAiB,EAClB,OAAO,aAEZ,KAAK,SAAW,OAAO,WAAW,KAAK,CACrC,QAAS,KAAK,QACd,GAAI,KAAK,MAAQ,CAAE,KAAM,KAAK,IAAK,EACnC,GAAI,KAAK,UAAY,CAAE,SAAU,KAAK,QAAS,EAC/C,GAAI,KAAK,OAAS,CAAE,MAAO,KAAK,KAAM,EACtC,GAAI,KAAK,QAAU,CAAE,OAAQ,KAAK,MAAO,CAC3C,CAAC,EACH,CAEA,YAAYM,EAA8B,CACnC,KAAK,UACNA,EAAQ,SAAc,CAACA,EAAQ,QAAW,cAC5C,KAAK,SAAS,QAAQ,EACtB,KAAK,SAAS,EAElB,CAEA,aAAoB,CAClB,KAAK,UAAU,QAAQ,EACvB,KAAK,SAAW,IAClB,CACF,EAnCWC,EAAA,CAARC,EAAM,GADIH,EACF,uBACAE,EAAA,CAARC,EAAM,GAFIH,EAEF,oBACAE,EAAA,CAARC,EAAM,GAHIH,EAGF,wBACAE,EAAA,CAARC,EAAM,GAJIH,EAIF,qBACAE,EAAA,CAARC,EAAM,GALIH,EAKF,sBAEiCE,EAAA,CAAzCE,EAAU,YAAa,CAAE,OAAQ,EAAK,CAAC,GAP7BJ,EAO+B,4BAP/BA,EAANE,EAAA,CALNG,EAAU,CACT,SAAU,cACV,WAAY,GACZ,SAAU,4HACZ,CAAC,GACYL",
6
+ "names": ["Component", "Input", "ViewChild", "WIDGET_SCRIPT_URL", "loadWidgetScript", "resolve", "reject", "existing", "script", "NamiruChatComponent", "changes", "__decorateClass", "Input", "ViewChild", "Component"]
7
7
  }
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(s,t)=>{for(var i in t)d(s,i,{get:t[i],enumerable:!0})},f=(s,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of u(t))!m.call(s,a)&&a!==i&&d(s,a,{get:()=>t[a],enumerable:!(r=c(t,a))||r.enumerable});return s};var w=s=>f(d({},"__esModule",{value:!0}),s),o=(s,t,i,r)=>{for(var a=r>1?void 0:r?c(t,i):t,g=s.length-1,h;g>=0;g--)(h=s[g])&&(a=(r?h(t,i,a):h(a))||a);return r&&a&&d(t,i,a),a};var v={};p(v,{NamiruChatComponent:()=>n});module.exports=w(v);var e=require("@angular/core");var l="https://namiru.ai/widget.js";function I(){return new Promise((s,t)=>{if(window.NamiruChat){s();return}let i=document.querySelector(`script[src="${l}"]`);if(i){i.addEventListener("load",()=>s()),i.addEventListener("error",()=>t(new Error("Failed to load Namiru widget script")));return}let r=document.createElement("script");r.src=l,r.async=!0,r.onload=()=>s(),r.onerror=()=>t(new Error("Failed to load Namiru widget script")),document.head.appendChild(r)})}var n=class{constructor(){this.leadCapture=new e.EventEmitter;this.feedback=new e.EventEmitter;this.sessionStart=new e.EventEmitter;this.sessionEnd=new e.EventEmitter;this.instance=null}async ngOnInit(){if(await I(),!window.NamiruChat)return;let t={agentId:this.agentId,...this.mode&&{mode:this.mode},...this.position&&{position:this.position},...this.width&&{width:this.width},...this.height&&{height:this.height},onLeadCapture:i=>this.leadCapture.emit(i),onFeedback:i=>this.feedback.emit(i),onSessionStart:i=>this.sessionStart.emit(i),onSessionEnd:i=>this.sessionEnd.emit(i)};this.instance=window.NamiruChat.init(t)}ngOnChanges(t){this.instance&&t.agentId&&!t.agentId.firstChange&&(this.instance.destroy(),this.ngOnInit())}ngOnDestroy(){this.instance?.destroy(),this.instance=null}};o([(0,e.Input)()],n.prototype,"agentId",2),o([(0,e.Input)()],n.prototype,"mode",2),o([(0,e.Input)()],n.prototype,"position",2),o([(0,e.Input)()],n.prototype,"width",2),o([(0,e.Input)()],n.prototype,"height",2),o([(0,e.Output)()],n.prototype,"leadCapture",2),o([(0,e.Output)()],n.prototype,"feedback",2),o([(0,e.Output)()],n.prototype,"sessionStart",2),o([(0,e.Output)()],n.prototype,"sessionEnd",2),o([(0,e.ViewChild)("container",{static:!0})],n.prototype,"containerRef",2),n=o([(0,e.Component)({selector:"namiru-chat",standalone:!0,template:`<div #container [style.width]="mode === 'inline' ? width : null" [style.height]="mode === 'inline' ? height : null"></div>`})],n);
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var m=(i,t)=>{for(var s in t)a(i,s,{get:t[s],enumerable:!0})},f=(i,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of w(t))!u.call(i,e)&&e!==s&&a(i,e,{get:()=>t[e],enumerable:!(n=c(t,e))||n.enumerable});return i};var p=i=>f(a({},"__esModule",{value:!0}),i),o=(i,t,s,n)=>{for(var e=n>1?void 0:n?c(t,s):t,h=i.length-1,l;h>=0;h--)(l=i[h])&&(e=(n?l(t,s,e):l(e))||e);return n&&e&&a(t,s,e),e};var I={};m(I,{NamiruChatComponent:()=>r});module.exports=p(I);var d=require("@angular/core");var g="https://namiru.ai/widget.js";function y(){return new Promise((i,t)=>{if(window.NamiruChat){i();return}let s=document.querySelector(`script[src="${g}"]`);if(s){s.addEventListener("load",()=>i()),s.addEventListener("error",()=>t(new Error("Failed to load Namiru widget script")));return}let n=document.createElement("script");n.src=g,n.async=!0,n.onload=()=>i(),n.onerror=()=>t(new Error("Failed to load Namiru widget script")),document.head.appendChild(n)})}var r=class{constructor(){this.instance=null}async ngOnInit(){await y(),window.NamiruChat&&(this.instance=window.NamiruChat.init({agentId:this.agentId,...this.mode&&{mode:this.mode},...this.position&&{position:this.position},...this.width&&{width:this.width},...this.height&&{height:this.height}}))}ngOnChanges(t){this.instance&&t.agentId&&!t.agentId.firstChange&&(this.instance.destroy(),this.ngOnInit())}ngOnDestroy(){this.instance?.destroy(),this.instance=null}};o([(0,d.Input)()],r.prototype,"agentId",2),o([(0,d.Input)()],r.prototype,"mode",2),o([(0,d.Input)()],r.prototype,"position",2),o([(0,d.Input)()],r.prototype,"width",2),o([(0,d.Input)()],r.prototype,"height",2),o([(0,d.ViewChild)("container",{static:!0})],r.prototype,"containerRef",2),r=o([(0,d.Component)({selector:"namiru-chat",standalone:!0,template:`<div #container [style.width]="mode === 'inline' ? width : null" [style.height]="mode === 'inline' ? height : null"></div>`})],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", "../src/namiru-chat.component.ts"],
4
- "sourcesContent": ["export { NamiruChatComponent } from \"./namiru-chat.component\";\nexport type { NamiruChatConfig, NamiruChatInstance, LeadCaptureData } from \"./namiru-chat.component\";\n", "import {\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n} from \"@angular/core\";\n\nexport interface LeadCaptureData {\n email?: string;\n name?: string;\n phone?: string;\n company?: string;\n}\n\nexport interface NamiruChatConfig {\n agentId: string;\n mode?: \"button\" | \"inline\";\n position?: \"bottom-right\" | \"bottom-left\";\n width?: string;\n height?: string;\n container?: HTMLElement;\n serverUrl?: string;\n wsUrl?: string;\n onLeadCapture?: (lead: LeadCaptureData) => void;\n onFeedback?: (rating: \"up\" | \"down\") => void;\n onSessionStart?: (sessionId: string) => void;\n onSessionEnd?: (sessionId: string) => void;\n}\n\nexport interface NamiruChatInstance {\n destroy: () => void;\n updateConfig: (config: Partial<NamiruChatConfig>) => void;\n}\n\ndeclare global {\n interface Window {\n NamiruChat?: {\n init: (config: NamiruChatConfig) => NamiruChatInstance;\n };\n }\n}\n\nconst WIDGET_SCRIPT_URL = \"https://namiru.ai/widget.js\";\n\nfunction loadWidgetScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (window.NamiruChat) { resolve(); return; }\n const existing = document.querySelector(`script[src=\"${WIDGET_SCRIPT_URL}\"]`);\n if (existing) {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => reject(new Error(\"Failed to load Namiru widget script\")));\n return;\n }\n const script = document.createElement(\"script\");\n script.src = WIDGET_SCRIPT_URL;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"Failed to load Namiru widget script\"));\n document.head.appendChild(script);\n });\n}\n\n@Component({\n selector: \"namiru-chat\",\n standalone: true,\n template: `<div #container [style.width]=\"mode === 'inline' ? width : null\" [style.height]=\"mode === 'inline' ? height : null\"></div>`,\n})\nexport class NamiruChatComponent implements OnInit, OnDestroy, OnChanges {\n @Input() agentId!: string;\n @Input() mode?: \"button\" | \"inline\";\n @Input() position?: \"bottom-right\" | \"bottom-left\";\n @Input() width?: string;\n @Input() height?: string;\n\n @Output() leadCapture = new EventEmitter<LeadCaptureData>();\n @Output() feedback = new EventEmitter<\"up\" | \"down\">();\n @Output() sessionStart = new EventEmitter<string>();\n @Output() sessionEnd = new EventEmitter<string>();\n\n @ViewChild(\"container\", { static: true }) containerRef!: ElementRef;\n\n private instance: NamiruChatInstance | null = null;\n\n async ngOnInit(): Promise<void> {\n await loadWidgetScript();\n if (!window.NamiruChat) return;\n\n const config: NamiruChatConfig = {\n agentId: this.agentId,\n ...(this.mode && { mode: this.mode }),\n ...(this.position && { position: this.position }),\n ...(this.width && { width: this.width }),\n ...(this.height && { height: this.height }),\n onLeadCapture: (lead) => this.leadCapture.emit(lead),\n onFeedback: (rating) => this.feedback.emit(rating),\n onSessionStart: (id) => this.sessionStart.emit(id),\n onSessionEnd: (id) => this.sessionEnd.emit(id),\n };\n\n this.instance = window.NamiruChat.init(config);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.instance) return;\n if (changes[\"agentId\"] && !changes[\"agentId\"].firstChange) {\n this.instance.destroy();\n this.ngOnInit();\n }\n }\n\n ngOnDestroy(): void {\n this.instance?.destroy();\n this.instance = null;\n }\n}\n"],
5
- "mappings": "2iBAAA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,KAAK,WAAW,KAAKA,CAAE,CAC/C,EAEA,KAAK,SAAW,OAAO,WAAW,KAAKH,CAAM,CAC/C,CAEA,YAAYI,EAA8B,CACnC,KAAK,UACNA,EAAQ,SAAc,CAACA,EAAQ,QAAW,cAC5C,KAAK,SAAS,QAAQ,EACtB,KAAK,SAAS,EAElB,CAEA,aAAoB,CAClB,KAAK,UAAU,QAAQ,EACvB,KAAK,SAAW,IAClB,CACF,EA9CWC,EAAA,IAAR,SAAM,GADIN,EACF,uBACAM,EAAA,IAAR,SAAM,GAFIN,EAEF,oBACAM,EAAA,IAAR,SAAM,GAHIN,EAGF,wBACAM,EAAA,IAAR,SAAM,GAJIN,EAIF,qBACAM,EAAA,IAAR,SAAM,GALIN,EAKF,sBAECM,EAAA,IAAT,UAAO,GAPGN,EAOD,2BACAM,EAAA,IAAT,UAAO,GARGN,EAQD,wBACAM,EAAA,IAAT,UAAO,GATGN,EASD,4BACAM,EAAA,IAAT,UAAO,GAVGN,EAUD,0BAEgCM,EAAA,IAAzC,aAAU,YAAa,CAAE,OAAQ,EAAK,CAAC,GAZ7BN,EAY+B,4BAZ/BA,EAANM,EAAA,IALN,aAAU,CACT,SAAU,cACV,WAAY,GACZ,SAAU,4HACZ,CAAC,GACYN",
6
- "names": ["src_exports", "__export", "NamiruChatComponent", "__toCommonJS", "import_core", "WIDGET_SCRIPT_URL", "loadWidgetScript", "resolve", "reject", "existing", "script", "NamiruChatComponent", "config", "lead", "rating", "id", "changes", "__decorateClass"]
4
+ "sourcesContent": ["export { NamiruChatComponent } from \"./namiru-chat.component\";\n", "import {\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n ViewChild,\n} from \"@angular/core\";\n\ndeclare global {\n interface Window {\n NamiruChat?: {\n init: (config: Record<string, unknown>) => { destroy: () => void };\n };\n }\n}\n\nconst WIDGET_SCRIPT_URL = \"https://namiru.ai/widget.js\";\n\nfunction loadWidgetScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (window.NamiruChat) { resolve(); return; }\n const existing = document.querySelector(`script[src=\"${WIDGET_SCRIPT_URL}\"]`);\n if (existing) {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => reject(new Error(\"Failed to load Namiru widget script\")));\n return;\n }\n const script = document.createElement(\"script\");\n script.src = WIDGET_SCRIPT_URL;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"Failed to load Namiru widget script\"));\n document.head.appendChild(script);\n });\n}\n\n@Component({\n selector: \"namiru-chat\",\n standalone: true,\n template: `<div #container [style.width]=\"mode === 'inline' ? width : null\" [style.height]=\"mode === 'inline' ? height : null\"></div>`,\n})\nexport class NamiruChatComponent implements OnInit, OnDestroy, OnChanges {\n @Input() agentId!: string;\n @Input() mode?: \"button\" | \"inline\";\n @Input() position?: \"bottom-right\" | \"bottom-left\";\n @Input() width?: string;\n @Input() height?: string;\n\n @ViewChild(\"container\", { static: true }) containerRef!: ElementRef;\n\n private instance: { destroy: () => void } | null = null;\n\n async ngOnInit(): Promise<void> {\n await loadWidgetScript();\n if (!window.NamiruChat) return;\n\n this.instance = window.NamiruChat.init({\n agentId: this.agentId,\n ...(this.mode && { mode: this.mode }),\n ...(this.position && { position: this.position }),\n ...(this.width && { width: this.width }),\n ...(this.height && { height: this.height }),\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.instance) return;\n if (changes[\"agentId\"] && !changes[\"agentId\"].firstChange) {\n this.instance.destroy();\n this.ngOnInit();\n }\n }\n\n ngOnDestroy(): void {\n this.instance?.destroy();\n this.instance = null;\n }\n}\n"],
5
+ "mappings": "2iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EASO,yBAUP,IAAMC,EAAoB,8BAE1B,SAASC,GAAkC,CACzC,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtC,GAAI,OAAO,WAAY,CAAED,EAAQ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AAQ,EAAK,CAAC,GAP7BF,EAO+B,4BAP/BA,EAANE,EAAA,IALN,aAAU,CACT,SAAU,cACV,WAAY,GACZ,SAAU,4HACZ,CAAC,GACYF",
6
+ "names": ["src_exports", "__export", "NamiruChatComponent", "__toCommonJS", "import_core", "WIDGET_SCRIPT_URL", "loadWidgetScript", "resolve", "reject", "existing", "script", "NamiruChatComponent", "changes", "__decorateClass"]
7
7
  }
@@ -1,32 +1,10 @@
1
- import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core";
2
- export interface LeadCaptureData {
3
- email?: string;
4
- name?: string;
5
- phone?: string;
6
- company?: string;
7
- }
8
- export interface NamiruChatConfig {
9
- agentId: string;
10
- mode?: "button" | "inline";
11
- position?: "bottom-right" | "bottom-left";
12
- width?: string;
13
- height?: string;
14
- container?: HTMLElement;
15
- serverUrl?: string;
16
- wsUrl?: string;
17
- onLeadCapture?: (lead: LeadCaptureData) => void;
18
- onFeedback?: (rating: "up" | "down") => void;
19
- onSessionStart?: (sessionId: string) => void;
20
- onSessionEnd?: (sessionId: string) => void;
21
- }
22
- export interface NamiruChatInstance {
23
- destroy: () => void;
24
- updateConfig: (config: Partial<NamiruChatConfig>) => void;
25
- }
1
+ import { ElementRef, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core";
26
2
  declare global {
27
3
  interface Window {
28
4
  NamiruChat?: {
29
- init: (config: NamiruChatConfig) => NamiruChatInstance;
5
+ init: (config: Record<string, unknown>) => {
6
+ destroy: () => void;
7
+ };
30
8
  };
31
9
  }
32
10
  }
@@ -36,10 +14,6 @@ export declare class NamiruChatComponent implements OnInit, OnDestroy, OnChanges
36
14
  position?: "bottom-right" | "bottom-left";
37
15
  width?: string;
38
16
  height?: string;
39
- leadCapture: EventEmitter<LeadCaptureData>;
40
- feedback: EventEmitter<"up" | "down">;
41
- sessionStart: EventEmitter<string>;
42
- sessionEnd: EventEmitter<string>;
43
17
  containerRef: ElementRef;
44
18
  private instance;
45
19
  ngOnInit(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiruai/angular",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Angular wrapper for Namiru AI chat widget",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",