@abtnode/blocklet-services 1.16.43-beta-20250505-062139-b156e7da → 1.16.43-beta-20250507-131727-e3e5be46
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/middlewares/check-running.js +5 -3
- package/api/routes/oauth/client.js +16 -1
- package/api/services/auth/index.js +5 -3
- package/api/util/attach-shared-utils.js +5 -3
- package/dist/assets/{AdapterDayjs-Bxdv5BBD.js → AdapterDayjs-QizZbjYO.js} +1 -1
- package/dist/assets/{ArrowDropDown-CtOiDsfU.js → ArrowDropDown-CDVfAOPe.js} +1 -1
- package/dist/assets/{CheckCircle-msbMBqZj.js → CheckCircle-CJmQq3zs.js} +1 -1
- package/dist/assets/{ChevronLeft-DmV9D3fU.js → ChevronLeft-BWWdEYiT.js} +1 -1
- package/dist/assets/{ChevronRight-Br0ablb7.js → ChevronRight-tpAiXojW.js} +1 -1
- package/dist/assets/{Community-DathqRsd.js → Community-CGFOsRKB.js} +1 -1
- package/dist/assets/{DeleteOutline-BU7WZ4i1.js → DeleteOutline-DqdSj9ec.js} +1 -1
- package/dist/assets/{Done-SwUOq9KC.js → Done-DtZ1RTXT.js} +1 -1
- package/dist/assets/{Download-Drp0bexG.js → Download-CC6n4Puh.js} +1 -1
- package/dist/assets/{Edit-CFF31Js3.js → Edit-CJyJLpRB.js} +1 -1
- package/dist/assets/{EditIcon-DWRQ3fi6.js → EditIcon-KKx_adUe.js} +1 -1
- package/dist/assets/{Email-B0n6rLUZ.js → Email-CXOl4bM_.js} +1 -1
- package/dist/assets/{Error-2fR4-pmz.js → Error-BfFrp5Y1.js} +1 -1
- package/dist/assets/{ExpandLess-C2a4bF6C.js → ExpandLess-Ddif_UHH.js} +1 -1
- package/dist/assets/{Google-ZTmw0mlG.js → Google-DMO1DD8q.js} +1 -1
- package/dist/assets/{Holiday-BkY6LMfd.js → Holiday-B4FuMZHi.js} +1 -1
- package/dist/assets/{InfoOutlined-hS_Bn_IB.js → InfoOutlined-CoMCPk7a.js} +1 -1
- package/dist/assets/{Launch-BvpJnrFC.js → Launch-DNHBfbtb.js} +1 -1
- package/dist/assets/{LaunchOutlined-DwFeZSV7.js → LaunchOutlined-CypNgDc2.js} +1 -1
- package/dist/assets/{Location-BQhEvGNL.js → Location-afhZgOLn.js} +1 -1
- package/dist/assets/{LockIcon-Bd69pSJI.js → LockIcon-BlopdQoN.js} +1 -1
- package/dist/assets/{Meeting-BW-_XtSL.js → Meeting-Ct6JoGYc.js} +1 -1
- package/dist/assets/{MoreHoriz-DrhBbQGZ.js → MoreHoriz-D6Wvugul.js} +1 -1
- package/dist/assets/{OffSick-9I8vBA8l.js → OffSick-CT2gezXK.js} +1 -1
- package/dist/assets/{Phone-CKzC4712.js → Phone-alkdVkQC.js} +1 -1
- package/dist/assets/{PlayArrow-CeIK7-yb.js → PlayArrow-gSxq4eiM.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-DpFFQWud.js → QuestionMarkCircle-DK54eXUx.js} +1 -1
- package/dist/assets/{ServerLogo-AfxVBRdi.js → ServerLogo-b4GZ-IpN.js} +1 -1
- package/dist/assets/{Timezone-C3hiNX6j.js → Timezone-6KelONy7.js} +1 -1
- package/dist/assets/{TuneOutlined-B-fSgZvP.js → TuneOutlined-D2mm0fk8.js} +1 -1
- package/dist/assets/{ViewList-CAnQTEEQ.js → ViewList-wWyYUeZC.js} +1 -1
- package/dist/assets/{WorkingRemotely-CHzRY2CT.js → WorkingRemotely-qYwywlWG.js} +1 -1
- package/dist/assets/{access-control-DygMvGXu.js → access-control-DLPO680A.js} +1 -1
- package/dist/assets/{actions-BEVLXA8P.js → actions-CHh4ckCh.js} +1 -1
- package/dist/assets/{add-component-core-BLsZRe6K.js → add-component-core-DlMKapO7.js} +2 -2
- package/dist/assets/{add-resource-uxj6Fg77.js → add-resource-BmnO7e2j.js} +1 -1
- package/dist/assets/{addon-DPxkCqqP.js → addon-CxsW-e44.js} +1 -1
- package/dist/assets/{advanced-RHwLVN7K.js → advanced-Bo8K0ZsY.js} +1 -1
- package/dist/assets/{appearance-BeAcEscd.js → appearance-BHAm7HQy.js} +1 -1
- package/dist/assets/{audit-logs-CPqbAeYP.js → audit-logs-CnqfBbxo.js} +1 -1
- package/dist/assets/{authorize-DsVtgYBZ.js → authorize-C-NJb9-z.js} +1 -1
- package/dist/assets/{base32-CwrkOaA2.js → base32-M2-tdl6O.js} +1 -1
- package/dist/assets/{branding-DtA4kERo.js → branding-DoVIYeNq.js} +2 -2
- package/dist/assets/{branding-D8yn967G.js → branding-HWsqjMlF.js} +1 -1
- package/dist/assets/{bundle-avatar-DB3E7EOv.js → bundle-avatar-Cb1gLIQK.js} +1 -1
- package/dist/assets/button-CO4tv2XS.js +1 -0
- package/dist/assets/{click-to-copy-j_gx9gFG.js → click-to-copy-BxPDzy5A.js} +1 -1
- package/dist/assets/{complete-ByIPtiSe.js → complete-eqvaP3jt.js} +1 -1
- package/dist/assets/{component-Cmj8wMD5.js → component-BWOI-XDr.js} +1 -1
- package/dist/assets/{config-CQRZ09xB.js → config-B4YxZsKp.js} +1 -1
- package/dist/assets/{config-navigation-C1Z6kyB3.js → config-navigation-_YzfelvT.js} +6 -6
- package/dist/assets/{config-BNKhoBDx.js → config-quCUUlRH.js} +1 -1
- package/dist/assets/{config-space-CcDRmzuH.js → config-space-_Rron-sL.js} +1 -1
- package/dist/assets/{confirm-oEG91BF3.js → confirm-BdypMD8p.js} +1 -1
- package/dist/assets/{connect-C9XH2QgZ.js → connect-C73ctF7v.js} +1 -1
- package/dist/assets/{connect-DB3ixc3c.js → connect-DpdQ5dsJ.js} +1 -1
- package/dist/assets/{connect-to-B_yuzVhS.js → connect-to-ClicwRFo.js} +1 -1
- package/dist/assets/{content-layout-C3Yd4mK9.js → content-layout-qHJyxPYq.js} +1 -1
- package/dist/assets/{dashboard-DyRSlDZ8.js → dashboard-BoKAftfy.js} +17 -17
- package/dist/assets/{delete-confirm-4a9iCk5U.js → delete-confirm-DmVgGU7R.js} +1 -1
- package/dist/assets/{did-address-DXsoioR-.js → did-address-CaOBKHpX.js} +1 -1
- package/dist/assets/{domain-CuSBV4D5.js → domain-C_re69mR.js} +1 -1
- package/dist/assets/{domain-action-card-BH2naaFL.js → domain-action-card-DZA2kJ9n.js} +1 -1
- package/dist/assets/domains-B1rKs-L0.js +1 -0
- package/dist/assets/{dot-WAAJ-O65.js → dot-DNqoPOFy.js} +1 -1
- package/dist/assets/{email-BLXsjGCd.js → email-DyqcwVW8.js} +1 -1
- package/dist/assets/{empty-spinner-BYUFR95o.js → empty-spinner-Bx6dYuKk.js} +1 -1
- package/dist/assets/{exchange-passport-xhqvffW9.js → exchange-passport-CRcpyt2h.js} +1 -1
- package/dist/assets/{fuel-kVR_XCvg.js → fuel-Csg8CT7E.js} +1 -1
- package/dist/assets/{gen-access-key-C9I6m66S.js → gen-access-key-DravbWWk.js} +1 -1
- package/dist/assets/{get-safe-url-DGnHBj8n.js → get-safe-url-BBjUrzRU.js} +1 -1
- package/dist/assets/{get-safe-url-R3dJEaue.js → get-safe-url-zHRp3aBu.js} +1 -1
- package/dist/assets/{home-BWQuOq0X.js → home-CM-H3jsN.js} +1 -1
- package/dist/assets/{iframe-CsfqLmob.js → iframe-BuwO7sH1.js} +1 -1
- package/dist/assets/{index-CMFOn8T3.js → index-3mcmABlM.js} +1 -1
- package/dist/assets/{index-DYxnn9uv.js → index-AFpdJQlM.js} +2 -2
- package/dist/assets/{index-WYf-xVMZ.js → index-BLdu7KNf.js} +1 -1
- package/dist/assets/{index-B72n4V2s.js → index-BTqduPxF.js} +1 -1
- package/dist/assets/{index-Bf8i5DPA.js → index-BktGjdcJ.js} +1 -1
- package/dist/assets/index-BmmSa8OU.js +141 -0
- package/dist/assets/{index-Be-8LeGB.js → index-ByRsWkxZ.js} +1 -1
- package/dist/assets/index-CFxMWjgx.js +6 -0
- package/dist/assets/{index-gw8hsltc.js → index-Cc7IEdxz.js} +1 -1
- package/dist/assets/{index-tf7PEogm.js → index-CoQfYWxM.js} +1 -1
- package/dist/assets/{index-v90LUntw.js → index-D3xXs49h.js} +4 -4
- package/dist/assets/{index-DIe9psLc.js → index-DF637rKa.js} +1 -1
- package/dist/assets/{index-DJxPLtmA.js → index-DcAi4AXo.js} +1 -1
- package/dist/assets/{index-aGp3zmpA.js → index-DisBCigl.js} +1 -1
- package/dist/assets/{index-BUHlfcy3.js → index-Dz5GK-zs.js} +1 -1
- package/dist/assets/{index-C2QrzzaU.js → index-PVfL4XCf.js} +1 -1
- package/dist/assets/{index-DMRB_27Q.js → index-cTHEQKxV.js} +5 -5
- package/dist/assets/{index-Bt7GP-dU.js → index-hOO84dse.js} +1 -1
- package/dist/assets/{index-Db1S67Mk.js → index-hv585eyH.js} +18 -18
- package/dist/assets/index-l3VL0wBE.js +161 -0
- package/dist/assets/{index-DcUWE37M.js → index-qVEdG7jc.js} +4 -4
- package/dist/assets/{index-CjjuFvKr.js → index-wd295lFg.js} +1 -1
- package/dist/assets/{invitation-UWUoMJEH.js → invitation-D-b5Vxj9.js} +1 -1
- package/dist/assets/{invite-CGi_9MV3.js → invite-D4vmIkpa.js} +1 -1
- package/dist/assets/{issue-passport-Ca9_iJlv.js → issue-passport-BeRSZdhB.js} +1 -1
- package/dist/assets/{item-BA9iP7co.js → item-CcTtyxW8.js} +1 -1
- package/dist/assets/{landing-page-Blz2w-aH.js → landing-page-xXstO1rJ.js} +1 -1
- package/dist/assets/{launch-result-message-B_fS-f90.js → launch-result-message-DucKBLPI.js} +1 -1
- package/dist/assets/{layout-DW9l-R-4.js → layout-D5imX3Tj.js} +1 -1
- package/dist/assets/{list-VlrLfNLt.js → list-DjGDmcyZ.js} +2 -2
- package/dist/assets/{list-header-8k1_C0K0.js → list-header-jygAFPJa.js} +1 -1
- package/dist/assets/localization-DxZ5mhWl.js +1 -0
- package/dist/assets/{log-CetSCivl.js → log-KrN0xsfb.js} +1 -1
- package/dist/assets/{logger-DXiDU1hr.js → logger-hgBwjvHi.js} +1 -1
- package/dist/assets/{login-pGpA2dx5.js → login-DDfBfTMB.js} +1 -1
- package/dist/assets/{login-oauth-callback-Cz4HDfxL.js → login-oauth-callback-BdgRJj-p.js} +1 -1
- package/dist/assets/{logo-uploader-hb4ghrVp.js → logo-uploader-CthNdiS0.js} +3 -3
- package/dist/assets/{lost-passport-BrhFEayy.js → lost-passport-a0O6SjHW.js} +1 -1
- package/dist/assets/{open-window-BqTbT6lB.js → open-window-D__BoNEX.js} +1 -1
- package/dist/assets/{overview-B3dRi3yE.js → overview-D3PLQpfp.js} +1 -1
- package/dist/assets/{page-header-BYtqLM5e.js → page-header-Kn6r_XKH.js} +1 -1
- package/dist/assets/{passport-item-FiBabn6e.js → passport-item-BqMiGQDS.js} +1 -1
- package/dist/assets/{permission-B0bwGXNp.js → permission-CC2IdTdZ.js} +1 -1
- package/dist/assets/{preferences-vpGHHPV1.js → preferences-yjK1dIpN.js} +1 -1
- package/dist/assets/{profile-embed-BhW6p4Xz.js → profile-embed-BwWjXkMu.js} +1 -1
- package/dist/assets/publish-resource-BB8z3L6t.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-J_09ZTBJ.js → react-beautiful-dnd.esm-djvJS7-9.js} +1 -1
- package/dist/assets/{relative-time-Ca1sd_aF.js → relative-time-DTDqch3x.js} +1 -1
- package/dist/assets/{runtime-CS1kGNvF.js → runtime-Hly5WV5m.js} +1 -1
- package/dist/assets/sdk-CtDt6ZE4.js +1 -0
- package/dist/assets/{security-CgsJIaze.js → security-CFwMMMxT.js} +1 -1
- package/dist/assets/{session-B_RsakU4.js → session-C3Z84LF2.js} +1 -1
- package/dist/assets/{setup-Bpmp0hS9.js → setup-BCBUXGcI.js} +3 -3
- package/dist/assets/{shorten-label-SbKUBkvs.js → shorten-label-BhyIJhRI.js} +1 -1
- package/dist/assets/{simple-select-CLc0Q9sm.js → simple-select-CF7l1q3Q.js} +1 -1
- package/dist/assets/{slicedToArray-C0YDCVwK.js → slicedToArray-D2u5vDM0.js} +2 -2
- package/dist/assets/{spaces-DHRCc5pJ.js → spaces-U3nGmGRa.js} +1 -1
- package/dist/assets/{start-b8VtKWzD.js → start-vVDqL4CC.js} +1 -1
- package/dist/assets/{starting-progress-Cq6oMvtd.js → starting-progress-BhqlnMjX.js} +1 -1
- package/dist/assets/{status-BUWzSxch.js → status-BR44F9iR.js} +1 -1
- package/dist/assets/{step-actions-tjbtKF9G.js → step-actions-DZo926Ej.js} +1 -1
- package/dist/assets/{studio-Dt-yrfsf.js → studio-DdhbfCKD.js} +1 -1
- package/dist/assets/{switch-control-CYExQdC4.js → switch-control-CvOsxpit.js} +1 -1
- package/dist/assets/{traffic-cstjgILR.js → traffic-gSZZSuR6.js} +1 -1
- package/dist/assets/{transfer-Ceah-H6_.js → transfer-pYU-BKtp.js} +1 -1
- package/dist/assets/{unsubscribe-DqbdiPdh.js → unsubscribe-DFl72cqo.js} +1 -1
- package/dist/assets/{use-blocklet-logo-ZrVs0Fgp.js → use-blocklet-logo-32yq4Y7I.js} +1 -1
- package/dist/assets/{use-mobile-BKvZ6hcv.js → use-mobile-DbhbAmWG.js} +1 -1
- package/dist/assets/{use-mobile-BNUwcWCH.js → use-mobile-fdqINXKQ.js} +1 -1
- package/dist/assets/{useLocalStorage-B_V0diy4.js → useLocalStorage-vveKfojd.js} +1 -1
- package/dist/assets/{user-center-BNt97_Oy.js → user-center-D1PJXvUz.js} +1 -1
- package/dist/assets/{util-CxKY-YuQ.js → util-BXETl5KI.js} +1 -1
- package/dist/assets/{util-DmIsJ5RI.js → util-sIStv7W9.js} +1 -1
- package/dist/assets/{vendor-arcblock-DpCuGvAS.js → vendor-arcblock-TgIfa3ko.js} +4 -4
- package/dist/assets/{vendor-mui-core-B6POpIBB.js → vendor-mui-core-BKQDHvL6.js} +17 -17
- package/dist/assets/{vendor-mui-x-CATHW1QL.js → vendor-mui-x-Db_Ss6fv.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-CeGz2B7G.js → vendor-ux-did-connect-Dr2W2Pc9.js} +1 -1
- package/dist/assets/{wrap-locale-DcoOFDfm.js → wrap-locale-B29V1TgE.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +36 -36
- package/dist/assets/button-Cd9-2VCv.js +0 -1
- package/dist/assets/domains-BSI91pSw.js +0 -1
- package/dist/assets/index-D10IrMQr.js +0 -137
- package/dist/assets/index-DQ5v58Z8.js +0 -192
- package/dist/assets/index-bodAuphN.js +0 -6
- package/dist/assets/localization-CtfwjqIp.js +0 -1
- package/dist/assets/publish-resource-8ginQRUx.js +0 -1
- package/dist/assets/sdk-DGCdjl0b.js +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
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,bd as g,T as z,O as U,bv as q,bt as W,bw as H,cI as L,y as T,ah as I,ai as N,cn as J,dz as X,dA as K,I as Y,dB as Q,e as Z,c1 as ee}from"./vendor-mui-core-BKQDHvL6.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-DXGUREV9.js";import{T as ae,bw as se}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{_}from"./vendor-arcblock-TgIfa3ko.js";import{aO as ne}from"./vendor-utils-CjMBJT5V.js";import{getAIKitComponent as le}from"./index-hv585eyH.js";import"./lottie-web-jYmAQWuC.js";import"./index-DODYa3Im.js";import"./index-cTHEQKxV.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})),u=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:u,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],me=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function pe({onSubmit:t}){const{loading:c,i18n:s}=D(),o=B({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},u=o.model==="dall-e-2"?xe:ce;return e.jsxs(ue,{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:me.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(L,{size:"small",min:0,max:u.length-1,step:1,value:u.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=u[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(L,{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(T,{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 ue=I(n)`
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
height: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
|
|
8
|
+
.title {
|
|
9
|
+
padding: 0 0 4px 1px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.label {
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
font-size: 15px;
|
|
15
|
+
line-height: 100%;
|
|
16
|
+
margin: 0;
|
|
17
|
+
word-wrap: break-word;
|
|
18
|
+
text-align: left;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.submit-ai {
|
|
22
|
+
height: 40px;
|
|
23
|
+
background: linear-gradient(90deg, #45e4fa 0%, #8a45fa 52.08%, #fa45bc 100%);
|
|
24
|
+
color: #fff;
|
|
25
|
+
border-radius: 30px;
|
|
26
|
+
box-shadow: none;
|
|
27
|
+
text-transform: none;
|
|
28
|
+
|
|
29
|
+
&.Mui-disabled {
|
|
30
|
+
color: ${({theme:t})=>t.palette.text.disabled} !important;
|
|
31
|
+
background: ${({theme:t})=>t.palette.action.disabledBackground} !important;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.MuiFormHelperText-root {
|
|
36
|
+
font-style: normal;
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
line-height: 14px;
|
|
40
|
+
margin: 0;
|
|
41
|
+
margin-top: 4px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.MuiOutlinedInput-root {
|
|
45
|
+
border-radius: 4px;
|
|
46
|
+
padding: 0;
|
|
47
|
+
|
|
48
|
+
textarea {
|
|
49
|
+
padding: 8.5px 14px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fieldset {
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:hover fieldset {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`,he=({onDelete:t,selected:c,onLoad:s,src:o,alt:l,...f})=>{const x=B({loading:!0});return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(n,{className:"lazy-image-wrapper",sx:{visibility:x.loading?"hidden":"visible",bgcolor:"background.paper",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{alt:l,src:o,...f,onLoad:()=>{x.loading=!1;try{s==null||s()}catch(u){console.error("image onLoad error: ",u)}},loading:"eager"})}),x.loading&&e.jsx(N,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{position:"absolute",top:0}}),e.jsx(ge,{onClick:()=>t(o),sx:{position:"absolute",left:10,bottom:10},children:e.jsx(J,{sx:{fontSize:20}})}),l&&e.jsxs(fe,{unstyled:!0,tip:l,sx:{position:"absolute",right:10,bottom:10,fontSize:14,width:"calc(100% - 20px - 10px - 36px)",display:"flex",alignItems:"center"},arrow:!0,tipPlacement:"top",PopperProps:{disablePortal:!0},children:[e.jsx(X,{sx:{fontSize:20,mr:.5}}),e.jsx(z,{sx:{fontSize:14,overflowX:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]}),e.jsx(n,{sx:{position:"absolute",right:8,top:8},onClick:f==null?void 0:f.onClick,children:c?e.jsx(be,{sx:{fontSize:30}}):e.jsx(K,{sx:{fontSize:30,color:"#fff"}})})]})},fe=I(se)`
|
|
59
|
+
height: 36px;
|
|
60
|
+
padding: 8px;
|
|
61
|
+
background: rgba(0, 0, 0, 0.42);
|
|
62
|
+
color: #f7f8f8;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
align-items: center;
|
|
66
|
+
border-radius: 6px;
|
|
67
|
+
color: #fff;
|
|
68
|
+
transition: all 0.3s;
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background: rgba(0, 0, 0, 0.69);
|
|
72
|
+
}
|
|
73
|
+
`,ge=I(Y)`
|
|
74
|
+
height: 36px;
|
|
75
|
+
width: 36px;
|
|
76
|
+
padding: 0;
|
|
77
|
+
background: rgba(0, 0, 0, 0.42);
|
|
78
|
+
color: #f7f8f8;
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
border-radius: 6px;
|
|
83
|
+
transition: all 0.3s;
|
|
84
|
+
|
|
85
|
+
&:hover {
|
|
86
|
+
background: rgba(0, 0, 0, 0.69);
|
|
87
|
+
}
|
|
88
|
+
`,be=I(Q)`
|
|
89
|
+
& path:first-of-type {
|
|
90
|
+
fill: ${({theme:t})=>{var c,s;return((s=(c=t.palette)==null?void 0:c.primary)==null?void 0:s.main)||"#1976d2"}};
|
|
91
|
+
opacity: 1;
|
|
92
|
+
}
|
|
93
|
+
& path:last-child {
|
|
94
|
+
fill: white;
|
|
95
|
+
}
|
|
96
|
+
`,je=b.lazy(()=>_(()=>import("./lottie-react.esm-D2t-u0YU.js"),__vite__mapDeps([0,1])).then(t=>({default:t.Player})));function O({src:t}){return e.jsx(je,{src:t,loop:!0,autoplay:!0})}function ye({options:t,handleApi:c,onSelect:s,onFinish:o,onClose:l,isMobile:f}){const{loading:x,onLoading:u,restrictions:a,i18n:j}=D(),[d,y]=b.useState([]),[m,k]=b.useState(),P=Z(),S=a==null?void 0:a.maxNumberOfFiles,[p,A]=b.useState({}),h=B({}),R=Object.keys(h).filter(r=>h[r]),E={xs:6,sm:6};b.useEffect(()=>{m&&!p.error&&_(()=>import("./lottie-error-CMOXHtBH.js"),[]).then(r=>{A(i=>({...i,error:r.default}))}),t&&!d.length&&!p.loading&&_(()=>import("./lottie-loading-o-GBrhM9.js"),[]).then(r=>{A(i=>({...i,loading:r.default}))}),!t&&!p.welcome&&_(()=>import("./lottie-welcome-C9B95FIi.js"),[]).then(r=>{A(i=>({...i,welcome:r.default}))})},[m,t,d.length,p]),ie(async()=>{var r;if(t){k(void 0),u(!0);try{const i=await c({...t,responseFormat:"b64_json"});if(i.data){const w=(i.data||[]).map(C=>({src:`data:image/png;base64,${C.b64Json||C.b64_json}`,width:t.size?Number((t.size||"").split("x")[0]):1024,alt:t.prompt}));y(d?[...w,...d]:w)}else k(i)}catch(i){console.error("AIImage generate error: ",i),k(((r=i==null?void 0:i.response)==null?void 0:r.data)||i)}finally{u(!1),o()}}},[t==null?void 0:t.number,t==null?void 0:t.prompt,t==null?void 0:t.size]);const $=r=>{const i=Object.keys(h).filter(w=>h[w]);if(S?i.length<S:!0)h[r]?h[r]=!1:h[r]=!0;else{const w=i.pop();w!==r&&(h[w]=!1),h[r]=!h[r]}},M=r=>{if(d){const i=d.findIndex(v=>v.src===r);i>-1&&(h[r]=!1,d.splice(i,1),y([...d]))}},V=()=>{var i,v;const r={width:((i=document.querySelector(".photo-item img"))==null?void 0:i.offsetWidth)||0,height:((v=document.querySelector(".photo-item img"))==null?void 0:v.offsetHeight)||0};return e.jsx(e.Fragment,{children:Array.from({length:(t==null?void 0:t.number)||1}).map((w,C)=>b.createElement(g,{item:!0,...E,key:C},e.jsx(N,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{borderRadius:"12px",...r}})))})},G=()=>m?e.jsxs(n,{width:300,height:300,m:"auto",children:[p.error&&e.jsx(O,{src:p.error},"error"),e.jsx(n,{sx:{textAlign:"center",color:"#25292F",wordBreak:"break-all"},children:m==null?void 0:m.message})]}):d&&Array.isArray(d)&&d.length>0?e.jsxs(e.Fragment,{children:[e.jsx(n,{flexGrow:1,sx:{height:0,overflowX:"hidden",overflowY:"auto"},children:e.jsx(ve,{sx:f?{p:0,border:"none !important"}:{p:2},children:e.jsxs(g,{spacing:2,container:!0,className:"photo-wrapper",children:[x&&e.jsx(V,{}),d.map((r,i)=>b.createElement(g,{item:!0,...E,key:r.src,className:"photo-item"},e.jsx(he,{...r,selected:h[r.src],style:{objectFit:"cover",cursor:"pointer",transition:"all 0.3s",border:h[r.src]?`2px solid ${P.palette.primary.main}`:"2px solid transparent",WebkitUserDrag:"none",width:"100%",height:"100%"},onClick:()=>{$(r.src)},onDelete:()=>{M(r.src)}})))]})})}),e.jsxs(n,{sx:{mt:2,display:"flex",justifyContent:l?"space-between":"flex-end",button:{borderRadius:"30px",height:40,textTransform:"none"}},children:[l&&typeof l=="function"&&e.jsx(T,{color:"primary",variant:"outlined",onClick:l,children:e.jsx(ee,{})}),e.jsx(T,{color:"primary",variant:"contained",disabled:!R.length||x,onClick:()=>{const r=ne(d,"src");s(R.map(i=>r[i]))},children:R.length?j("aiImageSelectedUse"):j("aiImageSelectedTip")})]})]}):t?e.jsx(n,{width:220,height:220,m:"auto",children:p.loading&&e.jsx(O,{src:p.loading},"loading")}):e.jsx(n,{width:300,height:300,m:"auto",children:p.welcome&&e.jsx(O,{src:p.welcome},"welcome")});return e.jsx(we,{children:G()})}const we=I(n)`
|
|
97
|
+
min-height: 100%;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
|
|
101
|
+
.lazy-image-wrapper {
|
|
102
|
+
border-radius: 12px;
|
|
103
|
+
|
|
104
|
+
img {
|
|
105
|
+
border-radius: 12px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.tips {
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
display: -webkit-box;
|
|
112
|
+
-webkit-box-orient: vertical;
|
|
113
|
+
-webkit-line-clamp: 3;
|
|
114
|
+
}
|
|
115
|
+
`,ve=I(n)`
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
|
|
119
|
+
border: 1px solid;
|
|
120
|
+
border-color: ${({theme:t})=>t.palette.divider};
|
|
121
|
+
border-radius: 12px;
|
|
122
|
+
min-height: 100%;
|
|
123
|
+
|
|
124
|
+
&:has(.Mui-focused) {
|
|
125
|
+
border: 1px solid #a482fe;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
> .input {
|
|
129
|
+
padding: 12px;
|
|
130
|
+
font-weight: 500;
|
|
131
|
+
font-size: 16px;
|
|
132
|
+
line-height: 19px;
|
|
133
|
+
color: #25292f;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
> .footer {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: flex-end;
|
|
140
|
+
padding: 0 12px 12px;
|
|
141
|
+
|
|
142
|
+
> .counter {
|
|
143
|
+
flex: 1;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
text-overflow: ellipsis;
|
|
146
|
+
white-space: nowrap;
|
|
147
|
+
font-weight: 400;
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
line-height: 14px;
|
|
150
|
+
color: #9397a1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
> .copy {
|
|
154
|
+
height: 25px;
|
|
155
|
+
width: 25px;
|
|
156
|
+
min-width: 0;
|
|
157
|
+
padding: 0;
|
|
158
|
+
color: #9397a1;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`;function Be({onSelect:t,api:c,restrictions:s,i18n:o,theme:l}){const[f,x]=b.useState(),[u,a]=b.useState(!1),j=()=>x(void 0),d=()=>a(!1),y=oe(document.body);let m=!!(y&&y.width<768);if(!le())return e.jsx(n,{width:1,height:1,display:"flex",justifyContent:"center",alignItems:"center",children:o("aiKitRequired")});const k=!m||m&&!u,P=!m||m&&u,S=m?d:!1;return e.jsx(de,{restrictions:s,i18n:o,theme:l,children:e.jsx(n,{sx:{display:"flex",width:"100%",height:"100%",bgcolor:"background.default"},children:e.jsxs(g,{container:!0,sx:{flexGrow:1,height:"100%"},children:[e.jsx(g,{item:!0,xs:12,sm:4,sx:{borderRight:m?"none":p=>`1px solid ${p.palette.divider}`,display:k?"unset":"none"},children:e.jsx(n,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:e.jsx(pe,{onSubmit:(...p)=>{a(!0),x(...p)}})})}),e.jsx(g,{item:!0,xs:12,sm:8,sx:{height:"100%",overflow:"hidden",p:2,display:P?"unset":"none"},children:e.jsx(ye,{isMobile:m,options:f,handleApi:c,onSelect:t,onFinish:j,onClose:S})})]})})})}export{Be as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C}from"./vendor-react-DEoibe3W.js";import{u as I,$ as F,n as oe,a as N,b5 as xe,aq as ce,bQ as ae,b7 as fe,aD as ge,bx as
|
|
1
|
+
import{r as C}from"./vendor-react-DEoibe3W.js";import{u as I,$ as F,n as oe,a as N,b5 as xe,aq as ce,bQ as ae,b7 as fe,aD as ge,bx as he,c5 as ye,ab as je}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{r as le}from"./passport-item-BqMiGQDS.js";import{l as $,z as B,aF as be,C as Ce,f as ke}from"./index-cTHEQKxV.js";import{u as _}from"./dashboard-BoKAftfy.js";import{j as e,H as j,bp as O,bs as G,bo as H,q as Q,aa as f,al as V,O as M,ab as J,bt as ve,bS as Ke,ah as P,T as z,ad as re,ak as Te}from"./vendor-mui-core-BKQDHvL6.js";import{O as Ae,$ as Se}from"./vendor-arcblock-TgIfa3ko.js";import{T as de}from"./index-PVfL4XCf.js";import{C as me}from"./confirm-BdypMD8p.js";import{$ as we}from"./vendor-utils-CjMBJT5V.js";import{C as E}from"./click-to-copy-BxPDzy5A.js";import{D as De}from"./delete-confirm-DmVgGU7R.js";import{d as Ie}from"./Edit-CJyJLpRB.js";import{P as Re}from"./permission-CC2IdTdZ.js";import{m as $e,G as Be}from"./vendor-hooks-DXGUREV9.js";import{U as _e,C as ze,I as Ne}from"./index-BLdu7KNf.js";import{B as Pe}from"./bundle-avatar-Cb1gLIQK.js";import{p as qe}from"./util-BXETl5KI.js";import{W as ie}from"./did-address-CaOBKHpX.js";import{f as Le}from"./format-error-BrmqJs5a.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-vveKfojd.js";import"./PlayArrow-gSxq4eiM.js";import"./get-safe-url-BBjUrzRU.js";import"./session-C3Z84LF2.js";import"./use-blocklet-logo-32yq4Y7I.js";import"./InfoOutlined-CoMCPk7a.js";import"./dot-DNqoPOFy.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DbhbAmWG.js";import"./vendor-mui-x-Db_Ss6fv.js";import"./AdapterDayjs-QizZbjYO.js";import"./Phone-alkdVkQC.js";import"./Location-afhZgOLn.js";import"./Email-CXOl4bM_.js";import"./Timezone-6KelONy7.js";import"./base32-M2-tdl6O.js";function X({value:t}){const{t:s,locale:u}=I(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(F,{value:t,locale:u}),`${s("setting.accessKey.expired",{time:""})}`]}):$(t,u)}X.propTypes={value:j.string.isRequired};function Y({value:t,onChange:s,...u}){const{t:l}=I(),d=C.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...u,children:[e.jsx(G,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(n=>e.jsx(Q,{value:n.value,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}Y.propTypes={value:j.string.isRequired,onChange:j.func.isRequired};const L=()=>{const t=oe.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=B(),{roles:u}=_(),l=[...t,...s?u:[]];return we(l,"name").filter(d=>d.name!==oe.ROLES.OWNER)};function Z(t){const{remark:s,onCreate:u}=t,{api:l}=B(),{teamDid:d}=_(),{t:n}=I(),[v,g]=C.useState(!1),[i,c]=C.useState(null),T=L(),k=()=>{g(!1),c(null)},b=async a=>{const{remark:h,passport:m,authType:o}=a;g(!0);const p=await l.createAccessKey({input:{teamDid:d,remark:h.trim(),passport:m,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:o}}),{data:w}=p;u(w),c(null),g(!1)},x={title:`${n("common.create")} ${n("accessKey")}`,description:(a,h,m)=>e.jsxs(V,{gap:3,children:[e.jsx(M,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:o=>{h({...a,remark:o.target.value,__disableConfirm:!a.passport||!o.target.value.trim()}),o.target.value.trim()?m(""):m(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:o=>{const p=o.target.value;m(null),h({...a,passport:p,__disableConfirm:!a.remark||!p})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:v,children:T.map(o=>e.jsx(Q,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:o.description})]})},o.name))})]}),e.jsx(Y,{value:a.authType,onChange:o=>{h({...a,authType:o.target.value})}}),e.jsx(de,{placeholder:n("setting.accessKey.expireTime"),value:a.expireAt,onChange:o=>{h({...a,expireAt:o,__disableConfirm:!a.passport||!a.remark||!o})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:b,onCancel:k};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>c(x),className:"rule-action",children:[v?e.jsx(J,{size:16}):e.jsx(Ae,{style:{fontSize:16}}),n("common.create")]}),i&&e.jsx(me,{title:i.title,description:i.description,confirm:i.confirm,color:i.color,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}Z.propTypes={remark:j.string,onCreate:j.func};Z.defaultProps={onCreate:()=>{},remark:""};function ee(t){const{onConfirm:s,accessKeyId:u,accessKeySecret:l,hideSecret:d}=t,{t:n}=C.useContext(xe),[v,g]=C.useState(!1),[i,c]=C.useState(()=>d),T=()=>{c(!i)},k=a=>{g(a.target.checked)},b=C.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
|
|
2
2
|
|
|
3
3
|
const client = new Client(fullEndpoint);
|
|
4
4
|
client.setAuthAccessKey({
|
|
@@ -16,14 +16,14 @@ client.setAuthAccessKey({
|
|
|
16
16
|
`,Ue=P.div`
|
|
17
17
|
font-size: 16px;
|
|
18
18
|
font-weight: bold;
|
|
19
|
-
`;function te(t){const{t:s,locale:u}=I(),{api:l}=B(),{teamDid:d}=_(),[n,v]=C.useState(!1),[g,i]=C.useState(null),{accessKeyId:c,time:T,remark:k,onDelete:b=()=>{}}=t,x=()=>{v(!1),i(null)},a=async()=>{v(!0);try{await l.deleteAccessKey({input:{teamDid:d,accessKeyId:c}}),b()}catch(o){console.error(o)}finally{v(!1),i(null)}},
|
|
19
|
+
`;function te(t){const{t:s,locale:u}=I(),{api:l}=B(),{teamDid:d}=_(),[n,v]=C.useState(!1),[g,i]=C.useState(null),{accessKeyId:c,time:T,remark:k,onDelete:b=()=>{}}=t,x=()=>{v(!1),i(null)},a=async()=>{v(!0);try{await l.deleteAccessKey({input:{teamDid:d,accessKeyId:c}}),b()}catch(o){console.error(o)}finally{v(!1),i(null)}},h=o=>({key:`<b>${c}</b>`,name:`<b>${k}</b>`,time:$(o,u),timeAge:Se(new Date(o),be(u))}),m={keyName:k,title:s("setting.accessKey.title"),description:T?`${s("setting.accessKey.description",h(T))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${c}</b>`,name:`<b>${k}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:k}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:a,onCancel:x};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{edge:"end",onClick:o=>{o.stopPropagation(),i(m)},size:"small",className:"rule-action",color:"error",children:[n?e.jsx(J,{size:16}):e.jsx(fe,{style:{fontSize:16}}),s("common.delete")]}),g&&e.jsx(De,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}te.propTypes={accessKeyId:j.string.isRequired,time:j.string.isRequired,remark:j.string.isRequired,onDelete:j.func};te.defaultProps={onDelete:()=>{}};function se(t){const{accessKeyId:s,remark:u,onUpdate:l,passport:d,expireAt:n,authType:v}=t,{api:g}=B(),{teamDid:i}=_(),{t:c}=I(),[T,k]=C.useState(!1),[b,x]=C.useState(null),a=L(),h=()=>{k(!1),x(null)},m=async p=>{const{accessKeyId:w,remark:R="",passport:y,expireAt:D,authType:q}=p;k(!0),await g.updateAccessKey({input:{teamDid:i,accessKeyId:w,remark:R.trim(),passport:y,expireAt:D?new Date(D).getTime():null,authType:q}}),l(),x(null),k(!1)},o={title:`${c("common.update")} ${c("accessKey")}`,description:(p,w,R)=>e.jsxs(V,{gap:3,children:[e.jsx(M,{label:c("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:p.accessKeyId,disabled:!0}),e.jsx(M,{label:c("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:p.remark,onChange:y=>{w({...p,remark:y.target.value,__disableConfirm:!y.target.value.trim()}),y.target.value.trim()?R(""):R(c("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:c("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"update-access-key-select-passport",value:p.passport,onChange:y=>{const D=y.target.value;R(null),w({...p,passport:D,__disableConfirm:!p.remark||!D})},fullWidth:!0,label:c("setting.accessKey.passport"),disabled:T,children:a.map(y=>e.jsx(Q,{value:y.name,"data-cy":`update-access-key-passport-option-${y.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:y.title||y.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:y.description})]})},y.name))})]}),e.jsx(Y,{disabled:!0,value:p.authType,onChange:y=>{w({...p,authType:y.target.value})}}),e.jsx(de,{placeholder:c("setting.accessKey.expireTime"),value:p.expireAt,onChange:y=>{w({...p,expireAt:y,__disableConfirm:!p.passport||!p.remark||!y})}})]}),confirm:c("common.confirm"),cancel:c("common.cancel"),color:"primary",params:{accessKeyId:s,remark:u,passport:d,expireAt:n,authType:v},onConfirm:m,onCancel:h};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{edge:"end",onClick:p=>{p.stopPropagation(),x(o)},size:"small",className:"rule-action",color:"primary",children:[T?e.jsx(J,{size:16}):e.jsx(Ie,{style:{fontSize:16}}),c("common.update")]}),b&&e.jsx(me,{title:b.title,description:b.description,confirm:b.confirm,color:b.color,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]})}se.propTypes={accessKeyId:j.string.isRequired,remark:j.string,passport:j.string,expireAt:j.string,authType:j.string,onUpdate:j.func};se.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature"};function ne({accessKey:t,onCancel:s}){const{t:u}=I();return e.jsx(ce,{title:u("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(We,{children:e.jsx(pe,{accessKey:t})})})}ne.propTypes={accessKey:j.object.isRequired,onCancel:j.func.isRequired};ne.defaultProps={};const We=P(f)`
|
|
20
20
|
margin-top: -16px;
|
|
21
21
|
|
|
22
22
|
.tabs {
|
|
23
23
|
margin-left: 0;
|
|
24
24
|
margin-right: 0;
|
|
25
25
|
}
|
|
26
|
-
`;function pe({accessKey:t}){var a,
|
|
26
|
+
`;function pe({accessKey:t}){var a,h;const{t:s,locale:u}=I(),{api:l}=B(),{teamDid:d}=_(),{blocklet:n}=Ce(),v=L(),g=C.useCallback(async m=>m?(await l.getUser({input:{teamDid:d,user:{did:m}}})).user:null,[l,d]),i=$e(()=>g(t.createdBy),{}),c=((n==null?void 0:n.children)||[]).find(m=>{var o;return((o=m==null?void 0:m.meta)==null?void 0:o.did)===t.componentDid}),T=C.useMemo(()=>{var m;return qe((m=i==null?void 0:i.data)==null?void 0:m.avatar,d,!0)},[(a=i==null?void 0:i.data)==null?void 0:a.avatar,d]),k=v.find(m=>m.name===t.passport),b=k?k.title:t.passport,x=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(ie,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(E,{children:`blocklet-${ge.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(f,{children:le(b,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:i!=null&&i.data?e.jsx(f,{sx:{display:"flex",alignItems:"center",".MuiAvatar-root":{width:32,height:32}},children:e.jsx(_e,{user:{...i.data,avatar:T},showDid:!0,cardType:ze.Detailed,infoType:Ne.Minimal,sx:{border:0,padding:0}})}):t.createdBy?e.jsx(ie,{did:t.createdBy,showQrcode:!0}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?$(t.createdAt,u):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?$(t.lastUsedAt,u):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(X,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...c?[{label:s("setting.accessKey.component"),content:e.jsxs(f,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Pe,{blocklet:c,ancestors:[n]}),e.jsx(f,{ml:"16px",sx:{minWidth:0},children:e.jsxs(f,{className:"component-header",children:[e.jsx(f,{className:"component-name",children:ke.getDisplayName(c,!0)}),e.jsx(f,{className:"component-version",children:(h=c==null?void 0:c.meta)==null?void 0:h.version})]})})]},c)}]:[]]}];return e.jsx(Fe,{gap:3,children:e.jsx(f,{className:"info-area",children:x.map(m=>e.jsxs(f,{mb:3,children:[e.jsx(z,{variant:"h6",sx:{mb:1.5},children:m.title}),e.jsx(f,{className:"info-grid",children:m.items.map(o=>e.jsxs(f,{className:"info-item",children:[e.jsx(f,{className:"info-label",children:e.jsx(z,{variant:"subtitle2",color:"textSecondary",children:o.label})}),e.jsx(f,{children:o.content})]},o.label))})]},m.title))})})}pe.propTypes={accessKey:j.object.isRequired};const Fe=P(V)`
|
|
27
27
|
.info-card {
|
|
28
28
|
margin-bottom: 24px;
|
|
29
29
|
overflow: hidden;
|
|
@@ -96,4 +96,4 @@ client.setAuthAccessKey({
|
|
|
96
96
|
margin: 0;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
`;function St(){var D,q;const{t,locale:s}=I(),{api:u,inService:l}=B(),{teamDid:d}=_(),[n,v]=C.useState({}),[g,i]=C.useState(null),c=L(),T=C.useRef(null),k=`access-keys-${d}`,b=
|
|
99
|
+
`;function St(){var D,q;const{t,locale:s}=I(),{api:u,inService:l}=B(),{teamDid:d}=_(),[n,v]=C.useState({}),[g,i]=C.useState(null),c=L(),T=C.useRef(null),k=`access-keys-${d}`,b=he(k),[x,a]=C.useState({searchText:b.searchText||"",pageSize:b.rowsPerPage||10,page:1}),h=Be(async()=>await u.getAccessKeys({input:{teamDid:d,paging:{page:x.page,pageSize:x.pageSize}}}),[x.page,x.pageSize]),{loading:m,error:o}=h,p=C.useMemo(()=>{var r;return((r=h.value)==null?void 0:r.list)||[]},[(D=h.value)==null?void 0:D.list]),w=C.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(r,{rowIndex:A})=>{const K=p[A];return e.jsx(f,{display:"flex",alignItems:"center",gap:2,children:e.jsx(z,{children:K.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:r=>e.jsx(ye,{showDidLogo:!1,children:r})}},{label:t("common.role"),name:"passport",options:{customBodyRender:r=>{const A=c.find(S=>S.name===r),K=A?A.title:r;return e.jsx(f,{children:le(K,r)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:r=>e.jsx(z,{children:r})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:r=>e.jsx(z,{children:t(`setting.accessKey.${r}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:r=>e.jsx(re,{title:$(r,s),children:r?e.jsx(F,{value:r,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:r=>e.jsx(re,{title:$(r,s),children:r?e.jsx(F,{value:r,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:r=>r?e.jsx(X,{value:r}):t("common.neverExpired")}},{label:t("common.actions"),name:"actions",width:100,options:{customBodyRender:(r,{rowIndex:A})=>{const K=p[A];return e.jsxs(f,{display:"flex",gap:1,children:[e.jsx(se,{...K,onUpdate:h.retry}),e.jsx(te,{accessKeyId:K.accessKeyId,time:K.lastUsedAt,remark:K.remark||"N/A",onDelete:h.retry})]})}}}],[p,s,t,h.retry,c]),R=({page:r,rowsPerPage:A,searchText:K})=>{x.pageSize!==A?a(S=>({...S,searchText:"",pageSize:A,page:1})):x.page!==r+1?a(S=>({...S,searchText:"",page:r+1})):x.searchText!==K&&a(S=>({...S,searchText:K,page:1}))},y=x.searchText?p.filter(r=>r.accessKeyId.toLowerCase().includes(x.searchText.toLowerCase())||(r.remark||"").toLowerCase().includes(x.searchText.toLowerCase())):p;return o?e.jsx(Te,{severity:"error",children:Le(o)}):e.jsxs(f,{ref:T,sx:{".custom-toobar-btns":{gap:"8px"}},children:[e.jsx(je,{durable:k,durableKeys:["page","rowsPerPage"],data:y,columns:w,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:x.page-1,rowsPerPage:x.pageSize,count:((q=h.value)==null?void 0:q.count)||0,searchDebounceTime:600,onRowClick(r,{dataIndex:A},K){var S;if((S=T.current)!=null&&S.contains(K.target)){const ue=y[A];i(ue)}}},loading:m,onChange:R,customButtons:[e.jsx(Re,{permission:l?"":"mutate_accessKey",children:e.jsx(Z,{onCreate:r=>{const{accessKeyId:A,accessKeySecret:K,authType:S}=r;v({show:!0,accessKeyId:A,accessKeySecret:K,authType:S})}})})]}),n.show&&e.jsx(ee,{hideSecret:n.authType==="signature",onConfirm:()=>{h.retry(),v({show:!1})},...n}),g&&e.jsx(ne,{onCancel:()=>i(null),accessKey:g})]})}export{St as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as j}from"./vendor-react-DEoibe3W.js";import{j as e,H as d,a9 as Pe,ad as jt,T as J,aa as C,E as _e,bp as Fe,bA as et,bR as Te,bt as Re,bS as Ie,y as Se,b4 as Ee,ab as tt,ah as ce,a1 as st,m as yt,bd as Xe,bs as vt,bo as St,q as Ze,bZ as Ct}from"./vendor-mui-core-B6POpIBB.js";import{e as ie,aA as ue,C as Nt}from"./vendor-utils-CjMBJT5V.js";import{a2 as Z,n as P,ba as wt,r as ke,F as Tt,u as te,bT as Rt,a1 as nt,a as De,ab as at,bq as je,aq as It,av as Et,bx as Dt}from"./vendor-ux-did-connect-CeGz2B7G.js";import{z as At,t as V,l as Ot,I as Je}from"./index-DMRB_27Q.js";import{f as ee,a as Ae}from"./vendor-hooks-DXGUREV9.js";import{S as he}from"./shorten-label-SbKUBkvs.js";import{I as it}from"./index-aGp3zmpA.js";import{A as Lt,S as Pt,a as _t,b as Ft,B as kt}from"./list-VlrLfNLt.js";import{R as Be}from"./relative-time-Ca1sd_aF.js";import{a as ze}from"./dashboard-DyRSlDZ8.js";import{W as Bt}from"./did-address-DXsoioR-.js";import{p as ot}from"./util-CxKY-YuQ.js";import{D as zt,g as Wt}from"./traffic-cstjgILR.js";import{i as qt,b as Mt}from"./use-blocklet-logo-ZrVs0Fgp.js";import{B as rt}from"./bundle-avatar-DB3E7EOv.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DpCuGvAS.js";import"./index-DIe9psLc.js";import"./sdk-DGCdjl0b.js";import"./InfoOutlined-hS_Bn_IB.js";import"./CheckCircle-msbMBqZj.js";import"./index-WYf-xVMZ.js";import"./Phone-CKzC4712.js";import"./Location-BQhEvGNL.js";import"./Email-B0n6rLUZ.js";import"./Timezone-C3hiNX6j.js";import"./useLocalStorage-B_V0diy4.js";import"./confirm-oEG91BF3.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-CeIK7-yb.js";import"./get-safe-url-DGnHBj8n.js";import"./session-B_RsakU4.js";import"./dot-WAAJ-O65.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BNUwcWCH.js";import"./base32-CwrkOaA2.js";import"./iframe-CsfqLmob.js";import"./LaunchOutlined-DwFeZSV7.js";import"./ChevronLeft-DmV9D3fU.js";import"./ChevronRight-Br0ablb7.js";import"./index-BUHlfcy3.js";import"./vendor-mui-x-CATHW1QL.js";import"./AdapterDayjs-Bxdv5BBD.js";const lt=j.createContext({}),{Provider:Kt,Consumer:mn}=lt;function $t({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[a,x]=j.useState([]),[u,R]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=j.useState([]),[I,q]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const _={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...M}=_;let Q="";B&&B.includes("system")&&(Q="system");const z=B?B.filter(f=>f!=="system"):[],oe={...M,source:Q,componentDids:z},se=await n.getNotificationSendLog({input:oe});return q(oe),x(se.list),R(se.paging),se.list}catch(_){return Z.error(_.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var _;return((_=A.meta)==null?void 0:_.did)===h});if(O)return O.ancestors=[s],O},[s]),$=async({notificationId:h,receivers:O,channels:A,..._})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),..._}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const _={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:_})}catch(_){throw Z.error(_.message),_}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:$,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(Kt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(wt,{type:Ht[t],children:t})}var qe={},Ut=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Vt=Ut(ke()),Gt=e;ct=qe.default=(0,Vt.default)((0,Gt.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 Me={},Yt=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var dt=Me.default=void 0,Xt=Yt(ke()),Zt=e;dt=Me.default=(0,Xt.default)((0,Zt.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 Ke={},Jt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Qt=Jt(ke()),es=e;ut=Ke.default=(0,Qt.default)((0,es.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 ts=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Ot(o,s)}):"",R=ts(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===P.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Qe=["info","success","error","warning"],ft=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},mt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},ss=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ns=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},as=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),is=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),os=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},rs=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ls=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>Tt({typography:{fontSize:14,button:{textTransform:"none"}},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 ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,R=[a,u].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(J,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(a=>{const x=pt(r,o,{status:a});return e.jsx(_e,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:R=>{const m=[...t];R.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx($e,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=pt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}He.propTypes={value:d.array.isRequired,onChange:d.func};function He({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Z.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Z.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Je(t[0],n)," - ",Je(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Wt(r),onChange:R})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Rt.TableFilterList,{...s,ItemComponent:t})})]})}function Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(_e,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const cs=[{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}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(cs),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(q=>({...q,checked:q.value===S.value?S.checked:q.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(J,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>R(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=We(),[v,S]=j.useState(!1),[I,q]=j.useState([]),E=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[D,G]=j.useState(null),[$,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{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"}],_=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));q(l),H(i.paging),S(!1)}catch(i){Z.error(i.message),S(!1)}};j.useEffect(()=>{_()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},M=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Q={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:M},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],U=[],K=[]]=y;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue(U,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:U,page:1})):k(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?as(c):i==="email"?ss(m,c):i==="pushKit"?ns(m,c):i==="webhook"?is(c):!0:!1},[R,m]),se=j.useCallback(i=>os(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Z.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),rs(l,c)>=4){Z.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Nt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Z.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,y)=>{i.stopPropagation();const F=c.filter(U=>U!==l);k(U=>({...U,[y]:F,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(Bt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,F]=c,U=F[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:y},y),e.jsx(de,{status:U.status,updatedAt:U.sendAt,reason:U.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(He,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(us,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Q,customButtons:Ye,components:{TableFilterList:i=>e.jsx(Ue,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ps,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,U;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(U=D==null?void 0:D.result)!=null&&U[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:y})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:b})})]})})})}const ds=j.memo(gt),us=ce.div`
|
|
1
|
+
import{r as j}from"./vendor-react-DEoibe3W.js";import{j as e,H as d,a9 as Pe,ad as jt,T as J,aa as C,E as _e,bp as Fe,bA as et,bR as Te,bt as Re,bS as Ie,y as Se,b4 as Ee,ab as tt,ah as ce,a1 as st,m as yt,bd as Xe,bs as vt,bo as St,q as Ze,bZ as Ct}from"./vendor-mui-core-BKQDHvL6.js";import{e as ie,aA as ue,C as Nt}from"./vendor-utils-CjMBJT5V.js";import{a2 as Z,n as P,ba as wt,r as ke,F as Tt,u as te,bT as Rt,a1 as nt,a as De,ab as at,bq as je,aq as It,av as Et,bx as Dt}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{z as At,t as V,l as Ot,I as Je}from"./index-cTHEQKxV.js";import{f as ee,a as Ae}from"./vendor-hooks-DXGUREV9.js";import{S as he}from"./shorten-label-BhyIJhRI.js";import{I as it}from"./index-DisBCigl.js";import{A as Lt,S as Pt,a as _t,b as Ft,B as kt}from"./list-DjGDmcyZ.js";import{R as Be}from"./relative-time-DTDqch3x.js";import{a as ze}from"./dashboard-BoKAftfy.js";import{W as Bt}from"./did-address-CaOBKHpX.js";import{p as ot}from"./util-BXETl5KI.js";import{D as zt,g as Wt}from"./traffic-gSZZSuR6.js";import{i as qt,b as Mt}from"./use-blocklet-logo-32yq4Y7I.js";import{B as rt}from"./bundle-avatar-Cb1gLIQK.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-TgIfa3ko.js";import"./index-DF637rKa.js";import"./sdk-CtDt6ZE4.js";import"./InfoOutlined-CoMCPk7a.js";import"./CheckCircle-CJmQq3zs.js";import"./index-BLdu7KNf.js";import"./Phone-alkdVkQC.js";import"./Location-afhZgOLn.js";import"./Email-CXOl4bM_.js";import"./Timezone-6KelONy7.js";import"./useLocalStorage-vveKfojd.js";import"./confirm-BdypMD8p.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-gSxq4eiM.js";import"./get-safe-url-BBjUrzRU.js";import"./session-C3Z84LF2.js";import"./dot-DNqoPOFy.js";import"./useAsync-GjVghrwi.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DbhbAmWG.js";import"./base32-M2-tdl6O.js";import"./iframe-BuwO7sH1.js";import"./LaunchOutlined-CypNgDc2.js";import"./ChevronLeft-BWWdEYiT.js";import"./ChevronRight-tpAiXojW.js";import"./index-Dz5GK-zs.js";import"./vendor-mui-x-Db_Ss6fv.js";import"./AdapterDayjs-QizZbjYO.js";const lt=j.createContext({}),{Provider:Kt,Consumer:mn}=lt;function $t({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[a,x]=j.useState([]),[u,R]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=j.useState([]),[I,q]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const _={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...M}=_;let Q="";B&&B.includes("system")&&(Q="system");const z=B?B.filter(f=>f!=="system"):[],oe={...M,source:Q,componentDids:z},se=await n.getNotificationSendLog({input:oe});return q(oe),x(se.list),R(se.paging),se.list}catch(_){return Z.error(_.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var _;return((_=A.meta)==null?void 0:_.did)===h});if(O)return O.ancestors=[s],O},[s]),$=async({notificationId:h,receivers:O,channels:A,..._})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),..._}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const _={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:_})}catch(_){throw Z.error(_.message),_}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:$,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(Kt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(wt,{type:Ht[t],children:t})}var qe={},Ut=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Vt=Ut(ke()),Gt=e;ct=qe.default=(0,Vt.default)((0,Gt.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 Me={},Yt=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var dt=Me.default=void 0,Xt=Yt(ke()),Zt=e;dt=Me.default=(0,Xt.default)((0,Zt.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 Ke={},Jt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Qt=Jt(ke()),es=e;ut=Ke.default=(0,Qt.default)((0,es.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 ts=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Ot(o,s)}):"",R=ts(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===P.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Qe=["info","success","error","warning"],ft=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},mt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},ss=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ns=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},as=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),is=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),os=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},rs=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ls=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>Tt({typography:{fontSize:14,button:{textTransform:"none"}},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 ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,R=[a,u].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(J,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(a=>{const x=pt(r,o,{status:a});return e.jsx(_e,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:R=>{const m=[...t];R.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx($e,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=pt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}He.propTypes={value:d.array.isRequired,onChange:d.func};function He({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Z.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Z.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Je(t[0],n)," - ",Je(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Wt(r),onChange:R})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Rt.TableFilterList,{...s,ItemComponent:t})})]})}function Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(_e,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const cs=[{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}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(cs),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(q=>({...q,checked:q.value===S.value?S.checked:q.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(J,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>R(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=We(),[v,S]=j.useState(!1),[I,q]=j.useState([]),E=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[D,G]=j.useState(null),[$,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{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"}],_=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));q(l),H(i.paging),S(!1)}catch(i){Z.error(i.message),S(!1)}};j.useEffect(()=>{_()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},M=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Q={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:M},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],U=[],K=[]]=y;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue(U,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:U,page:1})):k(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?as(c):i==="email"?ss(m,c):i==="pushKit"?ns(m,c):i==="webhook"?is(c):!0:!1},[R,m]),se=j.useCallback(i=>os(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Z.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),rs(l,c)>=4){Z.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Nt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Z.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,y)=>{i.stopPropagation();const F=c.filter(U=>U!==l);k(U=>({...U,[y]:F,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(Bt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,F]=c,U=F[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:y},y),e.jsx(de,{status:U.status,updatedAt:U.sendAt,reason:U.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(He,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(us,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Q,customButtons:Ye,components:{TableFilterList:i=>e.jsx(Ue,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ps,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,U;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(U=D==null?void 0:D.result)!=null&&U[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:y})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:b})})]})})})}const ds=j.memo(gt),us=ce.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{H as i,ah as v,j as s,bI as A,aa as N,ab as D,s as E}from"./vendor-mui-core-
|
|
1
|
+
import{H as i,ah as v,j as s,bI as A,aa as N,ab as D,s as E}from"./vendor-mui-core-BKQDHvL6.js";import{a as $,l as q,u as b,m as M}from"./vendor-hooks-DXGUREV9.js";import{a as U,R as F}from"./vendor-arcblock-TgIfa3ko.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b5 as H,aq as B,u as j,aU as O,n as Y,b6 as S,a1 as W}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{t as V,v as X,w as L,x as z}from"./index-cTHEQKxV.js";import{A as J}from"./vendor-utils-CjMBJT5V.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as G}from"./session-C3Z84LF2.js";import{b as Q}from"./sdk-CtDt6ZE4.js";import{d as Z}from"./CheckCircle-CJmQq3zs.js";import{w as ee}from"./wrap-locale-B29V1TgE.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(H),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),r=m.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&s.jsx(U,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(A,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
max-width: 350px;
|
|
4
4
|
margin: 30px auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,aa as g}from"./vendor-mui-core-
|
|
1
|
+
import{j as i,aa as g}from"./vendor-mui-core-BKQDHvL6.js";import{f as x,r as u}from"./vendor-react-DEoibe3W.js";import{u as v}from"./vendor-hooks-DXGUREV9.js";import{I as w}from"./invitation-D-b5Vxj9.js";import{L as I}from"./landing-page-xXstO1rJ.js";import{u as S,aW as P,n as T}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{H as j}from"./vendor-arcblock-TgIfa3ko.js";import{g as k}from"./get-safe-url-zHRp3aBu.js";import{u as E,d as L,c as W,s as R,a as C}from"./index-cTHEQKxV.js";import"./vendor-utils-CjMBJT5V.js";import"./use-passport-id-B-b-_oYF.js";import"./session-C3Z84LF2.js";import"./sdk-CtDt6ZE4.js";import"./CheckCircle-CJmQq3zs.js";import"./wrap-locale-B29V1TgE.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(R(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&P(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(T.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(j,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>W({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ab as w,aa as v}from"./vendor-mui-core-
|
|
1
|
+
import{j as e,ab as w,aa as v}from"./vendor-mui-core-BKQDHvL6.js";import{a as I,m as P,u as p}from"./vendor-hooks-DXGUREV9.js";import{I as T}from"./invitation-D-b5Vxj9.js";import{L as j}from"./landing-page-xXstO1rJ.js";import{u as k,aW as R,n as S}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{H as L}from"./vendor-arcblock-TgIfa3ko.js";import{g as E}from"./get-safe-url-zHRp3aBu.js";import{u as W,c as C,s as F,a as N}from"./index-cTHEQKxV.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-CjMBJT5V.js";import"./use-passport-id-B-b-_oYF.js";import"./session-C3Z84LF2.js";import"./sdk-CtDt6ZE4.js";import"./CheckCircle-CJmQq3zs.js";import"./wrap-locale-B29V1TgE.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=W(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),g=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:C,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};
|