@hanzo/ui 5.5.1 → 5.6.0

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.
File without changes
File without changes
File without changes
File without changes
File without changes
package/bin/test-mcp.sh CHANGED
File without changes
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var j=Object.defineProperty;var n=(t,e)=>j(t,"name",{value:e,configurable:true});function Y({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,label:r="Sign in with Hanzo",className:l="",variant:s="default"}){let[c,i]=react.useState(false),u=react.useCallback(()=>{i(true);let a=o||`${window.location.origin}/auth/callback`,m=crypto.randomUUID(),h=new URL(`${t}/login/oauth/authorize`);h.searchParams.set("client_id",e),h.searchParams.set("response_type","code"),h.searchParams.set("redirect_uri",a),h.searchParams.set("scope","openid profile email"),h.searchParams.set("state",m),window.location.href=h.toString();},[t,e,o]);return jsxRuntime.jsxs("button",{type:"button",className:`inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${s==="outline"?"border border-[#333] bg-transparent text-white hover:bg-[#1a1a1f]":"bg-white text-black hover:bg-[#e5e5e5]"} ${l}`,onClick:u,disabled:c,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("text",{x:"4",y:"26",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",fontSize:"28",fontWeight:"700",fill:"currentColor",children:"H"})}),c?"Redirecting...":r]})}n(Y,"IAMLoginButton");var E="hanzo-auth-token",S="hanzo-user",$="hanzo-auth-expires",V="https://iam.hanzo.ai",X={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function A(){let[t,e]=react.useState(void 0),[o,r]=react.useState([]),[l,s]=react.useState(void 0),[c,i]=react.useState(null),[u,f]=react.useState(true),g=react.useCallback(async()=>{try{let h=localStorage.getItem(E),H=localStorage.getItem($);if(!h||H&&Date.now()>Number(H)){f(!1);return}i(h);let R=localStorage.getItem(S);if(R)try{let p=JSON.parse(R);p?.email&&e({id:p.id,name:p.displayName||p.name,email:p.email,avatar:p.avatar});}catch{}let U=await fetch(`${V}/api/userinfo`,{headers:{Authorization:`Bearer ${h}`}});if(U.ok){let p=await U.json(),B={id:p.sub||p.id,name:p.name||p.displayName,email:p.email,avatar:p.picture||p.avatar};e(B),localStorage.setItem(S,JSON.stringify(p));let x=(p.groups||[]).map(G=>{let D=G.toLowerCase().replace(/^\//,""),k=X[D];return k?{id:D,name:k.name,slug:k.slug}:null}).filter(Boolean);x.length===0&&B.email&&x.push({id:"personal",name:"Personal",slug:"personal"}),r(x),s(x[0]?.id);}}catch{}finally{f(false);}},[]);react.useEffect(()=>{g();},[g]);let a=react.useCallback(()=>{localStorage.removeItem(E),localStorage.removeItem(S),localStorage.removeItem($),window.location.href="https://hanzo.id";},[]),m=react.useCallback(h=>{s(h);},[]);return {user:t,organizations:o,currentOrgId:l,token:c,loading:u,signOut:a,switchOrg:m}}n(A,"useHanzoAuth");function Q({loginUrl:t,clientId:e,fallback:o,children:r}){let{user:l,loading:s}=A();return react.useEffect(()=>{if(!s&&!l)if(t)window.location.href=t;else if(e){let c=`${window.location.origin}/auth/callback`,i=new URL("https://hanzo.id/login/oauth/authorize");i.searchParams.set("client_id",e),i.searchParams.set("response_type","code"),i.searchParams.set("redirect_uri",c),i.searchParams.set("scope","openid profile email"),window.location.href=i.toString();}else window.location.href="https://hanzo.id";},[s,l,t,e]),s?jsxRuntime.jsx(jsxRuntime.Fragment,{children:o??jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:r}):null}n(Q,"AuthGuard");var O={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var tt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function et(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(et,"hashStr");function y(t,e,o){return t%(e*(o+1))%e}n(y,"getUnit");function ot(t,e){return y(t,2,e)===0}n(ot,"getBoolean");function F(t,e,o){return o[y(t,o.length,e)]}n(F,"getRandomColor");function st(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16);return e*.299+o*.587+r*.114>128?"#000":"#fff"}n(st,"getContrast");function T({name:t,size:e=40,colors:o=tt,className:r,square:l=false}){let s=et(t),c=F(s,0,o),i=st(c),u=ot(s,2),f=y(s,3,7),g=y(s,5,8),a=y(s,10,9),m=a>6?a-10:a,h=y(s,5,10)>3?y(s,5,10)-5:y(s,5,10);return jsxRuntime.jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:r,style:l?void 0:{borderRadius:"50%"},children:[jsxRuntime.jsx("mask",{id:`beam-${s}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsxRuntime.jsx("rect",{width:36,height:36,rx:l?void 0:72,fill:"#fff"})}),jsxRuntime.jsxs("g",{mask:`url(#beam-${s})`,children:[jsxRuntime.jsx("rect",{width:36,height:36,fill:c}),jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${m} ${h}) rotate(${a} 18 18)`,fill:F(s,1,o),rx:6}),jsxRuntime.jsxs("g",{transform:`translate(${m} ${h}) rotate(${a} 18 18)`,children:[u?jsxRuntime.jsx("path",{d:`M15 ${19+f}c2 1 4 1 6 0`,stroke:i,fill:"none",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:`M13 ${19+f}a1 .75 0 0 0 10 0`,fill:i}),jsxRuntime.jsx("rect",{x:14-g,y:14,width:1.5,height:2,rx:1,fill:i}),jsxRuntime.jsx("rect",{x:20+g,y:14,width:1.5,height:2,rx:1,fill:i})]})]})]})}n(T,"BeamAvatar");async function rt(t){let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(r)).map(l=>l.toString(16).padStart(2,"0")).join("")}n(rt,"sha256");function nt(t,e){let[o,r]=react.useState(null);return react.useMemo(()=>{if(!t){r(null);return}let l=t.trim().toLowerCase();rt(l).then(s=>{r(`https://www.gravatar.com/avatar/${s}?s=${e||80}&d=404`);});},[t,e]),o}n(nt,"useGravatarUrl");function _({src:t,email:e,name:o,size:r=40,colors:l,className:s}){let[c,i]=react.useState(false),[u,f]=react.useState(false),g=nt(e,r*2),a=`rounded-full object-cover ${s||""}`,m={width:r,height:r};return t&&!c?jsxRuntime.jsx("img",{src:t,alt:o||e||"avatar",className:a,style:m,onError:()=>i(true)}):g&&!u?jsxRuntime.jsx("img",{src:g,alt:o||e||"avatar",className:a,style:m,onError:()=>f(true)}):jsxRuntime.jsx(T,{name:o||e||"user",size:r,colors:l,className:s})}n(_,"UserAvatar");function ht({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:r,onSignOut:l}){let[s,c]=react.useState(false),i=react.useRef(null);if(react.useEffect(()=>{let a=n(m=>{i.current&&!i.current.contains(m.target)&&c(false);},"handler");return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),!t)return null;let u=e.find(a=>a.id===o),f=u?.slug||"hanzo",g=O[f]||O.hanzo;return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>c(a=>!a),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsx(_,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxRuntime.jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsxRuntime.jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsxRuntime.jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsxRuntime.jsx("path",{d:"M6 9l6 6 6-6"})})]}),s&&jsxRuntime.jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsxRuntime.jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsxRuntime.jsx("p",{className:"text-[11px] text-white/40",children:t.email}),u&&jsxRuntime.jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:u.name})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsxRuntime.jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(a=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r?.(a.id),c(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-[13px] text-white/70",children:a.name}),a.role&&jsxRuntime.jsx("span",{className:"text-[10px] text-white/25 capitalize",children:a.role})]}),a.id===o&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},a.id))]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsx("a",{href:`${g.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Account settings"}),jsxRuntime.jsx("a",{href:g.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Billing"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{c(false),l?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(ht,"UserOrgDropdown");
3
+ exports.AuthGuard=Q;exports.IAMLoginButton=Y;exports.UserOrgDropdown=ht;exports.useHanzoAuth=A;
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import {useState,useCallback,useEffect,useRef,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var j=Object.defineProperty;var n=(t,e)=>j(t,"name",{value:e,configurable:true});function Y({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,label:r="Sign in with Hanzo",className:l="",variant:s="default"}){let[c,i]=useState(false),u=useCallback(()=>{i(true);let a=o||`${window.location.origin}/auth/callback`,m=crypto.randomUUID(),h=new URL(`${t}/login/oauth/authorize`);h.searchParams.set("client_id",e),h.searchParams.set("response_type","code"),h.searchParams.set("redirect_uri",a),h.searchParams.set("scope","openid profile email"),h.searchParams.set("state",m),window.location.href=h.toString();},[t,e,o]);return jsxs("button",{type:"button",className:`inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${s==="outline"?"border border-[#333] bg-transparent text-white hover:bg-[#1a1a1f]":"bg-white text-black hover:bg-[#e5e5e5]"} ${l}`,onClick:u,disabled:c,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:jsx("text",{x:"4",y:"26",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",fontSize:"28",fontWeight:"700",fill:"currentColor",children:"H"})}),c?"Redirecting...":r]})}n(Y,"IAMLoginButton");var E="hanzo-auth-token",S="hanzo-user",$="hanzo-auth-expires",V="https://iam.hanzo.ai",X={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function A(){let[t,e]=useState(void 0),[o,r]=useState([]),[l,s]=useState(void 0),[c,i]=useState(null),[u,f]=useState(true),g=useCallback(async()=>{try{let h=localStorage.getItem(E),H=localStorage.getItem($);if(!h||H&&Date.now()>Number(H)){f(!1);return}i(h);let R=localStorage.getItem(S);if(R)try{let p=JSON.parse(R);p?.email&&e({id:p.id,name:p.displayName||p.name,email:p.email,avatar:p.avatar});}catch{}let U=await fetch(`${V}/api/userinfo`,{headers:{Authorization:`Bearer ${h}`}});if(U.ok){let p=await U.json(),B={id:p.sub||p.id,name:p.name||p.displayName,email:p.email,avatar:p.picture||p.avatar};e(B),localStorage.setItem(S,JSON.stringify(p));let x=(p.groups||[]).map(G=>{let D=G.toLowerCase().replace(/^\//,""),k=X[D];return k?{id:D,name:k.name,slug:k.slug}:null}).filter(Boolean);x.length===0&&B.email&&x.push({id:"personal",name:"Personal",slug:"personal"}),r(x),s(x[0]?.id);}}catch{}finally{f(false);}},[]);useEffect(()=>{g();},[g]);let a=useCallback(()=>{localStorage.removeItem(E),localStorage.removeItem(S),localStorage.removeItem($),window.location.href="https://hanzo.id";},[]),m=useCallback(h=>{s(h);},[]);return {user:t,organizations:o,currentOrgId:l,token:c,loading:u,signOut:a,switchOrg:m}}n(A,"useHanzoAuth");function Q({loginUrl:t,clientId:e,fallback:o,children:r}){let{user:l,loading:s}=A();return useEffect(()=>{if(!s&&!l)if(t)window.location.href=t;else if(e){let c=`${window.location.origin}/auth/callback`,i=new URL("https://hanzo.id/login/oauth/authorize");i.searchParams.set("client_id",e),i.searchParams.set("response_type","code"),i.searchParams.set("redirect_uri",c),i.searchParams.set("scope","openid profile email"),window.location.href=i.toString();}else window.location.href="https://hanzo.id";},[s,l,t,e]),s?jsx(Fragment,{children:o??jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):l?jsx(Fragment,{children:r}):null}n(Q,"AuthGuard");var O={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var tt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function et(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(et,"hashStr");function y(t,e,o){return t%(e*(o+1))%e}n(y,"getUnit");function ot(t,e){return y(t,2,e)===0}n(ot,"getBoolean");function F(t,e,o){return o[y(t,o.length,e)]}n(F,"getRandomColor");function st(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16);return e*.299+o*.587+r*.114>128?"#000":"#fff"}n(st,"getContrast");function T({name:t,size:e=40,colors:o=tt,className:r,square:l=false}){let s=et(t),c=F(s,0,o),i=st(c),u=ot(s,2),f=y(s,3,7),g=y(s,5,8),a=y(s,10,9),m=a>6?a-10:a,h=y(s,5,10)>3?y(s,5,10)-5:y(s,5,10);return jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:r,style:l?void 0:{borderRadius:"50%"},children:[jsx("mask",{id:`beam-${s}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsx("rect",{width:36,height:36,rx:l?void 0:72,fill:"#fff"})}),jsxs("g",{mask:`url(#beam-${s})`,children:[jsx("rect",{width:36,height:36,fill:c}),jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${m} ${h}) rotate(${a} 18 18)`,fill:F(s,1,o),rx:6}),jsxs("g",{transform:`translate(${m} ${h}) rotate(${a} 18 18)`,children:[u?jsx("path",{d:`M15 ${19+f}c2 1 4 1 6 0`,stroke:i,fill:"none",strokeLinecap:"round"}):jsx("path",{d:`M13 ${19+f}a1 .75 0 0 0 10 0`,fill:i}),jsx("rect",{x:14-g,y:14,width:1.5,height:2,rx:1,fill:i}),jsx("rect",{x:20+g,y:14,width:1.5,height:2,rx:1,fill:i})]})]})]})}n(T,"BeamAvatar");async function rt(t){let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(r)).map(l=>l.toString(16).padStart(2,"0")).join("")}n(rt,"sha256");function nt(t,e){let[o,r]=useState(null);return useMemo(()=>{if(!t){r(null);return}let l=t.trim().toLowerCase();rt(l).then(s=>{r(`https://www.gravatar.com/avatar/${s}?s=${e||80}&d=404`);});},[t,e]),o}n(nt,"useGravatarUrl");function _({src:t,email:e,name:o,size:r=40,colors:l,className:s}){let[c,i]=useState(false),[u,f]=useState(false),g=nt(e,r*2),a=`rounded-full object-cover ${s||""}`,m={width:r,height:r};return t&&!c?jsx("img",{src:t,alt:o||e||"avatar",className:a,style:m,onError:()=>i(true)}):g&&!u?jsx("img",{src:g,alt:o||e||"avatar",className:a,style:m,onError:()=>f(true)}):jsx(T,{name:o||e||"user",size:r,colors:l,className:s})}n(_,"UserAvatar");function ht({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:r,onSignOut:l}){let[s,c]=useState(false),i=useRef(null);if(useEffect(()=>{let a=n(m=>{i.current&&!i.current.contains(m.target)&&c(false);},"handler");return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),!t)return null;let u=e.find(a=>a.id===o),f=u?.slug||"hanzo",g=O[f]||O.hanzo;return jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>c(a=>!a),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsx(_,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsx("path",{d:"M6 9l6 6 6-6"})})]}),s&&jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsx("p",{className:"text-[11px] text-white/40",children:t.email}),u&&jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:u.name})]}),e.length>0&&jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(a=>jsxs("button",{type:"button",onClick:()=>{r?.(a.id),c(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[13px] text-white/70",children:a.name}),a.role&&jsx("span",{className:"text-[10px] text-white/25 capitalize",children:a.role})]}),a.id===o&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},a.id))]}),jsxs("div",{className:"p-2",children:[jsx("a",{href:`${g.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Account settings"}),jsx("a",{href:g.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Billing"}),jsx("button",{type:"button",onClick:()=>{c(false),l?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(ht,"UserOrgDropdown");
3
+ export{Q as AuthGuard,Y as IAMLoginButton,ht as UserOrgDropdown,A as useHanzoAuth};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "description": "Multi-framework UI library with React, Vue, Svelte, and React Native support. Based on shadcn/ui with comprehensive framework coverage.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -45,6 +45,29 @@
45
45
  "sdk",
46
46
  "ui"
47
47
  ],
48
+ "scripts": {
49
+ "lat": "npm show @hanzo/ui version",
50
+ "pub": "npm publish",
51
+ "tc": "tsc --project tsconfig.build.json",
52
+ "build": "npm run clean && npm run build:minimal && npm run tc",
53
+ "build:minimal": "tsup --config tsup.config.minimal.ts",
54
+ "build:namespaces": "tsup --config tsup.config.namespaces.ts",
55
+ "build:full": "tsup --config tsup.config.production.ts",
56
+ "build:frameworks": "npm run build",
57
+ "build:watch": "tsup --watch",
58
+ "build:check": "tsc --project tsconfig.build.json --noEmit",
59
+ "clean": "rm -rf dist",
60
+ "prepublishOnly": "npm run build",
61
+ "update-registry": "node ./bin/update-registry.js",
62
+ "registry:mcp": "node ./bin/cli.js registry:mcp",
63
+ "registry:mcp:http": "node ./bin/cli.js registry:mcp --http",
64
+ "analyze:frameworks": "node analyze-frameworks.js",
65
+ "test": "vitest",
66
+ "test:ui": "vitest --ui",
67
+ "test:coverage": "vitest --coverage",
68
+ "test:jest": "jest test/multi-framework.test.js",
69
+ "test:frameworks": "jest test/multi-framework.test.js --verbose"
70
+ },
48
71
  "bin": {
49
72
  "hanzo-ui": "./bin/cli.js"
50
73
  },
@@ -256,18 +279,18 @@
256
279
  "require": "./dist/drawer.js"
257
280
  },
258
281
  "./dash": {
259
- "types": "./dist/dash/index.d.ts",
282
+ "types": "./dist/src/dash/index.d.ts",
260
283
  "import": "./dist/dash/index.mjs",
261
284
  "require": "./dist/dash/index.js"
262
285
  },
263
286
  "./dash/tokens.css": "./src/dash/tokens.css",
264
287
  "./dash/*": {
265
- "types": "./dist/dash/*.d.ts",
288
+ "types": "./dist/src/dash/*.d.ts",
266
289
  "import": "./dist/dash/*.mjs",
267
290
  "require": "./dist/dash/*.js"
268
291
  },
269
292
  "./billing": {
270
- "types": "./dist/billing/index.d.ts",
293
+ "types": "./dist/src/billing/index.d.ts",
271
294
  "import": "./dist/billing/index.mjs",
272
295
  "require": "./dist/billing/index.js"
273
296
  },
@@ -504,22 +527,22 @@
504
527
  "require": "./dist/pattern/*.js"
505
528
  },
506
529
  "./auth": {
507
- "types": "./dist/auth/index.d.ts",
530
+ "types": "./dist/src/auth/index.d.ts",
508
531
  "import": "./dist/auth/index.mjs",
509
532
  "require": "./dist/auth/index.js"
510
533
  },
511
534
  "./auth/*": {
512
- "types": "./dist/auth/*.d.ts",
535
+ "types": "./dist/src/auth/*.d.ts",
513
536
  "import": "./dist/auth/*.mjs",
514
537
  "require": "./dist/auth/*.js"
515
538
  },
516
539
  "./navigation": {
517
- "types": "./dist/navigation/index.d.ts",
540
+ "types": "./dist/src/navigation/index.d.ts",
518
541
  "import": "./dist/navigation/index.mjs",
519
542
  "require": "./dist/navigation/index.js"
520
543
  },
521
544
  "./navigation/*": {
522
- "types": "./dist/navigation/*.d.ts",
545
+ "types": "./dist/src/navigation/*.d.ts",
523
546
  "import": "./dist/navigation/*.mjs",
524
547
  "require": "./dist/navigation/*.js"
525
548
  },
@@ -638,11 +661,11 @@
638
661
  }
639
662
  },
640
663
  "dependencies": {
641
- "@next/third-parties": "^15.3.3",
664
+ "@next/third-parties": "^16.2.1",
642
665
  "@radix-ui/react-accordion": "^1.2.12",
643
666
  "@radix-ui/react-alert-dialog": "^1.1.15",
644
- "@radix-ui/react-aspect-ratio": "^1.1.7",
645
- "@radix-ui/react-avatar": "^1.1.10",
667
+ "@radix-ui/react-aspect-ratio": "^1.1.8",
668
+ "@radix-ui/react-avatar": "^1.1.11",
646
669
  "@radix-ui/react-checkbox": "^1.3.3",
647
670
  "@radix-ui/react-collapsible": "^1.1.12",
648
671
  "@radix-ui/react-context-menu": "^2.2.16",
@@ -650,17 +673,17 @@
650
673
  "@radix-ui/react-dropdown-menu": "^2.1.16",
651
674
  "@radix-ui/react-hover-card": "^1.1.15",
652
675
  "@radix-ui/react-icons": "^1.3.2",
653
- "@radix-ui/react-label": "^2.1.7",
676
+ "@radix-ui/react-label": "^2.1.8",
654
677
  "@radix-ui/react-menubar": "1.1.16",
655
678
  "@radix-ui/react-navigation-menu": "^1.2.14",
656
679
  "@radix-ui/react-popover": "^1.1.15",
657
- "@radix-ui/react-progress": "^1.1.7",
680
+ "@radix-ui/react-progress": "^1.1.8",
658
681
  "@radix-ui/react-radio-group": "^1.3.8",
659
682
  "@radix-ui/react-scroll-area": "^1.2.10",
660
683
  "@radix-ui/react-select": "^2.2.6",
661
- "@radix-ui/react-separator": "^1.1.7",
684
+ "@radix-ui/react-separator": "^1.1.8",
662
685
  "@radix-ui/react-slider": "^1.3.6",
663
- "@radix-ui/react-slot": "^1.2.3",
686
+ "@radix-ui/react-slot": "^1.2.4",
664
687
  "@radix-ui/react-switch": "^1.2.6",
665
688
  "@radix-ui/react-tabs": "^1.1.13",
666
689
  "@radix-ui/react-toast": "^1.2.15",
@@ -673,27 +696,25 @@
673
696
  "class-variance-authority": "^0.7.1",
674
697
  "clsx": "^2.1.1",
675
698
  "cmdk": "^1.1.1",
676
- "commander": "^12.1.0",
677
- "embla-carousel-react": "^8.0.0",
678
- "input-otp": "^1.2.4",
679
- "little-date": "^1.0.0",
699
+ "commander": "^14.0.3",
700
+ "embla-carousel-react": "^8.6.0",
701
+ "input-otp": "^1.4.2",
702
+ "little-date": "^1.2.1",
680
703
  "lodash.castarray": "^4.4.0",
681
704
  "lodash.isplainobject": "^4.0.6",
682
705
  "lodash.merge": "^4.6.2",
683
- "postcss-selector-parser": "^7.0.0",
684
- "react-intersection-observer": "^9.8.2",
685
- "sonner": "^2.0.0",
706
+ "postcss-selector-parser": "^7.1.1",
707
+ "react-intersection-observer": "^10.0.3",
708
+ "sonner": "^2.0.7",
686
709
  "svg-pan-zoom": "^3.6.2",
687
- "tailwind-merge": "^3.0.0",
710
+ "tailwind-merge": "^3.5.0",
688
711
  "tailwindcss-animate": "^1.0.7",
689
712
  "tailwindcss-interaction-media": "^0.1.0",
690
713
  "vaul": "^1.1.2",
691
714
  "zod": "^3.25.76",
692
- "zod-to-json-schema": "^3.23.2"
715
+ "zod-to-json-schema": "^3.25.1"
693
716
  },
694
717
  "peerDependencies": {
695
- "@rainbow-me/rainbowkit": "^2.0.0",
696
- "wagmi": "^2.0.0",
697
718
  "@dnd-kit/core": "^6.0.0",
698
719
  "@dnd-kit/modifiers": "^9.0.0",
699
720
  "@dnd-kit/sortable": "^10.0.0",
@@ -701,6 +722,7 @@
701
722
  "@hanzo/docs-core": "^16.0.0",
702
723
  "@hookform/resolvers": "^3.3.2",
703
724
  "@modelcontextprotocol/sdk": "^1.0.0",
725
+ "@rainbow-me/rainbowkit": "^2.0.0",
704
726
  "@tanstack/react-query": "^5.0.0",
705
727
  "@tanstack/react-table": "^8.0.0",
706
728
  "chrono-node": "^2.0.0",
@@ -720,7 +742,8 @@
720
742
  "recharts": "^2.0.0",
721
743
  "sql.js": "^1.0.0",
722
744
  "styled-components": "^6.0.0",
723
- "validator": "^13.11.0"
745
+ "validator": "^13.11.0",
746
+ "wagmi": "^2.0.0"
724
747
  },
725
748
  "peerDependenciesMeta": {
726
749
  "styled-components": {
@@ -806,63 +829,41 @@
806
829
  }
807
830
  },
808
831
  "devDependencies": {
809
- "@mdx-js/loader": "^3.0.0",
810
- "@mdx-js/react": "^3.0.0",
811
- "@radix-ui/react-primitive": "^2.1.3",
812
- "@splinetool/react-spline": "^4.0.0",
813
- "@tailwindcss/postcss": "^4.1.16",
832
+ "@mdx-js/loader": "^3.1.1",
833
+ "@mdx-js/react": "^3.1.1",
834
+ "@radix-ui/react-primitive": "^2.1.4",
835
+ "@splinetool/react-spline": "^4.1.0",
836
+ "@tailwindcss/postcss": "^4.2.2",
814
837
  "@testing-library/jest-dom": "^6.9.1",
815
- "@testing-library/react": "^16.3.0",
816
- "@types/facebook-pixel": "^0.0.30",
817
- "@types/gtag.js": "^0.0.19",
838
+ "@testing-library/react": "^16.3.2",
839
+ "@types/facebook-pixel": "^0.0.31",
840
+ "@types/gtag.js": "^0.0.20",
818
841
  "@types/lodash.merge": "^4.6.9",
819
842
  "@types/mdx": "^2.0.13",
820
- "@types/node": "20.14.15",
821
- "@types/react": "^19.0.0",
822
- "@types/react-dom": "^19.0.0",
843
+ "@types/node": "25.5.0",
844
+ "@types/react": "19.2.14",
845
+ "@types/react-dom": "19.2.3",
823
846
  "@types/react-syntax-highlighter": "^15.5.13",
824
847
  "@types/styled-components": "^5.1.36",
825
- "@vitejs/plugin-react": "^5.0.4",
826
- "@vitest/coverage-v8": "^4.0.6",
827
- "@vitest/ui": "^4.0.6",
848
+ "@vitejs/plugin-react": "^6.0.1",
849
+ "@vitest/coverage-v8": "^4.1.0",
850
+ "@vitest/ui": "^4.1.0",
828
851
  "embla-carousel": "^8.6.0",
829
852
  "filesize": "^11.0.13",
830
- "glob": "^11.0.2",
831
- "jest": "^30.1.3",
832
- "jsdom": "^27.0.0",
833
- "react-dropzone": "^14.3.8",
853
+ "glob": "^13.0.6",
854
+ "jest": "^30.3.0",
855
+ "jsdom": "^29.0.1",
856
+ "react-dropzone": "^15.0.0",
834
857
  "react-markdown": "^10.1.0",
835
- "react-syntax-highlighter": "^15.6.6",
858
+ "react-syntax-highlighter": "^16.1.1",
836
859
  "rehype-katex": "^7.0.1",
837
860
  "remark-gfm": "^4.0.1",
838
861
  "remark-math": "^6.0.0",
839
- "styled-components": "^6.3.8",
840
- "tailwindcss": "^4.1.16",
841
- "tsup": "^8.5.0",
842
- "tw-animate-css": "^1.2.9",
862
+ "styled-components": "^6.3.12",
863
+ "tailwindcss": "^4.2.2",
864
+ "tsup": "^8.5.1",
865
+ "tw-animate-css": "^1.4.0",
843
866
  "typescript": "^5.9.3",
844
- "vitest": "4.0.6"
845
- },
846
- "scripts": {
847
- "lat": "npm show @hanzo/ui version",
848
- "pub": "npm publish",
849
- "tc": "tsc --project tsconfig.build.json",
850
- "build": "npm run clean && npm run build:minimal && npm run tc",
851
- "build:minimal": "tsup --config tsup.config.minimal.ts",
852
- "build:namespaces": "tsup --config tsup.config.namespaces.ts",
853
- "build:full": "tsup --config tsup.config.production.ts",
854
- "build:frameworks": "npm run build",
855
- "build:watch": "tsup --watch",
856
- "build:check": "tsc --project tsconfig.build.json --noEmit",
857
- "clean": "rm -rf dist",
858
- "update-registry": "node ./bin/update-registry.js",
859
- "registry:mcp": "node ./bin/cli.js registry:mcp",
860
- "registry:mcp:http": "node ./bin/cli.js registry:mcp --http",
861
- "analyze:frameworks": "node analyze-frameworks.js",
862
- "test": "vitest",
863
- "test:ui": "vitest --ui",
864
- "test:coverage": "vitest --coverage",
865
- "test:jest": "jest test/multi-framework.test.js",
866
- "test:frameworks": "jest test/multi-framework.test.js --verbose"
867
+ "vitest": "4.1.0"
867
868
  }
868
- }
869
+ }