@abtnode/blocklet-services 1.16.44-beta-20250512-155818-937e465d → 1.16.44-beta-20250516-225119-c0b5ec8d
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/index.js +3 -1
- package/api/libs/connect/session.js +22 -9
- package/api/libs/image.js +1 -2
- package/api/libs/open-graph/index.js +1 -2
- package/api/libs/push-kit/index.js +1 -0
- package/api/middlewares/check-federated-cors-call.js +2 -2
- package/api/middlewares/check-permission.js +10 -3
- package/api/routes/blocklet.js +1 -1
- package/api/routes/csp-proxy.js +67 -0
- package/api/routes/federated.js +30 -25
- package/api/routes/oauth/client.js +2 -2
- package/api/routes/openembed.js +1 -1
- package/api/routes/user-session.js +1 -2
- package/api/routes/user.js +9 -6
- package/api/services/auth/connect/connect-to-did-spaces-for-user.js +1 -1
- package/api/services/auth/connect/pre-setup.js +2 -1
- package/api/services/auth/connect/setup.js +31 -4
- package/api/services/image/index.js +1 -1
- package/api/services/notification/queue.js +27 -4
- package/api/socket/channel/did.js +14 -7
- package/api/util/federated.js +5 -1
- package/api/util/user-util.js +1 -1
- package/dist/assets/{AdapterDayjs-BD9H1lZ-.js → AdapterDayjs-YbaNvT9I.js} +1 -1
- package/dist/assets/{ArrowDropDown-BrO-zDlb.js → ArrowDropDown-xgs4N3Rf.js} +1 -1
- package/dist/assets/{CheckCircle-Ds4QI0ey.js → CheckCircle-JXD6tKIa.js} +1 -1
- package/dist/assets/{ChevronLeft-CnQaQ-rc.js → ChevronLeft-D0eko_T8.js} +1 -1
- package/dist/assets/{ChevronRight-a_2_x6Ew.js → ChevronRight-CQY9Ni7X.js} +1 -1
- package/dist/assets/{Community-DW6DJTIs.js → Community-BCL2L7ib.js} +1 -1
- package/dist/assets/{DeleteOutline-CFN4r-OG.js → DeleteOutline-BEGOj_wq.js} +1 -1
- package/dist/assets/{Done-DqSE6KPe.js → Done-BUJJNjlP.js} +1 -1
- package/dist/assets/{Download-C_LRKzbG.js → Download-DdZEsxmZ.js} +1 -1
- package/dist/assets/{Edit-CbR4eoK8.js → Edit-vxeVwrqO.js} +1 -1
- package/dist/assets/{EditIcon-DxUWMw59.js → EditIcon-Dffk7mPL.js} +1 -1
- package/dist/assets/{Email-DWueGk7t.js → Email-CdSNK0eA.js} +1 -1
- package/dist/assets/{Error-jEHdDLNk.js → Error-C-RD4e9g.js} +1 -1
- package/dist/assets/{ExpandLess-CkoEHpgk.js → ExpandLess-CmqG9SE7.js} +1 -1
- package/dist/assets/{Google-DHEolkW-.js → Google-B7PA4qF8.js} +1 -1
- package/dist/assets/{Holiday-Dwvo6QkZ.js → Holiday-enHMZqEf.js} +1 -1
- package/dist/assets/{InfoOutlined-DkG0jjos.js → InfoOutlined-BIr5nkjV.js} +1 -1
- package/dist/assets/{Launch-B-2Jomi6.js → Launch-KvZQI_SA.js} +1 -1
- package/dist/assets/{LaunchOutlined-CXNijfqX.js → LaunchOutlined-ClxZU_tj.js} +1 -1
- package/dist/assets/{Location-DUEOr9J2.js → Location-By12Z3Te.js} +1 -1
- package/dist/assets/{LockIcon-Cjg8jV1E.js → LockIcon-98CKEIBe.js} +1 -1
- package/dist/assets/{Meeting-CJaI_cKm.js → Meeting-CLeFWDkY.js} +1 -1
- package/dist/assets/{MoreHoriz-B6KdR0Y8.js → MoreHoriz-H8rabTmY.js} +1 -1
- package/dist/assets/{OffSick-C9VqqjrN.js → OffSick-dUm363rs.js} +1 -1
- package/dist/assets/{Phone-DcHUzCa-.js → Phone--BSu-btI.js} +1 -1
- package/dist/assets/{PlayArrow-BToG9L6q.js → PlayArrow-CmxnItFZ.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-BPVDAm8U.js → QuestionMarkCircle-DTf-Tya5.js} +1 -1
- package/dist/assets/{ServerLogo-s6cfhx92.js → ServerLogo-CEsILJl5.js} +1 -1
- package/dist/assets/{Timezone-B-Ho_Uno.js → Timezone-YZ0dMUEr.js} +1 -1
- package/dist/assets/{TuneOutlined-BR2H7Mxj.js → TuneOutlined-DmhFMgM-.js} +1 -1
- package/dist/assets/{ViewList-D8vtMKQz.js → ViewList-DXk3qGFU.js} +1 -1
- package/dist/assets/{WorkingRemotely-lJ6DUMCR.js → WorkingRemotely-BX7rgbEY.js} +1 -1
- package/dist/assets/{access-control-CCSlKYYz.js → access-control-DfNk54C9.js} +1 -1
- package/dist/assets/{actions-BjTeIzgS.js → actions-V9hjjowb.js} +1 -1
- package/dist/assets/{add-component-core-C7-Epxoj.js → add-component-core-Dx4Ojnmk.js} +16 -16
- package/dist/assets/add-resource-CxXfKLfm.js +1 -0
- package/dist/assets/addon-DtaZ0TB3.js +14 -0
- package/dist/assets/{advanced-tG5IRVhQ.js → advanced-Ddtt8Hj-.js} +1 -1
- package/dist/assets/appearance-BrPMC4u8.js +1 -0
- package/dist/assets/ar-2yn9i2dw.js +7 -0
- package/dist/assets/audit-logs-D9m5k0JB.js +35 -0
- package/dist/assets/{authorize-DNTNbUhI.js → authorize-T5C3DfFM.js} +1 -1
- package/dist/assets/{base32-_zEVBJUg.js → base32-BPfgmw66.js} +1 -1
- package/dist/assets/blocklet-default-logo-Bspnu_ws.png +0 -0
- package/dist/assets/{branding-hDeNkLC2.js → branding-BVm4-_4U.js} +2 -2
- package/dist/assets/{branding-By8KDk5Q.js → branding-hFlZ2gIT.js} +2 -2
- package/dist/assets/{bundle-avatar-DYTLzqlT.js → bundle-avatar-BEofqN1I.js} +1 -1
- package/dist/assets/button-m03GMAJs.js +1 -0
- package/dist/assets/click-to-copy-DmYkL7Ui.js +1 -0
- package/dist/assets/{collapse-QV_2gdtM.js → collapse-FsvH0gRe.js} +1 -1
- package/dist/assets/complete-DwnM8k9G.js +39 -0
- package/dist/assets/{component-Blsql2u0.js → component-s7RjpIXH.js} +8 -8
- package/dist/assets/{config-LE_EJolF.js → config-Dl_53WnU.js} +1 -1
- package/dist/assets/{config-D6r2ZAFY.js → config-bdYGvEMY.js} +2 -2
- package/dist/assets/{config-navigation-B0nu0al4.js → config-navigation-bI89qiN3.js} +3 -3
- package/dist/assets/config-space-D1h9DQze.js +1 -0
- package/dist/assets/confirm-zdbJI4Oz.js +7 -0
- package/dist/assets/{connect-Cu2Ssv5A.js → connect-B2amNptu.js} +1 -1
- package/dist/assets/connect-BTGTAWj-.js +5 -0
- package/dist/assets/connect-to-DrS33AaQ.js +1 -0
- package/dist/assets/{content-layout-BzF-fNQz.js → content-layout--sy9JlYZ.js} +1 -1
- package/dist/assets/dashboard-u-oRSlsi.js +239 -0
- package/dist/assets/de-CEKbJD3-.js +7 -0
- package/dist/assets/delete-confirm-CUNBU1J1.js +1 -0
- package/dist/assets/{did-address-DjwPl1uy.js → did-address-BI9LYTx-.js} +1 -1
- package/dist/assets/domain-ER_Bg0qe.js +9 -0
- package/dist/assets/domain-action-card-CYBXEnlZ.js +28 -0
- package/dist/assets/domains-CBYb9WvZ.js +1 -0
- package/dist/assets/dot-BB5occkV.js +7 -0
- package/dist/assets/{email-BZVu6WP-.js → email-BmZcVM-V.js} +2 -2
- package/dist/assets/{empty-spinner-n0_Ehns5.js → empty-spinner-BZw_ShnT.js} +1 -1
- package/dist/assets/{es-BuUaHPig.js → es-dvMygD-W.js} +3 -3
- package/dist/assets/{exchange-passport-8jdiPDph.js → exchange-passport-B5vniH8u.js} +1 -1
- package/dist/assets/fr-BvFd5xp9.js +7 -0
- package/dist/assets/{fuel-Dx_cnsCl.js → fuel-DW3R8bWE.js} +1 -1
- package/dist/assets/{gen-access-key-CqKmmKML.js → gen-access-key-h48ZchOb.js} +1 -1
- package/dist/assets/get-safe-url-BcH2iukm.js +1 -0
- package/dist/assets/get-safe-url-OaLLn0UN.js +1 -0
- package/dist/assets/hi-C51yBXa5.js +5 -0
- package/dist/assets/{home-DzCwBE8F.js → home-CJ28zTIJ.js} +1 -1
- package/dist/assets/id-B1Mq_eQI.js +7 -0
- package/dist/assets/{iframe-DW7zzzTG.js → iframe-D0kv9-rE.js} +1 -1
- package/dist/assets/index-8eXqqyHQ.js +5 -0
- package/dist/assets/index-BGat0zzz.js +284 -0
- package/dist/assets/index-BXdw6keY.js +1 -0
- package/dist/assets/{index-BDYaw77z.js → index-BdH_4Yfe.js} +1 -1
- package/dist/assets/{index-C5SsKJ2n.js → index-C0te7llT.js} +18 -14
- package/dist/assets/index-C1rBJXFe.js +1 -0
- package/dist/assets/index-C3bbolus.js +113 -0
- package/dist/assets/{index-BYCeMwoO.js → index-C849wD9b.js} +1 -1
- package/dist/assets/{index-Bju4sfVL.js → index-CJpkpFKR.js} +2 -2
- package/dist/assets/index-CNauVjuD.js +99 -0
- package/dist/assets/{index-Btl_rz0J.js → index-CSbITcwB.js} +17 -17
- package/dist/assets/{index-DcUhenm6.js → index-CmQOzzP8.js} +1 -1
- package/dist/assets/{index-HU4yqI-9.js → index-D-X7HfwW.js} +1 -1
- package/dist/assets/{index-CPfvVvHv.js → index-D-mbJPLJ.js} +12 -12
- package/dist/assets/{index-enM9Y412.js → index-D3iGbfL9.js} +1 -1
- package/dist/assets/index-D70ICXrC.js +1 -0
- package/dist/assets/{index-DefO2n6z.js → index-DRCFOq4H.js} +58 -58
- package/dist/assets/{index-B8r-LrrM.js → index-DbsXFWms.js} +1 -1
- package/dist/assets/{index-BIPRCLBG.js → index-DoCu_ga_.js} +2 -2
- package/dist/assets/index-DwnC6XvN.js +6 -0
- package/dist/assets/{index-ftkgQlGr.js → index-DwswX2WL.js} +1 -1
- package/dist/assets/index-Up0XQY6f.js +55 -0
- package/dist/assets/index-VzeamwDR.js +241 -0
- package/dist/assets/index-nBzxkc-e.js +4 -0
- package/dist/assets/{index-SzdSxpkq.js → index-tD3kWii2.js} +4 -4
- package/dist/assets/{invitation-1bsb30Yz.js → invitation-CLUn7Gd4.js} +4 -4
- package/dist/assets/invite-B1zBa8Gp.js +1 -0
- package/dist/assets/issue-passport-5n5uQFFQ.js +1 -0
- package/dist/assets/item-BCYQnjF7.js +2 -0
- package/dist/assets/ja-CCKVmbEX.js +7 -0
- package/dist/assets/ko-A_w8tIEg.js +7 -0
- package/dist/assets/{landing-page-Due4o1uF.js → landing-page-CUrvCtHZ.js} +1 -1
- package/dist/assets/{launch-result-message-DIYoykBK.js → launch-result-message-Eea5FZDm.js} +1 -1
- package/dist/assets/{layout-D93HKT6w.js → layout-Bs_rMuQ9.js} +2 -2
- package/dist/assets/list-CFP3MiEI.js +2 -0
- package/dist/assets/list-M2tV_ZYf.js +236 -0
- package/dist/assets/list-header-DNFbdM3a.js +1 -0
- package/dist/assets/localization-Cl5vfs2R.js +1 -0
- package/dist/assets/{log--AX8zo75.js → log-CcpvITx1.js} +2 -3
- package/dist/assets/logger-BYg6vYBA.js +1 -0
- package/dist/assets/{login-WRcteY7r.js → login-4G5grSod.js} +1 -1
- package/dist/assets/login-oauth-callback-DMou-vp-.js +1 -0
- package/dist/assets/{logo-uploader-CQCy6MG3.js → logo-uploader-Bf6myR3q.js} +3 -3
- package/dist/assets/{lost-passport-kJX7pEJj.js → lost-passport-DWc6Kq0b.js} +2 -2
- package/dist/assets/{open-window--2G6Qjbq.js → open-window-CuyFfntO.js} +1 -1
- package/dist/assets/overview-vcNUrQdk.js +85 -0
- package/dist/assets/{page-header-xyZktwBS.js → page-header-DpNvpd52.js} +4 -4
- package/dist/assets/{passport-item-CIvCqz_R.js → passport-item-IDGIDfr4.js} +1 -1
- package/dist/assets/{permission-BH1TY_tz.js → permission-Cnn9EYOW.js} +1 -1
- package/dist/assets/preferences-Cqm2olsT.js +1 -0
- package/dist/assets/profile-embed-CcuuyEXm.js +1 -0
- package/dist/assets/pt-7HHecjdA.js +5 -0
- package/dist/assets/publish-resource-DGUHUINH.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-7PS2VwOi.js → react-beautiful-dnd.esm-cfY5JZV6.js} +1 -1
- package/dist/assets/ru-Bw8FVC4M.js +5 -0
- package/dist/assets/runtime-efQyx-LE.js +1 -0
- package/dist/assets/sdk-CXaHNlMH.js +1 -0
- package/dist/assets/{section-Cv4udilp.js → section-C1TPQFRq.js} +1 -1
- package/dist/assets/{security-DM8MeY05.js → security-DFjq-0Qw.js} +4 -4
- package/dist/assets/{session-CHdTc1We.js → session-B2z_IWIe.js} +1 -1
- package/dist/assets/setup-CLYOmcmD.js +30 -0
- package/dist/assets/{shorten-label-Cng55547.js → shorten-label-Bf7YQUd6.js} +1 -1
- package/dist/assets/{simple-select-CP_Svi_D.js → simple-select-DwWEI_ZU.js} +1 -1
- package/dist/assets/{slicedToArray-C7EPqaHf.js → slicedToArray-BSaY8ui4.js} +1 -1
- package/dist/assets/{spaces-BVG-t3ND.js → spaces-DMMN97uo.js} +1 -1
- package/dist/assets/{start-CIjuDAiX.js → start-xHz18_Rr.js} +3 -3
- package/dist/assets/{starting-progress-CiLZpNpg.js → starting-progress-DeFtXRb_.js} +1 -1
- package/dist/assets/status-y-bc7cex.js +1 -0
- package/dist/assets/{step-actions-CeJCmiCS.js → step-actions-Btu6D6gk.js} +1 -1
- package/dist/assets/{studio-DikseKRr.js → studio-CiFHrC57.js} +1 -1
- package/dist/assets/{switch-control-C5i52ixk.js → switch-control-DnNP5DPe.js} +1 -1
- package/dist/assets/table-tips-hNIkakER.js +1 -0
- package/dist/assets/th-DyW-mYrC.js +5 -0
- package/dist/assets/traffic-BIrotm6H.js +35 -0
- package/dist/assets/{transfer-CTEHVklh.js → transfer-BeJGTbo1.js} +1 -1
- package/dist/assets/{unsubscribe-Bi2IV-2n.js → unsubscribe-Bjxnpv_W.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BEy8Tnso.js → use-blocklet-logo-BoFa24A6.js} +1 -1
- package/dist/assets/{use-mobile-Boa_xu9A.js → use-mobile-JEGQfLZ2.js} +1 -1
- package/dist/assets/{use-mobile-DyX6Fl8Z.js → use-mobile-ZAS6Si4t.js} +1 -1
- package/dist/assets/useAsync-DnXpD472.js +1 -0
- package/dist/assets/{useLocalStorage-DVnkpneF.js → useLocalStorage-BRd3tKN9.js} +1 -1
- package/dist/assets/user-center-DI0NPFtg.js +76 -0
- package/dist/assets/{util-MKllNgBs.js → util-C3FgySYN.js} +1 -1
- package/dist/assets/{util-CEAObyfj.js → util-CVjZG67N.js} +1 -1
- package/dist/assets/{vendor-arcblock-uz9DVywv.js → vendor-arcblock-DPRICUXM.js} +109 -109
- package/dist/assets/{vendor-hooks-rDgu5KV9.js → vendor-hooks-Zkb4Ilbj.js} +1 -1
- package/dist/assets/{vendor-mui-core-D_bnq77o.js → vendor-mui-core-Bh-qMRq3.js} +1 -1
- package/dist/assets/{vendor-mui-x-R-0SFz4c.js → vendor-mui-x-CQTjfcpn.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-DHrruicZ.js → vendor-ux-did-connect-Ck9lzrbN.js} +73 -73
- package/dist/assets/vi-bzer6J4H.js +5 -0
- package/dist/assets/wrap-locale-COcPskJ7.js +1 -0
- package/dist/assets/zh-Cti0XXui.js +8 -0
- package/dist/assets/zh-tw-BLcDG99i.js +7 -0
- package/dist/images/all-done-dark.svg +68 -0
- package/dist/images/all-done-light.svg +60 -0
- package/dist/index.html +5 -5
- package/dist/service-worker.js +1 -1
- package/package.json +48 -47
- package/dist/assets/add-resource-CJHw7ea0.js +0 -1
- package/dist/assets/addon--u4EErgw.js +0 -14
- package/dist/assets/appearance-bRLsRDs2.js +0 -1
- package/dist/assets/ar-Blzb8h2o.js +0 -7
- package/dist/assets/audit-logs-B3-Fo3nR.js +0 -35
- package/dist/assets/button-D8hoY4xw.js +0 -1
- package/dist/assets/click-to-copy-CFiGx48J.js +0 -1
- package/dist/assets/complete-6R-n_Ra9.js +0 -45
- package/dist/assets/config-space-d34Deg7R.js +0 -1
- package/dist/assets/confirm-DjTZImyg.js +0 -7
- package/dist/assets/connect-K4ZmMu4L.js +0 -5
- package/dist/assets/connect-to-BG15Vnyg.js +0 -1
- package/dist/assets/dashboard-BIOpvfj3.js +0 -239
- package/dist/assets/de-BxI5dM9K.js +0 -7
- package/dist/assets/delete-confirm-BzuBR6TW.js +0 -1
- package/dist/assets/domain-action-card-Bcs_GWxq.js +0 -24
- package/dist/assets/domain-wh85yL2O.js +0 -9
- package/dist/assets/domains-bzKFbARj.js +0 -1
- package/dist/assets/dot-C4hULxc0.js +0 -7
- package/dist/assets/format-error-BrmqJs5a.js +0 -2
- package/dist/assets/fr-DezMACmP.js +0 -7
- package/dist/assets/get-safe-url-B5RJTMjC.js +0 -1
- package/dist/assets/get-safe-url-Bk6PlU7n.js +0 -1
- package/dist/assets/hi-ClbEozhq.js +0 -5
- package/dist/assets/id-CXYm-1K3.js +0 -7
- package/dist/assets/index-8CHxrfFP.js +0 -1
- package/dist/assets/index-B9nvthxv.js +0 -4
- package/dist/assets/index-C-A13dEh.js +0 -141
- package/dist/assets/index-Cc-e6lxg.js +0 -1
- package/dist/assets/index-DjEDWgGs.js +0 -6
- package/dist/assets/index-Du38Vjy4.js +0 -241
- package/dist/assets/index-Dyl-XQ73.js +0 -99
- package/dist/assets/index-Jnk92KZC.js +0 -284
- package/dist/assets/index-USO5zFMh.js +0 -55
- package/dist/assets/index-ioZVVJtg.js +0 -113
- package/dist/assets/invite-CALl83Zc.js +0 -1
- package/dist/assets/issue-passport-BcStTsbv.js +0 -1
- package/dist/assets/item-Bk_1JLeG.js +0 -2
- package/dist/assets/ja-B5V7b8Cm.js +0 -7
- package/dist/assets/ko-DP9up1nF.js +0 -7
- package/dist/assets/list-D96_O-GY.js +0 -2
- package/dist/assets/list-header-HqBQs1yn.js +0 -1
- package/dist/assets/list-rt6nku1-.js +0 -236
- package/dist/assets/localization-BUDtnbyU.js +0 -1
- package/dist/assets/logger-BLZgTs_U.js +0 -1
- package/dist/assets/login-oauth-callback-DZaPZfnA.js +0 -1
- package/dist/assets/overview-CpKMiGEK.js +0 -85
- package/dist/assets/preferences-CfmnTXfl.js +0 -1
- package/dist/assets/profile-embed-ZtzRYgXv.js +0 -1
- package/dist/assets/pt-CG45pWr4.js +0 -5
- package/dist/assets/publish-resource-CCa5xfwz.js +0 -1
- package/dist/assets/ru-0VhRQc7t.js +0 -5
- package/dist/assets/runtime-eXYlg9Cz.js +0 -1
- package/dist/assets/sdk-9eXJSWHG.js +0 -1
- package/dist/assets/setup-BEsU41BB.js +0 -30
- package/dist/assets/status-CUMJd-nJ.js +0 -1
- package/dist/assets/th-DwH8cjcw.js +0 -5
- package/dist/assets/traffic-B5x_6GvF.js +0 -35
- package/dist/assets/useAsync-C8ydfEEr.js +0 -1
- package/dist/assets/useAsync-CMWsznMW.js +0 -1
- package/dist/assets/user-center-DcXdjtRX.js +0 -76
- package/dist/assets/vi-CcmTJggB.js +0 -5
- package/dist/assets/wrap-locale-B9TkXFQe.js +0 -1
- package/dist/assets/zh-C2MKZFZw.js +0 -8
- package/dist/assets/zh-tw-mW-UVEHx.js +0 -7
- package/dist/images/all-done.png +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Qe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-Bh-qMRq3.js";import{J as St,z as Qt,A as Xt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{a as re,a5 as Ct,Z as K,bP as es,B as me,b1 as ts,ar as wt,j as W,b6 as ss,r as Xe,bQ as ns,Y as Tt,a6 as Rt,bm as Oe,al as Nt,W as is,bt as as}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{z as Ze,C as Et,au as It,av as X,t as se,l as rs,G as pt}from"./index-DRCFOq4H.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-Zkb4Ilbj.js";import{a as et,b as os}from"./dashboard-u-oRSlsi.js";import{l as ls,v as ke}from"./vendor-arcblock-DPRICUXM.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-BoFa24A6.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-FsvH0gRe.js";import{S as ee}from"./section-C1TPQFRq.js";import{S as Re}from"./shorten-label-Bf7YQUd6.js";import{I as Ot}from"./index-D3iGbfL9.js";import{R as At,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-M2tV_ZYf.js";import{W as vs}from"./did-address-BI9LYTx-.js";import{p as Dt}from"./util-CVjZG67N.js";import{D as ys,g as Ss}from"./traffic-BIrotm6H.js";import{B as Lt}from"./bundle-avatar-BEofqN1I.js";import{u as Cs}from"./use-mobile-ZAS6Si4t.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BRd3tKN9.js";import"./index-8eXqqyHQ.js";import"./confirm-zdbJI4Oz.js";import"./PlayArrow-CmxnItFZ.js";import"./get-safe-url-OaLLn0UN.js";import"./session-B2z_IWIe.js";import"./InfoOutlined-BIr5nkjV.js";import"./dot-BB5occkV.js";import"./useAsync-DnXpD472.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-JEGQfLZ2.js";import"./index-C849wD9b.js";import"./CheckCircle-JXD6tKIa.js";import"./index-DoCu_ga_.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-BPfgmw66.js";import"./iframe-D0kv9-rE.js";import"./LaunchOutlined-ClxZU_tj.js";import"./ChevronLeft-D0eko_T8.js";import"./ChevronRight-CQY9Ni7X.js";import"./index-CmQOzzP8.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-YbaNvT9I.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(ls),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var O=i.allow_leading_zeroes===!1?l:y,A=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return O.test(h)&&A&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});A(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),B=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),z=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(X,{name:"from",control:h,rules:{validate:S?z:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(X,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(X,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(X,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(X,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(X,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(es,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(X,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(X,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(X,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(X,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,ze={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Os(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...ze},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(ze))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...ze},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});A(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Qt(Xt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),B=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),z=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(As,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(X,{name:"endpoint",control:h,rules:{validate:S?z:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(X,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(X,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const As=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ts),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(Os,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:ai}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[O,A]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},B=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});A(c.componentDids)},z=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&B()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:z,resendNotification:_,getUser:M,componentDids:O,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ss,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Xe()),zs=e;_t=st.default=(0,Fs.default)((0,zs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},Bs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=Bs(Xe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Xe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function zt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:rs(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],Bt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:Bt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Qs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Ae=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Xs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=zt(r,o,{status:l});return e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(O=>O!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function Be(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=zt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(ns.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Qe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(O,A)=>{A.checked=O.target.checked;const R=o.map(S=>({...S,checked:S.value===A.value?A.checked:S.checked}));l(R)},i=O=>{O.stopPropagation(),s({channels:o.filter(A=>A.checked).map(A=>A.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(O=>e.jsx(ge,{control:e.jsx(Ke,{checked:O.checked,onChange:A=>h(A,O),name:O.value}),label:O.label},O.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:O=>p(O.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:O=>{O.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:O,blocklet:A}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),B=Te({anchorEl:null,position:null}),z=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],Q=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(Q,c.emailSendStatus)||g(H=>({...H,emailSendStatus:Q,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await O(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(A,f):d==="pushKit"?Vs(A,f):d==="webhook"?Gs(f):!0:!1},[O,A]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{B.anchorEl=null,B.position=null,M(null)},be=()=>{z.anchorEl=null,z.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),z.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Qs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const Q=d.currentTarget,H=Q.getBoundingClientRect();B.anchorEl=Q,B.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const Q=await oe(f,u.receiver);await Ee(1),M({channel:f,result:Q}),(typeof Q=="boolean"&&Q||Zt(Q)&&Object.values(Q).every(H=>!!H))&&(await t([f],[u.receiver],q),z.anchorEl||(await Ee(.5),pe()))}catch(Q){K.error(Q.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:Q=>w(Q,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(At,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Oe.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Oe.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.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
|
+
`,sn=ue.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
|
+
`,Ce=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function nn(n){const{wallet:t,push:s,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(he,{item:t})},{name:"Push",value:e.jsx(he,{item:s})},{name:"Email",value:e.jsx(he,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(he,{item:o,isWebhook:!0})}]:[]]}function an(n,t,s){const{wallet:r,push:o,email:l,webhook:y}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:t})},...y.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:y,isWebhook:!0,onResend:t})}]:[]]}_e.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};_e.defaultProps={mode:"simple",onResend:()=>{},resending:!1};he.propTypes={item:x.object.isRequired,isWebhook:x.bool};he.defaultProps={isWebhook:!1};function he({item:n,isWebhook:t=!1}){const{t:s}=re(),r=t?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(T,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(T,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[Ce(r)," / ",Ce(o)," ",s("notification.sendStatus.success")]})})})}xe.propTypes={item:x.object.isRequired,isWebhook:x.bool,channel:x.string,onResend:x.func,loading:x.bool};xe.defaultProps={isWebhook:!1,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function xe({channel:n,item:t,isWebhook:s=!1,onResend:r,loading:o}){const{t:l}=re(),{success:y,failed:p,pending:h}=t,i=Xs(n),O=s?y.length:y,A=s?p.length:p,R=s?h.length:h,S=async z=>{z.stopPropagation();const _=s?[...new Set([...y,...p].map(M=>M))]:[];await r([n],[],!0,_)},D=O+A,G=D>0?O/D*100:0,B=D>0?A/D*100:0;return e.jsxs(rn,{successRatio:G,failedRatio:B,children:[e.jsxs(ae,{variant:"h6",children:[i," (",t.total,")"]}),e.jsxs(ae,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Ye.success,fontWeight:600,fontSize:24},children:Ce(O)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(T,{className:"unsent-area",children:[e.jsxs(T,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[Ce(A)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[Ce(R)," ",l("notification.sendStatus.pending")]})]}),A>0&&e.jsx(T,{className:"resend-btn",children:e.jsx(me,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:S,children:l("notification.resend")})})]})]})}function _e({statistics:n,mode:t="simple",onResend:s,resending:r}){const o=ce(()=>t==="simple"?nn(n):an(n,s,r),[n,t]);return t==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Ot,{style:{alignItems:"flex-start",marginBottom:t==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(dt,{container:!0,spacing:2,children:o.map(l=>e.jsx(dt,{item:!0,md:4,sm:6,xs:12,children:l.value},l.name))})}const rn=ue(T)`
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: flex-start;
|
|
34
|
+
padding: 16px;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background: ${({successRatio:n,failedRatio:t,theme:s})=>n===0&&t===0?s.palette.grey[300]:`linear-gradient(to right, ${Ht(s.palette.success.light,.4)} ${n}%, ${s.palette.grey[100]} ${n}%)`};
|
|
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
|
+
`;Mt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Mt({notification:n,onCancel:t=()=>{},blocklet:s,tab:r="info"}){const{t:o,locale:l}=re(),{getComponent:y,resendNotification:p}=tt(),[h,i]=C.useState(!1),O=ce(()=>y(n.componentDid)||s,[s,n.componentDid]),A=Te({tab:r||"info"}),R=C.useCallback(async(c,g,j=!0,N=[])=>{var a;if(!c.length||!n.id)return;const E=g.length>0?g:(a=n==null?void 0:n.receivers)==null?void 0:a.map(m=>m.receiver);if(!E.length)return;let P=[...c];if(P.includes(W.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Wt(s)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.PUSH)),P.includes(W.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Bt(s)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!P.length)try{i(!0),await p({notificationId:n.id,receivers:E,channels:P,resendFailedOnly:j,...P.includes("webhook")&&N.length?{webhookUrls:N}:{}}),K.success("Message has been sent!")}catch(m){console.error("handleResend error",{error:m}),K.error(m.response?m.response.statusText:m.message)}finally{i(!1)}},[s,n.id,n==null?void 0:n.receivers,p,o]),S=ce(()=>cs(n),[n]),D=ce(()=>ds(n),[n]),G=ce(()=>S?n==null?void 0:n.actorInfo:[],[n]),B=ce(()=>{var c;return(s==null?void 0:s.did)||((c=s==null?void 0:s.meta)==null?void 0:c.did)||""},[s]);function z(){return[{name:o("notification.from"),value:S&&D?e.jsx(hs,{actors:G,teamDid:B,size:32,showName:!0}):e.jsx(xs,{size:32,blocklet:O,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Re,{maxLength:50,children:n.title})},{name:o("notification.body"),value:S?e.jsx(gs,{notification:n,blocklet:s}):e.jsx(bs,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ne,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(is,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(Ot,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const _={info:{label:o("common.basicInfo"),value:"info",component:z},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},M=Object.values(_).map(({label:c,value:g})=>({label:c,value:g})),J=_[A.tab]||_.info,ie=c=>{A.tab=c};return e.jsx(Nt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{A.tab="info",t()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(ln,{children:[e.jsx(T,{mx:3,className:"tabs",children:e.jsx(wt,{tabs:M,current:A.tab,onChange:ie,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[A.tab==="receivers"&&e.jsx(en,{notificationId:n.id,resending:h,handleResend:R}),A.tab==="statistics"&&e.jsx(_e,{statistics:n.statistics,mode:"detail",resending:h,onResend:R}),A.tab==="info"&&e.jsx(J.component,{})]})]})})}const on=C.memo(Mt),ln=ue.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: ${Oe.text.disabled};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;we.propTypes={blocklet:x.object,label:x.string};we.defaultProps={blocklet:null,label:""};const cn=ue.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 we({blocklet:n,label:t}){var s;return e.jsx(cn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||((s=n.meta)==null?void 0:s.title)})]}):e.jsx("span",{className:"name",children:t})})}ct.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ct.defaultProps={onDelete:()=>{}};function ct({list:n,label:t,onDelete:s}){return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(r=>e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Ne,{severity:r})}),onDelete:o=>s(o,r)},r))]})}function dn(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(Ne,{severity:t})})}function un({customTableButtons:n}){var je;const{t,locale:s}=re(),r=jt(),o=C.useMemo(()=>vt(r,qt()),[r]),[l,y]=C.useState(!1),{data:p,paging:h,blocklet:i,fetch:O,getComponent:A,componentDids:R,inService:S,teamDid:D}=tt(),G=C.useRef(null),[B,z]=C.useState(null),[_,M]=C.useState("info"),J=Cs(),[ie,c]=C.useState(!1),g=`notification-records-${(je=i.meta)==null?void 0:je.did}`,j=as(g),[N,E]=C.useState({pageSize:j.rowsPerPage||10,page:j.page?j.page+1:1,dids:j.dids||[],dateRange:j.dateRange||[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),P=ce(()=>{if(!i.children||!i.children.length)return[];const v=[];return i.children.forEach(b=>{var I;const w=b.did||((I=b.meta)==null?void 0:I.did);R.includes(w)&&(b.ancestors=[i],v.push(b))}),v},[R,i]),a=async v=>{try{y(!0),await O(v),y(!1)}finally{y(!1)}};C.useEffect(()=>{a(N)},[N]),C.useEffect(()=>{const v=p.find(b=>b.id===(B==null?void 0:B.id));B&&v&&z({...v})},[p]);const m=(v,b,w,I)=>{v.stopPropagation();const k=w.filter(F=>F!==b);E(F=>({...F,[I]:k,page:1}))},$=({page:v,rowsPerPage:b,filterList:w})=>{const[I=[],,,,k=[]]=w;N.pageSize!==b?E(F=>({...F,pageSize:b,page:1})):N.page!==v+1?E(F=>({...F,page:v+1})):ye(N.dids,I)?ye(N.severities,k)||E(F=>({...F,severities:k,page:1})):E(F=>({...F,dids:I,page:1}))},U=C.useCallback(()=>{z(null),M("info")},[]),oe=C.useCallback(()=>{O(N)},[O,N]),le=[{label:t("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:v=>v.map((b,w)=>{var k;if(b==="system")return e.jsx("span",{children:t("notification.system")},`system-${w}`);const I=P.find(F=>{var d;return(F.did||((d=F.meta)==null?void 0:d.did))===b});return e.jsx(we,{blocklet:I,label:(I==null?void 0:I.title)||((k=I==null?void 0:I.meta)==null?void 0:k.title)},b)}),update:(v,b,w)=>(v[w].splice(b,1),v)},filterOptions:{names:P,logic:(v,b)=>b.length?!b.includes(v):!1,display:(v,b,w,I)=>e.jsxs(Y,{style:{width:"380px"},children:[e.jsx(Vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Yt,{multiple:!0,value:v[w],renderValue:k=>e.jsx(T,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:k.map(F=>{var d;if(F==="system")return e.jsx("span",{children:t("notification.system")},F);const ne=P.find(u=>{var L;return(u.did||((L=u.meta)==null?void 0:L.did))===F});return e.jsx(we,{blocklet:ne,label:(ne==null?void 0:ne.title)||((d=ne==null?void 0:ne.meta)==null?void 0:d.title)},F)})}),onChange:k=>{v[w]=k.target.value,b(v[w],w,I)},children:[e.jsx(ut,{value:"system",children:t("notification.system")}),P.map(k=>{var ne,d;const F=k.did||((ne=k.meta)==null?void 0:ne.did);return e.jsx(ut,{value:F,children:e.jsx(we,{blocklet:k,label:k.title||((d=k.meta)==null?void 0:d.title)})},F)})]})]})},customBodyRenderLite:v=>{var I,k;const b=p[v],w=A(b.componentDid);return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[w?e.jsx(Lt,{size:32,blocklet:w,ancestors:w.ancestors??[]}):e.jsx(js,{blocklet:i,size:32}),e.jsx(Re,{maxLength:50,children:((I=w==null?void 0:w.meta)==null?void 0:I.title)||((k=i==null?void 0:i.meta)==null?void 0:k.title)})]})}}},{label:t("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v],{receivers:w}=b;return e.jsx(Gt,{total:w.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(),z(b),M("receivers")},children:w.map(I=>{const{receiverUser:k}=I,F=Dt(k.avatar,D,S);return e.jsx(Tt,{alt:k.fullName,src:`${F}?imageFilter=resize&w=48&h=48`,size:32,did:I.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},I.receiver)})})}}},{label:t("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(T,{onClick:w=>{w.stopPropagation(),z(b),M("statistics")},children:e.jsx(_e,{statistics:b.statistics})})}}},{label:t("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(Re,{maxLength:50,children:b.title})}}},{label:t("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:v=>{const b=p[v];return e.jsx(Ne,{severity:b.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:v=>e.jsx(ct,{list:v,label:t("notification.severity"),onDelete:(b,w)=>{b.stopPropagation(),m(b,w,le[4].options.filterList,"severities")}}),update:Ae},filterOptions:{names:mt,fullWidth:!0,logic:De,display:(v,b,w,I)=>e.jsx(dn,{label:t("notification.severity"),filterList:v,onChange:b,index:w,column:I,filterValues:mt})}}},{label:t("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:v=>{const{createdAt:b}=p[v];return e.jsx(At,{value:b,locale:s,shouldUpdate:!0})}}}],pe=v=>{E(b=>({...b,dateRange:v,page:1}))},be=[e.jsxs(T,{display:"flex",alignItems:"center",gap:1.5,children:[e.jsx(Jt,{onClick:()=>c(!0),sx:{p:J?0:void 0},children:e.jsx(os,{})},"settings"),J?e.jsx(ae,{children:t("common.setting")}):null]}),...n||[]];return e.jsxs(T,{ref:G,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(pn,{children:e.jsx(yt,{theme:o,children:e.jsx(Rt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:s,columns:le,data:p,durable:g,onChange:$,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...j,onRowClick:(v,{dataIndex:b})=>{z(p[b])}},customPreButtons:[e.jsx(rt,{value:N.dateRange,onChange:pe})],customButtons:be,components:{TableFilterList:v=>e.jsx(ot,{...v,itemComponent:b=>e.jsx(Pe,{...b,canDelete:w=>{var k;const I=(k=w==null?void 0:w.columnNames)==null?void 0:k[(w==null?void 0:w.index)||0];return(I==null?void 0:I.name)==="sender"}})})}})})}),B&&e.jsx(on,{refresh:oe,onCancel:U,notification:B,blocklet:i,tab:_}),e.jsx(Nt,{title:`${t("common.notification")} ${t("common.setting")}`,fullWidth:!0,maxWidth:"md",open:ie,onClose:()=>c(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(T,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(Ds,{})})})]})}const pn=ue.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
|
+
`;$t.propTypes={blocklet:x.object.isRequired,customTableButtons:x.array};$t.defaultProps={customTableButtons:[]};function $t({blocklet:n={},customTableButtons:t}){return e.jsx(Ps,{blocklet:n,children:e.jsx(un,{customTableButtons:t})})}export{$t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-
|
|
1
|
+
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-Bh-qMRq3.js";var t=function(e){return L.jsxs("svg",{...e,children:[L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z",fill:"url(#paint0_linear_615_426)"}),L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z",fill:"url(#paint1_linear_615_426)"}),L.jsxs("defs",{children:[L.jsxs("linearGradient",{id:"paint0_linear_615_426",x1:"31.72",y1:"95.7208",x2:"95.488",y2:"34.3249",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]}),L.jsxs("linearGradient",{id:"paint1_linear_615_426",x1:"28.4374",y1:"99.2464",x2:"98.7613",y2:"44.9372",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]})]})]})};t.defaultProps={width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var s=function(e){return L.jsx("svg",{...e,children:L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.36096 2.3999C7.04725 2.3999 6.76249 2.58326 6.63267 2.86886L0.872671 15.5409C0.825415 15.6448 0.800964 15.7577 0.800964 15.8719V15.9999V27.3919C0.800964 27.8337 1.15914 28.1919 1.60096 28.1919H30.401C30.8428 28.1919 31.201 27.8337 31.201 27.3919V15.8719C31.201 15.7577 31.1765 15.6448 31.1293 15.5409L25.3693 2.86886C25.2394 2.58326 24.9547 2.3999 24.641 2.3999H7.36096ZM2.40096 16.7999V26.5919H29.601V16.7932C29.5669 16.7976 29.5321 16.7999 29.4968 16.7999H22.3993L20.3328 19.8997C20.1845 20.1222 19.9347 20.2559 19.6672 20.2559H11.6032C11.3357 20.2559 11.0859 20.1222 10.9375 19.8997L8.87104 16.7999H2.40096ZM29.2167 15.1999H21.9712C21.7037 15.1999 21.4539 15.3336 21.3056 15.5561L19.239 18.6559H12.0313L9.96483 15.5561C9.81645 15.3336 9.56667 15.1999 9.29919 15.1999H2.78519L7.8761 3.9999H24.1258L29.2167 15.1999Z",fill:"currentColor"})})};s.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};export{s as E,t as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,
|
|
1
|
+
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-Bh-qMRq3.js";import{b1 as X,aM as $,d as H}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{d as G}from"./Done-BUJJNjlP.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-FsvH0gRe.js";import{C as Z}from"./Google-B7PA4qF8.js";import{aa as v,f as ee}from"./index-DRCFOq4H.js";import{R as ne,F as te,L as re}from"./logo-uploader-Bf6myR3q.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -8,4 +8,4 @@ import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b4 a
|
|
|
8
8
|
25%, 75% {
|
|
9
9
|
transform: scale(1.1) translateX(3px);
|
|
10
10
|
}
|
|
11
|
-
`,se={input:
|
|
11
|
+
`,se={input:_,color:T,passport:D,uploader:n=>e.jsx(re,{...n.componentProps})};function ie(n,{editing:s=!1}){const{componentType:i="input",render:a,renderFormItem:d}=n;return s&&d?d:!s&&a?a:se[i==null?void 0:i.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};V.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function V({item:n,findEditingItem:s,getItemValue:i,onFormItemChange:a,onFocusOut:d,disabled:f,loading:m,onCancel:x,formValues:j}){var h;const{key:y,description:p,required:l,solo:P=!1,hidden:g=!1,componentProps:k={},skipButtonDisabled:w=!1}=n;if(g)return null;const I=s(y),{editing:R,shaking:q}=I??{},F=i(n,{editing:R}),r=ie(n,{editing:R}),t={inputProps:{"data-cy":"schema-form-item-component"},key:y,description:p,editing:R,value:F,onChange:(c,E="change")=>a(n,c,E),componentProps:k,skipButtonDisabled:w,onBlur:()=>d(n)};return n.componentType==="collapse"&&((h=n.children)==null?void 0:h.length)>0?e.jsxs(U,{children:[e.jsx(Y,{expandIcon:e.jsx(J,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:n.description}),e.jsx(Q,{children:n.children.map(c=>e.jsx(V,{item:c,findEditingItem:s,getItemValue:i,onFormItemChange:a,onFocusOut:d,formValues:j,disabled:f,loading:m,onCancel:x},c.key))})]}):e.jsxs(b,{className:"form-item",children:[!P&&e.jsxs(b,{className:"form-item-label",sx:{color:l&&!F?"error.main":"text.secondary"},children:[p,l&&e.jsx(ne,{})]}),e.jsxs(b,{className:"form-item-body",children:[e.jsx(b,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:P?"center":"left"},style:{cursor:"text"},onClick:()=>{f||I!=null&&I.edited||w||a(n,j[y],"edit")},children:e.jsx(r,{...t})}),!P&&e.jsx(b,{className:"form-item-action",style:{marginLeft:0},children:R?e.jsxs(e.Fragment,{children:[I.edited?e.jsx(O,{"data-cy":"schema-form-item-confirm",onClick:()=>{a(n,F,"confirm")},disabled:f||m,sx:{animation:q?`${oe} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:m?e.jsx(M,{size:24}):e.jsx(G,{})}):null,e.jsx(O,{"data-cy":"schema-form-item-cancel",onClick:()=>x(n),style:{paddingLeft:I.edited?4:8},disabled:f||m,size:"large",children:e.jsx(H,{})})]}):null})]})]},y)}function L({schema:n,loading:s,value:i,defaultValue:a,onChange:d,style:f,disabled:m}){const x=Object.prototype.toString.call(i)==="[object Object]",[j,y]=u.useState([]),[p,l]=u.useState(x?i:a),P=u.useMemo(()=>n.length===1,[n]),g=u.useCallback(r=>j.find(t=>t.key===r),[j]);u.useEffect(()=>{var r;P&&((r=n[0])!=null&&r.required)&&y([{key:n[0].key,editing:!0,initialValue:a[n[0].key]}])},[n,P,a]);const k=u.useCallback(r=>{y(t=>t.find(c=>c.key===r.key)?t.map(c=>c.key===r.key?r:{...c}):[r].concat(t))},[]),w=u.useCallback((r,t,h)=>{const{key:c,secure:E}=r,C=g(c)??{...r};C.editing=!0;const z=p[c]!==t;C.edited=t&&C.initialValue!==t,C.initialValue=a[c];const N={...p,[c]:t};z&&l(N),d({[c]:t},{allValues:N,action:h,currentItem:r}),h==="confirm"&&E&&l({...p,[c]:"__encrypted__"}),h==="confirm"&&(C.initialValue=p[c]),["confirm","cancel"].includes(h)&&(C.editing=!1,C.edited=!1),k(C)},[a,p,d,k,g]),I=u.useCallback((r,{editing:t=!1})=>{const{key:h}=r,c=x?i[h]:p[h];return c==="__encrypted__"?t?"":"******":c},[x,i,p]),R=u.useCallback(r=>{const t=g(r.key);t&&w(r,t.initialValue,"cancel")},[g,w]),q=u.useCallback(r=>{const t=g(r.key);!t||!t.edited||(t.shaking=!0,k(t),setTimeout(()=>{t.shaking=!1,k(t)},500))},[g,k]),F=u.useCallback(r=>{const t=g(r.key);!t||!t.edited?R(r):q(r)},[g,q,R]);return e.jsx(ae,{className:"form",style:f,children:n==null?void 0:n.map(r=>{const{hidden:t=!1}=r;return t?null:e.jsx(V,{item:r,findEditingItem:g,getItemValue:I,onFormItemChange:w,onFocusOut:F,formValues:p,disabled:m,loading:s,onCancel:R})})})}L.propTypes={schema:o.array.isRequired,loading:o.bool,onChange:o.func.isRequired,value:o.object,defaultValue:o.object,style:o.object,disabled:o.bool};L.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const ae=W(te)``;export{L as S};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,W as R,j as ie,B as L,b1 as be,al as pe,bM as re,Z as je,az as Ce,bt as ke,c2 as Ke,b3 as ve,a6 as Te,$ as Ae}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{d as we}from"./Edit-vxeVwrqO.js";import{f as Se}from"./index-8eXqqyHQ.js";import{r as me}from"./passport-item-IDGIDfr4.js";import{z as $,l as M,aF as De,C as Ie,f as Re}from"./index-DRCFOq4H.js";import{u as B}from"./dashboard-u-oRSlsi.js";import{j as e,H as x,bo as O,br as G,bn as H,q as V,aa as f,al as Q,O as E,ab as $e,bs as Be,bR as _e,ah as P,T as N,ad as ce,ak as Ne}from"./vendor-mui-core-Bh-qMRq3.js";import{M as Pe,$ as We}from"./vendor-arcblock-DPRICUXM.js";import{T as ue}from"./index-D-X7HfwW.js";import{C as xe}from"./confirm-zdbJI4Oz.js";import{a0 as ze}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-DmYkL7Ui.js";import{D as Ue}from"./delete-confirm-CUNBU1J1.js";import{P as qe}from"./permission-Cnn9EYOW.js";import{l as Le,G as Me}from"./vendor-hooks-Zkb4Ilbj.js";import{U as Ee,C as Fe,I as Oe}from"./index-DoCu_ga_.js";import{B as Ge}from"./bundle-avatar-BEofqN1I.js";import{p as He}from"./util-CVjZG67N.js";import{W as le}from"./did-address-BI9LYTx-.js";import{A as Ve}from"./actions-V9hjjowb.js";import{u as Qe}from"./use-mobile-ZAS6Si4t.js";import{T as de}from"./table-tips-hNIkakER.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BRd3tKN9.js";import"./PlayArrow-CmxnItFZ.js";import"./get-safe-url-OaLLn0UN.js";import"./session-B2z_IWIe.js";import"./use-blocklet-logo-BoFa24A6.js";import"./InfoOutlined-BIr5nkjV.js";import"./dot-BB5occkV.js";import"./useAsync-DnXpD472.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-JEGQfLZ2.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-YbaNvT9I.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-BPfgmw66.js";import"./MoreHoriz-H8rabTmY.js";function Z({value:t}){const{t:s,locale:m}=D(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:m}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:m,type:"all"})}Z.propTypes={value:x.string.isRequired};function J({value:t,onChange:s,...m}){const{t:l}=D(),d=b.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(G,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(V,{value:o.value,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}J.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const z=()=>{const t=ie.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=$(),{roles:m}=B(),l=[...t,...s?m:[]];return ze(l,"name").filter(d=>d.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:m}=t,{api:l}=$(),{teamDid:d}=B(),{t:o}=D(),[k,j]=b.useState(!1),[c,h]=b.useState(null),y=z(),T=()=>{j(!1),h(null)},K=async a=>{const{remark:v,passport:r,authType:n}=a;j(!0);const u=await l.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:r,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=u;m(S),h(null),j(!1)},g={title:`${o("common.create")} ${o("accessKey")}`,description:(a,v,r)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{v({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?r(""):r(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:o("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const u=n.target.value;r(null),v({...a,passport:u,__disableConfirm:!a.remark||!u})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:y.map(n=>e.jsx(V,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(J,{value:a.authType,onChange:n=>{v({...a,authType:n.target.value})}}),e.jsx(ue,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{v({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:K,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>h(g),className:"rule-action",children:[k?e.jsx($e,{size:16}):e.jsx(Pe,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(xe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}X.propTypes={remark:x.string,onCreate:x.func};X.defaultProps={onCreate:()=>{},remark:""};function Y(t){const{onConfirm:s,accessKeyId:m,accessKeySecret:l,hideSecret:d}=t,{t:o}=b.useContext(be),[k,j]=b.useState(!1),[c,h]=b.useState(()=>d),y=()=>{h(!c)},T=a=>{j(a.target.checked)},K=b.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
|
|
2
|
+
|
|
3
|
+
const client = new Client(fullEndpoint);
|
|
4
|
+
client.setAuthAccessKey({
|
|
5
|
+
accessKeyId: "${m}",
|
|
6
|
+
accessKeySecret: "${l}",
|
|
7
|
+
});
|
|
8
|
+
`:`curl -H "Authorization: Bearer ${l}" "${(a=window.blocklet)==null?void 0:a.appUrl}/.well-known/service/api/did/session"`},[d,m,l]),g=b.useMemo(()=>{var a;return d?`blocklet deploy --endpoint ${(a=window.blocklet)==null?void 0:a.appUrl} --access-key ${m} --access-secret ${l} {blockletPath}/.blocklet/bundle;`:null},[d,m,l]);return e.jsxs(pe,{title:o("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(L,{disabled:d?!k:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:o("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ze,{children:o(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(q,{children:[e.jsx(U,{children:o("setting.accessKey.accessKeyId")}),e.jsx(F,{children:m})]}),e.jsxs(q,{children:[e.jsx(U,{children:o("setting.accessKey.accessKeySecret")}),c?e.jsx(L,{"data-cy":"show-secret-btn",color:"primary",onClick:y,children:o("setting.accessKey.showSecret")}):e.jsx(F,{children:l})]}),!c&&e.jsxs(q,{children:[e.jsx(U,{children:`Access Key ${o("setting.accessKey.usage")}`}),e.jsx(re,{code:K,language:"javascript"}),g&&e.jsx(re,{code:g,language:"bash"})]}),d&&e.jsx("div",{children:e.jsx(Be,{value:"end",disabled:c,control:e.jsx(_e,{checked:k,onChange:T}),label:o("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}Y.propTypes={accessKeyId:x.string.isRequired,accessKeySecret:x.string.isRequired,onConfirm:x.func,hideSecret:x.bool};Y.defaultProps={onConfirm:()=>{},hideSecret:!0};const U=P.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
margin-bottom: 8px;
|
|
14
|
+
`,q=P.div`
|
|
15
|
+
margin-bottom: 24px;
|
|
16
|
+
`,Ze=P.div`
|
|
17
|
+
font-size: 16px;
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
`;function ee(t){const{t:s,locale:m}=D(),{api:l}=$(),{teamDid:d}=B(),{accessKeyId:o,time:k,remark:j,onDelete:c=()=>{},onClose:h=()=>{}}=t,y=()=>{h()},T=async()=>{try{await l.deleteAccessKey({input:{teamDid:d,accessKeyId:o}}),c()}catch(a){je.error(a==null?void 0:a.message)}finally{y()}},K=a=>({key:`<b>${o}</b>`,name:`<b>${j}</b>`,time:M(a,m),timeAge:We(new Date(a),De(m))}),g={keyName:j,title:s("setting.accessKey.title"),description:k?`${s("setting.accessKey.description",K(k))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${o}</b>`,name:`<b>${j}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:j}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:T,onCancel:y};return e.jsx(Ue,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}ee.propTypes={accessKeyId:x.string.isRequired,time:x.string.isRequired,remark:x.string.isRequired,onDelete:x.func,onClose:x.func};ee.defaultProps={onDelete:()=>{},onClose:()=>{}};function te(t){const{accessKeyId:s,remark:m,onUpdate:l,passport:d,expireAt:o,authType:k,onClose:j}=t,{api:c}=$(),{teamDid:h}=B(),{t:y}=D(),[T,K]=b.useState(!1),g=z(),a=()=>{K(!1),j()},v=async n=>{const{accessKeyId:u,remark:S="",passport:p,expireAt:I,authType:W}=n;K(!0),await c.updateAccessKey({input:{teamDid:h,accessKeyId:u,remark:S.trim(),passport:p,expireAt:I?new Date(I).getTime():null,authType:W}}),l(),a()},r={title:`${y("common.update")} ${y("accessKey")}`,description:(n,u,S)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:y("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:n.accessKeyId,disabled:!0}),e.jsx(E,{label:y("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:n.remark,onChange:p=>{u({...n,remark:p.target.value,__disableConfirm:!p.target.value.trim()}),p.target.value.trim()?S(""):S(y("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:y("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"update-access-key-select-passport",value:n.passport,onChange:p=>{const I=p.target.value;S(null),u({...n,passport:I,__disableConfirm:!n.remark||!I})},fullWidth:!0,label:y("setting.accessKey.passport"),disabled:T,children:g.map(p=>e.jsx(V,{value:p.name,"data-cy":`update-access-key-passport-option-${p.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:p.title||p.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:p.description})]})},p.name))})]}),e.jsx(J,{disabled:!0,value:n.authType,onChange:p=>{u({...n,authType:p.target.value})}}),e.jsx(ue,{placeholder:y("setting.accessKey.expireTime"),value:n.expireAt,onChange:p=>{u({...n,expireAt:p,__disableConfirm:!n.passport||!n.remark||!p})}})]}),confirm:y("common.confirm"),cancel:y("common.cancel"),color:"primary",params:{accessKeyId:s,remark:m,passport:d,expireAt:o,authType:k},onConfirm:v,onCancel:a};return e.jsx(xe,{title:r.title,description:r.description,confirm:r.confirm,color:r.color,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})}te.propTypes={accessKeyId:x.string.isRequired,remark:x.string,passport:x.string,expireAt:x.string,authType:x.string,onUpdate:x.func,onClose:x.func};te.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function se({accessKey:t,onCancel:s}){const{t:m}=D();return e.jsx(pe,{title:m("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Je,{children:e.jsx(ye,{accessKey:t})})})}se.propTypes={accessKey:x.object.isRequired,onCancel:x.func.isRequired};se.defaultProps={};const Je=P(f)`
|
|
20
|
+
margin-top: -16px;
|
|
21
|
+
|
|
22
|
+
.tabs {
|
|
23
|
+
margin-left: 0;
|
|
24
|
+
margin-right: 0;
|
|
25
|
+
}
|
|
26
|
+
`;function ye({accessKey:t}){var a,v;const{t:s,locale:m}=D(),{api:l}=$(),{teamDid:d}=B(),{blocklet:o}=Ie(),k=z(),j=b.useCallback(async r=>r?(await l.getUser({input:{teamDid:d,user:{did:r}}})).user:null,[l,d]),c=Le(()=>j(t.createdBy),{}),h=((o==null?void 0:o.children)||[]).find(r=>{var n;return((n=r==null?void 0:r.meta)==null?void 0:n.did)===t.componentDid}),y=b.useMemo(()=>{var r;return He((r=c==null?void 0:c.data)==null?void 0:r.avatar,d,!0)},[(a=c==null?void 0:c.data)==null?void 0:a.avatar,d]),T=k.find(r=>r.name===t.passport),K=T?T.title:t.passport,g=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(le,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(F,{children:`blocklet-${Ce.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(f,{children:me(K,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:c!=null&&c.data?e.jsx(f,{sx:{display:"flex",alignItems:"center",".MuiAvatar-root":{width:32,height:32}},children:e.jsx(Ee,{user:{...c.data,avatar:y},showDid:!0,cardType:Fe.Detailed,infoType:Oe.Minimal,sx:{border:0,padding:0}})}):t.createdBy?e.jsx(le,{did:t.createdBy,showQrcode:!0}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:m}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:m}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(Z,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...h?[{label:s("setting.accessKey.component"),content:e.jsxs(f,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Ge,{blocklet:h,ancestors:[o]}),e.jsx(f,{ml:"16px",sx:{minWidth:0},children:e.jsxs(f,{className:"component-header",children:[e.jsx(f,{className:"component-name",children:Re.getDisplayName(h,!0)}),e.jsx(f,{className:"component-version",children:(v=h==null?void 0:h.meta)==null?void 0:v.version})]})})]},h)}]:[]]}];return e.jsx(Xe,{gap:3,children:e.jsx(f,{className:"info-area",children:g.map(r=>e.jsxs(f,{mb:3,children:[e.jsx(N,{variant:"h6",sx:{mb:1.5},children:r.title}),e.jsx(f,{className:"info-grid",children:r.items.map(n=>e.jsxs(f,{className:"info-item",children:[e.jsx(f,{className:"info-label",children:e.jsx(N,{variant:"subtitle2",color:"textSecondary",children:n.label})}),e.jsx(f,{children:n.content})]},n.label))})]},r.title))})})}ye.propTypes={accessKey:x.object.isRequired};const Xe=P(Q)`
|
|
27
|
+
.info-card {
|
|
28
|
+
margin-bottom: 24px;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.card-content {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 32px;
|
|
35
|
+
padding: 24px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.passport-image {
|
|
39
|
+
width: 150px;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
transition: transform 0.2s ease-in-out;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
transform: scale(1.05);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.info-area {
|
|
50
|
+
flex: 1;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.info-header {
|
|
56
|
+
padding-bottom: 16px;
|
|
57
|
+
border-bottom: 1px solid #eee;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.info-grid {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 12px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.info-item {
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: 8px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.info-label {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
width: 140px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.logs-card {
|
|
79
|
+
.card-header {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 8px;
|
|
83
|
+
padding: 16px 24px;
|
|
84
|
+
border-bottom: 1px solid #eee;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.MuiTimeline-root {
|
|
88
|
+
padding: 24px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.MuiTimelineContent-root {
|
|
92
|
+
padding: 0px 16px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.MuiTimelineDot-root {
|
|
96
|
+
margin: 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`;function Lt(){var oe,ae;const{t,locale:s}=D(),{api:m,inService:l}=$(),{teamDid:d}=B(),[o,k]=b.useState({}),[j,c]=b.useState(null),[h,y]=b.useState(null),[T,K]=b.useState(null),g=Qe(),a=z(),v=b.useRef(null),r=`access-keys-${d}`,n=ke(r),[u,S]=b.useState({searchText:n.searchText||"",pageSize:n.rowsPerPage||10,page:1}),p=Me(async()=>await m.getAccessKeys({input:{teamDid:d,paging:{page:u.page,pageSize:u.pageSize}}}),[u.page,u.pageSize]),{loading:I,error:W}=p,_=b.useMemo(()=>{var i;return((i=p.value)==null?void 0:i.list)||[]},[(oe=p.value)==null?void 0:oe.list]),fe=b.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(i,{rowIndex:A})=>{const w=_[A];return e.jsx(f,{display:"flex",alignItems:"center",gap:2,children:e.jsx(N,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:i=>e.jsx(Ke,{showDidLogo:!1,children:i})}},{label:t("common.role"),name:"passport",options:{customBodyRender:i=>{const A=a.find(C=>C.name===i),w=A?A.title:i;return e.jsx(f,{children:me(w,i)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:i=>e.jsx(N,{children:i})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:i=>e.jsx(N,{children:t(`setting.accessKey.${i}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:i=>e.jsx(ce,{title:M(i,s),children:i?e.jsx(R,{value:i,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:i=>e.jsx(ce,{title:M(i,s),children:i?e.jsx(R,{value:i,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:i=>i?e.jsx(Z,{value:i}):t("common.neverExpired")}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:A})=>{const w=_[A];return e.jsx(Ve,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(we,{}),text:t("common.edit"),onClick:C=>{C.stopPropagation(),K(w)}},{icon:e.jsx(ve,{}),text:t("common.delete"),onClick:C=>{C.stopPropagation(),y(w)}}]})}}}],[_,s,t,a,y,K]),he=({page:i,rowsPerPage:A,searchText:w})=>{u.pageSize!==A?S(C=>({...C,searchText:"",pageSize:A,page:1})):u.page!==i+1?S(C=>({...C,searchText:"",page:i+1})):u.searchText!==w&&S(C=>({...C,searchText:w,page:1}))},ne=u.searchText?_.filter(i=>i.accessKeyId.toLowerCase().includes(u.searchText.toLowerCase())||(i.remark||"").toLowerCase().includes(u.searchText.toLowerCase())):_;return W?e.jsx(Ne,{severity:"error",children:Se(W)}):e.jsxs(f,{ref:v,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[g?e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(Te,{durable:r,durableKeys:["page","rowsPerPage"],data:ne,columns:fe,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:u.page-1,rowsPerPage:u.pageSize,count:((ae=p.value)==null?void 0:ae.count)||0,searchDebounceTime:600,onRowClick(i,{dataIndex:A},w){var C;if((C=v.current)!=null&&C.contains(w.target)){const ge=ne[A];c(ge)}}},loading:I,onChange:he,title:g?null:e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(qe,{permission:l?"":"mutate_accessKey",children:e.jsx(X,{onCreate:i=>{const{accessKeyId:A,accessKeySecret:w,authType:C}=i;k({show:!0,accessKeyId:A,accessKeySecret:w,authType:C})}})})],emptyNode:e.jsx(Ae,{children:t("oauth.client.empty")})}),o.show&&e.jsx(Y,{hideSecret:o.authType==="signature",onConfirm:()=>{p.retry(),k({show:!1})},...o}),j&&e.jsx(se,{onCancel:()=>c(null),accessKey:j}),h&&e.jsx(ee,{accessKeyId:h.accessKeyId,time:h.lastUsedAt,remark:h.remark||"N/A",onDelete:p.retry,onClose:()=>y(null)}),T&&e.jsx(te,{...T,onUpdate:p.retry,onClose:()=>K(null)})]})}export{Lt as default};
|