@abtnode/blocklet-services 1.16.44-beta-20250529-004636-15e80e20 → 1.16.44-beta-20250529-223630-10e16ac8
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/assets/{access-control-eEjmzQYf.js → access-control-BhxOcGdx.js} +1 -1
- package/dist/assets/{add-component-core-pJP41zEE.js → add-component-core-XUReAzat.js} +1 -1
- package/dist/assets/{add-resource-CZeL421l.js → add-resource-C3kDcfBw.js} +1 -1
- package/dist/assets/{advanced-P0pT0XgG.js → advanced-hz-KSWn2.js} +1 -1
- package/dist/assets/{appearance-DeIbdwlo.js → appearance-ChvtVBNv.js} +1 -1
- package/dist/assets/{audit-logs-DdN0-QQr.js → audit-logs-DXoc97BV.js} +1 -1
- package/dist/assets/{authorize-C_rSdM9R.js → authorize-_fbQ19S4.js} +1 -1
- package/dist/assets/{branding-C6umqmKR.js → branding-DpkSF6dd.js} +2 -2
- package/dist/assets/{branding-HedBd6t0.js → branding-DuPWVNlC.js} +1 -1
- package/dist/assets/{bundle-avatar-B9he3Bf1.js → bundle-avatar-D4fwror8.js} +1 -1
- package/dist/assets/{complete-D7dveRTo.js → complete-C5D4D-fJ.js} +1 -1
- package/dist/assets/{component-cssFwqtY.js → component-CURpjZJ2.js} +1 -1
- package/dist/assets/{config-eQ2Et0RC.js → config-e36Xplpo.js} +1 -1
- package/dist/assets/config-navigation-BvjYZI_j.js +26 -0
- package/dist/assets/{config-space-CQ7Atb1l.js → config-space-EoSm62Er.js} +1 -1
- package/dist/assets/{confirm-Tue92P8p.js → confirm-Vzr2I9eM.js} +1 -1
- package/dist/assets/{connect-Cm-sTMiW.js → connect-B5Xr7MId.js} +1 -1
- package/dist/assets/{connect-PdQoyrqe.js → connect-DXOsnqkO.js} +1 -1
- package/dist/assets/{connect-to-FvVJBIsZ.js → connect-to-Bz9wYM04.js} +1 -1
- package/dist/assets/{dashboard-BhR1WNzF.js → dashboard-xUr1SbPS.js} +3 -3
- package/dist/assets/{delete-confirm-CHnQ2leb.js → delete-confirm-DNn4Os6R.js} +1 -1
- package/dist/assets/{domain-FY9-unAU.js → domain-XXgOrJDa.js} +1 -1
- package/dist/assets/{domain-action-card-Jvzi8kyL.js → domain-action-card-Cf1AoKOi.js} +1 -1
- package/dist/assets/{domains-CiBZW8yk.js → domains-DeFj6Ipl.js} +1 -1
- package/dist/assets/{email-z4l1k3Mi.js → email-BIVfXnpk.js} +1 -1
- package/dist/assets/{exchange-passport-DSoEjAA_.js → exchange-passport-C9Pvr9Da.js} +1 -1
- package/dist/assets/{fuel-CzrPInoR.js → fuel-Cs--pEYt.js} +1 -1
- package/dist/assets/{gen-access-key-BU2nGVgA.js → gen-access-key-CIzULsBE.js} +1 -1
- package/dist/assets/{index-D0F0qx_R.js → index-B7IOoVDF.js} +1 -1
- package/dist/assets/{index-C1XrZATd.js → index-BCJADuMw.js} +5 -5
- package/dist/assets/{index-NQMMaHuW.js → index-BU2FTGFr.js} +1 -1
- package/dist/assets/{index-C3le1atN.js → index-BoTgqYtV.js} +1 -1
- package/dist/assets/{index-5EytSaVA.js → index-C64IgZKt.js} +1 -1
- package/dist/assets/{index-D2a97Hdb.js → index-CsXmgylH.js} +3 -3
- package/dist/assets/{index-DutfRO7F.js → index-D-Lxloq5.js} +1 -1
- package/dist/assets/{index-P2m0RlAs.js → index-DBqLPDUh.js} +1 -1
- package/dist/assets/index-DDXNOodN.js +99 -0
- package/dist/assets/{index-B_NDUfon.js → index-DDoVX3je.js} +2 -2
- package/dist/assets/{index-hkk3GUEf.js → index-Drd9jydY.js} +1 -1
- package/dist/assets/{index-klBzz5vO.js → index-Dsd9SXVN.js} +1 -1
- package/dist/assets/index-DvBh35bh.js +1 -0
- package/dist/assets/{index-DrHUHp5S.js → index-U3mAyHwS.js} +1 -1
- package/dist/assets/{index-m831cH-_.js → index-W_fQ-nuf.js} +1 -1
- package/dist/assets/{index-ChHy6AQ7.js → index-wLX5GW2c.js} +1 -1
- package/dist/assets/{invitation-CGjIZ62g.js → invitation-Dsnc8lab.js} +1 -1
- package/dist/assets/{invite-CS_4jRwt.js → invite-CvAru4rZ.js} +1 -1
- package/dist/assets/{issue-passport-B6-OzJX7.js → issue-passport-CDE6vHUE.js} +1 -1
- package/dist/assets/{item-CuLwkmbx.js → item-rXnALS3b.js} +1 -1
- package/dist/assets/{layout-CNC_rrzE.js → layout-DYG0Wl7R.js} +1 -1
- package/dist/assets/{list-BTBbj1K4.js → list-DLMy1vVs.js} +1 -1
- package/dist/assets/list-b96sX5Y6.js +2 -0
- package/dist/assets/{log-29oTWiWO.js → log-Bwqh69bM.js} +1 -1
- package/dist/assets/{login-C52vMwpY.js → login-Ygmj8_J7.js} +1 -1
- package/dist/assets/{logo-uploader-Cir_HrSm.js → logo-uploader-CLwbDhA_.js} +2 -2
- package/dist/assets/{lost-passport-C2-kDXqq.js → lost-passport-CqzPSoLw.js} +1 -1
- package/dist/assets/{overview-BKOb0zVP.js → overview-DqabCKYi.js} +1 -1
- package/dist/assets/{passport-item-OEfv-Vh7.js → passport-item-C5-ZuTPM.js} +1 -1
- package/dist/assets/{publish-resource-DayX-x8-.js → publish-resource-ebKgw7OW.js} +1 -1
- package/dist/assets/{runtime-BbgMhX7n.js → runtime-B454s6Gb.js} +1 -1
- package/dist/assets/{security-DFHcsUZl.js → security-DCArL_za.js} +1 -1
- package/dist/assets/{setup-Do62jucF.js → setup-CX2pUl2y.js} +3 -3
- package/dist/assets/{start-B8F850CZ.js → start-Dhbx5j_D.js} +1 -1
- package/dist/assets/{status-D5JgbTyM.js → status-D4K-kiXO.js} +1 -1
- package/dist/assets/{step-actions-1pM57149.js → step-actions-CISMVGx2.js} +1 -1
- package/dist/assets/{traffic-Dvs1P0Re.js → traffic-BqHyn9L9.js} +1 -1
- package/dist/assets/{transfer-bax-fMxe.js → transfer-Bqv1gMqL.js} +1 -1
- package/dist/assets/{unsubscribe-DwUfpwja.js → unsubscribe-B3OLQIVA.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BZU9LLmz.js → use-blocklet-logo-Bhkp-Zm7.js} +1 -1
- package/dist/assets/{user-center-DQ_Kc4sL.js → user-center-vIx28YXm.js} +1 -1
- package/dist/assets/{util-BiCOL9ao.js → util-Dnkhck-D.js} +1 -1
- package/dist/assets/{wrap-locale-0GIFYj8p.js → wrap-locale-C_UOH97U.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/config-navigation-0pU9J0da.js +0 -26
- package/dist/assets/index-DC3jOsuk.js +0 -99
- package/dist/assets/index-DQD2rqsI.js +0 -1
- package/dist/assets/list-BNMEncjS.js +0 -2
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,Y as R,j as ie,B as z,b4 as be,ao as pe,bT as re,a0 as je,aC as Ce,bA as ke,c9 as Ke,b6 as Te,a9 as ve,a2 as Ae}from"./vendor-ux-did-connect-2jRoUb28.js";import{d as we}from"./Edit-CUl1Rt8i.js";import{f as Se}from"./index-8eXqqyHQ.js";import{r as me}from"./passport-item-OEfv-Vh7.js";import{D as B,n as M,aM as De,G as Ie,f as Re}from"./index-B_NDUfon.js";import{u as $}from"./dashboard-BhR1WNzF.js";import{j as e,H as x,bo as O,br as G,bn as H,q as V,aa as f,al as Q,O as E,ab as Be,bs as $e,bR as _e,ah as P,T as N,ad as ce,ak as Ne}from"./vendor-mui-core-BV2FUxWJ.js";import{B as Pe,W as We}from"./vendor-arcblock-BlrkGjK9.js";import{T as ue}from"./index-NQMMaHuW.js";import{C as xe}from"./confirm-Tue92P8p.js";import{a0 as Ue}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-R7MF4AwY.js";import{D as qe}from"./delete-confirm-CHnQ2leb.js";import{P as Le}from"./permission-DSHe73ba.js";import{l as ze,y as Me}from"./vendor-hooks-BgUTpb6X.js";import{U as Ee,C as Fe,I as Oe}from"./index-D1kTR2xk.js";import{B as Ge}from"./bundle-avatar-B9he3Bf1.js";import{p as He}from"./util-DMfPwzVN.js";import{W as le}from"./did-address-Dq-4__HB.js";import{A as Ve}from"./actions-DP7pj6xB.js";import{u as Qe}from"./use-mobile-BAa0wi8o.js";import{T as de}from"./table-tips-BfSSGl9N.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./InfoOutlined-D3XnF0Vg.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-CDDcwz3P.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-WurN0cIW.js";import"./MoreHoriz-DpKn_fkc.js";function Y({value:t}){const{t:s,locale:m}=D(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:m}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:m,type:"all"})}Y.propTypes={value:x.string.isRequired};function J({value:t,onChange:s,...m}){const{t:l}=D(),d=b.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(G,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(V,{value:o.value,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}J.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const U=()=>{const t=ie.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=B(),{roles:m}=$(),l=[...t,...s?m:[]];return Ue(l,"name").filter(d=>d.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:m}=t,{api:l}=B(),{teamDid:d}=$(),{t:o}=D(),[k,j]=b.useState(!1),[c,h]=b.useState(null),y=U(),v=()=>{j(!1),h(null)},K=async a=>{const{remark:T,passport:r,authType:n}=a;j(!0);const u=await l.createAccessKey({input:{teamDid:d,remark:T.trim(),passport:r,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=u;m(S),h(null),j(!1)},g={title:`${o("common.create")} ${o("accessKey")}`,description:(a,T,r)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{T({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?r(""):r(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:o("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const u=n.target.value;r(null),T({...a,passport:u,__disableConfirm:!a.remark||!u})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:y.map(n=>e.jsx(V,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(J,{value:a.authType,onChange:n=>{T({...a,authType:n.target.value})}}),e.jsx(ue,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{T({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:K,onCancel:v};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>h(g),className:"rule-action",children:[k?e.jsx(Be,{size:16}):e.jsx(Pe,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(xe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}X.propTypes={remark:x.string,onCreate:x.func};X.defaultProps={onCreate:()=>{},remark:""};function Z(t){const{onConfirm:s,accessKeyId:m,accessKeySecret:l,hideSecret:d}=t,{t:o}=b.useContext(be),[k,j]=b.useState(!1),[c,h]=b.useState(()=>d),y=()=>{h(!c)},v=a=>{j(a.target.checked)},K=b.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
|
|
2
|
-
|
|
3
|
-
const client = new Client(fullEndpoint);
|
|
4
|
-
client.setAuthAccessKey({
|
|
5
|
-
accessKeyId: "${m}",
|
|
6
|
-
accessKeySecret: "${l}",
|
|
7
|
-
});
|
|
8
|
-
`:`curl -H "Authorization: Bearer ${l}" "${(a=window.blocklet)==null?void 0:a.appUrl}/.well-known/service/api/did/session"`},[d,m,l]),g=b.useMemo(()=>{var a;return d?`blocklet deploy --endpoint ${(a=window.blocklet)==null?void 0:a.appUrl} --access-key ${m} --access-secret ${l} {blockletPath}/.blocklet/bundle;`:null},[d,m,l]);return e.jsxs(pe,{title:o("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(z,{disabled:d?!k:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:o("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ye,{children:o(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(L,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeyId")}),e.jsx(F,{children:m})]}),e.jsxs(L,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeySecret")}),c?e.jsx(z,{"data-cy":"show-secret-btn",color:"primary",onClick:y,children:o("setting.accessKey.showSecret")}):e.jsx(F,{children:l})]}),!c&&e.jsxs(L,{children:[e.jsx(q,{children:`Access Key ${o("setting.accessKey.usage")}`}),e.jsx(re,{code:K,language:"javascript"}),g&&e.jsx(re,{code:g,language:"bash"})]}),d&&e.jsx("div",{children:e.jsx($e,{value:"end",disabled:c,control:e.jsx(_e,{checked:k,onChange:v}),label:o("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}Z.propTypes={accessKeyId:x.string.isRequired,accessKeySecret:x.string.isRequired,onConfirm:x.func,hideSecret:x.bool};Z.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=P.div`
|
|
9
|
-
display: flex;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
align-items: center;
|
|
12
|
-
font-size: 16px;
|
|
13
|
-
margin-bottom: 8px;
|
|
14
|
-
`,L=P.div`
|
|
15
|
-
margin-bottom: 24px;
|
|
16
|
-
`,Ye=P.div`
|
|
17
|
-
font-size: 16px;
|
|
18
|
-
font-weight: bold;
|
|
19
|
-
`;function ee(t){const{t:s,locale:m}=D(),{api:l}=B(),{teamDid:d}=$(),{accessKeyId:o,time:k,remark:j,onDelete:c=()=>{},onClose:h=()=>{}}=t,y=()=>{h()},v=async()=>{try{await l.deleteAccessKey({input:{teamDid:d,accessKeyId:o}}),c()}catch(a){je.error(a==null?void 0:a.message)}finally{y()}},K=a=>({key:`<b>${o}</b>`,name:`<b>${j}</b>`,time:M(a,m),timeAge:We(new Date(a),De(m))}),g={keyName:j,title:s("setting.accessKey.title"),description:k?`${s("setting.accessKey.description",K(k))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${o}</b>`,name:`<b>${j}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:j}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:v,onCancel:y};return e.jsx(qe,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}ee.propTypes={accessKeyId:x.string.isRequired,time:x.string.isRequired,remark:x.string.isRequired,onDelete:x.func,onClose:x.func};ee.defaultProps={onDelete:()=>{},onClose:()=>{}};function te(t){const{accessKeyId:s,remark:m,onUpdate:l,passport:d,expireAt:o,authType:k,onClose:j}=t,{api:c}=B(),{teamDid:h}=$(),{t:y}=D(),[v,K]=b.useState(!1),g=U(),a=()=>{K(!1),j()},T=async n=>{const{accessKeyId:u,remark:S="",passport:p,expireAt:I,authType:W}=n;K(!0),await c.updateAccessKey({input:{teamDid:h,accessKeyId:u,remark:S.trim(),passport:p,expireAt:I?new Date(I).getTime():null,authType:W}}),l(),a()},r={title:`${y("common.update")} ${y("accessKey")}`,description:(n,u,S)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:y("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:n.accessKeyId,disabled:!0}),e.jsx(E,{label:y("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:n.remark,onChange:p=>{u({...n,remark:p.target.value,__disableConfirm:!p.target.value.trim()}),p.target.value.trim()?S(""):S(y("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:y("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"update-access-key-select-passport",value:n.passport,onChange:p=>{const I=p.target.value;S(null),u({...n,passport:I,__disableConfirm:!n.remark||!I})},fullWidth:!0,label:y("setting.accessKey.passport"),disabled:v,children:g.map(p=>e.jsx(V,{value:p.name,"data-cy":`update-access-key-passport-option-${p.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:p.title||p.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:p.description})]})},p.name))})]}),e.jsx(J,{disabled:!0,value:n.authType,onChange:p=>{u({...n,authType:p.target.value})}}),e.jsx(ue,{placeholder:y("setting.accessKey.expireTime"),value:n.expireAt,onChange:p=>{u({...n,expireAt:p,__disableConfirm:!n.passport||!n.remark||!p})}})]}),confirm:y("common.confirm"),cancel:y("common.cancel"),color:"primary",params:{accessKeyId:s,remark:m,passport:d,expireAt:o,authType:k},onConfirm:T,onCancel:a};return e.jsx(xe,{title:r.title,description:r.description,confirm:r.confirm,color:r.color,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})}te.propTypes={accessKeyId:x.string.isRequired,remark:x.string,passport:x.string,expireAt:x.string,authType:x.string,onUpdate:x.func,onClose:x.func};te.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function se({accessKey:t,onCancel:s}){const{t:m}=D();return e.jsx(pe,{title:m("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Je,{children:e.jsx(ye,{accessKey:t})})})}se.propTypes={accessKey:x.object.isRequired,onCancel:x.func.isRequired};se.defaultProps={};const Je=P(f)`
|
|
20
|
-
margin-top: -16px;
|
|
21
|
-
|
|
22
|
-
.tabs {
|
|
23
|
-
margin-left: 0;
|
|
24
|
-
margin-right: 0;
|
|
25
|
-
}
|
|
26
|
-
`;function ye({accessKey:t}){var a,T;const{t:s,locale:m}=D(),{api:l}=B(),{teamDid:d}=$(),{blocklet:o}=Ie(),k=U(),j=b.useCallback(async r=>r?(await l.getUser({input:{teamDid:d,user:{did:r}}})).user:null,[l,d]),c=ze(()=>j(t.createdBy),{}),h=((o==null?void 0:o.children)||[]).find(r=>{var n;return((n=r==null?void 0:r.meta)==null?void 0:n.did)===t.componentDid}),y=b.useMemo(()=>{var r;return He((r=c==null?void 0:c.data)==null?void 0:r.avatar,d,!0)},[(a=c==null?void 0:c.data)==null?void 0:a.avatar,d]),v=k.find(r=>r.name===t.passport),K=v?v.title:t.passport,g=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(le,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(F,{children:`blocklet-${Ce.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(f,{children:me(K,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:c!=null&&c.data?e.jsx(f,{sx:{display:"flex",alignItems:"center",".MuiAvatar-root":{width:32,height:32}},children:e.jsx(Ee,{user:{...c.data,avatar:y},showDid:!0,cardType:Fe.Detailed,infoType:Oe.Minimal,sx:{border:0,padding:0}})}):t.createdBy?e.jsx(le,{did:t.createdBy,showQrcode:!0}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:m}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:m}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(Y,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...h?[{label:s("setting.accessKey.component"),content:e.jsxs(f,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Ge,{blocklet:h,ancestors:[o]}),e.jsx(f,{ml:"16px",sx:{minWidth:0},children:e.jsxs(f,{className:"component-header",children:[e.jsx(f,{className:"component-name",children:Re.getDisplayName(h,!0)}),e.jsx(f,{className:"component-version",children:(T=h==null?void 0:h.meta)==null?void 0:T.version})]})})]},h)}]:[]]}];return e.jsx(Xe,{gap:3,children:e.jsx(f,{className:"info-area",children:g.map(r=>e.jsxs(f,{mb:3,children:[e.jsx(N,{variant:"h6",sx:{mb:1.5},children:r.title}),e.jsx(f,{className:"info-grid",children:r.items.map(n=>e.jsxs(f,{className:"info-item",children:[e.jsx(f,{className:"info-label",children:e.jsx(N,{variant:"subtitle2",color:"textSecondary",children:n.label})}),e.jsx(f,{children:n.content})]},n.label))})]},r.title))})})}ye.propTypes={accessKey:x.object.isRequired};const Xe=P(Q)`
|
|
27
|
-
.info-card {
|
|
28
|
-
margin-bottom: 24px;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.card-content {
|
|
33
|
-
display: flex;
|
|
34
|
-
gap: 32px;
|
|
35
|
-
padding: 24px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.passport-image {
|
|
39
|
-
width: 150px;
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
transition: transform 0.2s ease-in-out;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
|
|
44
|
-
&:hover {
|
|
45
|
-
transform: scale(1.05);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.info-area {
|
|
50
|
-
flex: 1;
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.info-header {
|
|
56
|
-
padding-bottom: 16px;
|
|
57
|
-
border-bottom: 1px solid #eee;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.info-grid {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
gap: 12px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.info-item {
|
|
67
|
-
display: flex;
|
|
68
|
-
gap: 8px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.info-label {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 8px;
|
|
75
|
-
width: 140px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.logs-card {
|
|
79
|
-
.card-header {
|
|
80
|
-
display: flex;
|
|
81
|
-
align-items: center;
|
|
82
|
-
gap: 8px;
|
|
83
|
-
padding: 16px 24px;
|
|
84
|
-
border-bottom: 1px solid #eee;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.MuiTimeline-root {
|
|
88
|
-
padding: 24px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.MuiTimelineContent-root {
|
|
92
|
-
padding: 0px 16px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.MuiTimelineDot-root {
|
|
96
|
-
margin: 0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`;function zt(){var oe,ae;const{t,locale:s}=D(),{api:m,inService:l}=B(),{teamDid:d}=$(),[o,k]=b.useState({}),[j,c]=b.useState(null),[h,y]=b.useState(null),[v,K]=b.useState(null),g=Qe(),a=U(),T=b.useRef(null),r=`access-keys-${d}`,n=ke(r),[u,S]=b.useState({searchText:n.searchText||"",pageSize:n.rowsPerPage||10,page:1}),p=Me(async()=>await m.getAccessKeys({input:{teamDid:d,paging:{page:u.page,pageSize:u.pageSize}}}),[u.page,u.pageSize]),{loading:I,error:W}=p,_=b.useMemo(()=>{var i;return((i=p.value)==null?void 0:i.list)||[]},[(oe=p.value)==null?void 0:oe.list]),fe=b.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(i,{rowIndex:A})=>{const w=_[A];return e.jsx(f,{display:"flex",alignItems:"center",gap:2,children:e.jsx(N,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:i=>e.jsx(Ke,{showDidLogo:!1,children:i})}},{label:t("common.role"),name:"passport",options:{customBodyRender:i=>{const A=a.find(C=>C.name===i),w=A?A.title:i;return e.jsx(f,{children:me(w,i)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:i=>e.jsx(N,{children:i})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:i=>e.jsx(N,{children:t(`setting.accessKey.${i}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:i=>e.jsx(ce,{title:M(i,s),children:i?e.jsx(R,{value:i,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:i=>e.jsx(ce,{title:M(i,s),children:i?e.jsx(R,{value:i,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:i=>i?e.jsx(Y,{value:i}):t("common.neverExpired")}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:A})=>{const w=_[A];return e.jsx(Ve,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(we,{}),text:t("common.edit"),onClick:C=>{C.stopPropagation(),K(w)}},{icon:e.jsx(Te,{}),text:t("common.delete"),onClick:C=>{C.stopPropagation(),y(w)}}]})}}}],[_,s,t,a,y,K]),he=({page:i,rowsPerPage:A,searchText:w})=>{u.pageSize!==A?S(C=>({...C,searchText:"",pageSize:A,page:1})):u.page!==i+1?S(C=>({...C,searchText:"",page:i+1})):u.searchText!==w&&S(C=>({...C,searchText:w,page:1}))},ne=u.searchText?_.filter(i=>i.accessKeyId.toLowerCase().includes(u.searchText.toLowerCase())||(i.remark||"").toLowerCase().includes(u.searchText.toLowerCase())):_;return W?e.jsx(Ne,{severity:"error",children:Se(W)}):e.jsxs(f,{ref:T,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[g?e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(ve,{durable:r,durableKeys:["page","rowsPerPage"],data:ne,columns:fe,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:u.page-1,rowsPerPage:u.pageSize,count:((ae=p.value)==null?void 0:ae.count)||0,searchDebounceTime:600,onRowClick(i,{dataIndex:A},w){var C;if((C=T.current)!=null&&C.contains(w.target)){const ge=ne[A];c(ge)}}},loading:I,onChange:he,title:g?null:e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(Le,{permission:l?"":"mutate_accessKey",children:e.jsx(X,{onCreate:i=>{const{accessKeyId:A,accessKeySecret:w,authType:C}=i;k({show:!0,accessKeyId:A,accessKeySecret:w,authType:C})}})})],emptyNode:e.jsx(Ae,{children:t("oauth.client.empty")})}),o.show&&e.jsx(Z,{hideSecret:o.authType==="signature",onConfirm:()=>{p.retry(),k({show:!1})},...o}),j&&e.jsx(se,{onCancel:()=>c(null),accessKey:j}),h&&e.jsx(ee,{accessKeyId:h.accessKeyId,time:h.lastUsedAt,remark:h.remark||"N/A",onDelete:p.retry,onClose:()=>y(null)}),v&&e.jsx(te,{...v,onUpdate:p.retry,onClose:()=>K(null)})]})}export{zt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as B,a0 as q,bT as U,I as ge,bU as fe,a2 as je,a9 as ye,bA as we}from"./vendor-ux-did-connect-2jRoUb28.js";import{t as ke,l as de,j as Ee}from"./vendor-hooks-BgUTpb6X.js";import{r as T,b as Q}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-D3XnF0Vg.js";import{j as ve,B as Ce}from"./vendor-arcblock-BlrkGjK9.js";import{D as F,aB as Se,aC as K,G as pe,y as Te}from"./index-B_NDUfon.js";import{u as _}from"./dashboard-BhR1WNzF.js";import{u as Re}from"./use-mobile-BAa0wi8o.js";import{H as t,j as e,D as Ie,aj as ze,t as De,aa as m,O as re,T as R,ab as M,ak as Z,z as Pe,y as H,bs as le,bR as Y,ad as $,L as J,A as G,bc as Ae,E as L,I as ee,C as We,bq as Oe,al as D,cg as qe,X as $e,bb as V,bp as Le,b4 as Be,ch as Me,ci as He,b5 as Ne,an as Fe,c0 as _e,s as ue,v as Ue,cj as Ke,ck as Ye,cl as Ve,cm as Je}from"./vendor-mui-core-BV2FUxWJ.js";import{d as Ge}from"./ExpandLess-t1cH-Bc4.js";import{b as he,z as Qe,A as Xe}from"./vendor-utils-rHXShPKm.js";import{C as Ze}from"./confirm-Tue92P8p.js";import{A as et}from"./actions-DP7pj6xB.js";import{T as ae}from"./table-tips-BfSSGl9N.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./MoreHoriz-DpKn_fkc.js";const tt=o=>{var f,w;const[p,u]=T.useState(null),[E,s]=T.useState(!o),[I,c]=T.useState(null),{blocklet:a}=pe(),d=(w=(f=a==null?void 0:a.site)==null?void 0:f.domainAliases[0])==null?void 0:w.value,j=T.useMemo(()=>{const b={};return p&&(p.sources.forEach(l=>{b[l.did]={source:l,events:[],count:0}}),p.events.forEach(l=>{b[l.source]&&(b[l.source].events.push(l),b[l.source].count+=1)})),b},[p]),y=async()=>{try{if(s(!0),!d)return;const l=await(await fetch(`https://${d}/.well-known/service/openevent.json`)).json();u(l),c(null)}catch(b){c(b instanceof Error?b:new Error(String(b)))}finally{s(!1)}};return T.useEffect(()=>{y()},[d]),{openEvent:p,setOpenEvent:u,eventsBySource:j,loading:E,error:I,loadData:y}};function te({eventsBySource:o,selectedEvents:p,setSelectedEvents:u,error:E}){const{t:s}=B(),[I,c]=T.useState({}),a=T.useMemo(()=>{const l={};return Object.entries(o).forEach(([g,{events:h}])=>{const S=h.filter(x=>p[`${x.type}-${x.source}`]).length;l[g]=S}),l},[o,p]),d=T.useMemo(()=>Object.values(a).reduce((l,g)=>l+g,0),[a]),j=T.useMemo(()=>Object.values(o).reduce((l,{events:g})=>l+g.length,0),[o]),y=(l,g)=>{g.stopPropagation(),c({...I,[l]:!I[l]})},f=l=>{const g=`${l.type}-${l.source}`;u(h=>({...h,[g]:!h[g]}))},w=(l,g)=>{const h={};l.forEach(S=>{const x=`${S.type}-${S.source}`;h[x]=!g}),u(S=>({...S,...h}))},b=l=>{const g={};Object.values(o).forEach(({events:h})=>{h.forEach(S=>{const x=`${S.type}-${S.source}`;g[x]=l.target.checked})}),u(g)};return e.jsxs(m,{sx:{width:"100%"},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:b,checked:d>0&&d===j}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[s("webhookEndpoint.selectAllEvents"),e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:s("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),d>0&&e.jsx(R,{variant:"body2",color:"primary",sx:{ml:"auto"},children:s("webhookEndpoint.selectedEventsCount",{count:d})})]}),e.jsx(m,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(o).map(([l,{source:g,events:h,count:S}],x)=>{const z=a[l]>0,k=a[l]===h.length&&h.length>0,A=I[l];return e.jsxs(Q.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:i})=>x<Object.keys(o).length-1?`1px solid ${i.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(m,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:i=>{i.target.closest(".MuiFormControlLabel-root")||y(l,i)},children:[e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:h.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:k,indeterminate:z&&!k,onChange:i=>{i.stopPropagation(),w(h,k)}}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[g.logo&&e.jsx(Ae,{src:g.logo,sx:{width:24,height:24}}),e.jsx(m,{children:g.title||l}),z&&e.jsx(L,{label:s("webhookEndpoint.selectedCount",{count:a[l]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:i=>`${i.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(R,{variant:"body2",color:"text.secondary",sx:{mr:1},children:s("webhookEndpoint.eventsCount",{count:S})}),h.length>0&&e.jsx(ee,{size:"small",edge:"end",children:A?e.jsx(Ge,{}):e.jsx(ve,{})})]})]})}),h.length>0&&e.jsx(We,{in:A,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:h.map(i=>{const r=`${i.type}-${i.source}`,n=!!p[r];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>f(i),children:e.jsxs(m,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:n,sx:{mr:1}}),e.jsxs(m,{children:[e.jsx(R,{variant:"body1",sx:{cursor:"pointer"},children:i.type}),e.jsx(R,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:i.description})]})]})},r)})})})]},l)})})}),E&&e.jsx(Oe,{error:!0,sx:{mt:1},children:E})]})}te.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};te.defaultProps={error:null};function oe({id:o,url:p,description:u,enabledEvents:E,onSubmit:s,onClose:I}){var i;const{t:c}=B(),[a,d]=T.useState({}),{teamDid:j}=_(),{api:y}=F(),{loading:f,error:w,eventsBySource:b}=tt(),{control:l,handleSubmit:g,formState:{errors:h},reset:S,setValue:x,trigger:z}=Se({defaultValues:{url:"",description:""}});T.useEffect(()=>{const r=Object.values(a).some(n=>n);x("selectedEvents",r?"valid":""),z("selectedEvents")},[a,x,z]);const k=()=>{d({}),S(),I()},A=async r=>{const n=Object.keys(a).filter(v=>a[v]),C={url:r.url,description:r.description,enabledEvents:n.map(v=>{const[P,O]=v.split("-");return!P||!O?null:{type:P,source:O}}).filter(Boolean)};try{if(o){const v=await y.updateWebhookEndpoint({input:{teamDid:j,id:o,data:C}});q.success(`${c("webhookEndpoint.updateWebhook")} ${c("webhookEndpoint.success")}`),s(v)}else{const v=await y.createWebhookEndpoint({input:{teamDid:j,input:C}});q.success(`${c("webhookEndpoint.createWebhook")} ${c("webhookEndpoint.success")}`),s(v)}}catch(v){q.error(v==null?void 0:v.message)}k()};return T.useEffect(()=>{S({url:p,description:u}),d(E.reduce((r,n)=>(r[`${n.type}-${n.source}`]=!0,r),{}))},[S,d,p,u,E]),e.jsx(Ie,{open:!0,onClose:k,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:g(A),children:[e.jsx(ze,{children:c(o?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(De,{children:e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:l,rules:{required:c("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:c("webhookEndpoint.validation.urlInvalid")}},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.url.label"),fullWidth:!0,error:!!h.url,helperText:(n=h.url)==null?void 0:n.message})}}),e.jsx(K,{name:"description",control:l,rules:{required:c("webhookEndpoint.validation.descriptionRequired")},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!h.description,helperText:(n=h.description)==null?void 0:n.message})}}),e.jsx(K,{name:"selectedEvents",control:l,rules:{required:c("webhookEndpoint.validation.eventRequired")},render:({field:r})=>e.jsx("input",{type:"hidden",...r})}),!f&&b&&Object.keys(b).length>0&&e.jsx(te,{eventsBySource:b,selectedEvents:a,setSelectedEvents:d,error:(i=h.selectedEvents)==null?void 0:i.message}),!f&&(!b||Object.keys(b).length===0)&&e.jsx(R,{color:"text.secondary",children:c("webhookEndpoint.noAvailableEvents")}),f&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(M,{size:20})}),w&&e.jsx(Z,{severity:"error",children:c("webhookEndpoint.loadingError",{message:w==null?void 0:w.message})})]})}),e.jsxs(Pe,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:k,children:c("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:c(o?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(o){switch(o){case"enabled":return"success";case"disabled":default:return"default"}}const ot=(o="en")=>o==="tw"?"zh":o;function N(o,p="YYYY-MM-DD HH:mm:ss",u="en"){return o?Te(o).locale(ot(u)).format(p):"-"}function st(o){return typeof o=="number"?!1:he(o)}function nt(o){return o>=200&&o<300}function W(o){const p=st(o.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(R,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[o.label,!!o.tip&&e.jsx($,{title:o.tip,children:e.jsx(qe,{fontSize:"small"})})]}),e.jsx(R,{component:"div",variant:"body1",color:p?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:p?"-":o.value})]}),o.divider&&e.jsx($e,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};W.defaultProps={tip:"",divider:!1};function se(o){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:o.mb,mt:o.mt,pb:1},children:[e.jsx(R,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:o.title}),o.children]})}se.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const it=o=>{const p={};return o.forEach(u=>{var s;const E=new Date(u.createdAt).toLocaleDateString();p[E]||(p[E]=[]),(s=p[E])==null||s.push(u)}),p};function ne({eventId:o,webhookEndpointId:p,event:u}){const{api:E}=F(),{t:s}=B(),{teamDid:I}=_(),{blocklet:c}=pe(),{data:a,loadMore:d,loadingMore:j,loading:y}=ke(x=>{const k=x?Math.ceil(x.list.length/15)+1:1;return E.getWebhookAttempts({input:{teamDid:I,input:{eventId:o,webhookId:p},paging:{page:k,pageSize:15}}})},{reloadDeps:[o,p]}),f=(a==null?void 0:a.list)||[],[w,b]=T.useState(null),l=it(f);T.useEffect(()=>{!w&&(a!=null&&a.list.length)&&b(a.list[0])},[a==null?void 0:a.list.length,w]);const g=x=>{b(x)};if(y)return e.jsx(M,{});const h=a&&a.list.length<a.paging.total,S=x=>{var z,k,A,i,r;if(x.responseBody&&((z=x.responseBody)!=null&&z.sessionId)&&((k=x.responseBody)!=null&&k.projectId)&&((A=x.responseBody)!=null&&A.agentId)){const n=(r=(i=c==null?void 0:c.site)==null?void 0:i.domainAliases[0])==null?void 0:r.value,C=(c.children||[]).find(P=>{var O;return((O=P==null?void 0:P.meta)==null?void 0:O.name)==="ai-studio"}),v=Qe(Xe(`https://${n}`,(C==null?void 0:C.mountPoint)||"","projects",x.responseBody.projectId,"logs/main"),{sessionId:x.responseBody.sessionId,agentId:x.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(v,"_blank"),children:e.jsx(m,{component:ge,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:he(Object.keys(l))?e.jsx(R,{color:"text.secondary",children:s("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(l).map(([x,z])=>e.jsxs(Q.Fragment,{children:[e.jsx(Le,{children:x}),z.map(k=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>g(k),selected:w===k,secondaryAction:e.jsx(R,{color:"text.secondary",children:N(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Be,{sx:{minWidth:0,mr:1.5},children:nt(k.responseStatus)===!1?e.jsx(Me,{color:"error"}):e.jsx(He,{color:"success"})}),e.jsx(Ne,{primary:e.jsx(R,{color:"text.primary",children:k.event.type})})]},k.id))]},x))}),h&&e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:d,disabled:j,sx:{color:x=>x.palette.text.disabled},children:s(j?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[w&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h6",children:o?w.endpoint.url:w.event.type}),e.jsx(m,{children:S(w)})]}),e.jsxs(m,{children:[e.jsxs(R,{variant:"h6",children:[s("webhookEndpoint.response")," (",w.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(w.responseBody,null,2)})]}),e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(w.event,null,2)})]})]}),(a==null?void 0:a.list.length)===0&&u&&e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.eventData")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(u.data,null,2)})]})]})]})}ne.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};ne.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:o,onClose:p}){var j,y,f,w;const{t:u}=B(),{api:E}=F(),{teamDid:s}=_(),{loading:I,error:c,data:a}=de(()=>E.getWebhookEndpoint({input:{teamDid:s,id:o}})),d=a==null?void 0:a.data;return c?e.jsx(Z,{severity:"error",children:c.message}):I||!d?e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(M,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(m,{children:[e.jsxs(D,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(D,{flex:1,width:0,children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:d.description}),e.jsx($,{title:d.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(D,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:p,children:e.jsx(_e,{})})})]}),e.jsx(m,{mt:2,children:e.jsxs(D,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(W,{label:u("common.status"),value:e.jsx(L,{size:"small",variant:"filled",label:d.status,color:xe(d.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(W,{label:u("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:d.enabledEvents.map(b=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:b==null?void 0:b.type},b))}),children:e.jsx(L,{size:"small",variant:"filled",label:u("webhookEndpoint.eventsCount",{count:d.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:u("webhookEndpoint.version"),value:d.apiVersion,divider:!0}),e.jsx(W,{label:u("common.createdAt"),value:N(d.createdAt),divider:!0}),e.jsx(W,{label:u("common.updatedAt"),value:N(d.updatedAt),divider:!0}),e.jsx(W,{label:u("common.createdBy"),value:e.jsx($,{arrow:!0,title:(j=d.createUser)==null?void 0:j.did,children:e.jsx(L,{size:"small",variant:"filled",label:(y=d.createUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:u("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(f=d.updateUser)==null?void 0:f.did,children:e.jsx(L,{size:"small",variant:"filled",label:(w=d.updateUser)==null?void 0:w.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(D,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:u("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(D,{height:0,flex:1,overflow:"hidden",children:e.jsx(ne,{webhookEndpointId:d.id})})]})]})}me.propTypes={id:t.string.isRequired,onClose:t.func.isRequired};const rt=ue(D)``;function be({open:o,onClose:p,id:u}){return e.jsx(Fe,{anchor:"right",open:o,onClose:p,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(m,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:u,onClose:p})})})}be.propTypes={open:t.bool.isRequired,onClose:t.func.isRequired,id:t.string.isRequired};function ce(){return null}const ie=Q.memo(({options:o,columns:p,toolbar:u=!0,footer:E=!0,hasRowLink:s=!1,emptyNodeText:I="",...c})=>{const{locale:a}=B(),d=Ue(f=>f.breakpoints.down("md")),j={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:d?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},y={};return u||(y.TableToolbar=ce),E||(y.TableFooter=ce),e.jsx(lt,{locale:a,options:{...j,...o},columns:(p||[]).map(f=>(f.options=f.options||{},f.options.filter=f.options.filter||!1,f.options.sort=f.options.sort||!1,f)),emptyNode:e.jsx(je,{children:I}),...c,components:y,hasRowLink:s,isMobile:d})});ie.propTypes={options:t.object,columns:t.array,toolbar:t.bool,footer:t.bool,hasRowLink:t.bool,emptyNodeText:t.node,durable:t.string,durableKeys:t.array,data:t.array,loading:t.bool,onChange:t.func,title:t.node,components:t.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const lt=ue(ye)``,at=ie;function Ot(){const{teamDid:o}=_(),p=Re(),u=`webhook-endpoints-${o}`,E=we(u),{t:s,locale:I}=B(),{api:c}=F(),[a,d]=T.useState(""),[j,y]=T.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[f,w]=Ee(u,{defaultValue:{pageSize:E.rowsPerPage||20,page:E.page?E.page+1:1}}),{loading:b,error:l,data:g,refresh:h}=de(()=>c.getWebhookEndpoints({input:{teamDid:o,paging:{page:f.page,pageSize:f.pageSize}}}));T.useEffect(()=>{h()},[f,h]);const S=T.useCallback(async(i,r)=>{try{await c.updateWebhookEndpoint({input:{teamDid:o,id:i.id,data:{status:r?"disabled":"enabled"}}}),h(),q.success(`${s(r?"webhookEndpoint.disable":"webhookEndpoint.enable")}${s("webhookEndpoint.success")}`)}catch(n){q.error(n==null?void 0:n.message)}},[c,o,h,s]),x=T.useCallback(async i=>{try{await c.deleteWebhookEndpoint({input:{teamDid:o,id:i}}),h(),y(r=>({...r,deleteConfirm:null})),q.success(`${s("common.delete")}${s("webhookEndpoint.success")}`)}catch(r){q.error(r==null?void 0:r.message)}},[c,o,h,s]),z=(i,r)=>{let n=i.page+1;const C=i.searchText||"";if(C!==a){d(C);return}if(r==="changePage"||r==="changeRowsPerPage"){r!=="changePage"&&(n=1);const v={page:n,pageSize:i.rowsPerPage};d(""),w(v)}};if(l)return e.jsx(Z,{severity:"error",children:l.message});if(b||!g)return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(M,{})});const k=((g==null?void 0:g.list)||[]).filter(i=>{if(!a)return!0;const r=a.toLowerCase();return i.description.toLowerCase().includes(r)||i.url.toLowerCase().includes(r)}),A=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(R,{variant:"body2",children:n.description}),e.jsx(m,{sx:{display:"flex"},onClick:C=>{C.stopPropagation()},children:e.jsx($,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(C=>e.jsx(L,{size:"small",variant:"filled",label:C.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${C.type}`))})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(L,{size:"small",variant:"filled",label:s(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:s("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>N(i)}},{label:s("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,r)=>{const n=k[r],C=(n==null?void 0:n.status)==="enabled";return e.jsx(et,{actions:[{icon:C?e.jsx(Ke,{}):e.jsx(Ye,{}),text:s(C?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),S(n,C)}},{icon:e.jsx(Ve,{}),text:s("common.edit"),onClick:v=>{v.stopPropagation(),y(P=>({...P,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Je,{}),text:s("common.delete"),onClick:v=>{v.stopPropagation(),y(P=>({...P,deleteConfirm:{title:s("webhookEndpoint.deleteWebhook.title"),description:s("webhookEndpoint.deleteWebhook.description"),confirm:s("common.confirm"),cancel:s("common.cancel"),onConfirm:()=>x(n.id),onCancel:()=>y(O=>({...O,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(m,{sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[p?e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}):null,e.jsx(at,{durable:u,durableKeys:["page","rowsPerPage"],data:k,columns:A,options:{count:g.count,page:f.page-1,rowsPerPage:f.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:r})=>{const n=g.list[r];y(C=>({...C,webhookDetail:{open:!0,id:n.id}}))}},loading:b,onChange:z,emptyNodeText:e.jsx(D,{gap:1,children:s("webhookEndpoint.noWebhooksAdded")}),title:p?null:e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>y(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[b?e.jsx(M,{size:16}):e.jsx(Ce,{style:{fontSize:16}}),s("common.create")]},"add")]}),j.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>y(i=>({...i,webhookDetail:{open:!1,id:null}})),id:j.webhookDetail.id}),j.createEdit.open&&e.jsx(oe,{onSubmit:h,...j.createEdit,onClose:()=>y(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),j.deleteConfirm&&e.jsx(Ze,{title:j.deleteConfirm.title,description:j.deleteConfirm.description,confirm:j.deleteConfirm.confirm,cancel:j.deleteConfirm.cancel,params:j.deleteConfirm.params,onConfirm:j.deleteConfirm.onConfirm,onCancel:j.deleteConfirm.onCancel})]})}export{Ot as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D2a97Hdb.js","assets/vendor-ux-did-connect-2jRoUb28.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-BV2FUxWJ.js","assets/vendor-hooks-BgUTpb6X.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-BlrkGjK9.js","assets/index-Bs1kxR8_.js","assets/index-B_NDUfon.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as U,b as be}from"./vendor-react-DEoibe3W.js";import{a as F,d as H,j as K,a0 as M,_ as ve,$ as ne,Y as $,b6 as ye,a9 as Ce,a2 as we}from"./vendor-ux-did-connect-2jRoUb28.js";import{H as o,j as e,D as G,aj as Q,I as X,t as Y,al as W,T as I,aa as p,O as T,bq as y,bK as Te,bQ as oe,bs as se,bR as ae,X as J,ak as ce,z as ue,y as L,ab as Z,ad as Se}from"./vendor-mui-core-BV2FUxWJ.js";import{B as de}from"./vendor-arcblock-BlrkGjK9.js";import{d as ke}from"./Edit-CUl1Rt8i.js";import{_ as Ie}from"./dot-itVN8XTt.js";import{l as pe}from"./index-BKKwhjBs.js";import{D as B,aB as he,aC as S,G as Ae}from"./index-B_NDUfon.js";import{u as _}from"./dashboard-BhR1WNzF.js";import{o as Re,c as qe,A as re}from"./vendor-utils-rHXShPKm.js";import{T as Oe}from"./index-NQMMaHuW.js";import{E as Pe}from"./empty-spinner-BdaCO6xq.js";import{C as v}from"./click-to-copy-R7MF4AwY.js";import{D as Ne}from"./delete-confirm-CHnQ2leb.js";import{b as Ee}from"./passport-item-OEfv-Vh7.js";import{A as We}from"./actions-DP7pj6xB.js";import{T as le}from"./table-tips-BfSSGl9N.js";import{u as De}from"./use-mobile-BAa0wi8o.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-510ntT1B.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./confirm-Tue92P8p.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./InfoOutlined-D3XnF0Vg.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-CDDcwz3P.js";import"./index-D1kTR2xk.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./did-address-Dq-4__HB.js";import"./util-DMfPwzVN.js";import"./base32-WurN0cIW.js";import"./MoreHoriz-DpKn_fkc.js";const ze={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:d}){const[t,m]=U.useState(!1),{t:n,locale:s}=F(),{api:g}=B(),{teamDid:h}=_(),{control:f,handleSubmit:q,formState:{errors:a},watch:k,setValue:x}=he({defaultValues:ze,mode:"onChange"}),w=k("scope"),A=c=>{c!=="profile:read"&&x("scope",w.includes(c)?w.filter(u=>u!==c):[...w,c])},N=async c=>{m(!0);try{const u={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(O=>O.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Re(u,qe)}}),r(u)}catch(u){M.error(u.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(G,{open:!0,onClose:d,maxWidth:"md",fullWidth:!0,children:[e.jsxs(Q,{children:[n("oauth.client.register")," ",e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsxs(W,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(u=a.clientName)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(u=a.clientUri)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(u=a.redirectUris)==null?void 0:u.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(y,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(y,{children:n("oauth.client.helperText.read")}),e.jsx(y,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(y,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Te,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(K.OAUTH_SCOPES).map(([c,u])=>e.jsx(se,{control:e.jsx(ae,{checked:w.includes(c),onChange:()=>A(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:u})})},c))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(W,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(u=a.contacts)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(W,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(u=a.tosUri)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(u=a.policyUri)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(ue,{children:[e.jsx(L,{onClick:d,children:n("common.cancel")}),e.jsxs(L,{onClick:q(N),disabled:t,variant:"contained",color:"primary",children:[t?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function V({scope:r,...d}){if(!r)return null;const t=r.split(" ").filter(Boolean);return e.jsx(W,{direction:"row",flexWrap:"wrap",gap:1,...d,children:t.map(m=>e.jsx(be.Fragment,{children:e.jsx(Se,{title:K.OAUTH_SCOPES[m],children:e.jsx(v,{children:m})})},m))})}V.propTypes={scope:o.string};V.defaultProps={scope:""};const ee=r=>{const{prefix:d}=B(),{blocklet:t}=Ae(),m=re(d,"/api/media/upload",t.appPid),n=U.useCallback(g=>g?g.startsWith("http")?g:`${re(d,"/api/media/upload",t.appPid)}/${g}`:"",[d,t.appPid]);return{clientLogoUrl:U.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},Le=U.lazy(()=>ve(()=>import("./index-D2a97Hdb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:d,onClose:t}){const[m,n]=U.useState(!1),{t:s,locale:g}=F(),h=U.useRef(null),{api:f}=B(),{teamDid:q}=_(),{control:a,handleSubmit:k,formState:{errors:x},watch:w,setValue:A,getValues:N}=he({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),c=w("scope"),u=w("logoUri"),{clientLogoUrl:O,apiPath:E}=ee(u),R=l=>{l!=="profile:read"&&A("scope",c.includes(l)?c.filter(i=>i!==l):[...c,l])},D=async l=>{const i={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:q,input:i}})},z=async l=>{n(!0);try{await D(l),d(),t()}catch(i){M.error(i.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(G,{open:!0,onClose:t,maxWidth:"md",fullWidth:!0,children:[e.jsxs(Q,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:t,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsxs(W,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:O?e.jsx(p,{children:e.jsx("img",{src:O,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(de,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(L,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(O?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(U.Suspense,{fallback:e.jsx(Pe,{}),children:e.jsx(Le,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{A("logoUri",l.data.filename),D(N()).then(()=>{d()}).catch(i=>{M.error(i.message||s("oauth.client.updateFailed"))}).finally(()=>{var i;(i=h.current)==null||i.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:E,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(T,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(i=x.clientName)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(i=x.clientUri)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(i=x.redirectUris)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(Oe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:i=>{l.onChange(i)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(K.OAUTH_SCOPES).map(([l,i])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>R(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:i})})},l))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(i=x.contacts)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(W,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(i=x.tosUri)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(i=x.policyUri)==null?void 0:i.message}),e.jsx(y,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(ue,{children:[e.jsx(L,{onClick:t,children:s("common.cancel")}),e.jsx(L,{onClick:k(z),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:d,onClose:t}){return e.jsx(xe,{client:r,onUpdate:m=>d(m),onClose:t})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:d}=F(),{api:t}=B(),{teamDid:m}=_(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},q=async()=>{try{await t.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(k){M.error(k==null?void 0:k.message)}finally{f()}},a={keyName:s,title:d("oauth.client.delete.title"),description:d("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:d("oauth.client.delete.description",{name:s}),confirm:d("common.delConfirm"),cancel:d("common.cancel"),onConfirm:q,onCancel:f};return e.jsx(Ne,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:d}){return e.jsxs(p,{mb:3,children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(W,{spacing:1.5,children:d.map(({label:t,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:t}),e.jsx(I,{sx:{wordBreak:"break-all"},children:m||"-"})]},t))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:d}){const{t,locale:m}=F(),{teamDid:n}=_(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:q,clientUri:a,logoUri:k,contacts:x,tosUri:w,policyUri:A,jwksUri:N,jwks:c,softwareId:u,softwareVersion:O,clientIdIssuedAt:E,clientSecretExpiresAt:R,updatedAt:D,createUser:z}=r,{clientLogoUrl:l}=ee(k),i=j=>{try{const P=new URL(window.blocklet.appUrl);return P.pathname=j,P.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),b=[{title:t("common.baseInfo"),items:[{label:t("oauth.client.name"),value:s},{label:t("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:t("oauth.client.clientUri"),value:a?e.jsx(v,{children:a}):"-"},{label:t("oauth.client.clientId"),value:e.jsx(v,{children:g})},{label:t("oauth.client.clientSecret"),value:e.jsx(v,{children:h})},{label:t("oauth.client.redirectUris"),value:e.jsx(v,{children:(f||[]).join(", ")})},{label:t("oauth.client.scope"),value:e.jsx(V,{scope:q})},{label:t("oauth.client.createUser"),value:z?Ee(z,!0):t("oauth.client.openRegistration")}]},{title:t("oauth.client.oauthEndpoints"),items:[{label:t("oauth.client.openidConfiguration"),value:e.jsx(v,{children:i("/.well-known/openid-configuration")})},{label:t("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/authorize")})},{label:t("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/token")})},{label:t("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/userinfo")})},{label:t("oauth.client.jwksUri"),value:e.jsx(v,{children:i("/.well-known/service/oauth/jwks")})},{label:t("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/register")})},{label:t("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:i("/.well-known/service/oauth/logout")})}]},{title:t("oauth.client.metaContact"),items:[{label:t("oauth.client.contacts"),value:x.length?e.jsx(v,{children:(x||[]).join(", ")}):"-"},{label:t("oauth.client.tosUri"),value:w?e.jsx(v,{children:w}):"-"},{label:t("oauth.client.policyUri"),value:A?e.jsx(v,{children:A}):"-"},{label:t("oauth.client.jwksUri"),value:N},{label:t("oauth.client.jwks"),value:c},{label:t("oauth.client.softwareId"),value:u},{label:t("oauth.client.softwareVersion"),value:O}]},{title:t("common.timeInfo"),items:[{label:t("oauth.client.clientIdIssuedAt"),value:E?e.jsx($,{value:E*1e3,type:"all",locale:m}):"-"},{label:t("oauth.client.clientSecretExpiresAt"),value:R?e.jsx($,{value:R*1e3,type:"all",locale:m}):"-"},{label:t("common.updatedAt"),value:D?e.jsx($,{value:D,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(G,{open:!0,onClose:d,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(Q,{children:[t("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(H,{})})]}),e.jsx(Y,{children:e.jsx(p,{mt:1,children:b.map((j,P)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),P!==b.length-1&&e.jsx(J,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Fe(r){return e.jsx($,{value:r*1e3})}function ie({selected:r,onClose:d}){return r?e.jsx(fe,{client:r,onClose:d}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function Ue({open:r,onCreated:d,onClose:t}){return r?e.jsx(me,{onCreated:d,onClose:t}):null}Ue.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function At(){var l;const[r,d]=U.useState({searchText:"",pageSize:10,page:1}),[t,m]=U.useState(null),[n,s]=U.useState(!1),g=U.useRef(null),{t:h,locale:f}=F(),{api:q}=B(),{teamDid:a}=_(),[k,x]=U.useState(null),[w,A]=U.useState(null),N=De(),{getClientLogoUrl:c}=ee(),u=Ie(async()=>await q.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:O}=u,E=U.useMemo(()=>{var i;return((i=u.value)==null?void 0:i.list)||[]},[(l=u.value)==null?void 0:l.list]),R=U.useMemo(()=>r.searchText?E.filter(i=>i.clientName.toLowerCase().includes(r.searchText.toLowerCase())||i.clientId.toLowerCase().includes(r.searchText.toLowerCase())||i.scope.toLowerCase().includes(r.searchText.toLowerCase())):E,[r.searchText,E]),D=U.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(i,{rowIndex:C})=>{const b=R[C],j=c(b.logoUri),P=pe.fromAppDid(b.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:P.address,src:j,size:48}),e.jsxs(W,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:b.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:b.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:i=>e.jsx(V,{scope:i})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Fe}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:C})=>{const b=R[C];return e.jsx(We,{actions:[{icon:e.jsx(ke,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(b)}},{icon:e.jsx(ye,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),A(b)}}]})}}}],[R,h,c,a,x,A]),z=({page:i,rowsPerPage:C,searchText:b})=>{r.pageSize!==C?d(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==i+1?d(j=>({...j,searchText:"",page:i+1})):r.searchText!==b&&d(j=>({...j,searchText:b,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[N?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Ce,{data:R,columns:D,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:R.length,searchDebounceTime:400,onRowClick(i,{dataIndex:C},b){var j;if((j=g.current)!=null&&j.contains(b.target)){const P=R[C];m(P)}}},onChange:z,title:N?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(L,{variant:"contained",size:"small",onClick:()=>s(!0),children:[O?e.jsx(Z,{size:16}):e.jsx(de,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(we,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:t,onClose:()=>m(null)}),e.jsx(Ue,{open:n,onCreated:()=>{s(!1),u.retry()},onClose:()=>s(!1)}),k&&e.jsx(je,{client:k,onUpdate:u.retry,onClose:()=>x(null)}),w&&e.jsx(te,{...w,onDelete:u.retry,onClose:()=>A(null)})]})}export{At as default};
|