@abtnode/blocklet-services 1.16.44-beta-20250512-155818-937e465d → 1.16.44-beta-20250516-225119-c0b5ec8d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.js +3 -1
- package/api/libs/connect/session.js +22 -9
- package/api/libs/image.js +1 -2
- package/api/libs/open-graph/index.js +1 -2
- package/api/libs/push-kit/index.js +1 -0
- package/api/middlewares/check-federated-cors-call.js +2 -2
- package/api/middlewares/check-permission.js +10 -3
- package/api/routes/blocklet.js +1 -1
- package/api/routes/csp-proxy.js +67 -0
- package/api/routes/federated.js +30 -25
- package/api/routes/oauth/client.js +2 -2
- package/api/routes/openembed.js +1 -1
- package/api/routes/user-session.js +1 -2
- package/api/routes/user.js +9 -6
- package/api/services/auth/connect/connect-to-did-spaces-for-user.js +1 -1
- package/api/services/auth/connect/pre-setup.js +2 -1
- package/api/services/auth/connect/setup.js +31 -4
- package/api/services/image/index.js +1 -1
- package/api/services/notification/queue.js +27 -4
- package/api/socket/channel/did.js +14 -7
- package/api/util/federated.js +5 -1
- package/api/util/user-util.js +1 -1
- package/dist/assets/{AdapterDayjs-BD9H1lZ-.js → AdapterDayjs-YbaNvT9I.js} +1 -1
- package/dist/assets/{ArrowDropDown-BrO-zDlb.js → ArrowDropDown-xgs4N3Rf.js} +1 -1
- package/dist/assets/{CheckCircle-Ds4QI0ey.js → CheckCircle-JXD6tKIa.js} +1 -1
- package/dist/assets/{ChevronLeft-CnQaQ-rc.js → ChevronLeft-D0eko_T8.js} +1 -1
- package/dist/assets/{ChevronRight-a_2_x6Ew.js → ChevronRight-CQY9Ni7X.js} +1 -1
- package/dist/assets/{Community-DW6DJTIs.js → Community-BCL2L7ib.js} +1 -1
- package/dist/assets/{DeleteOutline-CFN4r-OG.js → DeleteOutline-BEGOj_wq.js} +1 -1
- package/dist/assets/{Done-DqSE6KPe.js → Done-BUJJNjlP.js} +1 -1
- package/dist/assets/{Download-C_LRKzbG.js → Download-DdZEsxmZ.js} +1 -1
- package/dist/assets/{Edit-CbR4eoK8.js → Edit-vxeVwrqO.js} +1 -1
- package/dist/assets/{EditIcon-DxUWMw59.js → EditIcon-Dffk7mPL.js} +1 -1
- package/dist/assets/{Email-DWueGk7t.js → Email-CdSNK0eA.js} +1 -1
- package/dist/assets/{Error-jEHdDLNk.js → Error-C-RD4e9g.js} +1 -1
- package/dist/assets/{ExpandLess-CkoEHpgk.js → ExpandLess-CmqG9SE7.js} +1 -1
- package/dist/assets/{Google-DHEolkW-.js → Google-B7PA4qF8.js} +1 -1
- package/dist/assets/{Holiday-Dwvo6QkZ.js → Holiday-enHMZqEf.js} +1 -1
- package/dist/assets/{InfoOutlined-DkG0jjos.js → InfoOutlined-BIr5nkjV.js} +1 -1
- package/dist/assets/{Launch-B-2Jomi6.js → Launch-KvZQI_SA.js} +1 -1
- package/dist/assets/{LaunchOutlined-CXNijfqX.js → LaunchOutlined-ClxZU_tj.js} +1 -1
- package/dist/assets/{Location-DUEOr9J2.js → Location-By12Z3Te.js} +1 -1
- package/dist/assets/{LockIcon-Cjg8jV1E.js → LockIcon-98CKEIBe.js} +1 -1
- package/dist/assets/{Meeting-CJaI_cKm.js → Meeting-CLeFWDkY.js} +1 -1
- package/dist/assets/{MoreHoriz-B6KdR0Y8.js → MoreHoriz-H8rabTmY.js} +1 -1
- package/dist/assets/{OffSick-C9VqqjrN.js → OffSick-dUm363rs.js} +1 -1
- package/dist/assets/{Phone-DcHUzCa-.js → Phone--BSu-btI.js} +1 -1
- package/dist/assets/{PlayArrow-BToG9L6q.js → PlayArrow-CmxnItFZ.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-BPVDAm8U.js → QuestionMarkCircle-DTf-Tya5.js} +1 -1
- package/dist/assets/{ServerLogo-s6cfhx92.js → ServerLogo-CEsILJl5.js} +1 -1
- package/dist/assets/{Timezone-B-Ho_Uno.js → Timezone-YZ0dMUEr.js} +1 -1
- package/dist/assets/{TuneOutlined-BR2H7Mxj.js → TuneOutlined-DmhFMgM-.js} +1 -1
- package/dist/assets/{ViewList-D8vtMKQz.js → ViewList-DXk3qGFU.js} +1 -1
- package/dist/assets/{WorkingRemotely-lJ6DUMCR.js → WorkingRemotely-BX7rgbEY.js} +1 -1
- package/dist/assets/{access-control-CCSlKYYz.js → access-control-DfNk54C9.js} +1 -1
- package/dist/assets/{actions-BjTeIzgS.js → actions-V9hjjowb.js} +1 -1
- package/dist/assets/{add-component-core-C7-Epxoj.js → add-component-core-Dx4Ojnmk.js} +16 -16
- package/dist/assets/add-resource-CxXfKLfm.js +1 -0
- package/dist/assets/addon-DtaZ0TB3.js +14 -0
- package/dist/assets/{advanced-tG5IRVhQ.js → advanced-Ddtt8Hj-.js} +1 -1
- package/dist/assets/appearance-BrPMC4u8.js +1 -0
- package/dist/assets/ar-2yn9i2dw.js +7 -0
- package/dist/assets/audit-logs-D9m5k0JB.js +35 -0
- package/dist/assets/{authorize-DNTNbUhI.js → authorize-T5C3DfFM.js} +1 -1
- package/dist/assets/{base32-_zEVBJUg.js → base32-BPfgmw66.js} +1 -1
- package/dist/assets/blocklet-default-logo-Bspnu_ws.png +0 -0
- package/dist/assets/{branding-hDeNkLC2.js → branding-BVm4-_4U.js} +2 -2
- package/dist/assets/{branding-By8KDk5Q.js → branding-hFlZ2gIT.js} +2 -2
- package/dist/assets/{bundle-avatar-DYTLzqlT.js → bundle-avatar-BEofqN1I.js} +1 -1
- package/dist/assets/button-m03GMAJs.js +1 -0
- package/dist/assets/click-to-copy-DmYkL7Ui.js +1 -0
- package/dist/assets/{collapse-QV_2gdtM.js → collapse-FsvH0gRe.js} +1 -1
- package/dist/assets/complete-DwnM8k9G.js +39 -0
- package/dist/assets/{component-Blsql2u0.js → component-s7RjpIXH.js} +8 -8
- package/dist/assets/{config-LE_EJolF.js → config-Dl_53WnU.js} +1 -1
- package/dist/assets/{config-D6r2ZAFY.js → config-bdYGvEMY.js} +2 -2
- package/dist/assets/{config-navigation-B0nu0al4.js → config-navigation-bI89qiN3.js} +3 -3
- package/dist/assets/config-space-D1h9DQze.js +1 -0
- package/dist/assets/confirm-zdbJI4Oz.js +7 -0
- package/dist/assets/{connect-Cu2Ssv5A.js → connect-B2amNptu.js} +1 -1
- package/dist/assets/connect-BTGTAWj-.js +5 -0
- package/dist/assets/connect-to-DrS33AaQ.js +1 -0
- package/dist/assets/{content-layout-BzF-fNQz.js → content-layout--sy9JlYZ.js} +1 -1
- package/dist/assets/dashboard-u-oRSlsi.js +239 -0
- package/dist/assets/de-CEKbJD3-.js +7 -0
- package/dist/assets/delete-confirm-CUNBU1J1.js +1 -0
- package/dist/assets/{did-address-DjwPl1uy.js → did-address-BI9LYTx-.js} +1 -1
- package/dist/assets/domain-ER_Bg0qe.js +9 -0
- package/dist/assets/domain-action-card-CYBXEnlZ.js +28 -0
- package/dist/assets/domains-CBYb9WvZ.js +1 -0
- package/dist/assets/dot-BB5occkV.js +7 -0
- package/dist/assets/{email-BZVu6WP-.js → email-BmZcVM-V.js} +2 -2
- package/dist/assets/{empty-spinner-n0_Ehns5.js → empty-spinner-BZw_ShnT.js} +1 -1
- package/dist/assets/{es-BuUaHPig.js → es-dvMygD-W.js} +3 -3
- package/dist/assets/{exchange-passport-8jdiPDph.js → exchange-passport-B5vniH8u.js} +1 -1
- package/dist/assets/fr-BvFd5xp9.js +7 -0
- package/dist/assets/{fuel-Dx_cnsCl.js → fuel-DW3R8bWE.js} +1 -1
- package/dist/assets/{gen-access-key-CqKmmKML.js → gen-access-key-h48ZchOb.js} +1 -1
- package/dist/assets/get-safe-url-BcH2iukm.js +1 -0
- package/dist/assets/get-safe-url-OaLLn0UN.js +1 -0
- package/dist/assets/hi-C51yBXa5.js +5 -0
- package/dist/assets/{home-DzCwBE8F.js → home-CJ28zTIJ.js} +1 -1
- package/dist/assets/id-B1Mq_eQI.js +7 -0
- package/dist/assets/{iframe-DW7zzzTG.js → iframe-D0kv9-rE.js} +1 -1
- package/dist/assets/index-8eXqqyHQ.js +5 -0
- package/dist/assets/index-BGat0zzz.js +284 -0
- package/dist/assets/index-BXdw6keY.js +1 -0
- package/dist/assets/{index-BDYaw77z.js → index-BdH_4Yfe.js} +1 -1
- package/dist/assets/{index-C5SsKJ2n.js → index-C0te7llT.js} +18 -14
- package/dist/assets/index-C1rBJXFe.js +1 -0
- package/dist/assets/index-C3bbolus.js +113 -0
- package/dist/assets/{index-BYCeMwoO.js → index-C849wD9b.js} +1 -1
- package/dist/assets/{index-Bju4sfVL.js → index-CJpkpFKR.js} +2 -2
- package/dist/assets/index-CNauVjuD.js +99 -0
- package/dist/assets/{index-Btl_rz0J.js → index-CSbITcwB.js} +17 -17
- package/dist/assets/{index-DcUhenm6.js → index-CmQOzzP8.js} +1 -1
- package/dist/assets/{index-HU4yqI-9.js → index-D-X7HfwW.js} +1 -1
- package/dist/assets/{index-CPfvVvHv.js → index-D-mbJPLJ.js} +12 -12
- package/dist/assets/{index-enM9Y412.js → index-D3iGbfL9.js} +1 -1
- package/dist/assets/index-D70ICXrC.js +1 -0
- package/dist/assets/{index-DefO2n6z.js → index-DRCFOq4H.js} +58 -58
- package/dist/assets/{index-B8r-LrrM.js → index-DbsXFWms.js} +1 -1
- package/dist/assets/{index-BIPRCLBG.js → index-DoCu_ga_.js} +2 -2
- package/dist/assets/index-DwnC6XvN.js +6 -0
- package/dist/assets/{index-ftkgQlGr.js → index-DwswX2WL.js} +1 -1
- package/dist/assets/index-Up0XQY6f.js +55 -0
- package/dist/assets/index-VzeamwDR.js +241 -0
- package/dist/assets/index-nBzxkc-e.js +4 -0
- package/dist/assets/{index-SzdSxpkq.js → index-tD3kWii2.js} +4 -4
- package/dist/assets/{invitation-1bsb30Yz.js → invitation-CLUn7Gd4.js} +4 -4
- package/dist/assets/invite-B1zBa8Gp.js +1 -0
- package/dist/assets/issue-passport-5n5uQFFQ.js +1 -0
- package/dist/assets/item-BCYQnjF7.js +2 -0
- package/dist/assets/ja-CCKVmbEX.js +7 -0
- package/dist/assets/ko-A_w8tIEg.js +7 -0
- package/dist/assets/{landing-page-Due4o1uF.js → landing-page-CUrvCtHZ.js} +1 -1
- package/dist/assets/{launch-result-message-DIYoykBK.js → launch-result-message-Eea5FZDm.js} +1 -1
- package/dist/assets/{layout-D93HKT6w.js → layout-Bs_rMuQ9.js} +2 -2
- package/dist/assets/list-CFP3MiEI.js +2 -0
- package/dist/assets/list-M2tV_ZYf.js +236 -0
- package/dist/assets/list-header-DNFbdM3a.js +1 -0
- package/dist/assets/localization-Cl5vfs2R.js +1 -0
- package/dist/assets/{log--AX8zo75.js → log-CcpvITx1.js} +2 -3
- package/dist/assets/logger-BYg6vYBA.js +1 -0
- package/dist/assets/{login-WRcteY7r.js → login-4G5grSod.js} +1 -1
- package/dist/assets/login-oauth-callback-DMou-vp-.js +1 -0
- package/dist/assets/{logo-uploader-CQCy6MG3.js → logo-uploader-Bf6myR3q.js} +3 -3
- package/dist/assets/{lost-passport-kJX7pEJj.js → lost-passport-DWc6Kq0b.js} +2 -2
- package/dist/assets/{open-window--2G6Qjbq.js → open-window-CuyFfntO.js} +1 -1
- package/dist/assets/overview-vcNUrQdk.js +85 -0
- package/dist/assets/{page-header-xyZktwBS.js → page-header-DpNvpd52.js} +4 -4
- package/dist/assets/{passport-item-CIvCqz_R.js → passport-item-IDGIDfr4.js} +1 -1
- package/dist/assets/{permission-BH1TY_tz.js → permission-Cnn9EYOW.js} +1 -1
- package/dist/assets/preferences-Cqm2olsT.js +1 -0
- package/dist/assets/profile-embed-CcuuyEXm.js +1 -0
- package/dist/assets/pt-7HHecjdA.js +5 -0
- package/dist/assets/publish-resource-DGUHUINH.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-7PS2VwOi.js → react-beautiful-dnd.esm-cfY5JZV6.js} +1 -1
- package/dist/assets/ru-Bw8FVC4M.js +5 -0
- package/dist/assets/runtime-efQyx-LE.js +1 -0
- package/dist/assets/sdk-CXaHNlMH.js +1 -0
- package/dist/assets/{section-Cv4udilp.js → section-C1TPQFRq.js} +1 -1
- package/dist/assets/{security-DM8MeY05.js → security-DFjq-0Qw.js} +4 -4
- package/dist/assets/{session-CHdTc1We.js → session-B2z_IWIe.js} +1 -1
- package/dist/assets/setup-CLYOmcmD.js +30 -0
- package/dist/assets/{shorten-label-Cng55547.js → shorten-label-Bf7YQUd6.js} +1 -1
- package/dist/assets/{simple-select-CP_Svi_D.js → simple-select-DwWEI_ZU.js} +1 -1
- package/dist/assets/{slicedToArray-C7EPqaHf.js → slicedToArray-BSaY8ui4.js} +1 -1
- package/dist/assets/{spaces-BVG-t3ND.js → spaces-DMMN97uo.js} +1 -1
- package/dist/assets/{start-CIjuDAiX.js → start-xHz18_Rr.js} +3 -3
- package/dist/assets/{starting-progress-CiLZpNpg.js → starting-progress-DeFtXRb_.js} +1 -1
- package/dist/assets/status-y-bc7cex.js +1 -0
- package/dist/assets/{step-actions-CeJCmiCS.js → step-actions-Btu6D6gk.js} +1 -1
- package/dist/assets/{studio-DikseKRr.js → studio-CiFHrC57.js} +1 -1
- package/dist/assets/{switch-control-C5i52ixk.js → switch-control-DnNP5DPe.js} +1 -1
- package/dist/assets/table-tips-hNIkakER.js +1 -0
- package/dist/assets/th-DyW-mYrC.js +5 -0
- package/dist/assets/traffic-BIrotm6H.js +35 -0
- package/dist/assets/{transfer-CTEHVklh.js → transfer-BeJGTbo1.js} +1 -1
- package/dist/assets/{unsubscribe-Bi2IV-2n.js → unsubscribe-Bjxnpv_W.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BEy8Tnso.js → use-blocklet-logo-BoFa24A6.js} +1 -1
- package/dist/assets/{use-mobile-Boa_xu9A.js → use-mobile-JEGQfLZ2.js} +1 -1
- package/dist/assets/{use-mobile-DyX6Fl8Z.js → use-mobile-ZAS6Si4t.js} +1 -1
- package/dist/assets/useAsync-DnXpD472.js +1 -0
- package/dist/assets/{useLocalStorage-DVnkpneF.js → useLocalStorage-BRd3tKN9.js} +1 -1
- package/dist/assets/user-center-DI0NPFtg.js +76 -0
- package/dist/assets/{util-MKllNgBs.js → util-C3FgySYN.js} +1 -1
- package/dist/assets/{util-CEAObyfj.js → util-CVjZG67N.js} +1 -1
- package/dist/assets/{vendor-arcblock-uz9DVywv.js → vendor-arcblock-DPRICUXM.js} +109 -109
- package/dist/assets/{vendor-hooks-rDgu5KV9.js → vendor-hooks-Zkb4Ilbj.js} +1 -1
- package/dist/assets/{vendor-mui-core-D_bnq77o.js → vendor-mui-core-Bh-qMRq3.js} +1 -1
- package/dist/assets/{vendor-mui-x-R-0SFz4c.js → vendor-mui-x-CQTjfcpn.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-DHrruicZ.js → vendor-ux-did-connect-Ck9lzrbN.js} +73 -73
- package/dist/assets/vi-bzer6J4H.js +5 -0
- package/dist/assets/wrap-locale-COcPskJ7.js +1 -0
- package/dist/assets/zh-Cti0XXui.js +8 -0
- package/dist/assets/zh-tw-BLcDG99i.js +7 -0
- package/dist/images/all-done-dark.svg +68 -0
- package/dist/images/all-done-light.svg +60 -0
- package/dist/index.html +5 -5
- package/dist/service-worker.js +1 -1
- package/package.json +48 -47
- package/dist/assets/add-resource-CJHw7ea0.js +0 -1
- package/dist/assets/addon--u4EErgw.js +0 -14
- package/dist/assets/appearance-bRLsRDs2.js +0 -1
- package/dist/assets/ar-Blzb8h2o.js +0 -7
- package/dist/assets/audit-logs-B3-Fo3nR.js +0 -35
- package/dist/assets/button-D8hoY4xw.js +0 -1
- package/dist/assets/click-to-copy-CFiGx48J.js +0 -1
- package/dist/assets/complete-6R-n_Ra9.js +0 -45
- package/dist/assets/config-space-d34Deg7R.js +0 -1
- package/dist/assets/confirm-DjTZImyg.js +0 -7
- package/dist/assets/connect-K4ZmMu4L.js +0 -5
- package/dist/assets/connect-to-BG15Vnyg.js +0 -1
- package/dist/assets/dashboard-BIOpvfj3.js +0 -239
- package/dist/assets/de-BxI5dM9K.js +0 -7
- package/dist/assets/delete-confirm-BzuBR6TW.js +0 -1
- package/dist/assets/domain-action-card-Bcs_GWxq.js +0 -24
- package/dist/assets/domain-wh85yL2O.js +0 -9
- package/dist/assets/domains-bzKFbARj.js +0 -1
- package/dist/assets/dot-C4hULxc0.js +0 -7
- package/dist/assets/format-error-BrmqJs5a.js +0 -2
- package/dist/assets/fr-DezMACmP.js +0 -7
- package/dist/assets/get-safe-url-B5RJTMjC.js +0 -1
- package/dist/assets/get-safe-url-Bk6PlU7n.js +0 -1
- package/dist/assets/hi-ClbEozhq.js +0 -5
- package/dist/assets/id-CXYm-1K3.js +0 -7
- package/dist/assets/index-8CHxrfFP.js +0 -1
- package/dist/assets/index-B9nvthxv.js +0 -4
- package/dist/assets/index-C-A13dEh.js +0 -141
- package/dist/assets/index-Cc-e6lxg.js +0 -1
- package/dist/assets/index-DjEDWgGs.js +0 -6
- package/dist/assets/index-Du38Vjy4.js +0 -241
- package/dist/assets/index-Dyl-XQ73.js +0 -99
- package/dist/assets/index-Jnk92KZC.js +0 -284
- package/dist/assets/index-USO5zFMh.js +0 -55
- package/dist/assets/index-ioZVVJtg.js +0 -113
- package/dist/assets/invite-CALl83Zc.js +0 -1
- package/dist/assets/issue-passport-BcStTsbv.js +0 -1
- package/dist/assets/item-Bk_1JLeG.js +0 -2
- package/dist/assets/ja-B5V7b8Cm.js +0 -7
- package/dist/assets/ko-DP9up1nF.js +0 -7
- package/dist/assets/list-D96_O-GY.js +0 -2
- package/dist/assets/list-header-HqBQs1yn.js +0 -1
- package/dist/assets/list-rt6nku1-.js +0 -236
- package/dist/assets/localization-BUDtnbyU.js +0 -1
- package/dist/assets/logger-BLZgTs_U.js +0 -1
- package/dist/assets/login-oauth-callback-DZaPZfnA.js +0 -1
- package/dist/assets/overview-CpKMiGEK.js +0 -85
- package/dist/assets/preferences-CfmnTXfl.js +0 -1
- package/dist/assets/profile-embed-ZtzRYgXv.js +0 -1
- package/dist/assets/pt-CG45pWr4.js +0 -5
- package/dist/assets/publish-resource-CCa5xfwz.js +0 -1
- package/dist/assets/ru-0VhRQc7t.js +0 -5
- package/dist/assets/runtime-eXYlg9Cz.js +0 -1
- package/dist/assets/sdk-9eXJSWHG.js +0 -1
- package/dist/assets/setup-BEsU41BB.js +0 -30
- package/dist/assets/status-CUMJd-nJ.js +0 -1
- package/dist/assets/th-DwH8cjcw.js +0 -5
- package/dist/assets/traffic-B5x_6GvF.js +0 -35
- package/dist/assets/useAsync-C8ydfEEr.js +0 -1
- package/dist/assets/useAsync-CMWsznMW.js +0 -1
- package/dist/assets/user-center-DcXdjtRX.js +0 -76
- package/dist/assets/vi-CcmTJggB.js +0 -5
- package/dist/assets/wrap-locale-B9TkXFQe.js +0 -1
- package/dist/assets/zh-C2MKZFZw.js +0 -8
- package/dist/assets/zh-tw-mW-UVEHx.js +0 -7
- package/dist/images/all-done.png +0 -0
|
@@ -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-DefO2n6z.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};
|
|
@@ -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-DefO2n6z.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-BIOpvfj3.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-BEy8Tnso.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-rt6nku1-.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-B5x_6GvF.js";import{B as It}from"./bundle-avatar-DYTLzqlT.js";import{u as vs}from"./use-mobile-Boa_xu9A.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DVnkpneF.js";import"./confirm-DjTZImyg.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-BToG9L6q.js";import"./get-safe-url-Bk6PlU7n.js";import"./session-CHdTc1We.js";import"./InfoOutlined-DkG0jjos.js";import"./dot-C4hULxc0.js";import"./useAsync-CMWsznMW.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 i,aa as g}from"./vendor-mui-core-D_bnq77o.js";import{f as x,r as u}from"./vendor-react-DEoibe3W.js";import{u as v}from"./vendor-hooks-rDgu5KV9.js";import{I as w}from"./invitation-1bsb30Yz.js";import{L as I}from"./landing-page-Due4o1uF.js";import{u as S,aT as T,j}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as P}from"./vendor-arcblock-uz9DVywv.js";import{g as k}from"./get-safe-url-B5RJTMjC.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-DefO2n6z.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-B9TkXFQe.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&T(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(j.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(P,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,ab as w,aa as v}from"./vendor-mui-core-D_bnq77o.js";import{a as T,m as I,u as p}from"./vendor-hooks-rDgu5KV9.js";import{I as P}from"./invitation-1bsb30Yz.js";import{L as j}from"./landing-page-Due4o1uF.js";import{u as k,aT as R,j as S}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as L}from"./vendor-arcblock-uz9DVywv.js";import{g as E}from"./get-safe-url-B5RJTMjC.js";import{u as C,c as W,s as F,a as N}from"./index-DefO2n6z.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-B9TkXFQe.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),g=T({state:""}),s=I(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(P,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};
|