@abtnode/blocklet-services 1.16.44-beta-20250513-030435-c2d99062 → 1.16.44-beta-20250518-020443-77ba168f
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/index.js +6 -0
- 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-Din7doVd.js → access-control-DupKwlXi.js} +1 -1
- package/dist/assets/{actions-BjTeIzgS.js → actions-V9hjjowb.js} +1 -1
- package/dist/assets/{add-component-core-5x4gTem5.js → add-component-core-hWyA0oyr.js} +16 -16
- package/dist/assets/add-resource-BE6wXeqY.js +1 -0
- package/dist/assets/addon-DtaZ0TB3.js +14 -0
- package/dist/assets/{advanced-CN6mCSES.js → advanced-EG10mbK7.js} +1 -1
- package/dist/assets/appearance-Czknho-C.js +1 -0
- package/dist/assets/ar-2yn9i2dw.js +7 -0
- package/dist/assets/audit-logs-WqpwTrlM.js +35 -0
- package/dist/assets/{authorize-D2LCmekq.js → authorize-DEmcifx9.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-CwhhJRKu.js → branding-CJx0esf8.js} +2 -2
- package/dist/assets/{branding-B6AmOMI6.js → branding-DFhJVvNX.js} +2 -2
- package/dist/assets/{bundle-avatar-CDJRatFg.js → bundle-avatar-BbIyJr7P.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-C834qh46.js +39 -0
- package/dist/assets/{component-Cb3m5qUw.js → component-BK7TQ5JB.js} +8 -8
- package/dist/assets/{config-kGXJEkFJ.js → config-Cc-40NNR.js} +2 -2
- package/dist/assets/{config-LE_EJolF.js → config-Dl_53WnU.js} +1 -1
- package/dist/assets/{config-navigation-CKVyFhfH.js → config-navigation-DH93rn-r.js} +3 -3
- package/dist/assets/config-space-CxEu1ku3.js +1 -0
- package/dist/assets/confirm-DFwkkng7.js +7 -0
- package/dist/assets/{connect-HAC-YfHh.js → connect-CX2tLgwf.js} +1 -1
- package/dist/assets/{connect-BMn4CxDk.js → connect-tnlrEGOa.js} +1 -1
- package/dist/assets/connect-to-jqzhxL2-.js +1 -0
- package/dist/assets/{content-layout-BzF-fNQz.js → content-layout--sy9JlYZ.js} +1 -1
- package/dist/assets/dashboard-Dc5xtJBc.js +239 -0
- package/dist/assets/de-CEKbJD3-.js +7 -0
- package/dist/assets/delete-confirm-cVLum8Er.js +1 -0
- package/dist/assets/{did-address-DjwPl1uy.js → did-address-BI9LYTx-.js} +1 -1
- package/dist/assets/domain-7fDuc1TD.js +9 -0
- package/dist/assets/domain-action-card-CoP_GfSR.js +28 -0
- package/dist/assets/domains-CGg1il1q.js +1 -0
- package/dist/assets/{dot-BA3EvSrh.js → dot-BB5occkV.js} +2 -2
- package/dist/assets/{email-CHR0EOis.js → email-9P_7A90f.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-D0iIXJxD.js → exchange-passport-CfsGf2j7.js} +1 -1
- package/dist/assets/fr-BvFd5xp9.js +7 -0
- package/dist/assets/{fuel-nMTHNcy-.js → fuel-DOrn9jKI.js} +1 -1
- package/dist/assets/{gen-access-key-DH4wNzRm.js → gen-access-key-Ddbn2A92.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-BuXc3Oag.js → index-BBKe69-Z.js} +2 -2
- package/dist/assets/index-BEVde8cE.js +1 -0
- package/dist/assets/index-BQ8PIDUu.js +99 -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-B_-kynzD.js → index-Bi8r1T8R.js} +17 -17
- package/dist/assets/{index-CIkPfxzG.js → index-BiIZw9KG.js} +58 -58
- package/dist/assets/index-BmR2oN4p.js +113 -0
- package/dist/assets/{index-BCtmnJeV.js → index-BoYbZj00.js} +18 -14
- package/dist/assets/index-C26jJx3Z.js +55 -0
- package/dist/assets/index-C2sWzOOC.js +4 -0
- package/dist/assets/{index-BYCeMwoO.js → index-C849wD9b.js} +1 -1
- package/dist/assets/{index-BLGGjT7N.js → index-CeU2W9XY.js} +8 -8
- package/dist/assets/{index-DcUhenm6.js → index-CmQOzzP8.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-DK8EXxrQ.js +6 -0
- package/dist/assets/index-DPmpjBeE.js +241 -0
- package/dist/assets/{index-B8r-LrrM.js → index-DbsXFWms.js} +1 -1
- package/dist/assets/{index-CxwBhS0_.js → index-DfO-sKO8.js} +1 -1
- package/dist/assets/{index-BIPRCLBG.js → index-DoCu_ga_.js} +2 -2
- package/dist/assets/{index-ftkgQlGr.js → index-DwswX2WL.js} +1 -1
- package/dist/assets/{index-BA8C83iz.js → index-DxVAvQEw.js} +4 -4
- package/dist/assets/index-d-GNQQ24.js +1 -0
- package/dist/assets/{invitation-DzT9Qa0A.js → invitation-DmNSx8lT.js} +4 -4
- package/dist/assets/invite-BRV4-5NB.js +1 -0
- package/dist/assets/issue-passport-DVYjG5SL.js +1 -0
- package/dist/assets/item-F_qGx0RW.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-BcLfVSqs.js → layout-Dkaou_pj.js} +2 -2
- package/dist/assets/list-CUP3NH6M.js +236 -0
- package/dist/assets/list-Dq129hfR.js +2 -0
- package/dist/assets/list-header-DNFbdM3a.js +1 -0
- package/dist/assets/localization-Cl5vfs2R.js +1 -0
- package/dist/assets/{log-Iko0jLNA.js → log-C_uY3dq9.js} +2 -3
- package/dist/assets/logger-BYg6vYBA.js +1 -0
- package/dist/assets/{login-4Yq_pPSw.js → login-D8Wk5up1.js} +1 -1
- package/dist/assets/login-oauth-callback-DMou-vp-.js +1 -0
- package/dist/assets/{logo-uploader-Cnkdgyfv.js → logo-uploader-CHTXjHOW.js} +3 -3
- package/dist/assets/{lost-passport-D5jMtgH_.js → lost-passport-DlnOD9y-.js} +2 -2
- package/dist/assets/{open-window--2G6Qjbq.js → open-window-CuyFfntO.js} +1 -1
- package/dist/assets/overview-B451HiB6.js +85 -0
- package/dist/assets/{page-header-xyZktwBS.js → page-header-DpNvpd52.js} +4 -4
- package/dist/assets/{passport-item-DH3_49G1.js → passport-item-BWCHjFYy.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-BdSfAE92.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-BKK1_RAt.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-CX01lhxW.js → security-C8vye2TA.js} +4 -4
- package/dist/assets/{session-CHdTc1We.js → session-B2z_IWIe.js} +1 -1
- package/dist/assets/setup-CS2QWFMb.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-CMRQU8Px.js → start-6o3_Gxa0.js} +3 -3
- package/dist/assets/{starting-progress-CiLZpNpg.js → starting-progress-DeFtXRb_.js} +1 -1
- package/dist/assets/status-C73nIKwK.js +1 -0
- package/dist/assets/{step-actions-BfGTFkaB.js → step-actions-CqbOBcvS.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-B7XP49Y5.js +35 -0
- package/dist/assets/{transfer-BnR8fjLW.js → transfer-BfUTfR-d.js} +1 -1
- package/dist/assets/{unsubscribe-rUE2LcLN.js → unsubscribe-Bf4dBSoS.js} +1 -1
- package/dist/assets/{use-blocklet-logo-Phq7jasP.js → use-blocklet-logo-Bv56-gH-.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-DV3NyLhI.js → useAsync-DnXpD472.js} +1 -1
- package/dist/assets/{useLocalStorage-DVnkpneF.js → useLocalStorage-BRd3tKN9.js} +1 -1
- package/dist/assets/user-center-Ck0gNc-m.js +76 -0
- package/dist/assets/{util-CEAObyfj.js → util-CVjZG67N.js} +1 -1
- package/dist/assets/{util-Btd7aQEC.js → util-DWicJSOi.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-HcPVeI43.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-BrZnm53f.js +0 -1
- package/dist/assets/addon--u4EErgw.js +0 -14
- package/dist/assets/appearance-Bowm1Shj.js +0 -1
- package/dist/assets/ar-Blzb8h2o.js +0 -7
- package/dist/assets/audit-logs-DczjqamJ.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-CKhw9u_z.js +0 -45
- package/dist/assets/config-space-CogRdhoQ.js +0 -1
- package/dist/assets/confirm-SdqBW-ti.js +0 -7
- package/dist/assets/connect-to-eNQDY2rc.js +0 -1
- package/dist/assets/dashboard-BYxl5V9e.js +0 -239
- package/dist/assets/de-BxI5dM9K.js +0 -7
- package/dist/assets/delete-confirm-CKF_eljP.js +0 -1
- package/dist/assets/domain-DotN6lCb.js +0 -9
- package/dist/assets/domain-action-card-DHH9PLRG.js +0 -24
- package/dist/assets/domains-BV2pykxi.js +0 -1
- 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-B54lTbup.js +0 -99
- package/dist/assets/index-BCNchyGN.js +0 -141
- package/dist/assets/index-BJxv6GA4.js +0 -4
- package/dist/assets/index-CYeNo51G.js +0 -113
- package/dist/assets/index-CfxcUIhC.js +0 -1
- package/dist/assets/index-Ctzl9JDw.js +0 -55
- package/dist/assets/index-D7eC9ptO.js +0 -6
- package/dist/assets/index-D9KfgDPN.js +0 -241
- package/dist/assets/invite-CQPeUOT4.js +0 -1
- package/dist/assets/issue-passport-BYhvmLsl.js +0 -1
- package/dist/assets/item-D942q-4T.js +0 -2
- package/dist/assets/ja-B5V7b8Cm.js +0 -7
- package/dist/assets/ko-DP9up1nF.js +0 -7
- package/dist/assets/list-BiJWMg_P.js +0 -236
- package/dist/assets/list-DKUSPdB6.js +0 -2
- package/dist/assets/list-header-HqBQs1yn.js +0 -1
- 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-CaQ-tV1t.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-BtFRgv4P.js +0 -1
- package/dist/assets/ru-0VhRQc7t.js +0 -5
- package/dist/assets/runtime-B0207zk1.js +0 -1
- package/dist/assets/sdk-9eXJSWHG.js +0 -1
- package/dist/assets/setup-DIAgbS7c.js +0 -30
- package/dist/assets/status-DSQPLYSp.js +0 -1
- package/dist/assets/th-DwH8cjcw.js +0 -5
- package/dist/assets/traffic-ClE631in.js +0 -35
- package/dist/assets/user-center-D25Vw-wP.js +0 -76
- package/dist/assets/vi-CcmTJggB.js +0 -5
- package/dist/assets/wrap-locale-CPW6a0PM.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
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import{u as q,_ as $,bN as U,I as be,bO as fe,a0 as ge,a7 as je,bu as ye}from"./vendor-ux-did-connect-DHrruicZ.js";import{t as we,m as de,j as ke}from"./vendor-hooks-rDgu5KV9.js";import{r as C,b as G}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-DkG0jjos.js";import{j as ve,M as Ee}from"./vendor-arcblock-uz9DVywv.js";import{z as F,au as Ce,av as K,C as ce,t as Te}from"./index-CIkPfxzG.js";import{u as _}from"./dashboard-BYxl5V9e.js";import{H as o,j as e,D as Se,aj as Re,t as Ie,aa as f,O as ie,T as S,ab as B,ak as Z,z as Me,y as H,bt as le,bS as Y,ad as W,L as J,A as Q,bd as Pe,E as O,I as ee,C as ze,br as De,al as P,ch as $e,X as We,bc as V,bq as Oe,b5 as Ae,ci as qe,cj as Le,b6 as Be,an as He,c1 as Ne,s as pe,v as Fe,ck as _e,cl as Ue,cm as Ke,cn as Ye}from"./vendor-mui-core-D_bnq77o.js";import{d as Ve}from"./ExpandLess-CkoEHpgk.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-rHXShPKm.js";import{C as Ge}from"./confirm-SdqBW-ti.js";import{A as Xe}from"./actions-BjTeIzgS.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DVnkpneF.js";import"./PlayArrow-BToG9L6q.js";import"./get-safe-url-B5RJTMjC.js";import"./format-error-BrmqJs5a.js";import"./session-CHdTc1We.js";import"./use-blocklet-logo-Phq7jasP.js";import"./dot-BA3EvSrh.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DyX6Fl8Z.js";import"./MoreHoriz-B6KdR0Y8.js";const Ze=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const x={};return d&&(d.sources.forEach(r=>{x[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{x[r.source]&&(x[r.source].events.push(r),x[r.source].count+=1)})),x},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(x){p(x instanceof Error?x:new Error(String(x)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:j}])=>{const E=j.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},x=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:x,checked:l>0&&l===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const M=s[r]>0,i=s[r]===j.length&&j.length>0,h=R[r];return e.jsxs(G.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Pe,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(ee,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(ve,{})})]})]})}),j.length>0&&e.jsx(ze,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:k,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(De,{error:!0,sx:{mt:1},children:a})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=q(),[s,l]=C.useState({}),{teamDid:v}=_(),{api:T}=F(),{loading:g,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:M}=Ce({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[s,u,M]);const i=()=>{l({}),E(),R()},h=async m=>{const k=Object.keys(s).filter(I=>s[I]),z={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[A,L]=I.split("-");return!A||!L?null:{type:A,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:z}});$.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:z}});$.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){$.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(Se,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Re,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ie,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(k=j.url)==null?void 0:k.message})}}),e.jsx(K,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(k=j.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!x||Object.keys(x).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(B,{size:20})}),y&&e.jsx(Z,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Me,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:p("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const et=(t="en")=>t==="tw"?"zh":t;function N(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Te(t).locale(et(c)).format(d):"-"}function tt(t){return typeof t=="number"?!1:ue(t)}function ot(t){return t>=200&&t<300}function D(t){const d=tt(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(W,{title:t.tip,children:e.jsx($e,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(We,{orientation:"vertical",flexItem:!0})]})}D.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};D.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const nt=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=F(),{t:b}=q(),{teamDid:R}=_(),{blocklet:p}=ce(),{data:s,loadMore:l,loadingMore:v,loading:T}=we(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),g=(s==null?void 0:s.list)||[],[y,x]=C.useState(null),r=nt(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&x(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{x(u)};if(T)return e.jsx(B,{});const j=s&&s.list.length<s.paging.total,E=u=>{var M,i,h,n,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((h=u.responseBody)!=null&&h.agentId)){const k=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,z=(p.children||[]).find(A=>{var L;return((L=A==null?void 0:A.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(z==null?void 0:z.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(G.Fragment,{children:[e.jsx(Oe,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:N(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ae,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(qe,{color:"error"}):e.jsx(Le,{color:"success"})}),e.jsx(Be,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function he({id:t,onClose:d}){var v,T,g,y;const{t:c}=q(),{api:a}=F(),{teamDid:b}=_(),{loading:R,error:p,data:s}=de(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(Z,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(B,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(W,{title:l.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Ne,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.listen"),value:e.jsx(W,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(x=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:x==null?void 0:x.type},x))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:N(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:N(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}he.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(He,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(he,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=G.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=Fe(g=>g.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:s,options:{...v,...t},columns:(d||[]).map(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(ge,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(je)`
|
|
2
|
-
.custom-toobar-btns {
|
|
3
|
-
gap: 8px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.MuiPaper-root {
|
|
7
|
-
border-radius: 8px;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
}
|
|
10
|
-
table.MuiTable-root {
|
|
11
|
-
outline: 1px solid ${({theme:t})=>t.palette.divider};
|
|
12
|
-
border-radius: var(--radius-m, 8px);
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
}
|
|
15
|
-
[class*='MUIDataTable-responsiveBase'] {
|
|
16
|
-
outline: 1px solid ${({theme:t})=>t.palette.divider};
|
|
17
|
-
border-radius: var(--radius-m, 8px);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
th.MuiTableCell-head {
|
|
21
|
-
padding: 8px 16px 8px 16px;
|
|
22
|
-
text-transform: inherit;
|
|
23
|
-
border-bottom: none;
|
|
24
|
-
&:first-of-type {
|
|
25
|
-
border-top-left-radius: 8px;
|
|
26
|
-
padding-left: 20px;
|
|
27
|
-
}
|
|
28
|
-
&:last-of-type {
|
|
29
|
-
border-top-right-radius: 8px;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
tr.MuiTableRow-root:not(.MuiTableRow-footer):hover {
|
|
34
|
-
background: ${({theme:t})=>t.palette.grey[100]};
|
|
35
|
-
}
|
|
36
|
-
tr.MuiTableRow-root:last-of-type td:first-of-type {
|
|
37
|
-
border-bottom-left-radius: 8px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
tr.MuiTableRow-root:last-of-type td:last-of-type {
|
|
41
|
-
border-bottom-right-radius: 8px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
tr.MuiTableRow-root:nth-of-type(even) {
|
|
45
|
-
background: ${({theme:t})=>t.palette.grey[50]};
|
|
46
|
-
}
|
|
47
|
-
td.MuiTableCell-root {
|
|
48
|
-
border-bottom: none;
|
|
49
|
-
padding-top: 12px;
|
|
50
|
-
padding-bottom: 12px;
|
|
51
|
-
padding-left: 16px;
|
|
52
|
-
padding-right: 16px;
|
|
53
|
-
&:first-of-type {
|
|
54
|
-
padding-left: 20px;
|
|
55
|
-
}
|
|
56
|
-
&.MuiTableCell-footer {
|
|
57
|
-
border: none;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.datatable-footer {
|
|
62
|
-
.MuiTableRow-root.MuiTableRow-footer {
|
|
63
|
-
border: none;
|
|
64
|
-
}
|
|
65
|
-
table.MuiTable-root {
|
|
66
|
-
outline: none;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
}
|
|
69
|
-
.MuiTablePagination-input {
|
|
70
|
-
background: none;
|
|
71
|
-
}
|
|
72
|
-
div.MuiSelect-select {
|
|
73
|
-
padding: 0 24px 0 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
th a,
|
|
78
|
-
td a {
|
|
79
|
-
text-decoration: none;
|
|
80
|
-
display: block;
|
|
81
|
-
color: inherit;
|
|
82
|
-
&:first-of-type {
|
|
83
|
-
padding-left: 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
> div {
|
|
88
|
-
overflow: auto;
|
|
89
|
-
}
|
|
90
|
-
.custom-toobar-title-inner {
|
|
91
|
-
display: flex;
|
|
92
|
-
align-items: center;
|
|
93
|
-
}
|
|
94
|
-
@media (max-width: ${({theme:t})=>t.breakpoints.values.md}px) {
|
|
95
|
-
th a,
|
|
96
|
-
td a {
|
|
97
|
-
text-decoration: none;
|
|
98
|
-
display: block;
|
|
99
|
-
color: inherit;
|
|
100
|
-
padding-top: 0;
|
|
101
|
-
padding-bottom: 0;
|
|
102
|
-
padding-right: 0;
|
|
103
|
-
}
|
|
104
|
-
tr.MuiTableRow-root {
|
|
105
|
-
border: none;
|
|
106
|
-
padding: 20px;
|
|
107
|
-
display: block;
|
|
108
|
-
}
|
|
109
|
-
td.MuiTableCell-root:first-of-type {
|
|
110
|
-
padding-left: 0;
|
|
111
|
-
margin-top: 0;
|
|
112
|
-
}
|
|
113
|
-
td.MuiTableCell-root {
|
|
114
|
-
margin: 0;
|
|
115
|
-
margin-top: 8px;
|
|
116
|
-
align-items: center;
|
|
117
|
-
padding: 0;
|
|
118
|
-
flex-wrap: wrap;
|
|
119
|
-
flex-direction: ${({mobileTDFlexDirection:t="column"})=>t||"row"};
|
|
120
|
-
align-items: ${({mobileTDFlexDirection:t="column"})=>t==="column"?"flex-start":"center"};
|
|
121
|
-
justify-content: ${({mobileTDFlexDirection:t="column"})=>t==="column"?"flex-start":"space-between"};
|
|
122
|
-
}
|
|
123
|
-
td.MuiTableCell-root > div {
|
|
124
|
-
margin-bottom: 4px;
|
|
125
|
-
}
|
|
126
|
-
.MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
|
|
127
|
-
display: flex;
|
|
128
|
-
flex-direction: ${({mobileTDFlexDirection:t="column"})=>t||"row"};
|
|
129
|
-
align-items: flex-start;
|
|
130
|
-
justify-content: ${({mobileTDFlexDirection:t="column"})=>t==="row"?"space-between":"flex-start"};
|
|
131
|
-
flex-wrap: ${({mobileTDFlexDirection:t="column"})=>t==="row"?"nowrap":"wrap"};
|
|
132
|
-
word-break: break-all;
|
|
133
|
-
&.datatables-noprint {
|
|
134
|
-
justify-content: center;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
[class*='MUIDataTable-responsiveBase'] tr:not([class*='responsiveSimple']) td.MuiTableCell-body > div {
|
|
138
|
-
width: inherit;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
`,it=re;function Pt(){const{teamDid:t}=_(),d=`webhook-endpoints-${t}`,c=ye(d),{t:a}=q(),{api:b}=F(),[R,p]=C.useState(""),[s,l]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[v,T]=ke(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:g,error:y,data:x,refresh:r}=de(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:v.page,pageSize:v.pageSize}}}));C.useEffect(()=>{r()},[v,r]);const w=C.useCallback(async(i,h)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:h?"disabled":"enabled"}}}),r(),$.success(`${a(h?"webhookEndpoint.disable":"webhookEndpoint.enable")}${a("webhookEndpoint.success")}`)}catch(n){$.error(n==null?void 0:n.message)}},[b,t,r,a]),j=C.useCallback(async i=>{try{await b.deleteWebhookEndpoint({input:{teamDid:t,id:i}}),r(),l(h=>({...h,deleteConfirm:null})),$.success(`${a("common.delete")}${a("webhookEndpoint.success")}`)}catch(h){$.error(h==null?void 0:h.message)}},[b,t,r,a]),E=(i,h)=>{let n=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(h==="changePage"||h==="changeRowsPerPage"){h!=="changePage"&&(n=1);const k={page:n,pageSize:i.rowsPerPage};p(""),T(k)}};if(y)return e.jsx(Z,{severity:"error",children:y.message});if(g||!x)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(B,{})});const u=((x==null?void 0:x.list)||[]).filter(i=>{if(!R)return!0;const h=R.toLowerCase();return i.description.toLowerCase().includes(h)||i.url.toLowerCase().includes(h)}),M=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,h)=>{const n=u[h];return e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(S,{variant:"body2",children:n.description}),e.jsx(f,{sx:{display:"flex"},onClick:m=>{m.stopPropagation()},children:e.jsx(W,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,h)=>{const n=u[h];return e.jsx(f,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(m=>e.jsx(O,{size:"small",variant:"filled",label:m.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${m.type}`))})}}},{label:a("common.status"),name:"status",options:{customBodyRenderLite:(i,h)=>{const n=u[h];return e.jsx(O,{size:"small",variant:"filled",label:a(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:a("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>N(i)}},{label:a("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,h)=>{const n=u[h],m=(n==null?void 0:n.status)==="enabled";return e.jsx(Xe,{actions:[{icon:m?e.jsx(_e,{}):e.jsx(Ue,{}),text:a(m?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:k=>{k.stopPropagation(),w(n,m)}},{icon:e.jsx(Ke,{}),text:a("common.edit"),onClick:k=>{k.stopPropagation(),l(z=>({...z,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Ye,{}),text:a("common.delete"),onClick:k=>{k.stopPropagation(),l(z=>({...z,deleteConfirm:{title:a("webhookEndpoint.deleteWebhook.title"),description:a("webhookEndpoint.deleteWebhook.description"),confirm:a("common.confirm"),cancel:a("common.cancel"),onConfirm:()=>j(n.id),onCancel:()=>l(I=>({...I,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(e.Fragment,{children:[e.jsx(it,{durable:d,durableKeys:["page","rowsPerPage"],data:u,columns:M,options:{count:x.count,page:v.page-1,rowsPerPage:v.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:h})=>{const n=x.list[h];l(m=>({...m,webhookDetail:{open:!0,id:n.id}}))}},loading:g,onChange:E,title:e.jsx(S,{variant:"h6",children:a("webhookEndpoint.title")}),emptyNodeText:e.jsxs(P,{gap:1,children:[a("webhookEndpoint.noWebhooksAdded"),e.jsx(H,{variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:a("webhookEndpoint.createWebhook")})]}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[g?e.jsx(B,{size:16}):e.jsx(Ee,{style:{fontSize:16}}),a("common.create")]},"add")]}),s.webhookDetail.open&&e.jsx(me,{open:!0,onClose:()=>l(i=>({...i,webhookDetail:{open:!1,id:null}})),id:s.webhookDetail.id}),s.createEdit.open&&e.jsx(oe,{onSubmit:r,...s.createEdit,onClose:()=>l(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),s.deleteConfirm&&e.jsx(Ge,{title:s.deleteConfirm.title,description:s.deleteConfirm.description,confirm:s.deleteConfirm.confirm,cancel:s.deleteConfirm.cancel,params:s.deleteConfirm.params,onConfirm:s.deleteConfirm.onConfirm,onCancel:s.deleteConfirm.onCancel})]})}export{Pt as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{j as t,ab as S,aa as c,H as d,ah as g}from"./vendor-mui-core-D_bnq77o.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{b2 as v,C as w,B as m}from"./vendor-ux-did-connect-DHrruicZ.js";import{P}from"./page-header-xyZktwBS.js";import{C as T}from"./index-CIkPfxzG.js";import{u as B}from"./config-space-CogRdhoQ.js";import{C as E,D as b,a as D}from"./connect-to-eNQDY2rc.js";import{S as u}from"./step-actions-BfGTFkaB.js";import{S as N}from"./layout-BcLfVSqs.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-uz9DVywv.js";import"./spaces-BVG-t3ND.js";import"./api-BjteVZFg.js";import"./DeleteOutline-CFN4r-OG.js";import"./format-error-BrmqJs5a.js";import"./use-mobile-DyX6Fl8Z.js";import"./content-layout-BzF-fNQz.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:C,updateSpaceGateway:j,hasStorageEndpoint:h,loading:o,storageEndpoint:s}=B();return o?t.jsx(w,{relative:"parent",children:t.jsx(S,{})}):t.jsxs(G,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:h?t.jsx(E,{spaceGateway:f,settingStorageEndpoint:C}):t.jsx(b,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:j,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const G=g(N)`
|
|
2
|
-
height: 100%;
|
|
3
|
-
overflow-y: auto;
|
|
4
|
-
`;export{l as default};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import{g as qt,r as T}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ft,j as e,aa as R,O as se,bt as ge,bu as ze,bp as Y,ad as mt,H as x,a9 as Ge,T as oe,E as Je,bA as ht,bR as Be,bS as We,y as Oe,b4 as qe,ab as xt,a1 as gt,m as Kt,bc as lt,bs as Mt,bo as $t,q as ct,bZ as Ut,I as Ht}from"./vendor-mui-core-D_bnq77o.js";import{J as bt,z as Vt,A as Gt,e as fe,aB as je,C as Jt}from"./vendor-utils-rHXShPKm.js";import{u as le,a6 as jt,_ as M,bQ as Yt,B as me,b2 as Xt,as as vt,j as W,b7 as Zt,r as Ye,A as Qt,bR as es,Z as yt,a7 as St,bn as Ee,am as Ct,X as ts,bu as ss}from"./vendor-ux-did-connect-DHrruicZ.js";import{z as Xe,C as wt,au as Rt,av as Z,t as ne,l as ns,G as dt}from"./index-CIkPfxzG.js";import{a as Ce,u as J,f as ce}from"./vendor-hooks-rDgu5KV9.js";import{a as Ze,b as is}from"./dashboard-BYxl5V9e.js";import{l as as,v as Pe}from"./vendor-arcblock-uz9DVywv.js";import{f as Ke,i as rs,d as os}from"./use-blocklet-logo-Phq7jasP.js";import{A as ls,a as cs,d as ds,b as us}from"./collapse-QV_2gdtM.js";import{S as te}from"./section-Cv4udilp.js";import{S as we}from"./shorten-label-Cng55547.js";import{I as Tt}from"./index-enM9Y412.js";import{R as Nt,A as ps,S as fs,a as ms,b as hs,B as xs}from"./list-BiJWMg_P.js";import{W as gs}from"./did-address-DjwPl1uy.js";import{p as Et}from"./util-CEAObyfj.js";import{D as bs,g as js}from"./traffic-ClE631in.js";import{B as It}from"./bundle-avatar-CDJRatFg.js";import{u as vs}from"./use-mobile-Boa_xu9A.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DVnkpneF.js";import"./confirm-SdqBW-ti.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-BToG9L6q.js";import"./get-safe-url-B5RJTMjC.js";import"./session-CHdTc1We.js";import"./InfoOutlined-DkG0jjos.js";import"./dot-BA3EvSrh.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DyX6Fl8Z.js";import"./index-BYCeMwoO.js";import"./CheckCircle-Ds4QI0ey.js";import"./index-BIPRCLBG.js";import"./Phone-DcHUzCa-.js";import"./Location-DUEOr9J2.js";import"./Email-DWueGk7t.js";import"./Timezone-B-Ho_Uno.js";import"./base32-_zEVBJUg.js";import"./iframe-DW7zzzTG.js";import"./LaunchOutlined-CXNijfqX.js";import"./ChevronLeft-CnQaQ-rc.js";import"./ChevronRight-a_2_x6Ew.js";import"./index-DcUhenm6.js";import"./vendor-mui-x-R-0SFz4c.js";import"./AdapterDayjs-BD9H1lZ-.js";var Me={exports:{}},$e={exports:{}},Ue={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(o){return o==null}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var ys=Ue.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=l(as),o=l(ys);function l(m){return m&&m.__esModule?m:{default:m}}var r=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,S=/^[-+]?[0-9]+$/;function p(m,a){(0,s.default)(m),a=a||{};var E=a.allow_leading_zeroes===!1?r:S,I=!a.hasOwnProperty("min")||(0,o.default)(a.min)||m>=a.min,j=!a.hasOwnProperty("max")||(0,o.default)(a.max)||m<=a.max,C=!a.hasOwnProperty("lt")||(0,o.default)(a.lt)||m<a.lt,O=!a.hasOwnProperty("gt")||(0,o.default)(a.gt)||m>a.gt;return E.test(m)&&I&&j&&C&&O}n.exports=t.default,n.exports.default=t.default})($e,$e.exports);var Ss=$e.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var s=o(Ss);function o(r){return r&&r.__esModule?r:{default:r}}function l(r){return(0,s.default)(r,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Me,Me.exports);var Cs=Me.exports;const ws=qt(Cs),_e={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Rs(){var D,F,_;const{api:n}=Xe(),{blocklet:t}=wt(),{t:s}=le(),{confirmApi:o,confirmHolder:l}=jt(),r=(D=t==null?void 0:t.meta)==null?void 0:D.did,S=Object.assign({..._e},((_=(F=t==null?void 0:t.settings)==null?void 0:F.notification)==null?void 0:_.email)||{}),{handleSubmit:p,control:m,formState:a,watch:E,reset:I}=Rt({defaultValues:bt(S,Object.keys(_e))}),j=Ce({testReceiver:"",testReceiverError:""}),C=E("enabled"),O=J(async(i,h,H=!0)=>{var V,ie;try{const{blocklet:re}=await n.configNotification({input:{did:r,notification:JSON.stringify({email:i})}}),pe=Object.assign({..._e},((ie=(V=re==null?void 0:re.settings)==null?void 0:V.notification)==null?void 0:ie.email)||{});I(pe),H&&M.success(s("oauth.saveSuccess"))}catch(re){if(H)M.error(re.message||s("oauth.saveFailed"));else throw re}}),z=J(async(i,h,H)=>{try{a.isDirty&&await O(i,h,!1),await n.sendEmail({input:{did:r,receiver:H,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),M.success(s("notification.email.testSuccess"))}catch(V){M.error(V.message||s("notification.email.testfailed"))}}),L=J((i,h)=>{j.testReceiver="",j.testReceiverError="",o.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(R,{sx:{width:"300px"},children:e.jsx(se,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:j.testReceiver,onChange:H=>{j.testReceiver=H.target.value},error:!!j.testReceiverError,helperText:j.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(H){var ie;const V=(ie=j.testReceiver)==null?void 0:ie.trim();if(!V){j.testReceiverError=s("notification.email.receiverRequired");return}if(!Pe(V)){j.testReceiverError=s("notification.email.receiverInvalid");return}j.testReceiverError="",await z(i,h,V),H()}})}),U=J(i=>{const h=i==null?void 0:i.trim();return h?Pe(h)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),$=J(i=>{const h=i==null?void 0:i.trim();return h?Ke(h,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),Q=J(i=>i?ws(i)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),B=J(i=>i!=null&&i.trim()?!0:s("notification.email.userRequired")),q=J(i=>i!=null&&i.trim()?!0:s("notification.email.passwordRequired")),d=J(i=>i!=null&&i.trim()&&!Ke(i,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=J(i=>i!=null&&i.trim()&&!Pe(i)?s("notification.email.emailInvalid"):!0),b=J(()=>!0);return e.jsxs(R,{children:[e.jsxs(Ts,{component:"form",onSubmit:p(O),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(te,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Z,{name:"enabled",control:m,render:({field:i})=>e.jsx(ge,{control:e.jsx(ze,{checked:i.value,...i})})})}),e.jsx(te,{title:s("notification.email.from"),children:e.jsx(Z,{name:"from",control:m,rules:{validate:C?U:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,label:s("notification.email.from"),error:!!a.errors[i.name],helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.host"),children:e.jsx(Z,{name:"host",control:m,rules:{validate:C?$:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:s("notification.email.host"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.port"),children:e.jsx(Z,{name:"port",control:m,rules:{validate:C?Q:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,type:"number",error:!!a.errors[i.name],label:s("notification.email.port"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.user"),children:e.jsx(Z,{name:"user",control:m,rules:{validate:C?B:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:s("notification.email.user"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.password"),children:e.jsx(Z,{name:"password",control:m,rules:{validate:C?q:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,type:"password",error:!!a.errors[i.name],label:s("notification.email.password"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.secure"),children:e.jsx(Z,{name:"secure",control:m,rules:{validate:b},render:({field:i})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(ze,{checked:i.value,...i,disabled:!C})})})})}),e.jsxs(ls,{children:[e.jsxs(cs,{expandIcon:e.jsx(ds,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(mt,{title:s("notification.email.signatureTooltip"),children:e.jsx(Yt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(us,{children:[e.jsx(te,{title:s("notification.email.companyName"),children:e.jsx(Z,{name:"companyName",control:m,rules:{validate:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",error:!!a.errors[i.name],label:s("notification.email.companyName"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.companyLink"),children:e.jsx(Z,{name:"companyLink",control:m,rules:{validate:C?d:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",error:!!a.errors[i.name],label:s("notification.email.companyLink"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.companyAddress"),children:e.jsx(Z,{name:"companyAddress",control:m,rules:{validate:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",error:!!a.errors[i.name],label:s("notification.email.companyAddress"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.supportEmail"),children:e.jsx(Z,{name:"supportEmail",control:m,rules:{validate:C?g:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",type:"email",error:!!a.errors[i.name],label:s("notification.email.supportEmail"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})})]})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(L),disabled:!C,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!a.isDirty,children:s("oauth.save")})]})]}),l]})}const Ts=ue(ft)``,ke={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Ns(){var Q,B,q;const{api:n}=Xe(),{blocklet:t}=wt(),{t:s}=le(),{confirmApi:o,confirmHolder:l}=jt(),r=(Q=t==null?void 0:t.meta)==null?void 0:Q.did,S=Object.assign({...ke},((q=(B=t==null?void 0:t.settings)==null?void 0:B.notification)==null?void 0:q.pushKit)||{}),{handleSubmit:p,control:m,formState:a,watch:E,reset:I}=Rt({defaultValues:bt(S,Object.keys(ke))}),j=Ce({testReceiver:"",testReceiverError:""}),C=E("enabled"),O=J(async(d,g,b=!0)=>{var D,F;try{const{blocklet:_}=await n.configNotification({input:{did:r,notification:JSON.stringify({pushKit:d})}}),i=Object.assign({...ke},((F=(D=_==null?void 0:_.settings)==null?void 0:D.notification)==null?void 0:F.pushKit)||{});I(i),b&&M.success(s("oauth.saveSuccess"))}catch(_){if(b)M.error(_.message||s("oauth.saveFailed"));else throw _}}),z=J(async(d,g)=>{var b,D,F;try{a.isDirty&&await O(d,g,!1);const _=(b=((t==null?void 0:t.configs)||[]).find(H=>H.key==="BLOCKLET_APP_URL"))==null?void 0:b.value,i=Vt(Gt(_,"/.well-known/service/blocklet/logo"),{v:(D=t==null?void 0:t.meta)==null?void 0:D.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),h={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:(F=t==null?void 0:t.meta)==null?void 0:F.title,avatar:i}}}};await n.sendPush({input:{did:r,receiver:j.testReceiver,notification:JSON.stringify(h)}}),M.success(s("notification.pushKit.testSuccess"))}catch(_){M.error(_.message||s("notification.pushKit.testfailed"))}}),L=J((d,g)=>{j.testReceiverError="",o.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(R,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(se,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:j.testReceiver,onChange:b=>{j.testReceiver=b.target.value},error:!!j.testReceiverError,helperText:j.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(b){var F;if(!((F=j.testReceiver)==null?void 0:F.trim())){j.testReceiverError=s("notification.pushKit.receiverRequired");return}j.testReceiverError="",await z(d,g),b()}})}),U=J(d=>{const g=d==null?void 0:d.trim();return g?Ke(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),$=J(()=>!0);return e.jsxs(R,{children:[e.jsxs(Es,{component:"form",onSubmit:p(O),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(te,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Z,{name:"enabled",control:m,render:({field:d})=>e.jsx(ge,{control:e.jsx(ze,{checked:d.value,...d})})})}),e.jsx(te,{title:s("notification.pushKit.endpoint"),children:e.jsx(Z,{name:"endpoint",control:m,rules:{validate:C?U:$},render:({field:d})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...d,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!a.errors[d.name],helperText:((g=a.errors[d.name])==null?void 0:g.message)||" ",disabled:!C})})}})}),e.jsxs(te,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Z,{name:"did",control:m,render:({field:d})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...d,size:"small",label:s("notification.pushKit.did"),error:!!a.errors[d.name],helperText:((g=a.errors[d.name])==null?void 0:g.message)||" ",disabled:!C})})}}),e.jsx(Z,{name:"pushPath",control:m,render:({field:d})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...d,size:"small",label:s("notification.pushKit.pushPath"),error:!!a.errors[d.name],helperText:((g=a.errors[d.name])==null?void 0:g.message)||" ",disabled:!C})})}})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(L),disabled:!C,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!a.isDirty,children:s("oauth.save")})]})]}),l]})}const Es=ue(ft)``,ut=[{label:e.jsx(R,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(R,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Is(){const[n,t]=T.useState(ut[0].value),{locale:s}=T.useContext(Xt),o=ce(()=>({email:e.jsx(Rs,{}),pushKit:e.jsx(Ns,{})}),[s]),l=T.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(R,{children:[e.jsx(vt,{tabs:ut,current:n,onChange:t}),e.jsx(R,{style:l,children:o[n]})]})}const At=T.createContext({}),{Provider:As,Consumer:si}=At;function Os({children:n,blocklet:t=""}){const{api:s,inService:o,ws:{useSubscription:l}}=Xe(),[r,S]=T.useState([]),[p,m]=T.useState({total:0,pageSize:20,pageCount:0,page:1}),a=ce(()=>{var d;return(d=t.meta)==null?void 0:d.did},[t]),[E,I]=T.useState([]),[j,C]=T.useState({}),O=ce(()=>r.length?new Set(r.map(d=>d.id)):new Set,[r]),z=async({page:d=1,pageSize:g=20,...b}={})=>{if(!a)return[];try{const D={paging:{page:d,pageSize:g},...b,teamDid:a,dateRange:b.dateRange?[ne(b.dateRange[0]).toISOString(),ne(b.dateRange[1]).toISOString()]:void 0},{dids:F,..._}=D;let i="";F&&F.includes("system")&&(i="system");const h=F?F.filter(ie=>ie!=="system"):[],H={..._,source:i,componentDids:h},V=await s.getNotificationSendLog({input:H});return C(H),S(V.list),m(V.paging),V.list}catch(D){return M.error(D.message),[]}},L=async()=>{const d=await s.getNotificationComponents({input:{teamDid:a}});I(d.componentDids)},U=T.useCallback(d=>{const g=t.children.find(b=>{var D;return((D=b.meta)==null?void 0:D.did)===d});if(g)return g.ancestors=[t],g},[t]),$=async({notificationId:d,receivers:g,channels:b,...D})=>{await s.resendNotification({input:{teamDid:a,notificationId:d,receivers:g,channels:b.map(F=>F==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:F==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:F),...D}})},Q=T.useCallback(async d=>(await s.getUser({input:{teamDid:a,user:{did:d}}})).user,[s,a]),B=T.useCallback(async({page:d=1,pageSize:g=20,...b}={})=>{try{const D={paging:{page:d,pageSize:g},...b,userName:b.searchText||"",teamDid:a,dateRange:b.dateRange?[ne(b.dateRange[0]).toISOString(),ne(b.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:D})}catch(D){throw M.error(D.message),D}},[s,a]);T.useEffect(()=>{a&&L()},[a]),l(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,d=>{O.has(d.notificationId)&&z(j)},[O,j]),l(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,d=>{O.has(d.id)||z(j)},[O,j]);const q={fetch:z,data:r,paging:p,blocklet:t,getComponent:U,resendNotification:$,getUser:Q,componentDids:E,getReceivers:B,inService:o,teamDid:a};return e.jsx(As,{value:{notificationRecords:q},children:n})}function Qe(){const{notificationRecords:n}=T.useContext(At);return n}Re.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ds={info:"primary",success:"success",error:"error",warning:"warning"};function Re({severity:n="info"}){return e.jsx(Zt,{type:Ds[n],children:n})}var et={},Ls=Ge;Object.defineProperty(et,"__esModule",{value:!0});var Ot=et.default=void 0,Ps=Ls(Ye()),_s=e;Ot=et.default=(0,Ps.default)((0,_s.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 tt={},ks=Ge;Object.defineProperty(tt,"__esModule",{value:!0});var Dt=tt.default=void 0,Fs=ks(Ye()),zs=e;Dt=tt.default=(0,Fs.default)((0,zs.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 st={},Bs=Ge;Object.defineProperty(st,"__esModule",{value:!0});var Lt=st.default=void 0,Ws=Bs(Ye()),qs=e;Lt=st.default=(0,Ws.default)((0,qs.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 Ks=(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 Pt(n,t,s={}){const{status:o,updatedAt:l,reason:r="",channel:S="wallet"}=s,p=l?n("notification.sendStatus.sentTime",{date:ns(l,t)}):"",m=Ks(n,S,r);return o===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:m}:o===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:m,sentTime:p}}const He={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],pt=["info","success","error","warning"],_t=n=>{var s,o;const{settings:t}=n;return(o=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:o.enabled},kt=n=>{var s,o;const{settings:t}=n;return(o=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:o.enabled},Ms=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:_t(n),enabled:s}},$s=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:kt(n),enabled:s}},Us=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Hs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Te=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Vs=(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})}]:[],Ne=(n=[])=>{const t=ne().startOf("day");return n.filter(s=>ne(s.sendAt).isSame(t,"day")).length},Gs=(n,t="")=>{if(t&&Ve.includes(t)){const r=`${t}SendRecord`,S=fe(n,r,[]);return Ne(S)}const s=fe(n,"webhook",{}),o=Object.keys(s??{})??[];if(t&&o.includes(t)){const r=s[t]??[];return Ne(r)}const l={};return Ve.forEach(r=>{const S=`${r}SendRecord`,p=fe(n,S,[]),m=Ne(p);l[r]=m}),o.length>0&&o.forEach(r=>{const S=s[r]??[],p=Ne(S);l[r]=p}),l},Ie=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},Ae=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Js=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""}},Ft=()=>Qt({typography:{fontSize:14,button:{textTransform:"none"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:o}){const{status:l,title:r="",sentTime:S="",reason:p=""}=n,m=[r,p].filter(Boolean).join(", ");return e.jsx(mt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(oe,{color:"inherit",sx:{fontSize:12},children:m}),e.jsx("span",{children:S})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:He[l],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:He[l]})]}),e.jsx(oe,{color:"inherit",sx:{fontSize:12},children:s?r:o})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};ve.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ve.defaultProps={onDelete:()=>{}};function ve({list:n,label:t,onDelete:s}){const{t:o,locale:l}=le();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(oe,{children:[t,": "]}),n.map(r=>{const S=Pt(o,l,{status:r});return e.jsx(Je,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:S,enableTooltip:!1,children:S.title})}),onDelete:p=>s(p,r)},r)})]})}nt.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 nt({filterList:n,onChange:t,index:s,column:o,filterValues:l,label:r,renderLabel:S}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(ht,{component:"legend",children:r}),e.jsx(Be,{row:!0,children:l.map(p=>e.jsx(ge,{control:e.jsx(We,{checked:n[s].indexOf(p.value??p)>-1,onChange:m=>{const a=[...n];m.target.checked?a[s]=[...a[s],p.value??p]:a[s]=a[s].filter(E=>E!==(p.value??p)),t(a[s],s,o)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:S(p)})},p.value??p))})]})}function Fe(n){return e.jsx(nt,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}be.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function be({status:n,updatedAt:t,reason:s="",channel:o="wallet",onResend:l}){const{t:r,locale:S}=le(),p=Pt(r,S,{status:n,updatedAt:t,reason:s,channel:o});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Oe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:l,children:r("notification.resend")})]})}it.propTypes={value:x.array.isRequired,onChange:x.func};function it({value:n,onChange:t}){const{locale:s}=le(),o=ne().toDate(),[l,r]=T.useState(null),S=T.useCallback(a=>{r(l?null:a.currentTarget)},[l]),p=!!l,m=T.useCallback(a=>{if(!a.startDate||!a.endDate){M.error("Please select a date range");return}if(ne(a.startDate).isAfter(a.endDate)||!ne(a.startDate).isValid()||!ne(a.endDate).isValid()){M.error("Invalid date range");return}t([a.startDate,a.endDate]),r(null)},[t]);return e.jsxs("div",{children:[e.jsx(oe,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Oe,{onClick:S,variant:"outlined",size:"small",color:"inherit",children:[dt(n[0],s)," - ",dt(n[1],s)]})}),e.jsx(qe,{open:p,anchorEl:l,onClose:()=>{r(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(bs,{open:!0,maxDate:o,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:S,definedRanges:js(o),onChange:m})})]})}at.propTypes={itemComponent:x.elementType.isRequired};function at({itemComponent:n,...t}){var l;const{t:s}=le();return!((l=t==null?void 0:t.filterList)!=null&&l.filter(r=>r.length).length)?null:e.jsxs(R,{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(es.TableFilterList,{...t,ItemComponent:n})})]})}function De({label:n,onDelete:t,canDelete:s=()=>!0,...o}){const l=t&&typeof t=="function"?t:void 0;let r=!0;return s&&typeof s=="function"&&(r=s({label:n,...o})),e.jsx(Je,{label:n,variant:"outlined",...l&&r?{onDelete:l}:{}})}De.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};De.defaultProps={canDelete:()=>!0};const Ys=[{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}];rt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};rt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function rt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:o}=le(),[l,r]=T.useState(Ys),[S,p]=T.useState(!0),m=(E,I)=>{I.checked=E.target.checked;const j=l.map(C=>({...C,checked:C.value===I.value?I.checked:C.checked}));r(j)},a=E=>{E.stopPropagation(),s({channels:l.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:S})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(oe,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:o("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(ht,{component:"legend",children:o("notification.selectChannels")}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:l.map(E=>e.jsx(ge,{control:e.jsx(We,{checked:E.checked,onChange:I=>m(I,E),name:E.value}),label:E.label},E.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Be,{children:e.jsx(ge,{control:e.jsx(We,{checked:S,onChange:E=>p(E.target.checked)}),label:o("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Oe,{onClick:E=>{E.stopPropagation(),t()},color:"inherit",children:o("common.cancel")}),e.jsxs(Oe,{onClick:a,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(xt,{size:16}),o("common.confirm")]})]})]})}zt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function zt({notificationId:n,handleResend:t,resending:s=!1}){const{t:o,locale:l}=le(),{getReceivers:r,inService:S,teamDid:p,getUser:m,blocklet:a}=Qe(),[E,I]=T.useState(!1),[j,C]=T.useState([]),O=Ce({anchorEl:null,position:null}),z=Ce({anchorEl:null,position:null}),[L,U]=T.useState(null),[$,Q]=T.useState({total:0,pageSize:10,pageCount:0,page:1}),[B,q]=T.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[ne().subtract(1,"month").startOf("day").toDate(),ne().endOf("day").toDate()]}),[d,g]=T.useState([]),b=[{label:o("notification.sendStatus.pending"),value:0,status:"pending"},{label:o("notification.sendStatus.success"),value:1,status:"success"},{label:o("notification.sendStatus.failed"),value:2,status:"failed"}],D=async()=>{if(!E&&n)try{I(!0);const c=await r({notificationId:n,...B}),u=c.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Et(f.receiverUser.avatar,p,S)}}));C(u),Q(c.paging),I(!1)}catch(c){M.error(c.message),I(!1)}};T.useEffect(()=>{D()},[B]);const F=c=>{c.stopPropagation();const u=c.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},_=c=>c.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(Ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:F,children:o("notification.resend")})}):null,i={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:o("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:B.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:d,onRowSelectionChange:(c,u)=>{g(u.map(f=>f.dataIndex))},customToolbarSelect:_},h=({page:c,rowsPerPage:u,searchText:f,filterList:A})=>{const[,K=[],ee=[],X=[]]=A;B.pageSize!==u?q(G=>({...G,pageSize:u,page:1})):B.page!==c+1?q(G=>({...G,page:c+1})):B.searchText!==f?q(G=>({...G,searchText:f,page:1})):je(K,B.walletSendStatus)?je(ee,B.pushKitSendStatus)?je(X,B.emailSendStatus)||q(G=>({...G,emailSendStatus:X,page:1})):q(G=>({...G,pushKitSendStatus:ee,page:1})):q(G=>({...G,walletSendStatus:K,page:1}))},H=T.useCallback(async(c,u)=>{if(!u)return!1;const f=await m(u);return f?c==="wallet"?Us(f):c==="email"?Ms(a,f):c==="pushKit"?$s(a,f):c==="webhook"?Hs(f):!0:!1},[m,a]),V=T.useCallback(c=>Vs(o,c),[o]),ie=()=>{O.anchorEl=null,O.position=null,U(null)},re=()=>{z.anchorEl=null,z.position=null},pe=async(c,u,f=!0,A="")=>{if(!(!u.length||!c.length))try{t(c,u,f,A),z.anchorEl||(await Te(.5),ie())}catch(K){console.error("handleResend error",{error:K})}},y=async({channels:c,isResendFailedOnly:u})=>{const f=d.map(A=>j[A].receiver);await pe(c,f,u),await Te(.5),re(),g([])},v=async(c,u=[],f=!0)=>{try{await pe(["webhook"],[c.receiver],f,u)}catch(A){M.error(A.response?A.response.statusText:A.message)}},w=async(c,u,f,A=[],K=!0)=>{if(c.stopPropagation(),Gs(u,f)>=4){M.warning(o("notification.resendLimit"));return}if(!Ve.includes(f)){await v(u,A,K);return}if(c){const X=c.currentTarget,G=X.getBoundingClientRect();O.anchorEl=X,O.position={top:G.top+window.scrollY,left:G.left+window.scrollX}}U({channel:f});try{const X=await H(f,u.receiver);await Te(1),U({channel:f,result:X}),(typeof X=="boolean"&&X||Jt(X)&&Object.values(X).every(G=>!!G))&&(await t([f],[u.receiver],K),z.anchorEl||(await Te(.5),ie()))}catch(X){M.error(X.message)}},N=c=>{q(u=>({...u,dateRange:c,page:1}))},P=(c,u,f,A)=>{c.stopPropagation();const K=f.filter(ee=>ee!==u);q(ee=>({...ee,[A]:K,page:1}))},k=ce(()=>[{label:o("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:u,receiver:f}=j[c];return u?e.jsxs(R,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(yt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(we,{children:u.fullName})]},f):e.jsx(gs,{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:B.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(ve,{list:c,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),P(u,f,k[1].options.filterList,"walletSendStatus")}}),update:Ie},filterOptions:{names:b,fullWidth:!0,logic:Ae,display:(c,u,f,A)=>e.jsx(Fe,{label:"Wallet",filterList:c,onChange:u,index:f,column:A,filterValues:b})},customBodyRenderLite:c=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:A}=j[c];return e.jsx(be,{status:u,updatedAt:f,reason:A,channel:"wallet",onResend:K=>w(K,j[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:A}=j[c];return e.jsx(be,{status:u,updatedAt:f,reason:A,channel:"pushkit",onResend:K=>w(K,j[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:B.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(ve,{list:c,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),P(u,f,k[2].options.filterList,"pushKitSendStatus")}}),update:Ie},filterOptions:{names:b,fullWidth:!0,logic:Ae,display:(c,u,f,A)=>e.jsx(Fe,{label:"Push Kit",filterList:c,onChange:u,index:f,column:A,filterValues:b})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:A}=j[c];return e.jsx(be,{status:u,updatedAt:f,reason:A,channel:"email",onResend:K=>w(K,j[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:B.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(ve,{list:c,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),P(u,f,k[3].options.filterList,"emailSendStatus")}}),update:Ie},filterOptions:{names:b,fullWidth:!0,logic:Ae,display:(c,u,f,A)=>e.jsx(Fe,{label:"Email",filterList:c,onChange:u,index:f,column:A,filterValues:b})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:u}=j[c];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[A,K]=f,ee=K[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(we,{maxLength:30,children:A},A),e.jsx(be,{status:ee.status,updatedAt:ee.sendAt,reason:ee.failedReason,channel:"webhook",onResend:X=>w(X,j[c],"webhook",[A],!1)})]},A)})}}},{label:o("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:u}=j[c];return e.jsx(Nt,{value:u,locale:l,shouldUpdate:!0})}}}],[j,l,B,o]),ae=[e.jsx(it,{value:B.dateRange,onChange:N},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:E,startIcon:e.jsx(Lt,{}),onClick:()=>D(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:o("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Zs,{children:e.jsxs(gt,{theme:Ft(),children:[e.jsx(St,{className:"receivers-table",locale:l,loading:E,columns:k,data:j,onChange:h,options:i,customButtons:ae,components:{TableFilterList:c=>e.jsx(at,{...c,itemComponent:u=>e.jsx(De,{...u,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(qe,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:ie,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(Qs,{children:[e.jsxs(oe,{variant:"body1",component:"div",className:"check-title",children:[L==null?void 0:L.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:V(L==null?void 0:L.channel).map(c=>{var K,ee;const{type:u,pass:f,fail:A}=c;return!(L!=null&&L.result)||(K=L==null?void 0:L.result)!=null&&K[u]?e.jsxs(oe,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(ee=L==null?void 0:L.result)!=null&&ee[u]?Ee.success.main:"inherit"},children:[L!=null&&L.result?e.jsx(Ot,{}):e.jsx(xt,{size:12,sx:{color:Ee.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(oe,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ee.error.main},children:[e.jsx(Dt,{}),e.jsx("span",{children:A})]},u)})})]})}),z.anchorEl&&e.jsx(qe,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:re,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(rt,{loading:s,onCancel:re,onConfirm:y})})]})})})}const Xs=T.memo(zt),Zs=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
|
-
`,Qs=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
|
-
`,ye=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function en(n){const{wallet:t,push:s,email:o,webhook:l}=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:o})},...l.total>0?[{name:"Webhook",value:e.jsx(he,{item:l,isWebhook:!0})}]:[]]}function tn(n,t,s){const{wallet:o,push:l,email:r,webhook:S}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:o,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:l,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:r,onResend:t})},...S.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:S,isWebhook:!0,onResend:t})}]:[]]}Le.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};Le.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}=le(),o=t?n.success.length:n.success,l=n.total,r=o===l?"success":"failed";return e.jsx(R,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(R,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:r},enableTooltip:!1,children:[ye(o)," / ",ye(l)," ",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:o,loading:l}){const{t:r}=le(),{success:S,failed:p,pending:m}=t,a=Js(n),E=s?S.length:S,I=s?p.length:p,j=s?m.length:m,C=async U=>{U.stopPropagation();const $=s?[...new Set([...S,...p].map(Q=>Q))]:[];await o([n],[],!0,$)},O=E+I,z=O>0?E/O*100:0,L=O>0?I/O*100:0;return e.jsxs(sn,{successRatio:z,failedRatio:L,children:[e.jsxs(oe,{variant:"h6",children:[a," (",t.total,")"]}),e.jsxs(oe,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:He.success,fontWeight:600,fontSize:24},children:ye(E)}),e.jsx("small",{style:{paddingLeft:4},children:r("notification.sendStatus.success")})]}),e.jsxs(R,{className:"unsent-area",children:[e.jsxs(R,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[ye(I)," ",r("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[ye(j)," ",r("notification.sendStatus.pending")]})]}),I>0&&e.jsx(R,{className:"resend-btn",children:e.jsx(me,{size:"small",color:"primary",loading:l,variant:"contained",startIcon:e.jsx(Ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:C,children:r("notification.resend")})})]})]})}function Le({statistics:n,mode:t="simple",onResend:s,resending:o}){const l=ce(()=>t==="simple"?en(n):tn(n,s,o),[n,t]);return t==="simple"?e.jsx("div",{children:l.map(r=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:t==="simple"?0:16},valueComponent:"div",nameWidth:100,name:r.name,children:r.value},r.name))}):e.jsx(lt,{container:!0,spacing:2,children:l.map(r=>e.jsx(lt,{item:!0,md:4,sm:6,xs:12,children:r.value},r.name))})}const sn=ue(R)`
|
|
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, ${Kt(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
|
-
`;Bt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Bt({notification:n,onCancel:t=()=>{},blocklet:s,tab:o="info"}){const{t:l,locale:r}=le(),{getComponent:S,resendNotification:p}=Qe(),[m,a]=T.useState(!1),E=ce(()=>S(n.componentDid)||s,[s,n.componentDid]),I=Ce({tab:o||"info"}),j=T.useCallback(async(d,g,b=!0,D=[])=>{var i;if(!d.length||!n.id)return;const F=g.length>0?g:(i=n==null?void 0:n.receivers)==null?void 0:i.map(h=>h.receiver);if(!F.length)return;let _=[...d];if(_.includes(W.NOTIFICATION_SEND_CHANNEL.PUSH)&&!kt(s)&&(M.warning(l("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),_=_.filter(h=>h!==W.NOTIFICATION_SEND_CHANNEL.PUSH)),_.includes(W.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!_t(s)&&(M.warning(l("notification.sendStatus.reason.unavailable",{channel:"Email"})),_=_.filter(h=>h!==W.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!_.length)try{a(!0),await p({notificationId:n.id,receivers:F,channels:_,resendFailedOnly:b,..._.includes("webhook")&&D.length?{webhookUrls:D}:{}}),M.success("Message has been sent!")}catch(h){console.error("handleResend error",{error:h}),M.error(h.response?h.response.statusText:h.message)}finally{a(!1)}},[s,n.id,n==null?void 0:n.receivers,p,l]),C=ce(()=>rs(n),[n]),O=ce(()=>os(n),[n]),z=ce(()=>C?n==null?void 0:n.actorInfo:[],[n]),L=ce(()=>{var d;return(s==null?void 0:s.did)||((d=s==null?void 0:s.meta)==null?void 0:d.did)||""},[s]);function U(){return[{name:l("notification.from"),value:C&&O?e.jsx(ps,{actors:z,teamDid:L,size:32,showName:!0}):e.jsx(fs,{size:32,blocklet:E,showName:!0,hideDot:!0})},{name:l("notification.notificationTitle"),value:e.jsx(we,{maxLength:50,children:n.title})},{name:l("notification.body"),value:C?e.jsx(ms,{notification:n,blocklet:s}):e.jsx(hs,{notification:n,rows:0})},{name:l("notification.severity"),value:e.jsx(Re,{severity:n.severity})},{name:l("notification.createdAt"),value:e.jsx(ts,{value:n.createdAt,locale:r,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const $={info:{label:l("common.basicInfo"),value:"info",component:U},receivers:{label:l("notification.receiver"),value:"receivers"},statistics:{label:l("notification.statistics"),value:"statistics"}},Q=Object.values($).map(({label:d,value:g})=>({label:d,value:g})),B=$[I.tab]||$.info,q=d=>{I.tab=d};return e.jsx(Ct,{title:l("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{I.tab="info",t()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(an,{children:[e.jsx(R,{mx:3,className:"tabs",children:e.jsx(vt,{tabs:Q,current:I.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[I.tab==="receivers"&&e.jsx(Xs,{notificationId:n.id,resending:m,handleResend:j}),I.tab==="statistics"&&e.jsx(Le,{statistics:n.statistics,mode:"detail",resending:m,onResend:j}),I.tab==="info"&&e.jsx(B.component,{})]})]})})}const nn=T.memo(Bt),an=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: ${Ee.text.disabled};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;Se.propTypes={blocklet:x.object,label:x.string};Se.defaultProps={blocklet:null,label:""};const rn=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 Se({blocklet:n,label:t}){var s;return e.jsx(rn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(It,{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})})}ot.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ot.defaultProps={onDelete:()=>{}};function ot({list:n,label:t,onDelete:s}){return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(oe,{children:[t,": "]}),n.map(o=>e.jsx(Je,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Re,{severity:o})}),onDelete:l=>s(l,o)},o))]})}function on(n){return e.jsx(nt,{...n,renderLabel:t=>e.jsx(Re,{severity:t})})}function ln({customTableButtons:n}){var pe;const{t,locale:s}=le(),[o,l]=T.useState(!1),{data:r,paging:S,blocklet:p,fetch:m,getComponent:a,componentDids:E,inService:I,teamDid:j}=Qe(),C=T.useRef(null),[O,z]=T.useState(null),[L,U]=T.useState("info"),$=vs(),[Q,B]=T.useState(!1),q=`notification-records-${(pe=p.meta)==null?void 0:pe.did}`,d=ss(q),[g,b]=T.useState({pageSize:d.rowsPerPage||10,page:d.page?d.page+1:1,dids:d.dids||[],dateRange:d.dateRange||[ne().subtract(1,"month").startOf("day").toDate(),ne().endOf("day").toDate()]}),D=ce(()=>{if(!p.children||!p.children.length)return[];const y=[];return p.children.forEach(v=>{var N;const w=v.did||((N=v.meta)==null?void 0:N.did);E.includes(w)&&(v.ancestors=[p],y.push(v))}),y},[E,p]),F=async y=>{try{l(!0),await m(y),l(!1)}finally{l(!1)}};T.useEffect(()=>{F(g)},[g]),T.useEffect(()=>{const y=r.find(v=>v.id===(O==null?void 0:O.id));O&&y&&z({...y})},[r]);const _=(y,v,w,N)=>{y.stopPropagation();const P=w.filter(k=>k!==v);b(k=>({...k,[N]:P,page:1}))},i=({page:y,rowsPerPage:v,filterList:w})=>{const[N=[],,,,P=[]]=w;g.pageSize!==v?b(k=>({...k,pageSize:v,page:1})):g.page!==y+1?b(k=>({...k,page:y+1})):je(g.dids,N)?je(g.severities,P)||b(k=>({...k,severities:P,page:1})):b(k=>({...k,dids:N,page:1}))},h=T.useCallback(()=>{z(null),U("info")},[]),H=T.useCallback(()=>{m(g)},[m,g]),V=[{label:t("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:y=>y.map((v,w)=>{var P;if(v==="system")return e.jsx("span",{children:t("notification.system")},`system-${w}`);const N=D.find(k=>{var c;return(k.did||((c=k.meta)==null?void 0:c.did))===v});return e.jsx(Se,{blocklet:N,label:(N==null?void 0:N.title)||((P=N==null?void 0:N.meta)==null?void 0:P.title)},v)}),update:(y,v,w)=>(y[w].splice(v,1),y)},filterOptions:{names:D,logic:(y,v)=>v.length?!v.includes(y):!1,display:(y,v,w,N)=>e.jsxs(Y,{style:{width:"380px"},children:[e.jsx(Mt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs($t,{multiple:!0,value:y[w],renderValue:P=>e.jsx(R,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:P.map(k=>{var c;if(k==="system")return e.jsx("span",{children:t("notification.system")},k);const ae=D.find(u=>{var A;return(u.did||((A=u.meta)==null?void 0:A.did))===k});return e.jsx(Se,{blocklet:ae,label:(ae==null?void 0:ae.title)||((c=ae==null?void 0:ae.meta)==null?void 0:c.title)},k)})}),onChange:P=>{y[w]=P.target.value,v(y[w],w,N)},children:[e.jsx(ct,{value:"system",children:t("notification.system")}),D.map(P=>{var ae,c;const k=P.did||((ae=P.meta)==null?void 0:ae.did);return e.jsx(ct,{value:k,children:e.jsx(Se,{blocklet:P,label:P.title||((c=P.meta)==null?void 0:c.title)})},k)})]})]})},customBodyRenderLite:y=>{var N,P;const v=r[y],w=a(v.componentDid);return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[w?e.jsx(It,{size:32,blocklet:w,ancestors:w.ancestors??[]}):e.jsx(xs,{blocklet:p,size:32}),e.jsx(we,{maxLength:50,children:((N=w==null?void 0:w.meta)==null?void 0:N.title)||((P=p==null?void 0:p.meta)==null?void 0:P.title)})]})}}},{label:t("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:y=>{const v=r[y],{receivers:w}=v;return e.jsx(Ut,{total:w.length,renderSurplus:N=>N<100?e.jsxs("span",{children:["+",N]}):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:N=>{N.stopPropagation(),z(v),U("receivers")},children:w.map(N=>{const{receiverUser:P}=N,k=Et(P.avatar,j,I);return e.jsx(yt,{alt:P.fullName,src:`${k}?imageFilter=resize&w=48&h=48`,size:32,did:N.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},N.receiver)})})}}},{label:t("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:y=>{const v=r[y];return e.jsx(R,{onClick:w=>{w.stopPropagation(),z(v),U("statistics")},children:e.jsx(Le,{statistics:v.statistics})})}}},{label:t("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:y=>{const v=r[y];return e.jsx(we,{maxLength:50,children:v.title})}}},{label:t("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:y=>{const v=r[y];return e.jsx(Re,{severity:v.severity})},filter:!0,filterType:"custom",filterList:g.severities??[],customFilterListOptions:{render:y=>e.jsx(ot,{list:y,label:t("notification.severity"),onDelete:(v,w)=>{v.stopPropagation(),_(v,w,V[4].options.filterList,"severities")}}),update:Ie},filterOptions:{names:pt,fullWidth:!0,logic:Ae,display:(y,v,w,N)=>e.jsx(on,{label:t("notification.severity"),filterList:y,onChange:v,index:w,column:N,filterValues:pt})}}},{label:t("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:y=>{const{createdAt:v}=r[y];return e.jsx(Nt,{value:v,locale:s,shouldUpdate:!0})}}}],ie=y=>{b(v=>({...v,dateRange:y,page:1}))},re=[e.jsxs(R,{display:"flex",alignItems:"center",gap:1.5,children:[e.jsx(Ht,{onClick:()=>B(!0),sx:{p:$?0:void 0},children:e.jsx(is,{})},"settings"),$?e.jsx(oe,{children:t("common.setting")}):null]}),...n||[]];return e.jsxs(R,{ref:C,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(cn,{children:e.jsx(gt,{theme:Ft(),children:e.jsx(St,{className:"main-table",verticalKeyWidth:100,loading:o,locale:s,columns:V,data:r,durable:q,onChange:i,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:S.page-1,rowsPerPage:S.pageSize,count:S.total,...d,onRowClick:(y,{dataIndex:v})=>{z(r[v])}},customPreButtons:[e.jsx(it,{value:g.dateRange,onChange:ie})],customButtons:re,components:{TableFilterList:y=>e.jsx(at,{...y,itemComponent:v=>e.jsx(De,{...v,canDelete:w=>{var P;const N=(P=w==null?void 0:w.columnNames)==null?void 0:P[(w==null?void 0:w.index)||0];return(N==null?void 0:N.name)==="sender"}})})}})})}),O&&e.jsx(nn,{refresh:H,onCancel:h,notification:O,blocklet:p,tab:L}),e.jsx(Ct,{title:`${t("common.notification")} ${t("common.setting")}`,fullWidth:!0,maxWidth:"md",open:Q,onClose:()=>B(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(R,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(Is,{})})})]})}const cn=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
|
-
`;Wt.propTypes={blocklet:x.object.isRequired,customTableButtons:x.array};Wt.defaultProps={customTableButtons:[]};function Wt({blocklet:n={},customTableButtons:t}){return e.jsx(Os,{blocklet:n,children:e.jsx(ln,{customTableButtons:t})})}export{Wt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o,aa as r,H as i,T as a}from"./vendor-mui-core-D_bnq77o.js";import{L as f,r as g}from"./vendor-react-DEoibe3W.js";import"./index-CIkPfxzG.js";import"./vendor-arcblock-uz9DVywv.js";import"./vendor-ux-did-connect-DHrruicZ.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";const p=(e,t)=>[e,...Array.isArray(t)?t:[t]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function n({sx:e,...t}){const s=p({display:"flex",flexWrap:"wrap",mx:-1},e);return o.jsx(r,{sx:s,...t})}n.propTypes={sx:i.object};n.defaultProps={sx:{}};function w({icon:e}){const[t,s]=g.useState(!1);return!e||t?null:typeof e=="string"?o.jsx(r,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>s(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:t,extra:s,cover:c,icon:d,to:x,sx:h}){const m=p({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return o.jsx(r,{sx:m,children:o.jsx(r,{component:f,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:o.jsxs(r,{children:[o.jsxs(r,{sx:{position:"relative"},children:[c,d&&o.jsx(r,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:o.jsx(w,{icon:d})})]}),o.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),t&&o.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:t}),s]})})})}u.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const k="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:t,...s}){return o.jsx(u,{date:e.createdAt,sx:t,to:e.link,title:e.title,desc:e.desc,cover:o.jsx(r,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:o.jsx(r,{component:"img",src:k,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...s})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function C(){const e=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:"https://www.arcblock.io/docs/blocklet-developer/en/getting-started"},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:"https://www.arcblock.io/docs/createblocklet/en/quick-start"},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:"https://www.arcblock.io/docs/launcher/en/launcher-welcome"},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:"https://www.arcblock.io/docs/did-spaces/en/did-spaces-getting-started"},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:"https://www.arcblock.io/docs/did-wallet/en/get-started"},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:"https://www.arcblock.io/docs/did-domain/en/did-domain-faq"},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:"https://www.arcblock.io/docs/blockchain/en/blockchain-how-to-guides"},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:"https://www.arcblock.io/docs/did-connect/en/developer-guides"}];return o.jsx(n,{children:e.map(t=>o.jsx(b,{board:t},t.id))})}export{C as default};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import{u as ne,_ as U,c0 as ze,c1 as Ee,I as K,b_ as Ue,b$ as We,ad as Me,ac as _e,c2 as Ve,b4 as Ie,j as pe,r as $e,b2 as X,c3 as he,am as ge,B as z,bN as Ne,a6 as Je,c4 as He,a7 as Ke,a3 as Ge,a0 as Ze,as as De}from"./vendor-ux-did-connect-DHrruicZ.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-rDgu5KV9.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,aa as m,bt as W,bp as E,O,y as V,H as N,T as xe,I as oe,X as re,ah as Pe,al as H,cI as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-D_bnq77o.js";import{a7 as tt,M as Ce,T as nt,c as st}from"./vendor-arcblock-uz9DVywv.js";import{J as Y,a8 as at,c as qe,D as ot,n as Z,aJ as rt,A as it,b as lt}from"./vendor-utils-rHXShPKm.js";import{z as J,C as $,au as ae,av as I,aD as Fe}from"./index-CIkPfxzG.js";import{S as ie}from"./switch-control-C5i52ixk.js";import{S as D}from"./section-Cv4udilp.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-enM9Y412.js";import{b as ut}from"./base32-_zEVBJUg.js";import{u as mt}from"./use-mobile-Boa_xu9A.js";import"./lottie-web-jYmAQWuC.js";const le={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...le},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async o=>{var T,a;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:o})}}),u=Object.assign({...le},((a=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.domainDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:o})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[o.name],helperText:((T=c.errors[o.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:o})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[o.name],helperText:((T=c.errors[o.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:o})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[o.name],helperText:((T=c.errors[o.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ht(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ce},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ft(){var i,o,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...ue},((T=(o=r==null?void 0:r.settings)==null?void 0:o.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async a=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...ue},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const gt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=ze({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const o=y.index,T=s;if(o===T)return;const a=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-a.top;o<T&&A<u||o>T&&A>u||(w(o,T),y.index=T)}}),[{isDragging:x},g]=Ee({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:gt})}),e.jsx(xe,{sx:{flex:1},children:S}),e.jsx(oe,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:ct,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!1};const jt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:tt}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Me}),component:e.jsx(xt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:_e}),component:e.jsx(ft,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ve}),component:e.jsx(pt,{})}],bt=["github","google","apple","auth0"];function vt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of bt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...jt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ue,{backend:We,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const G={ttl:pe.SESSION_TTL,cacheTtl:pe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(nt,{...S,sx:{transform:"scale(0.75)"}})}function me(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function yt(){var a,j;const{api:S}=J(),{blocklet:r}=$(),n=(a=r==null?void 0:r.meta)==null?void 0:a.did,s=at({},G,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=G.ttl),qe(s.cacheTtl)&&(s.cacheTtl=G.cacheTtl),s.phone||(s.phone=G.phone),s.email||(s.email=G.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=ae({defaultValues:Y(me(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:o}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:ot(me(u,!0),["phone"])}}),_=Object.assign({},G,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(me(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(St,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>b(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>o(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(Xe,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const St=Pe.form`
|
|
2
|
-
max-width: 1536px;
|
|
3
|
-
|
|
4
|
-
.advanced-config {
|
|
5
|
-
border: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.config-form {
|
|
10
|
-
flex-grow: 1;
|
|
11
|
-
overflow-y: auto;
|
|
12
|
-
will-change: transform;
|
|
13
|
-
|
|
14
|
-
&:first-child {
|
|
15
|
-
margin: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
${S=>S.theme.breakpoints.down("md")} {
|
|
19
|
-
width: 100%;
|
|
20
|
-
flex-shrink: 0;
|
|
21
|
-
padding: 0 24px;
|
|
22
|
-
transform: translate(0, 0);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.config-item {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: space-between;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.config-desc {
|
|
33
|
-
font-weight: normal;
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
color: #666;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.form-item {
|
|
39
|
-
margin-top: 0;
|
|
40
|
-
}
|
|
41
|
-
`;var ve={},wt=Qe;Object.defineProperty(ve,"__esModule",{value:!0});var ye=ve.default=void 0,kt=wt($e()),Tt=e;ye=ve.default=(0,kt.default)((0,Tt.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const Lt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:It,SLOT_FOR_IP_DNS_SITE:Dt,DEFAULT_DID_DOMAIN:Ct}=pe,{encode:Ae}=ut,qt=S=>`${Ae(S.meta.did)}-${Dt}.${It}`,Ft=({did:S,didDomain:r=Ct})=>`${Ae(S)}.${r}`;var Pt={getIpDnsDomainForBlocklet:qt,getDidDomainForBlocklet:Ft};const Rt=R.forwardRef((S,r)=>{var b,y;const{t:n}=R.useContext(X),{blocklet:s}=$(),{api:w}=J(),t=se({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Z}),f=je(),c=((y=(b=f==null?void 0:f.transitions)==null?void 0:b.duration)==null?void 0:y.leavingScreen)||300,h=p(()=>{t.mode="view",t.data={},t.callback=Z}),l=p(()=>{t.show=!1,setTimeout(()=>{h()},c)}),d=p(i=>{t.mode="view",t.show=!0,t.data=i}),k=p((i,o=Z)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=o});R.useImperativeHandle(r,()=>({open:d,close:l,approve:k}),[d,l,k]);const L=te(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&rt(i,"appliedAt","status"),i.map(o=>{const T=n(`federated.info.${o}`);let a=t.data[o];if(o==="appName"&&t.data.isMaster&&(a=e.jsxs(m,{children:[e.jsx(Re,{component:ye}),a]})),["appId","appPid","serverId"].includes(o)&&(a=e.jsx(he,{children:a})),["appUrl"].includes(o)&&(a=e.jsx(m,{component:"a",href:a,target:"_blank",children:a})),["appLogo"].includes(o)){const j=it(`https://${Pt.getDidDomainForBlocklet({did:t.data.appPid})}`,"/.well-known/service/blocklet/logo");try{const u=new URL(j);u.searchParams.set("imageFilter","resize"),u.searchParams.set("w","80"),u.searchParams.set("h","80"),a=e.jsx("img",{src:u.href,width:"60",height:"60",alt:t.data.appName})}catch{a=e.jsx("img",{src:j,width:"60",height:"60",alt:t.data.appName})}}return o==="status"&&(a=a&&n(`federated.status.${a}`)),o==="migratedFrom"&&(a=(t.data.migratedFrom||[]).filter(P=>![t.data.appId,t.data.appPid].includes(P)).map(P=>e.jsx(he,{children:P}))),lt(a)&&(a="-"),{name:T,value:a}})},[t.data]),x=t.mode==="approve",g=p(async()=>{try{t.loadingReject=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),v=p(async()=>{try{t.loadingApprove=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(ge,{open:t.show,title:n(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:x?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,n("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:v,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,n("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:l,children:n("common.close")}),children:L.map(i=>e.jsx(dt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Oe=R.forwardRef((S,r)=>{var d,k;const n=je(),s=((k=(d=n==null?void 0:n.transitions)==null?void 0:d.duration)==null?void 0:k.leavingScreen)||300,{t:w}=R.useContext(X),t=se({show:!1,data:{link:""}}),f=p(()=>{t.data.link=""}),c=p(()=>{t.show=!1,setTimeout(()=>{f()},s)}),h=p(({link:L})=>{t.show=!0,t.data.link=L});R.useImperativeHandle(r,()=>({open:h,close:c}),[h,c]);const l=p(()=>{Ye(t.data.link),c()});return e.jsxs(ge,{open:t.show,title:w("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:w("common.copyAndClose")}),children:[e.jsx(m,{mb:1,children:w("federated.inviteJoinFederatedLoginDescription")}),e.jsx(m,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Ne,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function Se({mode:S}){var Q,we,ke,Te,Le;const r=R.useRef(null),n=R.useRef(null),{t:s,locale:w}=R.useContext(X),{blocklet:t,actions:{refreshBlocklet:f}}=$(),{confirmApi:c,confirmHolder:h}=Je(),{api:l}=J(),d=((Q=t.settings.federated)==null?void 0:Q.sites)||[],k=((we=t.settings.federated)==null?void 0:we.config)||{},L=k.isMaster!==!1,x=d.find(C=>C.appPid===t.appPid),g=se({loadingSync:!1}),v=p(C=>{var q;(q=n.current)==null||q.open(C)}),b=p(C=>{var q;(q=n.current)==null||q.approve(C,f)}),y=p(C=>{c.open({title:s("federated.removeFederatedLogin"),content:s("federated.removeFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:C.appPid}}),q()}})}),i=p(C=>{c.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"revoked"}}),q()}})}),o=p(C=>{c.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"approved"}}),q()}})}),T=te(()=>{const C=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"inline-block",children:e.jsxs(m,{component:"a",display:"flex",alignItems:"center",href:F.appUrl,target:"_blank",onClick:B=>{B.stopPropagation()},children:[ee&&e.jsx(Re,{component:ye,style:{marginRight:"4px"}}),F.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:q=>{const F=d[q];return e.jsx(he,{children:F.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{children:ee?"-":s(`federated.status.${F.status}`)})}}}];return L&&C.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"flex",gap:1,children:ee?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.rejected")}),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),y(F)},children:s("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:B=>{B.stopPropagation(),b(F)},children:s("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),i(F)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:B=>{B.stopPropagation(),o(F)},style:{whiteSpace:"nowrap"},children:s("federated.approve")},"approveSite")]})})}}}),C},[k.appId,d,L,s]),a=te(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(C,{dataIndex:q}){const F=d[q];v(F)}}),[]),j=p(()=>{var q;const C=t.environments.find(F=>F.key===st.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);C!=null&&C.value?(q=r.current)==null||q.open({link:C.value}):U.error(s("federated.failedToGetFederatedLoginLink"))},[(Le=(Te=(ke=t.site)==null?void 0:ke.domainAliases)==null?void 0:Te[0])==null?void 0:Le.href]),u=p(()=>{c.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.quitFederatedLogin({input:{did:t.appPid}}),C()}})}),P=p(()=>{c.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.disbandFederatedLogin({input:{did:t.appPid}}),C()}})}),A=p(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),He(500)]),U.success(s("common.succeeded"))}finally{g.loadingSync=!1}}),_=[];return x.status!=="pending"&&_.push(e.jsx(et,{title:s("federated.syncConfig"),children:e.jsx(oe,{size:"small",onClick:A,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(K,{icon:Lt,style:{fontSize:24}})},"syncConfig")})),S==="master"?(_.push(e.jsx(z,{size:"small",variant:"contained",onClick:j,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),_.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:P,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):_.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:u,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"main-table",locale:w,data:d,columns:T,customButtons:_,title:e.jsx(m,{className:"table-toolbar-left",children:s("oauth.federated")}),options:a}),h,e.jsx(Oe,{ref:r}),e.jsx(Rt,{ref:n})]})}Se.propTypes={mode:N.oneOf(["member","master"])};Se.defaultProps={mode:"member"};const At=R.forwardRef((S,r)=>{var g,v;const{t:n}=R.useContext(X),{api:s}=J(),{blocklet:w}=$(),t=w==null?void 0:w.appPid,f=je(),c=((v=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:v.leavingScreen)||300,h=se({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Z}),l=p(()=>{h.appUrl="",h.appUrlError="",h.callback=Z}),d=p(()=>{h.show=!1,setTimeout(()=>{l()},c)}),k=p((b=Z)=>{h.show=!0,h.callback=b});R.useImperativeHandle(r,()=>({open:k,close:d}),[k,d]);const L=p(b=>{if(!b)throw new Error(n("federated.federatedJoinAppUrlRequired"));if(!Ge(b))throw new Error(n("federated.federatedJoinAppUrlInvalid"))}),x=p(async()=>{try{L(h.appUrl),h.loading=!0;const b=await s.joinFederatedLogin({input:{did:t,appUrl:h.appUrl}});h.show=!1,d(),h==null||h.callback(b)}catch(b){h.appUrlError=b.message}finally{h.loading=!1}});return e.jsxs(ge,{open:h.show,title:n("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,disabled:h.loading,children:[h.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,n("common.confirm")]}),children:[e.jsx(m,{mb:1,children:n("federated.joinFederatedLoginDescription")}),e.jsx(O,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:n("federated.federatedJoinAppUrl"),label:n("federated.federatedJoinAppUrl"),value:h.appUrl,error:!!h.appUrlError,helperText:h.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{h.appUrl=b.target.value}})]})});function Ot(){var c,h,l,d,k;const S=R.useRef(null),r=R.useRef(null),{t:n}=R.useContext(X),{blocklet:s,actions:{refreshBlocklet:w}}=$(),t=p(()=>{var x,g,v,b;const L=(v=(g=(x=s.site)==null?void 0:x.domainAliases)==null?void 0:g[0])==null?void 0:v.href;if(L)try{const y=new URL(L);(b=S.current)==null||b.open({link:y.origin})}catch{U.error(n("federated.failedToGetFederatedLoginLink"))}},[(l=(h=(c=s.site)==null?void 0:c.domainAliases)==null?void 0:h[0])==null?void 0:l.href]),f=p(()=>{var L;(L=r.current)==null||L.open(()=>{w()})});if(((d=s.settings.federated)==null?void 0:d.sites.length)>0){const L=((k=s.settings.federated)==null?void 0:k.config.isMaster)!==!1;return e.jsx(Se,{mode:L?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsxs(m,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[e.jsx(z,{variant:"contained",onClick:t,children:n("federated.inviteJoinFederatedLogin")}),e.jsx(re,{sx:{width:"150px",color:"text.primary"},children:"OR"}),e.jsx(z,{variant:"outlined",onClick:f,children:n("federated.joinFederatedLogin")})]}),e.jsx(Oe,{ref:S}),e.jsx(At,{ref:r})]})}function Be({orientation:S="horizontal"}){const{t:r}=R.useContext(X),n=mt({key:"lg"}),s=[{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.commonSettings")}),value:"settings"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.federated")}),value:"federated"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.oauth")}),value:"oauth"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.moreLogin")}),value:"more"}],[w,t]=R.useState(s[0].value),f=te(()=>({oauth:e.jsx(vt,{}),federated:e.jsx(Ot,{}),more:e.jsx(Ze,{children:r("oauth.comingSoon")}),settings:e.jsx(yt,{})}),[r]);return S==="vertical"?e.jsx(Bt,{children:e.jsxs(H,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(m,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:s,current:w,orientation:n?"horizontal":"vertical",onChange:t,sx:{borderRight:n?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(m,{sx:{flexGrow:1,minWidth:0},children:e.jsx(m,{maxWidth:"1200px",children:f[w]})})]})}):e.jsxs(m,{children:[e.jsx(De,{tabs:s,current:w,onChange:t}),e.jsx(m,{marginTop:"10px",children:f[w]})]})}Be.propTypes={orientation:N.oneOf(["horizontal","vertical"])};Be.defaultProps={orientation:"horizontal"};const Bt=Pe.div`
|
|
42
|
-
.MuiTab-root {
|
|
43
|
-
text-align: left;
|
|
44
|
-
align-items: flex-start;
|
|
45
|
-
font-weight: normal;
|
|
46
|
-
|
|
47
|
-
div {
|
|
48
|
-
text-align: left;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.Mui-selected {
|
|
53
|
-
font-weight: bold;
|
|
54
|
-
}
|
|
55
|
-
`;export{Be as default};
|