react-aichatbot-widget 1.5.0 → 1.5.1

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.cjs CHANGED
@@ -15,4 +15,4 @@
15
15
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(An(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(_.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(_);function be(e,t){const n=this||ne,r=t||n,s=_.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function at(e){return!!(e&&e.__CANCEL__)}function Y(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(Y,b,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function jn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function kn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const d=Date.now(),c=r[i];o||(o=d),n[s]=p,r[s]=d;let u=i,x=0;for(;u!==s;)x+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const E=c&&d-c;return E?Math.round(x*1e3/E):void 0}}function Fn(e,t){let n=0,r=1e3/t,s,i;const o=(d,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const c=Date.now(),u=c-n;u>=r?o(d,c):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const ce=(e,t,n=3)=>{let r=0;const s=kn(50,250);return Fn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,p=o-r,d=s(p),c=o<=l;r=o;const u={loaded:o,total:l,progress:l?o/l:void 0,bytes:p,rate:d||void 0,estimated:d&&l&&c?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(u)},n)},Le=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>a.asap(()=>e(...t)),Nn=F.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,F.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(F.origin),F.navigator&&/(msie|trident)/i.test(F.navigator.userAgent)):()=>!0,Pn=F.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),a.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function _n(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Un(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!_n(t);return e&&(r||n==!1)?Un(e,t):t}const Ie=e=>e instanceof _?{...e}:e;function $(e,t){t=t||{};const n={};function r(d,c,u,x){return a.isPlainObject(d)&&a.isPlainObject(c)?a.merge.call({caseless:x},d,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(d,c,u,x){if(a.isUndefined(c)){if(!a.isUndefined(d))return r(void 0,d,u,x)}else return r(d,c,u,x)}function i(d,c){if(!a.isUndefined(c))return r(void 0,c)}function o(d,c){if(a.isUndefined(c)){if(!a.isUndefined(d))return r(void 0,d)}else return r(void 0,c)}function l(d,c,u){if(u in t)return r(d,c);if(u in e)return r(void 0,d)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(d,c,u)=>s(Ie(d),Ie(c),u,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const u=p[c]||s,x=u(e[c],t[c],c);a.isUndefined(x)&&u!==l||(n[c]=x)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=_.from(o),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(F.hasStandardBrowserEnv||F.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([c,u])=>{d.includes(c.toLowerCase())&&o.set(c,u)})}}if(F.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Nn(t.url))){const p=s&&i&&Pn.read(i);p&&o.set(s,p)}return t},Ln=typeof XMLHttpRequest<"u",Bn=Ln&&function(e){return new Promise(function(n,r){const s=ut(e);let i=s.data;const o=_.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:d}=s,c,u,x,E,f;function y(){E&&E(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function S(){if(!m)return;const w=_.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:w,config:e,request:m};lt(function(g){n(g),y()},function(g){r(g),y()},A),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(r(new b("Request aborted",b.ECONNABORTED,e,m)),m=null)},m.onerror=function(C){const A=C&&C.message?C.message:"Network Error",k=new b(A,b.ERR_NETWORK,e,m);k.event=C||null,r(k),m=null},m.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const A=s.transitional||ot;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new b(C,A.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(C,A){m.setRequestHeader(A,C)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),d&&([x,f]=ce(d,!0),m.addEventListener("progress",x)),p&&m.upload&&([u,E]=ce(p),m.upload.addEventListener("progress",u),m.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(c=w=>{m&&(r(!w||w.type?new Y(null,e,m):w),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const O=jn(s.url);if(O&&F.protocols.indexOf(O)===-1){r(new b("Unsupported protocol "+O+":",b.ERR_BAD_REQUEST,e));return}m.send(i||null)})},In=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const c=d instanceof Error?d:this.reason;r.abort(c instanceof b?c:new Y(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},Dn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},vn=async function*(e,t){for await(const n of Mn(e))yield*Dn(n,t)},Mn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},De=(e,t,n,r)=>{const s=vn(e,t);let i=0,o,l=p=>{o||(o=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:d,value:c}=await s.next();if(d){l(),p.close();return}let u=c.byteLength;if(n){let x=i+=u;n(x)}p.enqueue(new Uint8Array(c))}catch(d){throw l(d),d}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:oe}=a,zn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:ze}=a.global,qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qn=e=>{e=a.merge.call({skipUndefined:!0},zn,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",i=oe(n),o=oe(r);if(!s)return!1;const l=s&&oe(Me),p=s&&(typeof ze=="function"?(f=>y=>f.encode(y))(new ze):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=i&&l&&qe(()=>{let f=!1;const y=new n(F.origin,{body:new Me,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=o&&l&&qe(()=>a.isReadableStream(new r("").body)),u={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!u[f]&&(u[f]=(y,m)=>{let S=y&&y[f];if(S)return S.call(y);throw new b(`Response type '${f}' is not supported`,b.ERR_NOT_SUPPORT,m)})});const x=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(F.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},E=async(f,y)=>{const m=a.toFiniteNumber(f.getContentLength());return m??x(y)};return async f=>{let{url:y,method:m,data:S,signal:O,cancelToken:w,timeout:C,onDownloadProgress:A,onUploadProgress:k,responseType:g,headers:U,withCredentials:W="same-origin",fetchOptions:z}=ut(f),re=t||fetch;g=g?(g+"").toLowerCase():"text";let J=In([O,w&&w.toAbortSignal()],C),R=null;const j=J&&J.unsubscribe&&(()=>{J.unsubscribe()});let V;try{if(k&&d&&m!=="get"&&m!=="head"&&(V=await E(U,S))!==0){let M=new n(y,{method:"POST",body:S,duplex:"half"}),K;if(a.isFormData(S)&&(K=M.headers.get("content-type"))&&U.setContentType(K),M.body){const[me,se]=Le(V,ce(Be(k)));S=De(M.body,ve,me,se)}}a.isString(W)||(W=W?"include":"omit");const B=i&&"credentials"in n.prototype,Ae={...z,signal:J,method:m.toUpperCase(),headers:U.normalize().toJSON(),body:S,duplex:"half",credentials:B?W:void 0};R=i&&new n(y,Ae);let v=await(i?re(R,z):re(y,Ae));const je=c&&(g==="stream"||g==="response");if(c&&(A||je&&j)){const M={};["status","statusText","headers"].forEach(ke=>{M[ke]=v[ke]});const K=a.toFiniteNumber(v.headers.get("content-length")),[me,se]=A&&Le(K,ce(Be(A),!0))||[];v=new r(De(v.body,ve,me,()=>{se&&se(),j&&j()}),M)}g=g||"text";let yt=await u[a.findKey(u,g)||"text"](v,f);return!je&&j&&j(),await new Promise((M,K)=>{lt(M,K,{data:yt,headers:_.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:R})})}catch(B){throw j&&j(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,f,R),{cause:B.cause||B}):b.from(B,B&&B.code,f,R)}}},Hn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,p,d,c=Hn;for(;l--;)p=i[l],d=c.get(p),d===void 0&&c.set(p,d=l?new Map:qn(t)),c=d;return d};dt();const Oe={http:on,xhr:Bn,fetch:{get:dt}};a.forEach(Oe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,$n=e=>a.isFunction(e)||e===null||e===!1;function Wn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!$n(r)&&(s=Oe[(l=String(r)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
16
16
  `+o.map(He).join(`
17
17
  `):" "+He(o[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const ft={getAdapter:Wn,adapters:Oe};function xe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Y(null,e)}function $e(e){return xe(e),e.headers=_.from(e.headers),e.data=be.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||ne.adapter,e)(e).then(function(r){return xe(e),r.data=be.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return at(r)||(xe(e),r&&r.response&&(r.response.data=be.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const pt="1.13.2",he={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{he[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};he.transitional=function(t,n,r){function s(i,o){return"[Axios v"+pt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new b(s(o," has been removed"+(n?" in "+n:"")),b.ERR_DEPRECATED);return n&&!We[o]&&(We[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};he.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Jn(e,t,n){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],p=l===void 0||o(l,i,e);if(p!==!0)throw new b("option "+i+" must be "+p,b.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new b("Unknown option "+i,b.ERR_BAD_OPTION)}}const le={assertOptions:Jn,validators:he},I=le.validators;let H=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _e,response:new _e}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
18
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&le.assertOptions(r,{silentJSONParsing:I.transitional(I.boolean),forcedJSONParsing:I.transitional(I.boolean),clarifyTimeoutError:I.transitional(I.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:le.assertOptions(s,{encode:I.function,serialize:I.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),le.assertOptions(n,{baseUrl:I.spelling("baseURL"),withXsrfToken:I.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=_.concat(o,i);const l=[];let p=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(p=p&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let c,u=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...d),x=f.length,c=Promise.resolve(n);u<x;)c=c.then(f[u++],f[u++]);return c}x=l.length;let E=n;for(;u<x;){const f=l[u++],y=l[u++];try{E=f(E)}catch(m){y.call(this,m);break}}try{c=$e.call(this,E)}catch(f){return Promise.reject(f)}for(u=0,x=d.length;u<x;)c=c.then(d[u++],d[u++]);return c}getUri(t){t=$(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Vn=class ht{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Y(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ht(function(s){t=s}),cancel:t}}};function Kn(e){return function(n){return e.apply(null,n)}}function Xn(e){return a.isObject(e)&&e.isAxiosError===!0}const Ee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ee).forEach(([e,t])=>{Ee[t]=e});function mt(e){const t=new H(e),n=Je(H.prototype.request,t);return a.extend(n,H.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt($(e,s))},n}const T=mt(ne);T.Axios=H;T.CanceledError=Y;T.CancelToken=Vn;T.isCancel=at;T.VERSION=pt;T.toFormData=pe;T.AxiosError=b;T.Cancel=T.CanceledError;T.all=function(t){return Promise.all(t)};T.spread=Kn;T.isAxiosError=Xn;T.mergeConfig=$;T.AxiosHeaders=_;T.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);T.getAdapter=ft.getAdapter;T.HttpStatusCode=Ee;T.default=T;const{Axios:rr,AxiosError:sr,CanceledError:or,isCancel:ir,CancelToken:ar,VERSION:lr,all:cr,Cancel:ur,isAxiosError:dr,spread:fr,toFormData:pr,AxiosHeaders:hr,HttpStatusCode:mr,formToJSON:yr,getAdapter:br,mergeConfig:xr}=T,Gn=async(e,t,n,r,s)=>{console.log("Creating chat session with input url:",n);const i={chatInput:e,metadata:{pinecone_namespace:t,name:r,email:s}};try{return(await T.post(n,i,{headers:{"Content-Type":"application/json"}})).data}catch(o){throw console.error("Error communicating with chat API:",o),o}},Yn=async(e,t,n,r)=>{const s={chatInput:e,metadata:{pinecone_namespace:t},sessionId:r};try{return(await T.post(n,s,{headers:{"Content-Type":"application/json"}})).data}catch(i){throw console.error("Error communicating with chat API:",i),i}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n,setChatSessionId:r})=>{const[s,i]=N.useState(""),[o,l]=N.useState(""),[p,d]=N.useState(""),[c,u]=N.useState(""),[x,E]=N.useState(!1),f=async g=>{if(g.preventDefault(),E(!0),u(""),!s.trim()||!o.trim()){u("Name and email are required"),E(!1);return}try{const U=await Gn(p,n.pineconeNamespace,n.initiateChatUrl,s,o);console.log("response from n8n",U),e([{type:"user",text:p},{type:"bot",text:U.n8n.response,response_timestamp:U.n8n.response_timestamp,sessionId:U.n8n.sessionId}]),r(U.n8n.sessionId)}catch(U){console.log("error sending user details",U),u("Failed to submit. Please try again.")}finally{E(!1)}i(""),l(""),d("")},y={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},m={display:"flex",flexDirection:"column",gap:"24px"},S={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},O={display:"flex",flexDirection:"column",gap:"20px"},w={fontSize:"14px",color:t.fontColor,fontWeight:"500"},C={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},A={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:s.trim()&&o.trim()&&!x?"pointer":"not-allowed",opacity:s.trim()&&o.trim()&&!x?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},k={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:y,children:h.jsxs("form",{onSubmit:f,style:m,children:[c&&h.jsx("div",{style:k,role:"alert",children:c}),h.jsx("p",{style:S,children:n.welcomeText}),h.jsxs("div",{style:O,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:s,onChange:g=>{i(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{l(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Message"}),h.jsx("textarea",{placeholder:"Enter your message",value:p,onChange:g=>{d(g.target.value),u("")},style:{...C,minHeight:"60px",resize:"vertical"},required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!s.trim()||!o.trim()||x,style:A,onMouseEnter:g=>{s.trim()&&o.trim()&&!x&&(g.currentTarget.style.transform="translateY(-2px)",g.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="none"},children:x?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(D.Send,{size:18}),"Submit"]})})]})})},Zn=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[i,o]=N.useState(!1),[l,p]=N.useState(!1),[d,c]=N.useState(!1),[u,x]=N.useState(null),E=n.position==="left",f=R=>{x(R)},y={position:"fixed",bottom:"112px",[E?"left":"right"]:"32px",zIndex:50,width:d?"684px":"384px",height:d?"620px":"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},m={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},S={position:"relative"},O={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},w={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},C={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},A={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},k={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},g={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},U={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},W={fontWeight:"600"},z=(R,j)=>{R.currentTarget.style.background=j?"rgba(255,255,255,0.2)":"transparent"},re=R=>{s(R),p(!0)},J=async R=>{o(!0),s(j=>[...j,{type:"user",text:R}]);try{const j=await Yn(R,n.pineconeNamespace,n.onGoingChatUrl,u);s(V=>[...V,{type:"bot",text:j.n8n.response,response_timestamp:j.n8n.response_timestamp,suggested_prompts:j.n8n.suggested_prompt}])}catch(j){console.error("Chat error:",j),s(V=>[...V,{type:"bot",text:"Sorry, something went wrong."}])}finally{o(!1)}};return h.jsxs("div",{style:y,children:[h.jsxs("div",{style:m,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:S,children:[h.jsx("div",{style:O,children:h.jsx(D.MessageCircle,{size:22})}),h.jsx("span",{style:w})]}),h.jsxs("div",{children:[h.jsx("h3",{style:C,children:n.name}),h.jsx("p",{style:A,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>c(R=>!R),"aria-label":"expand chat",style:k,onMouseEnter:R=>z(R,!0),onMouseLeave:R=>z(R,!1),children:d?h.jsx(D.Minimize2,{size:20}):h.jsx(D.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"close chat",style:k,onMouseEnter:R=>z(R,!0),onMouseLeave:R=>z(R,!1),children:h.jsx(D.X,{size:20})})]})]}),u?h.jsxs(h.Fragment,{children:[h.jsx(gt,{messages:r,isLoading:i,theme:t}),h.jsx(xt,{onSendMessage:J,isLoading:i,theme:t,messages:r})]}):h.jsx(Qn,{handleMessageFromForm:re,theme:t,chatBotData:n,setChatSessionId:f}),h.jsx("div",{style:g,children:h.jsxs("p",{style:U,children:["powered by"," ",h.jsx("span",{style:W,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,onGoingChatUrl:t,initiateChatUrl:n,primaryColor:r="#3b82f6",secondaryColor:s="#8b5cf6",backgroundColor:i="#ffffff",fontColor:o="#1f2937",placeholderColor:l="#9ca3af",position:p="right",name:d="Assistant",subTitle:c="Typically replies instantly",welcomeText:u="Hi! How can I help you today?"})=>{const[x,E]=N.useState(!1),f=()=>E(k=>!k),y=()=>E(k=>!k),m={primaryColor:r,secondaryColor:s,backgroundColor:i,fontColor:o,placeholderColor:l,inputBackgroundColor:i},S={name:d,subTitle:c,welcomeText:u,onGoingChatUrl:t,initiateChatUrl:n,pineconeNamespace:e,position:p},O=p==="left",w="32px",C={position:"fixed",bottom:"104px",[O?"left":"right"]:w,zIndex:9999,pointerEvents:"auto"},A={position:"fixed",bottom:"32px",[O?"left":"right"]:w,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[x&&h.jsx("div",{style:C,children:h.jsx(Zn,{onClose:f,theme:m,chatBotData:S})}),h.jsx("div",{style:A,children:h.jsx(bt,{onMinimise:y,isOpen:x,theme:m,chatBotData:S})})]})};module.exports=er;
18
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&le.assertOptions(r,{silentJSONParsing:I.transitional(I.boolean),forcedJSONParsing:I.transitional(I.boolean),clarifyTimeoutError:I.transitional(I.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:le.assertOptions(s,{encode:I.function,serialize:I.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),le.assertOptions(n,{baseUrl:I.spelling("baseURL"),withXsrfToken:I.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=_.concat(o,i);const l=[];let p=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(p=p&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let c,u=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...d),x=f.length,c=Promise.resolve(n);u<x;)c=c.then(f[u++],f[u++]);return c}x=l.length;let E=n;for(;u<x;){const f=l[u++],y=l[u++];try{E=f(E)}catch(m){y.call(this,m);break}}try{c=$e.call(this,E)}catch(f){return Promise.reject(f)}for(u=0,x=d.length;u<x;)c=c.then(d[u++],d[u++]);return c}getUri(t){t=$(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Vn=class ht{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Y(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ht(function(s){t=s}),cancel:t}}};function Kn(e){return function(n){return e.apply(null,n)}}function Xn(e){return a.isObject(e)&&e.isAxiosError===!0}const Ee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ee).forEach(([e,t])=>{Ee[t]=e});function mt(e){const t=new H(e),n=Je(H.prototype.request,t);return a.extend(n,H.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt($(e,s))},n}const T=mt(ne);T.Axios=H;T.CanceledError=Y;T.CancelToken=Vn;T.isCancel=at;T.VERSION=pt;T.toFormData=pe;T.AxiosError=b;T.Cancel=T.CanceledError;T.all=function(t){return Promise.all(t)};T.spread=Kn;T.isAxiosError=Xn;T.mergeConfig=$;T.AxiosHeaders=_;T.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);T.getAdapter=ft.getAdapter;T.HttpStatusCode=Ee;T.default=T;const{Axios:rr,AxiosError:sr,CanceledError:or,isCancel:ir,CancelToken:ar,VERSION:lr,all:cr,Cancel:ur,isAxiosError:dr,spread:fr,toFormData:pr,AxiosHeaders:hr,HttpStatusCode:mr,formToJSON:yr,getAdapter:br,mergeConfig:xr}=T,Gn=async(e,t,n,r,s)=>{const i={chatInput:e,metadata:{pinecone_namespace:t,name:r,email:s}};try{return(await T.post(n,i,{headers:{"Content-Type":"application/json"}})).data}catch(o){throw console.error("Error communicating with chat API:",o),o}},Yn=async(e,t,n,r)=>{const s={chatInput:e,metadata:{pinecone_namespace:t},sessionId:r};try{return(await T.post(n,s,{headers:{"Content-Type":"application/json"}})).data}catch(i){throw console.error("Error communicating with chat API:",i),i}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n,setChatSessionId:r})=>{const[s,i]=N.useState(""),[o,l]=N.useState(""),[p,d]=N.useState(""),[c,u]=N.useState(""),[x,E]=N.useState(!1),f=async g=>{if(g.preventDefault(),E(!0),u(""),!s.trim()||!o.trim()){u("Name and email are required"),E(!1);return}try{const U=await Gn(p,n.pineconeNamespace,n.initiateChatUrl,s,o);e([{type:"user",text:p},{type:"bot",text:U.n8n.response,response_timestamp:U.n8n.response_timestamp,sessionId:U.n8n.sessionId}]),r(U.n8n.sessionId)}catch(U){console.log("error sending user details",U),u("Failed to submit. Please try again.")}finally{E(!1)}i(""),l(""),d("")},y={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},m={display:"flex",flexDirection:"column",gap:"24px"},S={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},O={display:"flex",flexDirection:"column",gap:"20px"},w={fontSize:"14px",color:t.fontColor,fontWeight:"500"},C={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},A={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:s.trim()&&o.trim()&&!x?"pointer":"not-allowed",opacity:s.trim()&&o.trim()&&!x?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},k={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:y,children:h.jsxs("form",{onSubmit:f,style:m,children:[c&&h.jsx("div",{style:k,role:"alert",children:c}),h.jsx("p",{style:S,children:n.welcomeText}),h.jsxs("div",{style:O,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:s,onChange:g=>{i(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{l(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Message"}),h.jsx("textarea",{placeholder:"Enter your message",value:p,onChange:g=>{d(g.target.value),u("")},style:{...C,minHeight:"60px",resize:"vertical"},required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!s.trim()||!o.trim()||x,style:A,onMouseEnter:g=>{s.trim()&&o.trim()&&!x&&(g.currentTarget.style.transform="translateY(-2px)",g.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="none"},children:x?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(D.Send,{size:18}),"Submit"]})})]})})},Zn=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[i,o]=N.useState(!1),[l,p]=N.useState(!1),[d,c]=N.useState(!1),[u,x]=N.useState(null),E=n.position==="left",f=R=>{x(R)},y={position:"fixed",bottom:"112px",[E?"left":"right"]:"32px",zIndex:50,width:d?"684px":"384px",height:d?"620px":"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},m={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},S={position:"relative"},O={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},w={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},C={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},A={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},k={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},g={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},U={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},W={fontWeight:"600"},z=(R,j)=>{R.currentTarget.style.background=j?"rgba(255,255,255,0.2)":"transparent"},re=R=>{s(R),p(!0)},J=async R=>{o(!0),s(j=>[...j,{type:"user",text:R}]);try{const j=await Yn(R,n.pineconeNamespace,n.onGoingChatUrl,u);s(V=>[...V,{type:"bot",text:j.n8n.response,response_timestamp:j.n8n.response_timestamp,suggested_prompts:j.n8n.suggested_prompt}])}catch(j){console.error("Chat error:",j),s(V=>[...V,{type:"bot",text:"Sorry, something went wrong."}])}finally{o(!1)}};return h.jsxs("div",{style:y,children:[h.jsxs("div",{style:m,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:S,children:[h.jsx("div",{style:O,children:h.jsx(D.MessageCircle,{size:22})}),h.jsx("span",{style:w})]}),h.jsxs("div",{children:[h.jsx("h3",{style:C,children:n.name}),h.jsx("p",{style:A,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>c(R=>!R),"aria-label":"expand chat",style:k,onMouseEnter:R=>z(R,!0),onMouseLeave:R=>z(R,!1),children:d?h.jsx(D.Minimize2,{size:20}):h.jsx(D.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"close chat",style:k,onMouseEnter:R=>z(R,!0),onMouseLeave:R=>z(R,!1),children:h.jsx(D.X,{size:20})})]})]}),u?h.jsxs(h.Fragment,{children:[h.jsx(gt,{messages:r,isLoading:i,theme:t}),h.jsx(xt,{onSendMessage:J,isLoading:i,theme:t,messages:r})]}):h.jsx(Qn,{handleMessageFromForm:re,theme:t,chatBotData:n,setChatSessionId:f}),h.jsx("div",{style:g,children:h.jsxs("p",{style:U,children:["powered by"," ",h.jsx("span",{style:W,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,onGoingChatUrl:t,initiateChatUrl:n,primaryColor:r="#3b82f6",secondaryColor:s="#8b5cf6",backgroundColor:i="#ffffff",fontColor:o="#1f2937",placeholderColor:l="#9ca3af",position:p="right",name:d="Assistant",subTitle:c="Typically replies instantly",welcomeText:u="Hi! How can I help you today?"})=>{const[x,E]=N.useState(!1),f=()=>E(k=>!k),y=()=>E(k=>!k),m={primaryColor:r,secondaryColor:s,backgroundColor:i,fontColor:o,placeholderColor:l,inputBackgroundColor:i},S={name:d,subTitle:c,welcomeText:u,onGoingChatUrl:t,initiateChatUrl:n,pineconeNamespace:e,position:p},O=p==="left",w="32px",C={position:"fixed",bottom:"104px",[O?"left":"right"]:w,zIndex:9999,pointerEvents:"auto"},A={position:"fixed",bottom:"32px",[O?"left":"right"]:w,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[x&&h.jsx("div",{style:C,children:h.jsx(Zn,{onClose:f,theme:m,chatBotData:S})}),h.jsx("div",{style:A,children:h.jsx(bt,{onMinimise:y,isOpen:x,theme:m,chatBotData:S})})]})};module.exports=er;
package/dist/index.js CHANGED
@@ -2003,7 +2003,6 @@ const {
2003
2003
  getAdapter: Fr,
2004
2004
  mergeConfig: Nr
2005
2005
  } = T, ir = async (e, t, n, r, o) => {
2006
- console.log("Creating chat session with input url:", n);
2007
2006
  const i = {
2008
2007
  chatInput: e,
2009
2008
  metadata: {
@@ -2060,7 +2059,7 @@ const {
2060
2059
  o,
2061
2060
  s
2062
2061
  );
2063
- console.log("response from n8n", L), e([
2062
+ e([
2064
2063
  { type: "user", text: p },
2065
2064
  { type: "bot", text: L.n8n.response, response_timestamp: L.n8n.response_timestamp, sessionId: L.n8n.sessionId }
2066
2065
  ]), r(L.n8n.sessionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-aichatbot-widget",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A React ChatBot Widget",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",