@snf/access-qa-bot 3.5.0-rc.1 → 3.5.0-rc.2

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.
@@ -292,5 +292,5 @@ Would you like to submit this security incident report?`},options:["Submit Secur
292
292
  display: inline !important;
293
293
  margin: 0 !important;
294
294
  }
295
- `;function Af(e){if(!e)return;const t=e.getRootNode();if(!(t instanceof ShadowRoot)||t.getElementById(CA))return;const n=document.createElement("style");n.id=CA,n.textContent=sf,t.appendChild(n)}const SA=qe((e,t)=>{const{apiKey:n=yt.DEFAULT_API_KEY,isLoggedIn:r=!1,loginUrl:o=Gt.LOGIN_URL,userEmail:i,userName:s,accessId:A,actingUser:a,ringEffect:l,defaultOpen:c,onClose:u,open:d,onOpenChange:p,embedded:h=!1,welcome:m,qaEndpoint:f,ratingEndpoint:b,agentEndpoint:y,resourceContext:g,onAnalyticsEvent:x}=e,k=oe(null),E=oe(null),[P,D]=te({}),[T,S]=te(null),Q=De(()=>({email:i,name:s,accessId:A}),[i,s,A]);$(()=>{Af(E.current)},[]),$(()=>{jp({ticketForm:P,setTicketForm:D})},[P]);const C=y||yt.AGENT_ENDPOINT,O=g?`${C}/capabilities?resource_context=${encodeURIComponent(g)}`:`${C}/capabilities`,U=`${C}/rating`;$(()=>{C.includes("localhost")&&!window.location.hostname.includes("localhost")&&console.warn("[AccessQABot] VITE_AGENT_ENDPOINT not set — agent requests will go to localhost. Set VITE_AGENT_ENDPOINT in your environment.")},[C]),$(()=>{let F=!1;async function v(){try{const W=await fetch(O,{credentials:"include"});if(!W.ok)throw new Error(`Capabilities API returned ${W.status}`);const Z=await W.json();F||S(Z)}catch(W){console.warn("Failed to fetch capabilities:",W),F||S({categories:[],is_authenticated:!1})}}return v(),()=>{F=!0}},[O,r]),$(()=>{if(!r)return;let F=!1;const v=`${C}/capabilities/personalized`;async function W(){try{const Z=await fetch(v,{credentials:"include"});if(!Z.ok)return;const X=await Z.json();F||console.debug("Personalized context loaded:",X)}catch{}}return W(),()=>{F=!0}},[C,r]),Gn(t,()=>({addMessage:F=>{var v,W;(W=(v=k.current)==null?void 0:v.addMessage)==null||W.call(v,F)}}));const N=m||Gt.WELCOME_MESSAGE,L=De(()=>af(),[]),B=G(F=>{x&&x({...F,type:F.type,timestamp:F.timestamp??Date.now(),sessionId:F.sessionId??L})},[x,L]),M=G(F=>{x&&x({...F,type:F.type,timestamp:typeof F.timestamp=="number"?F.timestamp:Date.now(),sessionId:typeof F.sessionId=="string"?F.sessionId:L})},[x,L]),w=De(()=>{const F=zp({welcome:N,trackEvent:B}),v=Jp({ticketForm:{},setTicketForm:D,userInfo:Q,trackEvent:B}),W=ef({ticketForm:{},setTicketForm:D,userInfo:Q,trackEvent:B}),Z=of({sessionId:L,apiKey:n,trackEvent:B}),X={...F,...v,...W,...Z};return Up(X,{disableOnOptions:!0})},[N,Q,L,n,r,B,T]);return T?_("div",{ref:E,children:_(Go,{ref:k,isLoggedIn:r,allowAnonAccess:yt.ALLOW_ANON_ACCESS,actingUser:a,onAnalyticsEvent:M,apiKey:n,qaEndpoint:f||yt.QA_ENDPOINT,ratingEndpoint:b||yt.RATING_ENDPOINT,capabilitiesEndpoint:O,agentRatingEndpoint:U,botName:Gt.BOT_NAME,logo:Gt.LOGO,primaryColor:Gt.PRIMARY_COLOR,secondaryColor:Gt.SECONDARY_COLOR,welcomeMessage:N,tooltipText:Gt.TOOLTIP,turnstileSiteKey:yt.TURNSTILE_SITE_KEY,loginUrl:o,open:d,onOpenChange:p,embedded:h,footerText:"AI-powered · Privacy Notice",footerLink:"https://support.access-ci.org/tools/access-qa-tool/privacy",resourceContext:g,customFlow:w})}):_("div",{ref:E})});SA.displayName="AccessQABot";function Jo(e){const{target:t,...n}=e;if(!t)throw new Error("qaBot: target element is required");const r=si();let o=n.isLoggedIn||!1,i=n.open!==void 0?n.open:n.defaultOpen||!1;const s=pl(t),A=()=>{s.render(_(SA,{ref:r,...n,isLoggedIn:o,open:i,onOpenChange:a=>{var l;i=a,(l=n.onOpenChange)==null||l.call(n,a)}}))};return A(),{addMessage(a){var l;(l=r.current)==null||l.addMessage(a)},setBotIsLoggedIn(a){o=a,A()},openChat(){i=!0,A()},closeChat(){i=!1,A()},toggleChat(){i=!i,A()},destroy(){s.unmount()}}}return typeof window<"u"&&(window.qaBot=Jo),jn.default=Jo,jn.qaBot=Jo,Object.defineProperties(jn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),jn}({});
295
+ `;function Af(e){if(!e)return;const t=e.getRootNode();if(!(t instanceof ShadowRoot)||t.getElementById(CA))return;const n=document.createElement("style");n.id=CA,n.textContent=sf,t.appendChild(n)}const SA=qe((e,t)=>{const{apiKey:n=yt.DEFAULT_API_KEY,isLoggedIn:r=!1,loginUrl:o=Gt.LOGIN_URL,userEmail:i,userName:s,accessId:A,actingUser:a,ringEffect:l,defaultOpen:c,onClose:u,open:d,onOpenChange:p,embedded:h=!1,welcome:m,qaEndpoint:f,ratingEndpoint:b,agentEndpoint:y,resourceContext:g,onAnalyticsEvent:x}=e,k=oe(null),E=oe(null),[P,D]=te({}),[T,S]=te(null),Q=De(()=>({email:i,name:s,accessId:A}),[i,s,A]);$(()=>{Af(E.current)},[]),$(()=>{jp({ticketForm:P,setTicketForm:D})},[P]);const C=y||yt.AGENT_ENDPOINT,O=g?`${C}/capabilities?resource_context=${encodeURIComponent(g)}`:`${C}/capabilities`,U=`${C}/rating`;$(()=>{C.includes("localhost")&&!window.location.hostname.includes("localhost")&&console.warn("[AccessQABot] VITE_AGENT_ENDPOINT not set — agent requests will go to localhost. Set VITE_AGENT_ENDPOINT in your environment.")},[C]),$(()=>{let F=!1;async function v(){try{const W=await fetch(O,{credentials:"include"});if(!W.ok)throw new Error(`Capabilities API returned ${W.status}`);const Z=await W.json();F||S(Z)}catch(W){console.warn("Failed to fetch capabilities:",W),F||S({categories:[],is_authenticated:!1})}}return v(),()=>{F=!0}},[O,r]),$(()=>{if(!r)return;let F=!1;const v=`${C}/capabilities/personalized`;async function W(){try{const Z=await fetch(v,{credentials:"include"});if(!Z.ok)return;const X=await Z.json();F||console.debug("Personalized context loaded:",X)}catch{}}return W(),()=>{F=!0}},[C,r]),Gn(t,()=>({addMessage:F=>{var v,W;(W=(v=k.current)==null?void 0:v.addMessage)==null||W.call(v,F)}}));const N=m||(T==null?void 0:T.welcome_message)||Gt.WELCOME_MESSAGE,L=De(()=>af(),[]),B=G(F=>{x&&x({...F,type:F.type,timestamp:F.timestamp??Date.now(),sessionId:F.sessionId??L})},[x,L]),M=G(F=>{x&&x({...F,type:F.type,timestamp:typeof F.timestamp=="number"?F.timestamp:Date.now(),sessionId:typeof F.sessionId=="string"?F.sessionId:L})},[x,L]),w=De(()=>{const F=zp({welcome:N,trackEvent:B}),v=Jp({ticketForm:{},setTicketForm:D,userInfo:Q,trackEvent:B}),W=ef({ticketForm:{},setTicketForm:D,userInfo:Q,trackEvent:B}),Z=of({sessionId:L,apiKey:n,trackEvent:B}),X={...F,...v,...W,...Z};return Up(X,{disableOnOptions:!0})},[N,Q,L,n,r,B,T]);return T?_("div",{ref:E,children:_(Go,{ref:k,isLoggedIn:r,allowAnonAccess:yt.ALLOW_ANON_ACCESS,actingUser:a,onAnalyticsEvent:M,apiKey:n,qaEndpoint:f||yt.QA_ENDPOINT,ratingEndpoint:b||yt.RATING_ENDPOINT,capabilitiesEndpoint:O,agentRatingEndpoint:U,botName:Gt.BOT_NAME,logo:Gt.LOGO,primaryColor:Gt.PRIMARY_COLOR,secondaryColor:Gt.SECONDARY_COLOR,welcomeMessage:N,tooltipText:Gt.TOOLTIP,turnstileSiteKey:yt.TURNSTILE_SITE_KEY,loginUrl:o,open:d,onOpenChange:p,embedded:h,footerText:"AI-powered · Privacy Notice",footerLink:"https://support.access-ci.org/tools/access-qa-tool/privacy",resourceContext:g,customFlow:w})}):_("div",{ref:E})});SA.displayName="AccessQABot";function Jo(e){const{target:t,...n}=e;if(!t)throw new Error("qaBot: target element is required");const r=si();let o=n.isLoggedIn||!1,i=n.open!==void 0?n.open:n.defaultOpen||!1;const s=pl(t),A=()=>{s.render(_(SA,{ref:r,...n,isLoggedIn:o,open:i,onOpenChange:a=>{var l;i=a,(l=n.onOpenChange)==null||l.call(n,a)}}))};return A(),{addMessage(a){var l;(l=r.current)==null||l.addMessage(a)},setBotIsLoggedIn(a){o=a,A()},openChat(){i=!0,A()},closeChat(){i=!1,A()},toggleChat(){i=!i,A()},destroy(){s.unmount()}}}return typeof window<"u"&&(window.qaBot=Jo),jn.default=Jo,jn.qaBot=Jo,Object.defineProperties(jn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),jn}({});
296
296
  //# sourceMappingURL=access-qa-bot.standalone.js.map