@abtnode/blocklet-services 1.17.5 → 1.17.6-beta-20251216-081847-bf91c4db
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/libs/connect/session.js +6 -9
- package/api/routes/federated.js +2 -2
- package/dist/assets/AdapterDayjs-Bfr4sW4C.js +3 -0
- package/dist/assets/{Community-C7CFokDQ.js → Community-CELsDteM.js} +1 -1
- package/dist/assets/{Google-qCiUM9VP.js → Google-DA3WTnLE.js} +1 -1
- package/dist/assets/{Holiday-DyVifdc-.js → Holiday-DOCjSYjH.js} +1 -1
- package/dist/assets/{Meeting-DbtUCCZq.js → Meeting-BAXt_LiK.js} +1 -1
- package/dist/assets/{OffSick-BtITykO3.js → OffSick-BGEr8Nkc.js} +1 -1
- package/dist/assets/{WorkingRemotely-mKvokr6L.js → WorkingRemotely-BcneAIXG.js} +1 -1
- package/dist/assets/access-control-BZvc7AZG.js +14 -0
- package/dist/assets/actions-Dfiiwkit.js +1 -0
- package/dist/assets/{add-component-core-CFL73x1V.js → add-component-core-CNH5E2RR.js} +1 -1
- package/dist/assets/add-resource-BWEvlWkH.js +1 -0
- package/dist/assets/addon-uM70Qwac.js +14 -0
- package/dist/assets/{advanced-Djs25PXG.js → advanced-Caeqx4XB.js} +1 -1
- package/dist/assets/aigne-B9drp8Pq.js +10 -0
- package/dist/assets/api-C75sLx9p.js +1 -0
- package/dist/assets/appearance-DM7p-6Wl.js +1 -0
- package/dist/assets/arrow-down.svg-C4FUKwt4.js +1 -0
- package/dist/assets/{audit-logs-CXjhDj8M.js → audit-logs-L-gO50KL.js} +2 -2
- package/dist/assets/authorize-D2d4GCpP.js +1 -0
- package/dist/assets/{base-chart-BXspUQ5X.js → base-chart-DSDnGziZ.js} +1 -1
- package/dist/assets/{base32-E_M8YiDy.js → base32-B-7CnEFd.js} +1 -1
- package/dist/assets/bind-account-DuzArGdZ.js +1 -0
- package/dist/assets/{branding-B6_O9dwM.js → branding-Dx40btDl.js} +1 -1
- package/dist/assets/{branding-BN5xzu2K.js → branding-aCdIMhb0.js} +5 -5
- package/dist/assets/branding-bYH66Nug.js +1 -0
- package/dist/assets/bundle-avatar-B1jZNqcH.js +1 -0
- package/dist/assets/button-BnSiFtNt.js +1 -0
- package/dist/assets/click-to-copy-CwdgHxjB.js +1 -0
- package/dist/assets/cloneDeep-B_fYlLpl.js +1 -0
- package/dist/assets/{collapse-DRXViE1U.js → collapse-B7gUzFaX.js} +1 -1
- package/dist/assets/{complete-DERkCyic.js → complete-Rr-_Zaon.js} +3 -3
- package/dist/assets/{component-BFEXoFyD.js → component-DZretbSC.js} +2 -2
- package/dist/assets/{config-DBQhYXkx.js → config-Bjbv_xI5.js} +1 -1
- package/dist/assets/config-BkqISfFO.js +53 -0
- package/dist/assets/{config-mfnTXE1f.js → config-Dw0qq-09.js} +2 -2
- package/dist/assets/{config-navigation-CL9YkEzl.js → config-navigation-Dj8qf6cK.js} +8 -8
- package/dist/assets/config-space-Dw6ITGIj.js +1 -0
- package/dist/assets/confirm-Bpit6U3-.js +7 -0
- package/dist/assets/{connect-DXN8mBKc.js → connect-B1ZA3nS8.js} +1 -1
- package/dist/assets/connect-Bl7-1lbc.js +1 -0
- package/dist/assets/connect-to-BsxW3JJi.js +1 -0
- package/dist/assets/{content-layout-B5NObRcH.js → content-layout-DmSBGGVm.js} +1 -1
- package/dist/assets/{create-passport-svg-BwqsyTOz.js → create-passport-svg-DGPNsGUE.js} +1 -1
- package/dist/assets/createClass-B5uCYz0o.js +1 -0
- package/dist/assets/{dashboard-DHhNID_3.js → dashboard-DBwE7l6f.js} +7 -7
- package/dist/assets/{delete-confirm-DSQSBte5.js → delete-confirm-L0HXJtqt.js} +1 -1
- package/dist/assets/did-address-uvYuZ4wv.js +1 -0
- package/dist/assets/domain-BoEowNlU.js +9 -0
- package/dist/assets/domain-action-card-BB0jQwcH.js +28 -0
- package/dist/assets/domains-kgzxNW_C.js +1 -0
- package/dist/assets/{edit.svg-Dz9cVo7r.js → edit.svg-RRSklUg-.js} +1 -1
- package/dist/assets/{email-DDHqRiNE.js → email-BAr61Jer.js} +2 -2
- package/dist/assets/{empty-spinner-0EAHJWBW.js → empty-spinner-BYDonf35.js} +1 -1
- package/dist/assets/engine-DWk3y4cO.js +1 -0
- package/dist/assets/exchange-passport-BuJUAVgN.js +1 -0
- package/dist/assets/{form-C-ZRaynb.js → form-kdwSU-mv.js} +3 -3
- package/dist/assets/form-text-input-B_h8beXh.js +11 -0
- package/dist/assets/{form-wrapper-dz0PgYyA.js → form-wrapper-PT5ZzMQy.js} +1 -1
- package/dist/assets/fuel-C9kfBZ4R.js +32 -0
- package/dist/assets/gen-access-key-Bh-o1OFU.js +1 -0
- package/dist/assets/gen-simple-access-key-DHmIlRFl.js +1 -0
- package/dist/assets/get-safe-url-gaxZoVzJ.js +1 -0
- package/dist/assets/{home-D8RPk4rl.js → home-Cb5I193s.js} +1 -1
- package/dist/assets/{iframe-DbxlfoSv.js → iframe-C233G1py.js} +1 -1
- package/dist/assets/{index-Dnont80V.js → index-B0Q9wWG1.js} +2 -2
- package/dist/assets/{index-BfyoUnq5.js → index-B7DVpLRM.js} +34 -34
- package/dist/assets/index-BScxMPlP.js +1 -0
- package/dist/assets/{index-CiQvt8QY.js → index-BT70k77_.js} +2 -2
- package/dist/assets/index-BaaFi7Vh.js +1 -0
- package/dist/assets/{index-CmT6o_W4.js → index-Bf3Peb0q.js} +5 -5
- package/dist/assets/{index-BIFlvVef.js → index-C-vVEZcs.js} +6 -6
- package/dist/assets/{index-BajjN1HU.js → index-CGP3CGlC.js} +6 -6
- package/dist/assets/{index-Ccjxs0wr.js → index-CI3rRJqa.js} +12 -12
- package/dist/assets/{index-CAtE4xM9.js → index-CK3KHeKw.js} +8 -8
- package/dist/assets/{index-CIvZ7HIX.js → index-CRAuhYSg.js} +1 -1
- package/dist/assets/{index-CJBVOMty.js → index-CUlOq3Sr.js} +4 -4
- package/dist/assets/{index-DK4Rvfj9.js → index-CZBIYuko.js} +1 -1
- package/dist/assets/{index-BjLM8Gon.js → index-CaTDaKrX.js} +1 -1
- package/dist/assets/index-CqD-x8pw.js +7 -0
- package/dist/assets/{index-Bs5xamxm.js → index-CtORPeiq.js} +2 -2
- package/dist/assets/index-D-a8pZtp.js +1 -0
- package/dist/assets/{index-BOiRUuPB.js → index-D24LKXzO.js} +1 -1
- package/dist/assets/{index-C0q1NhNR.js → index-D29her4n.js} +1 -1
- package/dist/assets/index-DACtt7qd.js +102 -0
- package/dist/assets/{index-BRGQOPmE.js → index-D_u0j8BO.js} +1 -1
- package/dist/assets/{index-B6QOO2yw.js → index-DjpxFmgG.js} +7 -7
- package/dist/assets/index-DuDIkjct.js +55 -0
- package/dist/assets/{index-BXtrOI0G.js → index-DwJ_NASi.js} +1 -1
- package/dist/assets/{index-Dijoh4El.js → index-DwyzCfdd.js} +103 -103
- package/dist/assets/index-KIswy2vM.js +120 -0
- package/dist/assets/index-LaMi0T4w.js +1 -0
- package/dist/assets/index-MQEkIEm-.js +1 -0
- package/dist/assets/{index-DHn4LCaq.js → index-OMkyTUNX.js} +4 -4
- package/dist/assets/index-WT6M-zj8.js +6 -0
- package/dist/assets/{index-BsA1v5Kx.js → index-_tncRnTu.js} +1 -1
- package/dist/assets/index-lK6Pf_qM.js +11 -0
- package/dist/assets/{index-CMec_woq.js → index-m1ZQT0sU.js} +1 -1
- package/dist/assets/{index-bb4s-8hu.js → index-oS8X43Pb.js} +6 -6
- package/dist/assets/index-xE7OidBo.js +1 -0
- package/dist/assets/{index.esm-DTmS4tth.js → index.esm-Co8ZxFyk.js} +1 -1
- package/dist/assets/{invitation-Cjg3Rgxl.js → invitation-C2S2tPzG.js} +7 -7
- package/dist/assets/invitations-Dil5QWBY.js +3 -0
- package/dist/assets/invite-GVnju9RQ.js +1 -0
- package/dist/assets/{isURL-wZZwzwyC.js → isURL-ZFgr0DWl.js} +2 -2
- package/dist/assets/issue-passport-BmU6NmKw.js +1 -0
- package/dist/assets/{item-Bpf_gGYt.js → item-DfQKizv4.js} +1 -1
- package/dist/assets/landing-page-C3zTr0-n.js +1 -0
- package/dist/assets/{launch-result-message-BTBdTioQ.js → launch-result-message-MNpx7ysR.js} +1 -1
- package/dist/assets/{layout-CZo9vMzc.js → layout-tkk_Lr2y.js} +1 -1
- package/dist/assets/list-BvgV1Jbh.js +2 -0
- package/dist/assets/list-YOpLH3o0.js +103 -0
- package/dist/assets/{list-header-BQo9L_6R.js → list-header-Cl3jykCe.js} +1 -1
- package/dist/assets/localization-DcnSNZHz.js +1 -0
- package/dist/assets/{lock.svg-BPCZ0CT3.js → lock.svg-BgybwZNe.js} +1 -1
- package/dist/assets/{log-KsUeQx46.js → log-C0zcaEbO.js} +1 -1
- package/dist/assets/logger-BbBkOuwH.js +1 -0
- package/dist/assets/login-BR26IXZx.js +1 -0
- package/dist/assets/login-oauth-callback-DCJMx5J1.js +1 -0
- package/dist/assets/logo-uploader-TLOlwvRt.js +30 -0
- package/dist/assets/{lost-passport-DWR3ith-.js → lost-passport-DE5KGhjz.js} +3 -3
- package/dist/assets/{lottie-react.esm-CD0xFBYg.js → lottie-react.esm-E4oo1jhL.js} +1 -1
- package/dist/assets/omit-D_PYZZLm.js +1 -0
- package/dist/assets/{open-window-Ct_MP3Sx.js → open-window-CPNpPXku.js} +1 -1
- package/dist/assets/over-due-invoice-payment-1EZsSUm4.js +1 -0
- package/dist/assets/{overview-5u7B_D_6.js → overview-CMduEuAK.js} +2 -2
- package/dist/assets/{page-header-Cgwo2np-.js → page-header-CHAwrgX-.js} +1 -1
- package/dist/assets/passport-Dg1YWagy.js +1 -0
- package/dist/assets/passport-item-QbgyHapR.js +1 -0
- package/dist/assets/{permission-BYxNrlaa.js → permission-C0bmOzVj.js} +1 -1
- package/dist/assets/preferences-0l0Zmaom.js +1 -0
- package/dist/assets/profile-embed-BQzLZZkK.js +1 -0
- package/dist/assets/publish-resource-ggObFvMi.js +1 -0
- package/dist/assets/{question-mark-circle.svg-DK9nTUDZ.js → question-mark-circle.svg-CByEVDhb.js} +1 -1
- package/dist/assets/{raf-schd.esm-JNUhxcps.js → raf-schd.esm-XXBRsnmf.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-Cvsu51oI.js → react-beautiful-dnd.esm-zYw9dagY.js} +1 -1
- package/dist/assets/{react-stripe.esm-Dqbe1A8R.js → react-stripe.esm-CVZErl8X.js} +1 -1
- package/dist/assets/{required-B0Gua-D1.js → required-BQln5OcV.js} +1 -1
- package/dist/assets/{revoke.svg-CuiCGfVW.js → revoke.svg-CNl4LAbv.js} +1 -1
- package/dist/assets/runtime-BNKE0VfZ.js +1 -0
- package/dist/assets/{sanitize-D6Abg5_T.js → sanitize-CtCDGQB6.js} +1 -1
- package/dist/assets/sdk-YVE2MSze.js +1 -0
- package/dist/assets/{section-BkMzBpvM.js → section-jXB9AxBb.js} +1 -1
- package/dist/assets/{security-DCG1tmZe.js → security-CWEVWbF4.js} +3 -3
- package/dist/assets/{server-logo-notext.svg-DHxZ1bRk.js → server-logo-notext.svg-xZ-i1SpD.js} +1 -1
- package/dist/assets/session-Des-0R_y.js +1 -0
- package/dist/assets/setup-Cps_vpFS.js +24 -0
- package/dist/assets/{shorten-label-DhOty_4j.js → shorten-label-C4py9TLA.js} +1 -1
- package/dist/assets/{simple-select-D0q2J-Br.js → simple-select-DbXWLzPn.js} +1 -1
- package/dist/assets/{spaces-DM95DgFM.js → spaces-2YPkTkBR.js} +1 -1
- package/dist/assets/start-CuCNmoqX.js +187 -0
- package/dist/assets/{starting-progress-aMYWzin8.js → starting-progress-xuCef6_T.js} +2 -2
- package/dist/assets/status-DleDsf-t.js +1 -0
- package/dist/assets/{step-actions-nHHLzUFh.js → step-actions-AHe2MQxo.js} +1 -1
- package/dist/assets/studio-HfI11Uc3.js +6 -0
- package/dist/assets/{switch-control-BAyRLHvJ.js → switch-control-CzYig10w.js} +1 -1
- package/dist/assets/switch-rIcJ7tho.js +1 -0
- package/dist/assets/{table-tips-BA9A3QDk.js → table-tips-Ba9Kf02z.js} +1 -1
- package/dist/assets/team-BWkxYdcc.js +146 -0
- package/dist/assets/traffic-jB6onGHq.js +1 -0
- package/dist/assets/transfer-DspVAdFc.js +16 -0
- package/dist/assets/unsubscribe-CKdMi1Kx.js +1 -0
- package/dist/assets/use-app-logo-BAGvxEU-.js +1 -0
- package/dist/assets/{use-mobile-Dwc30NoL.js → use-mobile-BINJTzMb.js} +1 -1
- package/dist/assets/{use-mobile-Vtj5nBdp.js → use-mobile-D5clNlrm.js} +1 -1
- package/dist/assets/{use-server-logo-BfNy3Xkj.js → use-server-logo-Cv1kAPgB.js} +1 -1
- package/dist/assets/use-window-close-D7QBHj75.js +1 -0
- package/dist/assets/useAsync-CgTefzpB.js +1 -0
- package/dist/assets/{useAsync-DNDhrs-2.js → useAsync-CxjyODHb.js} +1 -1
- package/dist/assets/{useAsyncRetry-CSW1hopB.js → useAsyncRetry-BnuUJFwY.js} +1 -1
- package/dist/assets/useLocalStorage-Bj52e1ZW.js +1 -0
- package/dist/assets/{useSetState-cWrp7qoX.js → useSetState-L-f8mSga.js} +1 -1
- package/dist/assets/user-center-CL_lKzgJ.js +125 -0
- package/dist/assets/user-follower-CfiG4RXf.js +32 -0
- package/dist/assets/{util-DSnAozzs.js → util-C9cWBCZz.js} +1 -1
- package/dist/assets/{util-BxX0TJKJ.js → util-DXf_zMuU.js} +1 -1
- package/dist/assets/{vendor-arcblock-D4Rvz_D3.js → vendor-arcblock-DkdOhPyM.js} +1 -1
- package/dist/assets/{vendor-hooks-U4TTuKG0.js → vendor-hooks-BZ19vVZ7.js} +2 -2
- package/dist/assets/{vendor-mui-core-B5XNUjey.js → vendor-mui-core-DnR6WYuU.js} +2 -2
- package/dist/assets/{vendor-mui-x-DtPl0qBm.js → vendor-mui-x-CQc01l4r.js} +1 -1
- package/dist/assets/{vendor-react-CUXIiAnY.js → vendor-react-CTtPmzVP.js} +1 -1
- package/dist/assets/{vendor-utils-CFxoplqC.js → vendor-utils-D5UG1a5Y.js} +2 -2
- package/dist/assets/{vendor-ux-BX9dSNUy.js → vendor-ux-DMZIE6wA.js} +2 -2
- package/dist/assets/{wait-connect-CCXiMHZY.js → wait-connect-D2wPrbE3.js} +1 -1
- package/dist/assets/{wizard-TEBzHS-w.js → wizard-EYZCXWG5.js} +2 -2
- package/dist/assets/wizard-components-PMRUmw6U.js +52 -0
- package/dist/assets/wrap-locale-B4E8Yvgz.js +1 -0
- package/dist/assets/{zh-Dr9buZnV.js → zh-CSl2KD_S.js} +1 -1
- package/dist/assets/zh-CXK3bXGt.js +1 -0
- package/dist/assets/{zh-tw-CeXBj2i0.js → zh-tw-BiloxWNq.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +25 -2
- package/package.json +50 -50
- package/dist/assets/AdapterDayjs-p1MGZm94.js +0 -3
- package/dist/assets/access-control-C6MQq9M9.js +0 -14
- package/dist/assets/actions-CiAs-6JM.js +0 -1
- package/dist/assets/add-resource-DVpeKvW6.js +0 -1
- package/dist/assets/addon-B5NG3IsS.js +0 -14
- package/dist/assets/aigne-WBAWm6yx.js +0 -10
- package/dist/assets/api-Cjc501Es.js +0 -1
- package/dist/assets/appearance-CVS4AfPI.js +0 -1
- package/dist/assets/arrow-down.svg-Dhs0HydJ.js +0 -1
- package/dist/assets/authorize-uzVAAuOd.js +0 -1
- package/dist/assets/bind-account-N3cioth0.js +0 -1
- package/dist/assets/branding-BFn6p_xP.js +0 -1
- package/dist/assets/bundle-avatar-CfVy3gda.js +0 -1
- package/dist/assets/button-4KPacREM.js +0 -1
- package/dist/assets/click-to-copy-DXHOGoUP.js +0 -1
- package/dist/assets/cloneDeep-DjDct56M.js +0 -1
- package/dist/assets/config-CwbUhIlW.js +0 -57
- package/dist/assets/config-space-3dNLmLWy.js +0 -1
- package/dist/assets/confirm-BIsS5xyi.js +0 -7
- package/dist/assets/connect-DMt_37_e.js +0 -1
- package/dist/assets/connect-to-D3C0j8V8.js +0 -1
- package/dist/assets/createClass-CkCf2FLT.js +0 -1
- package/dist/assets/did-address-Qmm0nyiR.js +0 -1
- package/dist/assets/domain-DcU9P4mp.js +0 -9
- package/dist/assets/domain-action-card-D9HXIIpd.js +0 -28
- package/dist/assets/domains-DVkGbWo7.js +0 -1
- package/dist/assets/engine-Cx3nUUOw.js +0 -1
- package/dist/assets/exchange-passport-Bxh8blMK.js +0 -1
- package/dist/assets/form-text-input-CbjI2VZQ.js +0 -11
- package/dist/assets/fuel-BdIacIqD.js +0 -32
- package/dist/assets/gen-access-key-DdjBRI5O.js +0 -1
- package/dist/assets/gen-simple-access-key-CBGi0io0.js +0 -1
- package/dist/assets/get-safe-url-pZvXlaJu.js +0 -1
- package/dist/assets/index-5B_H2zYd.js +0 -1
- package/dist/assets/index-6M8OhYM1.js +0 -1
- package/dist/assets/index-BRky7Qm3.js +0 -7
- package/dist/assets/index-CUIcSX4q.js +0 -102
- package/dist/assets/index-CtuxXUm_.js +0 -1
- package/dist/assets/index-DCPJbOWh.js +0 -55
- package/dist/assets/index-DD9ceQKr.js +0 -1
- package/dist/assets/index-Dn_bIjgF.js +0 -6
- package/dist/assets/index-G1If4Shq.js +0 -120
- package/dist/assets/index-RxqUBm3A.js +0 -11
- package/dist/assets/index-SH0LXIEm.js +0 -1
- package/dist/assets/index-mgpYakv8.js +0 -1
- package/dist/assets/invitations-xEsO2f9m.js +0 -3
- package/dist/assets/invite-ChOQtk0E.js +0 -1
- package/dist/assets/issue-passport-CUGjhBZr.js +0 -1
- package/dist/assets/landing-page-zT1Tduxx.js +0 -1
- package/dist/assets/list-Cj5o6_aJ.js +0 -103
- package/dist/assets/list-dBF9Lx52.js +0 -2
- package/dist/assets/localization-BhQNA1fu.js +0 -1
- package/dist/assets/logger-CWdgyrlX.js +0 -1
- package/dist/assets/login-BRtDYFyr.js +0 -1
- package/dist/assets/login-oauth-callback-BVOT5KIP.js +0 -1
- package/dist/assets/logo-uploader-CMuaTg_2.js +0 -30
- package/dist/assets/omit-DZEUV_m7.js +0 -1
- package/dist/assets/over-due-invoice-payment-EIjXZOAF.js +0 -1
- package/dist/assets/passport-BcfDxGFq.js +0 -1
- package/dist/assets/passport-item-BnRaEMVZ.js +0 -1
- package/dist/assets/preferences-BgyNzrci.js +0 -1
- package/dist/assets/profile-embed-C3hI8xed.js +0 -1
- package/dist/assets/publish-resource-CreTipUc.js +0 -1
- package/dist/assets/runtime-BwoZhRe2.js +0 -1
- package/dist/assets/sdk-Do4pV1s0.js +0 -1
- package/dist/assets/session-DUT2afHJ.js +0 -1
- package/dist/assets/setup-ephJCw43.js +0 -24
- package/dist/assets/start-sucUqu8u.js +0 -187
- package/dist/assets/status-BFw6nCWi.js +0 -1
- package/dist/assets/studio-BKkw9WY-.js +0 -6
- package/dist/assets/switch-C5K07M96.js +0 -1
- package/dist/assets/team-HgvOpVEJ.js +0 -146
- package/dist/assets/traffic-BvA-dAE6.js +0 -1
- package/dist/assets/transfer-CiITg5ql.js +0 -16
- package/dist/assets/unsubscribe-2BjO5Axx.js +0 -1
- package/dist/assets/use-app-logo-D9eQSUYq.js +0 -1
- package/dist/assets/use-window-close-DLSxYDw-.js +0 -1
- package/dist/assets/useAsync-Dy8z2Lh_.js +0 -1
- package/dist/assets/useLocalStorage-oIIa9C3F.js +0 -1
- package/dist/assets/user-center-BODNsVgb.js +0 -126
- package/dist/assets/user-follower-ODH9p68y.js +0 -32
- package/dist/assets/wizard-components-MqkmgXy5.js +0 -52
- package/dist/assets/wrap-locale-Dk2yVg3Y.js +0 -1
- package/dist/assets/zh-C6-KWz-k.js +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as e,ak as m,b4 as st,W as h,ar as L,cy as ot,a$ as it,T as B,c3 as at,c4 as lt,D as ct,V as dt,I as Oe,bb as oe,U as Z,n as ce,S as mt,cz as ut,Q as J,ai as gt,am as de,bf as pt,cb as xt,cc as ht,b1 as ze,b7 as ft,b8 as bt,b9 as vt,cA as yt,cB as jt,s as Ct,J as wt,c1 as Ot,z as me,bD as Be,aX as St,a6 as Tt,bV as Pt,aj as It,y as Dt,x as kt,bc as Mt,M as zt}from"./vendor-mui-core-B5XNUjey.js";import{V as N,H as O,h as Ne,z as Se,U as Re,i as _e,p as Rt,a2 as Et,b as ge,n as Ee}from"./vendor-ux-BX9dSNUy.js";import{r as C,i as qe,k as At}from"./vendor-react-CUXIiAnY.js";import{g as G,b as j,k as Ue,a as Wt,v as Lt,q as Bt,c as Nt}from"./vendor-hooks-U4TTuKG0.js";import{ar as ie,at as ae,c as Pe,_ as He,aA as _t,as as ue,J as qt,b6 as Ut,o as Ht}from"./index-Dijoh4El.js";import{u as Fe}from"./team-HgvOpVEJ.js";import{u as $e}from"./use-mobile-Vtj5nBdp.js";import{A as Ft}from"./actions-CiAs-6JM.js";import{u as Je}from"./session-DUT2afHJ.js";import{f as E}from"./index-DBs9Ljax.js";import{v as Ce}from"./index-BjLM8Gon.js";import{e as Ve,A as $t,n as te}from"./vendor-utils-CFxoplqC.js";import{F as Ae}from"./form-text-input-CbjI2VZQ.js";import{e as Jt}from"./edit.svg-Dz9cVo7r.js";import{C as Vt}from"./lock.svg-BPCZ0CT3.js";import{D as Kt,a as Gt,b as Xt,M as Qt}from"./index-CmT6o_W4.js";import{c as Yt}from"./passport-BcfDxGFq.js";import{C as Zt}from"./click-to-copy-DXHOGoUP.js";import{I as er}from"./invitations-xEsO2f9m.js";function Ke({members:t,total:o}){return e.jsxs(m,{className:"members-avatar-group",sx:{display:"flex",alignItems:"center","& > *:not(:first-of-type)":{ml:-1}},children:[t.map((a,i)=>e.jsx(m,{sx:{position:"relative",zIndex:i},children:e.jsx(ie,{did:a.userDid,avatarSize:32,cardType:ae.AvatarOnly,showHoverCard:!1})},a.userDid)),o>5&&e.jsxs(st,{sx:{width:32,height:32,bgcolor:"grey",fontSize:14},children:["+",o-5]})]})}Ke.propTypes={members:h.array.isRequired,total:h.number.isRequired};function Ge({org:t={},loading:o=!1}){const{t:a,locale:i}=N();return t.id?o?e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(L,{variant:"text",width:50,height:24}),e.jsx(L,{variant:"text",width:20,height:24})]}):e.jsxs(ot,{"aria-label":"breadcrumb",children:[e.jsx(it,{underline:"hover",color:"inherit",href:`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${i}`,children:a("common.orgs")}),e.jsx(B,{children:t.name})]}):null}Ge.propTypes={org:h.object.isRequired,loading:h.bool};function tr(t){if(!t)return"";if(/[\u4e00-\u9fa5]/.test(t.charAt(0)))return t.charAt(0);const o=t.trim().split(/\s+/);return o.length>1?o.slice(0,2).map(a=>a.charAt(0).toUpperCase()).join(""):t.charAt(0).toUpperCase()}function Xe({org:t,loading:o=!1}){return e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(m,{sx:{width:56,height:56,borderRadius:1,backgroundColor:"grey.100",display:"flex",alignItems:"center",justifyContent:"center"},children:o?e.jsx(L,{variant:"text",width:25,height:25}):e.jsx(B,{sx:{fontSize:30,fontWeight:600},children:tr(t.name)})}),e.jsxs(m,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsx(B,{variant:"h4",sx:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",textOverflow:"ellipsis"},children:o?e.jsx(L,{variant:"text",width:"10%",height:24}):t.name||"-"}),e.jsx(B,{variant:"body1",sx:{fontSize:14,lineHeight:1.2,overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:o?e.jsx(L,{variant:"text",width:"30%",height:24}):t.description||"-"})]})]})}Xe.propTypes={org:h.shape({name:h.string,description:h.string}).isRequired,loading:h.bool};function Ie({tabs:t,currentTab:o,onTabChange:a,loading:i=!1,extra:r=null}){return e.jsxs(m,{sx:{display:"flex",gap:1,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap"},children:[i?e.jsx(L,{variant:"text",width:300,height:56}):e.jsx(at,{color:"primary",size:"small",value:o,exclusive:!0,onChange:(s,u)=>{u!==null&&a(u)},disabled:i,children:t.map(s=>e.jsx(lt,{size:"small",value:s.value,children:s.label},s.value))}),e.jsx(m,{children:r})]})}Ie.propTypes={tabs:h.array.isRequired,currentTab:h.string.isRequired,onTabChange:h.func.isRequired,loading:h.bool,extra:h.node};const Qe=C.createContext({}),{Provider:rr,Consumer:Rr}=Qe,we={type:"",org:{},paging:{page:1,pageSize:10}};function nr({children:t,editable:o=!0,mode:a="user-center",id:i=""}){const{t:r}=N(),{api:s}=He(),{teamDid:u}=Fe(),{session:b}=Je(),[g,y]=C.useState(!1),[I,d]=C.useState(0),[w,T]=C.useState(0),f=G({loading:!1,org:null,members:[],membersPaging:{page:1,pageSize:10},invitations:[],refresh:null,editable:!1,roles:[],error:null}),x=C.useMemo(()=>b?.user?.did,[b?.user?.did]),z=G({all:JSON.parse(JSON.stringify(we)),myCreated:JSON.parse(JSON.stringify({...we,type:"owned"})),myJoined:JSON.parse(JSON.stringify({...we,type:"joined"}))}),D=G({mode:"",org:null}),v=G({loading:!1,org:null,showInvite:!1,showInviting:!1,inviteLink:"",roles:[],mode:"list"}),S=G({mode:"create",item:null,loading:!1,org:null,visible:!1}),U=C.useMemo(()=>window.blocklet?.settings?.org||{},[]),{confirmApi:H,confirmHolder:X}=_t(),re=j(async({org:n={},type:c="",paging:p={page:1,pageSize:10}})=>{try{y(!0);const R=await s.getOrgs({input:{teamDid:u,paging:p,org:n,...c?{type:c}:{}}});return z.all={org:n,paging:p,type:c},R}catch(R){console.error(R),O.error(E(R));return}finally{y(!1)}}),M=j(async({org:n={},paging:c={page:1,pageSize:10}})=>{try{y(!0);const p=await s.getOrgs({input:{teamDid:u,paging:c,org:n,type:"owned"}});return d(p?.paging?.total||0),z.myCreated={org:n,paging:c,type:"owned"},p}catch(p){console.error(p),O.error(E(p));return}finally{y(!1)}}),A=j(async({org:n={},paging:c={page:1,pageSize:10}})=>{try{y(!0);const p=await s.getOrgs({input:{teamDid:u,paging:c,org:n,type:"joined"}});return z.myJoined={org:n,paging:c,type:"joined"},p}catch(p){console.error(p),O.error(E(p));return}finally{y(!1)}}),k=j(()=>{T(n=>n+1)}),F=j(async n=>{try{await s.deleteOrg({input:{teamDid:u,id:n.id}}),k()}catch(c){console.error(c),O.error(E(c))}}),pe=j(n=>new Promise((c,p)=>{H.open({title:r("team.orgs.deleteConfirm",{name:n.name}),content:r("team.orgs.deleteConfirmDescription"),confirmButtonText:r("common.delete"),cancelButtonText:r("common.cancel"),confirmButtonProps:{color:"error"},onConfirm:async R=>{await F(n),R(),c()},onCancel:()=>{p()}})})),xe=j(async n=>{try{await s.updateOrg({input:{teamDid:u,org:n}}),O.success(r("team.orgs.mutate.updateSuccess"))}catch(c){console.error(c),O.error(E(c))}}),ee=j(async n=>{try{await s.createOrg({input:{teamDid:u,name:n.name,description:n.description}}),O.success(r("team.orgs.mutate.createSuccess")),k()}catch(c){console.error(c),O.error(E(c))}}),V=j(async(n,c=f.membersPaging)=>{try{const p=await s.getOrgMembers({input:{teamDid:u,orgId:n,paging:c}});f.members=p.users,f.membersPaging=p.paging}catch(p){console.error(p),O.error(E(p))}}),ne=j(async(n,c={page:1,pageSize:10})=>{try{const p=await s.getInvitations({input:{teamDid:u,orgId:n,paging:c}});f.invitations=p.invitations}catch(p){console.error(p),O.error(E(p))}}),Q=j(async n=>{try{const c=await s.getRoles({input:{teamDid:u,orgId:n}});f.roles=c.roles,v.roles=c.roles}catch(c){console.error(c),O.error(E(c))}}),he=j(async(n,c)=>{try{await s.removeOrgMember({input:{teamDid:u,orgId:n,userDid:c}}),O.success(r("team.orgs.invite.removeSuccess")),Promise.all([V(n),ne(n)])}catch(p){console.error(p),O.error(E(p))}}),Y=j((n,c)=>{const{user:p,status:R}=c,$=R==="inviting";return new Promise((ye,le)=>{H.open({title:$?r("team.orgs.member.removeInvitingMember",{name:p.fullName}):r("team.orgs.member.removeMemberConfirm",{name:p.fullName}),content:$?r("team.orgs.member.removeInvitingMemberDescription",{name:p.fullName}):r("team.orgs.member.removeMemberConfirmDescription"),confirmButtonProps:{color:"error"},onConfirm:async je=>{await he(n,p.did),je(),ye()},onCancel:()=>{le()}})})}),se=j(async n=>{try{const c=await s.getOrg({input:{teamDid:u,id:n}});f.org=c.org,f.error=null,f.editable=o?c?.org?.ownerDid===x:!1}catch(c){f.error=E(c),console.error(c),O.error(E(c))}}),fe=j(n=>{if(!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}D.org=n,D.mode="update"}),be=j(()=>{if(!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}const{maxOrgPerUser:n=10}=U;if(n<=I){O.error(r("team.orgs.mutate.maxOrgPerUser",{maxOrgPerUser:n}));return}D.org={},D.mode="create"}),ve=j(({org:n,open:c=!1,mode:p="list"})=>{if(c&&n){if(v.org=n,v.mode=p,!U?.enabled){O.error(r("team.orgs.mutate.orgNotEnabled"));return}const{maxMemberPerOrg:R=100}=U;if(n.membersCount=n.membersCount||1,R<=(n?.membersCount??1)){O.error(r("team.orgs.mutate.maxMemberPerOrg",{maxMemberPerOrg:R}));return}Q(n.id)}else v.mode="list",v.org=null,v.roles=[],v.inviteLink="";v.showInvite=c}),Me=j(({org:n,open:c=!1})=>{v.showInviting=c,v.org=c?n:null}),K=j(()=>{D.org=null,D.mode=""}),l=j(async n=>{try{if(f.loading=!0,await se(n),f.error)return;f.editable?await Promise.all([V(n),ne(n),Q(n)]):await Promise.all([V(n),Q(n)])}catch(c){console.error(c)}finally{f.loading=!1}}),P=j(async({userDids:n,role:c,email:p,inviteType:R})=>{try{const{org:$}=v||{};if(!$)throw new Error(400,"Org is not found");v.loading=!0;const ye=await s.inviteMembersToOrg({input:{userDids:n,email:p,teamDid:u,orgId:$.id,role:c,inviteType:R}}),{failedDids:le,inviteLink:je}=ye.data||{};R==="external"?v.inviteLink=je:le.length?O.success(r("team.orgs.invite.failed",{count:le.length})):O.success(r("team.orgs.invite.success")),v.mode==="detail"?l($.id):k()}catch($){console.error($),O.error(E($))}finally{v.loading=!1}}),W=j(({org:n,mode:c="create",open:p=!1,item:R=null})=>{S.visible=p,S.org=p?n:null,S.mode=p?c:"create",S.item=p&&c==="update"?R:null});C.useEffect(()=>{i&&l(i)},[i,l]);const q={editable:o,refresh:k,refreshTrigger:w,loading:g,mode:a,teamDid:u,onTriggerEditOrg:fe,onTriggerCreateOrg:be,onCancelMutateOrg:K,mutationParams:D,inviteParams:{...v,onTriggerInviteDialog:ve,onTriggerInvitingDialog:Me},orgDetail:{...f,refresh:l},passportParams:{...S,onTriggerPassportDialog:W},requests:{getAllOrgs:re,getMyCreatedOrgs:M,getMyJoinedOrgs:A,deleteOrg:pe,updateOrg:xe,createOrg:ee,getOrgMembers:V,getOrgInvitations:ne,removeOrgMember:Y,getOrg:se,inviteMembers:P,getOrgRoles:Q}};return e.jsxs(rr,{value:q,children:[t,X]})}function _(){return C.useContext(Qe)}function Ye({index:t=0}){const o=[{name:"75%",info:"45%",detail:"60%"},{name:"65%",info:"55%",detail:"40%"},{name:"90%",info:"30%",detail:"65%"}],a=o[t%o.length];return e.jsxs(mt,{sx:{px:0,py:1},children:[e.jsx(ut,{children:e.jsx(L,{variant:"circular",width:32,height:32})}),e.jsxs(m,{sx:{flex:1},children:[e.jsx(L,{variant:"text",width:a.name,height:20,sx:{mb:.5}}),e.jsx(L,{variant:"text",width:a.info,height:16,sx:{mb:.25}})]})]})}Ye.propTypes={index:h.number};function sr(){const{t,locale:o}=N(),{orgDetail:a,requests:i}=_(),{org:r,members:s,loading:u,editable:b,membersPaging:g}=a||{},y=ct(),I=(T,f)=>{f==="changePage"&&(g.page=T.page+1,i.getOrgMembers(r.id,g)),f==="changeRowsPerPage"&&(g.page=1,g.pageSize=T.rowsPerPage,i.getOrgMembers(r.id,g))},d=[{name:"user",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const{user:z}=x,D=x.userDid===r.ownerDid;return e.jsx(m,{sx:{py:{xs:.5,sm:1}},children:e.jsx(ie,{avatarSize:32,user:z,showDid:!0,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0},showHoverCard:!1,renderTopRightContent:b&&!D?()=>e.jsx(m,{sx:{display:{xs:"block",sm:"none"}},children:e.jsx(Oe,{size:"small",color:"error","aria-label":"delete",title:t("team.orgs.invite.remove"),onClick:v=>{v.stopPropagation(),i.removeOrgMember(r.id,x)},children:e.jsx(oe,{fontSize:"small"})})}):void 0})})}}},{name:"status",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const{user:z}=x,{passports:D=[]}=z;return e.jsxs(m,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:.5,alignItems:"flex-start",py:{xs:.5,sm:1}},children:[e.jsxs(m,{sx:{display:{xs:"flex",sm:"none"},flexDirection:"row",gap:.5,alignItems:"center",flexWrap:"nowrap",overflow:"auto",maxWidth:"100%"},children:[D.map(v=>e.jsx(Z,{label:v.title,size:"small",sx:{flexShrink:0}},v.id)),x.status==="inviting"?e.jsx(Z,{label:t("common.inviting"),size:"small",sx:{backgroundColor:ce(y.palette.warning.main,.15),color:y.palette.warning.dark,flexShrink:0}}):e.jsx(Z,{label:t("team.orgs.active"),size:"small",sx:{backgroundColor:ce(y.palette.success.main,.15),color:y.palette.success.dark,flexShrink:0}}),x.updatedAt&&e.jsxs(B,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap",flexShrink:0},children:[x.status==="inviting"?t("team.orgs.invitedAt"):t("team.orgs.joinedAt")," ",e.jsx(Se,{value:x.updatedAt})]})]}),e.jsxs(m,{sx:{display:{xs:"none",sm:"flex"},flexDirection:"row",gap:.5,alignItems:"center"},children:[D.map(v=>e.jsx(Z,{label:v.title,size:"small"},v.id)),x.status==="inviting"?e.jsx(Z,{label:t("common.inviting"),size:"small",sx:{backgroundColor:ce(y.palette.warning.main,.15),color:y.palette.warning.dark}}):e.jsx(Z,{label:t("team.orgs.active"),size:"small",sx:{backgroundColor:ce(y.palette.success.main,.15),color:y.palette.success.dark}})]})]})}}},{name:"updatedAt",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"33.33%"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];return!x||!x.updatedAt?null:e.jsx(m,{sx:{py:{xs:.5,sm:1},display:{xs:"none",sm:"flex"},flexDirection:"column",gap:.5,minWidth:0},children:e.jsxs(B,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:[x.status==="inviting"?t("team.orgs.invitedAt"):t("team.orgs.joinedAt"),e.jsx(Se,{value:x.updatedAt})]})})}}},{name:"actions",label:" ",options:{filter:!1,sort:!1,setCellHeaderProps:()=>({style:{display:"none"}}),setCellProps:()=>({style:{width:"80px",minWidth:"80px",maxWidth:"80px"}}),customBodyRender:(T,f)=>{const x=s[f.rowIndex];if(!x||!x.user)return null;const z=x.userDid===r.ownerDid;return!b||z?null:e.jsx(m,{sx:{py:{xs:.5,sm:1},display:{xs:"none",sm:"block"}},children:e.jsx(Oe,{color:"error","aria-label":"delete",title:t("team.orgs.invite.remove"),onClick:()=>i.removeOrgMember(r.id,x),children:e.jsx(oe,{})})})}}}],w={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,selectableRows:"none",expandableRowsOnClick:!1,page:g.page-1,rowsPerPage:g.pageSize,count:g.total||0,pagination:g.pageCount>1};return u?e.jsx(m,{className:"members-list",children:e.jsx(dt,{sx:{width:"100%",bgcolor:"background.paper"},children:Array.from({length:3},(T,f)=>e.jsx(Ye,{index:f},`skeleton-${f}`))})}):e.jsx(m,{className:"members-list",sx:{width:"100%","& .org-members-table > div":{overflow:"hidden"},"& .MuiPaper-root":{overflow:{xs:"hidden",sm:"auto"}},"& table":{width:{xs:"100%",sm:"auto"},tableLayout:{xs:"fixed",sm:"auto"}},"& .MuiTableRow-root .MuiTableCell-root":{py:{xs:.5,sm:1}},"& tbody tr":{display:{xs:"grid",sm:"table-row"},gridTemplateColumns:{xs:"1fr",sm:"auto"},gridTemplateRows:{xs:"auto auto",sm:"auto"},"& td":{display:{xs:"block !important",sm:"table-cell !important"},"&:nth-of-type(1)":{gridColumn:{xs:"1",sm:"auto"},gridRow:{xs:"1",sm:"auto"}},"&:nth-of-type(2)":{gridColumn:{xs:"1",sm:"auto"},gridRow:{xs:"2",sm:"auto"},minWidth:{xs:0,sm:"auto"}},"&:nth-of-type(3), &:nth-of-type(4)":{display:{xs:"none !important",sm:"table-cell !important"}}}}},children:e.jsx(Ne,{className:"org-members-table",data:s,columns:d,loading:u,onChange:I,locale:o,options:w})})}function or(){const{t}=N(),{orgDetail:o,inviteParams:a}=_(),{invitations:i,editable:r,org:s}=o||{};return r?e.jsxs(m,{sx:{display:"flex",gap:1},children:[e.jsxs(J,{variant:"outlined",style:{flexShrink:0},color:"primary",size:"small",onClick:()=>{a.onTriggerInvitingDialog({org:s,open:!0})},children:[e.jsx(Re,{style:{height:"1em",marginRight:4},icon:"tabler:user"}),t("common.inviting"),i.length?` (${i.length})`:""]}),e.jsx(J,{variant:"contained",size:"small",onClick:()=>{a.onTriggerInviteDialog({org:s,open:!0,mode:"detail"})},startIcon:e.jsx(Re,{style:{fontSize:14},icon:"tabler:user-plus"}),children:t("common.invite")})]}):null}function De({children:t,...o}){const a=$e(),[i,r]=C.useState(!1),s=j(()=>{r(!i)});return C.useEffect(()=>{r(!1)},[a]),a?e.jsx(gt,{onClickAway:()=>r(!1),children:e.jsx(de,{...o,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,slotProps:{popper:{disablePortal:!0}},open:i,onClose:s,children:C.cloneElement(t,{onClick:s})})}):e.jsx(de,{...o,children:t})}De.propTypes=de.propTypes;De.defaultProps=de.defaultProps;function ir(){const{orgDetail:t,requests:o}=_(),{org:a,loading:i,editable:r}=t||{},{t:s,locale:u}=N(),b=qe(),g=C.useMemo(()=>{const{settings:d={}}=window.blocklet||{};return Ve(d,"org.maxMemberPerOrg",100)},[]),y=j(async(d,w)=>{const T={...$t(a,["id","name","description"]),[d]:w};await o.updateOrg(T),t.refresh(T.id)}),I=j(async()=>{await o.deleteOrg(a),b(`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${u}`)});return e.jsxs(m,{children:[e.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:2},children:[e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:s("team.orgs.mutate.name"),children:r?e.jsx(Ae,{style:{marginTop:0},disabled:i,loading:i,initialValue:a.name,onSubmit:d=>y("name",d)}):a.name},a.name),e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:s("common.description"),children:r?e.jsx(Ae,{style:{marginTop:0},disabled:i,loading:i,initialValue:a.description,type:"textarea",rows:3,onSubmit:d=>y("description",d)}):a.description},a.description),e.jsx(Ce,{valueComponent:"div",nameWidth:180,name:e.jsxs(B,{sx:{display:"flex",alignItems:"center",gap:.5},children:[s("team.orgs.invite.maxMembers"),e.jsx(De,{title:s("team.orgs.invite.maxMembersTip"),children:e.jsx(pt,{fontSize:"small",sx:{cursor:"pointer",fontSize:14}})})]}),children:g},a.id)]}),r&&e.jsx(m,{display:"flex",justifyContent:"flex-end",children:e.jsx(J,{variant:"contained",color:"error",size:"small",startIcon:e.jsx(oe,{style:{fontSize:16}}),onClick:I,children:s("team.orgs.deleteOrg")})})]})}function ar(){const{orgDetail:t,requests:o}=_(),{roles:a,org:i,editable:r}=t||{},[s,u]=C.useState(!1),b=(window.blocklet?.environments||[]).find(g=>g.key===qt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR)?.value||"auto";return e.jsxs(Kt,{children:[e.jsx(m,{className:"list",children:a.map(g=>e.jsx(Gt,{role:g,createPassportSvg:Yt,onUpdate:u,actions:r?e.jsx("div",{className:"action",children:Ut(g.name)?e.jsx(Vt,{}):e.jsx(Jt,{})}):null,passportProps:{issuer:i.name,issuerDid:i.ownerDid,ownerDid:i.ownerDid,preferredColor:b}},g.name))}),s&&e.jsx(Xt,{onCancel:()=>u(!1),roles:a,onSuccess:()=>{u(!1),o.getOrgRoles(i.id)},onDelete:()=>{u(!1),o.getOrgRoles(i.id)},mode:"update",roleName:s.name,item:s,orgId:i.id,hasPermission:r})]})}function lr(){const{t}=N(),{orgDetail:o,passportParams:a}=_(),{org:i,editable:r}=o||{};return r?e.jsx(m,{sx:{display:"flex",gap:1},children:e.jsx(J,{variant:"contained",size:"small",onClick:()=>{a.onTriggerPassportDialog({org:i,open:!0})},startIcon:e.jsx(xt,{}),children:t("team.passport.create.title")})}):null}function cr(){const{teamDid:t,passportParams:o,requests:a}=_(),{visible:i,org:r}=o||{};return i?e.jsx(Qt,{teamDid:t,orgId:r.id,onCancel:()=>o.onTriggerPassportDialog({open:!1}),onSuccess:()=>{o.onTriggerPassportDialog({open:!1}),a.getOrgRoles(r.id)}}):null}function ke({id:t="",inDialog:o=!1}){const{orgDetail:a}=_(),{t:i}=N(),[r,s]=C.useState("members"),{org:u,loading:b,refresh:g,error:y}=a||{},I=[{label:i("team.orgs.members"),value:"members"},{label:i("common.settings"),value:"settings"},{label:i("team.member.passports"),value:"passports"}];if(C.useEffect(()=>{t&&o&&g(t)},[t,o]),y)return e.jsx(_e,{children:y});if(!u)return null;const d=()=>r==="members"?e.jsx(or,{}):r==="passports"?e.jsx(lr,{}):null;return e.jsxs(m,{children:[!o&&e.jsx(Ge,{org:u,loading:b}),e.jsxs(m,{sx:{mt:2},children:[e.jsx(Xe,{org:u,loading:b}),e.jsxs(m,{sx:{mt:1,p:2,border:w=>`1px solid ${w.palette.divider}`,borderRadius:1},children:[e.jsx(Ie,{tabs:I,currentTab:r,onTabChange:s,loading:b,extra:d()}),e.jsxs(m,{sx:{mt:2},children:[r==="members"&&e.jsx(sr,{}),r==="settings"&&e.jsx(ir,{}),r==="passports"&&e.jsx(ar,{})]})]})]})]})}ke.propTypes={id:h.string,inDialog:h.bool};function dr(){const{t,locale:o}=C.useContext(Rt),{teamDid:a}=Fe(),i=C.useRef(null),[r,s]=C.useState(null),[u,b]=C.useState(0),g=$e(),y=`orgs-${a}`,I=Et(y),d=G({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),{editable:w,loading:T,requests:f,onTriggerEditOrg:x,onTriggerCreateOrg:z,refreshTrigger:D}=_(),{data:v,refresh:S}=Ue(async()=>{const M={};d.searchText&&(M.name=d.searchText,M.description=d.searchText);const{orgs:A,paging:k}=await f.getAllOrgs({org:M,paging:{page:d.page,pageSize:d.pageSize}});return b(k.total),A},{refreshDeps:[a,d.page,d.pageSize,d.searchText],onError:M=>{O.error(E(M))}}),U=({page:M,rowsPerPage:A,searchText:k})=>{d.pageSize!==A?(d.pageSize=A,d.page=1):d.page!==M+1?d.page=M+1:d.searchText!==k&&(d.searchText=k,d.page=1)};C.useEffect(()=>{D>0&&S&&S()},[D,S]);const H=[{label:t("common.orgs"),name:"name"},{label:t("common.members"),name:"members",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(Ke,{members:k.members,total:k.membersCount})}}},{label:t("team.orgs.description"),name:"description"},{label:t("common.createdBy"),name:"owner",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(m,{children:e.jsx(ie,{showHoverCard:!1,avatarSize:32,did:k.ownerDid,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0,...g&&{minWidth:"unset"}}})})}}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:M=>e.jsx(m,{children:M?e.jsx(Se,{value:M,locale:o}):"-"})}},w&&{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(M,{rowIndex:A})=>{const k=v[A];return e.jsx(m,{children:e.jsx(Ft,{"data-cy":"orgs-table-actions",actions:[{icon:e.jsx(ht,{}),text:t("common.edit"),onClick:F=>{F.stopPropagation(),x(k)}},{icon:e.jsx(oe,{}),text:t("common.delete"),onClick:F=>{F.stopPropagation(),f.deleteOrg(k)}}]})})}}}],X={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(M,A,k){if(i.current?.contains(k.target)){const F=v[A.dataIndex];s(F)}},page:d.page-1,rowsPerPage:d.pageSize,count:u,searchDebounceTime:600},re=w?[e.jsx(J,{variant:"contained",size:"small",onClick:()=>{z()},children:t("common.create")},"add")]:[];return e.jsxs(m,{children:[e.jsx("div",{ref:i,className:"orgs-table",children:e.jsx(Ne,{className:"orgs-table",verticalKeyWidth:100,loading:T,columns:H,data:v||[],locale:o,durable:y,durableKeys:["page","rowsPerPage"],customButtons:re,options:X,onChange:U})}),r&&e.jsx(ge,{fullWidth:!0,maxWidth:"lg",title:r.name,open:!!r,onClose:()=>s(null),sx:{".MuiDialogContent-root":{pt:0}},children:e.jsx(ke,{id:r.id,inDialog:!0})})]})}function Ze({org:t,onInviteUser:o=te,onDelete:a=te,onClick:i=te,loading:r=!1,editable:s=!0}){const{t:u}=N(),{session:b}=Je(),g=C.useMemo(()=>b?.user?.did===t.ownerDid,[b?.user?.did,t.ownerDid]),y=()=>s?e.jsxs(e.Fragment,{children:[e.jsx(We,{variant:"outlined",size:"small",startIcon:e.jsx(jt,{style:{fontSize:16}}),onClick:d=>{d.stopPropagation(),o?.(t)},children:u("common.invite")}),e.jsx(We,{variant:"contained",color:"error",size:"small",startIcon:e.jsx(oe,{style:{fontSize:16}}),onClick:d=>{d.stopPropagation(),a?.(t)},children:u("common.delete")})]}):null,I=j(()=>g?null:t?.passports?.length>0?e.jsx(Z,{label:t.passports[0].title,size:"small"}):null);return e.jsx(ze,{sx:{flexDirection:{xs:"column",md:"row"},gap:{xs:2,md:2},cursor:"pointer",minWidth:300},onClick:()=>i?.(t),children:e.jsxs(ft,{sx:{boxShadow:1,border:"1px solid",borderColor:"divider",backgroundColor:"background.default",flex:1,display:"flex",flexDirection:"column"},children:[e.jsx(bt,{title:e.jsxs(ze,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"space-between"},children:[r?e.jsx(L,{variant:"text",width:"100%",height:24}):e.jsx(B,{variant:"h4",sx:{fontWeight:600},children:t.name}),r?e.jsx(L,{variant:"text",width:50,height:24}):I()]}),sx:{pb:2}}),e.jsxs(vt,{sx:{pt:0,flex:1,display:"flex",flexDirection:"column",gap:1,"&.MuiCardContent-root":{pb:2}},children:[e.jsx(B,{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",height:56},children:r?e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"text",width:"100%",height:24}),e.jsx(L,{variant:"text",width:"80%",height:24})]}):t.description}),e.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r?e.jsx(L,{variant:"text",width:"30%",height:24}):e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,color:"text.secondary",fontSize:14},children:[e.jsx(yt,{sx:{fontSize:"18px"}}),e.jsxs("span",{children:[t.membersCount||t.members?.length||1," ",u("team.orgs.members")]})]}),e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1},children:r?e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"text",width:50,height:24}),e.jsx(L,{variant:"text",width:50,height:24})]}):y()})]})]})]})})}Ze.propTypes={org:h.object.isRequired,onInviteUser:h.func,onDelete:h.func,onClick:h.func,loading:h.bool,editable:h.bool};const We=Ct(J)`
|
|
2
|
-
font-weight: 500;
|
|
3
|
-
.MuiButton-icon {
|
|
4
|
-
margin-right: 4px;
|
|
5
|
-
}
|
|
6
|
-
`;function et({paging:t,loading:o=!1,onChange:a=()=>{}}){const{locale:i}=N(),r=wt(d=>d.breakpoints.down("lg")),s=j((d,w)=>{a({page:w+1})}),u=j(d=>{const w=Number(d.target.value);a({page:1,pageSize:w})});if(t.pageCount<=1)return null;const{page:b,pageSize:g,total:y}=t,I=b-1<=0?0:b-1;return e.jsx(m,{className:"pagination",sx:{width:"100%",flex:1,display:"flex",justifyContent:r?"center":"flex-end"},children:e.jsx(Ot,{component:"div",disabled:o,count:y,locale:i,page:I,rowsPerPage:g,rowsPerPageOptions:[],onPageChange:s,onRowsPerPageChange:u})})}et.propTypes={paging:h.shape({page:h.number,pageSize:h.number,total:h.number,pageCount:h.number}).isRequired,loading:h.bool,onChange:h.func};function Te({type:t,onInviteUser:o=te,onClickOrg:a=te,editable:i=!0,extra:r=null}){const{t:s}=N(),u=G({page:1,pageSize:6}),{requests:b,loading:g,refreshTrigger:y}=_(),I=C.useMemo(()=>s(t==="owned"?"team.orgs.myCreated":"team.orgs.myJoined"),[t,s]),d=C.useMemo(()=>s(t==="owned"?"team.orgs.myCreatedEmpty":"team.orgs.myJoinedEmpty"),[t,s]),{data:w,refresh:T}=Ue(()=>(t==="owned"?b.getMyCreatedOrgs:b.getMyJoinedOrgs)({paging:u}),{refreshDeps:[u.page,u.pageSize,t]}),{orgs:f=[],paging:x}=w||{},z=C.useMemo(()=>g?[{id:1},{id:2},{id:3}]:f,[g,f]),D=C.useMemo(()=>!g&&f.length===0,[g,f]),v=j(S=>{u.page=S.page});return C.useEffect(()=>{y>0&&T&&T()},[y,T]),e.jsxs(m,{children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[e.jsx(B,{variant:"h6",children:I}),r]}),D?e.jsx(m,{className:"orgs-empty",sx:{py:4},children:e.jsx(_e,{children:d})}):e.jsxs(m,{children:[e.jsx(m,{sx:{display:"grid",px:1,gridTemplateColumns:{md:"1fr",lg:"repeat(2, 1fr)",xl:"repeat(3, 1fr)"},gap:2},children:z.map(S=>e.jsx(Ze,{org:S,onInviteUser:o,onDelete:b.deleteOrg,onClick:a,loading:g,editable:i},S.id))}),x?.pageCount>1&&e.jsx(et,{paging:x,loading:g,onChange:v})]})]})}Te.propTypes={type:h.oneOf(["owned","joined"]).isRequired,onInviteUser:h.func,onClickOrg:h.func,editable:h.bool,extra:h.node};function mr(){const{t}=N(),{onTriggerCreateOrg:o,inviteParams:a}=_(),i=qe(),r=At(),s=j(b=>{a.org=b,a.onTriggerInviteDialog({open:!0,org:b,mode:"list"})}),u=j(b=>{const g=`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs/${b.id}`;i({pathname:g,search:r.search})});return e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(Te,{type:"owned",onInviteUser:s,onClickOrg:u,extra:e.jsx(J,{onClick:o,children:t("common.create")})}),e.jsx(Te,{type:"joined",onInviteUser:s,onClickOrg:u,editable:!1})]})}function tt({mode:t="create",item:o={},onSuccess:a=te,mutationParams:i=void 0}){const[r,s]=C.useState(!1),[u,b]=C.useState(""),{t:g}=N(),y=_(),{requests:I,onCancelMutateOrg:d}=i||y,w=G({name:o.name||"",description:o.description||""}),T=async()=>{const x=w.name.trim();if(!x){b(g("team.orgs.validate.nameEmpty"));return}if(x.length>64){b(g("team.orgs.validate.nameTooLong",{length:64}));return}const z=w.description.trim();if(z.length>255){b(g("team.orgs.validate.descriptionTooLong",{length:255}));return}b(null),s(!0);try{t==="create"?await I.createOrg({name:x,description:z}):await I.updateOrg({id:o.id,name:x,description:z}),d(),a()}catch(D){console.error(D);const v=E(D);b(v),O.error(E(u))}finally{s(!1)}},f=e.jsxs("div",{children:[e.jsx(B,{component:"div",style:{marginTop:16},children:e.jsx(me,{label:g("team.orgs.mutate.name"),autoComplete:"off",variant:"outlined",name:"name","data-cy":"mutate-org-input-name",fullWidth:!0,autoFocus:!0,value:w.name,onChange:x=>{b(null),w.name=x.target.value},disabled:r})}),e.jsx(B,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx(me,{label:g("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-org-input-description",fullWidth:!0,value:w.description,onChange:x=>{b(null),w.description=x.target.value},disabled:r,multiline:!0,rows:3})})]});return e.jsxs(ge,{title:g("team.orgs.mutate.title",{mode:g(t==="create"?"common.create":"common.update")}),fullWidth:!0,open:!0,onClose:d,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ee,{onClick:d,color:"inherit",children:g("common.cancel")}),e.jsxs(Ee,{"data-cy":"mutate-org-confirm",onClick:T,color:"primary",disabled:r,variant:"contained",autoFocus:!0,children:[r&&e.jsx(Tt,{size:16}),g(t==="create"?"common.create":"common.update")]})]}),children:[e.jsx(Be,{component:"div",children:f}),!!u&&e.jsx(St,{severity:"error",style:{width:"100%",margin:0},children:u})]})}tt.propTypes={mode:h.oneOf(["create","update"]),item:h.object,onSuccess:h.func,mutationParams:h.object};var ur={};const Le=20;function gr(){const{t,locale:o}=N(),{api:a}=He(),{inviteParams:i,teamDid:r,requests:s}=_(),{showInvite:u,onTriggerInviteDialog:b,org:g,inviteLink:y,roles:I}=i||{},[d,w]=C.useState([]),[T,f]=C.useState(""),[x,z]=C.useState(!1),[D,v]=C.useState(""),[S,U]=C.useState("internal"),[H,X]=C.useState(""),[re,M]=C.useState(0),A=[{label:t("blocklet.internal"),value:"internal"},{label:t("blocklet.external"),value:"external"}],k=Wt(()=>{const{settings:l}=window.blocklet||{};return Ve(l,"notification.email.enabled")},[]),F=Lt(D,{wait:500}),{data:pe,loadMore:xe,loadingMore:ee}=Bt(async l=>{const P=l?Math.ceil(l.list.length/Le)+1:1,W=await a.getOrgInvitableUsers({input:{teamDid:r,id:g.id,query:{search:F},paging:{page:P,pageSize:Le}}}),{users:q=[],paging:n}=W||{};return{list:q,total:n?.total||0}},{reloadDeps:[r,F,g.id],isNoMore:l=>l?.list.length?l.list.length>=l?.total:!0,onError:l=>{console.error("Get users failed",l)}}),{list:V=[],total:ne=0}=pe||{},Q=V.length<ne,he=j(l=>{const P=l.target,{scrollTop:W,scrollHeight:q,clientHeight:n}=P;q-W-n<50&&!ee&&Q&&xe()}),Y=j(()=>{w([]),f(""),v(""),U("internal"),X(""),M(0),b({open:!1})}),se=j(async()=>{if(S==="internal"&&!d.length){O.error(t("team.orgs.invite.pleaseSelectUsers"));return}if(S==="external"&&!H.trim()){O.error(t("team.orgs.invite.pleaseEnterEmail"));return}if(!T){O.error(t("team.orgs.invite.pleaseSelectRole"));return}try{const l=S==="internal"?d.map(W=>W.did):[],P=S==="external"?H.trim():"";await s.inviteMembers({userDids:l,email:P,role:T,inviteType:S}),S==="external"?M(1):Y()}catch(l){console.error(l),O.error(E(l))}finally{z(!1)}}),fe=j(l=>{w(P=>P.filter(W=>W.did!==l.did))}),be=j(l=>{U(l),l==="external"?w([]):X("")}),ve=j(()=>{if(["1","true"].includes(ur.IS_E2E)){Y();return}Nt(y),O.success(t("common.copied")),Y()}),K=[{title:t("team.orgs.invite.inviteTitle",{orgName:g.name}),body:()=>e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(m,{sx:{display:"flex",justifyContent:"flex-start"},children:e.jsx(Ie,{tabs:A,currentTab:S,onTabChange:be,loading:x})}),S==="internal"&&e.jsx(Pt,{multiple:!0,options:V,"data-cy":"invite-org-select-users",loading:ee,disabled:x,getOptionLabel:l=>`${l.fullName||l.name||l.did||""}`,isOptionEqualToValue:(l,P)=>l.did===P.did,filterOptions:l=>l,value:d,inputValue:D,onChange:(l,P,W,q)=>{if(W==="selectOption"){const n=q.option,c=d.some(p=>p.did===n.did);w(c?p=>p.filter(R=>R.did!==n.did):p=>[...p,n]),v("")}else w(P)},onInputChange:(l,P,W)=>{W==="input"?v(P):W==="clear"&&v("")},renderInput:l=>e.jsx(me,{...l,label:t("common.member"),placeholder:t("team.orgs.invite.chooseUsersToInvite"),slotProps:{input:{...l.InputProps,endAdornment:e.jsxs(e.Fragment,{children:[ee&&e.jsx(m,{sx:{ml:1,fontSize:14,color:"text.secondary"},children:t("common.loading")}),l.InputProps.endAdornment]})}}}),renderValue:l=>e.jsx(m,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:l.map(P=>e.jsx(ie,{did:P.did,avatarSize:20,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0,minWidth:150,maxWidth:150},showHoverCard:!1,renderTopRightContent:()=>e.jsx(Oe,{size:"small",onClick:()=>fe(P),children:e.jsx(It,{sx:{fontSize:14}})})},P.did))}),slotProps:{listbox:{onScroll:he,sx:{maxHeight:300}},popper:{placement:"bottom-start",modifiers:[{name:"flip",enabled:!0,options:{altBoundary:!0,rootBoundary:"document",padding:8}}]}},renderOption:(l,P,{index:W})=>{const q=d.some(c=>c.did===P.did),n=W===V.length-1;return e.jsxs(m,{children:[e.jsx(m,{component:"li",...l,sx:{backgroundColor:q?"action.selected":"transparent",fontWeight:q?600:400,"&:hover":{backgroundColor:q?"action.selected":"action.hover"},position:"relative"},children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[e.jsx(m,{sx:{flex:1},children:e.jsx(ie,{avatarSize:32,did:P.did,showDid:!0,cardType:ae.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0},showHoverCard:!1})}),q&&e.jsx(m,{sx:{width:20,height:20,borderRadius:"50%",backgroundColor:"primary.main",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",ml:1},children:"✓"})]})},P.did),n&&Q&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",py:1,color:"text.secondary",fontSize:"0.875rem"},children:t(ee?"common.loadingMore":"common.loadMore")})]},P.did)}}),S==="external"&&e.jsx(me,{fullWidth:!0,type:"email",label:t("common.email"),placeholder:t("team.orgs.invite.enterEmailAddress"),value:H,onChange:l=>X(l.target.value),disabled:x,variant:"outlined"}),e.jsxs(Dt,{fullWidth:!0,variant:"outlined",children:[e.jsx(kt,{children:t("common.passport")}),e.jsx(Mt,{"data-cy":"invite-org-select-role",value:T,onChange:l=>{f(l.target.value)},fullWidth:!0,label:t("common.passport"),disabled:x,onKeyPress:l=>{l.key==="Enter"&&(l.preventDefault(),se())},children:I.map(l=>e.jsx(zt,{value:l.name,"data-cy":`invite-org-select-option-${l.name}`,children:e.jsxs(m,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(B,{variant:"subtitle1",children:l.title||l.name}),e.jsx(B,{variant:"caption",sx:{opacity:.7},children:l.description})]})},l.name))})]})]}),onConfirm:se},{title:t("team.inviting.link"),body:()=>e.jsxs("div",{children:[e.jsx(m,{sx:{fontSize:16,fontWeight:"bold"},children:t("team.member.inviteDialog.createSuccessTip",{expireDate:Ht("1760765405325",o)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Zt,{children:y}),k&&e.jsx(m,{sx:{mt:2},children:e.jsx(B,{variant:"body1",children:t("team.orgs.invite.inviteLinkSendToEmail",{email:H})})})]}),confirm:t("common.copy"),onConfirm:ve}][re];return e.jsx(ge,{title:K.title||t("common.invite"),open:u,onClose:Y,maxWidth:"sm",fullWidth:!0,showCloseButton:!0,actions:[e.jsx(J,{onClick:Y,disabled:x,children:t("common.cancel")},"cancel"),e.jsx(J,{loading:x,onClick:K.onConfirm,variant:"contained",disabled:S==="internal"&&!d.length||S==="external"&&!H.trim()||x,children:K.confirm||t("common.invite")},"invite")],sx:{".MuiDialogContent-root":{pt:0}},children:e.jsx(Be,{className:"dialog-content-body",component:"div",children:typeof K.body=="function"?K.body():K.body})})}function rt({layout:t="card",id:o=""}){const{t:a}=N(),{mutationParams:i,inviteParams:r,orgDetail:s,requests:u,passportParams:b}=_(),{invitations:g,org:y}=s||{},{showInvite:I,showInviting:d,onTriggerInvitingDialog:w}=r||{},T=()=>o?e.jsx(ke,{id:o}):t==="table"?e.jsx(dr,{}):e.jsx(mr,{}),f=j(()=>{u.getOrgInvitations(y.id)});return e.jsxs(m,{children:[T(),i.mode?e.jsx(tt,{mode:i.mode,item:i.org}):null,I?e.jsx(gr,{}):null,d?e.jsx(ge,{title:a("common.inviting"),onClose:()=>w({open:!1}),open:d,maxWidth:"lg",fullWidth:!0,children:e.jsx(er,{invitations:g,onRefresh:f})}):null,b.visible?e.jsx(cr,{}):null]})}rt.propTypes={layout:h.oneOf(["table","card"]),id:h.string};function nt({layout:t="card",mode:o="user-center",editable:a=!0,id:i=""}){return e.jsx(nr,{editable:a,mode:o,id:i,children:e.jsx(rt,{layout:t,id:i})})}nt.propTypes={layout:h.oneOf(["table","card"]),mode:h.oneOf(["dashboard","user-center"]),editable:h.bool,id:h.string};const Er=Object.freeze(Object.defineProperty({__proto__:null,default:nt},Symbol.toStringTag,{value:"Module"}));export{nt as O,De as T,Er as i};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import{r as x}from"./vendor-react-CUXIiAnY.js";import{j as e,W as d,am as mt,ak as N,T as Q,U as ke,y as Fe,cI as Ve,b5 as Re,b6 as Te,a5 as Ie,Q as Ce,cJ as Pe,aN as Ee,a6 as Ge,D as Qe,ci as ht,ad as Ye,cK as gt,cL as xt,at as ae,c2 as qe,n as bt,J as yt,x as jt,bc as St,M as He,cx as vt}from"./vendor-mui-core-B5XNUjey.js";import{e as ee,F as Ct,a0 as pe}from"./vendor-utils-CFxoplqC.js";import{H,Q as Nt,V as J,ac as wt,m as Je,$ as Xe,n as Ae,h as Ze,ad as be,b as Rt,j as Tt,z as It,a2 as Et}from"./vendor-ux-BX9dSNUy.js";import{_ as At,a1 as q,c as E,o as Dt,aS as Ue}from"./index-Dijoh4El.js";import{a as Y,g as De}from"./vendor-hooks-U4TTuKG0.js";import{S as me}from"./shorten-label-DhOty_4j.js";import{v as et}from"./index-BjLM8Gon.js";import{R as tt,A as Ot,S as Lt,a as kt,B as Ft}from"./list-Cj5o6_aJ.js";import{j as Pt,c as _t,N as Bt}from"./team-HgvOpVEJ.js";import{W as zt}from"./did-address-Qmm0nyiR.js";import{p as st}from"./util-DSnAozzs.js";import{D as Wt,g as Kt}from"./traffic-BvA-dAE6.js";import{B as nt}from"./bundle-avatar-CfVy3gda.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D4Rvz_D3.js";import"./server-logo-notext.svg-DHxZ1bRk.js";import"./session-DUT2afHJ.js";import"./isURL-wZZwzwyC.js";import"./use-app-logo-D9eQSUYq.js";import"./base32-E_M8YiDy.js";import"./useAsyncRetry-CSW1hopB.js";import"./useAsync-DNDhrs-2.js";import"./iframe-DbxlfoSv.js";import"./index-6M8OhYM1.js";import"./index-DBs9Ljax.js";import"./base-chart-BXspUQ5X.js";import"./index-DK4Rvfj9.js";import"./vendor-mui-x-DtPl0qBm.js";import"./AdapterDayjs-p1MGZm94.js";const at=x.createContext({}),{Provider:Mt,Consumer:qs}=at;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=At(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Y(()=>s.meta?.did,[s]),[y,v]=x.useState([]),[P,F]=x.useState({}),w=Y(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[q(T.dateRange[0]).toISOString(),q(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return H.error(D.message),[]}},K=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[q(T.dateRange[0]).toISOString(),q(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw H.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&K()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const X={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:y,getReceivers:V,inService:r,teamDid:h};return e.jsx(Mt,{value:{notificationRecords:X},children:t})}function _e(){const{notificationRecords:t}=x.useContext(at);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(Nt,{type:Ht[t],children:t})}const Ut=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function it(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:Dt(i,s)}):"",S=Ut(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},rt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},$t=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:ot(t),enabled:n}},Vt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:rt(t),enabled:n}},Gt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Qt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Yt=(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})}]:[],xe=(t=[])=>{const s=q().startOf("day");return t.filter(n=>q(n.sendAt).isSame(s,"day")).length},Jt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},je=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Xt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},lt=()=>({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 te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(mt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Q,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Q,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=J();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Q,{children:[s,": "]}),t.map(l=>{const b=it(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.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 Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ve,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(y=>y!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=J(),m=it(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=J(),r=q().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){H.error("Please select a date range");return}if(q(h.startDate).isAfter(h.endDate)||!q(h.startDate).isValid()||!q(h.endDate).isValid()){H.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Q,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[Ue(t[0],n)," - ",Ue(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Kt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=J();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{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(wt.TableFilterList,{...s,ItemComponent:t})})]})}function Ke({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Ke.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const Zt=[{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}];ct.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function ct({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=J(),[i,l]=x.useState(Zt),[b,m]=x.useState(!0),S=(y,v)=>{v.checked=y.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=y=>{y.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Q,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ve,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(y=>e.jsx(Te,{control:e.jsx(Ie,{checked:y.checked,onChange:v=>S(v,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:y=>m(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ge,{size:16}),r("common.confirm")]})]})]})}dt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function dt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=J(),l=Qe(),b=x.useMemo(()=>Je(l,lt()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:y,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),K=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,X]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[q().subtract(1,"month").startOf("day").toDate(),q().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{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"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:st(c.receiverUser.avatar,h,S)}}));U(o),X(a.paging),F(!1)}catch(a){H.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],M=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(M,p.emailSendStatus)||g(W=>({...W,emailSendStatus:M,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await y(o);return c?a==="wallet"?Gt(c):a==="email"?$t(v,c):a==="pushKit"?Vt(v,c):a==="webhook"?Qt(c):!0:!1},[y,v]),Ne=x.useCallback(a=>Yt(r,a),[r]),f=()=>{K.anchorEl=null,K.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},j=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await j(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await j(["webhook"],[a.receiver],c,o)}catch(C){H.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Jt(o,c)>=4){H.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const M=a.currentTarget,W=M.getBoundingClientRect();K.anchorEl=M,K.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const M=await oe(c,o.receiver);await ge(1),$({channel:c,result:M}),(typeof M=="boolean"&&M||Ct(M)&&Object.values(M).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(M){H.error(M.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Y(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Xe,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(zt,{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:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:M=>R(M,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(tt,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),ft=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(ht,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ts,{children:e.jsxs(Ye,{theme:b,children:[e.jsx(Ze,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:ft,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Ke,{...o,canDelete:()=>!1})})}}),K.anchorEl&&e.jsx(Ee,{open:!!K.anchorEl,anchorReference:"anchorPosition",anchorPosition:K.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ss,{children:[e.jsxs(Q,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Q,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(gt,{}):e.jsx(Ge,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Q,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(xt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(ct,{loading:n,onCancel:u,onConfirm:I})})]})})})}const es=x.memo(dt),ts=ae.div`
|
|
2
|
-
td.MuiTableCell-footer {
|
|
3
|
-
border: none !important;
|
|
4
|
-
}
|
|
5
|
-
.sent-status-cell {
|
|
6
|
-
.resend-btn {
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
&:hover {
|
|
10
|
-
.resend-btn {
|
|
11
|
-
display: flex;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`,ss=ae.div`
|
|
16
|
-
padding: 8px 16px;
|
|
17
|
-
.check-title {
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
margin-bottom: 8px;
|
|
20
|
-
&::first-letter {
|
|
21
|
-
text-transform: uppercase;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
.check-item {
|
|
25
|
-
svg {
|
|
26
|
-
font-size: 16px;
|
|
27
|
-
}
|
|
28
|
-
font-size: 12px;
|
|
29
|
-
}
|
|
30
|
-
`,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function ns(t){const{wallet:s,push:n,email:r,webhook:i}=t;return[{name:"Wallet",value:e.jsx(de,{item:s})},{name:"Push",value:e.jsx(de,{item:n})},{name:"Email",value:e.jsx(de,{item:r})},...i.total>0?[{name:"Webhook",value:e.jsx(de,{item:i,isWebhook:!0})}]:[]]}function as(t,s,n){const{wallet:r,push:i,email:l,webhook:b}=t;return[{name:"Wallet",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.PUSH,item:i,onResend:s})},{name:"Email",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(ue,{loading:n,channel:E.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}Me.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};de.propTypes={item:d.object.isRequired,isWebhook:d.bool};function de({item:t,isWebhook:s=!1}){const{t:n}=J(),r=s?t.success.length:t.success,i=t.total,l=r===i?"success":"failed";return e.jsx(N,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(te,{config:{status:l},enableTooltip:!1,children:[fe(r)," / ",fe(i)," ",n("notification.sendStatus.success")]})})})}ue.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};function ue({channel:t=E.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:n=!1,onResend:r=()=>{},loading:i=!1}){const{t:l}=J(),{success:b,failed:m,pending:S}=s,h=Xt(t),y=n?b.length:b,v=n?m.length:m,P=n?S.length:S,F=async L=>{L.stopPropagation();const k=n?[...new Set([...b,...m].map($=>$))]:[];await r([t],[],!0,k)},w=y+v,U=w>0?y/w*100:0,K=w>0?v/w*100:0;return e.jsxs(is,{successRatio:U,failedRatio:K,children:[e.jsxs(Q,{variant:"h6",children:[h," (",s.total,")"]}),e.jsxs(Q,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Oe.success,fontWeight:600,fontSize:24},children:fe(y)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(N,{className:"unsent-area",children:[e.jsxs(N,{children:[e.jsxs(te,{config:{status:"failed"},enableTooltip:!1,children:[fe(v)," ",l("notification.sendStatus.failed")]}),e.jsxs(te,{config:{status:"pending"},enableTooltip:!1,children:[fe(P)," ",l("notification.sendStatus.pending")]})]}),v>0&&e.jsx(N,{className:"resend-btn",children:e.jsx(Ae,{size:"small",color:"primary",loading:i,variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:F,children:l("notification.resend")})})]})]})}function Me({statistics:t,mode:s="simple",onResend:n=()=>{},resending:r=!1}){const i=Y(()=>s==="simple"?ns(t):as(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:i.map(l=>e.jsx(et,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(qe,{container:!0,spacing:2,children:i.map(l=>e.jsx(qe,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const is=ae(N)`
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
align-items: flex-start;
|
|
34
|
-
padding: 16px;
|
|
35
|
-
border-radius: 8px;
|
|
36
|
-
background: ${({successRatio:t,failedRatio:s,theme:n})=>t===0&&s===0?n.palette.grey[300]:`linear-gradient(to right, ${bt(n.palette.success.light,.4)} ${t}%, ${n.palette.grey[100]} ${t}%)`};
|
|
37
|
-
transition: 'background 0.5s ease';
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
.unsent-area {
|
|
40
|
-
width: 100%;
|
|
41
|
-
position: relative;
|
|
42
|
-
.resend-btn {
|
|
43
|
-
position: absolute;
|
|
44
|
-
right: 0;
|
|
45
|
-
bottom: 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`;ut.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function ut({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:i,locale:l}=J(),{getComponent:b,resendNotification:m}=_e(),[S,h]=x.useState(!1),y=Y(()=>b(t.componentDid)||n,[n,t.componentDid]),v=De({tab:r||"info"}),P=x.useCallback(async(p,g,T=!0,D=[])=>{if(!p.length||!t.id)return;const O=g.length>0?g:t?.receivers?.map(_=>_.receiver);if(!O.length)return;let z=[...p];if(z.includes(E.NOTIFICATION_SEND_CHANNEL.PUSH)&&!rt(n)&&(H.warning(i("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),z=z.filter(_=>_!==E.NOTIFICATION_SEND_CHANNEL.PUSH)),z.includes(E.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!ot(n)&&(H.warning(i("notification.sendStatus.reason.unavailable",{channel:"Email"})),z=z.filter(_=>_!==E.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!z.length)try{h(!0),await m({notificationId:t.id,receivers:O,channels:z,resendFailedOnly:T,...z.includes("webhook")&&D.length?{webhookUrls:D}:{}}),H.success("Message has been sent!")}catch(_){console.error("handleResend error",{error:_}),H.error(_.response?_.response.statusText:_.message)}finally{h(!1)}},[n,t.id,t?.receivers,m,i]),F=Y(()=>Pt(t),[t]),w=Y(()=>_t(t),[t]),U=Y(()=>F?t?.actorInfo:[],[t]),K=Y(()=>n?.did||n?.meta?.did||"",[n]);function L(){return[{name:i("notification.from"),value:F&&w?e.jsx(Ot,{actors:U,teamDid:K,size:32,showName:!0}):e.jsx(Lt,{size:32,blocklet:y,showName:!0,hideDot:!0})},{name:i("notification.notificationTitle"),value:e.jsx(me,{maxLength:50,children:t.title})},{name:i("notification.body"),value:F?e.jsx(kt,{notification:t,blocklet:n}):e.jsx(Bt,{notification:t,rows:0})},{name:i("notification.severity"),value:e.jsx(he,{severity:t.severity})},{name:i("notification.createdAt"),value:e.jsx(It,{value:t.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(et,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const k={info:{label:i("common.basicInfo"),value:"info",component:L},receivers:{label:i("notification.receiver"),value:"receivers"},statistics:{label:i("notification.statistics"),value:"statistics"}},$=Object.values(k).map(({label:p,value:g})=>({label:p,value:g})),V=k[v.tab]||k.info,X=p=>{v.tab=p};return e.jsx(Rt,{title:i("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{v.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(rs,{children:[e.jsx(N,{className:"tabs",sx:{mx:3},children:e.jsx(Tt,{tabs:$,current:v.tab,onChange:X,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[v.tab==="receivers"&&e.jsx(es,{notificationId:t.id,resending:S,handleResend:P}),v.tab==="statistics"&&e.jsx(Me,{statistics:t.statistics,mode:"detail",resending:S,onResend:P}),v.tab==="info"&&e.jsx(V.component,{})]})]})})}const os=x.memo(ut),rs=ae.div`
|
|
49
|
-
& > .notification-row {
|
|
50
|
-
padding: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.tabs {
|
|
54
|
-
margin: 0;
|
|
55
|
-
}
|
|
56
|
-
.body {
|
|
57
|
-
margin-top: 16px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.channel-item {
|
|
61
|
-
display: flex;
|
|
62
|
-
padding: 4px;
|
|
63
|
-
justify-content: flex-start;
|
|
64
|
-
align-items: center;
|
|
65
|
-
gap: 8px;
|
|
66
|
-
> p {
|
|
67
|
-
font-size: 15px;
|
|
68
|
-
}
|
|
69
|
-
.resend-btn {
|
|
70
|
-
svg {
|
|
71
|
-
font-size: 16px;
|
|
72
|
-
}
|
|
73
|
-
display: flex;
|
|
74
|
-
align-items: center;
|
|
75
|
-
font-size: 12px;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
&.disabled {
|
|
78
|
-
cursor: not-allowed;
|
|
79
|
-
color: ${be.text.disabled};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;ve.propTypes={blocklet:d.object,label:d.string};const ls=ae.div`
|
|
84
|
-
display: flex;
|
|
85
|
-
justify-items: flex-start;
|
|
86
|
-
align-items: center;
|
|
87
|
-
gap: 8px;
|
|
88
|
-
.name {
|
|
89
|
-
display: block;
|
|
90
|
-
max-width: 260px;
|
|
91
|
-
white-space: nowrap;
|
|
92
|
-
overflow: hidden;
|
|
93
|
-
text-overflow: ellipsis;
|
|
94
|
-
}
|
|
95
|
-
`;function ve({blocklet:t=null,label:s=""}){return e.jsx(ls,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(nt,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}pt.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function pt({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Q,{children:[s,": "]}),t.map(r=>e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(he,{severity:r})}),onDelete:i=>n(i,r)},r))]})}function cs(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(he,{severity:s})})}function ds({customTableButtons:t}){const{t:s,locale:n}=J(),r=Qe(),i=yt(r.breakpoints.down("sm")),l=x.useMemo(()=>Je(r,lt()),[r]),[b,m]=x.useState(!1),{data:S,paging:h,blocklet:y,fetch:v,getComponent:P,componentDids:F,inService:w,teamDid:U}=_e(),K=x.useRef(null),[L,k]=x.useState(null),[$,V]=x.useState("info"),X=`notification-records-${y.meta?.did}`,p=Et(X),[g,T]=x.useState({pageSize:p.rowsPerPage||10,page:p.page?p.page+1:1,dids:p.dids||[],dateRange:p.dateRange||[q().subtract(1,"month").startOf("day").toDate(),q().endOf("day").toDate()]}),D=Y(()=>{if(!y.children||!y.children.length)return[];const f=[];return y.children.forEach(u=>{const j=u.did||u.meta?.did;F.includes(j)&&(u.ancestors=[y],f.push(u))}),f},[F,y]),O=async f=>{try{m(!0),await v(f),m(!1)}finally{m(!1)}};x.useEffect(()=>{O(g)},[g]),x.useEffect(()=>{const f=S.find(u=>u.id===L?.id);L&&f&&k({...f})},[S]);const z=(f,u,j,I)=>{f.stopPropagation();const A=j.filter(R=>R!==u);T(R=>({...R,[I]:A,page:1}))},_=({page:f,rowsPerPage:u,filterList:j})=>{const[I=[],,,,A=[]]=j;g.pageSize!==u?T(R=>({...R,pageSize:u,page:1})):g.page!==f+1?T(R=>({...R,page:f+1})):pe(g.dids,I)?pe(g.severities,A)||T(R=>({...R,severities:A,page:1})):T(R=>({...R,dids:I,page:1}))},ie=x.useCallback(()=>{k(null),V("info")},[]),se=x.useCallback(()=>{v(g)},[v,g]),Z=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((u,j)=>{if(u==="system")return e.jsx("span",{children:s("notification.system")},`system-${j}`);const I=D.find(A=>(A.did||A.meta?.did)===u);return e.jsx(ve,{blocklet:I,label:I?.title||I?.meta?.title},u)}),update:(f,u,j)=>(f[j].splice(u,1),f)},filterOptions:{names:D,logic:(f,u)=>u.length?!u.includes(f):!1,display:(f,u,j,I)=>e.jsxs(Fe,{style:{width:"380px"},children:[e.jsx(jt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(St,{multiple:!0,value:f[j],renderValue:A=>e.jsx(N,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:A.map(R=>{if(R==="system")return e.jsx("span",{children:s("notification.system")},R);const re=D.find(ne=>(ne.did||ne.meta?.did)===R);return e.jsx(ve,{blocklet:re,label:re?.title||re?.meta?.title},R)})}),onChange:A=>{f[j]=A.target.value,u(f[j],j,I)},children:[e.jsx(He,{value:"system",children:s("notification.system")}),D.map(A=>{const R=A.did||A.meta?.did;return e.jsx(He,{value:R,children:e.jsx(ve,{blocklet:A,label:A.title||A.meta?.title})},R)})]})]})},customBodyRenderLite:f=>{const u=S[f],j=P(u.componentDid);return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[j?e.jsx(nt,{size:32,blocklet:j,ancestors:j.ancestors??[]}):e.jsx(Ft,{blocklet:y,size:32}),e.jsx(me,{maxLength:50,children:j?.meta?.title||y?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const u=S[f],{receivers:j}=u;return e.jsx(vt,{total:j.length,renderSurplus:I=>I<100?e.jsxs("span",{children:["+",I]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:I=>{I.stopPropagation(),k(u),V("receivers")},children:j.map(I=>{const{receiverUser:A}=I,R=st(A.avatar,U,w);return e.jsx(Xe,{alt:A.fullName,src:`${R}?imageFilter=resize&w=48&h=48`,size:32,did:I.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},I.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const u=S[f];return e.jsx(N,{onClick:j=>{j.stopPropagation(),k(u),V("statistics")},children:e.jsx(Me,{statistics:u.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const u=S[f];return e.jsx(me,{maxLength:50,children:u.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const u=S[f];return e.jsx(he,{severity:u.severity})},filter:!0,filterType:"custom",filterList:g.severities??[],customFilterListOptions:{render:f=>e.jsx(pt,{list:f,label:s("notification.severity"),onDelete:(u,j)=>{u.stopPropagation(),z(u,j,Z[4].options.filterList,"severities")}}),update:ye},filterOptions:{names:$e,fullWidth:!0,logic:je,display:(f,u,j,I)=>e.jsx(cs,{label:s("notification.severity"),filterList:f,onChange:u,index:j,column:I,filterValues:$e})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:u}=S[f];return e.jsx(tt,{value:u,locale:n,shouldUpdate:!0})}}}],oe=f=>{T(u=>({...u,dateRange:f,page:1}))},Ne=[...t||[]];return e.jsxs(N,{ref:K,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(us,{isBreakpointsDownSm:i,children:e.jsx(Ye,{theme:l,children:e.jsx(Ze,{className:"main-table",verticalKeyWidth:100,loading:b,locale:n,columns:Z,data:S,durable:X,onChange:_,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...p,onRowClick:(f,{dataIndex:u})=>{k(S[u])}},title:e.jsx(ze,{value:g.dateRange,onChange:oe}),customButtons:Ne,components:{TableFilterList:f=>e.jsx(We,{...f,itemComponent:u=>e.jsx(Ke,{...u,canDelete:j=>j?.columnNames?.[j?.index||0]?.name==="sender"})})}})})}),L&&e.jsx(os,{refresh:se,onCancel:ie,notification:L,blocklet:y,tab:$})]})}const us=ae.div`
|
|
96
|
-
td.MuiTableCell-footer {
|
|
97
|
-
border: none !important;
|
|
98
|
-
}
|
|
99
|
-
.sent-status-cell {
|
|
100
|
-
.resend-btn {
|
|
101
|
-
display: none;
|
|
102
|
-
}
|
|
103
|
-
&:hover {
|
|
104
|
-
.resend-btn {
|
|
105
|
-
display: flex;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.custom-toobar-btns {
|
|
111
|
-
gap: 4px;
|
|
112
|
-
}
|
|
113
|
-
.custom-toobar-title-inner {
|
|
114
|
-
display: flex;
|
|
115
|
-
justify-content: ${({isBreakpointsDownSm:t})=>t?"space-between":"flex-end"};
|
|
116
|
-
padding-right: ${({isBreakpointsDownSm:t})=>t?"0":"8px"};
|
|
117
|
-
flex-wrap: wrap;
|
|
118
|
-
gap: 8px;
|
|
119
|
-
}
|
|
120
|
-
`;ps.propTypes={blocklet:d.object.isRequired,customTableButtons:d.array};function ps({blocklet:t={},customTableButtons:s=[]}){return e.jsx(qt,{blocklet:t,children:e.jsx(ds,{customTableButtons:s})})}export{ps as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-CUXIiAnY.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bn as B,I as P,a6 as W,bF as M,aj as X,bG as G}from"./vendor-mui-core-B5XNUjey.js";import{C as H}from"./Google-qCiUM9VP.js";import{p as U}from"./vendor-ux-BX9dSNUy.js";import{c as Y}from"./create-passport-svg-BwqsyTOz.js";import{A as $}from"./vendor-arcblock-D4Rvz_D3.js";import{e as J}from"./index-Dijoh4El.js";import{R as Q}from"./required-B0Gua-D1.js";import{F as Z}from"./form-wrapper-dz0PgYyA.js";import{L as v}from"./logo-uploader-CMuaTg_2.js";import{A as ee,a as ne,b as te}from"./collapse-DRXViE1U.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:l}){const[i,c]=u.useState(!1),m=u.useRef(),f=u.useRef(s);u.useEffect(()=>{let a=null;return n&&(a=setTimeout(()=>{c(!0)},50)),()=>{clearTimeout(a)}},[n]);const h=a=>{f.current=a,l(a)},b=()=>{c(!1),l(f.current)},y=e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(j,{onKeyDown:b,sx:{display:"flex",flexGrow:1,alignItems:"center",height:"40px"},children:[e.jsx(j,{onClick:()=>c(!0),sx:{display:"flex",alignItems:"center"},children:e.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(L,{open:i,anchorEl:m.current,onClose:()=>c(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(H,{color:s,onChange:a=>h(a.hex)})})]});return n?p:y}T.propTypes=S;function D({editing:n,description:s,value:l,onChange:i,componentProps:c={},...m}){const{placeholder:f}=c,h=u.useRef(l),{t:b}=u.useContext(U),y=a=>{a.key==="Enter"&&i(h.current,"confirm")},p=a=>{h.current=a,i(a)};return n?e.jsx(A,{style:{flex:1},fullWidth:!0,value:l,onChange:a=>{a.persist(),p(a.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||f,onKeyDown:y,...m}):e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:l||e.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:s||f})})})}D.propTypes=S;function O({editing:n,value:s,onChange:l,componentProps:i,...c}){const{blocklet:m}=i,f=s==="auto"?$(m.appDid):s;return e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Y({title:"Owner",issuer:J.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...c,editing:n,value:n?f:s,onChange:l,componentProps:i})]})}O.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};const re=G`
|
|
2
|
-
0%, 100% {
|
|
3
|
-
transform: scale(1) translateX(0);
|
|
4
|
-
}
|
|
5
|
-
50% {
|
|
6
|
-
transform: scale(1.05) translateX(-3px);
|
|
7
|
-
}
|
|
8
|
-
25%, 75% {
|
|
9
|
-
transform: scale(1.1) translateX(3px);
|
|
10
|
-
}
|
|
11
|
-
`,oe={input:D,color:T,passport:O,uploader:n=>e.jsx(v,{...n.componentProps})};function se(n,{editing:s=!1}){const{componentType:l="input",render:i,renderFormItem:c}=n;return s&&c?c:!s&&i?i:oe[l?.toLowerCase()]}V.propTypes={item:o.object.isRequired,findEditingItem:o.func.isRequired,getItemValue:o.func.isRequired,onFormItemChange:o.func.isRequired,onFocusOut:o.func.isRequired,disabled:o.bool,loading:o.bool,onCancel:o.func,formValues:o.object.isRequired};function V({item:n,findEditingItem:s,getItemValue:l,onFormItemChange:i,onFocusOut:c,disabled:m=!1,loading:f=!1,onCancel:h=()=>{},formValues:b}){const{key:y,description:p,required:a,solo:R=!1,hidden:g=!1,componentProps:C={},skipButtonDisabled:w=!1}=n;if(g)return null;const F=s(y),{editing:I,shaking:E}=F??{},q=l(n,{editing:I}),r=se(n,{editing:I}),t={inputProps:{"data-cy":"schema-form-item-component"},key:y,description:p,editing:I,value:q,onChange:(x,d="change")=>i(n,x,d),componentProps:C,skipButtonDisabled:w,onBlur:()=>c(n)};return n.componentType==="collapse"&&n.children?.length>0?e.jsxs(ee,{children:[e.jsx(ne,{expandIcon:e.jsx(B,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:n.description}),e.jsx(te,{children:n.children.map(x=>e.jsx(V,{item:x,findEditingItem:s,getItemValue:l,onFormItemChange:i,onFocusOut:c,formValues:b,disabled:m,loading:f,onCancel:h},x.key))})]}):e.jsxs(j,{className:"form-item",children:[!R&&e.jsxs(j,{className:"form-item-label",sx:{color:a&&!q?"error.main":"text.secondary"},children:[p,a&&e.jsx(Q,{})]}),e.jsxs(j,{className:"form-item-body",children:[e.jsx(j,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:R?"center":"left"},style:{cursor:"text"},onClick:()=>{m||F?.edited||w||i(n,b[y],"edit")},children:e.jsx(r,{...t})}),!R&&e.jsx(j,{className:"form-item-action",style:{marginLeft:0},children:I?e.jsxs(e.Fragment,{children:[F.edited?e.jsx(P,{"data-cy":"schema-form-item-confirm",onClick:()=>{i(n,q,"confirm")},disabled:m||f,sx:{animation:E?`${re} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:f?e.jsx(W,{size:24}):e.jsx(M,{})}):null,e.jsx(P,{"data-cy":"schema-form-item-cancel",onClick:()=>h(n),style:{paddingLeft:F.edited?4:8},disabled:m||f,size:"large",children:e.jsx(X,{})})]}):null})]})]},y)}function ie({schema:n,loading:s=!1,value:l=void 0,defaultValue:i={},onChange:c,style:m={},disabled:f=!1}){const h=Object.prototype.toString.call(l)==="[object Object]",[b,y]=u.useState([]),[p,a]=u.useState(h?l:i),R=u.useMemo(()=>n.length===1,[n]),g=u.useCallback(r=>b.find(t=>t.key===r),[b]);u.useEffect(()=>{R&&n[0]?.required&&y([{key:n[0].key,editing:!0,initialValue:i[n[0].key]}])},[n,R,i]);const C=u.useCallback(r=>{y(t=>t.find(d=>d.key===r.key)?t.map(d=>d.key===r.key?r:{...d}):[r].concat(t))},[]),w=u.useCallback((r,t,x)=>{const{key:d,secure:_}=r,k=g(d)??{...r};k.editing=!0;const z=p[d]!==t;k.edited=t&&k.initialValue!==t,k.initialValue=i[d];const N={...p,[d]:t};z&&a(N),c({[d]:t},{allValues:N,action:x,currentItem:r}),x==="confirm"&&_&&a({...p,[d]:"__encrypted__"}),x==="confirm"&&(k.initialValue=p[d]),["confirm","cancel"].includes(x)&&(k.editing=!1,k.edited=!1),C(k)},[i,p,c,C,g]),F=u.useCallback((r,{editing:t=!1})=>{const{key:x}=r,d=h?l[x]:p[x];return d==="__encrypted__"?t?"":"******":d},[h,l,p]),I=u.useCallback(r=>{const t=g(r.key);t&&w(r,t.initialValue,"cancel")},[g,w]),E=u.useCallback(r=>{const t=g(r.key);!t||!t.edited||(t.shaking=!0,C(t),setTimeout(()=>{t.shaking=!1,C(t)},500))},[g,C]),q=u.useCallback(r=>{const t=g(r.key);!t||!t.edited?I(r):E(r)},[g,E,I]);return e.jsx(ae,{className:"form",style:m,children:n?.map(r=>{const{hidden:t=!1}=r;return t?null:e.jsx(V,{item:r,findEditingItem:g,getItemValue:F,onFormItemChange:w,onFocusOut:q,formValues:p,disabled:f,loading:s,onCancel:I})})})}ie.propTypes={schema:o.array.isRequired,loading:o.bool,onChange:o.func.isRequired,value:o.object,defaultValue:o.object,style:o.object,disabled:o.bool};const ae=K(Z)``;export{ie as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l}from"./vendor-react-CUXIiAnY.js";import{V as C,$ as E,j as M,k as P}from"./vendor-ux-BX9dSNUy.js";import{k as y}from"./vendor-hooks-U4TTuKG0.js";import{j as e,ak as s,a6 as S,aX as w,b1 as W,y as L,x as _,bc as B,M as D,T as z,a$ as A,I as K,bd as N,Q as F,W as U}from"./vendor-mui-core-B5XNUjey.js";import{c as $,_ as k}from"./index-Dijoh4El.js";import{a as V}from"./api-Cjc501Es.js";import{T as q}from"./table-tips-BA9A3QDk.js";import{u as G}from"./team-HgvOpVEJ.js";import{u as H}from"./session-DUT2afHJ.js";import"./vendor-utils-CFxoplqC.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D4Rvz_D3.js";import"./use-mobile-Vtj5nBdp.js";import"./isURL-wZZwzwyC.js";import"./use-app-logo-D9eQSUYq.js";function T({endpoint:i}){const[t,a]=l.useState("mcp-link"),x=k(),{api:h}=k(),{teamDid:m}=G(),{t:c,locale:p}=C(),{session:r}=H(),{data:u,run:o,loading:g}=y(()=>{const f={owner:$.SERVER_ROLES.ADMIN}[r?.user?.role]||r?.user?.role;return h.createAccessKey({input:{teamDid:m,passport:f,authType:"simple",remark:"Generated by MCP Servers"}})},{manual:!0}),{imgPrefix:n}=x,j=l.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[n]),v=j.find(d=>d.value===t),b=l.useMemo(()=>u?.data?.accessKeySecret,[u]),R=l.useMemo(()=>!b&&t!=="mcp-link",[b,t]),I=d=>{const f=`npx @blocklet/install-mcp@latest i ${i} --client ${d} --streamableHTTP --oauth2Bearer ${b}`;switch(d){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return f;case"mcp-link":default:return i}};return e.jsxs(s,{className:"mcp-servers-container",children:[e.jsx(M,{tabs:j,current:t,onChange:a,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(z,{component:"span",variant:"h6",sx:{fontWeight:"bold",my:2},children:t==="mcp-link"?v?.label:`${v?.label} ${c("installCommand")}`}),t!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${p}/mcp-${t}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{size:"small",children:e.jsx(N,{fontSize:"small"})})})]}),e.jsxs(s,{className:"mcp-servers-codeblock",sx:{position:"relative","& pre":{borderRadius:1},"& .codeblock__inner":{overflow:"auto !important",borderRadius:1}},children:[e.jsx(P,{code:I(t),language:"shell",style:{margin:0},showDefaultText:!1}),R&&e.jsx(s,{sx:{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:g?e.jsx(S,{}):e.jsx(F,{variant:"contained",color:"primary",onClick:o,size:"small",children:`${c("common.generate")} ${c("command")}`})})]})]})]})}T.propTypes={endpoint:U.string.isRequired};function ce(){const[i,t]=l.useState(null),{t:a,locale:x}=C(),h=`${window?.blocklet?.appUrl}${$.WELLKNOWN_SERVICE_PATH_PREFIX}/mcp/servers`,{data:m,loading:c,error:p}=y(()=>Promise.all([V.get(h)])),r=l.useMemo(()=>m?.[0]?.data?.servers||[],[m]);l.useEffect(()=>{r?.length&&t(r.find(o=>o.did===window?.blocklet?.did)||r[0])},[r]);const u=o=>{const g=o.target.value;t(r.find(n=>n.did===g))};return c?e.jsx(s,{children:e.jsx(S,{})}):p?e.jsx(w,{color:"error",children:p?.message}):r?.length?e.jsxs(W,{sx:{gap:2,maxWidth:1200},children:[e.jsx(q,{title:a("mcp.listTitle"),tooltipTitle:a("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${x}/mcp-server`}),e.jsxs(L,{fullWidth:!0,children:[e.jsx(_,{id:"server-select-label",children:a("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:i?.did||"",label:a("mcp.available"),onChange:u,children:r.map(o=>e.jsx(D,{value:o.did,children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(E,{variant:"rounded",shape:"square",did:o.did,src:o.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:o.name})]})},o.did))})]}),i&&e.jsx(T,{endpoint:i.endpoint})]}):e.jsx(w,{color:"warning",children:a("mcp.noServer")})}export{ce as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as p}from"./vendor-react-CUXIiAnY.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-B5XNUjey.js";import{a as j}from"./vendor-hooks-U4TTuKG0.js";import{a1 as r}from"./index-Dijoh4El.js";import{V as A}from"./vendor-ux-BX9dSNUy.js";import{l as C}from"./arrow-down.svg-Dhs0HydJ.js";import{L as O,D as H}from"./vendor-mui-x-DtPl0qBm.js";import{A as R}from"./AdapterDayjs-p1MGZm94.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:h="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const T=e?r(n).tz(e):r(n);i(new Date(T.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:h,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:h=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[T,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>h?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:T})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r}from"./vendor-react-CUXIiAnY.js";import{j as o,a6 as b,am as D,ak as w,bb as L,at as H,W as x}from"./vendor-mui-core-B5XNUjey.js";import{p as S,n as T,h as Y,i as z}from"./vendor-ux-BX9dSNUy.js";import{_ as M,a1 as N,B as P,a2 as E,a3 as W}from"./index-Dijoh4El.js";import{n as _}from"./vendor-utils-CFxoplqC.js";import{u as A}from"./team-HgvOpVEJ.js";import{C as K}from"./confirm-BIsS5xyi.js";import{P as q}from"./permission-BYxNrlaa.js";import{C as F}from"./click-to-copy-DXHOGoUP.js";function G({invitations:a=[],onRefresh:v=_}){const{api:C,inService:d}=M(),{t,locale:y}=r.useContext(S),{teamDid:h,invitations:f,refresh:g,endpoint:l,roles:j}=A(),[i,m]=r.useState(null),[I,c]=r.useState(!1),s=r.useMemo(()=>a.length>0?a:f,[a,f]),k=async({inviteId:e})=>{if(!I){c(!0);try{await C.deleteInvitation({input:{teamDid:h,inviteId:e}}),g(),v?.(),await E(800)}catch(n){console.error(n)}finally{c(!1),m(null)}}},R=()=>{c(!1),m(null)},p=e=>l?W({inviteId:e.inviteId,endpoint:l}):"",B=[{label:t("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:e=>{const n=s[e];return l?o.jsx(F,{children:p(n)}):o.jsx(b,{size:16})}}},{label:t("common.role"),name:"role",widtn:70,options:{sort:!1,customBodyRender:e=>{const n=j.find(u=>u.name===e);return n?.title?o.jsx(D,{title:e,children:n.title}):e||"--"}}},{label:t("common.remark"),name:"remark",options:{sort:!1,customBodyRender:e=>e||"--"}},{label:t("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(e,{rowIndex:n})=>s[n]?.inviter?.fullName}},{label:t("common.expires"),name:"expireDate",options:{sort:!1,customBodyRender:e=>o.jsx(w,{children:N(e).format("YYYY-MM-DD HH:mm")})}},{label:t("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:e=>{const n=s[e];return o.jsx(q,{permission:d?"":"mutate_team",role:d?P:[],children:o.jsxs(T,{onClick:()=>m({title:t("team.inviting.delete.title"),description:t("team.inviting.delete.description",{link:p(n)}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>k(n),onCancel:R}),size:"small",color:"error",variant:"text",children:[o.jsx(L,{style:{fontSize:"1.2em"}}),t("common.delete")]})})}}}];return o.jsxs(J,{children:[s.length?o.jsx(Y,{locale:y,data:[...s],columns:B,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}}):o.jsx(z,{sx:{minHeight:200},children:t("common.empty")}),i&&o.jsx(K,{title:i.title,description:i.description,confirm:i.confirm,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}G.propTypes={invitations:x.array,onRefresh:x.func};const J=H.div`
|
|
2
|
-
margin-top: -20px;
|
|
3
|
-
`;export{G as I};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,ak as l}from"./vendor-mui-core-B5XNUjey.js";import{i as x,r as w}from"./vendor-react-CUXIiAnY.js";import{b as g}from"./vendor-hooks-U4TTuKG0.js";import{I as v}from"./invitation-Cjg3Rgxl.js";import{K as u}from"./landing-page-zT1Tduxx.js";import{V as I,y as k}from"./vendor-ux-BX9dSNUy.js";import{a as S,d as E,s as T,b as j,c as P,H as R}from"./index-Dijoh4El.js";import{g as W}from"./get-safe-url-pZvXlaJu.js";import{c as b}from"./passport-BcfDxGFq.js";import"./vendor-utils-CFxoplqC.js";import"./index-CUIcSX4q.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DUT2afHJ.js";import"./sdk-Do4pV1s0.js";import"./wrap-locale-Dk2yVg3Y.js";import"./index-5B_H2zYd.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D4Rvz_D3.js";import"./create-passport-svg-BwqsyTOz.js";function J(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:m,session:p}=S(),{t:d}=I(),r=s.get("inviteId"),a=s.get("redirect"),f=w.useCallback(async()=>{const{data:t}=await E.get("invitation",{params:{inviteId:r}});return t},[r]),h=g(async(t,o=i=>i)=>{t&&(T(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&k(o(t.visitorId))),await p.refresh(),setTimeout(()=>{if(a){const i=decodeURIComponent(a);i.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(i,{replace:!0}):window.location.href=W(i)}else window.location.href=window.env.pathPrefix||"/"},50)});return e.jsxs(u,{did:window.blocklet?.appPid,children:[e.jsx(R,{children:e.jsxs("title",{children:[d("pageTitle.invite")," | ",window.blocklet?.appName]})}),e.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:e.jsx(v,{...n,getDataFn:f,checkFn:m.get,createPassportSvg:t=>b({...t}),onLoginSuccess:h,inService:!0})})]})}export{J as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,a6 as w,ak as x}from"./vendor-mui-core-B5XNUjey.js";import{g as v,k,b as p}from"./vendor-hooks-U4TTuKG0.js";import{I as T}from"./invitation-Cjg3Rgxl.js";import{K as I}from"./landing-page-zT1Tduxx.js";import{V as P,y as j}from"./vendor-ux-BX9dSNUy.js";import{a as R,s as S,b as E,c as N,H as W}from"./index-Dijoh4El.js";import{g as b}from"./get-safe-url-pZvXlaJu.js";import{c as C}from"./passport-BcfDxGFq.js";import{i as F}from"./vendor-react-CUXIiAnY.js";import"./vendor-utils-CFxoplqC.js";import"./index-CUIcSX4q.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DUT2afHJ.js";import"./sdk-Do4pV1s0.js";import"./wrap-locale-Dk2yVg3Y.js";import"./index-5B_H2zYd.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D4Rvz_D3.js";import"./create-passport-svg-BwqsyTOz.js";function Z(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=F(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),o=k(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(o.error)throw o.error;return o?.data}),g=p(async(t,i=e=>e)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(w,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(W,{children:s.jsxs("title",{children:[h("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),s.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:C,onLoginSuccess:g,inService:!0,status:u.state})})]})}export{Z as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,T as v,a$ as b,D as I,J as T,ak as t}from"./vendor-mui-core-B5XNUjey.js";import{x as B,g as E,L as P,$ as j,N}from"./vendor-ux-BX9dSNUy.js";import{a as $}from"./vendor-hooks-U4TTuKG0.js";import{am as A}from"./index-Dijoh4El.js";function C({linkProps:s=void 0,showExtra:o=!1,...n}){return e.jsxs(v,{...n,children:["Powered by"," ",e.jsx(b,{href:"https://www.arcblock.io",target:"_blank",...s,children:"ArcBlock"}),"'s"," ",e.jsx(b,{href:"https://www.blocklet.io",target:"_blank",...s,children:"Blocklet Technology"}),o?", the decentralized web engine.":null]})}function W({did:s,children:o,title:n=void 0,description:a=void 0,actions:h=void 0,logo:i=void 0,logoSize:d=50,poweredBy:x=void 0,termsOfUse:g=void 0,standalone:y=!1}){const r=globalThis?.blocklet||globalThis?.env||{},{palette:f}=I(),c=T(l=>l.breakpoints.down("lg")),w=A({meta:r}),k=$(()=>{const l=r.appPid,u=B.isEthereumDid(l),z=u?void 0:E(l);return u?P(l):z.color},[r?.appPid]);if(!s)return o;n===void 0&&(n=r.appName),a===void 0&&(a=r.appDescription),i===void 0&&(i=w||""),typeof i=="string"&&(i?i=e.jsx(t,{sx:{height:d,maxHeight:d,objectFit:"contain"},component:"img",src:i,alt:`${r.appName}'s logo`}):i=e.jsx(j,{size:d,did:s,src:i,variant:"rounded"})),x===void 0&&(x=e.jsx(C,{linkProps:{color:f.text.secondary,sx:{"&:hover":{textDecoration:"underline"}}},showExtra:!c,sx:{textAlign:"center",fontSize:"12px",color:"text.secondary"}}));let p=o;!o&&!c&&(p=e.jsx(t,{sx:{filter:"blur(180px)",display:"flex"},children:e.jsx(j,{size:210,did:s,variant:"rounded"})}));const D=!!o;let m=!y;return c&&(m=!D),e.jsxs(t,{sx:{width:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",px:{xs:2,sm:4,md:8},pt:{xs:2,sm:4,md:6},pb:{xs:5,md:8},background:`radial-gradient(circle at bottom right, ${N(k,.3)} 10%, ${f.background.default} 50%)`,position:"relative"},children:[e.jsxs(t,{sx:{maxWidth:1200,display:"flex",alignItems:"center",justifyContent:[m,p].filter(Boolean).length>1?"space-between":"center",width:"100%",margin:"auto"},children:[m?e.jsxs(t,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(t,{sx:{display:"flex",alignItems:"center"},children:i}),e.jsx(v,{variant:"h2",sx:{fontWeight:"bold",fontSize:{sm:"2.25rem",md:"2.75rem",xl:"3.5rem"}},children:n}),a?e.jsx(t,{sx:{mb:2,color:"text.secondary"},children:a}):null,h?e.jsx(t,{sx:{mt:8},children:h}):null,g?e.jsx(t,{sx:{mt:-1,color:"grey"},children:g}):null]}):null,p]}),e.jsx(t,{sx:{position:"absolute",zIndex:10,bottom:10,left:10,right:10,textAlign:"center"},children:x})]})}export{W as K};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import{r as o}from"./vendor-react-CUXIiAnY.js";import{j as t,b4 as _,W as n,D as F,n as xe,b0 as ye,co as be,cv as ve,cw as je,cx as we,ak as g,T as q,Q as ke,a$ as te,a3 as Ie,s as Me,J as Re,I as Ce,at as Ae}from"./vendor-mui-core-B5XNUjey.js";import{a as D,b as O,h as Te}from"./vendor-hooks-U4TTuKG0.js";import{V as Q,z as Ne,U as ne,p as re,S as $e}from"./vendor-ux-BX9dSNUy.js";import{t as Se}from"./server-logo-notext.svg-DHxZ1bRk.js";import{B as ze}from"./bundle-avatar-CfVy3gda.js";import{a as Le,g as se,i as ie,b as oe,c as V,M as ae,d as Ee,m as De,e as Be,f as Pe,h as qe,j as Ve,k as _e,l as Fe,n as Oe,N as Ue}from"./team-HgvOpVEJ.js";import{R as He,I as We,C as K,a as U}from"./vendor-utils-CFxoplqC.js";import{ar as Qe,as as Ke,at as Xe,c as Ge,_ as Je}from"./index-Dijoh4El.js";import{p as Ye}from"./util-DSnAozzs.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=Le({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function X({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=Q(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}X.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=F(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const H={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(K(Ge.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Qe,{user:u,showDid:!0,cardType:Xe.AvatarOnly,infoType:Ke.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(H).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};G.propTypes={actors:n.oneOfType([n.shape(H),n.arrayOf(n.shape(H))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function G({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return He(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return U(s)||!s.type||!s.actor||U(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5,wordBreak:"break-all"},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=F(),{t:d}=Q(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!U(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:K(i,x.metaLink):null}),C=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),$=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(G,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(X,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),$&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:K(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
height: 100%;
|
|
7
|
-
min-height: 500px;
|
|
8
|
-
color: #999;
|
|
9
|
-
.empty-icon {
|
|
10
|
-
margin: 10px 0;
|
|
11
|
-
}
|
|
12
|
-
`;function fe({children:e=null,...r}){const s=Je(),l=F().palette.mode==="dark";return t.jsxs(ot,{...r,children:[t.jsx("img",{src:`${s.imgPrefix}/${l?"all-done-dark":"all-done-light"}.svg`,alt:"All Done",width:120,height:120,style:{maxHeight:"100%",maxWidth:"100%"},onError:u=>{u.target.style.display="none"}}),t.jsx(g,{className:"empty-content",children:e})]})}fe.propTypes={color:n.string,children:n.any};at.propTypes={data:n.array,blockletMap:n.object,onReadBatch:n.func,inDialog:n.bool,highlightId:n.string,highlight:n.bool,type:n.oneOf(["server","service"])};ge.propTypes={notification:n.object,blocklet:n.object,onReadBatch:n.func,inDialog:n.bool,highlight:n.bool};P.propTypes={blocklet:n.object,size:n.number,showName:n.bool,hideDot:n.bool};function P({blocklet:e,size:r=40,showName:s=!1,hideDot:i=!1}){const l=e?.did||e?.meta?.did||"",u=(e?.alsoKnownAs||[]).concat(e?.appId||e?.appDid||e?.appPid||"");return t.jsxs(g,{className:"component-avatar",sx:{display:"flex",alignItems:"center",gap:i?"8px":"4px"},children:[!i&&t.jsx("span",{className:"dot"}),e?t.jsx(g,{children:u.includes(l)?t.jsx(le,{blocklet:e,size:r,style:{borderRadius:8}}):t.jsx(ze,{blocklet:e,ancestors:e.ancestors??[],size:r,style:{borderRadius:8}})}):t.jsx(Se,{width:r,height:r}),s&&t.jsx("span",{className:"component-name",children:e?.meta?.title})]})}function ge({notification:e,blocklet:r,onReadBatch:s=()=>{},inDialog:i=!1,highlight:l}){const{locale:u}=o.useContext(re),m=F(),d=Re(h=>h.breakpoints.down("md")),p=o.useRef(null),y=o.useMemo(()=>qe(e),[e]),v=o.useMemo(()=>Ve(e),[e]),b=o.useMemo(()=>V(e),[e]),k=o.useMemo(()=>e.items||[],[e]),C=o.useMemo(()=>k.length>0,[k]),$=o.useMemo(()=>v?C?k.map(h=>V(h)?h.actorInfo:{did:h.activity?.actor}).filter(Boolean):e.actorInfo??[]:[],[k,e.actorInfo,C,v]),w=o.useMemo(()=>r?.did||r?.meta?.did||"",[r]),a=o.useMemo(()=>_e(w,window.blocklet),[w]),x=O((h,S)=>{const A=Fe(h);if(A.length&&s(A.map(R=>R.id)),S&&!S.customPreventRedirect){const R=Oe(h,a);R&&typeof R=="string"&&window.open(R,"_blank","noopener,noreferrer")}});return t.jsxs(lt,{ref:p,className:"notification-row",id:e.id,isRead:y,inDialog:i,highlight:l,isMd:d,onClick:h=>x(e,h),children:[v?t.jsx(de,{activity:e.activity.type,size:d?24:32}):t.jsx(ce,{severity:e.severity,size:d?24:32}),t.jsxs(g,{className:"notification",sx:{display:"flex",flexDirection:"column",alignItems:"start"},children:[t.jsxs(g,{className:"header",sx:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,mb:1.5},children:[v&&b?t.jsx(G,{actors:$,teamDid:w,size:d?24:32,avatarFallback:t.jsx(P,{blocklet:r,hideDot:!0,size:d?24:32})}):t.jsx(P,{blocklet:r,hideDot:!0,size:d?24:32}),t.jsx(X,{value:e.createdAt,locale:u,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),v?t.jsx(pe,{notification:e,isMultiple:C,blocklet:r,mountPoint:a,avatarFallback:t.jsx(P,{blocklet:r,hideDot:!0,size:d?24:32})}):t.jsxs(t.Fragment,{children:[t.jsx(q,{variant:"body1",className:"title",sx:{color:"rgba(24, 24, 27, 1)",mt:0,mb:.5},children:e.title}),t.jsx(Ue,{notification:e,rows:i?0:2})]}),t.jsx(me,{notification:e})]}),e?.description&&e.severity==="error"&&t.jsx(g,{className:"copy-button",children:t.jsx(Ce,{size:"small",children:t.jsx($e,{sx:{fontSize:22},content:e?.description||""})})})]})}function at({data:e,blockletMap:r,onReadBatch:s=()=>{},inDialog:i=!1,highlightId:l,highlight:u=!1,type:m="service"}){const{t:d}=Q(),p=o.useRef(null),[y,v]=o.useState(!1),[b,k]=o.useState(!0),[C,$]=o.useState(!1),w=o.useRef(new Set),a=o.useRef(new Set),x=o.useRef(null),h=o.useRef(null),S=o.useRef(!1),A=o.useRef(null),R=o.useMemo(()=>i?e?.slice(0,5):e,[i,e]),z=o.useMemo(()=>De(R),[R]),L=o.useMemo(()=>{const c=new Map;return z&&z.length&&z.forEach(f=>{c.set(f.id,f)}),c},[z]);o.useEffect(()=>{const c=()=>{k(document.visibilityState==="visible")};return document.addEventListener("visibilitychange",c),()=>{document.removeEventListener("visibilitychange",c)}},[]);const B=o.useCallback(()=>{if(!i&&w.current.size>0){const c=[];w.current.forEach(f=>{if(a.current.has(f))return;const I=L.get(f);if(I){const{receivers:T=[],items:N=[]}=I;if(T.length&&!T[0].read&&(c.push(f),a.current.add(f),N.length>0&&N.forEach(j=>{const M=j.id;M&&!a.current.has(M)&&(c.push(M),a.current.add(M))}),h.current)){const j=document.getElementById(f);j&&h.current.unobserve(j)}}}),c.length>0&&(s(c),setTimeout(()=>{v(!1)},300)),w.current.clear()}},[i,L,s]),J=o.useCallback(()=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{B()},50)},[B]),E=o.useCallback(()=>{if(i||!p.current||!b)return;h.current&&h.current.disconnect();const c={root:null,rootMargin:"0px",threshold:.5},f=new IntersectionObserver(T=>{y&&T.forEach(N=>{const j=N.target.id;if(a.current.has(j))return;const M=L.get(j);if(M){const{receivers:Y=[]}=M;Y.length&&!Y[0].read&&(N.isIntersecting?(w.current.add(j),J()):w.current.delete(j))}})},c);h.current=f,Array.from(p.current.querySelectorAll(".notification-row")).filter(T=>{const N=T.id;if(a.current.has(N))return!1;const j=L.get(N);if(j){const{receivers:M=[]}=j;return M.length&&!M[0].read}return!1}).forEach(T=>{f.observe(T)}),S.current=!1},[y,i,b,L,J]);return o.useEffect(()=>{i||(S.current=!0,h.current&&b&&y&&setTimeout(()=>{E()},0))},[R,y,b,E,i]),o.useEffect(()=>{if(i||!p.current||!b)return;let c=window;if(m==="server"&&(c=document.getElementById("arc__dashboard-main")),!c){const I=document.getElementsByClassName("dashboard-main")[0];I&&(c=I)}if(!c)return;const f=I=>{I.isTrusted&&(y||v(!0),$(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{$(!1),B(),S.current&&E()},300))};return c.addEventListener("scroll",f,{passive:!0}),()=>{c.removeEventListener("scroll",f),x.current&&clearTimeout(x.current),A.current&&clearTimeout(A.current)}},[i,y,b,B,E,m]),o.useEffect(()=>(i||E(),()=>{h.current&&h.current.disconnect()}),[E,i]),Te(()=>{setTimeout(()=>{const c=Be(p.current),f=Pe(L,c);s(f.map(I=>I.id))},100)}),z?.length?t.jsx(g,{ref:p,sx:{display:"flex",flexDirection:"column",...i?{maxHeight:"calc(-200px + 100vh)",overflow:"auto"}:{}},children:z?.map(c=>{const f=c.source==="system"?r.get(c.entityId||c.sender):r.get(c.componentDid||c.sender);return c?.type?.toLowerCase()==="passthrough"?null:t.jsx(ge,{highlight:u&&l===c.id,inDialog:i,notification:c,blocklet:f,onReadBatch:s},c.id)})}):t.jsx(fe,{children:d("notification.allDone")})}const lt=Ae(g)`
|
|
13
|
-
@keyframes flash-bg {
|
|
14
|
-
0% {
|
|
15
|
-
background-color: ${e=>e.theme.palette.warning.light};
|
|
16
|
-
}
|
|
17
|
-
100% {
|
|
18
|
-
background-color: unset;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
position: relative;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: flex-start;
|
|
24
|
-
gap: ${e=>e.isMd?e.theme.spacing(1):e.theme.spacing(1.5)};
|
|
25
|
-
padding: ${e=>e.isMd?`${e.theme.spacing(2)} 0`:e.theme.spacing(3)};
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
animation: ${e=>e.highlight?"flash-bg 3s ease-out 0s 1 normal none running":"none"};
|
|
28
|
-
background-color: ${e=>e.isRead?"transparent":e.theme.palette.grey[100]};
|
|
29
|
-
border-bottom: 1px solid;
|
|
30
|
-
border-color: ${({theme:e})=>e.palette.grey[200]};
|
|
31
|
-
&:last-child {
|
|
32
|
-
border-bottom: none;
|
|
33
|
-
}
|
|
34
|
-
&:hover {
|
|
35
|
-
background-color: ${e=>e.theme.palette.action.hover};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.copy-button {
|
|
39
|
-
position: absolute;
|
|
40
|
-
right: ${e=>e.inDialog?e.theme.spacing(2):"0"};
|
|
41
|
-
top: ${e=>e.inDialog?e.theme.spacing(5):e.theme.spacing(4)};
|
|
42
|
-
display: none;
|
|
43
|
-
background: ${e=>e.theme.palette.action.disabledBackground};
|
|
44
|
-
border-radius: 50%;
|
|
45
|
-
svg {
|
|
46
|
-
width: ${e=>e.theme.spacing(2.25)};
|
|
47
|
-
height: ${e=>e.theme.spacing(2.25)};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
&:hover {
|
|
51
|
-
.copy-button {
|
|
52
|
-
display: block;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.component-avatar {
|
|
57
|
-
.dot {
|
|
58
|
-
width: ${e=>e.theme.spacing(1)};
|
|
59
|
-
height: ${e=>e.theme.spacing(1)};
|
|
60
|
-
border-radius: 50%;
|
|
61
|
-
background-color: ${e=>e.theme.palette.primary.main};
|
|
62
|
-
visibility: ${e=>e.isRead?"hidden":"visible"};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.notification {
|
|
67
|
-
width: calc(100% - ${e=>e.theme.spacing(6.25)});
|
|
68
|
-
|
|
69
|
-
> .header {
|
|
70
|
-
width: 100%;
|
|
71
|
-
@media (min-width: 900px) {
|
|
72
|
-
.title {
|
|
73
|
-
max-width: calc(100vw - ${e=>e.theme.spacing(50)});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
@media (min-width: 1200px) {
|
|
77
|
-
.title {
|
|
78
|
-
max-width: ${e=>e.theme.spacing(102.5)};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
@media (max-width: 900px) {
|
|
82
|
-
.title {
|
|
83
|
-
max-width: calc(100vw - ${e=>e.theme.spacing(25)});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.title {
|
|
89
|
-
min-width: 0;
|
|
90
|
-
max-width: 100%;
|
|
91
|
-
overflow: hidden;
|
|
92
|
-
text-overflow: ellipsis;
|
|
93
|
-
white-space: nowrap;
|
|
94
|
-
color: ${e=>e.theme.palette.text.primary};
|
|
95
|
-
font-size: ${e=>e.theme.typography.fontSize*1.15}px;
|
|
96
|
-
}
|
|
97
|
-
.link {
|
|
98
|
-
color: ${e=>e.theme.palette.primary.main};
|
|
99
|
-
font-size: ${e=>e.theme.typography.fontSize}px;
|
|
100
|
-
text-decoration: none;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
`;export{G as A,le as B,at as N,X as R,P as S,pe as a};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrVXX4fX.css"),window.__toCdnUrl("assets/index-B5LvOF-F.css")])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as b,a as be}from"./vendor-react-CUXIiAnY.js";import{V as D,H,_ as ye,$ as re,z as V,h as ve,i as Ce}from"./vendor-ux-BX9dSNUy.js";import{j as e,Y as M,bC as K,I as X,aj as G,$ as Q,b1 as q,T as I,ak as c,z as w,F as C,b7 as Te,b5 as le,b6 as ne,a5 as se,a3 as Y,aX as oe,R as ae,Q as z,a6 as J,W as n,am as we,cb as ce,cc as Se,bb as Ie}from"./vendor-mui-core-B5XNUjey.js";import{_ as $,c as k,ac as Re,ar as Ee,as as Ae,at as ke}from"./index-Dijoh4El.js";import{u as We}from"./useAsyncRetry-CSW1hopB.js";import{r as Ne}from"./index-BfyoUnq5.js";import{u as B}from"./team-HgvOpVEJ.js";import{u as ue,C as S}from"./index.esm-DTmS4tth.js";import{o as Pe,b as qe,C as te}from"./vendor-utils-CFxoplqC.js";import{T as Oe}from"./index-mgpYakv8.js";import{E as Le}from"./empty-spinner-0EAHJWBW.js";import{C as v}from"./click-to-copy-DXHOGoUP.js";import{D as _e}from"./delete-confirm-DSQSBte5.js";import{r as ze}from"./passport-item-BnRaEMVZ.js";import{A as Fe}from"./actions-CiAs-6JM.js";import{T as ie}from"./table-tips-BA9A3QDk.js";import{u as De}from"./use-mobile-Vtj5nBdp.js";import"./vendor-hooks-U4TTuKG0.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D4Rvz_D3.js";import"./useAsync-DNDhrs-2.js";import"./session-DUT2afHJ.js";import"./isURL-wZZwzwyC.js";import"./use-app-logo-D9eQSUYq.js";import"./arrow-down.svg-Dhs0HydJ.js";import"./vendor-mui-x-DtPl0qBm.js";import"./AdapterDayjs-p1MGZm94.js";import"./confirm-BIsS5xyi.js";import"./index-DBs9Ljax.js";import"./ua-parser-DP5omx3I.js";import"./did-address-Qmm0nyiR.js";import"./util-DSnAozzs.js";import"./base32-E_M8YiDy.js";var de=Ne();const $e={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function pe({onCreated:r,onClose:a}){const[i,h]=b.useState(!1),{t:l,locale:s}=D(),{api:f}=$(),{teamDid:d}=B(),{control:y,handleSubmit:g,formState:{errors:u},watch:W,setValue:m}=ue({defaultValues:$e,mode:"onChange"}),T=W("scope"),R=o=>{o!=="profile:read"&&m("scope",T.includes(o)?T.filter(x=>x!==o):[...T,o])},N=async o=>{h(!0);try{const x={...o,redirectUris:o.redirectUris,contacts:o.contacts?o.contacts.split(",").map(A=>A.trim()):[],scope:o.scope.join(" ")};await f.createOAuthClient({input:{teamDid:d,input:Pe(x,qe)}}),r(x)}catch(x){H.error(x.message||"Failed to create OAuth App")}finally{h(!1)}};return e.jsxs(M,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Q,{children:e.jsxs(q,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:y,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!u.clientName,helperText:u.clientName?.message}),e.jsx(C,{children:l("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:y,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!u.clientUri,helperText:u.clientUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:y,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!u.redirectUris,helperText:u.redirectUris?.message}),e.jsxs(c,{sx:{display:"flex",gap:"2px"},children:[e.jsx(C,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(C,{children:l("oauth.client.helperText.read")}),e.jsx(C,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(C,{children:l("oauth.client.helperText.more")})]})]})})}),e.jsxs(Te,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([o,x])=>e.jsx(ne,{control:e.jsx(se,{checked:T.includes(o),onChange:()=>R(o),disabled:o==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:x})})},o))})})]}),e.jsx(Y,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(q,{children:e.jsx(S,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:o})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!u.contacts,helperText:u.contacts?.message}),e.jsx(C,{children:l("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:o})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!u.tosUri,helperText:u.tosUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:o})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...o,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!u.policyUri,helperText:u.policyUri?.message}),e.jsx(C,{children:l("oauth.client.helperText.policyUri")})]})})]}),u.error&&e.jsx(oe,{severity:"error",children:u.error.message})]})}),e.jsxs(ae,{children:[e.jsx(z,{onClick:a,children:l("common.cancel")}),e.jsxs(z,{onClick:g(N),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(J,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}pe.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function Z({scope:r="",...a}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(q,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(h=>e.jsx(be.Fragment,{children:e.jsx(we,{title:k.OAUTH_SCOPES[h],children:e.jsx(v,{children:h})})},h))})}Z.propTypes={scope:n.string};const ee=r=>{const{prefix:a}=$(),{blocklet:i}=Re(),h=te(a,"/api/media/upload",i.appPid),l=b.useCallback(f=>f?f.startsWith("http")?f:`${te(a,"/api/media/upload",i.appPid)}/${f}`:"",[a,i.appPid]);return{clientLogoUrl:b.useMemo(()=>l(r),[r,l]),apiPath:h,getClientLogoUrl:l}},Be=b.lazy(()=>ye(()=>import("./index-CiQvt8QY.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(r=>({default:r.Uploader})));function he({client:r,onUpdate:a,onClose:i}){const[h,l]=b.useState(!1),{t:s,locale:f}=D(),d=b.useRef(null),{api:y}=$(),{teamDid:g}=B(),{control:u,handleSubmit:W,formState:{errors:m},watch:T,setValue:R,getValues:N}=ue({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),o=T("scope"),x=T("logoUri"),{clientLogoUrl:A,apiPath:P}=ee(x),E=t=>{t!=="profile:read"&&R("scope",o.includes(t)?o.filter(p=>p!==t):[...o,t])},O=async t=>{const p={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(j=>j.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(j=>j.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri,clientSecretExpiresAt:t.clientSecretExpiresAt?parseInt(t.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:p}})},_=async t=>{l(!0);try{await O(t),a(),i()}catch(p){H.error(p.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(M,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Q,{children:e.jsxs(q,{spacing:3,sx:{mt:2},children:[e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(c,{children:[e.jsx(c,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:A?e.jsx(c,{children:e.jsx("img",{src:A,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(c,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ce,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(A?"common.change":"common.upload")})]}),e.jsx(c,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Le,{}),children:e.jsx(Be,{ref:d,locale:f,popup:!0,onUploadFinish:t=>{R("logoUri",t.data.filename),O(N()).then(()=>{a()}).catch(p=>{H.error(p.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:P,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:u,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:m.clientName?.message}),e.jsx(C,{children:s("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:u,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:m.clientUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:u,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:m.redirectUris?.message}),e.jsx(C,{children:s("oauth.client.helperText.redirectUris")})]})})}),e.jsx(S,{name:"clientSecretExpiresAt",control:u,render:({field:t})=>e.jsx(Oe,{placeholder:s("oauth.client.input.expireTime"),value:t.value*1e3,onChange:p=>{t.onChange(p)}})}),e.jsxs(c,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([t,p])=>e.jsx(ne,{control:e.jsx(se,{checked:o.includes(t),onChange:()=>E(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:p})})},t))})})]}),e.jsx(Y,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(c,{children:e.jsx(S,{name:"contacts",control:u,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:m.contacts?.message}),e.jsx(C,{children:s("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:m.tosUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:m.policyUri?.message}),e.jsx(C,{children:s("oauth.client.helperText.policyUri")})]})})]}),m.error&&e.jsx(oe,{severity:"error",children:m.error.message})]})}),e.jsxs(ae,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:W(_),disabled:h,variant:"contained",color:"primary",children:h?e.jsx(J,{size:16}):s("common.update")})]})]})}he.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function me({client:r,onUpdate:a,onClose:i}){return e.jsx(he,{client:r,onUpdate:h=>a(h),onClose:i})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function xe({clientId:r,clientName:a,onDelete:i=()=>{},onClose:h=()=>{}}){const{t:l}=D(),{api:s}=$(),{teamDid:f}=B(),d=()=>{h()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:f,clientId:r}}),i()}catch(u){H.error(u?.message)}finally{d()}},g={keyName:a,title:l("oauth.client.delete.title"),description:l("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:l("oauth.client.delete.description",{name:a}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:d};return e.jsx(_e,{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})}xe.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};function je({title:r,items:a}){return e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(q,{spacing:1.5,children:a.map(({label:i,value:h})=>e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(I,{sx:{wordBreak:"break-all"},children:h||"-"})]},i))})]})}je.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function ge({client:r,onClose:a}){const{t:i,locale:h}=D(),{teamDid:l}=B(),{clientName:s,clientId:f,clientSecret:d,redirectUris:y,scope:g,clientUri:u,logoUri:W,contacts:m,tosUri:T,policyUri:R,jwksUri:N,jwks:o,softwareId:x,softwareVersion:A,clientIdIssuedAt:P,clientSecretExpiresAt:E,updatedAt:O,createUser:_}=r,{clientLogoUrl:t}=ee(W),p=L=>{try{const F=new URL(window.blocklet.appUrl);return F.pathname=L,F.toString()}catch{return"-"}},j=de.fromAppDid(f,l),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(re,{variant:"rounded",shape:"square",src:t,did:j.address,size:64})},{label:i("oauth.client.clientUri"),value:u?e.jsx(v,{children:u}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(v,{children:f})},{label:i("oauth.client.clientSecret"),value:e.jsx(v,{children:d})},{label:i("oauth.client.redirectUris"),value:e.jsx(v,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(Z,{scope:g})},{label:i("oauth.client.createUser"),value:_?ze(_,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(v,{children:p("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(v,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:m.length?e.jsx(v,{children:(m||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(v,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:R?e.jsx(v,{children:R}):"-"},{label:i("oauth.client.jwksUri"),value:N},{label:i("oauth.client.jwks"),value:o},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:A}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:P?e.jsx(V,{value:P*1e3,type:"all",locale:h}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:E?e.jsx(V,{value:E*1e3,type:"all",locale:h}):"-"},{label:i("common.updatedAt"),value:O?e.jsx(V,{value:O,type:"all",locale:h}):"-"}]}].filter(Boolean);return e.jsxs(M,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(K,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Q,{children:e.jsx(c,{sx:{mt:1},children:U.map((L,F)=>e.jsxs(c,{children:[e.jsx(je,{title:L.title,items:L.items}),F!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},L.title))})})]})}ge.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Ve(r){return e.jsx(V,{value:r*1e3})}function fe({selected:r=null,onClose:a}){return r?e.jsx(ge,{client:r,onClose:a}):null}fe.propTypes={selected:n.object,onClose:n.func.isRequired};function Ue({open:r,onCreated:a,onClose:i}){return r?e.jsx(pe,{onCreated:a,onClose:i}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function Tt(){const[r,a]=b.useState({searchText:"",pageSize:10,page:1}),[i,h]=b.useState(null),[l,s]=b.useState(!1),f=b.useRef(null),{t:d,locale:y}=D(),{api:g}=$(),{teamDid:u}=B(),[W,m]=b.useState(null),[T,R]=b.useState(null),N=De(),{getClientLogoUrl:o}=ee(),x=We(async()=>await g.getOAuthClients({input:{teamDid:u,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:A}=x,P=b.useMemo(()=>x.value?.list||[],[x.value?.list]),E=b.useMemo(()=>r.searchText?P.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):P,[r.searchText,P]),O=b.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p],U=o(j.logoUri),L=de.fromAppDid(j.clientId,u);return e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[e.jsx(re,{variant:"rounded",shape:"square",did:L.address,src:U,size:48}),e.jsxs(q,{sx:{gap:.5},children:[e.jsx(c,{sx:{color:"text.primary"},children:j.clientName}),e.jsx(c,{sx:{color:"text.secondary"},children:j.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(Z,{scope:t})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Ve}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(Ee,{showDid:!0,did:t,cardType:ke.Detailed,infoType:Ae.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p];return e.jsx(Fe,{actions:[{icon:e.jsx(Se,{}),text:d("common.edit"),onClick:U=>{U.stopPropagation(),m(j)}},{icon:e.jsx(Ie,{}),text:d("common.delete"),onClick:U=>{U.stopPropagation(),R(j)}}]})}}}],[E,d,o,u,m,R]),_=({page:t,rowsPerPage:p,searchText:j})=>{r.pageSize!==p?a(U=>({...U,searchText:"",pageSize:p,page:1})):r.page!==t+1?a(U=>({...U,searchText:"",page:t+1})):r.searchText!==j&&a(U=>({...U,searchText:j,page:1}))};return e.jsxs(c,{ref:f,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[N?e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,e.jsx(ve,{data:E,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:E.length,searchDebounceTime:400,onRowClick(t,{dataIndex:p},j){if(f.current?.contains(j.target)){const U=E[p];h(U)}}},onChange:_,title:N?null:e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[A?e.jsx(J,{size:16}):e.jsx(ce,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ce,{children:d("oauth.client.empty")})}),e.jsx(fe,{selected:i,onClose:()=>h(null)}),e.jsx(Ue,{open:l,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),W&&e.jsx(me,{client:W,onUpdate:x.retry,onClose:()=>m(null)}),T&&e.jsx(xe,{...T,onDelete:x.retry,onClose:()=>R(null)})]})}export{Tt as default};
|