@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 Kc(e){if(!e)return;const t=e.getRootNode();if(!(t instanceof ShadowRoot)||t.getElementById(ca))return;const r=document.createElement("style");r.id=ca,r.textContent=Wc,t.appendChild(r)}const Fr=f.forwardRef((e,t)=>{const{apiKey:r=je.DEFAULT_API_KEY,isLoggedIn:n=!1,loginUrl:o=mt.LOGIN_URL,userEmail:i,userName:A,accessId:s,actingUser:a,ringEffect:l,defaultOpen:c,onClose:d,open:u,onOpenChange:p,embedded:g=!1,welcome:v,qaEndpoint:h,ratingEndpoint:w,agentEndpoint:x,resourceContext:m,onAnalyticsEvent:k}=e,P=f.useRef(null),C=f.useRef(null),[S,I]=f.useState({}),[Q,D]=f.useState(null),_=f.useMemo(()=>({email:i,name:A,accessId:s}),[i,A,s]);f.useEffect(()=>{Kc(C.current)},[]),f.useEffect(()=>{Ic({ticketForm:S,setTicketForm:I})},[S]);const B=x||je.AGENT_ENDPOINT,M=m?`${B}/capabilities?resource_context=${encodeURIComponent(m)}`:`${B}/capabilities`,F=`${B}/rating`;f.useEffect(()=>{B.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."),je.ALLOW_ANON_ACCESS&&!je.TURNSTILE_SITE_KEY&&console.warn("[AccessQABot] Anonymous access is enabled without Turnstile. Set VITE_TURNSTILE_SITE_KEY for bot protection, or disable VITE_ALLOW_ANON_ACCESS.")},[B]),f.useEffect(()=>{let z=!1;async function y(){try{const G=await fetch(M,{credentials:"include"});if(!G.ok)throw new Error(`Capabilities API returned ${G.status}`);const Z=await G.json();z||D(Z)}catch(G){console.warn("Failed to fetch capabilities:",G),z||D({categories:[],is_authenticated:!1})}}return y(),()=>{z=!0}},[M,n]),f.useEffect(()=>{if(!n)return;let z=!1;const y=`${B}/capabilities/personalized`;async function G(){try{const Z=await fetch(y,{credentials:"include"});if(!Z.ok)return;const K=await Z.json();z||console.debug("Personalized context loaded:",K)}catch{}}return G(),()=>{z=!0}},[B,n]),f.useImperativeHandle(t,()=>({addMessage:z=>{var y,G;(G=(y=P.current)==null?void 0:y.addMessage)==null||G.call(y,z)}}));const N=v||mt.WELCOME_MESSAGE,L=f.useMemo(()=>Yc(),[]),O=f.useCallback(z=>{k&&k({...z,type:z.type,timestamp:z.timestamp??Date.now(),sessionId:z.sessionId??L})},[k,L]),U=f.useCallback(z=>{k&&k({...z,type:z.type,timestamp:typeof z.timestamp=="number"?z.timestamp:Date.now(),sessionId:typeof z.sessionId=="string"?z.sessionId:L})},[k,L]),b=f.useMemo(()=>{const z=Dc({welcome:N,trackEvent:O}),y=Uc({ticketForm:{},setTicketForm:I,userInfo:_,trackEvent:O}),G=zc({ticketForm:{},setTicketForm:I,userInfo:_,trackEvent:O}),Z=Gc({sessionId:L,apiKey:r,trackEvent:O}),K={...z,...y,...G,...Z};return Sc(K,{disableOnOptions:!0})},[N,_,L,r,n,O,Q]);return Q?E.jsx("div",{ref:C,children:E.jsx(Or,{ref:P,isLoggedIn:n,allowAnonAccess:je.ALLOW_ANON_ACCESS,actingUser:a,onAnalyticsEvent:U,apiKey:r,qaEndpoint:h||je.QA_ENDPOINT,ratingEndpoint:w||je.RATING_ENDPOINT,capabilitiesEndpoint:M,agentRatingEndpoint:F,botName:mt.BOT_NAME,logo:mt.LOGO,primaryColor:mt.PRIMARY_COLOR,secondaryColor:mt.SECONDARY_COLOR,welcomeMessage:N,tooltipText:mt.TOOLTIP,turnstileSiteKey:je.TURNSTILE_SITE_KEY||void 0,loginUrl:o,open:u,onOpenChange:p,embedded:g,footerText:"AI-powered · Privacy Notice",footerLink:"https://support.access-ci.org/tools/access-qa-tool/privacy",resourceContext:m,customFlow:b})}):E.jsx("div",{ref:C})});Fr.displayName="AccessQABot",He.API_CONFIG=je,He.AccessQABot=Fr,He.BOT_CONFIG=mt,He.QABot=Fr,Object.defineProperty(He,Symbol.toStringTag,{value:"Module"})});
|
|
295
|
+
`;function Kc(e){if(!e)return;const t=e.getRootNode();if(!(t instanceof ShadowRoot)||t.getElementById(ca))return;const r=document.createElement("style");r.id=ca,r.textContent=Wc,t.appendChild(r)}const Fr=f.forwardRef((e,t)=>{const{apiKey:r=je.DEFAULT_API_KEY,isLoggedIn:n=!1,loginUrl:o=mt.LOGIN_URL,userEmail:i,userName:A,accessId:s,actingUser:a,ringEffect:l,defaultOpen:c,onClose:d,open:u,onOpenChange:p,embedded:g=!1,welcome:v,qaEndpoint:h,ratingEndpoint:w,agentEndpoint:x,resourceContext:m,onAnalyticsEvent:k}=e,P=f.useRef(null),C=f.useRef(null),[S,I]=f.useState({}),[Q,D]=f.useState(null),_=f.useMemo(()=>({email:i,name:A,accessId:s}),[i,A,s]);f.useEffect(()=>{Kc(C.current)},[]),f.useEffect(()=>{Ic({ticketForm:S,setTicketForm:I})},[S]);const B=x||je.AGENT_ENDPOINT,M=m?`${B}/capabilities?resource_context=${encodeURIComponent(m)}`:`${B}/capabilities`,F=`${B}/rating`;f.useEffect(()=>{B.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."),je.ALLOW_ANON_ACCESS&&!je.TURNSTILE_SITE_KEY&&console.warn("[AccessQABot] Anonymous access is enabled without Turnstile. Set VITE_TURNSTILE_SITE_KEY for bot protection, or disable VITE_ALLOW_ANON_ACCESS.")},[B]),f.useEffect(()=>{let z=!1;async function y(){try{const G=await fetch(M,{credentials:"include"});if(!G.ok)throw new Error(`Capabilities API returned ${G.status}`);const Z=await G.json();z||D(Z)}catch(G){console.warn("Failed to fetch capabilities:",G),z||D({categories:[],is_authenticated:!1})}}return y(),()=>{z=!0}},[M,n]),f.useEffect(()=>{if(!n)return;let z=!1;const y=`${B}/capabilities/personalized`;async function G(){try{const Z=await fetch(y,{credentials:"include"});if(!Z.ok)return;const K=await Z.json();z||console.debug("Personalized context loaded:",K)}catch{}}return G(),()=>{z=!0}},[B,n]),f.useImperativeHandle(t,()=>({addMessage:z=>{var y,G;(G=(y=P.current)==null?void 0:y.addMessage)==null||G.call(y,z)}}));const N=v||(Q==null?void 0:Q.welcome_message)||mt.WELCOME_MESSAGE,L=f.useMemo(()=>Yc(),[]),O=f.useCallback(z=>{k&&k({...z,type:z.type,timestamp:z.timestamp??Date.now(),sessionId:z.sessionId??L})},[k,L]),U=f.useCallback(z=>{k&&k({...z,type:z.type,timestamp:typeof z.timestamp=="number"?z.timestamp:Date.now(),sessionId:typeof z.sessionId=="string"?z.sessionId:L})},[k,L]),b=f.useMemo(()=>{const z=Dc({welcome:N,trackEvent:O}),y=Uc({ticketForm:{},setTicketForm:I,userInfo:_,trackEvent:O}),G=zc({ticketForm:{},setTicketForm:I,userInfo:_,trackEvent:O}),Z=Gc({sessionId:L,apiKey:r,trackEvent:O}),K={...z,...y,...G,...Z};return Sc(K,{disableOnOptions:!0})},[N,_,L,r,n,O,Q]);return Q?E.jsx("div",{ref:C,children:E.jsx(Or,{ref:P,isLoggedIn:n,allowAnonAccess:je.ALLOW_ANON_ACCESS,actingUser:a,onAnalyticsEvent:U,apiKey:r,qaEndpoint:h||je.QA_ENDPOINT,ratingEndpoint:w||je.RATING_ENDPOINT,capabilitiesEndpoint:M,agentRatingEndpoint:F,botName:mt.BOT_NAME,logo:mt.LOGO,primaryColor:mt.PRIMARY_COLOR,secondaryColor:mt.SECONDARY_COLOR,welcomeMessage:N,tooltipText:mt.TOOLTIP,turnstileSiteKey:je.TURNSTILE_SITE_KEY||void 0,loginUrl:o,open:u,onOpenChange:p,embedded:g,footerText:"AI-powered · Privacy Notice",footerLink:"https://support.access-ci.org/tools/access-qa-tool/privacy",resourceContext:m,customFlow:b})}):E.jsx("div",{ref:C})});Fr.displayName="AccessQABot",He.API_CONFIG=je,He.AccessQABot=Fr,He.BOT_CONFIG=mt,He.QABot=Fr,Object.defineProperty(He,Symbol.toStringTag,{value:"Module"})});
|
|
296
296
|
//# sourceMappingURL=access-qa-bot.umd.cjs.map
|