shopify-chatbot-widget 0.5.5 → 0.5.6

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.
@@ -681,4 +681,4 @@ html body {
681
681
  userAgent: `).concat(navigator.userAgent,`
682
682
  timeBetweenLoadAndGet: `).concat(o-a,`
683
683
  visitorId: `).concat(f.visitorId,`
684
- components: `).concat(sL(c),"\n```")),[2,f]}})})}}}function wre(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(V5,"/npm-monitoring"),!0),e.send()}catch(t){console.error(t)}}function Tre(e){var t;return e===void 0&&(e={}),eu(this,void 0,void 0,function(){var a,r,o;return tu(this,function(c){switch(c.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&wre(),a=e.delayFallback,r=e.debug,[4,Cre(a)];case 1:return c.sent(),o=pre({cache:{},debug:r}),[2,Ere(o,r)]}})})}var Ore={load:Tre,hashComponents:uL,componentsToDebugString:sL};const Rre=()=>{const[e,t]=x.useState(!1),[a,r]=x.useState("sessions"),[o,c]=x.useState(null),[f,m]=x.useState(!1),[g,p]=x.useState(""),[v,S]=x.useState(""),[E,T]=x.useState(!1),O=window.innerWidth,{chatbotLogo:M,colorCode:A,subscription:N,messagesSuggestions:_,isFetchingDetails:j,disableForm:L,merchantPhone:D,userType:V,calendly:H}=BZ(),[z,U]=x.useState(null),B=()=>{if(!L&&!f){r("create");return}else{const Z=crypto.randomUUID();c(Z),S(M),p("Ai Agent"),console.log(Z),T(!0),r("messenger")}};x.useEffect(()=>{(async()=>{try{let re=localStorage.getItem("visitor_id"),k=localStorage.getItem("ip_address"),q=localStorage.getItem("country");if(re||(re=(await(await Ore.load()).get()).visitorId,localStorage.setItem("visitor_id",re)),!k||!q){const le=await(await fetch("https://ipapi.co/json")).json();k=le.ip,q=le.country_name,k&&localStorage.setItem("ip_address",k),q&&localStorage.setItem("country",q)}if(re&&k&&q){console.log("HHH"),U({visitorId:re,country:q});const le=await(await fetch(`${wi.apiUrl}register-ip/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ip_address:k,country:q,visitor_id:re})})).json();m(le.has_user_info||!1)}else console.warn("Missing IP or country info after fetch")}catch(re){console.error("Failed to fetch or send visitor info",re)}})()},[]);const ee=(Z,re,k)=>{c(Z),p(re),S(k),T(!1),r("messenger")};x.useEffect(()=>{const Z=re=>{const k=re.data||{};k.type==="JAWEB_CHAT"&&(k.action==="open-ready"?t(!0):k.action==="closed"&&t(!1))};return window.addEventListener("message",Z),()=>window.removeEventListener("message",Z)},[]);const Y=()=>{window.parent?.postMessage({type:"JAWEB_CHAT",action:"open"},"*")},W=()=>{window.parent?.postMessage({type:"JAWEB_CHAT",action:"close"},"*")};return ae.jsxs("div",{children:[!j&&N?ae.jsx("div",{style:{bottom:O<768?"20%":0,top:O<768?"0":"5%",height:O<768?"100%":"85%",borderRadius:10,width:"100%",zIndex:9999},children:e&&ae.jsxs("div",{className:"chatbot-box",children:[a==="sessions"&&ae.jsx(IZ,{chatbotLogo:M,Phone:D||"",colorCode:A,visitorId:z?.visitorId||"",Opened:e,setOpen:Z=>Z?Y():W(),onNewSession:B,onSessionSelect:ee}),a==="create"&&ae.jsx(FZ,{colorCode:A,visitorId:z?.visitorId||"",country:z?.country||"",onBack:()=>r("sessions"),onCreate:Z=>{c(Z.session_id),m(Z.hasInfo),r("messenger")}}),a==="messenger"&&o&&ae.jsx(pne,{sessionId:o,chatbotLogo:v||M,agentName:g||"Ai Assistant",colorCode:A,messagesSuggestions:_,newSession:E,disableForm:L,setOpen:Z=>Z?Y():W(),setNewSession:T,Opened:e,setView:()=>r("sessions"),userType:V,calendly:H??""})]})}):null,ae.jsx("div",{className:"jaweb-chatbot-container",children:!j&&N?ae.jsx(ri,{type:"primary",shape:"circle",icon:ae.jsx("img",{src:"https://jaweb.me/wp-content/uploads/2025/03/download__2_-removebg-preview.png",alt:"Chat Icon",style:{width:30,height:30}}),size:"large",style:{backgroundColor:A,width:60,height:60},className:`chat-launcher ${e?"chatbot-open":""}`,onClick:()=>e?W():Y()}):null})]})},cL="jaweb-chatbot-container";if(!document.getElementById(cL)){const e=document.createElement("div");e.id=cL,document.body.appendChild(e),E8.createRoot(e).render(ae.jsx(Rre,{}))}})();
684
+ components: `).concat(sL(c),"\n```")),[2,f]}})})}}}function wre(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(V5,"/npm-monitoring"),!0),e.send()}catch(t){console.error(t)}}function Tre(e){var t;return e===void 0&&(e={}),eu(this,void 0,void 0,function(){var a,r,o;return tu(this,function(c){switch(c.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&wre(),a=e.delayFallback,r=e.debug,[4,Cre(a)];case 1:return c.sent(),o=pre({cache:{},debug:r}),[2,Ere(o,r)]}})})}var Ore={load:Tre,hashComponents:uL,componentsToDebugString:sL};const Rre=()=>{const[e,t]=x.useState(!1),[a,r]=x.useState("sessions"),[o,c]=x.useState(null),[f,m]=x.useState(!1),[g,p]=x.useState(""),[v,S]=x.useState(""),[E,T]=x.useState(!1),O=window.innerWidth,{chatbotLogo:M,colorCode:A,subscription:N,messagesSuggestions:_,isFetchingDetails:j,disableForm:L,merchantPhone:D,userType:V,calendly:H}=BZ(),[z,U]=x.useState(null),B=()=>{if(!L&&!f){r("create");return}else{const Z=crypto.randomUUID();c(Z),S(M),p("Ai Agent"),console.log(Z),T(!0),r("messenger")}};x.useEffect(()=>{(async()=>{try{let re=localStorage.getItem("visitor_id"),k=localStorage.getItem("ip_address"),q=localStorage.getItem("country");if(re||(re=(await(await Ore.load()).get()).visitorId,localStorage.setItem("visitor_id",re)),!k||!q){const le=await(await fetch("https://ipapi.co/json")).json();k=le.ip,q=le.country_name,k&&localStorage.setItem("ip_address",k),q&&localStorage.setItem("country",q)}if(re&&k&&q){console.log("HHH"),U({visitorId:re,country:q});const le=await(await fetch(`${wi.apiUrl}register-ip/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ip_address:k,country:q,visitor_id:re})})).json();m(le.has_user_info||!1)}else console.warn("Missing IP or country info after fetch")}catch(re){console.error("Failed to fetch or send visitor info",re)}})()},[]);const ee=(Z,re,k)=>{c(Z),p(re),S(k),T(!1),r("messenger")};x.useEffect(()=>{const Z=re=>{const k=re.data||{};k.type==="JAWEB_CHAT"&&(k.action==="open-ready"?t(!0):k.action==="closed"&&t(!1))};return window.addEventListener("message",Z),()=>window.removeEventListener("message",Z)},[]);const Y=()=>{window.parent?.postMessage({type:"JAWEB_CHAT",action:"open"},"*")},W=()=>{window.parent?.postMessage({type:"JAWEB_CHAT",action:"close"},"*")};return ae.jsxs("div",{children:[!j&&N?ae.jsx("div",{style:{bottom:O<768?"20%":0,top:O<768?"0":"5%",height:O<768?"100%":"85%",borderRadius:10,width:"100%",zIndex:9999},children:e&&ae.jsxs("div",{className:"chatbot-box",children:[a==="sessions"&&ae.jsx(IZ,{chatbotLogo:M,Phone:D||"",colorCode:A,visitorId:z?.visitorId||"",Opened:e,setOpen:Z=>Z?Y():W(),onNewSession:B,onSessionSelect:ee}),a==="create"&&ae.jsx(FZ,{colorCode:A,visitorId:z?.visitorId||"",country:z?.country||"",onBack:()=>r("sessions"),onCreate:Z=>{c(Z.session_id),m(Z.hasInfo),r("messenger")}}),a==="messenger"&&o&&ae.jsx(pne,{sessionId:o,chatbotLogo:v||M,agentName:g||"Ai Assistant",colorCode:A,messagesSuggestions:_,newSession:E,disableForm:L,calendly:H??"",setOpen:Z=>Z?Y():W(),setNewSession:T,Opened:e,setView:()=>r("sessions"),userType:V})]})}):null,ae.jsx("div",{className:"jaweb-chatbot-container",children:!j&&N?ae.jsx(ri,{type:"primary",shape:"circle",icon:ae.jsx("img",{src:"https://jaweb.me/wp-content/uploads/2025/03/download__2_-removebg-preview.png",alt:"Chat Icon",style:{width:30,height:30}}),size:"large",style:{backgroundColor:A,width:60,height:60},className:`chat-launcher ${e?"chatbot-open":""}`,onClick:()=>e?W():Y()}):null})]})},cL="jaweb-chatbot-container";if(!document.getElementById(cL)){const e=document.createElement("div");e.id=cL,document.body.appendChild(e),E8.createRoot(e).render(ae.jsx(Rre,{}))}})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shopify-chatbot-widget",
3
3
  "private": false,
4
- "version": "0.5.5",
4
+ "version": "0.5.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",