@abtnode/blocklet-services 1.17.8-beta-20260108-021819-e099f0ca → 1.17.8-beta-20260108-120904-21cb5fb6

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.
Files changed (130) hide show
  1. package/api/util/blocklet-utils.js +9 -4
  2. package/dist/assets/{Google-JbLVL0lz.js → Google-BI3aC5vK.js} +1 -1
  3. package/dist/assets/{access-control-DMsY0Jfu.js → access-control-BL-PuDiR.js} +1 -1
  4. package/dist/assets/{add-component-core-DXBsHpN1.js → add-component-core-BzMN094F.js} +1 -1
  5. package/dist/assets/{add-resource-B1owMSeP.js → add-resource-BRF-rYME.js} +1 -1
  6. package/dist/assets/{addon-B42_QFF5.js → addon-yDIBSjIk.js} +1 -1
  7. package/dist/assets/{advanced-BnFynWN7.js → advanced-DEE0XFtQ.js} +1 -1
  8. package/dist/assets/{aigne-Qq2FBVAW.js → aigne-9evgyH7b.js} +1 -1
  9. package/dist/assets/{appearance-Dnc6HNzY.js → appearance-C8B414U2.js} +1 -1
  10. package/dist/assets/{audit-logs-Cfw8JmA4.js → audit-logs-qNutRhHx.js} +1 -1
  11. package/dist/assets/{authorize-B_1efpwx.js → authorize-CZSHuYdu.js} +1 -1
  12. package/dist/assets/{base32-r3F0yIbl.js → base32-z3esjJBn.js} +1 -1
  13. package/dist/assets/{bind-account-Cw-tBmC3.js → bind-account-QxLU_sxt.js} +1 -1
  14. package/dist/assets/{branding-BxEmV2m2.js → branding-Bk26INk9.js} +1 -1
  15. package/dist/assets/{branding-CBavw5s2.js → branding-_XszRU-Z.js} +1 -1
  16. package/dist/assets/{branding-CbYOEW_s.js → branding-tR0gcoY_.js} +1 -1
  17. package/dist/assets/{bundle-avatar-1zs0l21j.js → bundle-avatar-2AQWR0ld.js} +1 -1
  18. package/dist/assets/{complete-CIQgRJri.js → complete-CEvsz8uU.js} +1 -1
  19. package/dist/assets/{component-qZAbczHw.js → component-BrZ1DWiw.js} +2 -2
  20. package/dist/assets/{config-btuzRTop.js → config-6tpm84_l.js} +1 -1
  21. package/dist/assets/{config-BaKRlJau.js → config-CwlqBQNt.js} +1 -1
  22. package/dist/assets/config-cdtQwn5t.js +53 -0
  23. package/dist/assets/{config-navigation-BNsZpUQd.js → config-navigation-CZ9V7otK.js} +2 -2
  24. package/dist/assets/{config-space-BZQrckxG.js → config-space-CZRqkXsR.js} +1 -1
  25. package/dist/assets/{confirm-D6AvlbAp.js → confirm-Ch-CAgUO.js} +1 -1
  26. package/dist/assets/{connect-_I5q1wXN.js → connect-BNkv99fz.js} +1 -1
  27. package/dist/assets/{connect-Dv4BPfET.js → connect-CadBIZOq.js} +1 -1
  28. package/dist/assets/{connect-BC85oS0g.js → connect-i7rkK26L.js} +1 -1
  29. package/dist/assets/{connect-to-CVH3cw77.js → connect-to-lX3lujSp.js} +1 -1
  30. package/dist/assets/{dashboard-BQgUp8NI.js → dashboard-CmJOnF0g.js} +2 -2
  31. package/dist/assets/{delete-confirm-BLy-Oo1o.js → delete-confirm-DiU5PO2T.js} +1 -1
  32. package/dist/assets/{domain-BqtauLm5.js → domain-DHqSA0zl.js} +1 -1
  33. package/dist/assets/{domain-action-card-nuzd77mn.js → domain-action-card-BsNaII7k.js} +1 -1
  34. package/dist/assets/{domains-Cg8723ho.js → domains-BQ_Of9Oo.js} +1 -1
  35. package/dist/assets/{email-CCNEyVGq.js → email-DXdzQLls.js} +1 -1
  36. package/dist/assets/engine-D18zeIE7.js +1 -0
  37. package/dist/assets/{exchange-passport-DR-pKNHM.js → exchange-passport-NOgYhNpm.js} +1 -1
  38. package/dist/assets/{form-Bkig0Zr5.js → form-DhecYoSJ.js} +1 -1
  39. package/dist/assets/{fuel-tC2bCgpP.js → fuel-DgzL5KSX.js} +1 -1
  40. package/dist/assets/{gen-access-key-BbtCn0wJ.js → gen-access-key-BxnyhhCR.js} +1 -1
  41. package/dist/assets/{gen-simple-access-key-DbKaLz9m.js → gen-simple-access-key-BJI-4yOF.js} +1 -1
  42. package/dist/assets/{get-safe-url-DxqVk96E.js → get-safe-url-BVTaUfvO.js} +1 -1
  43. package/dist/assets/{home-BdXWvJM-.js → home-Bibhtg_U.js} +1 -1
  44. package/dist/assets/{iframe-BHP6CYbe.js → iframe-CqiUrjUO.js} +1 -1
  45. package/dist/assets/{index-DixUQBnm.js → index-0ZSFNH-D.js} +1 -1
  46. package/dist/assets/{index-C96Fw4Lj.js → index-BhpNA6ar.js} +1 -1
  47. package/dist/assets/{index-D3L_FG1K.js → index-BszSKE9L.js} +1 -1
  48. package/dist/assets/{index-BbSDwNE6.js → index-CHkWO9t3.js} +1 -1
  49. package/dist/assets/{index-BPZITdMW.js → index-Cdaohlhu.js} +1 -1
  50. package/dist/assets/{index-DVrxzIzr.js → index-CdsI3g5U.js} +1 -1
  51. package/dist/assets/index-CsYL8tps.js +1 -0
  52. package/dist/assets/{index-CNGNZ6kv.js → index-D88DUiSg.js} +1 -1
  53. package/dist/assets/{index-B0O4cfgn.js → index-D8NN8LDz.js} +1 -1
  54. package/dist/assets/{index-BEfIUbZC.js → index-DI4CWTXR.js} +62 -62
  55. package/dist/assets/{index-BvB9yPsA.js → index-DUnMyyWn.js} +3 -3
  56. package/dist/assets/{index-DUL9RfTo.js → index-D_ckidZn.js} +1 -1
  57. package/dist/assets/{index-5IYIk-ZG.js → index-DlifV2p1.js} +1 -1
  58. package/dist/assets/{index-BGo7DXlf.js → index-DzdHYw6g.js} +1 -1
  59. package/dist/assets/{index-B7hLDto7.js → index-Ge2WhAk1.js} +1 -1
  60. package/dist/assets/{index-BoLm67SH.js → index-POuATgdm.js} +1 -1
  61. package/dist/assets/index-TBM4hzrY.js +81 -0
  62. package/dist/assets/{index-BasnkqHA.js → index-WjASWJcO.js} +1 -1
  63. package/dist/assets/{index-Cvt4JvUl.js → index-fC-FqmP3.js} +1 -1
  64. package/dist/assets/{index-yvRJAzQn.js → index-gohmHhDq.js} +1 -1
  65. package/dist/assets/{index-Ly6A31IO.js → index-hBDzzv6I.js} +1 -1
  66. package/dist/assets/{index-dC2vB2_g.js → index-iX-pnOjy.js} +1 -1
  67. package/dist/assets/{index-BrDWLIA2.js → index-jILCQaR3.js} +1 -1
  68. package/dist/assets/{index-D320ZZ3W.js → index-m_xRKGyG.js} +1 -1
  69. package/dist/assets/{index-Bv2O-NCZ.js → index-mt_AKU_F.js} +2 -2
  70. package/dist/assets/{index-DTdf57JC.js → index-u9tqiWy4.js} +1 -1
  71. package/dist/assets/{index-BHnD9G0G.js → index-uexcv8C-.js} +1 -1
  72. package/dist/assets/{info-outline-rounded-YiCh4oGg.js → info-outline-rounded-BLwoUxyI.js} +1 -1
  73. package/dist/assets/{invitation-CnuNtRnn.js → invitation-DSs7YT3_.js} +1 -1
  74. package/dist/assets/{invitations-D_3NLIPO.js → invitations-DK7oD-E6.js} +1 -1
  75. package/dist/assets/{invite-CUVHQCSI.js → invite-CdWfDz--.js} +1 -1
  76. package/dist/assets/{isURL-vNa-ZfGd.js → isURL-DMMDDAKA.js} +1 -1
  77. package/dist/assets/{issue-passport-Do2LhI-f.js → issue-passport-yIqheTA0.js} +1 -1
  78. package/dist/assets/{item-BabsiwzU.js → item-BV3WfK17.js} +1 -1
  79. package/dist/assets/{landing-page-B5QvkHHO.js → landing-page-BDAr8Hmo.js} +1 -1
  80. package/dist/assets/{layout-DRVZ4L0D.js → layout-DzZv-Jny.js} +1 -1
  81. package/dist/assets/{list-B22ZyQqz.js → list-B6eMSw29.js} +1 -1
  82. package/dist/assets/{list-BbHzj-7w.js → list-BWd3aUjb.js} +1 -1
  83. package/dist/assets/{localization-BFHoFo4B.js → localization-oLJXrcTA.js} +1 -1
  84. package/dist/assets/{log-BigiLZw2.js → log-BskdQbRf.js} +1 -1
  85. package/dist/assets/{login-DeBY1fPe.js → login-CfL0Uf6Y.js} +1 -1
  86. package/dist/assets/{login-oauth-callback-Du-bMipe.js → login-oauth-callback-_6XAZMOE.js} +1 -1
  87. package/dist/assets/{logo-uploader-DEFzQY0j.js → logo-uploader-D5E5QaRF.js} +1 -1
  88. package/dist/assets/{lost-passport-DkN5GdCK.js → lost-passport-CUtEI06a.js} +1 -1
  89. package/dist/assets/{open-window-CdadJ5vo.js → open-window-Bi6zVDJd.js} +1 -1
  90. package/dist/assets/{over-due-invoice-payment-CXZ42RZu.js → over-due-invoice-payment-B7FQEnNH.js} +1 -1
  91. package/dist/assets/{overview-a9TXaGnH.js → overview-C7QghcRT.js} +1 -1
  92. package/dist/assets/{passport-C_PAxd9K.js → passport-B_eTMTmZ.js} +1 -1
  93. package/dist/assets/{passport-item-BudJHbYX.js → passport-item-D53yZ-cF.js} +1 -1
  94. package/dist/assets/{permission-CeqEAPPT.js → permission-DC8i_y8F.js} +1 -1
  95. package/dist/assets/{preferences-ixUbb8gE.js → preferences-DzDUGj-O.js} +1 -1
  96. package/dist/assets/{profile-embed-BIwa1Yt3.js → profile-embed-B3QUDkbU.js} +1 -1
  97. package/dist/assets/{provider-icon-CkqIY6iX.js → provider-icon-D15U0Izg.js} +1 -1
  98. package/dist/assets/{publish-resource-BpvxLOlV.js → publish-resource-DCIlLUPS.js} +1 -1
  99. package/dist/assets/{runtime-TkU2snTc.js → runtime-BHekBabT.js} +1 -1
  100. package/dist/assets/sdk-CJUhxOGJ.js +1 -0
  101. package/dist/assets/{security-Dw0iwARQ.js → security-BMslI5IZ.js} +1 -1
  102. package/dist/assets/{session-Cin9Rizr.js → session-CZpDtsCZ.js} +1 -1
  103. package/dist/assets/{setup-Daw0Bdkr.js → setup-CCvGdFDO.js} +1 -1
  104. package/dist/assets/{spaces-DghHe7uP.js → spaces-D3H6AchN.js} +1 -1
  105. package/dist/assets/{start-SLdZOtVD.js → start-SeWUP0mo.js} +1 -1
  106. package/dist/assets/{starting-progress-BiI8hmaj.js → starting-progress-Y3UjFmoX.js} +1 -1
  107. package/dist/assets/{status-DRNtY6SL.js → status-MSXp_buG.js} +1 -1
  108. package/dist/assets/{step-actions-Cb6B0FCJ.js → step-actions-BNFJWVZI.js} +1 -1
  109. package/dist/assets/{studio-CVfdma-R.js → studio-CRjDRBty.js} +1 -1
  110. package/dist/assets/{team-DkV63Yjl.js → team-YWd-FRKh.js} +1 -1
  111. package/dist/assets/{traffic-C8BReAMz.js → traffic-0IuWlrAD.js} +1 -1
  112. package/dist/assets/{transfer-Dt4V38KL.js → transfer-DRS2VUAN.js} +1 -1
  113. package/dist/assets/{unsubscribe-rCcvC6Dj.js → unsubscribe-xDow2Z6m.js} +1 -1
  114. package/dist/assets/{use-app-logo-DnCfhAzv.js → use-app-logo-hIHAHSSI.js} +1 -1
  115. package/dist/assets/{user-center-Cnc61do7.js → user-center-COnqQuqE.js} +1 -1
  116. package/dist/assets/{user-follower-Cc2pWcSL.js → user-follower-DVX8m-Zk.js} +1 -1
  117. package/dist/assets/{util-CMCJQTXJ.js → util-Dee1Ybp3.js} +1 -1
  118. package/dist/assets/{util-BgLSp_5A.js → util-GXkeqbBQ.js} +1 -1
  119. package/dist/assets/{wait-connect-TKbZWSFd.js → wait-connect-CLe9IfYi.js} +1 -1
  120. package/dist/assets/{wizard-BSaM_cSr.js → wizard-8Tk0iyxY.js} +1 -1
  121. package/dist/assets/{wizard-components-BOHnkwWH.js → wizard-components-C10frai0.js} +1 -1
  122. package/dist/assets/{wrap-locale-CFhaO2KZ.js → wrap-locale-CxYp8fAf.js} +1 -1
  123. package/dist/assets/{zh-DG89vJJ6.js → zh-BRjrClew.js} +1 -1
  124. package/dist/index.html +1 -1
  125. package/package.json +24 -24
  126. package/dist/assets/config-CoSaZVwp.js +0 -53
  127. package/dist/assets/engine-DOYgeVKF.js +0 -1
  128. package/dist/assets/index-B3RkYGd7.js +0 -1
  129. package/dist/assets/index-Bm1VCAzZ.js +0 -81
  130. package/dist/assets/sdk-CMvNWVGa.js +0 -1
@@ -1,81 +0,0 @@
1
- import{V as $,W as P,K as me,bv as ke,d6 as St,d7 as Lt,b9 as le,ay as N,a_ as we,F as M,a8 as Y,d8 as It,d9 as Ct,bb as Fe,da as Dt,b3 as Tt,bc as Ne}from"./vendor-ux-DjXlxcvL.js";import{b as g,a as se,f as At,g as be,c as Pt}from"./vendor-hooks-DQAdyHrE.js";import{r as L,L as Et}from"./vendor-react-CTtPmzVP.js";import{j as e,ak as m,y as V,z as q,W as u,bX as Q,Q as X,T as te,I as pe,a3 as he,D as Le,b6 as _,cu as _e,bi as qe,d_ as Ot,at as $e,ah as Je,d$ as Ke,a6 as Be,am as Ft,e0 as qt,bb as Bt,d2 as Rt,d3 as Wt,dV as zt,bO as Ut,b0 as Nt,d4 as _t,U as Ge,Y as Vt,b5 as Ht,$ as Mt,bZ as $t,M as Jt,R as Kt,e1 as Gt}from"./vendor-mui-core-CKKG_1TN.js";import{M as ae}from"./provider-icon-CkqIY6iX.js";import{x as re,n as B,z as ge,E as Ze,b as je,a3 as Xe,aD as Zt,a as Ye}from"./vendor-utils-CUs2ebe7.js";import{Z as K,Y as J,c as ne,cH as Re,aB as Qe,bA as Xt,J as We,l as Yt}from"./index-BEfIUbZC.js";import{u as ie,C as A,a as Ve}from"./index.esm-Co8ZxFyk.js";import{S as C}from"./section-CenHBXqj.js";import{S as Qt}from"./switch-control-npfWE_aC.js";import{d as en,a as tn}from"./edit-rounded-CnMn6J-D.js";import{S as nn}from"./simple-select-DtCsUIHR.js";import{u as et}from"./index-BnOC3Ium.js";import{v as on}from"./index-BSZ3mQac.js";import{r as an}from"./base32-r3F0yIbl.js";import{C as sn}from"./click-to-copy-Dk6ZAJOw.js";import{u as rn}from"./use-mobile-_vjPRYx2.js";import"./lottie-web-4koyQiv_.js";import"./google-icon-vNOJy67F.js";import"./vendor-arcblock-BCP2x3BR.js";import"./required-DHjZE3-Y.js";import"./arrow-down.svg-7ME6T1BL.js";const Ie={domain:"",clientId:"",clientSecret:""};function tt({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t,locale:d}=$(),c=n?.meta?.did,f=Object.assign({...Ie},n?.settings?.authentication?.auth0||{}),p=(n.environments||[]).find(a=>a.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:h,reset:b}=ie({defaultValues:re(f,Object.keys(Ie))}),x=g(async a=>{try{const{blocklet:o}=await i.configAuthentication({input:{did:c,authentication:JSON.stringify({...l,auth0:{...a,order:l.auth0?.order??Object.keys(l).length,enabled:!0,type:"oauth"}})}}),I=Object.assign({...Ie},o?.settings?.authentication?.auth0||{});b(I),P.success(t("common.saveSuccess")),s()}catch(o){P.error(o.message||t("common.saveFailed"))}}),D=g(a=>a?.trim()?!0:t("authentication.auth0.domainDescription")),S=g(a=>a?.trim()?!0:t("authentication.auth0.clientIdDescription")),T=g(a=>a?.trim()?!0:t("authentication.auth0.clientSecretDescription")),v=se(()=>d==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[d]),j=ge(p,ne.WELLKNOWN_SERVICE_PATH_PREFIX,"oauth/callback/auth0");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{onSubmit:y(x),disabled:!0,children:[e.jsx(C,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:v,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[v,e.jsx(m,{component:me,icon:Re,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(C,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[j,e.jsx(ke,{locale:d,content:j,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(C,{title:t("authentication.auth0.domain"),children:e.jsx(A,{name:"domain",control:w,rules:{validate:D},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...a,size:"small",label:t("authentication.auth0.domain"),error:!!h.errors[a.name],helperText:h.errors[a.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.auth0.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:S},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...a,size:"small",label:t("authentication.auth0.clientId"),error:!!h.errors[a.name],helperText:h.errors[a.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.auth0.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:T},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...a,size:"small",type:"password",label:t("authentication.auth0.clientSecret"),error:!!h.errors[a.name],helperText:h.errors[a.name]?.message||" "})})})})]})})}tt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Ce={clientId:"",clientSecret:""};function nt({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t,locale:d}=$(),c=n?.meta?.did,f=Object.assign({...Ce},n?.settings?.authentication?.github||{}),p=(n.environments||[]).find(j=>j.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:h,reset:b}=ie({defaultValues:re(f,Object.keys(Ce))}),x=g(async j=>{try{const{blocklet:a}=await i.configAuthentication({input:{did:c,authentication:JSON.stringify({...l,github:{...j,order:l.github?.order??Object.keys(l).length,enabled:!0,type:"oauth"}})}}),o=Object.assign({...Ce},a?.settings?.authentication?.github||{});b(o),P.success(t("common.saveSuccess")),s()}catch(a){P.error(a.message||t("common.saveFailed"))}}),D=g(j=>j?.trim()?!0:t("authentication.github.clientIdDescription")),S=g(j=>j?.trim()?!0:t("authentication.github.clientSecretDescription")),T=se(()=>d==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[d]),v=ge(p,ne.WELLKNOWN_SERVICE_PATH_PREFIX,"oauth/callback/github");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{disabled:!0,children:[e.jsx(C,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:me,icon:Re,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(C,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[v,e.jsx(ke,{locale:d,content:v,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(C,{title:t("authentication.github.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:D},render:({field:j})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...j,size:"small",label:t("authentication.github.clientId"),error:!!h.errors[j.name],helperText:h.errors[j.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.github.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:S},render:({field:j})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...j,size:"small",type:"password",label:t("authentication.github.clientSecret"),error:!!h.errors[j.name],helperText:h.errors[j.name]?.message||" "})})})})]})})}nt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const De={showQrcode:!0};function it({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t}=$(),d=n?.meta?.did,c=Object.assign({...De},n?.settings?.authentication?.wallet||{}),{handleSubmit:f,control:p,reset:y}=ie({defaultValues:re(c,Object.keys(De))}),w=g(async h=>{try{const{blocklet:b}=await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...l,wallet:{...h,order:l.wallet?.order??Object.keys(l).length,enabled:!0,type:"builtin"}})}}),x=Object.assign({...De},b?.settings?.authentication?.wallet||{});y(x),P.success(t("common.saveSuccess")),s()}catch(b){P.error(b.message||t("common.saveFailed"))}});return L.useImperativeHandle(r,()=>({submit:f(w)}),[f,w]),e.jsx(m,{children:e.jsx("form",{children:e.jsx(C,{title:t("authentication.wallet.showQrcode"),children:e.jsx(A,{name:"showQrcode",control:p,render:({field:h})=>e.jsx(Q,{control:e.jsx(Qt,{sx:{ml:1},checked:h.value,...h})})})})})})}it.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};function ot({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t}=$(),d=n?.meta?.did,c=g(async()=>{try{await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...l,email:{order:l.email?.order??Object.keys(l).length,enabled:!0,type:"builtin"}})}}),P.success(t("common.saveSuccess")),s()}catch(f){P.error(f.message||t("common.saveFailed"))}});return L.useImperativeHandle(r,()=>({submit:c}),[c]),e.jsxs(m,{children:[t("authentication.emailLoginDescription"),e.jsx("br",{}),t("authentication.emailNotificationRequired"),e.jsx("br",{}),e.jsx(m,{component:Et,to:ge(ne.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/notification/settings"),sx:{mt:1,display:"inline-block"},children:e.jsx(X,{size:"small",variant:"outlined",children:t("authentication.gotoEmailNotification")})})]})}ot.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};function at({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t}=$(),d=n?.meta?.did,c=g(async()=>{try{await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...l,passkey:{order:l.passkey?.order??Object.keys(l).length,enabled:!0,type:"builtin"}})}}),P.success(t("common.saveSuccess")),s()}catch(f){P.error(f.message||t("common.saveFailed"))}});return L.useImperativeHandle(r,()=>({submit:c}),[c]),null}at.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Te={clientId:"",clientSecret:""};function st({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t,locale:d}=$(),c=n?.meta?.did,f=Object.assign({...Te},n?.settings?.authentication?.google||{}),p=(n.environments||[]).find(j=>j.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:h,reset:b}=ie({defaultValues:re(f,Object.keys(Te))}),x=g(async j=>{try{const{blocklet:a}=await i.configAuthentication({input:{did:c,authentication:JSON.stringify({...l,google:{...j,order:l.google?.order??Object.keys(l).length,enabled:!0,type:"oauth"}})}}),o=Object.assign({...Te},a?.settings?.authentication?.google||{});b(o),P.success(t("common.saveSuccess")),s()}catch(a){P.error(a.message||t("common.saveFailed"))}}),D=g(j=>j?.trim()?!0:t("authentication.google.clientIdDescription")),S=g(j=>j?.trim()?!0:t("authentication.google.clientSecretDescription")),T=se(()=>d==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[d]),v=ge(p,ne.WELLKNOWN_SERVICE_PATH_PREFIX,"oauth/callback/google");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{onSubmit:y(x),disabled:!0,children:[e.jsx(C,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:me,icon:Re,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(C,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[v,e.jsx(ke,{locale:d,content:v,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(C,{title:t("authentication.google.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:D},render:({field:j})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...j,size:"small",label:t("authentication.google.clientId"),error:!!h.errors[j.name],helperText:h.errors[j.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.google.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:S},render:({field:j})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...j,size:"small",type:"password",label:t("authentication.google.clientSecret"),error:!!h.errors[j.name],helperText:h.errors[j.name]?.message||" "})})})})]})})}st.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Ae={teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function rt({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t,locale:d}=$(),c=n?.meta?.did,f=Object.assign({...Ae},n?.settings?.authentication?.apple||{}),p=(n.environments||[]).find(o=>o.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:h,reset:b}=ie({defaultValues:re(f,Object.keys(Ae))}),x=g(async o=>{try{const{blocklet:I}=await i.configAuthentication({input:{did:c,authentication:JSON.stringify({...l,apple:{...o,order:l.apple?.order??Object.keys(l).length,enabled:!0,type:"oauth"}})}}),W=Object.assign({...Ae},I?.settings?.authentication?.apple||{});b(W),P.success(t("common.saveSuccess")),s()}catch(I){P.error(I.message||t("common.saveFailed"))}}),D=g(o=>o?.trim()?!0:t("authentication.apple.teamIdDescription")),S=g(o=>o?.trim()?!0:t("authentication.apple.serviceIdDescription")),T=g(o=>o?.trim()?!0:t("authentication.apple.keyIdDescription")),v=g(o=>o?.trim()?!0:t("authentication.apple.authKeyDescription")),j=g(o=>o?.trim()?!0:t("authentication.apple.bundleIdDescription")),a=ge(p,ne.WELLKNOWN_SERVICE_PATH_PREFIX,"oauth/callback/apple");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{children:[e.jsx(C,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[a,e.jsx(ke,{locale:d,content:a,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(C,{title:t("authentication.apple.teamId"),children:e.jsx(A,{name:"teamId",control:w,rules:{validate:D},render:({field:o})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...o,size:"small",label:t("authentication.apple.teamId"),error:!!h.errors[o.name],helperText:h.errors[o.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.apple.bundleId"),children:e.jsx(A,{name:"bundleId",control:w,rules:{validate:j},render:({field:o})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...o,size:"small",label:t("authentication.apple.bundleId"),error:!!h.errors[o.name],helperText:h.errors[o.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.apple.serviceId"),children:e.jsx(A,{name:"serviceId",control:w,rules:{validate:S},render:({field:o})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...o,size:"small",label:t("authentication.apple.serviceId"),error:!!h.errors[o.name],helperText:h.errors[o.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.apple.keyId"),children:e.jsx(A,{name:"keyId",control:w,rules:{validate:T},render:({field:o})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...o,size:"small",label:t("authentication.apple.keyId"),error:!!h.errors[o.name],helperText:h.errors[o.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.apple.authKey"),children:e.jsx(A,{name:"authKey",control:w,rules:{validate:v},render:({field:o})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...o,size:"small",type:"password",label:t("authentication.apple.authKey"),multiline:!0,rows:4,error:!!h.errors[o.name],helperText:h.errors[o.name]?.message||" ",slotProps:{input:{sx:{WebkitTextSecurity:"disc",fontFamily:"text-security-disc, monospace"}}}})})})})]})})}rt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Pe={clientId:"",clientSecret:""};function lt({ref:r=null,onSuccess:s=B,sortMaps:l={}}){const{api:i}=K(),{blocklet:n}=J(),{t,locale:d}=$(),c=n?.meta?.did,f=Object.assign({...Pe},n?.settings?.authentication?.twitter||{}),p=(n.environments||[]).find(v=>v.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:h,reset:b}=ie({defaultValues:re(f,Object.keys(Pe))}),x=g(async v=>{try{const{blocklet:j}=await i.configAuthentication({input:{did:c,authentication:JSON.stringify({...l,twitter:{...v,order:l.twitter?.order??Object.keys(l).length,enabled:!0,type:"oauth"}})}}),a=Object.assign({...Pe},j?.settings?.authentication?.twitter||{});b(a),P.success(t("common.saveSuccess")),s()}catch(j){P.error(j.message||t("common.saveFailed"))}}),D=g(v=>v?.trim()?!0:t("authentication.twitter.clientIdDescription")),S=g(v=>v?.trim()?!0:t("authentication.twitter.clientSecretDescription")),T=ge(p,ne.WELLKNOWN_SERVICE_PATH_PREFIX,"oauth/callback/twitter");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{onSubmit:y(x),disabled:!0,children:[e.jsx(C,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[T,e.jsx(ke,{locale:d,content:T,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(C,{title:t("authentication.twitter.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:D},render:({field:v})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...v,size:"small",label:t("authentication.twitter.clientId"),error:!!h.errors[v.name],helperText:h.errors[v.name]?.message||" "})})})}),e.jsx(C,{title:t("authentication.twitter.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:S},render:({field:v})=>e.jsx(V,{fullWidth:!0,children:e.jsx(q,{...v,size:"small",type:"password",label:t("authentication.twitter.clientSecret"),error:!!h.errors[v.name],helperText:h.errors[v.name]?.message||" "})})})})]})})}lt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const ln={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function ct({id:r,title:s,index:l,onBegin:i=B,onMove:n,onEnd:t,onEditItem:d=B,onDeleteItem:c=B,disableDelete:f=!1,icon:p=null}){const y=L.useRef(null),w=L.useRef(null),[{handlerId:h},b]=St({accept:"dragItem",collect(T){return{handlerId:T.getHandlerId()}},hover(T,v){if(!y.current)return;const j=T.index,a=l;if(j===a)return;const o=y.current?.getBoundingClientRect(),I=w.current?.getBoundingClientRect(),W=(I.bottom-I.top)/2,fe=v.getClientOffset().y-o.top;j<a&&fe<W||j>a&&fe>W||(n(j,a),T.index=a)}}),[{isDragging:x},D]=Lt({item:{index:l,type:"dragItem"},collect:T=>({isDragging:T.isDragging()}),begin:i,end:t});D(w),b(y);const S=x?.3:1;return e.jsx(m,{ref:y,children:e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:w,"data-handler-id":h,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:S,display:"flex",alignItems:"center",gap:.5},draggable:!1,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(me,{fontSize:20,icon:ln})}),e.jsx(m,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:p}),e.jsx(te,{sx:{flex:1},children:s}),e.jsx(pe,{size:"small",color:"primary",onClick:()=>{d(r)},children:e.jsx(me,{icon:en})}),e.jsx(pe,{size:"small",color:"error",onClick:()=>{c(r)},disabled:f,children:e.jsx(me,{icon:tn})})]}),e.jsx(he,{})]})})}ct.propTypes={title:u.string.isRequired,id:u.string.isRequired,index:u.number.isRequired,onBegin:u.func,onMove:u.func.isRequired,onEnd:u.func.isRequired,onEditItem:u.func,onDeleteItem:u.func,disableDelete:u.bool,icon:u.any};function dt({ref:r=null,providers:s=[],sortMaps:l={}}){const i=L.useRef(null),{t:n}=L.useContext(le),t=Le(),{control:d,watch:c,setValue:f,reset:p}=ie({mode:"onChange",defaultValues:{provider:""}}),y=c("provider"),w=s.find(a=>a.name===y),h=At(w),b=t?.transitions?.duration?.leavingScreen||300,x=be({initMode:"add",mode:"add",show:!1,callback:B,get dialogTitle(){return this.mode==="edit"?n("authentication.updateLoginProvider",{provider:h.current?.title}):n("authentication.addLoginProvider")}}),D=g(()=>{p(),x.mode="add",x.initMode="add"}),S=g(()=>{x.show=!1,setTimeout(()=>{D()},b)}),T=g((a,o=null)=>{if(x.show=!0,o)x.initMode="edit",x.mode="edit",f("provider",o.provider);else{const I=s.find(W=>W.enabled===!1)?.name||s[0]?.name||N.WALLET;f("provider",I)}a?x.callback=a:x.callback=B});L.useImperativeHandle(r,()=>({open:T,close:S}),[T,S]);const v=g(()=>{i.current.submit()}),j=s.map(a=>({value:a.name,title:a.title,description:a.enabled?n("common.enabled"):""}));return L.useEffect(()=>{w?.enabled?x.mode="edit":x.mode="add"},[w?.enabled]),e.jsxs(we,{open:x.show,title:x.dialogTitle,onClose:S,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(M,{color:"primary",autoFocus:!0,variant:"contained",onClick:v,disabled:!y,children:x.mode==="add"?n("common.confirm"):n("common.update")}),children:[x.initMode==="edit"?null:e.jsx(A,{name:"provider",control:d,render:({field:a})=>e.jsx(nn,{required:!0,fullWidth:!0,margin:"dense",size:"small",label:n("authentication.chooseProvider"),placeholder:n("authentication.chooseProviderPlaceholder"),options:j,...Ze(a,"ref"),slotProps:{optionItem:{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"}}}})}),e.jsx(m,{sx:{mt:2,".section":{mb:1,gap:4},".section-left":{width:150}},children:w?.component&&e.jsx(w.component,{ref:i,onSuccess:S,sortMaps:l})})]})}dt.propTypes={ref:u.any,providers:u.array,sortMaps:u.object};function cn(){const{confirmApi:r,confirmHolder:s}=Qe(),l=L.useRef(),{t:i}=$(),{api:n}=K(),{blocklet:t}=J(),d=t?.meta?.did,c=t?.settings?.authentication||{},f=[{name:N.WALLET,title:Y[N.WALLET],icon:e.jsx(ae,{provider:"wallet",sx:{width:20,height:20,scale:.9}}),component:it},{name:N.EMAIL,title:Y[N.EMAIL],icon:e.jsx(ae,{provider:"email",sx:{width:20,height:20,scale:.9}}),component:ot},{name:N.PASSKEY,title:Y[N.PASSKEY],icon:e.jsx(ae,{provider:"passkey",sx:{width:20,height:20,scale:.9}}),component:at},{name:N.GOOGLE,title:Y[N.GOOGLE],icon:e.jsx(ae,{provider:"google",sx:{width:20,height:20}}),component:st},{name:N.APPLE,title:Y[N.APPLE],icon:e.jsx(ae,{provider:"apple",sx:{width:20,height:20}}),component:rt},{name:N.GITHUB,title:Y[N.GITHUB],icon:e.jsx(ae,{provider:"github",sx:{width:20,height:20}}),component:nt},{name:N.TWITTER,title:Y[N.TWITTER],icon:e.jsx(ae,{provider:"twitter",sx:{width:20,height:20}}),component:lt},{name:N.AUTH0,title:Y[N.AUTH0],icon:e.jsx(ae,{provider:"auth0",sx:{width:20,height:20}}),component:tt,hidden:!0}].map(a=>({...a,enabled:c[a.name]?.enabled??!1,order:c[a.name]?.order??null})),p=f.filter(a=>a.enabled),y=p.sort((a,o)=>!je(a?.order)&&!je(o?.order)?a.order-o.order:je(a?.order)?1:-1),w=y.reduce((a,o,I)=>Object.assign(a,{[o.name]:{order:I}}),{}),h=be(y.reduce((a,o,I)=>Object.assign(a,{[o.name]:I}),{})),b=[...p].sort((a,o)=>h[a.name]-h[o.name]),x={};typeof window<"u"&&(x.context=window);const D=g((a,o)=>{const I=b[a],W=b[o];h[I.name]=o,h[W.name]=a}),S=g(async()=>{const a=Object.keys(h).reduce((o,I)=>(o[I]={order:h[I]},o),{});await n.configAuthentication({input:{did:d,authentication:JSON.stringify(a)}})}),T=()=>{l.current.open(()=>{l.current.close()})},v=g(a=>{l.current.open(B,{provider:a})}),j=g(a=>{r.open({title:i("authentication.deleteLoginProvider",{provider:Y[a]}),content:i("authentication.deleteLoginProviderDescription",{provider:Y[a]}),confirmButtonText:i("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:i("common.cancel"),async onConfirm(o){try{await n.configAuthentication({input:{did:d,authentication:JSON.stringify({[a]:{enabled:!1,order:null}})}}),delete h[a],P.success(i("common.deleteSuccess")),o()}catch(I){P.error(I.message||i("common.deleteFailed"))}}})});return e.jsxs(m,{children:[e.jsx(M,{variant:"contained",onClick:T,sx:{mb:1},children:i("authentication.addLoginProvider")}),e.jsx(It,{backend:Ct,...x,children:b.map((a,o)=>e.jsx(ct,{index:o,id:a.name,title:a.title,icon:a.icon,onMove:D,onEnd:S,onEditItem:v,onDeleteItem:j,disableDelete:y.length<=1,children:a.component},a.name))}),e.jsx(dt,{ref:l,providers:f,sortMaps:w}),s]})}const ue={ttl:ne.SESSION_TTL,cacheTtl:ne.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function Z(r){return e.jsx(et,{...r,sx:{transform:"scale(0.75)"}})}function Ee(r,s=!1){const l=s?r.ttl*86400:r.ttl/86400;return{...r,ttl:l}}function dn(){const{api:r}=K(),{blocklet:s}=J(),l=s?.meta?.did,i=Xe({},ue,s?.settings?.session||{});je(i.ttl)&&(i.ttl=ue.ttl),je(i.cacheTtl)&&(i.cacheTtl=ue.cacheTtl),i.phone||(i.phone=ue.phone),i.email||(i.email=ue.email),je(i.enableBlacklist)&&(i.enableBlacklist=ue.enableBlacklist);const{handleSubmit:n,control:t,formState:d,reset:c,watch:f}=ie({defaultValues:re(Ee(i),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:p}=$(),y=f("email.enabled"),w=f("phone.enabled"),h=f("email.enableDomainBlackList"),b=f("email.enableDomainWhiteList"),{fields:x,append:D,remove:S}=Ve({control:t,name:"email.domainBlackList"}),{fields:T,append:v,remove:j}=Ve({control:t,name:"email.domainWhiteList"}),a=g(async o=>{try{const{blocklet:I}=await r.updateAppSessionConfig({input:{did:l,config:Ze(Ee(o,!0),["phone"])}}),W=Object.assign({},ue,re(I?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));c(Ee(W)),P.success(p("common.configSuccess"))}catch(I){P.error(I.message)}});return e.jsx(un,{onSubmit:n(a),children:e.jsxs(_,{direction:"column",sx:{gap:6},children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:p("blocklet.config.session.profile")}),e.jsx(m,{component:he,sx:{my:3}})]}),e.jsxs(_,{sx:{gap:2},children:[e.jsx(C,{title:p("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(C,{title:p("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(C,{title:p("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.enabled",control:t,render:({field:o})=>e.jsx(Z,{...o,checked:o.value})})})}),y&&e.jsxs(_,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(C,{title:p("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.requireVerified",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(C,{title:p("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.requireUnique",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(C,{title:p("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.trustOauthProviders",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(C,{title:p("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.enableDomainBlackList",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),h&&e.jsxs(m,{children:[x.map((o,I)=>e.jsxs(_,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(A,{name:`email.domainBlackList.${I}`,control:t,render:W=>e.jsx(q,{...W.field,size:"small",fullWidth:!0})}),e.jsx(pe,{onClick:()=>S(I),children:e.jsx(_e,{})})]},o.id)),e.jsx(X,{startIcon:e.jsx(qe,{}),onClick:()=>D(""),children:p("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:p("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.enableDomainWhiteList",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),b&&e.jsxs(m,{children:[T.map((o,I)=>e.jsxs(_,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(A,{name:`email.domainWhiteList.${I}`,control:t,render:W=>e.jsx(q,{...W.field,size:"small",fullWidth:!0})}),e.jsx(pe,{onClick:()=>j(I),children:e.jsx(_e,{})})]},o.id)),e.jsx(X,{startIcon:e.jsx(qe,{}),onClick:()=>v(""),children:p("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(C,{title:p("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"phone.enabled",control:t,disabled:!0,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),w&&e.jsxs(_,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(C,{title:p("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"phone.requireVerified",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(C,{title:p("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"phone.requireUnique",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:p("blocklet.config.session.period")}),e.jsx(m,{component:he,sx:{my:3}}),e.jsx(_,{direction:"column",spacing:2,children:e.jsx(A,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:o})=>e.jsx(V,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:p("blocklet.config.session.ttl",{day:o.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Ot,{...o,defaultValue:7,step:1,marks:[{value:1,label:p("blocklet.config.session.day",{day:1})},{value:7,label:p("blocklet.config.session.days",{day:7})},{value:14,label:p("blocklet.config.session.days",{day:14})},{value:21,label:p("blocklet.config.session.days",{day:21})},{value:30,label:p("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:p("blocklet.config.session.experimentalSettings")}),e.jsx(m,{component:he,sx:{my:3}}),e.jsx(_,{direction:"column",spacing:2,children:e.jsx(C,{title:p("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"enableBlacklist",control:t,render:({field:o})=>e.jsx(Q,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})})})]}),e.jsx(m,{children:e.jsx(X,{type:"submit",variant:"contained",disabled:!d.isDirty,children:p("common.save")})})]})})}const un=$e.form`
2
- max-width: 1536px;
3
-
4
- .advanced-config {
5
- border: 0;
6
- padding: 0;
7
- }
8
-
9
- .config-form {
10
- flex-grow: 1;
11
- overflow-y: auto;
12
- will-change: transform;
13
-
14
- &:first-child {
15
- margin: 0;
16
- }
17
-
18
- ${r=>r.theme.breakpoints.down("md")} {
19
- width: 100%;
20
- flex-shrink: 0;
21
- padding: 0 24px;
22
- transform: translate(0, 0);
23
- }
24
- }
25
-
26
- .config-item {
27
- display: flex;
28
- align-items: center;
29
- justify-content: space-between;
30
- }
31
-
32
- .config-desc {
33
- font-weight: normal;
34
- font-size: 12px;
35
- color: #666;
36
- }
37
-
38
- .form-item {
39
- margin-top: 0;
40
- }
41
- `,mn={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'};var Oe,He;function hn(){if(He)return Oe;He=1;const{DEFAULT_IP_DOMAIN_SUFFIX:r,SLOT_FOR_IP_DNS_SITE:s,DEFAULT_DID_DOMAIN:l}=Xt(),{encode:i}=an();return Oe={getIpDnsDomainForBlocklet:d=>`${i(d.meta.did)}-${s}.${r}`,getDidDomainForBlocklet:({did:d,didDomain:c=l})=>`${i(d)}.${c}`},Oe}var pn=hn();function ut({ref:r=null}){const{t:s}=L.useContext(le),{blocklet:l}=J(),{api:i}=K(),n=be({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:B}),d=Le()?.transitions?.duration?.leavingScreen||300,c=g(()=>{n.mode="view",n.data={},n.callback=B}),f=g(()=>{n.show=!1,setTimeout(()=>{c()},d)}),p=g(D=>{n.mode="view",n.show=!0,n.data=D}),y=g((D,S=B)=>{n.mode="approve",n.show=!0,n.data=D,n.callback=S});L.useImperativeHandle(r,()=>({open:p,close:f,approve:y}),[p,f,y]);const w=se(()=>{if(!n.show)return[];n.data.migratedFrom=[n.data.appId,n.data.appPid];const D=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return n.data.isMaster!==!1&&Zt(D,"appliedAt","status"),D.map(S=>{const T=s(`federated.info.${S}`);let v=n.data[S];if(S==="appName"&&n.data.isMaster&&(v=e.jsxs(m,{children:[e.jsx(Je,{component:Ke}),v]})),["appId","appPid","serverId"].includes(S)&&(v=e.jsx(Fe,{children:v})),["appUrl"].includes(S)&&(v=e.jsx(m,{component:"a",href:v,target:"_blank",children:v})),["appLogo"].includes(S)){const j=ge(`https://${pn.getDidDomainForBlocklet({did:n.data.appPid})}`,ne.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const a=new URL(j);a.searchParams.set("imageFilter","resize"),a.searchParams.set("w","80"),a.searchParams.set("h","80"),v=e.jsx("img",{src:a.href,width:"60",height:"60",alt:n.data.appName})}catch{v=e.jsx("img",{src:j,width:"60",height:"60",alt:n.data.appName})}}return S==="status"&&(v=v&&s(`federated.status.${v}`)),S==="migratedFrom"&&(v=(n.data.migratedFrom||[]).filter(o=>![n.data.appId,n.data.appPid].includes(o)).map(o=>e.jsx(Fe,{children:o}))),Ye(v)&&(v="-"),{name:T,value:v}})},[n.data]),h=n.mode==="approve",b=g(async()=>{try{n.loadingReject=!0,await i.auditFederatedLogin({input:{memberPid:n.data.appPid,did:l.appPid,status:"rejected"}}),f(),n?.callback(!1)}finally{n.loadingReject=!1}}),x=g(async()=>{try{n.loadingApprove=!0,await i.auditFederatedLogin({input:{memberPid:n.data.appPid,did:l.appPid,status:"approved"}}),f(),n?.callback(!0)}finally{n.loadingApprove=!1}});return e.jsx(we,{open:n.show,title:s(h?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:h?e.jsxs(e.Fragment,{children:[e.jsxs(X,{color:"error",variant:"contained",onClick:b,disabled:n.loadingReject,children:[n.loadingReject?e.jsx(Be,{size:16,color:"grey"}):null,s("common.reject")]}),e.jsxs(X,{variant:"contained",onClick:x,disabled:n.loadingApprove,children:[n.loadingApprove?e.jsx(Be,{size:16,color:"grey"}):null,s("common.approve")]})]}):e.jsx(X,{variant:"outlined",onClick:f,children:s("common.close")}),children:w.map(D=>e.jsx(on,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:D.name,children:D.value},D.name))})}ut.propTypes={ref:u.any};function ze({ref:r=null}){const l=Le()?.transitions?.duration?.leavingScreen||300,{t:i}=L.useContext(le),n=be({show:!1,data:{link:""}}),t=g(()=>{n.data.link=""}),d=g(()=>{n.show=!1,setTimeout(()=>{t()},l)}),c=g(({link:p})=>{n.show=!0,n.data.link=p});L.useImperativeHandle(r,()=>({open:c,close:d}),[c,d]);const f=g(()=>{Pt(n.data.link),d()});return e.jsxs(we,{open:n.show,title:i("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(M,{color:"primary",autoFocus:!0,variant:"contained",onClick:f,children:i("common.copyAndClose")}),children:[e.jsx(m,{sx:{mb:2},children:i("federated.inviteJoinFederatedLoginDescription")}),e.jsx(m,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(sn,{children:n.data.link})})]})}ze.propTypes={ref:u.any};function mt({mode:r="member"}){const s=L.useRef(null),l=L.useRef(null),{t:i,locale:n}=L.useContext(le),{blocklet:t,actions:{refreshBlocklet:d}}=J(),{confirmApi:c,confirmHolder:f}=Qe(),{api:p}=K(),y=t.settings.federated?.sites||[],w=t.settings.federated?.config||{},h=w.isMaster!==!1,b=y.find(E=>E.appPid===t.appPid),x=be({loadingSync:!1}),D=g(E=>{l.current?.open(E)}),S=g(E=>{l.current?.approve(E,d)}),T=g(E=>{c.open({title:i("federated.removeFederatedLogin"),content:i("federated.removeFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(R){await p.quitFederatedLogin({input:{did:t.appPid,targetDid:E.appPid}}),R()}})}),v=g(E=>{c.open({title:i("federated.disableFederatedLogin"),content:i("federated.disableFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(R){await p.auditFederatedLogin({input:{memberPid:E.appPid,did:t.appPid,status:"revoked"}}),R()}})}),j=g(E=>{c.open({title:i("federated.enableFederatedLogin"),content:i("federated.enableFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),async onConfirm(R){await p.auditFederatedLogin({input:{memberPid:E.appPid,did:t.appPid,status:"approved"}}),R()}})}),a=se(()=>{const E=[{label:i("common.name"),name:"appName",options:{customBodyRenderLite:R=>{const O=y[R],ce=O.isMaster!==!1;return e.jsx(m,{sx:{display:"inline-block"},children:e.jsxs(m,{component:"a",href:O.appUrl,target:"_blank",onClick:H=>{H.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[ce&&e.jsx(Je,{component:Ke,style:{marginRight:"4px"}}),O.appName]})})}}},{label:i("common.did"),name:"appId",options:{customBodyRenderLite:R=>{const O=y[R];return e.jsx(Fe,{children:O.appId})}}},{label:i("common.status"),name:"status",options:{customBodyRenderLite:R=>{const O=y[R],ce=O.isMaster!==!1;return e.jsx(m,{children:ce?"-":i(`federated.status.${O.status}`)})}}}];return h&&E.push({label:i("common.actions"),name:"actions",options:{customBodyRenderLite:R=>{const O=y[R],ce=O.isMaster!==!1;return e.jsx(m,{sx:{display:"flex",gap:1},children:ce?e.jsxs(e.Fragment,{children:[O.status==="rejected"&&e.jsx(M,{variant:"contained",color:"error",size:"small",onClick:H=>{H.stopPropagation()},children:i("federated.status.rejected")}),O.status==="revoked"&&e.jsx(M,{variant:"contained",color:"secondary",size:"small",onClick:H=>{H.stopPropagation()},children:i("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(M,{variant:"contained",color:"error",size:"small",onClick:H=>{H.stopPropagation(),T(O)},children:i("federated.quitMember")},"quiteSite"),O.status==="pending"&&e.jsx(M,{variant:"contained",color:"primary",size:"small",onClick:H=>{H.stopPropagation(),S(O)},children:i("federated.status.pending")},"auditSite"),O.status==="approved"&&e.jsx(M,{variant:"contained",color:"error",size:"small",onClick:H=>{H.stopPropagation(),v(O)},style:{whiteSpace:"nowrap"},children:i("federated.revoke")},"revokeSite"),O.status==="revoked"&&e.jsx(M,{variant:"contained",color:"warning",size:"small",onClick:H=>{H.stopPropagation(),j(O)},style:{whiteSpace:"nowrap"},children:i("federated.approve")},"approveSite")]})})}}}),E},[w.appId,y,h,i]),o=se(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(E,{dataIndex:R}){const O=y[R];D(O)}}),[]),I=g(()=>{const E=t.environments.find(R=>R.key===We.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);E?.value?s.current?.open({link:E.value}):P.error(i("federated.failedToGetFederatedLoginLink"))},[t.site?.domainAliases?.[0]?.href]),W=g(()=>{c.open({title:i("federated.quitFederatedLogin"),content:i("federated.quitFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(E){await p.quitFederatedLogin({input:{did:t.appPid}}),E()}})}),ve=g(()=>{c.open({title:i("federated.disbandFederatedLogin"),content:i("federated.disbandFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(E){await p.disbandFederatedLogin({input:{did:t.appPid}}),E()}})}),fe=g(async()=>{try{x.loadingSync=!0,await Promise.all([await p.syncFederatedConfig({input:{did:t.appPid}}),Dt(500)]),P.success(i("common.succeeded"))}finally{x.loadingSync=!1}}),oe=[];return b.status!=="pending"&&oe.push(e.jsx(Ft,{title:i("federated.syncConfig"),children:e.jsx(pe,{size:"small",onClick:fe,disabled:x.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},x.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(me,{icon:mn,style:{fontSize:24}})},"syncConfig")})),r==="master"?(oe.push(e.jsx(M,{size:"small",variant:"contained",onClick:I,sx:{ml:1},children:i("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),oe.push(e.jsx(M,{color:"error",size:"small",variant:"contained",onClick:ve,sx:{ml:1},children:i("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):oe.push(e.jsx(M,{size:"small",variant:"contained",color:"error",onClick:W,sx:{ml:1},children:i("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Tt,{className:"main-table",locale:n,data:y,columns:a,customButtons:oe,title:e.jsx(m,{className:"table-toolbar-left",children:i("authentication.federated")}),options:o}),f,e.jsx(ze,{ref:s}),e.jsx(ut,{ref:l})]})}mt.propTypes={mode:u.oneOf(["member","master"])};function ht({ref:r=null}){const{t:s}=L.useContext(le),{api:l}=K(),{blocklet:i}=J(),n=i?.appPid,d=Le()?.transitions?.duration?.leavingScreen||300,c=be({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:B}),f=g(()=>{c.appUrl="",c.appUrlError="",c.callback=B}),p=g(()=>{c.show=!1,setTimeout(()=>{f()},d)}),y=g((b=B)=>{c.show=!0,c.callback=b});L.useImperativeHandle(r,()=>({open:y,close:p}),[y,p]);const w=g(b=>{if(!b)throw new Error(s("federated.federatedJoinAppUrlRequired"));if(!Yt(b))throw new Error(s("federated.federatedJoinAppUrlInvalid"))}),h=g(async()=>{try{w(c.appUrl),c.loading=!0;const b=await l.joinFederatedLogin({input:{did:n,appUrl:c.appUrl}});c.show=!1,p(),c?.callback(b)}catch(b){c.appUrlError=b.message}finally{c.loading=!1}});return e.jsxs(we,{open:c.show,title:s("federated.joinFederatedLogin"),onClose:p,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(M,{color:"primary",autoFocus:!0,variant:"contained",onClick:h,disabled:c.loading,children:[c.loading?e.jsx(Be,{size:16,sx:{mr:1},color:"grey"}):null,s("common.confirm")]}),children:[e.jsx(m,{sx:{mb:1},children:s("federated.joinFederatedLoginDescription")}),e.jsx(q,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:s("federated.federatedJoinAppUrl"),label:s("federated.federatedJoinAppUrl"),value:c.appUrl,error:!!c.appUrlError,helperText:c.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{c.appUrl=b.target.value}})]})}ht.propTypes={ref:u.any};function gn(){const{t:r}=L.useContext(le);return e.jsxs(_,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(qt,{fontSize:"large",color:"primary"}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",gutterBottom:!0,children:r("federated.title")}),e.jsx(te,{variant:"body2",sx:{color:"text.secondary"},children:r("federated.description")}),e.jsx(Bt,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:r("federated.link")})]})]})}function fn(){const r=L.useRef(null),s=L.useRef(null),{t:l}=L.useContext(le),{blocklet:i,actions:{refreshBlocklet:n}}=J(),t=g(()=>{const c=i.site?.domainAliases?.[0]?.href;if(c)try{const f=new URL(c);r.current?.open({link:f.origin})}catch{P.error(l("federated.failedToGetFederatedLoginLink"))}},[i.site?.domainAliases?.[0]?.href]),d=g(()=>{s.current?.open(()=>{n()})});if(i.settings.federated?.sites.length>0){const c=i.settings.federated?.config.isMaster!==!1;return e.jsx(mt,{mode:c?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(m,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(gn,{}),e.jsx(he,{sx:{width:1}}),e.jsxs(_,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(M,{variant:"contained",onClick:t,sx:{width:1},children:l("federated.inviteJoinFederatedLogin")}),e.jsx(M,{variant:"outlined",onClick:d,sx:{width:1},children:l("federated.joinFederatedLogin")})]})]})}),e.jsx(ze,{ref:r}),e.jsx(ht,{ref:s})]})}const Ue={login:{en:{title:"Login",scan:"Login with one of the following methods",confirm:"Confirm connection in your DID Wallet",success:"Successfully logged in"},zh:{title:"登录",scan:"请使用下面的方式完成登录",confirm:"在 DID Wallet 中确认连接",success:"登录成功"}},"switch-profile":{en:{title:"Switch Profile",scan:"Use DID Wallet to switch profile",confirm:"Select profile in your DID Wallet",success:"Profile updated"},zh:{title:"切换个人信息",scan:"请使用 DID Wallet 来切换个人信息",confirm:"在 DID Wallet 中选择个人信息",success:"个人信息已经更新"}},"switch-passport":{en:{title:"Switch Passport",scan:"Use DID Wallet to switch passport",confirm:"Select passport in your DID Wallet",success:"Passport and session updated"},zh:{title:"切换通行证",scan:"请使用 DID Wallet 来切换通行证",confirm:"在 DID Wallet 中选择通行证",success:"通行证和会话已经更新"}}},xn={en:{title:"",scan:"",confirm:"",success:""},zh:{title:"",scan:"",confirm:"",success:""}},xe="new-action",pt=Object.keys(Ue),gt=["zh","en"],ft=r=>/^[a-z][a-z-]*$/.test(r),jn=r=>{const s=[];return r.includes("zh")&&s.push("zh"),r.includes("en")&&s.push("en"),r.filter(l=>!gt.includes(l)).forEach(l=>s.push(l)),s},xt=r=>{const s=We.baseLanguages.find(l=>l.code===r);return s?s.name:r};function jt({value:r="",onChange:s=()=>{},onBlur:l=()=>{},onKeyDown:i=()=>{},isDuplicate:n=!1}){const{t}=$(),d=r&&!ft(r);let c="";return d?c=t("authentication.didConnect.actionNameError"):n&&(c=t("authentication.didConnect.actionNameDuplicate")),e.jsx(q,{value:r,onChange:s,onBlur:l,onKeyDown:i,onClick:f=>f.stopPropagation(),size:"small",variant:"standard",autoFocus:!0,placeholder:"action-name",helperText:c,error:d||n,sx:{"& .MuiInputBase-input":{py:0,fontSize:14,fontWeight:500}}})}jt.propTypes={value:u.string,onChange:u.func,onBlur:u.func,onKeyDown:u.func,isDuplicate:u.bool};function bt({langCode:r,isSelected:s=!1,canDelete:l=!1,onSelect:i=()=>{},onDelete:n=()=>{}}){return e.jsx(Ge,{label:xt(r),onClick:i,onDelete:l?n:void 0,size:"small",sx:{bgcolor:s?"primary.main":"grey.100",color:s?"primary.contrastText":"text.primary","&:hover":{bgcolor:s?"primary.dark":"grey.200"},"& .MuiChip-deleteIcon":{color:s?"primary.contrastText":"text.secondary","&:hover":{color:s?"primary.contrastText":"error.main"}}}})}bt.propTypes={langCode:u.string.isRequired,isSelected:u.bool,canDelete:u.bool,onSelect:u.func,onDelete:u.func};function vt({actionKey:r,actionData:s={},expanded:l=!1,selectedLang:i="",editing:n={},onChange:t={}}){const{t:d}=$(),c=!pt.includes(r),f=jn(Object.keys(s)),p=s[i]||{},y=n?.actionKey===r,w=n?.name&&n.name!==r&&n.allActions?.[n.name];return e.jsxs(Rt,{expanded:l,onChange:(h,b)=>t.accordion(b),elevation:0,sx:{border:"1px solid",borderColor:"grey.200",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{margin:0}},children:[e.jsxs(Wt,{expandIcon:e.jsx(Nt,{}),sx:{minHeight:48,"& .MuiAccordionSummary-content":{alignItems:"center",gap:1}},children:[y?e.jsx(jt,{value:n.name,onChange:t.editingName,onBlur:t.finishEditing,onKeyDown:t.editingKeyDown,isDuplicate:w}):e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,"&:hover .edit-icon":{opacity:1}},children:[e.jsx(te,{sx:{fontWeight:500},children:r}),c&&e.jsx(pe,{className:"edit-icon",size:"small",onClick:t.startEditing,sx:{p:.25,opacity:0,transition:"opacity 0.2s",color:"text.secondary","&:hover":{color:"primary.main",bgcolor:"transparent"}},children:e.jsx(zt,{sx:{fontSize:16}})})]}),c&&e.jsx(pe,{size:"small",onClick:t.delete,sx:{ml:"auto",mr:1,p:.5,color:"error.main","&:hover":{bgcolor:"error.lighter"}},children:e.jsx(Ut,{sx:{fontSize:20}})})]}),e.jsxs(_t,{sx:{pt:0},children:[e.jsxs(m,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1,mb:2},children:[e.jsx(te,{variant:"body2",color:"text.secondary",sx:{flexShrink:0},children:"Languages:"}),f.map(h=>e.jsx(bt,{langCode:h,isSelected:i===h,canDelete:!gt.includes(h),onSelect:()=>t.language(h),onDelete:b=>t.deleteLanguage(h,b)},h)),e.jsx(Ge,{label:`${d("common.add")}`,onClick:t.addLanguage,size:"small",variant:"outlined",icon:e.jsx(qe,{sx:{fontSize:16}}),sx:{borderStyle:"dashed","&:hover":{bgcolor:"action.hover"}}})]}),e.jsxs(_,{spacing:2,children:[e.jsx(q,{label:"Title",value:p.title||"",onChange:h=>t.field("title",h.target.value),fullWidth:!0,size:"small"}),e.jsx(q,{label:"Scan",value:p.scan||"",onChange:h=>t.field("scan",h.target.value),fullWidth:!0,size:"small",multiline:!0,minRows:2})]})]})]})}vt.propTypes={actionKey:u.string.isRequired,actionData:u.object,expanded:u.bool,selectedLang:u.string,editing:u.shape({actionKey:u.string,name:u.string,allActions:u.object}),onChange:u.shape({accordion:u.func,language:u.func,field:u.func,startEditing:u.func,editingName:u.func,finishEditing:u.func,editingKeyDown:u.func,delete:u.func,addLanguage:u.func,deleteLanguage:u.func})};function yt({open:r,onClose:s,existingLanguages:l,selectedLanguage:i,onLanguageChange:n,onAdd:t}){const{t:d}=$(),c=We.baseLanguages.filter(f=>!l.includes(f.code));return e.jsxs(Vt,{open:r,onClose:s,maxWidth:"xs",fullWidth:!0,children:[e.jsx(Ht,{children:d("authentication.didConnect.addLanguage")}),e.jsx(Mt,{children:e.jsx(V,{fullWidth:!0,sx:{mt:1},children:e.jsx($t,{value:i,onChange:f=>n(f.target.value),displayEmpty:!0,size:"small",renderValue:f=>f?xt(f):e.jsx(te,{color:"text.secondary",children:d("authentication.didConnect.selectLanguage")}),children:c.map(f=>e.jsx(Jt,{value:f.code,children:f.name},f.code))})})}),e.jsxs(Kt,{children:[e.jsx(X,{onClick:s,children:d("common.cancel")}),e.jsx(X,{onClick:t,variant:"contained",disabled:!i,children:d("common.add")})]})]})}yt.propTypes={open:u.bool.isRequired,onClose:u.func.isRequired,existingLanguages:u.array.isRequired,selectedLanguage:u.string.isRequired,onLanguageChange:u.func.isRequired,onAdd:u.func.isRequired};function kt({open:r=!1,onClose:s=()=>{},onSave:l=()=>{},initialConfig:i=null}){const{t:n,locale:t}=$(),[d,c]=L.useState({}),[f,p]=L.useState("login"),[y,w]=L.useState({}),[h,b]=L.useState(!1),[x,D]=L.useState(""),[S,T]=L.useState(""),[v,j]=L.useState(null),[a,o]=L.useState(""),I=t||"en";L.useEffect(()=>{if(!r)return;const k=i||Ue;c(k);const F=Object.keys(k);p(F[0]||"login");const z={};F.forEach(G=>{const U=Object.keys(k[G]||{});z[G]=U.includes(I)?I:U[0]||"en"}),w(z),j(null)},[r,i,I]);const W=g(k=>k?Object.values(k).every(F=>!F?.title?.trim()&&!F?.scan?.trim()):!0),ve=g(()=>!Object.keys(d).some(F=>!pt.includes(F)&&W(d[F]))&&!d[xe]);g(()=>{ve()&&(c(k=>({...k,[xe]:xn})),p(xe),w(k=>({...k,[xe]:I})),j(xe),o(xe))});const fe=g(k=>{const{value:F}=k.target;(F===""||/^[a-z-]*$/.test(F))&&o(F)}),oe=g(()=>{const k=a.trim();if(!k||!ft(k)||k!==v&&d[k]){j(null);return}if(k!==v){const F={};Object.keys(d).forEach(z=>{F[z===v?k:z]=d[z]}),c(F),f===v&&p(k),y[v]&&w(z=>{const G={...z,[k]:z[v]};return delete G[v],G})}j(null)}),E=g(k=>{k.key==="Enter"?oe():k.key==="Escape"&&j(null)}),R=g((k,F)=>{F.stopPropagation();const z={...d};delete z[k],c(z),f===k&&p(Object.keys(z)[0]||!1)}),O=g(()=>{!S||!x||(c(k=>({...k,[x]:{...k[x],[S]:{title:"",scan:"",confirm:"",success:""}}})),w(k=>({...k,[x]:S})),b(!1))}),ce=g((k,F,z)=>{z.stopPropagation();const G=d[k];if(Object.keys(G||{}).length<=1)return;const ee={...G};delete ee[F],c(de=>({...de,[k]:ee})),y[k]===F&&w(de=>({...de,[k]:Object.keys(ee)[0]||"en"}))}),H=g(()=>{l(JSON.stringify(d)),s()});ve();const wt=e.jsxs(e.Fragment,{children:[e.jsx(X,{onClick:s,variant:"outlined",children:n("common.cancel")}),e.jsx(X,{onClick:H,variant:"contained",startIcon:e.jsx(Gt,{}),children:n("common.confirm")})]});return e.jsxs(we,{open:r,onClose:s,maxWidth:"md",fullWidth:!0,title:n("authentication.didConnect.configDialogTitle"),actions:wt,children:[e.jsxs(_,{spacing:1.5,children:[Object.keys(d).map(k=>{const F=d[k]||{},z=Object.keys(F),G=y[k]||z[0]||"en";return e.jsx(vt,{actionKey:k,actionData:F,expanded:f===k,selectedLang:G,editing:{actionKey:v,name:a,allActions:d},onChange:{accordion:U=>p(U?k:!1),language:U=>w(ee=>({...ee,[k]:U})),field:(U,ee)=>c(de=>({...de,[k]:{...de[k],[G]:{...de[k]?.[G],[U]:ee}}})),startEditing:U=>{U.stopPropagation(),j(k),o(k)},editingName:fe,finishEditing:oe,editingKeyDown:E,delete:U=>R(k,U),addLanguage:U=>{U.stopPropagation(),D(k),T(""),b(!0)},deleteLanguage:(U,ee)=>ce(k,U,ee)}},k)}),!1]}),e.jsx(yt,{open:h,onClose:()=>b(!1),existingLanguages:Object.keys(d[x]||{}),selectedLanguage:S,onLanguageChange:T,onAdd:O})]})}kt.propTypes={open:u.bool,onClose:u.func,onSave:u.func,initialConfig:u.object};const Se={showDidColor:!0,showAppInfo:!0};function Me(r){return e.jsx(et,{...r,sx:{transform:"scale(0.75)"}})}function bn(){const{api:r}=K(),{blocklet:s}=J(),l=s?.meta?.did,{control:i,reset:n}=ie({defaultValues:Xe({},Se,s?.settings?.didConnect||{})}),t=se(()=>{const b=s?.settings?.actionConfig;return b&&!Ye(b)?b:Ue},[s?.settings?.actionConfig]),{t:d}=$(),[c,f]=L.useState(!1),p=g(async(b,x)=>{try{const D={showDidColor:i._defaultValues?.showDidColor??Se.showDidColor,showAppInfo:i._defaultValues?.showAppInfo??Se.showAppInfo};D[b]=x;const{blocklet:S}=await r.configDidConnect({input:{did:l,didConnect:JSON.stringify(D)}}),T=Object.assign({},Se,S?.settings?.didConnect||{});n(T),P.success(d("common.configSuccess"))}catch(D){P.error(D.message),n(i._defaultValues)}}),y=g(()=>{f(!1)}),w=g(()=>{f(!0)}),h=g(async b=>{try{await r.configDidConnectActions({input:{did:l,actionConfig:b}}),P.success(d("common.configSuccess"))}catch(x){console.error(x),P.error(x.message)}});return e.jsxs(vn,{children:[e.jsxs(_,{direction:"column",sx:{gap:4},children:[e.jsxs(m,{children:[e.jsx(m,{children:d("authentication.didConnect.basicSettings")}),e.jsx(he,{sx:{my:2}}),e.jsxs(_,{sx:{gap:2},children:[e.jsx(C,{title:d("authentication.didConnect.showDidColor"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"showDidColor",control:i,render:({field:b})=>e.jsx(Me,{...b,checked:b.value,onChange:x=>{p("showDidColor",x.target.checked),b.onChange(x)}})})})}),e.jsx(C,{title:d("authentication.didConnect.showAppInfo"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"showAppInfo",control:i,render:({field:b})=>e.jsx(Me,{...b,checked:b.value,onChange:x=>{p("showAppInfo",x.target.checked),b.onChange(x)}})})})})]})]}),e.jsxs(m,{children:[e.jsx(m,{children:d("authentication.didConnect.customSettings")}),e.jsx(he,{sx:{my:2}}),e.jsx(_,{direction:"row",sx:{gap:2},children:e.jsx(X,{variant:"outlined",onClick:w,children:d("authentication.didConnect.configDialogTitle")})})]})]}),e.jsx(kt,{open:c,onClose:y,onSave:h,initialConfig:t})]})}const vn=$e.div`
42
- max-width: 1536px;
43
-
44
- .advanced-config {
45
- border: 0;
46
- padding: 0;
47
- }
48
-
49
- .config-form {
50
- flex-grow: 1;
51
- overflow-y: auto;
52
- will-change: transform;
53
-
54
- &:first-child {
55
- margin: 0;
56
- }
57
-
58
- ${r=>r.theme.breakpoints.down("md")} {
59
- width: 100%;
60
- flex-shrink: 0;
61
- padding: 0 24px;
62
- transform: translate(0, 0);
63
- }
64
- }
65
-
66
- .config-item {
67
- display: flex;
68
- align-items: center;
69
- justify-content: space-between;
70
- }
71
-
72
- .config-desc {
73
- font-weight: normal;
74
- font-size: 12px;
75
- color: #666;
76
- }
77
-
78
- .form-item {
79
- margin-top: 0;
80
- }
81
- `;function ye({label:r}){return e.jsx(m,{sx:{textAlign:"center",width:"100%"},children:r})}ye.propTypes={label:u.any.isRequired};function yn({orientation:r="horizontal"}){const{t:s}=L.useContext(le),l=rn({key:"lg"}),i=[{label:e.jsx(ye,{label:s("authentication.didConnectSettings")}),value:"didConnect"},{label:e.jsx(ye,{label:s("authentication.loginProviders")}),value:"loginProviders"},{label:e.jsx(ye,{label:s("authentication.federated")}),value:"federated"},{label:e.jsx(ye,{label:s("authentication.sessionSettings")}),value:"session"}],[n,t]=L.useState(i[0].value),d=se(()=>({didConnect:e.jsx(bn,{}),loginProviders:e.jsx(cn,{}),federated:e.jsx(fn,{}),session:e.jsx(dn,{})}),[s]);return r==="vertical"?e.jsx(m,{sx:{".MuiTab-root":{textAlign:"left",alignItems:"flex-start",fontWeight:"normal",div:{textAlign:"left"}},".Mui-selected":{fontWeight:"bold"}},children:e.jsxs(_,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(m,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ne,{tabs:i,current:n,orientation:l?"horizontal":"vertical",onChange:t,sx:{borderRight:l?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(m,{sx:{flexGrow:1,minWidth:0},children:e.jsx(m,{sx:{maxWidth:"1200px"},children:d[n]})})]})}):e.jsxs(m,{children:[e.jsx(Ne,{tabs:i,current:n,onChange:t}),e.jsx(m,{sx:{marginTop:"10px"},children:d[n]})]})}yn.propTypes={orientation:u.oneOf(["horizontal","vertical"])};export{yn as default};
@@ -1 +0,0 @@
1
- import{h as o}from"./index-BEfIUbZC.js";const e=o();export{e as b};