@abtnode/blocklet-services 1.16.44 → 1.16.45-beta-20250609-082716-b6b0592b
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/api/cache.js +122 -138
- package/api/index.js +6 -9
- package/api/libs/email.js +1 -1
- package/api/libs/jwt.js +1 -1
- package/api/routes/dns-resolver.js +11 -10
- package/api/services/auth/session.js +6 -2
- package/api/util/attach-shared-utils.js +15 -21
- package/dist/assets/{AdapterDayjs-eMGLd9qK.js → AdapterDayjs-BXVfASrK.js} +1 -1
- package/dist/assets/{ArrowDropDown-QAD1r6CI.js → ArrowDropDown-Ce8TY3aP.js} +1 -1
- package/dist/assets/{CheckCircle-DKl6wFCW.js → CheckCircle-M9NlpTm_.js} +1 -1
- package/dist/assets/{ChevronLeft-BTvoFtZ-.js → ChevronLeft-02OWcWpH.js} +1 -1
- package/dist/assets/{ChevronRight-CB-tzzK0.js → ChevronRight-CB8w0u2n.js} +1 -1
- package/dist/assets/{DeleteOutline-D--wbiEJ.js → DeleteOutline-1-hBNY1U.js} +1 -1
- package/dist/assets/{Done-D5w4g3Ux.js → Done-CcJLRcBY.js} +1 -1
- package/dist/assets/{Download-CSPVh6pQ.js → Download-HHknpEZd.js} +1 -1
- package/dist/assets/{Edit-Dp6PSucO.js → Edit-hd-cDU5C.js} +1 -1
- package/dist/assets/{Error-7F2F0yXi.js → Error-D0rGqAKE.js} +1 -1
- package/dist/assets/{ExpandLess-BiXZAaWu.js → ExpandLess-Fb-uW6u_.js} +1 -1
- package/dist/assets/{Google-B-pSveIB.js → Google-WGwK551e.js} +1 -1
- package/dist/assets/{Home-BxZHmRym.js → Home-DeTVRhMG.js} +1 -1
- package/dist/assets/{InfoOutlined-Bpx0eOkP.js → InfoOutlined-CLiL5VeK.js} +1 -1
- package/dist/assets/{Launch-akp2B3sE.js → Launch-BwVeOcBz.js} +1 -1
- package/dist/assets/{LaunchOutlined-BorUV5ev.js → LaunchOutlined-CPurmWuM.js} +1 -1
- package/dist/assets/{MoreHoriz-B0f55Tf5.js → MoreHoriz-9E3q8aHi.js} +1 -1
- package/dist/assets/{PlayArrow-RuC30CX1.js → PlayArrow-B_ZNrQDa.js} +1 -1
- package/dist/assets/{TuneOutlined-D5FWo3d6.js → TuneOutlined-0oMZE8a4.js} +1 -1
- package/dist/assets/{ViewList-BqZC98em.js → ViewList-ColSGL1_.js} +1 -1
- package/dist/assets/{access-control-f_Q0xNEr.js → access-control-Bu9cwoFT.js} +1 -1
- package/dist/assets/{actions-DBL5WgL-.js → actions-DtL6bYnA.js} +1 -1
- package/dist/assets/{add-component-core-lxVDVv-g.js → add-component-core-CsW-bf6w.js} +1 -1
- package/dist/assets/{add-resource-DHuVcGqm.js → add-resource-D1GK1xW7.js} +1 -1
- package/dist/assets/{addon-DPZv8EDi.js → addon-e-JO0VU3.js} +1 -1
- package/dist/assets/advanced-BSxn1YDX.js +14 -0
- package/dist/assets/api-CQoRx33p.js +1 -0
- package/dist/assets/{appearance-CjjdXxDr.js → appearance-rcoe4DP4.js} +1 -1
- package/dist/assets/{audit-logs-9UAh1pea.js → audit-logs-XAopC8XN.js} +1 -1
- package/dist/assets/{authorize-f7rwXyK0.js → authorize-DNwNxF9-.js} +1 -1
- package/dist/assets/{base-chart-C6ehpmPk.js → base-chart-BYonGucU.js} +1 -1
- package/dist/assets/{base32-BwYE-4Kz.js → base32-CmYq1ikq.js} +1 -1
- package/dist/assets/{branding-DgYdp8Fj.js → branding-DpIlP_xM.js} +1 -1
- package/dist/assets/{branding-DyNgn-Bl.js → branding-moJCZl3a.js} +2 -2
- package/dist/assets/{bundle-avatar-eYIyRJCN.js → bundle-avatar-D28BGkcC.js} +1 -1
- package/dist/assets/{button-BJsVm63u.js → button-C0Vra3Ak.js} +1 -1
- package/dist/assets/{click-to-copy-BBibsDSl.js → click-to-copy-BUVqg1RQ.js} +1 -1
- package/dist/assets/{cloneDeep-IATUBtZS.js → cloneDeep-ro06l5HL.js} +1 -1
- package/dist/assets/{collapse-C0MB7y7w.js → collapse--nd2JDBL.js} +1 -1
- package/dist/assets/{complete-x6sLfw6B.js → complete-C6_ojDUa.js} +1 -1
- package/dist/assets/{component-B-zaossI.js → component-OYgpJSh4.js} +1 -1
- package/dist/assets/{config-BedCVCOB.js → config-C_hb7xhJ.js} +1 -1
- package/dist/assets/{config-kZ6x7NWW.js → config-QpBBpp7d.js} +1 -1
- package/dist/assets/{config-navigation-DWYn0QbT.js → config-navigation-VPQM3i1K.js} +3 -3
- package/dist/assets/{config-space-BKyIMqyn.js → config-space-CBoUabjP.js} +1 -1
- package/dist/assets/{confirm-W9aiB3ZK.js → confirm-BjCmRSAF.js} +1 -1
- package/dist/assets/{connect-BDcfioWR.js → connect-B6S3YIgF.js} +1 -1
- package/dist/assets/{connect-7xjSPaIL.js → connect-CQ-AWW94.js} +1 -1
- package/dist/assets/{connect-to-CjAmbMcq.js → connect-to-kM9lCXLX.js} +1 -1
- package/dist/assets/{dashboard-DTpUsE7s.js → dashboard-B7qE-Md0.js} +3 -3
- package/dist/assets/{delete-confirm-CR9GWuZW.js → delete-confirm-Dow_C0jR.js} +1 -1
- package/dist/assets/{did-address-C3GRjuMv.js → did-address-bJAfhuZx.js} +1 -1
- package/dist/assets/{domain-C5GTtUcW.js → domain-B8NapX5o.js} +1 -1
- package/dist/assets/{domain-action-card-DZFY_-cJ.js → domain-action-card-CCtkcxNz.js} +1 -1
- package/dist/assets/domains-DzI4bWdK.js +1 -0
- package/dist/assets/{dot-DGdAPqTT.js → dot-BID2dzD_.js} +1 -1
- package/dist/assets/{email-0L0UoCI5.js → email-DDPCqu4Z.js} +1 -1
- package/dist/assets/{exchange-passport-Cz76Mvqo.js → exchange-passport-xdsOlfWE.js} +1 -1
- package/dist/assets/{fuel-H0bbfYDc.js → fuel-D1fw-gpI.js} +1 -1
- package/dist/assets/{gen-access-key-CVMgx_Do.js → gen-access-key-R0_DUG_D.js} +1 -1
- package/dist/assets/{get-safe-url-CISc2x16.js → get-safe-url-BWDUV79Q.js} +1 -1
- package/dist/assets/{get-safe-url-DvHrYSqa.js → get-safe-url-CwT4-jkw.js} +1 -1
- package/dist/assets/{home-frxjPVWF.js → home-D1kBU1RC.js} +1 -1
- package/dist/assets/{iframe-BiCAYvW4.js → iframe-DsIqy16E.js} +1 -1
- package/dist/assets/{index-C0jIKgVd.js → index-At5NExT-.js} +1 -1
- package/dist/assets/{index-CsOtcFM5.js → index-B-K0Nvyz.js} +1 -1
- package/dist/assets/{index-BFxPxs1o.js → index-B4FABIlz.js} +1 -1
- package/dist/assets/{index-C9xycxde.js → index-BBuUqC0B.js} +1 -1
- package/dist/assets/{index-Bp39ibX1.js → index-BDw54V1q.js} +1 -1
- package/dist/assets/{index-CTJ98R3F.js → index-BSiKOdsD.js} +1 -1
- package/dist/assets/{index-CmGpTnGy.js → index-BY-e9TG4.js} +1 -1
- package/dist/assets/{index-Dsf-Dx7V.js → index-BnR8uU0R.js} +1 -1
- package/dist/assets/{index-DZ-_hefE.js → index-BpvW-cUy.js} +1 -1
- package/dist/assets/{index-NqsjhbFu.js → index-Brd3-BIC.js} +1 -1
- package/dist/assets/{index-CXZIC-uq.js → index-By1VEzOz.js} +1 -1
- package/dist/assets/{index-D2TrKFIL.js → index-CCrgDhTM.js} +1 -1
- package/dist/assets/{index-BPMh7nrj.js → index-CZgWTJXl.js} +1 -1
- package/dist/assets/{index-Rx6rf5TL.js → index-DQjZ74P0.js} +43 -43
- package/dist/assets/{index-DVfId0OB.js → index-DVLOAsDQ.js} +1 -1
- package/dist/assets/{index-CNP49TJ1.js → index-DWZfwLDs.js} +1 -1
- package/dist/assets/{index-DtuVp5SU.js → index-DnDFazyx.js} +3 -3
- package/dist/assets/{index-KHBjePpP.js → index-Dntq1ezd.js} +1 -1
- package/dist/assets/{index-Ch5CE_Xo.js → index-Drni9chH.js} +1 -1
- package/dist/assets/{index-B778V4Al.js → index-Hs7lhrID.js} +4 -4
- package/dist/assets/{index-CqQ_qPcW.js → index-NE1bWD-Q.js} +1 -1
- package/dist/assets/{invitation-BrPENaxX.js → invitation-Sx6eoeir.js} +1 -1
- package/dist/assets/{invite-B0YEiWAC.js → invite-CZ68j_lY.js} +1 -1
- package/dist/assets/{issue-passport-Dz3BWjAa.js → issue-passport-IkLenFGe.js} +1 -1
- package/dist/assets/{item-CALJuG3t.js → item-RUDvbSOI.js} +1 -1
- package/dist/assets/{layout-BpG5xw8B.js → layout-BCvTd67o.js} +1 -1
- package/dist/assets/{list-DyU1G1ER.js → list-BeFxJZxl.js} +1 -1
- package/dist/assets/{list-BZl1XCaf.js → list-DjvUHEwY.js} +2 -2
- package/dist/assets/localization-BNjdHo-G.js +1 -0
- package/dist/assets/{log-CTKJhZ_E.js → log-BGQO-I2s.js} +1 -1
- package/dist/assets/{logger-DAjuoBTQ.js → logger-KwxABgLK.js} +1 -1
- package/dist/assets/{login-Cg8geEoU.js → login-BF0iOJJn.js} +1 -1
- package/dist/assets/{login-oauth-callback-HckguQey.js → login-oauth-callback-Dt9V4GRH.js} +1 -1
- package/dist/assets/{logo-uploader-oD7wBJlZ.js → logo-uploader-BecsVnr8.js} +3 -3
- package/dist/assets/{lost-passport-BxZlOTiO.js → lost-passport-CaF7MO2m.js} +1 -1
- package/dist/assets/{omit-CsI4VeYr.js → omit-O1pUD7ku.js} +1 -1
- package/dist/assets/{open-window-Ct0k45Ir.js → open-window-Dn44K3ur.js} +1 -1
- package/dist/assets/overview-DwmambxV.js +85 -0
- package/dist/assets/{page-header-CVBmdH9B.js → page-header-JH9JWGMg.js} +1 -1
- package/dist/assets/{passport-item-D1UYvMW_.js → passport-item-DEX2NwJD.js} +1 -1
- package/dist/assets/{permission-CMjo9z-z.js → permission-B7ZHEOJv.js} +1 -1
- package/dist/assets/{preferences-Dtk7H5V2.js → preferences-DUSp_pAb.js} +1 -1
- package/dist/assets/{profile-embed-yHOg7opg.js → profile-embed-BIjwkrGW.js} +1 -1
- package/dist/assets/publish-resource-Bk548CMo.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CaWQHB2l.js → react-beautiful-dnd.esm-DCPrD7-r.js} +1 -1
- package/dist/assets/{runtime-BGMX9PTT.js → runtime-xdMFSsvP.js} +1 -1
- package/dist/assets/{sanitize-qIr4ImjO.js → sanitize-DbZs1H_T.js} +1 -1
- package/dist/assets/sdk-BJQcHaGO.js +1 -0
- package/dist/assets/{security-DDqACA_P.js → security-DCYPNDg3.js} +1 -1
- package/dist/assets/{session-N9ogZkBO.js → session-1k8BRnYA.js} +1 -1
- package/dist/assets/{setup--FMKBbd7.js → setup-CQ7O7nI0.js} +3 -3
- package/dist/assets/{spaces-ClWdZraZ.js → spaces-CpSu6mVL.js} +1 -1
- package/dist/assets/{start-D7GkMfm4.js → start-t5ebRJzD.js} +1 -1
- package/dist/assets/{starting-progress-COPiu29g.js → starting-progress-a7uoLG-L.js} +1 -1
- package/dist/assets/{status-D5ypXFOB.js → status-C4-MBX3k.js} +1 -1
- package/dist/assets/{step-actions-X0m-Hu2A.js → step-actions-Brohu3S-.js} +1 -1
- package/dist/assets/{studio-LXKuDXYf.js → studio-Cua13-ul.js} +1 -1
- package/dist/assets/{switch-control-ByXecLFy.js → switch-control-CzaI2YNK.js} +1 -1
- package/dist/assets/{table-tips-CbVGFubR.js → table-tips-Czrj7r52.js} +1 -1
- package/dist/assets/{traffic-GgX3Erg7.js → traffic-BI_ofO44.js} +1 -1
- package/dist/assets/{transfer-Dq6dS0l-.js → transfer-SwfyIGYE.js} +1 -1
- package/dist/assets/{unsubscribe-BZAVKPXL.js → unsubscribe-DFPfNrme.js} +1 -1
- package/dist/assets/{use-blocklet-logo-CmMzePwG.js → use-blocklet-logo-6YMz11ob.js} +1 -1
- package/dist/assets/use-server-logo-BbYHFDuK.js +1 -1
- package/dist/assets/{useAsync-QkUcWOv0.js → useAsync-B6ZHbOEG.js} +1 -1
- package/dist/assets/{useLocalStorage-COrhSWV-.js → useLocalStorage-BF3BqN1O.js} +1 -1
- package/dist/assets/{user-center-DVO5FZd_.js → user-center-BjGMsOGg.js} +3 -3
- package/dist/assets/{util-DZiavuQJ.js → util-BBMAZSVn.js} +1 -1
- package/dist/assets/{util-Ayf5_DBX.js → util-CS4PqVkK.js} +1 -1
- package/dist/assets/{vendor-arcblock-CATQui2x.js → vendor-arcblock-B4hgrXYM.js} +74 -74
- package/dist/assets/{vendor-hooks-TMGmpw5W.js → vendor-hooks-BCm626KH.js} +1 -1
- package/dist/assets/vendor-utils-B3iZkn2R.js +208 -0
- package/dist/assets/vendor-ux-did-connect-CX7qG3_M.js +2305 -0
- package/dist/assets/{wrap-locale-BD27EgAf.js → wrap-locale-378mdIBS.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/service-worker.js +1 -1
- package/package.json +45 -45
- package/dist/assets/advanced-iHTV3yj0.js +0 -14
- package/dist/assets/api-DB7tZ-Xo.js +0 -1
- package/dist/assets/domains-BjYCkCPj.js +0 -1
- package/dist/assets/localization-BpRT0W0W.js +0 -1
- package/dist/assets/overview-B_ZqHpwj.js +0 -85
- package/dist/assets/publish-resource-H3WaTgcl.js +0 -1
- package/dist/assets/sdk-b4mKK9kW.js +0 -1
- package/dist/assets/vendor-utils-CxrPpJZS.js +0 -208
- package/dist/assets/vendor-ux-did-connect-Bh011lgb.js +0 -2305
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-Bh011lgb.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-TMGmpw5W.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-CATQui2x.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-CxrPpJZS.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-Rx6rf5TL.js";import{S as ce}from"./switch-control-ByXecLFy.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-Dsf-Dx7V.js";import{b as xt}from"./base32-BwYE-4Kz.js";import{u as ft}from"./use-mobile-CXU9YBvX.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={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 be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.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:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
|
|
1
|
+
import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-CX7qG3_M.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-BCm626KH.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-B4hgrXYM.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-B3iZkn2R.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-DQjZ74P0.js";import{S as ce}from"./switch-control-CzaI2YNK.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BnR8uU0R.js";import{b as xt}from"./base32-CmYq1ikq.js";import{u as ft}from"./use-mobile-CiFFAdJf.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={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 be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.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:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-D2t-u0YU.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,aa as n,as as g,T as z,O as U,bv as q,bt as W,bw as H,cG as N,y as O,ah as I,ai as B,ck as J,dy as X,dz as K,I as Y,dA as Q,e as Z,c0 as ee}from"./vendor-mui-core-wlbruq2I.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as E,f as re,i as ie,d as oe}from"./vendor-hooks-
|
|
2
|
+
import{j as e,aa as n,as as g,T as z,O as U,bv as q,bt as W,bw as H,cG as N,y as O,ah as I,ai as B,ck as J,dy as X,dz as K,I as Y,dA as Q,e as Z,c0 as ee}from"./vendor-mui-core-wlbruq2I.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as E,f as re,i as ie,d as oe}from"./vendor-hooks-BCm626KH.js";import{T as ae,bG as se,_}from"./vendor-ux-did-connect-CX7qG3_M.js";import{aP as ne}from"./vendor-utils-B3iZkn2R.js";import{getAIKitComponent as le}from"./index-DnDFazyx.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-B4hgrXYM.js";import"./index-BpvW-cUy.js";import"./index-DQjZ74P0.js";import"./index-DVQCgvFb.js";const F=b.createContext({}),D=()=>b.useContext(F);function de({children:t,restrictions:c,i18n:s,theme:o}){const[l,f]=te({loading:!1}),x=a=>f(j=>({...j,loading:a})),m=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:m,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],pe=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function ue({onSubmit:t}){const{loading:c,i18n:s}=D(),o=E({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(o));Object.values(o).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),x={width:"100%",pl:1,pr:1},m=o.model==="dall-e-2"?xe:ce;return e.jsxs(me,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:o.prompt??"",onChange:a=>{a.stopPropagation(),o.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:o.model,onChange:a=>{o.number=1,o.size="1024x1024",o.model=a.target.value},children:pe.map(a=>e.jsx(W,{value:a.value,control:e.jsx(H,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageSize")}: ${o.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...x,children:e.jsx(N,{size:"small",min:0,max:m.length-1,step:1,value:m.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=m[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(N,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:o.number,onChange:(a,j)=>{a.stopPropagation(),o.number=Number(j)}})})]})]})}),e.jsx(O,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const me=I(n)`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bp as Y,br as w,O as S,q as j,aa as v}from"./vendor-mui-core-wlbruq2I.js";import{y as s}from"./index-
|
|
1
|
+
import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bp as Y,br as w,O as S,q as j,aa as v}from"./vendor-mui-core-wlbruq2I.js";import{y as s}from"./index-DQjZ74P0.js";import{a as H}from"./vendor-ux-did-connect-CX7qG3_M.js";import{A as M}from"./vendor-arcblock-B4hgrXYM.js";import{b as _}from"./vendor-hooks-BCm626KH.js";import{L as A,D as y}from"./vendor-mui-x-BKgL6hAa.js";import{A as C}from"./AdapterDayjs-BXVfASrK.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const d=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:d,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,d]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(d(o),o==="custom"){const f=s().toDate();D(f),m(f)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(f=>s(f.value).isSame(i))||(d("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b7 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-wlbruq2I.js";import{bb as X,aV as $,d as H}from"./vendor-ux-did-connect-
|
|
1
|
+
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b7 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-wlbruq2I.js";import{bb as X,aV as $,d as H}from"./vendor-ux-did-connect-CX7qG3_M.js";import{d as G}from"./Done-CcJLRcBY.js";import{A as U,a as Y,d as J,b as Q}from"./collapse--nd2JDBL.js";import{C as Z}from"./Google-WGwK551e.js";import{ad as v,f as ee}from"./index-DQjZ74P0.js";import{R as ne,F as te,L as re}from"./logo-uploader-BecsVnr8.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";import{a9 as Ot,j as e,aa as E,bp as Fe,bs as $e,bo as We,q as je,T as Q,O as me,ab as ie,by as He,ak as oe,H as v,ah as z,e as Cn,ad as ue,w as jn,y as Nt,b8 as Sn,b9 as wn,I as Pn,bi as kn,bt as In,bS as Tn}from"./vendor-mui-core-wlbruq2I.js";import{B as St,e as ze,a0 as Dn,ay as An,n as wt,A as Rn,b as Ln}from"./vendor-utils-CxrPpJZS.js";import{r as _t,aR as Ut,bK as En,i as On,a as V,a2 as Nn,a1 as _n,a3 as Y,ar as se,B as W,f as Un,at as Bn,d as Fn,bb as fe,bB as $n,k as J,a5 as Bt,an as Wn,bs as Ft,bt as $t,bu as zn,I as Mn,ax as qn,$ as Me,bd as Hn,ac as Wt,ab as zt,bH as Vn}from"./vendor-ux-did-connect-Bh011lgb.js";import{c as X,a as Kn,G as Mt,v as Se,n as Zn,I as Yn}from"./vendor-arcblock-CATQui2x.js";import{d as Gn}from"./ViewList-BqZC98em.js";import{a2 as Qn,f as Jn,D as q,ay as we,n as pe,a3 as Xn,V as re,az as es,G as qt,aA as Ht,y as ts,b as ns,aB as ss}from"./index-Rx6rf5TL.js";import{k as rs,u as Ve,a as Ke,c as os,m as is,b as as}from"./vendor-hooks-TMGmpw5W.js";import{l as ls}from"./index-BPMh7nrj.js";import{u as K,d as Pt,W as Vt}from"./dashboard-DTpUsE7s.js";import{W as Ze}from"./did-address-C3GRjuMv.js";import{P as ee}from"./permission-CMjo9z-z.js";import{C as Te}from"./click-to-copy-BBibsDSl.js";import{T as Kt}from"./index-BFxPxs1o.js";import{f as te}from"./index-8eXqqyHQ.js";import{_ as cs}from"./useAsync-QkUcWOv0.js";import{I as M}from"./index-Dsf-Dx7V.js";import{d as ds}from"./DeleteOutline-D--wbiEJ.js";import{C as ge}from"./confirm-W9aiB3ZK.js";import{u as he}from"./session-N9ogZkBO.js";import{i as Zt,a as Pe,p as Yt}from"./util-Ayf5_DBX.js";import{b as ms}from"./sdk-b4mKK9kW.js";import{A as us}from"./actions-DBL5WgL-.js";import{S as ps}from"./shorten-label-CTSJhlwO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-COrhSWV-.js";import"./PlayArrow-RuC30CX1.js";import"./get-safe-url-DvHrYSqa.js";import"./use-blocklet-logo-CmMzePwG.js";import"./InfoOutlined-Bpx0eOkP.js";import"./dot-DGdAPqTT.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-eMGLd9qK.js";import"./base32-BwYE-4Kz.js";import"./MoreHoriz-B0f55Tf5.js";var Ye={},fs=Ot;Object.defineProperty(Ye,"__esModule",{value:!0});var Gt=Ye.default=void 0,gs=fs(_t()),hs=e;Gt=Ye.default=(0,gs.default)((0,hs.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ge=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ge.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="person";const xs=Ge;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var Ce={},ys=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Jt="%[a-f0-9]{2}",kt=new RegExp("("+Jt+")|([^%]+?)","gi"),It=new RegExp("("+Jt+")+","gi");function qe(t,o){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;o=o||1;var c=t.slice(0,o),u=t.slice(o);return Array.prototype.concat.call([],qe(c),qe(u))}function vs(t){try{return decodeURIComponent(t)}catch{for(var o=t.match(kt)||[],c=1;c<o.length;c++)t=qe(o,c).join(""),o=t.match(kt)||[];return t}}function bs(t){for(var o={"%FE%FF":"��","%FF%FE":"��"},c=It.exec(t);c;){try{o[c[0]]=decodeURIComponent(c[0])}catch{var u=vs(c[0]);u!==c[0]&&(o[c[0]]=u)}c=It.exec(t)}o["%C2"]="�";for(var d=Object.keys(o),h=0;h<d.length;h++){var S=d[h];t=t.replace(new RegExp(S,"g"),o[S])}return t}var Cs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return bs(t)}},js=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];const c=t.indexOf(o);return c===-1?[t]:[t.slice(0,c),t.slice(c+o.length)]},Ss=function(t,o){for(var c={},u=Object.keys(t),d=Array.isArray(o),h=0;h<u.length;h++){var S=u[h],p=t[S];(d?o.indexOf(S)!==-1:o(S,p,t))&&(c[S]=p)}return c};(function(t){const o=ys,c=Cs,u=js,d=Ss,h=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(l,r)=>{const x=l.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[",x,"]"].join("")]:[...l,[g(s,n),"[",g(x,n),"]=",g(r,n)].join("")]};case"bracket":return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[]"].join("")]:[...l,[g(s,n),"[]=",g(r,n)].join("")];case"comma":case"separator":return s=>(l,r)=>r==null||r.length===0?l:l.length===0?[[g(s,n),"=",g(r,n)].join("")]:[[l,g(r,n)].join(n.arrayFormatSeparator)];default:return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,g(s,n)]:[...l,[g(s,n),"=",g(r,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(l,r,x)=>{if(s=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!s){x[l]=r;return}x[l]===void 0&&(x[l]={}),x[l][s[1]]=r};case"bracket":return(l,r,x)=>{if(s=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!s){x[l]=r;return}if(x[l]===void 0){x[l]=[r];return}x[l]=[].concat(x[l],r)};case"comma":case"separator":return(l,r,x)=>{const y=typeof r=="string"&&r.includes(n.arrayFormatSeparator),w=typeof r=="string"&&!y&&i(r,n).includes(n.arrayFormatSeparator);r=w?i(r,n):r;const _=y||w?r.split(n.arrayFormatSeparator).map(F=>i(F,n)):r===null?r:i(r,n);x[l]=_};default:return(l,r,x)=>{if(x[l]===void 0){x[l]=r;return}x[l]=[].concat(x[l],r)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(n,s){return s.encode?s.strict?o(n):encodeURIComponent(n):n}function i(n,s){return s.decode?c(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,l)=>Number(s)-Number(l)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const l=n.indexOf("#");return l!==-1&&(s=n.slice(l)),s}function a(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function I(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const l=p(s),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(const x of n.split("&")){if(x==="")continue;let[y,w]=u(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:i(w,s),l(i(y,s),w,r)}for(const x of Object.keys(r)){const y=r[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=I(y[w],s);else r[x]=I(y,s)}return s.sort===!1?r:(s.sort===!0?Object.keys(r).sort():Object.keys(r).sort(s.sort)).reduce((x,y)=>{const w=r[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=a,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const l=w=>s.skipNull&&h(n[w])||s.skipEmptyString&&n[w]==="",r=S(s),x={};for(const w of Object.keys(n))l(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const _=n[w];return _===void 0?"":_===null?g(w,s):Array.isArray(_)?_.reduce(r(w),[]).join("&"):g(w,s)+"="+g(_,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[l,r]=u(n,"#");return Object.assign({url:l.split("?")[0]||"",query:m(a(n),s)},s&&s.parseFragmentIdentifier&&r?{fragmentIdentifier:i(r,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const l=C(n.url).split("?")[0]||"",r=t.extract(n.url),x=t.parse(r,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${g(n.fragmentIdentifier,s)}`),`${l}${w}${_}`},t.pick=(n,s,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:r,query:x,fragmentIdentifier:y}=t.parseUrl(n,l);return t.stringifyUrl({url:r,query:d(x,s),fragmentIdentifier:y},l)},t.exclude=(n,s,l)=>{const r=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,r,l)}})(Ce);const le=yn,ws={parseNumbers:!1,parseBooleans:!1},Ps={skipNull:!1,skipEmptyString:!1},ks=(t,o)=>{var c,u;const{navigateMode:d="push",parseOptions:h,stringifyOptions:S}={},p=Object.assign(Object.assign({},ws),h),b=Object.assign(Object.assign({},Ps),S),g=le.useLocation(),i=(c=le.useHistory)===null||c===void 0?void 0:c.call(le),T=(u=le.useNavigate)===null||u===void 0?void 0:u.call(le),C=rs(),k=P.useRef(typeof t=="function"?t():t||{}),a=P.useMemo(()=>Ce.parse(g.search,p),[g.search]),I=P.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[I,Ve(n=>{const s=typeof n=="function"?n(I):n;C(),i&&i[d]({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},g.state),T&&T({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},{replace:d==="replace",state:g.state})})]},Is=ks,Ts=Ut,_e=En,Ue=On,Ds=ls,Tt={role:Ts.types.RoleType.ROLE_APPLICATION},As=(t,o,c,u)=>{let d=c||Tt;const h=(0,Ue.isEthereumType)((0,Ue.DidType)(c));if(h?d=(0,_e.WalletType)(c):d=(0,_e.WalletType)(Tt),!(0,Ue.isValid)(t)){let S="";try{return h?S=t.slice(0,66):S=t,(0,_e.fromSecretKey)(S,d)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!o)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ds.fromAppDid)(t,o,d,u||0)};var Rs=As,Xt=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const ce=Xt(Qn),Ls=Ut,ve=Xt(Rs),Es=Jn,Os=(t,o,{returnWallet:c=!0}={})=>{var F,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,ce.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:d=[]}=t,h=[...d,...u],S=h.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=h.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=h.find(D=>D.key==="BLOCKLET_APP_URL"),g=h.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:T}=t.meta,C=(0,Es.getDisplayName)(t),k=(0,ce.default)(S,"value",t.meta.description),a=(0,ce.default)(p,"value","auto"),I=(0,ce.default)(b,"value",""),m=(0,ce.default)(g,"value","");if(!c)return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=h.find(D=>D.key==="BLOCKLET_APP_SK"),s=h.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),l=h.find(D=>D.key==="BLOCKLET_APP_PSK");let r;s&&(s.value==="ethereum"||s.value==="eth")&&(r=s.value);let x=null,y=null;if(n&&n.value)x=(0,ve.default)(n.value,void 0,r),l&&l.value&&l.value!==n.value&&(y=(0,ve.default)(l.value,void 0,r));else{if(!o||typeof o!="string")throw new Error("Node secret key must be a string");s?x=(0,ve.default)(t.meta.did,o,r):x=(0,ve.default)(t.meta.did,o)}const w=((R=(F=t.settings)==null?void 0:F.session)==null?void 0:R.salt)||"",_=Ls.Hasher.SHA3.hash256(St.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>St.from(D))));return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:_,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ns=Os;const _s=vn(Ns);function Je({teamDid:t,roles:o,apps:c,onCancel:u,onSuccess:d,onError:h,endpoint:S}){var I;const{api:p}=q(),{t:b,locale:g}=V(),i=Ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:c.length>0?c[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!i.role){i.error=b("team.member.error.passportEmpty");return}const m=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:m,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:l}=await p.createMemberInvitation({input:s});i.inviteInfo=l,i.activeStep=1}catch(n){const s=te(n);i.error=s,h(n)}finally{i.loading=!1}},C=o.find(m=>m.name===i.role),a=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[c.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx($e,{children:b("common.sourceApp")}),e.jsx(We,{value:i.sourceAppPid,onChange:m=>{i.error=null,i.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,children:c.map(m=>e.jsx(je,{value:m.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Nn,{did:m.appPid,size:28}),m.appName]}),e.jsx(_n,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx($e,{children:b("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:i.role,onChange:m=>{i.error=null,i.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:o.filter(m=>m.name!=="owner").map(m=>e.jsx(je,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Q,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Q,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((I=C==null?void 0:C.extra)==null?void 0:I.display)==="custom"&&e.jsx(me,{label:b("common.display"),type:"url",value:i.display,onChange:m=>{i.error=null,i.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(me,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:m=>{i.error=null,i.remark=m.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Kt,{value:i.passportExpireTime,onChange:m=>{i.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:T},{body:()=>{var n,s;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=i.inviteInfo)==null?void 0:s.expireDate,g)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});os(m),Y.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:u}][i.activeStep];return e.jsxs(se,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!i.error&&e.jsx(oe,{severity:"error",variant:"icon",children:i.error})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Je.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:o,onSuccess:c,onError:u,endpoint:d}){const{api:h,info:S}=q(),{api:p}=P.useContext(Un),[b,g]=P.useState(!1),{t:i,locale:T}=V(),[C,k]=P.useState(""),[a,I]=P.useState(!1),[m,n]=P.useState(0),[s,l]=P.useState(""),[r,x]=P.useState(""),y=!!ze(S,"ownerNft.did"),w=cs(async()=>{if(y){const{state:A}=await h.getDelegationState();return A}return{delegated:!0}});if(w.loading)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx(oe,{severity:"error",variant:"icon",children:te(w.error)})});const _=async()=>{k(null),g(!0);try{const{inviteInfo:A}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:r.trim()}});l(A),n(D.length-1)}catch(A){const H=te(A);k(H),u(A)}finally{g(!1)}},F=()=>{I(!0),n(1)},R=()=>{I(!1),n(0)},D=[{body:e.jsxs(Q,{component:"div",children:[e.jsxs(oe,{severity:"warning",children:[e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(oe,{severity:"warning",children:e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(me,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:r,onChange:A=>{k(null),x(A.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:o,onConfirm:y&&!ze(w,"value.delegated")?F:_},{body:()=>e.jsx(Bn,{action:"delegate-transfer-nft",open:a,locale:T,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Xn(S),extraParams:{targetDID:S.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const A=we({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Us,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:A})]})},confirm:i("common.confirm"),onConfirm:c}],O=D[m];return e.jsxs(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(W,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(W,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(ie,{size:16}),O.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(oe,{severity:"error",variant:"icon",children:C})]})}Xe.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Us=z.div`
|
|
1
|
+
import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";import{a9 as Ot,j as e,aa as E,bp as Fe,bs as $e,bo as We,q as je,T as Q,O as me,ab as ie,by as He,ak as oe,H as v,ah as z,e as Cn,ad as ue,w as jn,y as Nt,b8 as Sn,b9 as wn,I as Pn,bi as kn,bt as In,bS as Tn}from"./vendor-mui-core-wlbruq2I.js";import{B as St,e as ze,a0 as Dn,ay as An,n as wt,A as Rn,b as Ln}from"./vendor-utils-B3iZkn2R.js";import{r as _t,aR as Ut,bK as En,i as On,a as V,a2 as Nn,a1 as _n,a3 as Y,ar as se,B as W,f as Un,at as Bn,d as Fn,bb as fe,bB as $n,k as J,a5 as Bt,an as Wn,bs as Ft,bt as $t,bu as zn,I as Mn,ax as qn,$ as Me,bd as Hn,ac as Wt,ab as zt,bH as Vn}from"./vendor-ux-did-connect-CX7qG3_M.js";import{c as X,a as Kn,G as Mt,v as Se,n as Zn,I as Yn}from"./vendor-arcblock-B4hgrXYM.js";import{d as Gn}from"./ViewList-ColSGL1_.js";import{a2 as Qn,f as Jn,D as q,ay as we,n as pe,a3 as Xn,V as re,az as es,G as qt,aA as Ht,y as ts,b as ns,aB as ss}from"./index-DQjZ74P0.js";import{k as rs,u as Ve,a as Ke,c as os,m as is,b as as}from"./vendor-hooks-BCm626KH.js";import{l as ls}from"./index-CZgWTJXl.js";import{u as K,d as Pt,W as Vt}from"./dashboard-B7qE-Md0.js";import{W as Ze}from"./did-address-bJAfhuZx.js";import{P as ee}from"./permission-B7ZHEOJv.js";import{C as Te}from"./click-to-copy-BUVqg1RQ.js";import{T as Kt}from"./index-B4FABIlz.js";import{f as te}from"./index-8eXqqyHQ.js";import{_ as cs}from"./useAsync-B6ZHbOEG.js";import{I as M}from"./index-BnR8uU0R.js";import{d as ds}from"./DeleteOutline-1-hBNY1U.js";import{C as ge}from"./confirm-BjCmRSAF.js";import{u as he}from"./session-1k8BRnYA.js";import{i as Zt,a as Pe,p as Yt}from"./util-CS4PqVkK.js";import{b as ms}from"./sdk-BJQcHaGO.js";import{A as us}from"./actions-DtL6bYnA.js";import{S as ps}from"./shorten-label-CTSJhlwO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BF3BqN1O.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-CwT4-jkw.js";import"./use-blocklet-logo-6YMz11ob.js";import"./InfoOutlined-CLiL5VeK.js";import"./dot-BID2dzD_.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CXU9YBvX.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-BXVfASrK.js";import"./base32-CmYq1ikq.js";import"./MoreHoriz-9E3q8aHi.js";var Ye={},fs=Ot;Object.defineProperty(Ye,"__esModule",{value:!0});var Gt=Ye.default=void 0,gs=fs(_t()),hs=e;Gt=Ye.default=(0,gs.default)((0,hs.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ge=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ge.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="person";const xs=Ge;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var Ce={},ys=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Jt="%[a-f0-9]{2}",kt=new RegExp("("+Jt+")|([^%]+?)","gi"),It=new RegExp("("+Jt+")+","gi");function qe(t,o){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;o=o||1;var c=t.slice(0,o),u=t.slice(o);return Array.prototype.concat.call([],qe(c),qe(u))}function vs(t){try{return decodeURIComponent(t)}catch{for(var o=t.match(kt)||[],c=1;c<o.length;c++)t=qe(o,c).join(""),o=t.match(kt)||[];return t}}function bs(t){for(var o={"%FE%FF":"��","%FF%FE":"��"},c=It.exec(t);c;){try{o[c[0]]=decodeURIComponent(c[0])}catch{var u=vs(c[0]);u!==c[0]&&(o[c[0]]=u)}c=It.exec(t)}o["%C2"]="�";for(var d=Object.keys(o),h=0;h<d.length;h++){var S=d[h];t=t.replace(new RegExp(S,"g"),o[S])}return t}var Cs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return bs(t)}},js=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];const c=t.indexOf(o);return c===-1?[t]:[t.slice(0,c),t.slice(c+o.length)]},Ss=function(t,o){for(var c={},u=Object.keys(t),d=Array.isArray(o),h=0;h<u.length;h++){var S=u[h],p=t[S];(d?o.indexOf(S)!==-1:o(S,p,t))&&(c[S]=p)}return c};(function(t){const o=ys,c=Cs,u=js,d=Ss,h=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(l,r)=>{const x=l.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[",x,"]"].join("")]:[...l,[g(s,n),"[",g(x,n),"]=",g(r,n)].join("")]};case"bracket":return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[]"].join("")]:[...l,[g(s,n),"[]=",g(r,n)].join("")];case"comma":case"separator":return s=>(l,r)=>r==null||r.length===0?l:l.length===0?[[g(s,n),"=",g(r,n)].join("")]:[[l,g(r,n)].join(n.arrayFormatSeparator)];default:return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,g(s,n)]:[...l,[g(s,n),"=",g(r,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(l,r,x)=>{if(s=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!s){x[l]=r;return}x[l]===void 0&&(x[l]={}),x[l][s[1]]=r};case"bracket":return(l,r,x)=>{if(s=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!s){x[l]=r;return}if(x[l]===void 0){x[l]=[r];return}x[l]=[].concat(x[l],r)};case"comma":case"separator":return(l,r,x)=>{const y=typeof r=="string"&&r.includes(n.arrayFormatSeparator),w=typeof r=="string"&&!y&&i(r,n).includes(n.arrayFormatSeparator);r=w?i(r,n):r;const _=y||w?r.split(n.arrayFormatSeparator).map(F=>i(F,n)):r===null?r:i(r,n);x[l]=_};default:return(l,r,x)=>{if(x[l]===void 0){x[l]=r;return}x[l]=[].concat(x[l],r)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(n,s){return s.encode?s.strict?o(n):encodeURIComponent(n):n}function i(n,s){return s.decode?c(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,l)=>Number(s)-Number(l)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const l=n.indexOf("#");return l!==-1&&(s=n.slice(l)),s}function a(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function I(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const l=p(s),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(const x of n.split("&")){if(x==="")continue;let[y,w]=u(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:i(w,s),l(i(y,s),w,r)}for(const x of Object.keys(r)){const y=r[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=I(y[w],s);else r[x]=I(y,s)}return s.sort===!1?r:(s.sort===!0?Object.keys(r).sort():Object.keys(r).sort(s.sort)).reduce((x,y)=>{const w=r[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=a,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const l=w=>s.skipNull&&h(n[w])||s.skipEmptyString&&n[w]==="",r=S(s),x={};for(const w of Object.keys(n))l(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const _=n[w];return _===void 0?"":_===null?g(w,s):Array.isArray(_)?_.reduce(r(w),[]).join("&"):g(w,s)+"="+g(_,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[l,r]=u(n,"#");return Object.assign({url:l.split("?")[0]||"",query:m(a(n),s)},s&&s.parseFragmentIdentifier&&r?{fragmentIdentifier:i(r,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const l=C(n.url).split("?")[0]||"",r=t.extract(n.url),x=t.parse(r,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${g(n.fragmentIdentifier,s)}`),`${l}${w}${_}`},t.pick=(n,s,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:r,query:x,fragmentIdentifier:y}=t.parseUrl(n,l);return t.stringifyUrl({url:r,query:d(x,s),fragmentIdentifier:y},l)},t.exclude=(n,s,l)=>{const r=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,r,l)}})(Ce);const le=yn,ws={parseNumbers:!1,parseBooleans:!1},Ps={skipNull:!1,skipEmptyString:!1},ks=(t,o)=>{var c,u;const{navigateMode:d="push",parseOptions:h,stringifyOptions:S}={},p=Object.assign(Object.assign({},ws),h),b=Object.assign(Object.assign({},Ps),S),g=le.useLocation(),i=(c=le.useHistory)===null||c===void 0?void 0:c.call(le),T=(u=le.useNavigate)===null||u===void 0?void 0:u.call(le),C=rs(),k=P.useRef(typeof t=="function"?t():t||{}),a=P.useMemo(()=>Ce.parse(g.search,p),[g.search]),I=P.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[I,Ve(n=>{const s=typeof n=="function"?n(I):n;C(),i&&i[d]({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},g.state),T&&T({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},{replace:d==="replace",state:g.state})})]},Is=ks,Ts=Ut,_e=En,Ue=On,Ds=ls,Tt={role:Ts.types.RoleType.ROLE_APPLICATION},As=(t,o,c,u)=>{let d=c||Tt;const h=(0,Ue.isEthereumType)((0,Ue.DidType)(c));if(h?d=(0,_e.WalletType)(c):d=(0,_e.WalletType)(Tt),!(0,Ue.isValid)(t)){let S="";try{return h?S=t.slice(0,66):S=t,(0,_e.fromSecretKey)(S,d)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!o)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ds.fromAppDid)(t,o,d,u||0)};var Rs=As,Xt=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const ce=Xt(Qn),Ls=Ut,ve=Xt(Rs),Es=Jn,Os=(t,o,{returnWallet:c=!0}={})=>{var F,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,ce.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:d=[]}=t,h=[...d,...u],S=h.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=h.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=h.find(D=>D.key==="BLOCKLET_APP_URL"),g=h.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:T}=t.meta,C=(0,Es.getDisplayName)(t),k=(0,ce.default)(S,"value",t.meta.description),a=(0,ce.default)(p,"value","auto"),I=(0,ce.default)(b,"value",""),m=(0,ce.default)(g,"value","");if(!c)return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=h.find(D=>D.key==="BLOCKLET_APP_SK"),s=h.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),l=h.find(D=>D.key==="BLOCKLET_APP_PSK");let r;s&&(s.value==="ethereum"||s.value==="eth")&&(r=s.value);let x=null,y=null;if(n&&n.value)x=(0,ve.default)(n.value,void 0,r),l&&l.value&&l.value!==n.value&&(y=(0,ve.default)(l.value,void 0,r));else{if(!o||typeof o!="string")throw new Error("Node secret key must be a string");s?x=(0,ve.default)(t.meta.did,o,r):x=(0,ve.default)(t.meta.did,o)}const w=((R=(F=t.settings)==null?void 0:F.session)==null?void 0:R.salt)||"",_=Ls.Hasher.SHA3.hash256(St.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>St.from(D))));return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:_,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ns=Os;const _s=vn(Ns);function Je({teamDid:t,roles:o,apps:c,onCancel:u,onSuccess:d,onError:h,endpoint:S}){var I;const{api:p}=q(),{t:b,locale:g}=V(),i=Ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:c.length>0?c[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!i.role){i.error=b("team.member.error.passportEmpty");return}const m=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:m,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:l}=await p.createMemberInvitation({input:s});i.inviteInfo=l,i.activeStep=1}catch(n){const s=te(n);i.error=s,h(n)}finally{i.loading=!1}},C=o.find(m=>m.name===i.role),a=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[c.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx($e,{children:b("common.sourceApp")}),e.jsx(We,{value:i.sourceAppPid,onChange:m=>{i.error=null,i.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,children:c.map(m=>e.jsx(je,{value:m.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Nn,{did:m.appPid,size:28}),m.appName]}),e.jsx(_n,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx($e,{children:b("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:i.role,onChange:m=>{i.error=null,i.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:o.filter(m=>m.name!=="owner").map(m=>e.jsx(je,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Q,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Q,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((I=C==null?void 0:C.extra)==null?void 0:I.display)==="custom"&&e.jsx(me,{label:b("common.display"),type:"url",value:i.display,onChange:m=>{i.error=null,i.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(me,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:m=>{i.error=null,i.remark=m.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Kt,{value:i.passportExpireTime,onChange:m=>{i.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:T},{body:()=>{var n,s;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=i.inviteInfo)==null?void 0:s.expireDate,g)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});os(m),Y.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:u}][i.activeStep];return e.jsxs(se,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!i.error&&e.jsx(oe,{severity:"error",variant:"icon",children:i.error})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Je.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:o,onSuccess:c,onError:u,endpoint:d}){const{api:h,info:S}=q(),{api:p}=P.useContext(Un),[b,g]=P.useState(!1),{t:i,locale:T}=V(),[C,k]=P.useState(""),[a,I]=P.useState(!1),[m,n]=P.useState(0),[s,l]=P.useState(""),[r,x]=P.useState(""),y=!!ze(S,"ownerNft.did"),w=cs(async()=>{if(y){const{state:A}=await h.getDelegationState();return A}return{delegated:!0}});if(w.loading)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx(oe,{severity:"error",variant:"icon",children:te(w.error)})});const _=async()=>{k(null),g(!0);try{const{inviteInfo:A}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:r.trim()}});l(A),n(D.length-1)}catch(A){const H=te(A);k(H),u(A)}finally{g(!1)}},F=()=>{I(!0),n(1)},R=()=>{I(!1),n(0)},D=[{body:e.jsxs(Q,{component:"div",children:[e.jsxs(oe,{severity:"warning",children:[e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(oe,{severity:"warning",children:e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(me,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:r,onChange:A=>{k(null),x(A.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:o,onConfirm:y&&!ze(w,"value.delegated")?F:_},{body:()=>e.jsx(Bn,{action:"delegate-transfer-nft",open:a,locale:T,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Xn(S),extraParams:{targetDID:S.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const A=we({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Us,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:A})]})},confirm:i("common.confirm"),onConfirm:c}],O=D[m];return e.jsxs(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(W,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(W,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(ie,{size:16}),O.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(oe,{severity:"error",variant:"icon",children:C})]})}Xe.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Us=z.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
`;var et=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"})]})};et.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};et.displayName="forbid-login";const en=et;var tt=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"}),e.jsx("rect",{x:"15.3125",y:"14.0625",width:"7.5",height:"1.875",rx:"0.9375",transform:"rotate(-90 15.3125 14.0625)"})]})};tt.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};tt.displayName="allow-login";const tn=tt;function ke(t){const{passport:o,onDelete:c,...u}=t;return e.jsxs(Bs,{...u,children:[o.title||o.name," ",!!c&&e.jsx(Fn,{"data-cy":"delete-issuance",className:"delete",onClick:c})]})}ke.propTypes={passport:v.object.isRequired,onDelete:v.func};ke.defaultProps={onDelete:null};const Bs=z.span`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-wlbruq2I.js";import{a as f}from"./vendor-ux-did-connect-
|
|
1
|
+
import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-wlbruq2I.js";import{a as f}from"./vendor-ux-did-connect-CX7qG3_M.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-DQjZ74P0.js";import"./vendor-utils-B3iZkn2R.js";import"./vendor-hooks-BCm626KH.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-B4hgrXYM.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bt as ge,bu as We,bp as Y,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bA as gt,bR as Ke,bS as qe,y as Le,b7 as Me,ab as bt,bJ as jt,Y as vt,cn as yt,m as Ht,as as dt,bs as Vt,bo as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-wlbruq2I.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-CxrPpJZS.js";import{y as es,a as re,ab as Ct,a3 as q,X as ke,c0 as ts,B as me,k as W,bb as ss,ax as wt,bg as ns,r as Qe,c1 as is,a2 as Tt,ac as Rt,bA as Ae,ar as Nt,$ as as,bH as rs}from"./vendor-ux-did-connect-Bh011lgb.js";import{D as Ze,G as Et,aC as It,aD as Q,y as se,n as os,K as pt}from"./index-Rx6rf5TL.js";import{a as Te,u as V,b as ce}from"./vendor-hooks-TMGmpw5W.js";import{a as et,b as ls}from"./dashboard-DTpUsE7s.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-CmMzePwG.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-C0MB7y7w.js";import{S as ee}from"./section-Bb547IGJ.js";import{S as Re}from"./shorten-label-CTSJhlwO.js";import{I as At}from"./index-Dsf-Dx7V.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-DyU1G1ER.js";import{W as vs}from"./did-address-C3GRjuMv.js";import{p as Dt}from"./util-Ayf5_DBX.js";import{D as ys,g as Ss}from"./traffic-GgX3Erg7.js";import{B as Lt}from"./bundle-avatar-eYIyRJCN.js";import{u as Cs}from"./use-mobile-CXU9YBvX.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CATQui2x.js";import"./useLocalStorage-COrhSWV-.js";import"./index-8eXqqyHQ.js";import"./confirm-W9aiB3ZK.js";import"./PlayArrow-RuC30CX1.js";import"./get-safe-url-DvHrYSqa.js";import"./session-N9ogZkBO.js";import"./InfoOutlined-Bpx0eOkP.js";import"./dot-DGdAPqTT.js";import"./useAsync-QkUcWOv0.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./index-DU8cx_m6.js";import"./CheckCircle-DKl6wFCW.js";import"./base32-BwYE-4Kz.js";import"./iframe-BiCAYvW4.js";import"./LaunchOutlined-BorUV5ev.js";import"./ChevronLeft-BTvoFtZ-.js";import"./ChevronRight-CB-tzzK0.js";import"./index-BoQJXOtZ.js";import"./base-chart-C6ehpmPk.js";import"./index-KHBjePpP.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-eMGLd9qK.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&q.success(s("oauth.saveSuccess"))}catch(le){if($)q.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),q.success(s("notification.email.testSuccess"))}catch(U){q.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&q.success(s("oauth.saveSuccess"))}catch(P){if(j)q.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,W.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),q.success(s("notification.pushKit.testSuccess"))}catch(P){q.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:si}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return q.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw q.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),Ks=e;kt=nt.default=(0,Ws.default)((0,Ks.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},qs=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=qs(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Kt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(qe,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){q.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){q.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(qe,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(ge,{control:e.jsx(qe,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}qt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function qt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,Kt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){q.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,K=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(K,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:K,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(K){console.error("handleResend error",{error:K})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){q.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],K=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){q.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,K);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],K),B.anchorEl||(await Ee(.5),pe()))}catch(X){q.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const K=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:K,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:K=>w(K,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:K=>w(K,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:K=>w(K,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,K]=f,Z=K[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var K,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(K=_==null?void 0:_.result)!=null&&K[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(qt),tn=ue.div`
|
|
1
|
+
import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bt as ge,bu as We,bp as Y,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bA as gt,bR as Ke,bS as qe,y as Le,b7 as Me,ab as bt,bJ as jt,Y as vt,cn as yt,m as Ht,as as dt,bs as Vt,bo as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-wlbruq2I.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-B3iZkn2R.js";import{y as es,a as re,ab as Ct,a3 as q,X as ke,c0 as ts,B as me,k as W,bb as ss,ax as wt,bg as ns,r as Qe,c1 as is,a2 as Tt,ac as Rt,bA as Ae,ar as Nt,$ as as,bH as rs}from"./vendor-ux-did-connect-CX7qG3_M.js";import{D as Ze,G as Et,aC as It,aD as Q,y as se,n as os,K as pt}from"./index-DQjZ74P0.js";import{a as Te,u as V,b as ce}from"./vendor-hooks-BCm626KH.js";import{a as et,b as ls}from"./dashboard-B7qE-Md0.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-6YMz11ob.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse--nd2JDBL.js";import{S as ee}from"./section-Bb547IGJ.js";import{S as Re}from"./shorten-label-CTSJhlwO.js";import{I as At}from"./index-BnR8uU0R.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-BeFxJZxl.js";import{W as vs}from"./did-address-bJAfhuZx.js";import{p as Dt}from"./util-CS4PqVkK.js";import{D as ys,g as Ss}from"./traffic-BI_ofO44.js";import{B as Lt}from"./bundle-avatar-D28BGkcC.js";import{u as Cs}from"./use-mobile-CiFFAdJf.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-B4hgrXYM.js";import"./useLocalStorage-BF3BqN1O.js";import"./index-8eXqqyHQ.js";import"./confirm-BjCmRSAF.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-CwT4-jkw.js";import"./session-1k8BRnYA.js";import"./InfoOutlined-CLiL5VeK.js";import"./dot-BID2dzD_.js";import"./useAsync-B6ZHbOEG.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CXU9YBvX.js";import"./index-DU8cx_m6.js";import"./CheckCircle-M9NlpTm_.js";import"./base32-CmYq1ikq.js";import"./iframe-DsIqy16E.js";import"./LaunchOutlined-CPurmWuM.js";import"./ChevronLeft-02OWcWpH.js";import"./ChevronRight-CB8w0u2n.js";import"./index-BoQJXOtZ.js";import"./base-chart-BYonGucU.js";import"./index-Dntq1ezd.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-BXVfASrK.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&q.success(s("oauth.saveSuccess"))}catch(le){if($)q.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),q.success(s("notification.email.testSuccess"))}catch(U){q.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&q.success(s("oauth.saveSuccess"))}catch(P){if(j)q.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,W.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),q.success(s("notification.pushKit.testSuccess"))}catch(P){q.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:si}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return q.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw q.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),Ks=e;kt=nt.default=(0,Ws.default)((0,Ks.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},qs=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=qs(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Kt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(qe,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){q.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){q.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(qe,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(ge,{control:e.jsx(qe,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}qt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function qt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,Kt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){q.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,K=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(K,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:K,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(K){console.error("handleResend error",{error:K})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){q.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],K=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){q.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,K);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],K),B.anchorEl||(await Ee(.5),pe()))}catch(X){q.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const K=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:K,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:K=>w(K,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:K=>w(K,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:K=>w(K,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,K]=f,Z=K[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var K,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(K=_==null?void 0:_.result)!=null&&K[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(qt),tn=ue.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r,T as i}from"./vendor-mui-core-wlbruq2I.js";import{a0 as p,an as x}from"./vendor-utils-
|
|
1
|
+
import{j as r,T as i}from"./vendor-mui-core-wlbruq2I.js";import{a0 as p,an as x}from"./vendor-utils-B3iZkn2R.js";import{s as c}from"./vendor-ux-did-connect-CX7qG3_M.js";function h({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(f=>p(x(f))).join(" "):o,layout:n="horizontal",children:e,valueComponent:l="div",nameWidth:s=90,...m}){return r.jsxs(u,{layout:n,width:s,...m,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),e&&r.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:e})]})}const u=c("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
|
|
4
4
|
justify-content: flex-start;
|