@neuctra/authix 1.0.2 → 1.0.3
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.
|
@@ -6963,8 +6963,8 @@ const ks = [
|
|
|
6963
6963
|
};
|
|
6964
6964
|
export {
|
|
6965
6965
|
Xs as NeuctraAuthix,
|
|
6966
|
-
eo as
|
|
6967
|
-
to as
|
|
6966
|
+
eo as ReactSignedIn,
|
|
6967
|
+
to as ReactSignedOut,
|
|
6968
6968
|
no as ReactUserButton,
|
|
6969
6969
|
Qs as ReactUserLogin,
|
|
6970
6970
|
ro as ReactUserProfile,
|
|
@@ -651,4 +651,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
651
651
|
border-width: 2px;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
`})]})},Qn=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,propUser:n,className:o="",profileUrl:i,settingsUrl:a,showProfileMenuItem:l=!0,showSettingsMenuItem:h=!0,showViewProfileMenuItem:p=!0,profileLabel:u="My Profile",settingsLabel:b="Settings",viewProfileLabel:C="View Profile",logoutLabel:k="Sign Out"})=>{const{baseUrl:c,apiKey:g,appId:y}=ie(),[I,W]=j.useState(!1),[S,F]=j.useState(null),[D,m]=j.useState(!0),[_,w]=j.useState(null),M=j.useRef(null),V=j.useRef(null),[U,A]=j.useState(!1),[O,E]=j.useState(!1);j.useEffect(()=>{const x=()=>{E(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const N=async x=>{try{if(!x)throw new Error("Invalid user ID");const{data:v}=await $.get(`${c}/users/check-user/${x}?appId=${y}`,{headers:{"x-api-key":g},timeout:1e4});(!v.success||!v.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),F(null),w("Session expired"))}catch(v){console.error("User validation failed:",v);const H=v.response?.status===404?"User not found":v.code==="NETWORK_ERROR"?"Network error":"Validation failed";w(H),v.response?.status===404&&(localStorage.removeItem("userInfo"),F(null))}};j.useEffect(()=>{(async()=>{try{if(m(!0),w(null),n){if(!n.id||!n.name||!n.email)throw new Error("Invalid user data provided");F(n),await N(n.id)}else{const v=localStorage.getItem("userInfo");if(v)try{const H=JSON.parse(v);if(!H.id||!H.name||!H.email)throw new Error("Invalid stored user data");F(H),await N(H.id)}catch(H){console.error("Failed to parse stored user data:",H),localStorage.removeItem("userInfo"),w("Invalid user data")}}}catch(v){console.error("User initialization failed:",v),w(v.message||"Failed to load user")}finally{m(!1)}})()},[n]),j.useEffect(()=>{const x=()=>{if(I&&V.current){const v=V.current.getBoundingClientRect(),H=window.innerWidth,te=window.innerHeight,ve=280,J=300,re=H-v.right,je=v.left,et=te-v.bottom,es=re>=ve||re>je;A(es),et<J&&v.top>J}};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[I]),j.useEffect(()=>{const x=te=>{M.current&&!M.current.contains(te.target)&&!V.current?.contains(te.target)&&W(!1)},v=te=>{te.key==="Escape"&&W(!1)},H=()=>{I&&W(!1)};return I&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",v),window.addEventListener("scroll",H,{passive:!0})),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v),window.removeEventListener("scroll",H)}},[I]);const T=e?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:t,accentHover:`${t}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:t,accentHover:`${t}e6`,error:"#ef4444"},P={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:O?"6px":"8px",padding:O?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:T.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:O?"auto":"140px",maxWidth:O?"200px":"none",outline:"none"},avatarImage:{width:O?"28px":"32px",height:O?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${T.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:O?"13px":"14px",fontWeight:600,color:T.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:O?"80px":"120px"},userEmail:{fontSize:O?"11px":"12px",color:T.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:O?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:I?"rotate(180deg)":"rotate(0deg)",color:T.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[U?"left":"right"]:"0",backgroundColor:T.surfaceElevated,border:`1px solid ${T.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:I?1:0,pointerEvents:I?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:I?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:O?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:O?"10px":"12px",padding:O?"14px":"16px"},dropdownAvatar:{width:O?"40px":"48px",height:O?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${T.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:O?"15px":"16px",fontWeight:600,color:T.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:O?"13px":"14px",color:T.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:O?"10px":"12px",padding:O?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:T.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:O?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:O?"16px":"18px",height:O?"16px":"18px",color:T.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:O?"10px":"12px",padding:O?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:O?"13px":"14px",color:T.error,textAlign:"left",outline:"none"},loadingText:{padding:O?"16px 12px":"20px 16px",textAlign:"center",color:T.textSecondary,fontSize:O?"13px":"14px"},errorState:{padding:O?"16px 12px":"20px 16px",textAlign:"center",color:T.textSecondary,fontSize:O?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:T.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},B=()=>{w(null),m(!0);const x=localStorage.getItem("userInfo");if(x)try{const v=JSON.parse(x);F(v),N(v.id)}catch{w("Invalid user data")}m(!1)},q=(x,v)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),v())},f=()=>i||S?.profileUrl,R=()=>{const x=f();x&&window.open(x,"_blank","noopener,noreferrer")},L=()=>{a&&window.open(a,"_blank","noopener,noreferrer")};return s.jsxs("div",{style:P.wrapper,ref:M,className:o,role:"menu","aria-label":"User menu",children:[s.jsxs("div",{ref:V,style:P.avatarButton,onClick:()=>W(x=>!x),onKeyDown:x=>q(x,()=>W(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":I,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=T.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[S?.avatarUrl?s.jsx("img",{src:S.avatarUrl,alt:`${S.name}'s avatar`,style:P.avatarImage,loading:"lazy",onError:x=>{const v=x.target;v.src=`https://api.dicebear.com/9.x/avataaars/svg?seed=${S.name||"user"}`}}):s.jsx("img",{src:`https://api.dicebear.com/9.x/avataaars/svg?seed=${S?.name||"user"}`,alt:"Default user avatar",style:P.avatarImage,loading:"lazy"}),!O&&s.jsxs("div",{style:P.userInfo,children:[s.jsx("div",{style:P.userName,title:S?.name,children:S?.name||"Guest"}),S?.email&&s.jsx("div",{style:P.userEmail,title:S.email,children:S.email})]}),s.jsx(Pn,{size:O?14:16,style:P.chevron,"aria-hidden":"true"})]}),I&&s.jsx("div",{style:P.dropdown,role:"menu","aria-label":"User options",children:D?s.jsx("div",{style:P.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):S?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:P.userSection,children:[S?.avatarUrl?s.jsx("img",{src:S.avatarUrl,alt:`${S.name}'s profile picture`,style:P.dropdownAvatar,loading:"lazy",onError:x=>{const v=x.target;v.src=`https://api.dicebear.com/9.x/avataaars/svg?seed=${S.name}`}}):s.jsx("img",{src:`https://api.dicebear.com/9.x/avataaars/svg?seed=${S.name}`,alt:`${S.name}'s default avatar`,style:P.dropdownAvatar,loading:"lazy"}),s.jsxs("div",{style:P.dropdownUserInfo,children:[s.jsx("div",{style:P.dropdownUserName,title:S.name,children:S.name}),s.jsx("div",{style:P.dropdownUserEmail,title:S.email,children:S.email})]})]}),s.jsxs("div",{style:P.dropdownSection,children:[l&&f()&&s.jsxs("button",{style:P.menuItem,onClick:R,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,R),role:"menuitem",tabIndex:0,children:[s.jsx(fe,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:u})]}),h&&a&&s.jsxs("button",{style:P.menuItem,onClick:L,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,L),role:"menuitem",tabIndex:0,children:[s.jsx(Dn,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:b})]}),p&&S.profileUrl&&s.jsxs("a",{href:S.profileUrl,target:"_blank",rel:"noopener noreferrer",style:P.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[s.jsx(Se,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:C})]})]}),s.jsx("div",{style:P.dropdownSection,children:s.jsxs("button",{style:P.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,r),role:"menuitem",tabIndex:0,children:[s.jsx(Vt,{style:{...P.icon,color:T.error},"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:k})]})})]}):s.jsxs("div",{style:P.errorState,role:"alert",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsx(ae,{size:16,"aria-hidden":"true"}),s.jsx("span",{children:_||"Not signed in"})]}),_&&_!=="Not signed in"&&s.jsx("button",{style:P.retryButton,onClick:B,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=T.accent},children:"Try Again"})]})})]})};X.NeuctraAuthix=bn,X.ReactSignInComponent=Yn,X.ReactSignOutComponent=Jn,X.ReactUserButton=Qn,X.ReactUserLogin=Hn,X.ReactUserProfile=Zn,X.ReactUserSignUp=$n,X.getSdkConfig=ie,X.setSdkConfig=Bn,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
|
|
654
|
+
`})]})},Qn=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,propUser:n,className:o="",profileUrl:i,settingsUrl:a,showProfileMenuItem:l=!0,showSettingsMenuItem:h=!0,showViewProfileMenuItem:p=!0,profileLabel:u="My Profile",settingsLabel:b="Settings",viewProfileLabel:C="View Profile",logoutLabel:k="Sign Out"})=>{const{baseUrl:c,apiKey:g,appId:y}=ie(),[I,W]=j.useState(!1),[S,F]=j.useState(null),[D,m]=j.useState(!0),[_,w]=j.useState(null),M=j.useRef(null),V=j.useRef(null),[U,A]=j.useState(!1),[O,E]=j.useState(!1);j.useEffect(()=>{const x=()=>{E(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const N=async x=>{try{if(!x)throw new Error("Invalid user ID");const{data:v}=await $.get(`${c}/users/check-user/${x}?appId=${y}`,{headers:{"x-api-key":g},timeout:1e4});(!v.success||!v.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),F(null),w("Session expired"))}catch(v){console.error("User validation failed:",v);const H=v.response?.status===404?"User not found":v.code==="NETWORK_ERROR"?"Network error":"Validation failed";w(H),v.response?.status===404&&(localStorage.removeItem("userInfo"),F(null))}};j.useEffect(()=>{(async()=>{try{if(m(!0),w(null),n){if(!n.id||!n.name||!n.email)throw new Error("Invalid user data provided");F(n),await N(n.id)}else{const v=localStorage.getItem("userInfo");if(v)try{const H=JSON.parse(v);if(!H.id||!H.name||!H.email)throw new Error("Invalid stored user data");F(H),await N(H.id)}catch(H){console.error("Failed to parse stored user data:",H),localStorage.removeItem("userInfo"),w("Invalid user data")}}}catch(v){console.error("User initialization failed:",v),w(v.message||"Failed to load user")}finally{m(!1)}})()},[n]),j.useEffect(()=>{const x=()=>{if(I&&V.current){const v=V.current.getBoundingClientRect(),H=window.innerWidth,te=window.innerHeight,ve=280,J=300,re=H-v.right,je=v.left,et=te-v.bottom,es=re>=ve||re>je;A(es),et<J&&v.top>J}};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[I]),j.useEffect(()=>{const x=te=>{M.current&&!M.current.contains(te.target)&&!V.current?.contains(te.target)&&W(!1)},v=te=>{te.key==="Escape"&&W(!1)},H=()=>{I&&W(!1)};return I&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",v),window.addEventListener("scroll",H,{passive:!0})),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v),window.removeEventListener("scroll",H)}},[I]);const T=e?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:t,accentHover:`${t}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:t,accentHover:`${t}e6`,error:"#ef4444"},P={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:O?"6px":"8px",padding:O?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:T.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:O?"auto":"140px",maxWidth:O?"200px":"none",outline:"none"},avatarImage:{width:O?"28px":"32px",height:O?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${T.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:O?"13px":"14px",fontWeight:600,color:T.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:O?"80px":"120px"},userEmail:{fontSize:O?"11px":"12px",color:T.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:O?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:I?"rotate(180deg)":"rotate(0deg)",color:T.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[U?"left":"right"]:"0",backgroundColor:T.surfaceElevated,border:`1px solid ${T.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:I?1:0,pointerEvents:I?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:I?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:O?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:O?"10px":"12px",padding:O?"14px":"16px"},dropdownAvatar:{width:O?"40px":"48px",height:O?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${T.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:O?"15px":"16px",fontWeight:600,color:T.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:O?"13px":"14px",color:T.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:O?"10px":"12px",padding:O?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:T.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:O?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:O?"16px":"18px",height:O?"16px":"18px",color:T.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:O?"10px":"12px",padding:O?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:O?"13px":"14px",color:T.error,textAlign:"left",outline:"none"},loadingText:{padding:O?"16px 12px":"20px 16px",textAlign:"center",color:T.textSecondary,fontSize:O?"13px":"14px"},errorState:{padding:O?"16px 12px":"20px 16px",textAlign:"center",color:T.textSecondary,fontSize:O?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:T.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},B=()=>{w(null),m(!0);const x=localStorage.getItem("userInfo");if(x)try{const v=JSON.parse(x);F(v),N(v.id)}catch{w("Invalid user data")}m(!1)},q=(x,v)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),v())},f=()=>i||S?.profileUrl,R=()=>{const x=f();x&&window.open(x,"_blank","noopener,noreferrer")},L=()=>{a&&window.open(a,"_blank","noopener,noreferrer")};return s.jsxs("div",{style:P.wrapper,ref:M,className:o,role:"menu","aria-label":"User menu",children:[s.jsxs("div",{ref:V,style:P.avatarButton,onClick:()=>W(x=>!x),onKeyDown:x=>q(x,()=>W(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":I,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=T.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[S?.avatarUrl?s.jsx("img",{src:S.avatarUrl,alt:`${S.name}'s avatar`,style:P.avatarImage,loading:"lazy",onError:x=>{const v=x.target;v.src=`https://api.dicebear.com/9.x/avataaars/svg?seed=${S.name||"user"}`}}):s.jsx("img",{src:`https://api.dicebear.com/9.x/avataaars/svg?seed=${S?.name||"user"}`,alt:"Default user avatar",style:P.avatarImage,loading:"lazy"}),!O&&s.jsxs("div",{style:P.userInfo,children:[s.jsx("div",{style:P.userName,title:S?.name,children:S?.name||"Guest"}),S?.email&&s.jsx("div",{style:P.userEmail,title:S.email,children:S.email})]}),s.jsx(Pn,{size:O?14:16,style:P.chevron,"aria-hidden":"true"})]}),I&&s.jsx("div",{style:P.dropdown,role:"menu","aria-label":"User options",children:D?s.jsx("div",{style:P.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):S?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:P.userSection,children:[S?.avatarUrl?s.jsx("img",{src:S.avatarUrl,alt:`${S.name}'s profile picture`,style:P.dropdownAvatar,loading:"lazy",onError:x=>{const v=x.target;v.src=`https://api.dicebear.com/9.x/avataaars/svg?seed=${S.name}`}}):s.jsx("img",{src:`https://api.dicebear.com/9.x/avataaars/svg?seed=${S.name}`,alt:`${S.name}'s default avatar`,style:P.dropdownAvatar,loading:"lazy"}),s.jsxs("div",{style:P.dropdownUserInfo,children:[s.jsx("div",{style:P.dropdownUserName,title:S.name,children:S.name}),s.jsx("div",{style:P.dropdownUserEmail,title:S.email,children:S.email})]})]}),s.jsxs("div",{style:P.dropdownSection,children:[l&&f()&&s.jsxs("button",{style:P.menuItem,onClick:R,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,R),role:"menuitem",tabIndex:0,children:[s.jsx(fe,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:u})]}),h&&a&&s.jsxs("button",{style:P.menuItem,onClick:L,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,L),role:"menuitem",tabIndex:0,children:[s.jsx(Dn,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:b})]}),p&&S.profileUrl&&s.jsxs("a",{href:S.profileUrl,target:"_blank",rel:"noopener noreferrer",style:P.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[s.jsx(Se,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:C})]})]}),s.jsx("div",{style:P.dropdownSection,children:s.jsxs("button",{style:P.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,r),role:"menuitem",tabIndex:0,children:[s.jsx(Vt,{style:{...P.icon,color:T.error},"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:k})]})})]}):s.jsxs("div",{style:P.errorState,role:"alert",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsx(ae,{size:16,"aria-hidden":"true"}),s.jsx("span",{children:_||"Not signed in"})]}),_&&_!=="Not signed in"&&s.jsx("button",{style:P.retryButton,onClick:B,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=T.accent},children:"Try Again"})]})})]})};X.NeuctraAuthix=bn,X.ReactSignedIn=Yn,X.ReactSignedOut=Jn,X.ReactUserButton=Qn,X.ReactUserLogin=Hn,X.ReactUserProfile=Zn,X.ReactUserSignUp=$n,X.getSdkConfig=ie,X.setSdkConfig=Bn,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ReactUserSignUp } from "./UserSignUp.js";
|
|
2
2
|
export { ReactUserLogin } from "./UserLogin.js";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { ReactSignedIn } from "./SignedIn.js";
|
|
4
|
+
export { ReactSignedOut } from "./SignedOut.js";
|
|
5
5
|
export { ReactUserProfile } from "./UserProfile.js";
|
|
6
6
|
export { ReactUserButton } from "./UserButton.js";
|