@abtnode/blocklet-services 1.16.52-beta-20250928-042319-ff3f0e04 → 1.16.52-beta-20251002-030549-0f91dab2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/middlewares/launcher-login.js +3 -2
- package/api/routes/access-key.js +13 -1
- package/api/routes/csp-proxy.js +7 -7
- package/dist/assets/{AdapterDayjs-Ch1GqpK7.js → AdapterDayjs-CAaLcejt.js} +1 -1
- package/dist/assets/{Google-CZPwmMCG.js → Google-BMeng9mn.js} +2 -2
- package/dist/assets/{access-control-MtITiDMT.js → access-control-Cw0_MVFj.js} +1 -1
- package/dist/assets/{actions-CL4xTGOh.js → actions-DbBJOD0d.js} +1 -1
- package/dist/assets/{add-component-core-DT871JXs.js → add-component-core-B4fftW3o.js} +7 -7
- package/dist/assets/add-resource-CZfTjlD0.js +1 -0
- package/dist/assets/{addon-CAvqw8mm.js → addon-CBAld8jW.js} +2 -2
- package/dist/assets/{advanced-BeEKQmus.js → advanced-DPeAQM5T.js} +2 -2
- package/dist/assets/{aigne-DepLc7CZ.js → aigne-DD21HBlT.js} +1 -1
- package/dist/assets/api-BUbloWod.js +1 -0
- package/dist/assets/{appearance-CQM-3LPu.js → appearance-CwcRjBdx.js} +1 -1
- package/dist/assets/{ar-DrftSIv3.js → ar-7nBHeQPa.js} +1 -1
- package/dist/assets/{ar-DGfbWcRb.js → ar-DDKSNNIB.js} +2 -2
- package/dist/assets/{arrow-down.svg-VIKI4IBd.js → arrow-down.svg-B1ffj_Bi.js} +1 -1
- package/dist/assets/{audit-logs-B4nW0HQW.js → audit-logs-CIL7B8dX.js} +2 -2
- package/dist/assets/authorize-DPXeAf_q.js +1 -0
- package/dist/assets/{base-chart-BntWHeFy.js → base-chart-BbbiwJIa.js} +1 -1
- package/dist/assets/base32-CgLd9kUN.js +1 -0
- package/dist/assets/bind-account-Ci1GnBqL.js +1 -0
- package/dist/assets/{branding-DIltHBq0.js → branding-CGCnGFEE.js} +2 -2
- package/dist/assets/branding-IhXI5Wue.js +1 -0
- package/dist/assets/{branding-BxI7VSjI.js → branding-Y62inJ9A.js} +5 -5
- package/dist/assets/{bundle-avatar-BvwlMY-v.js → bundle-avatar-BrBIjq4r.js} +1 -1
- package/dist/assets/button-BG8yGG9e.js +1 -0
- package/dist/assets/{click-to-copy-Dqmzk5Lh.js → click-to-copy-CVHuu877.js} +1 -1
- package/dist/assets/{cloneDeep-sSKmkjV3.js → cloneDeep-E2Pxqpbv.js} +1 -1
- package/dist/assets/{collapse-GMtfQlRs.js → collapse-DhGi244c.js} +1 -1
- package/dist/assets/{complete-BiA0H-F-.js → complete-DNXvjWOj.js} +3 -3
- package/dist/assets/{component-CcDcQA4R.js → component-M75sOZuG.js} +3 -3
- package/dist/assets/{config-BDmrqxia.js → config-BASOtMEK.js} +7 -7
- package/dist/assets/{config-7aDpCy1J.js → config-BOttfQk3.js} +1 -1
- package/dist/assets/{config-CegNHv38.js → config-Bshk_mlq.js} +2 -2
- package/dist/assets/{config-navigation-DeVpCAhC.js → config-navigation-C_Stnyxb.js} +13 -13
- package/dist/assets/{config-space-D3NLSAOS.js → config-space-Bh_yLAj-.js} +1 -1
- package/dist/assets/confirm-LpOyjg-M.js +7 -0
- package/dist/assets/{connect-NiZcQvBT.js → connect-A31Nzurl.js} +1 -1
- package/dist/assets/{connect-3UzkXBvk.js → connect-DEe_baYC.js} +1 -1
- package/dist/assets/connect-to-Cco6-qou.js +1 -0
- package/dist/assets/{content-layout-DYZYIlLo.js → content-layout-CaGd-JXO.js} +1 -1
- package/dist/assets/createClass-BuhPvJV8.js +1 -0
- package/dist/assets/{dashboard-C_xJDuQY.js → dashboard-B757yKbJ.js} +3 -3
- package/dist/assets/{de-DGZI-Bsh.js → de-C5jW-Aco.js} +2 -2
- package/dist/assets/{de-CzR7Usym.js → de-Dn7PhTZq.js} +1 -1
- package/dist/assets/{delete-confirm-ZcwDcAcQ.js → delete-confirm-V3_sRk8l.js} +1 -1
- package/dist/assets/{did-address-CNnw4_bl.js → did-address-CeTjTMC4.js} +1 -1
- package/dist/assets/{domain-oUFlaLKy.js → domain-B9OATbrX.js} +1 -1
- package/dist/assets/{domain-action-card-t81ZH6IT.js → domain-action-card-D-_-tvd3.js} +2 -2
- package/dist/assets/domains-CHjbOYj6.js +1 -0
- package/dist/assets/{email-BfBsaQZc.js → email-BpimKMdd.js} +3 -3
- package/dist/assets/{empty-spinner-DCC7mgEb.js → empty-spinner-CkCqfxFX.js} +1 -1
- package/dist/assets/engine-DyhSNCpN.js +1 -0
- package/dist/assets/{es-BHI4ILsC.js → es-B_X5HHiA.js} +1 -1
- package/dist/assets/{es-CMwFpp7C.js → es-DnE5Se03.js} +2 -2
- package/dist/assets/{exchange-passport-DHCCHO-N.js → exchange-passport-XYv5fxqy.js} +1 -1
- package/dist/assets/{form-Csfi6zyX.js → form-CHueGgAz.js} +2 -2
- package/dist/assets/{form-text-input-xNlMjrH6.js → form-text-input-CqoNK3mi.js} +1 -1
- package/dist/assets/{form-wrapper-BCRhnWhi.js → form-wrapper-DNqXvSru.js} +1 -1
- package/dist/assets/{fr-BqKCXdV2.js → fr-BIAMVkwl.js} +1 -1
- package/dist/assets/{fr-eKsI9Vcp.js → fr-BpXortYf.js} +2 -2
- package/dist/assets/{fuel-CUlDLjak.js → fuel-CfnN-Pjf.js} +1 -1
- package/dist/assets/gen-access-key-ku3cDonU.js +1 -0
- package/dist/assets/gen-simple-access-key-EujuCaoZ.js +1 -0
- package/dist/assets/get-safe-url-CbJcsvAc.js +1 -0
- package/dist/assets/{hi-DlvVN0mm.js → hi-4-0lpKbp.js} +1 -1
- package/dist/assets/{hi-C0JqybmN.js → hi-CeUu25BW.js} +1 -1
- package/dist/assets/{home-BwyzLr74.js → home-CSzo40aP.js} +1 -1
- package/dist/assets/{id-DHF6PX-M.js → id-BugYMmLN.js} +2 -2
- package/dist/assets/{id-YNynvxGd.js → id-Dw1-p0GY.js} +1 -1
- package/dist/assets/iframe-eYdxV3eX.js +1 -0
- package/dist/assets/{index-kiLQKwVa.js → index-3xeMR-Qg.js} +1 -1
- package/dist/assets/{index-Ck6n4b0a.js → index-6IwthDxj.js} +1 -1
- package/dist/assets/index-82gv-l2w.js +283 -0
- package/dist/assets/{index-CfHItWba.js → index-B0JZLMkR.js} +4 -4
- package/dist/assets/index-BA8N8sek.js +150 -0
- package/dist/assets/{index-uH_9YgA0.js → index-BC0KaiLK.js} +1 -1
- package/dist/assets/index-BFZ5LKID.js +62 -0
- package/dist/assets/{index-gcYTlYEZ.js → index-BVRSxJRS.js} +1 -1
- package/dist/assets/{index-B06oP6vd.js → index-BjcHj49D.js} +1 -1
- package/dist/assets/index-Br6A9_4o.js +124 -0
- package/dist/assets/{index-CJWwSLdB.js → index-C-QPG4ba.js} +19 -19
- package/dist/assets/index-C0n4exuY.js +1 -0
- package/dist/assets/index-COFNyzYu.js +29 -0
- package/dist/assets/index-CX0nBp11.js +1 -0
- package/dist/assets/index-C_YGTMJ4.js +1 -0
- package/dist/assets/index-CjATIX5e.js +1039 -0
- package/dist/assets/{index-D7zqBJdA.js → index-CmkQ05MW.js} +12 -12
- package/dist/assets/{index-DS-40ZVK.js → index-Cs6DTc99.js} +5 -5
- package/dist/assets/index-Cza28Ou-.js +7 -0
- package/dist/assets/{index-Cn5TXl_L.js → index-D04UESXe.js} +1 -1
- package/dist/assets/{index-CKpQd8db.js → index-DOo8QRm-.js} +14 -14
- package/dist/assets/{index-v50gyNUL.js → index-DRhj0EDS.js} +9 -9
- package/dist/assets/{index-DH4W6unN.js → index-DZkt7K0r.js} +1 -1
- package/dist/assets/{index-DzI9kX_C.js → index-DbXxI_D0.js} +1 -1
- package/dist/assets/index-Dn2eai8S.js +113 -0
- package/dist/assets/{index-DO9UDa6G.js → index-Dr9NaKfR.js} +1 -1
- package/dist/assets/{index-D-puzkw-.js → index-DxuK3aPg.js} +1 -1
- package/dist/assets/{index-BPJUfDZY.js → index-IN8OKZ_V.js} +2 -2
- package/dist/assets/index-ZXxjnrfz.js +55 -0
- package/dist/assets/{index-BwMsFaIR.js → index-ZYd4RNU_.js} +1 -1
- package/dist/assets/{index-BUiG3mKw.js → index-iIT2_Y_I.js} +1 -1
- package/dist/assets/{invitation-GzoS6QSS.js → invitation-Bud5mQS8.js} +2 -2
- package/dist/assets/{invite-DDdJj6co.js → invite-BnTsj399.js} +1 -1
- package/dist/assets/{isURL-CCV0esLR.js → isURL-BkRG9xZw.js} +2 -2
- package/dist/assets/{issue-passport-PUK3HiX7.js → issue-passport-sL6P-Jy0.js} +1 -1
- package/dist/assets/{item-DAL9Dho-.js → item-CZxO50cp.js} +1 -1
- package/dist/assets/{ja-DEmGhfzG.js → ja-C6gbn0J8.js} +1 -1
- package/dist/assets/{ja-c-6MaUg1.js → ja-DaREJWmX.js} +2 -2
- package/dist/assets/{ko-CTFi4Ndk.js → ko-DGXdpX64.js} +2 -2
- package/dist/assets/{ko-CfYoSPs0.js → ko-av2FKXII.js} +1 -1
- package/dist/assets/{landing-page-CL9L_8lE.js → landing-page-Co0EA4cx.js} +1 -1
- package/dist/assets/{launch-result-message-DN12F68Q.js → launch-result-message-B0--4ubW.js} +1 -1
- package/dist/assets/{layout-CWE2T-JY.js → layout-CiBZwE8j.js} +1 -1
- package/dist/assets/list-CgUqi7mZ.js +2 -0
- package/dist/assets/list-CoRNWpJL.js +103 -0
- package/dist/assets/{list-header-CoFZp82R.js → list-header-DlrmpNef.js} +1 -1
- package/dist/assets/localization-DAfm9MKy.js +1 -0
- package/dist/assets/{log-CH5xMfwF.js → log-BLtV-mr3.js} +1 -1
- package/dist/assets/logger-CsgnUk8i.js +1 -0
- package/dist/assets/login-0UJlN7iP.js +1 -0
- package/dist/assets/{login-oauth-callback-yy8oOs-S.js → login-oauth-callback-BhX1vXuH.js} +1 -1
- package/dist/assets/{logo-uploader-BbYoAyD-.js → logo-uploader-x03Hv0sw.js} +2 -2
- package/dist/assets/{lost-passport-CnWY_gqA.js → lost-passport-DuQjRy5y.js} +2 -2
- package/dist/assets/{observability-oDc3dKFA.js → observability-3BjnzXRV.js} +1 -1
- package/dist/assets/{omit-C2ouGG7F.js → omit-r-0RLWOV.js} +1 -1
- package/dist/assets/{open-window-2gqXwgFW.js → open-window-C2521tBf.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-D2yclQzx.js → over-due-invoice-payment-CeMW933U.js} +1 -1
- package/dist/assets/{overview-B4sE3XPK.js → overview-C-11gh2u.js} +2 -2
- package/dist/assets/{page-header-8LlFejLk.js → page-header-DP0csqkR.js} +1 -1
- package/dist/assets/passport-item-CBQOM3AQ.js +1 -0
- package/dist/assets/{permission-CSIyJtvw.js → permission-BeuMG3nG.js} +1 -1
- package/dist/assets/{playground-Dk2enS21.js → playground-BEhnKrD-.js} +1 -1
- package/dist/assets/preferences-DvVN_OF0.js +1 -0
- package/dist/assets/profile-embed-BdpgwY58.js +1 -0
- package/dist/assets/{pt-DTd68aWZ.js → pt-C5SxM_jO.js} +1 -1
- package/dist/assets/{pt-QkdDdQuw.js → pt-CIqefLTL.js} +1 -1
- package/dist/assets/publish-resource-CERp8nCz.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DPZZJVHP.js → react-beautiful-dnd.esm-9QLg1KOC.js} +1 -1
- package/dist/assets/{react-stripe.esm-DXXjh9xE.js → react-stripe.esm-DWiCVD55.js} +1 -1
- package/dist/assets/{required-B2SKELXR.js → required-BUAaYcMZ.js} +1 -1
- package/dist/assets/{ru-swMH4bvc.js → ru-B4h3WudR.js} +1 -1
- package/dist/assets/{ru-BHPYrefb.js → ru-BWd-_jpY.js} +1 -1
- package/dist/assets/runtime-CC0b3IOS.js +1 -0
- package/dist/assets/sanitize-mRppk1lK.js +2 -0
- package/dist/assets/sdk-Dfotb8VE.js +1 -0
- package/dist/assets/{section-CndbjVtx.js → section-CCfmWVdK.js} +1 -1
- package/dist/assets/{security-g0CzShNx.js → security-DAv6SG0v.js} +3 -3
- package/dist/assets/session-p360wpOR.js +1 -0
- package/dist/assets/{setup-D_impIE6.js → setup-CWKcr-SA.js} +1 -1
- package/dist/assets/{shorten-label-Cbu8wo9m.js → shorten-label-DAXPWCI6.js} +1 -1
- package/dist/assets/{simple-select-BqhbnnqN.js → simple-select-BHPmFba3.js} +1 -1
- package/dist/assets/{spaces-p4zKSeyp.js → spaces-DdStEDKL.js} +1 -1
- package/dist/assets/{start-BD7Kr8U-.js → start-gQWc3jOT.js} +1 -1
- package/dist/assets/{starting-progress-C6OFR0oi.js → starting-progress-CxdsmebW.js} +1 -1
- package/dist/assets/status-jCRFV0de.js +1 -0
- package/dist/assets/{step-actions-RYL0A520.js → step-actions-DV76BAlD.js} +1 -1
- package/dist/assets/{studio-Bp-XDrgR.js → studio-D9ArZgZT.js} +1 -1
- package/dist/assets/{switch-control-XooTt-i6.js → switch-control-Bs2D4JNi.js} +1 -1
- package/dist/assets/{table-tips-CgCabdgD.js → table-tips-B1dFVdej.js} +1 -1
- package/dist/assets/team-CxJqHuEA.js +146 -0
- package/dist/assets/{th-DuqieD90.js → th-BjttL5p9.js} +1 -1
- package/dist/assets/{th-Bk3GO_e5.js → th-CRUlNqtq.js} +1 -1
- package/dist/assets/traffic-BuZd517Z.js +1 -0
- package/dist/assets/{transfer-Z_9W88aQ.js → transfer-Dh7kcNdX.js} +1 -1
- package/dist/assets/{unsubscribe-B07Ogw5q.js → unsubscribe-DzDiAt1Q.js} +1 -1
- package/dist/assets/{use-app-logo-D_gO-Dio.js → use-app-logo-BiGG8tCg.js} +1 -1
- package/dist/assets/{use-mobile-CQ7Tw4aD.js → use-mobile-BW9mTiYC.js} +1 -1
- package/dist/assets/{use-mobile-D93Bk2Ru.js → use-mobile-B_fpUHD7.js} +1 -1
- package/dist/assets/{use-server-logo-BJM5bxfh.js → use-server-logo-R848M-JH.js} +1 -1
- package/dist/assets/{use-window-close-toR_SRTv.js → use-window-close-Dk0lXOqo.js} +1 -1
- package/dist/assets/{useAsync-CNAYLnLm.js → useAsync-DkQHu4t4.js} +1 -1
- package/dist/assets/{useAsync-DZevTxbv.js → useAsync-DoI7Qt9M.js} +1 -1
- package/dist/assets/{useAsyncRetry-6TjWJyO6.js → useAsyncRetry-DNTidBXG.js} +1 -1
- package/dist/assets/useLocalStorage-BzRs3x-K.js +1 -0
- package/dist/assets/user-center-Gvk90n3A.js +126 -0
- package/dist/assets/{user-follower-DWn8bXG-.js → user-follower-D7rNbdJC.js} +1 -1
- package/dist/assets/user-sessions-BXusVv21.js +1 -0
- package/dist/assets/{util-Bravn321.js → util-BKRDkFNf.js} +1 -1
- package/dist/assets/{util-BYg7Nb7Z.js → util-DQbvJ9cJ.js} +1 -1
- package/dist/assets/{vendor-arcblock-DEa0A9MF.js → vendor-arcblock-BhtOu00C.js} +144 -141
- package/dist/assets/vendor-hooks-BtDnIwBH.js +7 -0
- package/dist/assets/{vendor-mui-core-CmD-NPnl.js → vendor-mui-core-BIZOanxj.js} +18 -18
- package/dist/assets/{vendor-mui-x--K2rEM1j.js → vendor-mui-x-DWX99wt-.js} +1 -1
- package/dist/assets/vendor-utils-CVwaKsP9.js +213 -0
- package/dist/assets/{vendor-ux-pYOhjQLA.js → vendor-ux-Cfhaj-oj.js} +13 -13
- package/dist/assets/{vi-xPRidQ_j.js → vi-5AzowaJ4.js} +1 -1
- package/dist/assets/{vi-42QzvOuM.js → vi-C-IhikR1.js} +1 -1
- package/dist/assets/{wait-connect-CgBXxzyb.js → wait-connect-CPHamZhf.js} +1 -1
- package/dist/assets/{wizard-BEs2v6uI.js → wizard-DXT-RVCl.js} +1 -1
- package/dist/assets/{wizard-components-5FNqoPRf.js → wizard-components-CkjeNOkS.js} +3 -3
- package/dist/assets/wrap-locale-DQUa7V1E.js +1 -0
- package/dist/assets/{zh-Blu7Gys0.js → zh-1ARDBzTp.js} +1 -1
- package/dist/assets/{zh-NsxeedJj.js → zh-BQXiLbg6.js} +1 -1
- package/dist/assets/{zh-C-k4DKK-.js → zh-CWvcoHsp.js} +2 -2
- package/dist/assets/{zh-tw-BLENKI0o.js → zh-tw-DAvBOrfW.js} +1 -1
- package/dist/assets/{zh-tw-Dxa4oubT.js → zh-tw-D_73qm-O.js} +2 -2
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +50 -50
- package/dist/assets/add-resource-BnQPv53-.js +0 -1
- package/dist/assets/api-sewNv0AE.js +0 -1
- package/dist/assets/authorize-DtR2q4pL.js +0 -1
- package/dist/assets/base32-dGIGRTeZ.js +0 -1
- package/dist/assets/bind-account-DKu95GI-.js +0 -1
- package/dist/assets/branding-DI8S4rKX.js +0 -1
- package/dist/assets/button-D5GaRQPz.js +0 -1
- package/dist/assets/confirm-BbY8YGyk.js +0 -7
- package/dist/assets/connect-to-QQ3T-HpF.js +0 -1
- package/dist/assets/createClass-CDs8uNCX.js +0 -1
- package/dist/assets/domains-CMbykSQm.js +0 -1
- package/dist/assets/engine-BNoG81bE.js +0 -1
- package/dist/assets/gen-access-key-C3uuo9SI.js +0 -1
- package/dist/assets/gen-simple-access-key-CX90y0zh.js +0 -1
- package/dist/assets/get-safe-url-DKg8JLr1.js +0 -1
- package/dist/assets/hdkey-BgsbeAhG.js +0 -62
- package/dist/assets/iframe-SCM7rlz3.js +0 -1
- package/dist/assets/index-BJbNz5vx.js +0 -1027
- package/dist/assets/index-BWAu1pEw.js +0 -1
- package/dist/assets/index-CB__aq5L.js +0 -7
- package/dist/assets/index-CKOznUni.js +0 -110
- package/dist/assets/index-CNvRrWdA.js +0 -1
- package/dist/assets/index-DTU7_GN0.js +0 -124
- package/dist/assets/index-Qx6e57-u.js +0 -55
- package/dist/assets/index-VARWquqH.js +0 -1
- package/dist/assets/index-c7w7Lgaw.js +0 -113
- package/dist/assets/index-g5_ozUJZ.js +0 -30
- package/dist/assets/index-sQzZNoGx.js +0 -271
- package/dist/assets/list-B1IF52f7.js +0 -103
- package/dist/assets/list-DNkyeHs7.js +0 -4
- package/dist/assets/localization-DWmiu7jH.js +0 -1
- package/dist/assets/logger-Cror7fb1.js +0 -1
- package/dist/assets/login-C0H7ScpD.js +0 -1
- package/dist/assets/passport-item-CK1Zj4rm.js +0 -1
- package/dist/assets/preferences-BBghzBy7.js +0 -1
- package/dist/assets/profile-embed-B2uhPkoV.js +0 -1
- package/dist/assets/publish-resource-DhuBgzO7.js +0 -1
- package/dist/assets/runtime-B3mVl8w2.js +0 -1
- package/dist/assets/sanitize-BwaMGjTb.js +0 -2
- package/dist/assets/sdk-B4j47QQf.js +0 -1
- package/dist/assets/session-m3orzHBa.js +0 -1
- package/dist/assets/status-D1-G3QED.js +0 -1
- package/dist/assets/team-B-jk7E5_.js +0 -146
- package/dist/assets/traffic-CInL395-.js +0 -1
- package/dist/assets/useLocalStorage-CiLfInVV.js +0 -1
- package/dist/assets/user-center-DzijYiyQ.js +0 -126
- package/dist/assets/user-sessions-CuXtk29w.js +0 -1
- package/dist/assets/vendor-hooks-DLNZ8kxG.js +0 -7
- package/dist/assets/vendor-utils-DQK0pEML.js +0 -213
- package/dist/assets/wrap-locale-B5OsZl6Q.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-
|
|
1
|
+
import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-BtDnIwBH.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as K,cs as ft,U as xt,T as E,a3 as ht,W as w,z as $,M as ae,I as W,cC as $e,ca as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as wt}from"./vendor-mui-core-BIZOanxj.js";import{T as F,b as H,j as Tt,P as fe,G as le,H as R,n as L,p as xe,N as Ue,w as Ge,a3 as It,E as De,S as Dt,a0 as Pt}from"./vendor-ux-Cfhaj-oj.js";import{Y as k,p as Rt,ao as Ve,c as U,B as J,a7 as kt,aI as At,f as Ft,W as Nt,aq as se,bb as Lt,be as Ye}from"./index-CjATIX5e.js";import{W as he}from"./did-address-CeTjTMC4.js";import{u as _}from"./team-CxJqHuEA.js";import{a as ge,r as ye,b as je,c as Ke,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-CBQOM3AQ.js";import{p as Ze}from"./util-BKRDkFNf.js";import{u as Mt}from"./use-mobile-BW9mTiYC.js";import{v as Q}from"./index-6IwthDxj.js";import{w as G,P as Je}from"./permission-BeuMG3nG.js";import{C as _t}from"./Google-BMeng9mn.js";import{A as $t}from"./vendor-arcblock-BhtOu00C.js";import{G as Z,$ as Ot,H as Wt}from"./vendor-utils-CVwaKsP9.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-LpOyjg-M.js";import{L as Qe}from"./list-header-DlrmpNef.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-p360wpOR.js";import"./isURL-BkRG9xZw.js";import"./use-app-logo-BiGG8tCg.js";import"./index-BC0KaiLK.js";import"./base32-CgLd9kUN.js";import"./cloneDeep-E2Pxqpbv.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Tt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};const Ut=q(g)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -9,7 +9,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
9
9
|
.body {
|
|
10
10
|
margin-top: 24px;
|
|
11
11
|
}
|
|
12
|
-
`;function et({createPassportSvg:u,passport:o}){const{t:i,locale:p}=F(),{teamDid:m}=_(),{inService:l}=k(),h=Mt(),a=[{items:[{label:i("common.role"),content:ge(o.title)},{label:i("common.did"),content:e.jsx(he,{did:o.id})},{label:i("team.passport.status"),content:je(o.status)},{label:i("common.type"),content:e.jsx(g,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(s=>e.jsx(xt,{label:s,variant:"outlined",size:"small",sx:{borderRadius:1}},s))})}]}],f=[{title:i("team.passport.owner"),items:[{label:i("team.passport.owner"),content:e.jsx(g,{children:ye(o.user,l)})}]},{title:i("common.timeInfo"),items:[{label:i("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(le,{value:o.issuanceDate,type:"all",locale:p}):"-"},{label:i("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(le,{value:o.lastLoginAt,type:"all",locale:p}):"-"},{label:i("common.expires"),content:o.expirationDate?e.jsx(le,{value:o.expirationDate,type:"all",locale:p}):"-"}]},{title:i("blocklet.overview.source"),items:[{label:i("blocklet.overview.source"),content:ne(o.source)}]}];return e.jsxs(Gt,{gap:3,children:[e.jsxs(g,{sx:{display:"flex",flexDirection:h?"column":"row",alignItems:h?"flex-start":"center",justifyContent:h?"center":"flex-start",width:"100%",overflow:"hidden",gap:h?2:4},children:[e.jsx(g,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,m,l):"",revoked:o.revoked,extra:o?.expirationDate?{key:"Exp",value:
|
|
12
|
+
`;function et({createPassportSvg:u,passport:o}){const{t:i,locale:p}=F(),{teamDid:m}=_(),{inService:l}=k(),h=Mt(),a=[{items:[{label:i("common.role"),content:ge(o.title)},{label:i("common.did"),content:e.jsx(he,{did:o.id})},{label:i("team.passport.status"),content:je(o.status)},{label:i("common.type"),content:e.jsx(g,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(s=>e.jsx(xt,{label:s,variant:"outlined",size:"small",sx:{borderRadius:1}},s))})}]}],f=[{title:i("team.passport.owner"),items:[{label:i("team.passport.owner"),content:e.jsx(g,{children:ye(o.user,l)})}]},{title:i("common.timeInfo"),items:[{label:i("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(le,{value:o.issuanceDate,type:"all",locale:p}):"-"},{label:i("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(le,{value:o.lastLoginAt,type:"all",locale:p}):"-"},{label:i("common.expires"),content:o.expirationDate?e.jsx(le,{value:o.expirationDate,type:"all",locale:p}):"-"}]},{title:i("blocklet.overview.source"),items:[{label:i("blocklet.overview.source"),content:ne(o.source)}]}];return e.jsxs(Gt,{gap:3,children:[e.jsxs(g,{sx:{display:"flex",flexDirection:h?"column":"row",alignItems:h?"flex-start":"center",justifyContent:h?"center":"flex-start",width:"100%",overflow:"hidden",gap:h?2:4},children:[e.jsx(g,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,m,l):"",revoked:o.revoked,extra:o?.expirationDate?{key:"Exp",value:Ve(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(g,{className:"info-area",children:a.map(s=>e.jsxs(g,{children:[s.title&&e.jsx(E,{variant:"h6",sx:{mb:2},children:s.title}),e.jsx(g,{className:"info-grid",sx:{gap:"12px !important"},children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",sx:{maxWidth:40},children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:r.content})]},r.label))})]},s.title))})]}),e.jsx(ht,{}),e.jsx(g,{className:"info-area",children:f.map(s=>e.jsxs(g,{children:[e.jsx(E,{variant:"h5",sx:{mb:1.5},children:s.title}),e.jsx(g,{className:"info-grid",children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{minWidth:500},children:r.content})]},r.label))})]},s.title))})]})}et.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired};const Gt=q(ee)`
|
|
13
13
|
.info-card {
|
|
14
14
|
margin-bottom: 24px;
|
|
15
15
|
overflow: hidden;
|
|
@@ -87,7 +87,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
87
87
|
margin: 0;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`,tt=10,st=1;function rt({passport:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),[l,h]=C.useState({pageSize:tt,page:st}),{data:a,loading:f}=re(async()=>{const y={teamDid:i,query:{passportId:u.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>R.error(y.message)}),s=C.useMemo(()=>a?.logs||[],[a?.logs]),r=y=>y.action===U.PASSPORT_LOG_ACTION.APPROVE||y.action===U.PASSPORT_LOG_ACTION.REVOKE?y?.metadata?.operator?.fullName?`${p("common.operator")}: ${y?.metadata?.operator?.fullName}`:null:y.action===U.PASSPORT_LOG_ACTION.ISSUE&&y.metadata?.action===U.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?y?.metadata?.inviter?.fullName?`${p("common.inviter")}: ${y?.metadata?.inviter?.fullName}`:null:`passportId: ${y.passportId}`,t=C.useMemo(()=>[{label:p("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsx(
|
|
90
|
+
`,tt=10,st=1;function rt({passport:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),[l,h]=C.useState({pageSize:tt,page:st}),{data:a,loading:f}=re(async()=>{const y={teamDid:i,query:{passportId:u.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>R.error(y.message)}),s=C.useMemo(()=>a?.logs||[],[a?.logs]),r=y=>y.action===U.PASSPORT_LOG_ACTION.APPROVE||y.action===U.PASSPORT_LOG_ACTION.REVOKE?y?.metadata?.operator?.fullName?`${p("common.operator")}: ${y?.metadata?.operator?.fullName}`:null:y.action===U.PASSPORT_LOG_ACTION.ISSUE&&y.metadata?.action===U.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?y?.metadata?.inviter?.fullName?`${p("common.inviter")}: ${y?.metadata?.inviter?.fullName}`:null:`passportId: ${y.passportId}`,t=C.useMemo(()=>[{label:p("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsx(K,{title:r(d),children:`${y} ${d.metadata?.action?`(${d.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:y=>e.jsx(g,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:y||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[d.operatorUa&&e.jsx(g,{children:Bt(d.operatorUa)}),d.operatorUa&&e.jsx(K,{title:d.operatorUa,children:e.jsx(ft,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:p("common.createdAt"),name:"createdAt",options:{customBodyRender:y=>Rt(y,m)}}],[p,m,s]),n=({page:y,rowsPerPage:x})=>{l.pageSize!==x?h(d=>({...d,pageSize:x,page:1})):l.page!==y+1&&h(d=>({...d,page:y+1}))},c={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:a?.total||0};return f?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsx(g,{children:e.jsx(fe,{className:"logs-table",verticalKeyWidth:100,locale:m,data:s,columns:t,options:c,loading:f,onChange:n})})}rt.propTypes={passport:w.object.isRequired};function at({passport:u,onSwitchPassport:o}){const{api:i}=k(),{teamDid:p}=_(),{t:m,locale:l}=F(),[h,a]=C.useState({pageSize:tt,page:st}),{data:f,loading:s}=re(async()=>{const x={teamDid:p,passportId:u.parentDid,paging:{page:h.page,pageSize:h.pageSize}},d=await i.getRelatedPassports({input:x});return{passports:d.passports||[],total:d.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:x=>R.error(x.message)}),r=C.useMemo(()=>f?.passports||[],[f?.passports]),t=C.useMemo(()=>[{label:m("team.passport.role"),name:"role",options:{customBodyRender:ge}},{label:m("team.passport.owner"),name:"user",options:{customBodyRender:ye}},{label:m("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:m("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:x=>Ke(x,l)}},{label:m("blocklet.overview.source"),name:"source",options:{customBodyRender:ne}}],[m,l]),n=({page:x,rowsPerPage:d})=>{h.pageSize!==d?a(j=>({...j,pageSize:d,page:1})):h.page!==x+1&&a(j=>({...j,page:x+1}))},c=C.useRef(null),y={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:f?.total||0,onRowClick(x,{dataIndex:d},j){if(c.current?.contains(j.target)){const S=r[d];o(S)}}};return s?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(ee,{spacing:1,children:[e.jsx(_e,{severity:"warning",children:m("team.passport.relatedDescription")}),e.jsx(g,{ref:c,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(fe,{className:"related-table",verticalKeyWidth:100,locale:l,data:r.filter(x=>x.id!==u.id),columns:t,options:y,loading:s,onChange:n})})]})}at.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function Ce({onCancel:u,onSuccess:o}){const{api:i}=k(),{blocklet:p}=kt(),{t:m}=F(),[l,h]=C.useState(!1),a=(p.environments.find(n=>n.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",f=a==="auto"?$t(p.appDid):a,[s,r]=C.useState(f),t=async()=>{const n=[{key:Nt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:s}];try{h(!0),await i.configBlocklet({input:{did:p.meta.did,configs:n}}),o()}catch(c){R.error(c.message)}finally{h(!1)}};return e.jsx(H,{title:m("team.passport.color"),onClose:u,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:m("common.cancel")}),e.jsxs(L,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx(M,{size:16}),m("common.save")]})]}),children:e.jsxs(g,{className:"dialog-content",sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx(_t,{disableAlpha:!0,color:s,onChange:n=>r(n.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:At({scope:"passport",role:"owner",title:"Owner",issuer:Ft.getDisplayName(p),issuerDid:p.appDid,ownerName:"Your Name",ownerDid:p.appDid,preferredColor:s})}})]})})}const Vt=G(Ce,"mutate_team"),Yt=G(Ce,"",J);function Kt(u){const{inService:o}=k();return o?e.jsx(Yt,{...u}):e.jsx(Vt,{...u})}Ce.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};var nt=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};nt.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Zt=(u,o)=>u?!o.some(i=>!i.from.passport||!i.to.role):!1;function ot({onCancel:u,onSuccess:o,data:i={},trustedPassports:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=C.useState(!1),[r,t]=C.useState(i.issuerDid||""),[n,c]=C.useState(i.remark||""),[y,x]=C.useState(Z(i.mappings)||[]),d=p.findIndex(S=>S.issuerDid===i.issuerDid),j=async()=>{if(f)return;const S={issuerDid:r,remark:n,mappings:y.map(b=>({...b,to:{...b.to,ttl:b.to.ttl||0}}))},T=[...p];d===-1?T.unshift(S):T[d]=S;try{s(!0),await m.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await se(800),s(!1),R.success(a("common.saveSuccess")),o()}catch(b){s(!1),R.error(te(b))}};return e.jsx(H,{title:a("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(W,{onClick:u,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>j(),color:"primary",disabled:!Zt(r,y)||!n||f,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[f&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(Jt,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:a("team.passport.issuerDid"),value:r,onChange:S=>{t(S.target.value)}}),e.jsx($,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:a("common.remark"),value:n,onChange:S=>{c(S.target.value)}}),e.jsxs(g,{sx:{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(g,{className:"dialog-h1",children:a("team.passport.mappingRule")}),e.jsx(g,{children:e.jsx(L,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{x(S=>{const T=[...S];return T.unshift({from:{passport:""},to:{role:U.ROLES.GUEST}}),T})},children:a("team.add")})})]}),e.jsxs(g,{className:"list",sx:{mt:-.5},children:[y.map((S,T)=>e.jsxs(g,{className:"mapping-item",sx:{display:"flex",alignItems:"center",justifyContent:"space-between",my:1},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID *",value:S.from.passport,onChange:b=>{const{value:P}=b.target;x(I=>{const B=[...I];return B[T].from.passport=P,B})},sx:{"& .MuiInputBase-input::placeholder":{fontSize:14},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}})}),e.jsx(g,{sx:{flexShrink:0,mx:1,width:65,height:16},children:e.jsx(nt,{})}),e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small",select:!0,value:S.to.role,onChange:b=>{x(P=>{const I=[...P];return I[T].to.role=b.target.value,I})},variant:"outlined",children:l.filter(b=>b.name!=="owner").map(b=>e.jsx(ae,{value:b.name,"data-cy":`passport-mapping-select-option-${b.name}`,children:e.jsx("span",{children:b.title||b.name})},b.name))})})]}),e.jsx(g,{sx:{flexShrink:0},children:e.jsx(W,{onClick:()=>{x(b=>{const P=[...b];return P.splice(T,1),P})},size:"large",children:e.jsx(ie,{})})})]},`mapping-${T}`)),!y.length&&e.jsx(g,{sx:{my:2,color:"text.secondary",fontSize:"16px"},children:e.jsx(xe,{children:a("common.empty")})})]})]})})})}ot.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};const Jt=q.div`
|
|
91
91
|
.dialog-h1 {
|
|
92
92
|
font-size: 18px;
|
|
93
93
|
}
|
|
@@ -99,7 +99,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
`;function be({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedPassports:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(""),y=async d=>{if(f)return;const j=m.findIndex(
|
|
102
|
+
`;function be({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedPassports:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(""),y=async d=>{if(f)return;const j=m.findIndex(T=>T.issuerDid===d);j===-1&&R.error("Cannot find passports");const S=[...m];S.splice(j,1);try{s(!0),await i.configTrustedPassports({input:{teamDid:p,trustedPassports:S}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(!1)}catch(T){s(!1),R.error(T.message)}},x=m.filter(d=>!n||d.issuerDid.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedIssuers"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(ts,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedPassportIssuers")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchIssuerDid"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexShrink:0},children:[e.jsx(he,{copyable:!1,size:16,did:Ge.toAddress(d.issuerDid),showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",ml:"28px",flexGrow:1},children:d.mappings&&d.mappings.length?`${d.mappings.length} ${l("team.passport.mappingRule")}`:l("team.passport.defaultRule")}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(W,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(oe,{})}),e.jsx(W,{"data-cy":"delete-mapping-rule",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.issuerDid}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.issuerDid),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.issuerDid)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(ot,{mode:r.mode,data:r.data,trustedPassports:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}be.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const Qt=G(be,"mutate_team"),Xt=G(be,"",J);function es(u){const{inService:o}=k();return o?e.jsx(Xt,{...u}):e.jsx(Qt,{...u})}const ts=q.div`
|
|
103
103
|
.list {
|
|
104
104
|
.MuiIconButton-root {
|
|
105
105
|
svg {
|
|
@@ -107,7 +107,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
`;var ss=Ot();const Re=Me(ss);function it({onCancel:u,onSuccess:o,data:i={},trustedFactories:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=qt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:i.factoryAddress||"",remark:i.remark||"",role:i.passport?.role||"member",ttlPolicy:i.passport?.ttlPolicy||"never",ttl:Re(+i.passport?.ttl||365*24*60*60*1e3),error:""}),r=p.findIndex(x=>x.factoryAddress===i.factoryAddress),t=async()=>{if(f.loading)return;const{factoryAddress:x,remark:d,role:j,ttlPolicy:S,ttl:
|
|
110
|
+
`;var ss=Ot();const Re=Me(ss);function it({onCancel:u,onSuccess:o,data:i={},trustedFactories:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=qt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:i.factoryAddress||"",remark:i.remark||"",role:i.passport?.role||"member",ttlPolicy:i.passport?.ttlPolicy||"never",ttl:Re(+i.passport?.ttl||365*24*60*60*1e3),error:""}),r=p.findIndex(x=>x.factoryAddress===i.factoryAddress),t=async()=>{if(f.loading)return;const{factoryAddress:x,remark:d,role:j,ttlPolicy:S,ttl:T}=f,b={factoryAddress:x,remark:d,passport:{role:j,ttlPolicy:S,ttl:S==="never"?0:Re(T)}},P=[...p];r===-1?P.unshift(b):P[r]=b;try{s({loading:!0}),await m.configTrustedFactories({input:{teamDid:h,trustedFactories:P}}),await se(800),R.success(a("common.saveSuccess")),o()}catch(I){console.error(I),R.error(te(I))}finally{s({loading:!1})}};C.useEffect(()=>{const x=f.fetched.find(j=>j.address===f.factoryAddress),d=f.errored.find(j=>j.address===f.factoryAddress);Ge.isValid(f.factoryAddress)&&!f.fetching&&!x&&!d&&(s({fetching:!0}),Lt(U.MAIN_CHAIN_ENDPOINT).getFactoryState({address:f.factoryAddress}).then(S=>{S.state?s({fetching:!1,fetched:[...f.fetched.filter(T=>T.address!==f.factoryAddress),S.state],remark:S.state.name}):s({fetching:!1,errored:[...f.errored.filter(T=>T.address!==f.factoryAddress),{address:f.factoryAddress}],error:a("team.passport.factory404",f)})}).catch(S=>{console.error(S),s({fetching:!1,error:te(S)})}))},[f.factoryAddress,f.fetching]);let n=f.error;const c=f.factoryAddress?f.errored.find(x=>x.address===f.factoryAddress):null;!n&&c&&(n=a("team.passport.factory404",f));const y=f.factoryAddress?f.fetched.find(x=>x.address===f.factoryAddress):null;return!n&&y&&(n=y.description),n||(n=a("team.passport.factoryAddressTip")),e.jsx(H,{title:a("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(W,{onClick:u,"data-cy":"close-trusted-factory",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>t(),color:"primary",disabled:!f.factoryAddress||!f.remark||!f.role||f.loading||f.error||c,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[f.loading&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(rs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,error:!!f.error||!!c,"data-cy":"input-factory-address",label:a("team.passport.factoryAddress"),helperText:n,value:f.factoryAddress,onChange:x=>{s({factoryAddress:x.target.value,error:""})},slotProps:{input:{endAdornment:f.fetching?e.jsx(gt,{position:"end",children:e.jsx(M,{size:16})}):null}}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:a("common.remark"),value:f.remark,onChange:x=>{s({remark:x.target.value})}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:a("team.passport.role"),select:!0,value:f.role,onChange:x=>{s({role:x.target.value})},variant:"outlined",children:l.filter(x=>x.name!=="owner").map(x=>e.jsx(ae,{value:x.name,"data-cy":`passport-role-select-option-${x.name}`,children:e.jsx("span",{children:x.title||x.name})},x.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Oe,{children:a("team.passport.ttl")}),e.jsxs(We,{color:"primary",size:"small",value:f.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(x,d)=>s({ttlPolicy:d}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(X,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(K,{title:a("team.passport.ttlNeverTip"),children:e.jsx(E,{children:a("team.passport.ttlNever")})})}),e.jsx(X,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(K,{title:a("team.passport.ttlMintTip"),children:e.jsx(E,{children:a("team.passport.ttlMint")})})}),e.jsx(X,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(K,{title:a("team.passport.ttlExchangeTip"),children:e.jsx(E,{children:a("team.passport.ttlExchange")})})})]}),f.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:f.ttl,onChange:x=>{s({ttl:x.target.value})}}),e.jsx(He,{children:a("team.passport.ttlTip")})]})]})]})})})}it.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedFactories:w.array,data:w.object};const rs=q.div`
|
|
111
111
|
.dialog-h1 {
|
|
112
112
|
font-size: 18px;
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
`;function Se({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedFactories:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(null),[n,c]=C.useState(""),y=async d=>{if(!f)try{s(!0),await i.configTrustedFactories({input:{teamDid:p,trustedFactories:m.filter(j=>j.factoryAddress!==d)}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(null)}catch(j){s(!1),R.error(j.message)}},x=m.filter(d=>!n||d.factoryAddress.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedFactories"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(is,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexGrow:1},children:[e.jsx(he,{copyable:!1,did:d.factoryAddress,size:16,showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",mr:"24px"},children:e.jsx(
|
|
122
|
+
`;function Se({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedFactories:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(null),[n,c]=C.useState(""),y=async d=>{if(!f)try{s(!0),await i.configTrustedFactories({input:{teamDid:p,trustedFactories:m.filter(j=>j.factoryAddress!==d)}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(null)}catch(j){s(!1),R.error(j.message)}},x=m.filter(d=>!n||d.factoryAddress.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedFactories"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(is,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexGrow:1},children:[e.jsx(he,{copyable:!1,did:d.factoryAddress,size:16,showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",mr:"24px"},children:e.jsx(It,{type:"success",children:d.passport.role})}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(W,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(oe,{})}),e.jsx(W,{"data-cy":"delete-trusted-factory",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.factoryAddress}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.factoryAddress),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.factoryAddress)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(it,{data:r.data,trustedFactories:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Se.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const as=G(Se,"mutate_team"),ns=G(Se,"",J);function os(u){const{inService:o}=k();return o?e.jsx(ns,{...u}):e.jsx(as,{...u})}const is=q.div`
|
|
123
123
|
.list {
|
|
124
124
|
.MuiIconButton-root {
|
|
125
125
|
svg {
|
|
@@ -132,7 +132,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
132
132
|
*
|
|
133
133
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
134
134
|
* @license MIT
|
|
135
|
-
*/var ue,Ne;function cs(){if(Ne)return ue;Ne=1,ue=function(i){return i!=null&&(u(i)||o(i)||!!i._isBuffer)};function u(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function o(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&u(i.slice(0,0))}return ue}var Le;function ds(){return Le||(Le=1,function(){var u=ls(),o=Fe().utf8,i=cs(),p=Fe().bin,m=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=p.stringToBytes(l):l=o.stringToBytes(l):i(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var a=u.bytesToWords(l),f=l.length*8,s=1732584193,r=-271733879,t=-1732584194,n=271733878,c=0;c<a.length;c++)a[c]=(a[c]<<8|a[c]>>>24)&16711935|(a[c]<<24|a[c]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var y=m._ff,x=m._gg,d=m._hh,j=m._ii,c=0;c<a.length;c+=16){var S=s,w=r,b=t,P=n;s=y(s,r,t,n,a[c+0],7,-680876936),n=y(n,s,r,t,a[c+1],12,-389564586),t=y(t,n,s,r,a[c+2],17,606105819),r=y(r,t,n,s,a[c+3],22,-1044525330),s=y(s,r,t,n,a[c+4],7,-176418897),n=y(n,s,r,t,a[c+5],12,1200080426),t=y(t,n,s,r,a[c+6],17,-1473231341),r=y(r,t,n,s,a[c+7],22,-45705983),s=y(s,r,t,n,a[c+8],7,1770035416),n=y(n,s,r,t,a[c+9],12,-1958414417),t=y(t,n,s,r,a[c+10],17,-42063),r=y(r,t,n,s,a[c+11],22,-1990404162),s=y(s,r,t,n,a[c+12],7,1804603682),n=y(n,s,r,t,a[c+13],12,-40341101),t=y(t,n,s,r,a[c+14],17,-1502002290),r=y(r,t,n,s,a[c+15],22,1236535329),s=x(s,r,t,n,a[c+1],5,-165796510),n=x(n,s,r,t,a[c+6],9,-1069501632),t=x(t,n,s,r,a[c+11],14,643717713),r=x(r,t,n,s,a[c+0],20,-373897302),s=x(s,r,t,n,a[c+5],5,-701558691),n=x(n,s,r,t,a[c+10],9,38016083),t=x(t,n,s,r,a[c+15],14,-660478335),r=x(r,t,n,s,a[c+4],20,-405537848),s=x(s,r,t,n,a[c+9],5,568446438),n=x(n,s,r,t,a[c+14],9,-1019803690),t=x(t,n,s,r,a[c+3],14,-187363961),r=x(r,t,n,s,a[c+8],20,1163531501),s=x(s,r,t,n,a[c+13],5,-1444681467),n=x(n,s,r,t,a[c+2],9,-51403784),t=x(t,n,s,r,a[c+7],14,1735328473),r=x(r,t,n,s,a[c+12],20,-1926607734),s=d(s,r,t,n,a[c+5],4,-378558),n=d(n,s,r,t,a[c+8],11,-2022574463),t=d(t,n,s,r,a[c+11],16,1839030562),r=d(r,t,n,s,a[c+14],23,-35309556),s=d(s,r,t,n,a[c+1],4,-1530992060),n=d(n,s,r,t,a[c+4],11,1272893353),t=d(t,n,s,r,a[c+7],16,-155497632),r=d(r,t,n,s,a[c+10],23,-1094730640),s=d(s,r,t,n,a[c+13],4,681279174),n=d(n,s,r,t,a[c+0],11,-358537222),t=d(t,n,s,r,a[c+3],16,-722521979),r=d(r,t,n,s,a[c+6],23,76029189),s=d(s,r,t,n,a[c+9],4,-640364487),n=d(n,s,r,t,a[c+12],11,-421815835),t=d(t,n,s,r,a[c+15],16,530742520),r=d(r,t,n,s,a[c+2],23,-995338651),s=j(s,r,t,n,a[c+0],6,-198630844),n=j(n,s,r,t,a[c+7],10,1126891415),t=j(t,n,s,r,a[c+14],15,-1416354905),r=j(r,t,n,s,a[c+5],21,-57434055),s=j(s,r,t,n,a[c+12],6,1700485571),n=j(n,s,r,t,a[c+3],10,-1894986606),t=j(t,n,s,r,a[c+10],15,-1051523),r=j(r,t,n,s,a[c+1],21,-2054922799),s=j(s,r,t,n,a[c+8],6,1873313359),n=j(n,s,r,t,a[c+15],10,-30611744),t=j(t,n,s,r,a[c+6],15,-1560198380),r=j(r,t,n,s,a[c+13],21,1309151649),s=j(s,r,t,n,a[c+4],6,-145523070),n=j(n,s,r,t,a[c+11],10,-1120210379),t=j(t,n,s,r,a[c+2],15,718787259),r=j(r,t,n,s,a[c+9],21,-343485551),s=s+S>>>0,r=r+w>>>0,t=t+b>>>0,n=n+P>>>0}return u.endian([s,r,t,n])};m._ff=function(l,h,a,f,s,r,t){var n=l+(h&a|~h&f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._gg=function(l,h,a,f,s,r,t){var n=l+(h&f|a&~f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._hh=function(l,h,a,f,s,r,t){var n=l+(h^a^f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._ii=function(l,h,a,f,s,r,t){var n=l+(a^(h|~f))+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._blocksize=16,m._digestsize=16,ce.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var a=u.wordsToBytes(m(l,h));return h&&h.asBytes?a:h&&h.asString?p.bytesToString(a):u.bytesToHex(a)}}()),ce.exports}var ps=ds();const us=Me(ps);function Te({teamDid:u,onCancel:o,onSuccess:i,onError:p=()=>{},mode:m="create",item:l={}}){const{api:h}=k(),[a,f]=C.useState(!1),[s,r]=C.useState(""),{t}=F(),[n,c]=C.useState(l.title||""),[y,x]=C.useState(l.description||""),[d,j]=C.useState(l?.extra?.display||"builtin"),[S,w]=C.useState(l?.extra?.types?l.extra.types.join(","):""),b=async()=>{const D=n.trim();if(!D){r(t("team.passport.error.titleEmpty"));return}if(D.length>64){r(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){r(t("team.passport.error.descriptionEmpty"));return}const V=m==="create"?us(D):l.name;r(null),f(!0);try{if(m==="create"){const z={teamDid:u,name:V,title:D,description:B};d==="custom"&&(z.extra=JSON.stringify({display:"custom",types:S.split(",")})),await h.createRole({input:z})}else{const z={teamDid:u,role:{name:V,title:D,description:B}};await h.updateRole({input:z})}i()}catch(z){const K=te(z);r(K),p(z)}finally{f(!1)}},P=e.jsxs("div",{children:[m==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx($,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:n,onChange:D=>{r(null),c(D.target.value)},disabled:m==="update"||a,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx($,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:D=>{r(null),x(D.target.value)},disabled:a,multiline:!0,rows:3})}),m==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Oe,{children:t("common.display")}),e.jsxs(We,{color:"primary",size:"small",value:d,exclusive:!0,style:{marginTop:16},disabled:a,onChange:(D,B)=>j(B),"data-cy":"input-role-display",children:[e.jsx(X,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(X,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),d==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:S,disabled:a,onChange:D=>{w(D.target.value)}}),e.jsx(He,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(H,{title:m==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{"data-cy":"mutate-role-confirm",onClick:b,color:"primary",disabled:a,variant:"contained",autoFocus:!0,children:[a&&e.jsx(M,{size:16}),t(m==="create"?"common.create":"common.update")]})]}),children:[e.jsx(yt,{component:"div",children:P}),!!s&&e.jsx(_e,{severity:"error",style:{width:"100%",margin:0},children:s})]})}Te.propTypes={teamDid:T.string.isRequired,onCancel:T.func.isRequired,onSuccess:T.func.isRequired,onError:T.func,mode:T.oneOf(["create","update"]),item:T.object};function we({onCancel:u,onSuccess:o,onDelete:i,roleName:p,hasPermission:m=!1}){const{api:l}=k(),{roles:h,permissions:a,teamDid:f,refresh:s,isNodeTeam:r}=_(),{t}=F(),[n,c]=C.useState([]),[y,x]=C.useState(!1),[d,j]=C.useState(null),[S,w]=C.useState(!1),b=Z(h.find(A=>A.name===p)),P=Ke(p),D=async A=>{if(!S)try{w(!0),await l.deleteRole({input:{teamDid:f,name:A}}),i()}catch(v){R.error(v.message)}finally{w(!1),j(null)}},B=async(A,v)=>{const N=(await l.getPermissionsByRole({input:{teamDid:A,role:{name:v}}})).permissions||[],O=a.map(De=>({...De,bind:N.some(pt=>pt.name===De.name)}));c(O)},V=async()=>{w(!0);const A=n.filter(v=>v.bind).map(v=>v.name);try{await l.updatePermissionsForRole({input:{teamDid:f,roleName:b.name,grantNames:A}}),R.success(t("common.saveSuccess")),o()}catch(v){R.error(te(v))}finally{w(!1)}};C.useEffect(()=>{f&&p&&B(f,p)},[f,p]);const z=r||!m;let K=null;return r&&(K=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:n.filter(A=>z?A.bind:!0).map(A=>e.jsx("div",{className:"item",children:e.jsx(jt,{control:e.jsx(vt,{disabled:z,checked:A.bind,onChange:()=>{c(v=>v.map(I=>(I.name===A.name&&(I.bind=!I.bind),I)))},name:A.name}),label:A.description})}))})]})),e.jsxs(H,{title:t("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:m&&!P&&e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:()=>x(b),"data-cy":`edit-passport-${b.name}`,size:"large",children:e.jsx(oe,{fill:"#bfbfbf"})}),e.jsx(W,{onClick:()=>j({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:b.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(b.name)},onCancel:()=>{w(!1),j(null)}}),"data-cy":`delete-passport-${b.name}`,size:"large",children:e.jsx(ie,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{onClick:V,color:"primary",disabled:S||!b,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[S&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(hs,{children:[!b&&e.jsx(gs,{children:e.jsx(M,{})}),b&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:b.title}),e.jsx("div",{className:"description",style:{marginTop:r?16:48},children:b.description})]}),K]})]}),y&&e.jsx(Te,{teamDid:f,onCancel:()=>x(null),onSuccess:()=>{x(null),s()},mode:"update",roleName:y.name,item:y}),d&&e.jsx(ve,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}const ms=G(we,"mutate_team"),fs=G(we,"",J);function xs(u){const{inService:o}=k();return o?e.jsx(fs,{...u}):e.jsx(ms,{...u})}we.propTypes={roleName:T.string.isRequired,onCancel:T.func.isRequired,onSuccess:T.func.isRequired,onDelete:T.func.isRequired,hasPermission:T.bool};const hs=q.div`
|
|
135
|
+
*/var ue,Ne;function cs(){if(Ne)return ue;Ne=1,ue=function(i){return i!=null&&(u(i)||o(i)||!!i._isBuffer)};function u(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function o(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&u(i.slice(0,0))}return ue}var Le;function ds(){return Le||(Le=1,function(){var u=ls(),o=Fe().utf8,i=cs(),p=Fe().bin,m=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=p.stringToBytes(l):l=o.stringToBytes(l):i(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var a=u.bytesToWords(l),f=l.length*8,s=1732584193,r=-271733879,t=-1732584194,n=271733878,c=0;c<a.length;c++)a[c]=(a[c]<<8|a[c]>>>24)&16711935|(a[c]<<24|a[c]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var y=m._ff,x=m._gg,d=m._hh,j=m._ii,c=0;c<a.length;c+=16){var S=s,T=r,b=t,P=n;s=y(s,r,t,n,a[c+0],7,-680876936),n=y(n,s,r,t,a[c+1],12,-389564586),t=y(t,n,s,r,a[c+2],17,606105819),r=y(r,t,n,s,a[c+3],22,-1044525330),s=y(s,r,t,n,a[c+4],7,-176418897),n=y(n,s,r,t,a[c+5],12,1200080426),t=y(t,n,s,r,a[c+6],17,-1473231341),r=y(r,t,n,s,a[c+7],22,-45705983),s=y(s,r,t,n,a[c+8],7,1770035416),n=y(n,s,r,t,a[c+9],12,-1958414417),t=y(t,n,s,r,a[c+10],17,-42063),r=y(r,t,n,s,a[c+11],22,-1990404162),s=y(s,r,t,n,a[c+12],7,1804603682),n=y(n,s,r,t,a[c+13],12,-40341101),t=y(t,n,s,r,a[c+14],17,-1502002290),r=y(r,t,n,s,a[c+15],22,1236535329),s=x(s,r,t,n,a[c+1],5,-165796510),n=x(n,s,r,t,a[c+6],9,-1069501632),t=x(t,n,s,r,a[c+11],14,643717713),r=x(r,t,n,s,a[c+0],20,-373897302),s=x(s,r,t,n,a[c+5],5,-701558691),n=x(n,s,r,t,a[c+10],9,38016083),t=x(t,n,s,r,a[c+15],14,-660478335),r=x(r,t,n,s,a[c+4],20,-405537848),s=x(s,r,t,n,a[c+9],5,568446438),n=x(n,s,r,t,a[c+14],9,-1019803690),t=x(t,n,s,r,a[c+3],14,-187363961),r=x(r,t,n,s,a[c+8],20,1163531501),s=x(s,r,t,n,a[c+13],5,-1444681467),n=x(n,s,r,t,a[c+2],9,-51403784),t=x(t,n,s,r,a[c+7],14,1735328473),r=x(r,t,n,s,a[c+12],20,-1926607734),s=d(s,r,t,n,a[c+5],4,-378558),n=d(n,s,r,t,a[c+8],11,-2022574463),t=d(t,n,s,r,a[c+11],16,1839030562),r=d(r,t,n,s,a[c+14],23,-35309556),s=d(s,r,t,n,a[c+1],4,-1530992060),n=d(n,s,r,t,a[c+4],11,1272893353),t=d(t,n,s,r,a[c+7],16,-155497632),r=d(r,t,n,s,a[c+10],23,-1094730640),s=d(s,r,t,n,a[c+13],4,681279174),n=d(n,s,r,t,a[c+0],11,-358537222),t=d(t,n,s,r,a[c+3],16,-722521979),r=d(r,t,n,s,a[c+6],23,76029189),s=d(s,r,t,n,a[c+9],4,-640364487),n=d(n,s,r,t,a[c+12],11,-421815835),t=d(t,n,s,r,a[c+15],16,530742520),r=d(r,t,n,s,a[c+2],23,-995338651),s=j(s,r,t,n,a[c+0],6,-198630844),n=j(n,s,r,t,a[c+7],10,1126891415),t=j(t,n,s,r,a[c+14],15,-1416354905),r=j(r,t,n,s,a[c+5],21,-57434055),s=j(s,r,t,n,a[c+12],6,1700485571),n=j(n,s,r,t,a[c+3],10,-1894986606),t=j(t,n,s,r,a[c+10],15,-1051523),r=j(r,t,n,s,a[c+1],21,-2054922799),s=j(s,r,t,n,a[c+8],6,1873313359),n=j(n,s,r,t,a[c+15],10,-30611744),t=j(t,n,s,r,a[c+6],15,-1560198380),r=j(r,t,n,s,a[c+13],21,1309151649),s=j(s,r,t,n,a[c+4],6,-145523070),n=j(n,s,r,t,a[c+11],10,-1120210379),t=j(t,n,s,r,a[c+2],15,718787259),r=j(r,t,n,s,a[c+9],21,-343485551),s=s+S>>>0,r=r+T>>>0,t=t+b>>>0,n=n+P>>>0}return u.endian([s,r,t,n])};m._ff=function(l,h,a,f,s,r,t){var n=l+(h&a|~h&f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._gg=function(l,h,a,f,s,r,t){var n=l+(h&f|a&~f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._hh=function(l,h,a,f,s,r,t){var n=l+(h^a^f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._ii=function(l,h,a,f,s,r,t){var n=l+(a^(h|~f))+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._blocksize=16,m._digestsize=16,ce.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var a=u.wordsToBytes(m(l,h));return h&&h.asBytes?a:h&&h.asString?p.bytesToString(a):u.bytesToHex(a)}}()),ce.exports}var ps=ds();const us=Me(ps);function we({teamDid:u,onCancel:o,onSuccess:i,onError:p=()=>{},mode:m="create",item:l={}}){const{api:h}=k(),[a,f]=C.useState(!1),[s,r]=C.useState(""),{t}=F(),[n,c]=C.useState(l.title||""),[y,x]=C.useState(l.description||""),[d,j]=C.useState(l?.extra?.display||"builtin"),[S,T]=C.useState(l?.extra?.types?l.extra.types.join(","):""),b=async()=>{const I=n.trim();if(!I){r(t("team.passport.error.titleEmpty"));return}if(I.length>64){r(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){r(t("team.passport.error.descriptionEmpty"));return}const V=m==="create"?us(I):l.name;r(null),f(!0);try{if(m==="create"){const z={teamDid:u,name:V,title:I,description:B};d==="custom"&&(z.extra=JSON.stringify({display:"custom",types:S.split(",")})),await h.createRole({input:z})}else{const z={teamDid:u,role:{name:V,title:I,description:B}};await h.updateRole({input:z})}i()}catch(z){const Y=te(z);r(Y),p(z)}finally{f(!1)}},P=e.jsxs("div",{children:[m==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx($,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:n,onChange:I=>{r(null),c(I.target.value)},disabled:m==="update"||a,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx($,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:I=>{r(null),x(I.target.value)},disabled:a,multiline:!0,rows:3})}),m==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Oe,{children:t("common.display")}),e.jsxs(We,{color:"primary",size:"small",value:d,exclusive:!0,style:{marginTop:16},disabled:a,onChange:(I,B)=>j(B),"data-cy":"input-role-display",children:[e.jsx(X,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(X,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),d==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:S,disabled:a,onChange:I=>{T(I.target.value)}}),e.jsx(He,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(H,{title:m==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{"data-cy":"mutate-role-confirm",onClick:b,color:"primary",disabled:a,variant:"contained",autoFocus:!0,children:[a&&e.jsx(M,{size:16}),t(m==="create"?"common.create":"common.update")]})]}),children:[e.jsx(yt,{component:"div",children:P}),!!s&&e.jsx(_e,{severity:"error",style:{width:"100%",margin:0},children:s})]})}we.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};function Te({onCancel:u,onSuccess:o,onDelete:i,roleName:p,hasPermission:m=!1}){const{api:l}=k(),{roles:h,permissions:a,teamDid:f,refresh:s,isNodeTeam:r}=_(),{t}=F(),[n,c]=C.useState([]),[y,x]=C.useState(!1),[d,j]=C.useState(null),[S,T]=C.useState(!1),b=Z(h.find(A=>A.name===p)),P=Ye(p),I=async A=>{if(!S)try{T(!0),await l.deleteRole({input:{teamDid:f,name:A}}),i()}catch(v){R.error(v.message)}finally{T(!1),j(null)}},B=async(A,v)=>{const N=(await l.getPermissionsByRole({input:{teamDid:A,role:{name:v}}})).permissions||[],O=a.map(Ie=>({...Ie,bind:N.some(pt=>pt.name===Ie.name)}));c(O)},V=async()=>{T(!0);const A=n.filter(v=>v.bind).map(v=>v.name);try{await l.updatePermissionsForRole({input:{teamDid:f,roleName:b.name,grantNames:A}}),R.success(t("common.saveSuccess")),o()}catch(v){R.error(te(v))}finally{T(!1)}};C.useEffect(()=>{f&&p&&B(f,p)},[f,p]);const z=r||!m;let Y=null;return r&&(Y=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:n.filter(A=>z?A.bind:!0).map(A=>e.jsx("div",{className:"item",children:e.jsx(jt,{control:e.jsx(vt,{disabled:z,checked:A.bind,onChange:()=>{c(v=>v.map(D=>(D.name===A.name&&(D.bind=!D.bind),D)))},name:A.name}),label:A.description})}))})]})),e.jsxs(H,{title:t("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:m&&!P&&e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:()=>x(b),"data-cy":`edit-passport-${b.name}`,size:"large",children:e.jsx(oe,{fill:"#bfbfbf"})}),e.jsx(W,{onClick:()=>j({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:b.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{I(b.name)},onCancel:()=>{T(!1),j(null)}}),"data-cy":`delete-passport-${b.name}`,size:"large",children:e.jsx(ie,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{onClick:V,color:"primary",disabled:S||!b,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[S&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(hs,{children:[!b&&e.jsx(gs,{children:e.jsx(M,{})}),b&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:b.title}),e.jsx("div",{className:"description",style:{marginTop:r?16:48},children:b.description})]}),Y]})]}),y&&e.jsx(we,{teamDid:f,onCancel:()=>x(null),onSuccess:()=>{x(null),s()},mode:"update",roleName:y.name,item:y}),d&&e.jsx(ve,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}const ms=G(Te,"mutate_team"),fs=G(Te,"",J);function xs(u){const{inService:o}=k();return o?e.jsx(fs,{...u}):e.jsx(ms,{...u})}Te.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};const hs=q.div`
|
|
136
136
|
.header {
|
|
137
137
|
.title {
|
|
138
138
|
font-weight: 400;
|
|
@@ -181,7 +181,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
181
181
|
justify-content: center;
|
|
182
182
|
align-items: center;
|
|
183
183
|
height: 200px;
|
|
184
|
-
`,Be=C.memo(({field:u,value:o,copyable:i})=>{const{local:p}=F();return o?e.jsxs(g,{onClick:m=>m.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?e.jsxs(
|
|
184
|
+
`,Be=C.memo(({field:u,value:o,copyable:i})=>{const{local:p}=F();return o?e.jsxs(g,{onClick:m=>m.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?e.jsxs(De,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,e.jsx(De,{variant:"body1",children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(K,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),i?e.jsx(Dt,{content:Wt(o),locale:p,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function lt({createPassportSvg:u}){const{inService:o}=k(),{roles:i,teamIssuerDid:p,teamName:m,refresh:l,passportColor:h,teamDid:a,isNodeTeam:f}=_(),{t:s}=F(),[r,t]=C.useState(!1),[n,c]=C.useState(!1),y=Ct(d=>d.breakpoints.down("md")),x=C.useCallback(d=>d&&!U.ROLES[d.toUpperCase()],[]);return e.jsxs(ys,{sx:{mt:0},children:[e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end"},children:!f&&e.jsxs(bt,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),s("team.passport.create.title")]})}),e.jsx(g,{className:"list",children:i.map(d=>e.jsxs(g,{"data-cy":`passport-${d.name}`,className:"item",onClick:()=>c(d),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:u({title:d.title,issuer:m,issuerDid:p,ownerName:"Your Name",ownerDid:p,preferredColor:h,width:"150px"})}}),e.jsxs(g,{className:"title",sx:{ml:3},children:[e.jsx(Be,{value:d.title}),x(d.name)?e.jsx(Be,{value:d.name,copyable:!0}):null]})]}),!y&&e.jsx(g,{className:"description",children:d.description}),e.jsx(Je,{permission:o?"":"mutate_team",role:o?J:[],children:e.jsx("div",{className:"action",children:Ye(d.name)?e.jsx(Ht,{}):e.jsx(oe,{})})})]},d.name))}),n&&e.jsx(xs,{onCancel:()=>c(!1),onSuccess:()=>{c(!1),l()},onDelete:()=>{c(!1),l()},mode:"update",roleName:n.name,item:n}),r&&e.jsx(we,{teamDid:a,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const ys=q(g)`
|
|
185
185
|
.list {
|
|
186
186
|
.item {
|
|
187
187
|
padding: 12px;
|
|
@@ -219,7 +219,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
219
219
|
fill: ${({theme:u})=>u.palette.text.secondary};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
`;lt.propTypes={createPassportSvg:
|
|
222
|
+
`;lt.propTypes={createPassportSvg:w.func.isRequired};function ct({createPassportSvg:u}){const{t:o}=F(),{api:i,inService:p}=k(),{teamDid:m,refresh:l,enablePassportIssuance:h,isNodeTeam:a}=_(),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(!1),[y,x]=C.useState(!1),[d,j]=C.useState(!1),S=async T=>{if(T.stopPropagation(),!y){x(!0);try{await i.configPassportIssuance({input:{teamDid:m,enable:!h}}),l(),await se(800),R.success(o("common.configSuccess"))}catch(b){R.error(b.message)}finally{x(!1)}}};return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[e.jsx(Je,{permission:p?"":"mutate_team",role:p?J:[],children:e.jsx(Q,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(Q.Item,{onClick:()=>t(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(g,{children:[o("team.passport.trustedPassportIssuers"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(Q.Item,{onClick:()=>c(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(g,{children:[o("team.passport.configFactories"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configFactoriesTip")})]})}),e.jsx(Q.Item,{"data-cy":"config-show-issue-passport",onClick:S,children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[y&&e.jsx(M,{size:16,style:{marginRight:8}}),e.jsxs(g,{children:[o(h?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o(h?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!a&&e.jsx(Q.Item,{onClick:()=>s(!0),"data-cy":"config-passport-color",children:e.jsxs(g,{children:[o("team.passport.configColor"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(L,{variant:"outlined",onClick:()=>{j(!0)},children:o("team.passport.view")})})}),r&&e.jsx(es,{onCancel:()=>t(!1)}),n&&e.jsx(os,{onCancel:()=>c(!1)}),f&&e.jsx(Kt,{onCancel:()=>s(!1),onSuccess:()=>s(!1)}),d&&e.jsx(H,{open:!0,maxWidth:"lg",onClose:()=>j(!1),onBackdropClick:()=>j(!1),onEscapeKeyDown:()=>j(!1),title:o("team.passport.view"),children:e.jsx(lt,{createPassportSvg:u,onCancel:()=>j(!1)})})]})}ct.propTypes={createPassportSvg:w.func.isRequired};const ze="$all",Ee="",dt=ut.memo(({createPassportSvg:u,passport:o,teamDid:i,inService:p})=>e.jsx(g,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,i,p):"",revoked:o.revoked,width:"36px",extra:o?.expirationDate?{key:"Exp",value:Ve(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}));dt.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired,teamDid:w.string.isRequired,inService:w.bool.isRequired};function js({createPassportSvg:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),{SYSTEM_ROLES:l}=zt(),{inService:h}=k(),[a,f]=C.useState(!1),s=`passports-${i}`,r=Pt(s),[t,n]=C.useState({role:ze,status:Ee,searchText:r.searchText||"",pageSize:r.rowsPerPage||10,page:r.page?r.page+1:1}),{data:c,loading:y}=re(async()=>(await o.getPassportRoleCounts({input:{teamDid:i}})).counts||[],{refreshDeps:[i]}),{data:x,loading:d}=re(async()=>{const v={};t.role!==ze&&(v.role=t.role),t.status&&(v.status=t.status);const D=await o.getPassportsByRole({input:{teamDid:i,query:v,paging:{page:t.page,pageSize:t.pageSize}}});return{passports:D.passports||[],total:D.paging.total}},{refreshDeps:[t.role,t.status,t.page,t.pageSize],onError:v=>R.error(v.message)}),j=v=>c?.find(N=>N.key===v)?.value||0,S=C.useMemo(()=>Object.keys(l).map(v=>({name:v,title:l[v],num:j(v)})),[c,j]),T=C.useMemo(()=>[{label:p("team.passport.role"),name:"role",options:{customBodyRender:(v,{rowIndex:D})=>{const N=x?.passports[D];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(dt,{createPassportSvg:u,passport:N,teamDid:i}),e.jsx(g,{children:ge(N.title)})]})}}},{label:p("team.passport.owner"),name:"user",options:{customBodyRender:v=>ye(v,h)}},{label:p("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:p("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:v=>Ke(v,m)}},{label:p("common.address"),name:"id",options:{customBodyRender:Et}},{label:p("blocklet.overview.source"),name:"source",options:{customBodyRender:(v,{rowIndex:D})=>{const N=x?.passports[D];return N.parentDid?ne("recover"):ne(N.source)}}}],[p,m,x?.passports,i,u,h]),b=v=>{n(D=>({...D,role:v,page:1}))},P=({page:v,rowsPerPage:D,searchText:N})=>{t.pageSize!==D?n(O=>({...O,searchText:"",pageSize:D,page:1})):t.page!==v+1?n(O=>({...O,searchText:"",page:v+1})):t.searchText!==N&&n(O=>({...O,searchText:N,page:1}))},I=C.useRef(null),B=x?.passports||[],V=t.searchText?B.filter(v=>v.id.includes(t.searchText)||(v?.user?.fullName||"").includes(t.searchText)):B,z={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(v,{dataIndex:D},N){if(I.current?.contains(N.target)){const O=x?.passports[D];f(O)}},page:t.page-1,rowsPerPage:t.pageSize,count:x?.total||0,searchDebounceTime:600},Y=v=>{n(D=>({...D,status:v.target.value,page:1}))},A=e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(g,{sx:{fontSize:16,fontWeight:400},children:[p("team.passport.status"),":"]}),e.jsxs(St,{size:"small",value:t.status,onChange:Y,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(ae,{value:Ee,children:p("common.all")}),Object.values(U.PASSPORT_STATUS).map(v=>e.jsx(ae,{value:v,sx:{py:1},children:p(`team.passport.statusMap.${v}`)},v))]})]});return y?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(vs,{children:[e.jsxs(g,{className:"main",sx:{display:"flex",mt:0,gap:3},children:[e.jsx(g,{className:"left",children:e.jsx(g,{className:"tabs",children:S.map(v=>e.jsxs(g,{className:`tab ${t.role===v.name?"active":""}`,onClick:()=>b(v.name),children:[e.jsx("span",{className:"text",children:v.title}),e.jsx(g,{sx:{color:"text.secondary"},children:v.num})]},v.name))})}),e.jsx(g,{ref:I,className:"right",children:e.jsx(fe,{className:"main-table",verticalKeyWidth:100,locale:m,durable:s,durableKeys:["page","rowsPerPage"],data:V,columns:T,options:z,loading:d,onChange:P,customButtons:[e.jsx(ct,{createPassportSvg:u})],title:A})})]}),a&&e.jsx(Xe,{createPassportSvg:u,onCancel:()=>f(null),passport:a,onSwitchPassport:f})]})}js.propTypes={createPassportSvg:w.func.isRequired};const vs=wt(g)`
|
|
223
223
|
.main {
|
|
224
224
|
.left {
|
|
225
225
|
width: 256px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-
|
|
1
|
+
import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-BIZOanxj.js";import{T as f}from"./vendor-ux-Cfhaj-oj.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-CjATIX5e.js";import"./vendor-utils-CVwaKsP9.js";import"./vendor-hooks-BtDnIwBH.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BhtOu00C.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,T as i}from"./vendor-mui-core-
|
|
1
|
+
import{j as e,T as i}from"./vendor-mui-core-BIZOanxj.js";import{K as p,L as c}from"./vendor-utils-CVwaKsP9.js";import{l as x}from"./vendor-ux-Cfhaj-oj.js";function y({name:t,nameFormatter:r=o=>typeof o=="string"?o.split(" ").map(f=>p(c(f))).join(" "):o,layout:n="horizontal",children:a,valueComponent:l="div",nameWidth:m=90,...s}){return e.jsxs(d,{layout:n,width:m,...s,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:r(t)}),a&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:a})]})}const d=x("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
|
|
4
4
|
justify-content: flex-start;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Q,b6 as me,be as Ke,y as V,am as ut,c_ as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,c$ as pt,b5 as qe,a5 as Me,Q as Fe,d0 as Ye,aN as Ue,a6 as ft,D as ht,d1 as qt,ad as xt,d2 as Mt,d3 as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cv as Gt,I as Yt,d4 as Jt}from"./vendor-mui-core-BIZOanxj.js";import{A as gt,J as Xt,C as Qt,e as le,F as Zt,a3 as je}from"./vendor-utils-CVwaKsP9.js";import{T as te,H as M,n as ce,c as en,j as bt,a3 as tn,au as nn,m as jt,$ as vt,P as yt,av as Ae,b as St,G as sn,a0 as an}from"./vendor-ux-Cfhaj-oj.js";import{aD as rn,Y as Je,a7 as Ct,aX as wt,K as _e,c as _,ao as Z,p as on,aM as at}from"./index-CjATIX5e.js";import{g as ye,b as $,a as se}from"./vendor-hooks-BtDnIwBH.js";import{u as Rt,C as J}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-BkRG9xZw.js";import{S as X}from"./section-CCfmWVdK.js";import{A as ln,a as cn,b as dn}from"./collapse-DhGi244c.js";import{S as Se}from"./shorten-label-DAXPWCI6.js";import{v as Tt}from"./index-DbXxI_D0.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-CoRNWpJL.js";import{j as hn,c as xn,N as gn}from"./team-CxJqHuEA.js";import{W as bn}from"./did-address-CeTjTMC4.js";import{p as It}from"./util-BKRDkFNf.js";import{D as jn,g as vn}from"./traffic-BuZd517Z.js";import{B as Et}from"./bundle-avatar-BrBIjq4r.js";import{u as yn}from"./use-mobile-BW9mTiYC.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BhtOu00C.js";import"./required-BUAaYcMZ.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-BC0KaiLK.js";import"./session-p360wpOR.js";import"./use-app-logo-BiGG8tCg.js";import"./base32-CgLd9kUN.js";import"./useAsyncRetry-DNTidBXG.js";import"./useAsync-DkQHu4t4.js";import"./iframe-eYdxV3eX.js";import"./index-C_YGTMJ4.js";import"./index-DBs9Ljax.js";import"./base-chart-BbbiwJIa.js";import"./index-Dr9NaKfR.js";import"./vendor-mui-x-DWX99wt-.js";import"./AdapterDayjs-CAaLcejt.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function wn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var Rn=wn();const Tn=Wt(Rn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Je(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver=localStorage.getItem("test-receiver")||"",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await G(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),w=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),K=$(a=>a?.trim()?!0:t("notification.email.userRequired")),q=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),R=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(J,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(J,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(J,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(J,{name:"port",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(J,{name:"user",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(J,{name:"password",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(J,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(J,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(J,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(J,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(J,{name:"supportEmail",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Je(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(w,K,q=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:w})}}),R=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(R),q&&M.success(t("oauth.saveSuccess"))}catch(f){if(q)M.error(f.message||t("oauth.saveFailed"));else throw f}}),G=$(async(w,K)=>{try{i.isDirty&&await E(w,K,!1);const q=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Qt(q,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),R={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(R)}}),M.success(t("notification.pushKit.testSuccess"))}catch(q){M.error(q.message||t("notification.pushKit.testfailed"))}}),z=$((w,K)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:q=>{S.testReceiver=q.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(q){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await G(w,K),q()}})}),F=$(w=>{const K=w?.trim();return K?He(K)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(kn,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(J,{name:"enabled",control:p,render:({field:w})=>e.jsx(me,{control:e.jsx(Ke,{checked:w.value,...w})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(J,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(J,{name:"did",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})}),e.jsx(J,{name:"pushPath",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const kn=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function An(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const kt=v.createContext({}),{Provider:On,Consumer:Ws}=kt;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Je(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),G=async({page:f=1,pageSize:R=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:R},...C,teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const R=s.children.find(C=>C.meta?.did===f);if(R)return R.ancestors=[s],R},[s]),B=async({notificationId:f,receivers:R,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:R,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},w=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f},options:{enableConnectedAccount:!0}}})).user,[t,i]),K=v.useCallback(async({page:f=1,pageSize:R=20,...C}={})=>{try{const a={paging:{page:f,pageSize:R},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&G(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||G(S)},[E,S]);const q={fetch:G,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:w,componentDids:N,getReceivers:K,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:q},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(kt);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function At(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:Ot(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],ke=(n=[])=>{const s=Z().startOf("day");return n.filter(t=>Z(t.sendAt).isSame(s,"day")).length},Kn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return ke(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return ke(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=ke(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=ke(b);o[l]=u}),o},Oe=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},qn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=At(r,o,{status:l});return e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Qe.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Qe({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Qe,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=At(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ye,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:h.array.isRequired,onChange:h.func};function Ze({value:n,onChange:s}){const{locale:t}=te(),r=Z().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Z(i.startDate).isAfter(i.endDate)||!Z(i.startDate).isValid()||!Z(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Ge,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{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}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,G]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,w]=v.useState(null),[K,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,R]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],O=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));G(d),q(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ye,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:K.page-1,rowsPerPage:K.pageSize,count:K.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],Y=[]]=A;f.pageSize!==d?R(H=>({...H,pageSize:d,page:1})):f.page!==c+1?R(H=>({...H,page:c+1})):f.searchText!==m?R(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(Y,f.emailSendStatus)||R(H=>({...H,emailSendStatus:Y,page:1})):R(H=>({...H,pushKitSendStatus:ne,page:1})):R(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),we=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,w(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(A=>E[A].receiver);await g(c,m,d),await Ee(.5),he(),a([])},k=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(A){M.error(A.response?A.response.statusText:A.message)}},L=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await k(d,A,U);return}if(c){const Y=c.currentTarget,H=Y.getBoundingClientRect();z.anchorEl=Y,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}w({channel:m});try{const Y=await pe(m,d.receiver);await Ee(1),w({channel:m,result:Y}),(typeof Y=="boolean"&&Y||Zt(Y)&&Object.values(Y).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(Y){M.error(Y.message)}},W=c=>{R(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);R(ne=>({...ne,[A]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:Y=>L(Y,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),Re=[e.jsx(Ze,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>O(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:Re,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(B?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?Ae.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:Ae.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
|
|
2
|
+
td.MuiTableCell-footer {
|
|
3
|
+
border: none !important;
|
|
4
|
+
}
|
|
5
|
+
.sent-status-cell {
|
|
6
|
+
.resend-btn {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
&:hover {
|
|
10
|
+
.resend-btn {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,$n=ae.div`
|
|
16
|
+
padding: 8px 16px;
|
|
17
|
+
.check-title {
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
margin-bottom: 8px;
|
|
20
|
+
&::first-letter {
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.check-item {
|
|
25
|
+
svg {
|
|
26
|
+
font-size: 16px;
|
|
27
|
+
}
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
}
|
|
30
|
+
`,ve=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function Vn(n){const{wallet:s,push:t,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(ge,{item:s})},{name:"Push",value:e.jsx(ge,{item:t})},{name:"Email",value:e.jsx(ge,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(ge,{item:o,isWebhook:!0})}]:[]]}function Gn(n,s,t){const{wallet:r,push:o,email:l,webhook:b}=n;return[{name:"Wallet",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}nt.propTypes={statistics:h.object.isRequired,onResend:h.func,mode:h.oneOf(["simple","detail"]),resending:h.bool};ge.propTypes={item:h.object.isRequired,isWebhook:h.bool};function ge({item:n,isWebhook:s=!1}){const{t}=te(),r=s?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(y,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[ve(r)," / ",ve(o)," ",t("notification.sendStatus.success")]})})})}be.propTypes={item:h.object.isRequired,isWebhook:h.bool,channel:h.string,onResend:h.func,loading:h.bool};function be({channel:n=_.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:t=!1,onResend:r=()=>{},loading:o=!1}){const{t:l}=te(),{success:b,failed:u,pending:p}=s,i=qn(n),N=t?b.length:b,I=t?u.length:u,S=t?p.length:p,j=async F=>{F.stopPropagation();const B=t?[...new Set([...b,...u].map(w=>w))]:[];await r([n],[],!0,B)},E=N+I,G=E>0?N/E*100:0,z=E>0?I/E*100:0;return e.jsxs(Yn,{successRatio:G,failedRatio:z,children:[e.jsxs(ee,{variant:"h6",children:[i," (",s.total,")"]}),e.jsxs(ee,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:$e.success,fontWeight:600,fontSize:24},children:ve(N)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(y,{className:"unsent-area",children:[e.jsxs(y,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[ve(I)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[ve(S)," ",l("notification.sendStatus.pending")]})]}),I>0&&e.jsx(y,{className:"resend-btn",children:e.jsx(ce,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(Ye,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:j,children:l("notification.resend")})})]})]})}function nt({statistics:n,mode:s="simple",onResend:t=()=>{},resending:r=!1}){const o=se(()=>s==="simple"?Vn(n):Gn(n,t,r),[n,s]);return s==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(st,{container:!0,spacing:2,children:o.map(l=>e.jsx(st,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const Yn=ae(y)`
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: flex-start;
|
|
34
|
+
padding: 16px;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background: ${({successRatio:n,failedRatio:s,theme:t})=>n===0&&s===0?t.palette.grey[300]:`linear-gradient(to right, ${Ht(t.palette.success.light,.4)} ${n}%, ${t.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
|
+
`;_t.propTypes={notification:h.object.isRequired,onCancel:h.func,blocklet:h.object.isRequired,tab:h.string};function _t({notification:n,onCancel:s=()=>{},blocklet:t,tab:r="info"}){const{t:o,locale:l}=te(),{getComponent:b,resendNotification:u}=Xe(),[p,i]=v.useState(!1),N=se(()=>b(n.componentDid)||t,[t,n.componentDid]),I=ye({tab:r||"info"}),S=v.useCallback(async(f,R,C=!0,a=[])=>{if(!f.length||!n.id)return;const T=R.length>0?R:n?.receivers?.map(D=>D.receiver);if(!T.length)return;let O=[...f];if(O.includes(_.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),O=O.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.PUSH)),O.includes(_.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Ot(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),O=O.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!O.length)try{i(!0),await u({notificationId:n.id,receivers:T,channels:O,resendFailedOnly:C,...O.includes("webhook")&&a.length?{webhookUrls:a}:{}}),M.success("Message has been sent!")}catch(D){console.error("handleResend error",{error:D}),M.error(D.response?D.response.statusText:D.message)}finally{i(!1)}},[t,n.id,n?.receivers,u,o]),j=se(()=>hn(n),[n]),E=se(()=>xn(n),[n]),G=se(()=>j?n?.actorInfo:[],[n]),z=se(()=>t?.did||t?.meta?.did||"",[t]);function F(){return[{name:o("notification.from"),value:j&&E?e.jsx(un,{actors:G,teamDid:z,size:32,showName:!0}):e.jsx(mn,{size:32,blocklet:N,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Se,{maxLength:50,children:n.title})},{name:o("notification.body"),value:j?e.jsx(pn,{notification:n,blocklet:t}):e.jsx(gn,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ce,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(sn,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(R=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:R.name,children:R.value},R.name))}const B={info:{label:o("common.basicInfo"),value:"info",component:F},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},w=Object.values(B).map(({label:f,value:R})=>({label:f,value:R})),K=B[I.tab]||B.info,q=f=>{I.tab=f};return e.jsx(St,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{I.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(Xn,{children:[e.jsx(y,{className:"tabs",sx:{mx:3},children:e.jsx(bt,{tabs:w,current:I.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[I.tab==="receivers"&&e.jsx(Un,{notificationId:n.id,resending:p,handleResend:S}),I.tab==="statistics"&&e.jsx(nt,{statistics:n.statistics,mode:"detail",resending:p,onResend:S}),I.tab==="info"&&e.jsx(K.component,{})]})]})})}const Jn=v.memo(_t),Xn=ae.div`
|
|
49
|
+
& > .notification-row {
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.tabs {
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
.body {
|
|
57
|
+
margin-top: 16px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.channel-item {
|
|
61
|
+
display: flex;
|
|
62
|
+
padding: 4px;
|
|
63
|
+
justify-content: flex-start;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
> p {
|
|
67
|
+
font-size: 15px;
|
|
68
|
+
}
|
|
69
|
+
.resend-btn {
|
|
70
|
+
svg {
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
}
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
&.disabled {
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
color: ${Ae.text.disabled};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;Pe.propTypes={blocklet:h.object,label:h.string};const Qn=ae.div`
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-items: flex-start;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
.name {
|
|
89
|
+
display: block;
|
|
90
|
+
max-width: 260px;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
}
|
|
95
|
+
`;function Pe({blocklet:n=null,label:s=""}){return e.jsx(Qn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Et,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||n.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}zt.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function zt({list:n,label:s,onDelete:t=()=>{}}){return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(r=>e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(Ce,{severity:r})}),onDelete:o=>t(o,r)},r))]})}function Zn(n){return e.jsx(Qe,{...n,renderLabel:s=>e.jsx(Ce,{severity:s})})}function es({customTableButtons:n}){const{t:s,locale:t}=te(),r=ht(),o=v.useMemo(()=>jt(r,Lt()),[r]),[l,b]=v.useState(!1),{data:u,paging:p,blocklet:i,fetch:N,getComponent:I,componentDids:S,inService:j,teamDid:E}=Xe(),G=v.useRef(null),[z,F]=v.useState(null),[B,w]=v.useState("info"),K=yn(),[q,f]=v.useState(!1),R=`notification-records-${i.meta?.did}`,C=an(R),[a,T]=v.useState({pageSize:C.rowsPerPage||10,page:C.page?C.page+1:1,dids:C.dids||[],dateRange:C.dateRange||[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),O=se(()=>{if(!i.children||!i.children.length)return[];const g=[];return i.children.forEach(x=>{const k=x.did||x.meta?.did;S.includes(k)&&(x.ancestors=[i],g.push(x))}),g},[S,i]),D=async g=>{try{b(!0),await N(g),b(!1)}finally{b(!1)}};v.useEffect(()=>{D(a)},[a]),v.useEffect(()=>{const g=u.find(x=>x.id===z?.id);z&&g&&F({...g})},[u]);const re=(g,x,k,L)=>{g.stopPropagation();const W=k.filter(P=>P!==x);T(P=>({...P,[L]:W,page:1}))},ue=({page:g,rowsPerPage:x,filterList:k})=>{const[L=[],,,,W=[]]=k;a.pageSize!==x?T(P=>({...P,pageSize:x,page:1})):a.page!==g+1?T(P=>({...P,page:g+1})):je(a.dids,L)?je(a.severities,W)||T(P=>({...P,severities:W,page:1})):T(P=>({...P,dids:L,page:1}))},oe=v.useCallback(()=>{F(null),w("info")},[]),pe=v.useCallback(()=>{N(a)},[N,a]),we=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:g=>g.map((x,k)=>{if(x==="system")return e.jsx("span",{children:s("notification.system")},`system-${k}`);const L=O.find(W=>(W.did||W.meta?.did)===x);return e.jsx(Pe,{blocklet:L,label:L?.title||L?.meta?.title},x)}),update:(g,x,k)=>(g[k].splice(x,1),g)},filterOptions:{names:O,logic:(g,x)=>x.length?!x.includes(g):!1,display:(g,x,k,L)=>e.jsxs(V,{style:{width:"380px"},children:[e.jsx($t,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Vt,{multiple:!0,value:g[k],renderValue:W=>e.jsx(y,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:W.map(P=>{if(P==="system")return e.jsx("span",{children:s("notification.system")},P);const ie=O.find(Re=>(Re.did||Re.meta?.did)===P);return e.jsx(Pe,{blocklet:ie,label:ie?.title||ie?.meta?.title},P)})}),onChange:W=>{g[k]=W.target.value,x(g[k],k,L)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),O.map(W=>{const P=W.did||W.meta?.did;return e.jsx(it,{value:P,children:e.jsx(Pe,{blocklet:W,label:W.title||W.meta?.title})},P)})]})]})},customBodyRenderLite:g=>{const x=u[g],k=I(x.componentDid);return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[k?e.jsx(Et,{size:32,blocklet:k,ancestors:k.ancestors??[]}):e.jsx(fn,{blocklet:i,size:32}),e.jsx(Se,{maxLength:50,children:k?.meta?.title||i?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g],{receivers:k}=x;return e.jsx(Gt,{total:k.length,renderSurplus:L=>L<100?e.jsxs("span",{children:["+",L]}):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:L=>{L.stopPropagation(),F(x),w("receivers")},children:k.map(L=>{const{receiverUser:W}=L,P=It(W.avatar,E,j);return e.jsx(vt,{alt:W.fullName,src:`${P}?imageFilter=resize&w=48&h=48`,size:32,did:L.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},L.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(y,{onClick:k=>{k.stopPropagation(),F(x),w("statistics")},children:e.jsx(nt,{statistics:x.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(Se,{maxLength:50,children:x.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:g=>{const x=u[g];return e.jsx(Ce,{severity:x.severity})},filter:!0,filterType:"custom",filterList:a.severities??[],customFilterListOptions:{render:g=>e.jsx(zt,{list:g,label:s("notification.severity"),onDelete:(x,k)=>{x.stopPropagation(),re(x,k,we[4].options.filterList,"severities")}}),update:Oe},filterOptions:{names:dt,fullWidth:!0,logic:De,display:(g,x,k,L)=>e.jsx(Zn,{label:s("notification.severity"),filterList:g,onChange:x,index:k,column:L,filterValues:dt})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:g=>{const{createdAt:x}=u[g];return e.jsx(Nt,{value:x,locale:t,shouldUpdate:!0})}}}],fe=g=>{T(x=>({...x,dateRange:g,page:1}))},he=[e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[e.jsx(Yt,{onClick:()=>f(!0),sx:{p:K?0:void 0},children:e.jsx(Jt,{})},"settings"),K?e.jsx(ee,{children:s("common.setting")}):null]}),...n||[]];return e.jsxs(y,{ref:G,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ts,{children:e.jsx(xt,{theme:o,children:e.jsx(yt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:t,columns:we,data:u,durable:R,onChange:ue,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:p.page-1,rowsPerPage:p.pageSize,count:p.total,...C,onRowClick:(g,{dataIndex:x})=>{F(u[x])}},customPreButtons:[e.jsx(Ze,{value:a.dateRange,onChange:fe})],customButtons:he,components:{TableFilterList:g=>e.jsx(et,{...g,itemComponent:x=>e.jsx(tt,{...x,canDelete:k=>k?.columnNames?.[k?.index||0]?.name==="sender"})})}})})}),z&&e.jsx(Jn,{refresh:pe,onCancel:oe,notification:z,blocklet:i,tab:B}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:q,onClose:()=>f(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(y,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(An,{})})})]})}const ts=ae.div`
|
|
96
|
+
td.MuiTableCell-footer {
|
|
97
|
+
border: none !important;
|
|
98
|
+
}
|
|
99
|
+
.sent-status-cell {
|
|
100
|
+
.resend-btn {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
&:hover {
|
|
104
|
+
.resend-btn {
|
|
105
|
+
display: flex;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.custom-toobar-btns {
|
|
111
|
+
gap: 4px;
|
|
112
|
+
}
|
|
113
|
+
`;ns.propTypes={blocklet:h.object.isRequired,customTableButtons:h.array};function ns({blocklet:n={},customTableButtons:s=[]}){return e.jsx(Dn,{blocklet:n,children:e.jsx(es,{customTableButtons:s})})}export{ns as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as oT,E as $m,F as Xm,G as Zm}from"./vendor-hooks-BtDnIwBH.js";import{B as qm}from"./vendor-utils-CVwaKsP9.js";import{g as jL,a as JL,r as QL}from"./vendor-react-Dvs43sk9.js";/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|