@rizom/brain 0.2.0-alpha.227 → 0.2.0-alpha.228
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.
- package/dist/brain.js +440 -440
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/site.js +14 -14
- package/dist/site.js.map +1 -1
- package/dist/ui/account-app.js +36 -35
- package/dist/ui/account-app.js.map +2 -2
- package/dist/ui/admin-app.js +3 -2
- package/dist/ui/admin-app.js.map +2 -2
- package/package.json +1 -1
package/dist/ui/admin-app.js
CHANGED
|
@@ -583,7 +583,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
583
583
|
position: fixed;
|
|
584
584
|
right: 24px;
|
|
585
585
|
bottom: 24px;
|
|
586
|
-
|
|
586
|
+
/* Above .people-modal-layer so mutation errors stay visible in dialogs. */
|
|
587
|
+
z-index: 1300;
|
|
587
588
|
max-width: min(380px, calc(100vw - 48px));
|
|
588
589
|
margin: 0;
|
|
589
590
|
padding: 10px 14px;
|
|
@@ -1235,4 +1236,4 @@ button.people-metric:hover {
|
|
|
1235
1236
|
}
|
|
1236
1237
|
`;var T3={all:["admin"],anchor:()=>["admin","anchor"],users:()=>["admin","users"],audit:()=>["admin","audit"]};function VL(){return{queryKey:T3.anchor(),queryFn:async()=>(await _L()).anchor}}function SL(){return{queryKey:T3.users(),queryFn:async()=>(await FL()).users}}function EL(){return{queryKey:T3.audit(),queryFn:async()=>(await QL()).events}}async function kL(G,B){await Promise.all([G.invalidateQueries({queryKey:T3.anchor()}),G.invalidateQueries({queryKey:T3.users()}),G.invalidateQueries({queryKey:T3.audit()})])}var G0=L0(K1(),1);var DL="brains:admin-peer-invitation";function jL(G){let B=G.bootstrap.role==="admin",L=B6(),R=A7({...VL(),enabled:B,...G.initialAnchor!==void 0?{initialData:G.initialAnchor}:{}}),I=A7({...SL(),enabled:B,...G.initialUsers!==void 0?{initialData:G.initialUsers}:{}}),C=A7({...EL(),enabled:B,...G.initialAudit!==void 0?{initialData:G.initialAudit}:{}}),k=I.data??[],M=C.data??[],b=R.data,q=(b?.configuredKind??"person")==="organization",P=q?"People":"Members",E=q?"person":"member",i=k.filter((U)=>U.status!=="invited"),U0=k.filter((U)=>U.status==="invited"),s=k.filter((U)=>U.role==="admin"&&U.status==="active").length,[J0,S0]=U8.useState(G.initialUsers?.find((U)=>U.userId===G.bootstrap.userId)?.userId??G.initialUsers?.find((U)=>U.status!=="invited")?.userId),[y0,j0]=U8.useState("overview"),[b0,o0]=U8.useState(null),{feedback:E1,runWithFeedback:d0}=CL(),{mutateAsync:n}=lZ({mutationFn:(U)=>RL(U),onSuccess:async(U,S)=>kL(L,S.action)}),N1=B&&(R.isPending||I.isPending||C.isPending),f=R.error??I.error??C.error,u0=f?uZ(f,"Admin unavailable"):null,K0=U8.useMemo(()=>i.find((U)=>U.userId===J0),[i,J0]);U8.useEffect(()=>{S0((U)=>{if(i.some((S)=>S.userId===U))return U;return i.find((S)=>S.userId===G.bootstrap.userId)?.userId??i[0]?.userId})},[i,G.bootstrap.userId]),U8.useEffect(()=>{if(!B||typeof window>"u")return;let U=window.sessionStorage.getItem(DL);if(!U)return;window.sessionStorage.removeItem(DL);try{let S=JSON.parse(U);if(typeof S.peerId!=="string"||!S.peerId.trim())return;j0("invitations"),o0({kind:"add",draft:{peerId:S.peerId,...typeof S.displayName==="string"&&S.displayName.trim()?{displayName:S.displayName}:{}}})}catch{}},[B]);let Y0=U8.useCallback(async(U,S,o="Access record updated")=>d0(async()=>{let X0=await n(U);if(S)S0(S);return X0},{fallback:"Mutation failed",success:o}),[n,d0]),r0=()=>o0(null),d=(U,S,o=S.delivery.label)=>{S0(U.userId),o0({kind:"setup",setupUrl:S.setupUrl,copy:`This single-use link is bound to ${o}. Deliver it only through that confirmed private channel, and open it in the intended person’s browser or a private window—not an existing Admin session. It expires ${A6(S.expiresAt*1000)}.`})},e=(U)=>{Y0({action:A1.startPasskeyRegistration,confirmation:A1.startPasskeyRegistration,userId:U.userId},U.userId,"Setup link created").then((S)=>{let o=S.registration;d(U,o)}).catch(()=>{return})},r=async(U)=>{if(U.peerId){let C0=await Y0({action:A1.inviteExternalPeerPerson,confirmation:A1.inviteExternalPeerPerson,peerId:U.peerId,displayName:U.displayName,role:U.role,delivery:U.delivery},void 0,"Invitation created");d(C0.user,C0.registration,U.delivery.type==="email"?U.delivery.subject:U.delivery.label);return}let S=await Y0({action:A1.createUser,confirmation:A1.createUser,displayName:U.displayName,role:U.role,status:"invited"},void 0,"Invitation created"),o=await Y0({action:A1.startPasskeyRegistration,confirmation:A1.startPasskeyRegistration,userId:S.user.userId,delivery:U.delivery},S.user.userId,"Setup link created");d(S.user,o.registration,U.delivery.type==="email"?U.delivery.subject:U.delivery.label)},E0=()=>j0("members"),k0=()=>j0("invitations");return G0.jsxDEV(G0.Fragment,{children:[G0.jsxDEV("style",{children:qL},void 0,!1,void 0,this),G0.jsxDEV("div",{className:"people-surface",children:[G0.jsxDEV("header",{className:"admin-hero",children:[G0.jsxDEV("div",{children:[G0.jsxDEV("h1",{children:"Admin"},void 0,!1,void 0,this),G0.jsxDEV("p",{children:q?"people · invitations · audit":"members · invitations · audit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G0.jsxDEV("div",{className:"admin-hero-meta",children:[G0.jsxDEV("span",{children:["brain ",G0.jsxDEV("strong",{children:G.bootstrap.brainName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G0.jsxDEV("span",{children:[i.length," ",i.length===1?"member":"members"," ·"," ",s," ",s===1?"admin":"admins"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G0.jsxDEV("nav",{className:"admin-tabs","aria-label":"Administration sections",children:["overview","members","invitations","audit"].map((U)=>G0.jsxDEV("button",{className:y0===U?"is-active":"",type:"button",onClick:()=>j0(U),children:[U==="members"?P:U[0]?.toUpperCase()+U.slice(1),U==="invitations"&&U0.length>0?G0.jsxDEV("small",{children:U0.length},void 0,!1,void 0,this):null]},U,!0,void 0,this))},void 0,!1,void 0,this),!B?G0.jsxDEV("div",{className:"card people-empty-state",children:[G0.jsxDEV("strong",{children:"Admin access required"},void 0,!1,void 0,this),G0.jsxDEV("p",{children:"This console is available only to active Administrators."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u0?G0.jsxDEV("p",{className:"people-error-banner",children:u0},void 0,!1,void 0,this):N1?G0.jsxDEV("div",{className:"people-loading",children:"Resolving private records…"},void 0,!1,void 0,this):y0==="overview"?G0.jsxDEV(IL,{anchor:b,users:k,onOpenMembers:E0,onOpenInvitations:k0},void 0,!1,void 0,this):y0==="members"?G0.jsxDEV("section",{className:"people-panel",children:[G0.jsxDEV("header",{className:"people-head",children:[G0.jsxDEV("div",{children:[G0.jsxDEV("div",{className:"eyebrow",children:"Roster"},void 0,!1,void 0,this),G0.jsxDEV("h2",{children:P},void 0,!1,void 0,this),G0.jsxDEV("p",{children:"Local accounts, sign-in, connected channels, access, and optional external peers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G0.jsxDEV(R2,{tone:"primary",onClick:()=>o0({kind:"add"}),children:["Add ",E]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G0.jsxDEV("div",{className:"people-layout",children:[G0.jsxDEV(ML,{users:i,selectedUserId:J0,currentUserId:G.bootstrap.userId,label:P,onSelect:S0},void 0,!1,void 0,this),G0.jsxDEV(mL,{user:K0,brainName:G.bootstrap.brainName,activeAdminCount:s,selfUserId:G.bootstrap.userId,onConfirm:o0,onMutation:Y0,onSetup:(U,S)=>o0({kind:"setup",setupUrl:U,copy:S})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):y0==="invitations"?G0.jsxDEV(PL,{invitations:U0,onAdd:()=>o0({kind:"add"}),onCreateSetup:e,onCancel:(U)=>o0({kind:"confirm",title:`Cancel ${U.displayName}’s invitation?`,copy:"The pending account will be suspended and its setup links revoked.",warning:"The person and peer association remain in audit history.",submitLabel:"Cancel invitation",run:async()=>{await Y0({action:A1.updateUserStatus,confirmation:A1.updateUserStatus,userId:U.userId,status:"suspended"},void 0,"Invitation cancelled")}})},void 0,!1,void 0,this):G0.jsxDEV(vL,{events:M,users:k},void 0,!1,void 0,this)]},void 0,!0,void 0,this),E1&&G0.jsxDEV("p",{className:`people-feedback people-feedback--${E1.tone}`,role:"status",children:E1.message},void 0,!1,void 0,this),b0?.kind==="add"&&G0.jsxDEV(OL,{...b0.draft?{initialDraft:b0.draft}:{},onClose:r0,onCreate:(U)=>r(U).catch(()=>{return})},void 0,!1,void 0,this),b0?.kind==="confirm"&&G0.jsxDEV(U7,{eyebrow:"Confirm access change",title:b0.title,copy:b0.copy,onClose:r0,onSubmit:(U)=>{U.preventDefault();let S=b0.run;r0(),S().catch(()=>{return})},footer:G0.jsxDEV(G0.Fragment,{children:[G0.jsxDEV(R2,{type:"button",onClick:r0,children:"Cancel"},void 0,!1,void 0,this),G0.jsxDEV(R2,{type:"submit",tone:"danger",children:b0.submitLabel},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:G0.jsxDEV("p",{className:"people-warning",children:b0.warning},void 0,!1,void 0,this)},void 0,!1,void 0,this),b0?.kind==="setup"&&G0.jsxDEV(U7,{eyebrow:"Private delivery",title:"Passkey setup link",copy:b0.copy,onClose:r0,footer:G0.jsxDEV(R2,{tone:"primary",onClick:r0,children:"Done"},void 0,!1,void 0,this),children:[G0.jsxDEV("div",{className:"people-setup-link",children:[G0.jsxDEV("code",{children:b0.setupUrl},void 0,!1,void 0,this),G0.jsxDEV(R2,{onClick:()=>{d0(()=>navigator.clipboard.writeText(b0.setupUrl),{success:"Setup link copied",fallback:"Copy failed; select the link manually."}).catch(()=>{return})},children:"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G0.jsxDEV("p",{className:"people-warning",children:"Anyone holding this link can register a passkey until it expires or is used."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bL(){return new bZ({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var s$=L0(K1(),1),U5=document.querySelector("[data-people-root]");if(!U5)throw Error("People root element not found");var a$=U5.dataset.peopleRole,t_={userId:U5.dataset.peopleUserId??"",displayName:U5.dataset.peopleName??"Authenticated",role:a$==="admin"||a$==="trusted"||a$==="public"?a$:"public",isAnchor:U5.dataset.peopleIsAnchor==="true",brainName:U5.dataset.peopleBrainName??"brain",routePath:U5.dataset.peopleRoute??"/admin"},e_=bL();fL.createRoot(U5).render(s$.jsxDEV(dL.StrictMode,{children:s$.jsxDEV(hZ,{client:e_,children:s$.jsxDEV(jL,{bootstrap:t_},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this));
|
|
1237
1238
|
|
|
1238
|
-
//# debugId=
|
|
1239
|
+
//# debugId=C2898615735A604B64756E2164756E21
|