@abtnode/webapp 1.16.45-beta-20250609-111118-0d252ebe → 1.16.45-beta-20250610-112229-2eb0face
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/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/dist/assets/{AdapterDayjs-BqwbfR-J.js → AdapterDayjs-DAz3KrnL.js} +1 -1
- package/dist/assets/{Add-CSGWebd7.js → Add-BvcTJL6g.js} +1 -1
- package/dist/assets/{ArrowDropDown-BCCxOUNE.js → ArrowDropDown-lSBhitmG.js} +1 -1
- package/dist/assets/{Autocomplete-BRFoT1-d.js → Autocomplete-DPEAys5B.js} +1 -1
- package/dist/assets/{Breadcrumbs-B-xYTnoc.js → Breadcrumbs-CCANSAXq.js} +1 -1
- package/dist/assets/{ButtonGroup-ClVwTb7r.js → ButtonGroup-8JIPxBFt.js} +1 -1
- package/dist/assets/{CSSTransition-DpoNbm4c.js → CSSTransition-CrBmaRu0.js} +1 -1
- package/dist/assets/{CallMerge-weq4zXp-.js → CallMerge-ChAxopdM.js} +1 -1
- package/dist/assets/{CardContent-CTAfwoUe.js → CardContent-BQOdBMgK.js} +1 -1
- package/dist/assets/{ChevronLeft-DQK-aqqz.js → ChevronLeft-CQivGJHk.js} +1 -1
- package/dist/assets/{ChevronRight-BtkdX9A9.js → ChevronRight-BlhG3yZY.js} +1 -1
- package/dist/assets/{Clear-D0I7uWhD.js → Clear-9k4hE_iq.js} +1 -1
- package/dist/assets/{Close-6CxneLlA.js → Close-aI0rARqu.js} +1 -1
- package/dist/assets/{Community-v2_SoLAO.js → Community-BX8y7YvB.js} +1 -1
- package/dist/assets/{Delete-P4B2dduO.js → Delete-EgRRDgvd.js} +1 -1
- package/dist/assets/{DeleteOutline-EQ9bHspP.js → DeleteOutline-Ja8iJJm1.js} +1 -1
- package/dist/assets/{Done-2EsU1aO2.js → Done-yL7tHkLt.js} +1 -1
- package/dist/assets/{Edit-frf3Fbx4.js → Edit-WOZnUVvS.js} +1 -1
- package/dist/assets/{ErrorOutline-a1DnwqoR.js → ErrorOutline-BjAyvxx4.js} +1 -1
- package/dist/assets/{HelpOutline-CBv7x3VM.js → HelpOutline-BmFBsSz3.js} +1 -1
- package/dist/assets/{Holiday-CM3JD4xm.js → Holiday-BwHFmcPg.js} +1 -1
- package/dist/assets/{Launch-B7fv6nTK.js → Launch-DHV3U2Y3.js} +1 -1
- package/dist/assets/{Link-CiUEO3cQ.js → Link-C4RjtlPw.js} +1 -1
- package/dist/assets/{ListItemButton-ByIRcZGW.js → ListItemButton-CS_u4xql.js} +1 -1
- package/dist/assets/{ListSubheader-Yn3XMnVm.js → ListSubheader-C-e_2m7m.js} +1 -1
- package/dist/assets/{LoadingButton-B3es9INs.js → LoadingButton-bxrmduDd.js} +1 -1
- package/dist/assets/{LockIcon-C1gL9Uz4.js → LockIcon--YdvMZNM.js} +1 -1
- package/dist/assets/{Meeting-BkxfSXYG.js → Meeting-CTX8DATf.js} +1 -1
- package/dist/assets/{MoreHoriz-3d6Yp_t-.js → MoreHoriz-DAgzjMkD.js} +1 -1
- package/dist/assets/{MoreVert-C_Ck3fn9.js → MoreVert-C7ADSe__.js} +1 -1
- package/dist/assets/{OffSick-Z9k6qoex.js → OffSick-Cw_Bo4pj.js} +1 -1
- package/dist/assets/{OpenInNew-D79h4Iot.js → OpenInNew-DloC4nwa.js} +1 -1
- package/dist/assets/{Public-BtS6bdiD.js → Public-DYzbOE-T.js} +1 -1
- package/dist/assets/{Refresh-C1kA8imS.js → Refresh-By8bfp9S.js} +1 -1
- package/dist/assets/{SchemaReference.es-Dfqhb0uS.js → SchemaReference.es-CbqYK7gW.js} +1 -1
- package/dist/assets/{Search-CUm1f8xo.js → Search-CjaYHOuY.js} +1 -1
- package/dist/assets/{Slider-B0hY7ZYB.js → Slider-14Xp1QE3.js} +1 -1
- package/dist/assets/{Stepper-CEe-v4P_.js → Stepper-Cz4oLc0v.js} +1 -1
- package/dist/assets/{Switch-D3iZUzda.js → Switch-lDUha6nF.js} +1 -1
- package/dist/assets/{TableRow-CQ8RBtid.js → TableRow-uM5dbbKH.js} +1 -1
- package/dist/assets/{TableSearch-Uk9kIt7i.js → TableSearch-CUrFzIWx.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-BrZT8OFC.js → ToggleButtonGroup-ruLs9U48.js} +1 -1
- package/dist/assets/{Verified-DjfvSM3n.js → Verified-Cr6wy4Uq.js} +1 -1
- package/dist/assets/{VerifiedUser-CGB9pAg5.js → VerifiedUser-DQ1XdtS0.js} +1 -1
- package/dist/assets/{ViewColumn-CcQluqhl.js → ViewColumn-BncCRTIT.js} +1 -1
- package/dist/assets/{ViewList-CPkfx4gI.js → ViewList-Co_V4mfD.js} +1 -1
- package/dist/assets/{WorkingRemotely-BMx519Rn.js → WorkingRemotely-B4kcvx6l.js} +1 -1
- package/dist/assets/{_createAggregator-Dp2y-Mf_.js → _createAggregator-zWIYJPBX.js} +1 -1
- package/dist/assets/{actions-CvZtuIOm.js → actions-Cq51qPdo.js} +1 -1
- package/dist/assets/{actions-C8ldDfDc.js → actions-DAVGXMmF.js} +1 -1
- package/dist/assets/{agreement-4TUvZhY3.js → agreement-CfNMWvuB.js} +1 -1
- package/dist/assets/api-C6KC1P_U.js +1 -0
- package/dist/assets/{appearance-CztLZ35g.js → appearance-DJMviNOj.js} +1 -1
- package/dist/assets/ar-D9QEDjY-.js +7 -0
- package/dist/assets/{audit-logs-vnwtSLPp.js → audit-logs-aDT3tL_y.js} +1 -1
- package/dist/assets/{base-chart-tXWghrta.js → base-chart-DFps1bMz.js} +1 -1
- package/dist/assets/{blocklet-SKmr21o8.js → blocklet-C3B7_czn.js} +1 -1
- package/dist/assets/{brace-fold.es-C8hYDu8C.js → brace-fold.es-DdrA8572.js} +1 -1
- package/dist/assets/{chain-Cw3CxpIJ.js → chain-BgOjv6uW.js} +1 -1
- package/dist/assets/{click-to-copy-BBcwV5Sv.js → click-to-copy-CVJCV48Y.js} +1 -1
- package/dist/assets/cloneDeep-D8oICiE5.js +1 -0
- package/dist/assets/{closebrackets.es-n7j2YaKC.js → closebrackets.es-BAEECG-J.js} +1 -1
- package/dist/assets/{codemirror.es-q3z3D3fp.js → codemirror.es-CtyzpQd3.js} +1 -1
- package/dist/assets/{collapse-Cy01Qhtt.js → collapse-cvMh281U.js} +1 -1
- package/dist/assets/{comment.es-CZaW3Zjc.js → comment.es-CT1dSA50.js} +1 -1
- package/dist/assets/{config-navigation-B4iEyuxN.js → config-navigation-CJVBY_1Y.js} +3 -3
- package/dist/assets/{connect-to-BbdcjX_x.js → connect-to-B6vJIcaQ.js} +1 -1
- package/dist/assets/{de-Dv_ApqsF.js → de-BOa43YBF.js} +2 -2
- package/dist/assets/{delete-confirm-qy4uClf5.js → delete-confirm-BSpKG6TK.js} +1 -1
- package/dist/assets/{detail-C_SIxTEY.js → detail-BRQO1KYU.js} +3 -3
- package/dist/assets/{dialog.es-BEBI39yG.js → dialog.es-DXrJ9E3h.js} +1 -1
- package/dist/assets/{domains-Bql4UA4y.js → domains-Cd_E9K6j.js} +2 -2
- package/dist/assets/{download-DdDp7qNF.js → download-DD0NX-dO.js} +1 -1
- package/dist/assets/emotion-react.browser.esm-CZUhgARx.js +1 -0
- package/dist/assets/es-A3ma-OJp.js +9 -0
- package/dist/assets/{foldgutter.es-XJVlfA9j.js → foldgutter.es-CS9dkaWG.js} +1 -1
- package/dist/assets/fr-I3xKp6I5.js +7 -0
- package/dist/assets/{get-safe-url-BHhOK-87.js → get-safe-url-DFKtG9HX.js} +1 -1
- package/dist/assets/{get-safe-url-ZQAisLez.js → get-safe-url-rD4VAeiO.js} +1 -1
- package/dist/assets/getValidReactChildren-DXpwHayT.js +1 -0
- package/dist/assets/{hi-Dqbq8i5Y.js → hi-DacRhM8A.js} +1 -1
- package/dist/assets/{hint.es-BXYnqh_9.js → hint.es-C7s_Cw87.js} +1 -1
- package/dist/assets/{hint.es2-mCmWTcSI.js → hint.es2-BG7IPyzR.js} +1 -1
- package/dist/assets/{id-Bxr8o3Uo.js → id-B7LQAHL7.js} +3 -3
- package/dist/assets/{iframe-CVde2I2R.js → iframe-DlTBif6K.js} +1 -1
- package/dist/assets/{index-BublfAf3.js → index--pEcZ_jy.js} +1 -1
- package/dist/assets/{index-DzK6OW-H.js → index-0tIu-1zK.js} +1 -1
- package/dist/assets/{index-B6gCUDLy.js → index-27HrDkC8.js} +1 -1
- package/dist/assets/{index-BDHvuJA-.js → index-B-pqbvXR.js} +5 -5
- package/dist/assets/{index-ooFvSbXR.js → index-B45EgQpP.js} +1 -1
- package/dist/assets/{index-ChSMfUDl.js → index-BDad1uXv.js} +10 -10
- package/dist/assets/{index-CFc2cpAq.js → index-BH6N9kiW.js} +1 -1
- package/dist/assets/{index-BUWOtFDP.js → index-BIheNxxs.js} +1 -1
- package/dist/assets/index-BK4_GEzF.js +41 -0
- package/dist/assets/{index-C562LNdR.js → index-BMRaOW3i.js} +9 -9
- package/dist/assets/{index-Dg-nEXIR.js → index-BTMNPpbj.js} +1 -1
- package/dist/assets/{index-DNFAdenj.js → index-Baygm6LA.js} +1 -1
- package/dist/assets/{index-CIeEDIRZ.js → index-Bde_-0lD.js} +1 -1
- package/dist/assets/{index-CCGiAGPb.js → index-BgzweKIj.js} +1 -1
- package/dist/assets/{index-DRvnuna9.js → index-Bi-MJ5VJ.js} +1 -1
- package/dist/assets/{index-DnLtwT4P.js → index-BjBCo6La.js} +1 -1
- package/dist/assets/{index-C_5on_zt.js → index-BjO4wh2H.js} +1 -1
- package/dist/assets/{index-CEr4LN-P.js → index-BpB-1Bg8.js} +1 -1
- package/dist/assets/{index-BkStkax6.js → index-BtMd2e0b.js} +2 -2
- package/dist/assets/{index-B37Lr7Hg.js → index-BzjQHdRE.js} +1 -1
- package/dist/assets/{index-wKRUqEyT.js → index-C9lGpvq5.js} +2 -2
- package/dist/assets/{index-DzcmC4If.js → index-CDuhEPSB.js} +3 -3
- package/dist/assets/{index-CZplOWEN.js → index-CEGwKYvA.js} +1 -1
- package/dist/assets/{index-DdAt9jDT.js → index-CRtRN11t.js} +1 -1
- package/dist/assets/{index-Ds-ruyy-.js → index-CUN_nqtm.js} +1 -1
- package/dist/assets/{index-DTnnZgV3.js → index-CeegzfSw.js} +1 -1
- package/dist/assets/{index-CViyZjZs.js → index-CqW8J3Hz.js} +1 -1
- package/dist/assets/{index-CPBAco4X.js → index-CvUqaFUa.js} +1 -1
- package/dist/assets/{index-DzWDWvao.js → index-D1JYJWP1.js} +1 -1
- package/dist/assets/{index-uw3m84Z2.js → index-D2RfS7-O.js} +1 -1
- package/dist/assets/{index-DTb1YjkO.js → index-D6xNQO9D.js} +186 -186
- package/dist/assets/{index-DM5TK3mI.js → index-DApYzB3T.js} +1 -1
- package/dist/assets/index-DH6yhpyX.js +1 -0
- package/dist/assets/{index-CyCivdc5.js → index-DKh1PYSe.js} +1 -1
- package/dist/assets/{index-DVT--CtL.js → index-D_h7IVNI.js} +3 -3
- package/dist/assets/{index-DsdaIM1E.js → index-DbByIiV7.js} +4 -4
- package/dist/assets/{index-B6YLm2gY.js → index-DdEhGphv.js} +1 -1
- package/dist/assets/{index-BKpBz5IS.js → index-DeXCywmG.js} +1 -1
- package/dist/assets/{index-BWpZKV7G.js → index-DlxuFr_2.js} +3 -3
- package/dist/assets/{index-BLrsx8oH.js → index-FAOrsHzs.js} +1 -1
- package/dist/assets/{index-BILcrV-b.js → index-a2DZ9msz.js} +1 -1
- package/dist/assets/{index-Cm6VrPFr.js → index-aJFga9DB.js} +1 -1
- package/dist/assets/{index-omP-_XYV.js → index-gWj5DPOC.js} +1 -1
- package/dist/assets/index-k2TA2gFi.js +236 -0
- package/dist/assets/{index-C-QDjEC-.js → index-oGDBSDmQ.js} +1 -1
- package/dist/assets/{index-BQOOINkR.js → index-qzXhzN00.js} +1 -1
- package/dist/assets/{index-D3OlVE0m.js → index-vg5CgSEg.js} +1 -1
- package/dist/assets/{index.esm-CB-7UGfI.js → index.esm-UxoaB6Mu.js} +1 -1
- package/dist/assets/{info-addon.es-DKtNhOCh.js → info-addon.es-CZJHTLgg.js} +1 -1
- package/dist/assets/{info.es-B7YFO8O9.js → info.es-D24qyler.js} +1 -1
- package/dist/assets/{install-from-url-B9F0r0Uk.js → install-from-url-74slzMXU.js} +1 -1
- package/dist/assets/{invitation-BAovnHWT.js → invitation-B-BBdPct.js} +1 -1
- package/dist/assets/is-path-prefix-equal-1KjO4UlG.js +1 -0
- package/dist/assets/item-CX8J2MJp.js +277 -0
- package/dist/assets/{ja-CJfcqkdo.js → ja-DRQ4Eecl.js} +3 -1
- package/dist/assets/{javascript.es-e4wfmIpw.js → javascript.es-B3XIQ5bF.js} +1 -1
- package/dist/assets/{jump-to-line.es-D1zAOCng.js → jump-to-line.es-BPFdS4sP.js} +1 -1
- package/dist/assets/{jump.es-CR1apnMt.js → jump.es-DgTQZ6E0.js} +1 -1
- package/dist/assets/{ko-BxAazRix.js → ko-CzL3UzwL.js} +3 -1
- package/dist/assets/{lint.es-po0cvpDF.js → lint.es-CwL2rPB4.js} +1 -1
- package/dist/assets/{lint.es2-CIRlGKEU.js → lint.es2-K3G7qF5X.js} +1 -1
- package/dist/assets/{lint.es3-CC5QXby4.js → lint.es3-CDpRIgr_.js} +1 -1
- package/dist/assets/{list-header-D5Klosqn.js → list-header-CXofX5mW.js} +1 -1
- package/dist/assets/{log-DvWjHRjx.js → log-Dq3hLTsh.js} +1 -1
- package/dist/assets/{lottie-react.esm-CzS4D97g.js → lottie-react.esm-BpS8UEol.js} +1 -1
- package/dist/assets/{matchbrackets.es-Bh__cUPA.js → matchbrackets.es-BPk0GVm3.js} +1 -1
- package/dist/assets/{memory-VuyFpRX6.js → memory-CkILGNBa.js} +1 -1
- package/dist/assets/{metric-sJIuzFdD.js → metric--mq9dzfr.js} +1 -1
- package/dist/assets/{mode.es-b4PvmWPj.js → mode.es-B948py4j.js} +1 -1
- package/dist/assets/{mode.es2-B8UlLCtX.js → mode.es2-DLBpn1Xq.js} +1 -1
- package/dist/assets/{mode.es3-CQ9X5NiW.js → mode.es3-R3sBu0Hd.js} +1 -1
- package/dist/assets/omit-Bvtj3rp4.js +1 -0
- package/dist/assets/{onlineParser.es-mNPHWPcl.js → onlineParser.es-BYKS9Ohl.js} +1 -1
- package/dist/assets/{overview-DptGQrLC.js → overview-BhyffKqV.js} +1 -1
- package/dist/assets/{permission-DtbkcHFU.js → permission-fFO3ZJsb.js} +1 -1
- package/dist/assets/{preference-BIxg48qT.js → preference-D_V_1qTZ.js} +3 -3
- package/dist/assets/{pt-FpFCyI6v.js → pt-CHKumXYv.js} +3 -3
- package/dist/assets/{raf-schd.esm-CyR0PsG3.js → raf-schd.esm-BoCSLgIS.js} +1 -1
- package/dist/assets/refType-DjUDB_a_.js +1 -0
- package/dist/assets/{resource-dialog-DSlsEDCi.js → resource-dialog-1Tb87EP-.js} +4 -4
- package/dist/assets/{ru-BuGIFp9h.js → ru-CvkEKhgU.js} +1 -1
- package/dist/assets/{runtime-BqyrQzUD.js → runtime-BYAbYCDO.js} +1 -1
- package/dist/assets/{schema-BD6PrmCO.js → schema-Vu9BjGDN.js} +1 -1
- package/dist/assets/sdk-Dt3mm4lK.js +1 -0
- package/dist/assets/{search.es-BjwGHA7G.js → search.es-ywYl9dIw.js} +1 -1
- package/dist/assets/{searchcursor.es-CbJCToER.js → searchcursor.es-D3BwbrKk.js} +1 -1
- package/dist/assets/{service-BV2uNns2.js → service-BdSy4Eq2.js} +1 -1
- package/dist/assets/{shorten-label-BOckTQ1X.js → shorten-label-CAYARumO.js} +1 -1
- package/dist/assets/{show-hint.es-q9IMwctI.js → show-hint.es-CGSGzLNs.js} +1 -1
- package/dist/assets/{simple-select-Dtd0a5G_.js → simple-select-C2mBEc0U.js} +1 -1
- package/dist/assets/{spaces-Bqb0c1IC.js → spaces-DeV_YpyK.js} +1 -1
- package/dist/assets/{status-CoaEXqC8.js → status-AY9VNZQw.js} +1 -1
- package/dist/assets/{status-DAsfcIss.js → status-CuBjattD.js} +1 -1
- package/dist/assets/{sublime.es-Di_Rzzft.js → sublime.es-DqRI1gij.js} +1 -1
- package/dist/assets/{switch-control-uwHD90eP.js → switch-control-D_7zaAA3.js} +1 -1
- package/dist/assets/{table-icons-CMF2B4vQ.js → table-icons-DAVi_zrs.js} +1 -1
- package/dist/assets/{team-DbBAK1Lw.js → team-BVeJhT_q.js} +1 -1
- package/dist/assets/{th-BafLD2wR.js → th-B2BUfjNJ.js} +1 -1
- package/dist/assets/{toLower-Bk4Y66nU.js → toLower-Ddm9p1Fv.js} +1 -1
- package/dist/assets/toUpper-Dd2NWyrY.js +1 -0
- package/dist/assets/{traffic-C8Jrp6CL.js → traffic-Bvn15N7O.js} +1 -1
- package/dist/assets/{url-evaluation-DQ262LSg.js → url-evaluation-D2mP9Xpx.js} +1 -1
- package/dist/assets/{url-join-IGglLOtK.js → url-join-DNscpbOT.js} +1 -1
- package/dist/assets/{use-mobile-BoYyduuc.js → use-mobile-BCP-_fa6.js} +1 -1
- package/dist/assets/{use-mobile-YvhVWxe8.js → use-mobile-DVHkFhK8.js} +1 -1
- package/dist/assets/{useAsync-DbB0tJq1.js → useAsync-DKByAgoA.js} +1 -1
- package/dist/assets/{useAsyncRetry-BLg3v7lI.js → useAsyncRetry-CXNieOXD.js} +1 -1
- package/dist/assets/{useLocalStorage-DQZ59j66.js → useLocalStorage-BvE_hswD.js} +1 -1
- package/dist/assets/{useThemeProps-CtXzBlYo.js → useThemeProps-Daih-0Xh.js} +1 -1
- package/dist/assets/{util-CUC0Xf5B.js → util-CCEJlwCp.js} +1 -1
- package/dist/assets/{vi-BMZxxaJ2.js → vi-BykmwIAT.js} +3 -3
- package/dist/assets/{wait-container-GoGxY2Kf.js → wait-container-DHAK3hjx.js} +1 -1
- package/dist/assets/{withStyles-_FcG1bkA.js → withStyles-Cj7JqeJd.js} +1 -1
- package/dist/assets/wrap-locale-DGIIYNPn.js +1 -0
- package/dist/assets/{zh-DusA4qAT.js → zh-CbCaOuAd.js} +3 -1
- package/dist/assets/{zh-tw-BO-QhSNP.js → zh-tw-C9JfiCVV.js} +3 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/api-gAVz4YtD.js +0 -1
- package/dist/assets/ar-0ZkmCCuq.js +0 -7
- package/dist/assets/cloneDeep-CP0xacDT.js +0 -1
- package/dist/assets/emotion-react.browser.esm--gIypTeg.js +0 -1
- package/dist/assets/es-D_uF0siv.js +0 -7
- package/dist/assets/fr-DVFSQfDp.js +0 -7
- package/dist/assets/getValidReactChildren-B-b9MOMT.js +0 -1
- package/dist/assets/index-Boprg64p.js +0 -236
- package/dist/assets/index-DrBxStif.js +0 -41
- package/dist/assets/index-s1CQJTjJ.js +0 -1
- package/dist/assets/is-path-prefix-equal-C80Jhu_q.js +0 -1
- package/dist/assets/item-CrnjScjy.js +0 -277
- package/dist/assets/omit-BEDWXxvr.js +0 -1
- package/dist/assets/refType-J5vgZzDX.js +0 -1
- package/dist/assets/sdk-gxKU3x6m.js +0 -1
- package/dist/assets/toUpper-FI4Si1KF.js +0 -1
- package/dist/assets/wrap-locale-B35eVgy7.js +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{P as q,n as te,K as b,r as I,j as e,aZ as F,k as ue,kf as me,bl as fe,bq as ie,m as ne,gK as se,fR as ae,aT as oe,cu as x,y as P,t as g,kg as V,kh as Y,aY as Z,N as y,aB as he,B,cH as xe,a2 as pe,A as je,e as ge,bC as ve}from"./index-D6xNQO9D.js";import{T as ye}from"./index-0tIu-1zK.js";import{u as le,C as j}from"./index.esm-UxoaB6Mu.js";import{A as be,a as we,d as Re,b as Te}from"./collapse-cvMh281U.js";import{f as Se}from"./index-BH6N9kiW.js";import{u as ce}from"./blocklet-C3B7_czn.js";import{S as Q}from"./Switch-lDUha6nF.js";function p({title:u,desc:i,link:r,sectionLeftSx:f,sectionRightSx:w,children:h,..._}){const S=I.useMemo(()=>r?i?i.replace(/<b>(.*?)<\/b>/g,`<a href="${r}" target="_blank" rel="noopener noreferrer">$1</a>`):"":i,[i,r]);return e.jsx(Ee,{..._,children:e.jsxs(F,{className:"section",direction:{sm:"column",md:"row"},gap:{xs:3,md:6},children:[e.jsxs(b,{className:"section-left",sx:f,children:[e.jsx(ue,{className:"section-title",children:u}),e.jsx(b,{className:"section-desc",sx:{color:"text.secondary"},dangerouslySetInnerHTML:{__html:S}})]}),e.jsx(F,{className:"section-content",direction:"column",sx:{width:"100%",...w},children:h})]})})}p.propTypes={title:q.string.isRequired,children:q.node.isRequired,desc:q.string,sectionLeftSx:q.object,sectionRightSx:q.object,link:q.node};p.defaultProps={desc:"",sectionLeftSx:{width:"384px"},sectionRightSx:{},link:""};const Ee=te(b)`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
.section {
|
|
7
|
+
width: 100%;
|
|
8
|
+
|
|
9
|
+
.section-left {
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
flex-grow: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.section-title {
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
line-height: 32px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.section-desc {
|
|
20
|
+
font-weight: normal;
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
white-space: pre-line;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.section-content {
|
|
26
|
+
flex-grow: 1;
|
|
27
|
+
width: 0;
|
|
28
|
+
align-self: center;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (max-width: 900px) {
|
|
33
|
+
.section-left {
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.section-content {
|
|
38
|
+
width: 100% !important;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;var X={exports:{}},G={exports:{}},ee={exports:{}};(function(u,i){Object.defineProperty(i,"__esModule",{value:!0}),i.default=r;function r(f){return f==null}u.exports=i.default,u.exports.default=i.default})(ee,ee.exports);var Ce=ee.exports;(function(u,i){Object.defineProperty(i,"__esModule",{value:!0}),i.default=S;var r=w(me),f=w(Ce);function w(a){return a&&a.__esModule?a:{default:a}}var h=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,_=/^[-+]?[0-9]+$/;function S(a,n){(0,r.default)(a),n=n||{};var O=n.allow_leading_zeroes===!1?h:_,L=!n.hasOwnProperty("min")||(0,f.default)(n.min)||a>=n.min,c=!n.hasOwnProperty("max")||(0,f.default)(n.max)||a<=n.max,o=!n.hasOwnProperty("lt")||(0,f.default)(n.lt)||a<n.lt,K=!n.hasOwnProperty("gt")||(0,f.default)(n.gt)||a>n.gt;return O.test(a)&&L&&c&&o&&K}u.exports=i.default,u.exports.default=i.default})(G,G.exports);var Pe=G.exports;(function(u,i){Object.defineProperty(i,"__esModule",{value:!0}),i.default=w;var r=f(Pe);function f(h){return h&&h.__esModule?h:{default:h}}function w(h){return(0,r.default)(h,{allow_leading_zeroes:!1,min:0,max:65535})}u.exports=i.default,u.exports.default=i.default})(X,X.exports);var _e=X.exports;const Ke=fe(_e),H={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Ne(){var E,R,v;const{api:u}=ie(),{blocklet:i}=ce(),{t:r}=ne(),{confirmApi:f,confirmHolder:w}=se(),h=(E=i==null?void 0:i.meta)==null?void 0:E.did,_=Object.assign({...H},((v=(R=i==null?void 0:i.settings)==null?void 0:R.notification)==null?void 0:v.email)||{}),{handleSubmit:S,control:a,formState:n,watch:O,reset:L}=le({defaultValues:ae(_,Object.keys(H))}),c=oe({testReceiver:"",testReceiverError:""}),o=O("enabled"),K=x(async(t,s,T=!0)=>{var C,k;try{const{blocklet:N}=await u.configNotification({input:{did:h,notification:JSON.stringify({email:t})}}),de=Object.assign({...H},((k=(C=N==null?void 0:N.settings)==null?void 0:C.notification)==null?void 0:k.email)||{});L(de),T&&P.success(r("oauth.saveSuccess"))}catch(N){if(T)P.error(N.message||r("oauth.saveFailed"));else throw N}}),D=x(async(t,s,T)=>{try{n.isDirty&&await K(t,s,!1),await u.sendEmail({input:{did:h,receiver:T,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),P.success(r("notification.email.testSuccess"))}catch(C){P.error(C.message||r("notification.email.testfailed"))}}),M=x((t,s)=>{c.testReceiver="",c.testReceiverError="",f.open({title:r("notification.email.testSendEmail"),content:()=>e.jsx(b,{sx:{width:"300px"},children:e.jsx(g,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:r("notification.email.inputTestReceiver"),value:c.testReceiver,onChange:T=>{c.testReceiver=T.target.value},error:!!c.testReceiverError,helperText:c.testReceiverError||" "})}),confirmButtonText:r("common.confirm"),cancelButtonText:r("common.cancel"),async onConfirm(T){var k;const C=(k=c.testReceiver)==null?void 0:k.trim();if(!C){c.testReceiverError=r("notification.email.receiverRequired");return}if(!V(C)){c.testReceiverError=r("notification.email.receiverInvalid");return}c.testReceiverError="",await D(t,s,C),T()}})}),U=x(t=>{const s=t==null?void 0:t.trim();return s?V(s)?!0:r("notification.email.fromInvalid"):r("notification.email.fromRequired")}),$=x(t=>{const s=t==null?void 0:t.trim();return s?Y(s,{require_host:!1,protocols:[]})?!0:r("notification.email.hostInvalid"):r("notification.email.hostRequired")}),z=x(t=>t?Ke(t)?!0:r("notification.email.portInvalid"):r("notification.email.portRequired")),W=x(t=>t!=null&&t.trim()?!0:r("notification.email.userRequired")),A=x(t=>t!=null&&t.trim()?!0:r("notification.email.passwordRequired")),l=x(t=>t!=null&&t.trim()&&!Y(t,{protocols:["http","https"],require_protocol:!0})?r("notification.email.linkInvalid"):!0),m=x(t=>t!=null&&t.trim()&&!V(t)?r("notification.email.emailInvalid"):!0),d=x(()=>!0);return e.jsxs(b,{children:[e.jsxs(qe,{component:"form",onSubmit:S(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(p,{title:r("notification.email.enable"),my:2.5,children:e.jsx(j,{name:"enabled",control:a,render:({field:t})=>e.jsx(Z,{control:e.jsx(Q,{checked:t.value,...t})})})}),e.jsx(p,{title:r("notification.email.from"),children:e.jsx(j,{name:"from",control:a,rules:{validate:o?U:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",required:!0,label:r("notification.email.from"),error:!!n.errors[t.name],helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.host"),children:e.jsx(j,{name:"host",control:a,rules:{validate:o?$:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",required:!0,error:!!n.errors[t.name],label:r("notification.email.host"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.port"),children:e.jsx(j,{name:"port",control:a,rules:{validate:o?z:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",required:!0,type:"number",error:!!n.errors[t.name],label:r("notification.email.port"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.user"),children:e.jsx(j,{name:"user",control:a,rules:{validate:o?W:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",required:!0,error:!!n.errors[t.name],label:r("notification.email.user"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.password"),children:e.jsx(j,{name:"password",control:a,rules:{validate:o?A:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",required:!0,type:"password",error:!!n.errors[t.name],label:r("notification.email.password"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.secure"),children:e.jsx(j,{name:"secure",control:a,rules:{validate:d},render:({field:t})=>e.jsx(y,{fullWidth:!0,children:e.jsx(Z,{control:e.jsx(Q,{checked:t.value,...t,disabled:!o})})})})}),e.jsxs(be,{children:[e.jsxs(we,{expandIcon:e.jsx(Re,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[r("notification.email.signature"),e.jsx(he,{title:r("notification.email.signatureTooltip"),children:e.jsx(Se,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(Te,{children:[e.jsx(p,{title:r("notification.email.companyName"),children:e.jsx(j,{name:"companyName",control:a,rules:{validate:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",error:!!n.errors[t.name],label:r("notification.email.companyName"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.companyLink"),children:e.jsx(j,{name:"companyLink",control:a,rules:{validate:o?l:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",error:!!n.errors[t.name],label:r("notification.email.companyLink"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.companyAddress"),children:e.jsx(j,{name:"companyAddress",control:a,rules:{validate:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",error:!!n.errors[t.name],label:r("notification.email.companyAddress"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})}),e.jsx(p,{title:r("notification.email.supportEmail"),children:e.jsx(j,{name:"supportEmail",control:a,rules:{validate:o?m:d},render:({field:t})=>{var s;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...t,size:"small",type:"email",error:!!n.errors[t.name],label:r("notification.email.supportEmail"),helperText:((s=n.errors[t.name])==null?void 0:s.message)||" ",disabled:!o})})}})})]})]}),e.jsxs(b,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(B,{variant:"outlined",color:"warning",onClick:S(M),disabled:!o,children:r("oauth.runTest")}),e.jsx(B,{type:"submit",variant:"contained",disabled:!n.isDirty,children:r("oauth.save")})]})]}),w]})}const qe=te(F)``,J={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Oe(){var z,W,A;const{api:u}=ie(),{blocklet:i}=ce(),{t:r}=ne(),{confirmApi:f,confirmHolder:w}=se(),h=(z=i==null?void 0:i.meta)==null?void 0:z.did,_=Object.assign({...J},((A=(W=i==null?void 0:i.settings)==null?void 0:W.notification)==null?void 0:A.pushKit)||{}),{handleSubmit:S,control:a,formState:n,watch:O,reset:L}=le({defaultValues:ae(_,Object.keys(J))}),c=oe({testReceiver:"",testReceiverError:""}),o=O("enabled"),K=x(async(l,m,d=!0)=>{var E,R;try{const{blocklet:v}=await u.configNotification({input:{did:h,notification:JSON.stringify({pushKit:l})}}),t=Object.assign({...J},((R=(E=v==null?void 0:v.settings)==null?void 0:E.notification)==null?void 0:R.pushKit)||{});L(t),d&&P.success(r("oauth.saveSuccess"))}catch(v){if(d)P.error(v.message||r("oauth.saveFailed"));else throw v}}),D=x(async(l,m)=>{var d,E,R;try{n.isDirty&&await K(l,m,!1);const v=(d=((i==null?void 0:i.configs)||[]).find(T=>T.key==="BLOCKLET_APP_URL"))==null?void 0:d.value,t=xe(pe(v,je.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(E=i==null?void 0:i.meta)==null?void 0:E.version,t:new Date((i==null?void 0:i.updatedAt)||0).getTime()}),s={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:i==null?void 0:i.appDid,fullName:(R=i==null?void 0:i.meta)==null?void 0:R.title,avatar:t}}}};await u.sendPush({input:{did:h,receiver:c.testReceiver,notification:JSON.stringify(s)}}),P.success(r("notification.pushKit.testSuccess"))}catch(v){P.error(v.message||r("notification.pushKit.testfailed"))}}),M=x((l,m)=>{c.testReceiverError="",f.open({title:r("notification.pushKit.testSend"),content:()=>e.jsx(b,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(g,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:r("notification.pushKit.inputTestReceiver"),value:c.testReceiver,onChange:d=>{c.testReceiver=d.target.value},error:!!c.testReceiverError,helperText:c.testReceiverError||" "})}),confirmButtonText:r("common.confirm"),cancelButtonText:r("common.cancel"),async onConfirm(d){var R;if(!((R=c.testReceiver)==null?void 0:R.trim())){c.testReceiverError=r("notification.pushKit.receiverRequired");return}c.testReceiverError="",await D(l,m),d()}})}),U=x(l=>{const m=l==null?void 0:l.trim();return m?Y(m)?!0:r("notification.pushKit.endpointInvalid"):r("notification.pushKit.endpointRequired")}),$=x(()=>!0);return e.jsxs(b,{children:[e.jsxs(Le,{component:"form",onSubmit:S(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(p,{title:r("notification.pushKit.enable"),my:2.5,children:e.jsx(j,{name:"enabled",control:a,render:({field:l})=>e.jsx(Z,{control:e.jsx(Q,{checked:l.value,...l})})})}),e.jsx(p,{title:r("notification.pushKit.endpoint"),children:e.jsx(j,{name:"endpoint",control:a,rules:{validate:o?U:$},render:({field:l})=>{var m;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...l,size:"small",required:!0,label:r("notification.pushKit.endpoint"),error:!!n.errors[l.name],helperText:((m=n.errors[l.name])==null?void 0:m.message)||" ",disabled:!o})})}})}),e.jsxs(p,{title:r("notification.pushKit.customOptions"),children:[e.jsx(j,{name:"did",control:a,render:({field:l})=>{var m;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...l,size:"small",label:r("notification.pushKit.did"),error:!!n.errors[l.name],helperText:((m=n.errors[l.name])==null?void 0:m.message)||" ",disabled:!o})})}}),e.jsx(j,{name:"pushPath",control:a,render:({field:l})=>{var m;return e.jsx(y,{fullWidth:!0,children:e.jsx(g,{...l,size:"small",label:r("notification.pushKit.pushPath"),error:!!n.errors[l.name],helperText:((m=n.errors[l.name])==null?void 0:m.message)||" ",disabled:!o})})}})]}),e.jsxs(b,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(B,{variant:"outlined",color:"warning",onClick:S(M),disabled:!o,children:r("oauth.runTest")}),e.jsx(B,{type:"submit",variant:"contained",disabled:!n.isDirty,children:r("oauth.save")})]})]}),w]})}const Le=te(F)``,re=[{label:e.jsx(b,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(b,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function De(){const[u,i]=I.useState(re[0].value),{locale:r}=I.useContext(ge),f=ve(()=>({email:e.jsx(Ne,{}),pushKit:e.jsx(Oe,{})}),[r]),w=I.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(b,{children:[e.jsx(ye,{tabs:re,current:u,onChange:i}),e.jsx(b,{style:w,children:f[u]})]})}export{De as B,p as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as H,K as y,aB as Ce,P as i,y as L,al as ft,r as f,e as ve,bE as qe,b as Y,H as B,V as $t,bD as He,t as K,n as $,X as ie,l3 as Ao,a4 as Z,aZ as ao,k as te,D as ht,b5 as qo,gK as Wo,gL as Go,e3 as zo,C as ue,fQ as Fo,w as Vo,az as Wn,a2 as gt,v as Yo,l4 as Ko,l5 as Ho,B as ae,l6 as Qo,Y as Zo,Z as Xo,l7 as lo,br as co,Q as ye,dH as Jo,dU as er,aD as tr,aE as nr,aF as or,aH as Q,aS as rr,cR as sr,E as uo,bp as ir,$ as ar,M as at,aG as po,b1 as zt,l8 as lr,b2 as je,aC as Gn,cP as cr,k0 as dr,A as U,ae as We,aO as mo,bV as Ft,cz as ur,g as xt,l9 as pr,bd as mr,x as fo,aY as Mt,T as fr,aW as Ke,R as Ut,W as hr,bF as ho,gJ as gr,cu as xr,aK as yr,bw as Cr,aV as jr,ep as vr,fZ as zn,la as Fn,h9 as Vn,U as Yn,G as lt,cO as br,ha as Rr,bU as Sr,k1 as wr}from"./index-DTb1YjkO.js";import{d as Er}from"./Add-CSGWebd7.js";import{E as Tr}from"./index-omP-_XYV.js";import{e as Pr,f as kr,g as _r,u as Vt,a as Ir}from"./actions-CvZtuIOm.js";import{S as Dr}from"./switch-control-uwHD90eP.js";import{u as pe}from"./blocklet-SKmr21o8.js";import{P as At,w as yt}from"./permission-DtbkcHFU.js";import{d as go}from"./Edit-frf3Fbx4.js";import{T as Ur,M as Nr,t as Lr}from"./table-icons-CMF2B4vQ.js";import{s as Br,R as dt,F as Or,L as $r,d as Mr,B as Ar}from"./preference-BIxg48qT.js";import{C as Kn}from"./click-to-copy-BBcwV5Sv.js";import{d as Yt}from"./Link-CiUEO3cQ.js";import{c as qr,C as Wr,b as Gr,s as xo,e as zr,z as Fr,d as yo,a as Vr,A as Yr,B as Kr,f as Hr,S as Qr}from"./item-CrnjScjy.js";import{u as Zr,a as Xr,P as Co,L as Hn,A as Jr,S as es}from"./index-CViyZjZs.js";import{u as ts,C as ns,D as os,a as rs,b as ss}from"./connect-to-BbdcjX_x.js";import{C as is,u as as,A as ls}from"./agreement-4TUvZhY3.js";import{d as cs}from"./Done-2EsU1aO2.js";import{A as ds,a as us,d as ps,b as ms}from"./collapse-Cy01Qhtt.js";import{C as fs,L as hs}from"./LockIcon-C1gL9Uz4.js";import{I as gs,a as xs,f as ys,B as Cs}from"./install-from-url-B9F0r0Uk.js";import{a as Qn}from"./api-gAVz4YtD.js";import{v as jo,e as js,a as ut}from"./util-CUC0Xf5B.js";import{u as vo}from"./use-mobile-BoYyduuc.js";import{d as vs}from"./ArrowDropDown-BCCxOUNE.js";import{_ as bs}from"./useLocalStorage-DQZ59j66.js";import{d as Ct}from"./Delete-P4B2dduO.js";import{d as bo}from"./Launch-B7fv6nTK.js";import{D as Rs}from"./delete-confirm-qy4uClf5.js";import{W as Qe,R as Ss,a as Zn}from"./url-evaluation-DQ262LSg.js";import{B as Ro}from"./status-CoaEXqC8.js";import{A as So}from"./actions-C8ldDfDc.js";import{I as Nt}from"./index-BLrsx8oH.js";import{t as ws}from"./toUpper-FI4Si1KF.js";import{S as Es}from"./Switch-D3iZUzda.js";import{a as Ts}from"./team-DbBAK1Lw.js";import"./MoreVert-C_Ck3fn9.js";import"./get-safe-url-BHhOK-87.js";import"./ButtonGroup-ClVwTb7r.js";import"./getValidReactChildren-B-b9MOMT.js";import"./index-C_5on_zt.js";import"./raf-schd.esm-CyR0PsG3.js";import"./index-DRvnuna9.js";import"./ViewColumn-CcQluqhl.js";import"./CSSTransition-DpoNbm4c.js";import"./index-DzK6OW-H.js";import"./Clear-D0I7uWhD.js";import"./ChevronRight-BtkdX9A9.js";import"./ChevronLeft-DQK-aqqz.js";import"./Search-CUm1f8xo.js";import"./omit-BEDWXxvr.js";import"./index-CEr4LN-P.js";import"./index-B6YLm2gY.js";import"./iframe-CVde2I2R.js";import"./Autocomplete-BRFoT1-d.js";import"./ListSubheader-Yn3XMnVm.js";import"./Verified-DjfvSM3n.js";import"./VerifiedUser-CGB9pAg5.js";import"./DeleteOutline-EQ9bHspP.js";import"./url-join-IGglLOtK.js";import"./Close-6CxneLlA.js";import"./index-BkStkax6.js";import"./OpenInNew-D79h4Iot.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-CBv7x3VM.js";import"./index-DnLtwT4P.js";import"./spaces-Bqb0c1IC.js";import"./index-D3OlVE0m.js";import"./cloneDeep-CP0xacDT.js";import"./schema-BD6PrmCO.js";import"./ListItemButton-ByIRcZGW.js";import"./Stepper-CEe-v4P_.js";import"./is-path-prefix-equal-C80Jhu_q.js";import"./MoreHoriz-3d6Yp_t-.js";const Ps=Bo(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");function Xn(e,o){var n={};return o=Oo(o),$o(e,function(a,r,s){Mo(n,r,o(a,r,s))}),n}var Kt={},ks=Gt;Object.defineProperty(Kt,"__esModule",{value:!0});var wo=Kt.default=void 0,_s=ks(Wt()),Is=t;wo=Kt.default=(0,_s.default)((0,Is.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");var Ht={},Ds=Gt;Object.defineProperty(Ht,"__esModule",{value:!0});var Qt=Ht.default=void 0,Us=Ds(Wt()),Ns=t;Qt=Ht.default=(0,Us.default)((0,Ns.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");function Zt({children:e,...o}){var x;const{t:n}=G(),{api:a}=H(),{blocklet:r}=pe(),s=(x=r==null?void 0:r.settings)==null?void 0:x.autoCheckUpdate,h=async g=>{await a.updateAutoCheckUpdate({input:{did:r.meta.did,autoCheckUpdate:g}})},c=async()=>{try{const g=!(s!=null&&s.enabled);await h({enabled:g}),L.success(n(g?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(g){L.error(g.message)}},p=!!(s!=null&&s.enabled);return t.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[e,t.jsx(Ce,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Dr,{checked:p,onChange:c,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Zt.propTypes={children:i.any};Zt.defaultProps={children:null};function Jn(e){function o({sx:n,...a}){return t.jsx(e,{...a,sx:{color:"text.primary",...n}})}return o}const Ls={...Xn(Lr,Jn),...Xn(Pr,Jn)},Bs=(e,o)=>{let{description:n}=e;return(Object.values(Y.CHAIN_PROP_MAP).includes(e.key)||B.isEnvShareable(e))&&(n?n=`${n} (${o("blocklet.config.sharedToAllComponents")})`:n=o("blocklet.config.sharedToAllComponents")),n&&t.jsx("div",{style:{marginLeft:12},children:n})},Lt=(e,o,n=[])=>!(n!=null&&n.length)&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!o.meta.environments.find(a=>a.name===e.key)&&o.children.every(a=>!a.meta.environments.find(r=>r.name===e.key))?!0:e.custom,eo=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),Bt=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function Xt({blocklet:e,ancestors:o}){const n=H(),{palette:a}=ft(),{inService:r}=n,{t:s}=f.useContext(ve),h=[...o.map(m=>m.meta.did),e.meta.did],c=()=>L.success(s("blocklet.config.changedTip")),p=m=>Lt(m,e,o);if(qe(e.status)||e.status==="unknown"&&qe(e.status))return null;const x=m=>new Promise(async(u,v)=>{if(!m.key.trim()||!m.value.trim()){L.error(s("blocklet.config.environment.keyValueRequired")),v();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),v();return}m.custom=Bt(m.key);try{const w=await n.api.configBlocklet({input:{did:h,configs:[m]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),g=(m,u)=>new Promise(async(v,w)=>{if(m.required&&(!m.key.trim()||!m.value.trim())){L.error(s("blocklet.config.environment.keyValueRequired")),w();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),w();return}if(m.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const N=Ao(m);if(N){L.error(N),w();return}}const j=[{...m,value:m.secure&&m.value==="__encrypted__"?"":m.value}];if(m.key!==u.key){if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),w();return}j.push({key:u.key,custom:Bt(m.key)})}try{const N=await n.api.configBlocklet({input:{did:h,configs:j}});c(N.blocklet),v()}catch(N){L.error(ie(N)),w()}}),l=m=>new Promise(async(u,v)=>{if(m.required){L.error(s("blocklet.config.environment.deleteForbidden")),v();return}if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),v();return}try{const w=await n.api.configBlocklet({input:{did:h,configs:[{key:m.key,custom:Bt(m.key)}]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),b=(e.configs||[]).filter(m=>!Y.BLOCKLET_CONFIGURABLE_KEY[m.key]||[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(m.key)),d=B.getSharedConfigObj(o[0],e),T=B.getComponentMissingConfigs(e,o[0]),S=b.map(m=>({...m,value:Object.values(Y.CHAIN_PROP_MAP).includes(m.key)&&Object.keys(d).includes(m.key)?d[m.key]:d[m.key]||m.value})),R=S.some(m=>m.key&&m.key.startsWith("BWA_")),k={onRowAdd:x,onRowUpdate:g,onRowDelete:l,isDeletable:p},C=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:m=>t.jsx(Kn,{value:m.value,style:{color:m.required&&!m.value?a.error.main:a.text.primary,fontWeight:m.required?"bold":"normal"},children:m.key}),editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsx(to,{children:t.jsx(K,{fullWidth:!0,size:"small",disabled:p(v)===!1,value:Br.escapeTag(u),onChange:j=>w(j.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:m=>m.value?m.secure?"******":t.jsx(Kn,{unstyled:!0,value:m.value,style:{wordBreak:"break-all"},children:m.value}):null,editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsxs(to,{children:[t.jsx(K,{fullWidth:!0,size:"small",value:u==="__encrypted__"?"":u,onChange:j=>w(j.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Bs(v,s)]})}}];return t.jsxs(Os,{children:[!!T.length&&t.jsx($t,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),R&&t.jsx($t,{severity:"info",children:s("blocklet.config.environment.tip")}),t.jsx(At,{permission:r?"":"mutate_blocklets",role:r?He:[],children:m=>t.jsx(Ur,{className:"config-table",children:t.jsx(Nr,{title:t.jsx(y,{fontWeight:"bold",children:s("common.environments")}),columns:C(),icons:Ls,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:s("common.actions")},body:{emptyDataSourceMessage:s("common.noData")}},data:S,editable:m?k:{}})})})]})}Xt.propTypes={blocklet:i.object.isRequired,ancestors:i.array};Xt.defaultProps={ancestors:[]};const Os=$.div`
|
|
1
|
+
import{bW as Bo,j as t,f7 as Oo,hM as $o,l3 as Mo,aP as Wt,aQ as Gt,m as G,bq as H,K as y,aB as Ce,P as i,y as L,al as ft,r as f,e as ve,bE as qe,b as Y,H as B,V as $t,bD as He,t as K,n as $,X as ie,l4 as Ao,a4 as Z,aZ as ao,k as te,D as ht,b5 as qo,gL as Wo,gM as Go,e3 as Fo,C as ue,fQ as zo,w as Vo,az as Wn,a2 as gt,v as Yo,l5 as Ko,l6 as Ho,B as ae,l7 as Qo,Y as Zo,Z as Xo,l8 as lo,br as co,Q as ye,dH as Jo,dU as er,aD as tr,aE as nr,aF as or,aH as Q,aS as rr,cR as sr,E as uo,bp as ir,$ as ar,M as at,aG as po,b1 as Ft,l9 as lr,b2 as je,aC as Gn,cP as cr,k1 as dr,A as U,ae as We,aO as mo,bV as zt,cz as ur,g as xt,la as pr,bd as mr,x as fo,aY as Mt,T as fr,aW as Ke,R as Ut,W as hr,bF as ho,gK as gr,cu as xr,aK as yr,bw as Cr,aV as jr,ep as vr,fZ as Fn,lb as zn,ha as Vn,U as Yn,G as lt,cO as br,hb as Rr,bU as Sr,k2 as wr}from"./index-D6xNQO9D.js";import{d as Er}from"./Add-BvcTJL6g.js";import{E as Tr}from"./index-gWj5DPOC.js";import{e as Pr,f as kr,g as _r,u as Vt,a as Ir}from"./actions-Cq51qPdo.js";import{S as Dr}from"./switch-control-D_7zaAA3.js";import{u as pe}from"./blocklet-C3B7_czn.js";import{P as At,w as yt}from"./permission-fFO3ZJsb.js";import{d as go}from"./Edit-WOZnUVvS.js";import{T as Ur,M as Nr,t as Lr}from"./table-icons-DAVi_zrs.js";import{s as Br,R as dt,F as Or,L as $r,d as Mr,B as Ar}from"./preference-D_V_1qTZ.js";import{C as Kn}from"./click-to-copy-CVJCV48Y.js";import{d as Yt}from"./Link-C4RjtlPw.js";import{c as qr,C as Wr,b as Gr,s as xo,e as Fr,W as zr,d as yo,a as Vr,A as Yr,B as Kr,f as Hr,S as Qr}from"./item-CX8J2MJp.js";import{u as Zr,a as Xr,P as Co,L as Hn,A as Jr,S as es}from"./index-CqW8J3Hz.js";import{u as ts,C as ns,D as os,a as rs,b as ss}from"./connect-to-B6vJIcaQ.js";import{C as is,u as as,A as ls}from"./agreement-CfNMWvuB.js";import{d as cs}from"./Done-yL7tHkLt.js";import{A as ds,a as us,d as ps,b as ms}from"./collapse-cvMh281U.js";import{C as fs,L as hs}from"./LockIcon--YdvMZNM.js";import{I as gs,a as xs,f as ys,B as Cs}from"./install-from-url-74slzMXU.js";import{a as Qn}from"./api-C6KC1P_U.js";import{v as jo,e as js,a as ut}from"./util-CCEJlwCp.js";import{u as vo}from"./use-mobile-BCP-_fa6.js";import{d as vs}from"./ArrowDropDown-lSBhitmG.js";import{_ as bs}from"./useLocalStorage-BvE_hswD.js";import{d as Ct}from"./Delete-EgRRDgvd.js";import{d as bo}from"./Launch-DHV3U2Y3.js";import{D as Rs}from"./delete-confirm-BSpKG6TK.js";import{W as Qe,R as Ss,a as Zn}from"./url-evaluation-D2mP9Xpx.js";import{B as Ro}from"./status-AY9VNZQw.js";import{A as So}from"./actions-DAVGXMmF.js";import{I as Nt}from"./index-FAOrsHzs.js";import{t as ws}from"./toUpper-Dd2NWyrY.js";import{S as Es}from"./Switch-lDUha6nF.js";import{a as Ts}from"./team-BVeJhT_q.js";import"./MoreVert-C7ADSe__.js";import"./get-safe-url-rD4VAeiO.js";import"./ButtonGroup-8JIPxBFt.js";import"./getValidReactChildren-DXpwHayT.js";import"./index-BjO4wh2H.js";import"./raf-schd.esm-BoCSLgIS.js";import"./index-Bi-MJ5VJ.js";import"./ViewColumn-BncCRTIT.js";import"./CSSTransition-CrBmaRu0.js";import"./index-0tIu-1zK.js";import"./Clear-9k4hE_iq.js";import"./ChevronRight-BlhG3yZY.js";import"./ChevronLeft-CQivGJHk.js";import"./Search-CjaYHOuY.js";import"./omit-Bvtj3rp4.js";import"./index-BpB-1Bg8.js";import"./index-DdEhGphv.js";import"./iframe-DlTBif6K.js";import"./Autocomplete-DPEAys5B.js";import"./ListSubheader-C-e_2m7m.js";import"./Verified-Cr6wy4Uq.js";import"./VerifiedUser-DQ1XdtS0.js";import"./DeleteOutline-Ja8iJJm1.js";import"./url-join-DNscpbOT.js";import"./Close-aI0rARqu.js";import"./index-BtMd2e0b.js";import"./OpenInNew-DloC4nwa.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-BmFBsSz3.js";import"./index-BjBCo6La.js";import"./spaces-DeV_YpyK.js";import"./index-vg5CgSEg.js";import"./cloneDeep-D8oICiE5.js";import"./schema-Vu9BjGDN.js";import"./ListItemButton-CS_u4xql.js";import"./Stepper-Cz4oLc0v.js";import"./is-path-prefix-equal-1KjO4UlG.js";import"./MoreHoriz-DAgzjMkD.js";const Ps=Bo(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");function Xn(e,o){var n={};return o=Oo(o),$o(e,function(a,r,s){Mo(n,r,o(a,r,s))}),n}var Kt={},ks=Gt;Object.defineProperty(Kt,"__esModule",{value:!0});var wo=Kt.default=void 0,_s=ks(Wt()),Is=t;wo=Kt.default=(0,_s.default)((0,Is.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");var Ht={},Ds=Gt;Object.defineProperty(Ht,"__esModule",{value:!0});var Qt=Ht.default=void 0,Us=Ds(Wt()),Ns=t;Qt=Ht.default=(0,Us.default)((0,Ns.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");function Zt({children:e,...o}){var x;const{t:n}=G(),{api:a}=H(),{blocklet:r}=pe(),s=(x=r==null?void 0:r.settings)==null?void 0:x.autoCheckUpdate,h=async g=>{await a.updateAutoCheckUpdate({input:{did:r.meta.did,autoCheckUpdate:g}})},c=async()=>{try{const g=!(s!=null&&s.enabled);await h({enabled:g}),L.success(n(g?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(g){L.error(g.message)}},p=!!(s!=null&&s.enabled);return t.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[e,t.jsx(Ce,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Dr,{checked:p,onChange:c,name:"enableWelcomePage",style:{...o.style,zoom:.8}})})})]})}Zt.propTypes={children:i.any};Zt.defaultProps={children:null};function Jn(e){function o({sx:n,...a}){return t.jsx(e,{...a,sx:{color:"text.primary",...n}})}return o}const Ls={...Xn(Lr,Jn),...Xn(Pr,Jn)},Bs=(e,o)=>{let{description:n}=e;return(Object.values(Y.CHAIN_PROP_MAP).includes(e.key)||B.isEnvShareable(e))&&(n?n=`${n} (${o("blocklet.config.sharedToAllComponents")})`:n=o("blocklet.config.sharedToAllComponents")),n&&t.jsx("div",{style:{marginLeft:12},children:n})},Lt=(e,o,n=[])=>!(n!=null&&n.length)&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!o.meta.environments.find(a=>a.name===e.key)&&o.children.every(a=>!a.meta.environments.find(r=>r.name===e.key))?!0:e.custom,eo=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),Bt=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function Xt({blocklet:e,ancestors:o}){const n=H(),{palette:a}=ft(),{inService:r}=n,{t:s}=f.useContext(ve),h=[...o.map(m=>m.meta.did),e.meta.did],c=()=>L.success(s("blocklet.config.changedTip")),p=m=>Lt(m,e,o);if(qe(e.status)||e.status==="unknown"&&qe(e.status))return null;const x=m=>new Promise(async(u,v)=>{if(!m.key.trim()||!m.value.trim()){L.error(s("blocklet.config.environment.keyValueRequired")),v();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),v();return}m.custom=Bt(m.key);try{const w=await n.api.configBlocklet({input:{did:h,configs:[m]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),g=(m,u)=>new Promise(async(v,w)=>{if(m.required&&(!m.key.trim()||!m.value.trim())){L.error(s("blocklet.config.environment.keyValueRequired")),w();return}if(eo(m.key)===!1){L.error(s("blocklet.config.environment.invalidKey")),w();return}if(m.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const N=Ao(m);if(N){L.error(N),w();return}}const j=[{...m,value:m.secure&&m.value==="__encrypted__"?"":m.value}];if(m.key!==u.key){if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),w();return}j.push({key:u.key,custom:Bt(m.key)})}try{const N=await n.api.configBlocklet({input:{did:h,configs:j}});c(N.blocklet),v()}catch(N){L.error(ie(N)),w()}}),l=m=>new Promise(async(u,v)=>{if(m.required){L.error(s("blocklet.config.environment.deleteForbidden")),v();return}if(!Lt(m,e,o)){L.error("Only key of custom env can be changed"),v();return}try{const w=await n.api.configBlocklet({input:{did:h,configs:[{key:m.key,custom:Bt(m.key)}]}});c(w.blocklet),u()}catch(w){L.error(ie(w)),v()}}),b=(e.configs||[]).filter(m=>!Y.BLOCKLET_CONFIGURABLE_KEY[m.key]||[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(m.key)),d=B.getSharedConfigObj(o[0],e),T=B.getComponentMissingConfigs(e,o[0]),S=b.map(m=>({...m,value:Object.values(Y.CHAIN_PROP_MAP).includes(m.key)&&Object.keys(d).includes(m.key)?d[m.key]:d[m.key]||m.value})),R=S.some(m=>m.key&&m.key.startsWith("BWA_")),k={onRowAdd:x,onRowUpdate:g,onRowDelete:l,isDeletable:p},C=()=>[{title:s("common.key"),field:"key",initialEditValue:"",width:"30%",render:m=>t.jsx(Kn,{value:m.value,style:{color:m.required&&!m.value?a.error.main:a.text.primary,fontWeight:m.required?"bold":"normal"},children:m.key}),editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsx(to,{children:t.jsx(K,{fullWidth:!0,size:"small",disabled:p(v)===!1,value:Br.escapeTag(u),onChange:j=>w(j.target.value),variant:"outlined",label:"Key",placeholder:s("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:s("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:m=>m.value?m.secure?"******":t.jsx(Kn,{unstyled:!0,value:m.value,style:{wordBreak:"break-all"},children:m.value}):null,editComponent:m=>{const{value:u,rowData:v,onChange:w}=m;return t.jsxs(to,{children:[t.jsx(K,{fullWidth:!0,size:"small",value:u==="__encrypted__"?"":u,onChange:j=>w(j.target.value),variant:"outlined",label:s("common.value"),placeholder:s("blocklet.config.environment.value"),margin:"dense"}),Bs(v,s)]})}}];return t.jsxs(Os,{children:[!!T.length&&t.jsx($t,{severity:"error",style:{marginTop:24},children:s("blocklet.config.missingRequired")}),R&&t.jsx($t,{severity:"info",children:s("blocklet.config.environment.tip")}),t.jsx(At,{permission:r?"":"mutate_blocklets",role:r?He:[],children:m=>t.jsx(Ur,{className:"config-table",children:t.jsx(Nr,{title:t.jsx(y,{fontWeight:"bold",children:s("common.environments")}),columns:C(),icons:Ls,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:s("common.actions")},body:{emptyDataSourceMessage:s("common.noData")}},data:S,editable:m?k:{}})})})]})}Xt.propTypes={blocklet:i.object.isRequired,ancestors:i.array};Xt.defaultProps={ancestors:[]};const Os=$.div`
|
|
2
2
|
.config-table {
|
|
3
3
|
margin-bottom: 24px;
|
|
4
4
|
position: relative;
|
|
@@ -65,7 +65,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
65
65
|
.ux-dialog_closeButton {
|
|
66
66
|
margin: 0;
|
|
67
67
|
}
|
|
68
|
-
`,Jt={description:i.string,editing:i.bool,onChange:i.func,required:i.bool,value:i.any,componentProps:i.object,render:i.func,renderFormItem:i.func};function en({editing:e,value:o,onChange:n}){const[a,r]=f.useState(!1),s=f.useRef(),h=f.useRef(o);f.useEffect(()=>{let l=null;return e&&(l=setTimeout(()=>{r(!0)},50)),()=>{clearTimeout(l)}},[e]);const c=l=>{h.current=l,n(l)},p=()=>{r(!1),n(h.current)},x=t.jsx(y,{className:"form-item-input slot",px:1,children:t.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&t.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=t.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:p,children:[t.jsx(y,{display:"flex",alignItems:"center",onClick:()=>r(!0),children:t.jsx("div",{ref:s,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),t.jsx(qo,{open:a,anchorEl:s.current,onClose:()=>r(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:t.jsx(fs,{color:o,onChange:l=>c(l.hex)})})]});return e?g:x}en.propTypes=Jt;function tn({editing:e,description:o,value:n,onChange:a,componentProps:r,...s}){const{placeholder:h}=r,c=f.useRef(n),{t:p}=f.useContext(ve),x=l=>{l.key==="Enter"&&a(c.current,"confirm")},g=l=>{c.current=l,a(l)};return e?t.jsx(K,{style:{flex:1},fullWidth:!0,value:n,onChange:l=>{l.persist(),g(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||h,onKeyDown:x,...s}):t.jsx(y,{px:1,className:"form-item-input slot",children:n||t.jsx("span",{className:"placeholder",children:p("common.requiredInputPlaceholder",{name:o||h})})})}tn.propTypes=Jt;tn.defaultProps={componentProps:{}};function nn({editing:e,value:o,onChange:n,componentProps:a,...r}){const{blocklet:s}=a,h=o==="auto"?Wo.getPassportColorFromDid(s.appDid):o;return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Go({title:"Owner",issuer:B.getDisplayName(s),issuerDid:s.appDid,ownerName:"Your Name",ownerDid:s.appDid,preferredColor:o||"auto"})}}),t.jsx(en,{...r,editing:e,value:e?h:o,onChange:n,componentProps:a})]})}nn.propTypes={...Jt,componentProps:i.shape({blocklet:i.object.isRequired}).isRequired};nn.defaultProps={};const Ms=
|
|
68
|
+
`,Jt={description:i.string,editing:i.bool,onChange:i.func,required:i.bool,value:i.any,componentProps:i.object,render:i.func,renderFormItem:i.func};function en({editing:e,value:o,onChange:n}){const[a,r]=f.useState(!1),s=f.useRef(),h=f.useRef(o);f.useEffect(()=>{let l=null;return e&&(l=setTimeout(()=>{r(!0)},50)),()=>{clearTimeout(l)}},[e]);const c=l=>{h.current=l,n(l)},p=()=>{r(!1),n(h.current)},x=t.jsx(y,{className:"form-item-input slot",px:1,children:t.jsxs(y,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&t.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),g=t.jsxs(y,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:p,children:[t.jsx(y,{display:"flex",alignItems:"center",onClick:()=>r(!0),children:t.jsx("div",{ref:s,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),t.jsx(qo,{open:a,anchorEl:s.current,onClose:()=>r(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:t.jsx(fs,{color:o,onChange:l=>c(l.hex)})})]});return e?g:x}en.propTypes=Jt;function tn({editing:e,description:o,value:n,onChange:a,componentProps:r,...s}){const{placeholder:h}=r,c=f.useRef(n),{t:p}=f.useContext(ve),x=l=>{l.key==="Enter"&&a(c.current,"confirm")},g=l=>{c.current=l,a(l)};return e?t.jsx(K,{style:{flex:1},fullWidth:!0,value:n,onChange:l=>{l.persist(),g(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||h,onKeyDown:x,...s}):t.jsx(y,{px:1,className:"form-item-input slot",children:n||t.jsx("span",{className:"placeholder",children:p("common.requiredInputPlaceholder",{name:o||h})})})}tn.propTypes=Jt;tn.defaultProps={componentProps:{}};function nn({editing:e,value:o,onChange:n,componentProps:a,...r}){const{blocklet:s}=a,h=o==="auto"?Wo.getPassportColorFromDid(s.appDid):o;return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Go({title:"Owner",issuer:B.getDisplayName(s),issuerDid:s.appDid,ownerName:"Your Name",ownerDid:s.appDid,preferredColor:o||"auto"})}}),t.jsx(en,{...r,editing:e,value:e?h:o,onChange:n,componentProps:a})]})}nn.propTypes={...Jt,componentProps:i.shape({blocklet:i.object.isRequired}).isRequired};nn.defaultProps={};const Ms=Fo`
|
|
69
69
|
0%, 100% {
|
|
70
70
|
transform: scale(1) translateX(0);
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
75
75
|
25%, 75% {
|
|
76
76
|
transform: scale(1.1) translateX(3px);
|
|
77
77
|
}
|
|
78
|
-
`,As={input:tn,color:en,passport:nn,uploader:e=>t.jsx($r,{...e.componentProps})};function qs(e,{editing:o=!1}){const{componentType:n="input",render:a,renderFormItem:r}=e;return o&&r?r:!o&&a?a:As[n==null?void 0:n.toLowerCase()]}vt.propTypes={item:i.object.isRequired,findEditingItem:i.func.isRequired,getItemValue:i.func.isRequired,onFormItemChange:i.func.isRequired,onFocusOut:i.func.isRequired,disabled:i.bool,loading:i.bool,onCancel:i.func,formValues:i.object.isRequired};vt.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function vt({item:e,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,disabled:s,loading:h,onCancel:c,formValues:p}){var w;const{key:x,description:g,required:l,solo:b=!1,hidden:d=!1,componentProps:T={},skipButtonDisabled:S=!1}=e;if(d)return null;const R=o(x),{editing:k,shaking:C}=R??{},m=n(e,{editing:k}),u=qs(e,{editing:k}),v={inputProps:{"data-cy":"schema-form-item-component"},key:x,description:g,editing:k,value:m,onChange:(j,N="change")=>a(e,j,N),componentProps:T,skipButtonDisabled:S,onBlur:()=>r(e)};return e.componentType==="collapse"&&((w=e.children)==null?void 0:w.length)>0?t.jsxs(ds,{children:[t.jsx(us,{expandIcon:t.jsx(ps,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),t.jsx(ms,{children:e.children.map(j=>t.jsx(vt,{item:j,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,formValues:p,disabled:s,loading:h,onCancel:c},j.key))})]}):t.jsxs(y,{className:"form-item",children:[!b&&t.jsxs(y,{className:"form-item-label",sx:{color:l&&!m?"error.main":"text.secondary"},children:[g,l&&t.jsx(dt,{})]}),t.jsxs(y,{className:"form-item-body",children:[t.jsx(y,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:b?"center":"left"},style:{cursor:"text"},onClick:()=>{s||R!=null&&R.edited||S||a(e,p[x],"edit")},children:t.jsx(u,{...v})}),!b&&t.jsx(y,{className:"form-item-action",style:{marginLeft:0},children:k?t.jsxs(t.Fragment,{children:[R.edited?t.jsx(Z,{"data-cy":"schema-form-item-confirm",onClick:()=>{a(e,m,"confirm")},disabled:s||h,sx:{animation:C?`${Ms} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?t.jsx(ue,{size:24}):t.jsx(cs,{})}):null,t.jsx(Z,{"data-cy":"schema-form-item-cancel",onClick:()=>c(e),style:{paddingLeft:R.edited?4:8},disabled:s||h,size:"large",children:t.jsx(
|
|
78
|
+
`,As={input:tn,color:en,passport:nn,uploader:e=>t.jsx($r,{...e.componentProps})};function qs(e,{editing:o=!1}){const{componentType:n="input",render:a,renderFormItem:r}=e;return o&&r?r:!o&&a?a:As[n==null?void 0:n.toLowerCase()]}vt.propTypes={item:i.object.isRequired,findEditingItem:i.func.isRequired,getItemValue:i.func.isRequired,onFormItemChange:i.func.isRequired,onFocusOut:i.func.isRequired,disabled:i.bool,loading:i.bool,onCancel:i.func,formValues:i.object.isRequired};vt.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function vt({item:e,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,disabled:s,loading:h,onCancel:c,formValues:p}){var w;const{key:x,description:g,required:l,solo:b=!1,hidden:d=!1,componentProps:T={},skipButtonDisabled:S=!1}=e;if(d)return null;const R=o(x),{editing:k,shaking:C}=R??{},m=n(e,{editing:k}),u=qs(e,{editing:k}),v={inputProps:{"data-cy":"schema-form-item-component"},key:x,description:g,editing:k,value:m,onChange:(j,N="change")=>a(e,j,N),componentProps:T,skipButtonDisabled:S,onBlur:()=>r(e)};return e.componentType==="collapse"&&((w=e.children)==null?void 0:w.length)>0?t.jsxs(ds,{children:[t.jsx(us,{expandIcon:t.jsx(ps,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),t.jsx(ms,{children:e.children.map(j=>t.jsx(vt,{item:j,findEditingItem:o,getItemValue:n,onFormItemChange:a,onFocusOut:r,formValues:p,disabled:s,loading:h,onCancel:c},j.key))})]}):t.jsxs(y,{className:"form-item",children:[!b&&t.jsxs(y,{className:"form-item-label",sx:{color:l&&!m?"error.main":"text.secondary"},children:[g,l&&t.jsx(dt,{})]}),t.jsxs(y,{className:"form-item-body",children:[t.jsx(y,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:b?"center":"left"},style:{cursor:"text"},onClick:()=>{s||R!=null&&R.edited||S||a(e,p[x],"edit")},children:t.jsx(u,{...v})}),!b&&t.jsx(y,{className:"form-item-action",style:{marginLeft:0},children:k?t.jsxs(t.Fragment,{children:[R.edited?t.jsx(Z,{"data-cy":"schema-form-item-confirm",onClick:()=>{a(e,m,"confirm")},disabled:s||h,sx:{animation:C?`${Ms} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?t.jsx(ue,{size:24}):t.jsx(cs,{})}):null,t.jsx(Z,{"data-cy":"schema-form-item-cancel",onClick:()=>c(e),style:{paddingLeft:R.edited?4:8},disabled:s||h,size:"large",children:t.jsx(zo,{})})]}):null})]})]},x)}function on({schema:e,loading:o,value:n,defaultValue:a,onChange:r,style:s,disabled:h}){const c=Object.prototype.toString.call(n)==="[object Object]",[p,x]=f.useState([]),[g,l]=f.useState(c?n:a),b=f.useMemo(()=>e.length===1,[e]),d=f.useCallback(u=>p.find(v=>v.key===u),[p]);f.useEffect(()=>{var u;b&&((u=e[0])!=null&&u.required)&&x([{key:e[0].key,editing:!0,initialValue:a[e[0].key]}])},[e,b,a]);const T=f.useCallback(u=>{x(v=>v.find(j=>j.key===u.key)?v.map(j=>j.key===u.key?u:{...j}):[u].concat(v))},[]),S=f.useCallback((u,v,w)=>{const{key:j,secure:N}=u,M=d(j)??{...u};M.editing=!0;const I=g[j]!==v;M.edited=v&&M.initialValue!==v,M.initialValue=a[j];const ne={...g,[j]:v};I&&l(ne),r({[j]:v},{allValues:ne,action:w,currentItem:u}),w==="confirm"&&N&&l({...g,[j]:"__encrypted__"}),w==="confirm"&&(M.initialValue=g[j]),["confirm","cancel"].includes(w)&&(M.editing=!1,M.edited=!1),T(M)},[a,g,r,T,d]),R=f.useCallback((u,{editing:v=!1})=>{const{key:w}=u,j=c?n[w]:g[w];return j==="__encrypted__"?v?"":"******":j},[c,n,g]),k=f.useCallback(u=>{const v=d(u.key);v&&S(u,v.initialValue,"cancel")},[d,S]),C=f.useCallback(u=>{const v=d(u.key);!v||!v.edited||(v.shaking=!0,T(v),setTimeout(()=>{v.shaking=!1,T(v)},500))},[d,T]),m=f.useCallback(u=>{const v=d(u.key);!v||!v.edited?k(u):C(u)},[d,C,k]);return t.jsx(Ws,{className:"form",style:s,children:e==null?void 0:e.map(u=>{const{hidden:v=!1}=u;return v?null:t.jsx(vt,{item:u,findEditingItem:d,getItemValue:R,onFormItemChange:S,onFocusOut:m,formValues:g,disabled:h,loading:o,onCancel:k})})})}on.propTypes={schema:i.array.isRequired,loading:i.bool,onChange:i.func.isRequired,value:i.object,defaultValue:i.object,style:i.object,disabled:i.bool};on.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Ws=$(Or)``;function rn({meta:e,onCancel:o,mode:n,handlePaySuccess:a}){const{t:r,locale:s}=G(),{info:h}=H(),c=Vo(h),[p,x]=f.useState(null),g=new URL(e==null?void 0:e.registryUrl).origin,l=B.getDisplayName({meta:e}),b=async(T,S)=>{const R=({downloadTokenList:m})=>{a({downloadTokenList:m})},k=m=>{L.error(m),o(m)};function C(m){return Ho(()=>Qn.get(m).then(async({data:u})=>{const v=u==null?void 0:u.downloadTokenList;if(u.status==="succeed"){if(v&&v.length)await R({downloadTokenList:v});else return await k(r("blocklet.component.missDownloadTokenTip")),!0;return!0}return u.status==="error"?(console.error("vc error: ",u),await k(u==null?void 0:u.error),!0):!1}),{interval:1e3})}if(n==="purchase"&&p){const{statusUrl:m}=Ko(p);await C(m)}else await R({downloadTokenList:T.downloadTokenList&&S(T.downloadTokenList)})};if(f.useEffect(()=>{if(n==="purchase"){const T=new URL(g);T.pathname="/api/did/verify-purchase-blocklet/token",T.searchParams.set("serverDid",h.did),T.searchParams.set("blockletDid",e==null?void 0:e.did);try{Qn.get(T.href).then(({data:S})=>{const R=`${S.url}`;x(R)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{x(null)}},[n]),n==="purchase"&&!p)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:Wn.create({baseURL:g}).get,extraParams:{serverDid:h.did,blockletDid:e==null?void 0:e.did},messages:{title:r("store.purchase.verify.auth.title",{name:l}),scan:r("store.purchase.verify.auth.scan"),confirm:r("store.purchase.verify.auth.confirm"),success:r("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Wn.create({baseURL:gt(g,"/store")}).get,extraParams:{factory:e.nftFactory,nw:p},messages:{title:r("store.purchase.auth.title",{name:l}),scan:r("store.purchase.auth.scan"),confirm:r("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:r("store.purchase.auth.success")}),t.jsx("p",{children:r("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return t.jsx(Yo,{open:!0,locale:s,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:b,cancelWhenScanned:o,onClose:o,checkTimeout:60*5e3,webWalletUrl:c,disableClose:!0,showDownload:!1,...d[n]})}rn.propTypes={...qr,handlePaySuccess:i.func,mode:i.oneOf(["verify","purchase"]).isRequired};rn.defaultProps={handlePaySuccess:()=>{}};const sn=f.forwardRef(({mode:e,...o},n)=>{const[a,r]=f.useState(e!=="both"?e:"verify"),[s,h]=f.useState(e!=="both"?2:1),c=x=>{x!==a&&r(x)},p=()=>{a&&s!==2&&h(2)};return f.useImperativeHandle(n,()=>({onNext:p,getCurrentStep:()=>s})),s===1?t.jsx("div",{style:{maxWidth:520},children:t.jsx(Wr,{action:a,onNext:null,onSelect:c})}):t.jsx(rn,{...o,mode:a})});sn.propTypes={mode:i.oneOf(["both","verify","purchase"]).isRequired,ref:i.any};sn.defaultProps={ref:{}};const Gs=sn;function Fs({...e}){return t.jsx(ae,{className:"bottom-button",variant:"contained",color:"primary",...e})}function an({blocklet:e,onStartNow:o,children:n,disabled:a}){const{t:r}=G(),s=vo();return!e||Qo(e.meta)?t.jsx(zs,{children:n}):t.jsxs(Vs,{isMobile:s,children:[t.jsx(Fs,{className:"start-now",variant:"contained",color:"primary",disabled:a,onClick:()=>o(),children:r("setup.startNow")}),t.jsx(y,{display:"flex",alignItems:"center",children:n})]})}an.propTypes={blocklet:i.object,onStartNow:i.func,children:i.any,disabled:i.bool};an.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const zs=$(y)`
|
|
79
79
|
width: 100%;
|
|
80
80
|
margin-top: auto;
|
|
81
81
|
padding-top: 24px;
|
|
@@ -125,7 +125,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
125
125
|
overflow-y: auto;
|
|
126
126
|
padding-bottom: 32px;
|
|
127
127
|
overflow-x: hidden;
|
|
128
|
-
`;function cn({onChange:e,loading:o,children:n,extra:a,stores:r,storageKey:s}){const{t:h}=G(),{info:c,inService:p}=H(),{blocklet:x}=pe(),[g,l]=f.useState(!1),b=f.useRef(null),[d,T]=f.useState(),[S,R]=bs(s||"tmp"),[k,C]=s?[S,R]:[d,T],{storeList:m,teamDid:u}=lo({fromBlocklet:p,blocklet:x,nodeInfo:c}),v=co([...r.map(j=>({...j,protected:!0})),...m],"url"),w=k&&v.find(j=>k===j.url)||v[0];return t.jsxs(t.Fragment,{children:[t.jsxs(Ks,{children:[t.jsx(ae,{ref:b,color:"primary","data-cy":"add-component-select-store",endIcon:t.jsx(vs,{color:"primary"}),onClick:()=>{l(!0)},style:{padding:"0 2px"},children:t.jsx(te,{color:"primary",children:w.name})}),t.jsx(te,{color:"primary",children:a})]}),t.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:h("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:w,autoFocus:!0,onChange:j=>{const N=j.target.value;C(N.url),e(N)},SelectProps:{open:g,MenuProps:{anchorEl:b.current},renderValue:j=>j==null?void 0:j.name,onClose:()=>{l(!1)}},style:{display:"none"},margin:"normal",children:[v==null?void 0:v.map(j=>t.jsx(ye,{sx:{width:"400px",maxWidth:"90vw"},value:j,"data-cy":j.url,children:t.jsx(Gr,{teamDid:u,store:j,onDelete:()=>{var N;k===j.url&&C((N=v[0])==null?void 0:N.url)}})},j.url)),!xo.isInServerlessMode(c)&&t.jsx(
|
|
128
|
+
`;function cn({onChange:e,loading:o,children:n,extra:a,stores:r,storageKey:s}){const{t:h}=G(),{info:c,inService:p}=H(),{blocklet:x}=pe(),[g,l]=f.useState(!1),b=f.useRef(null),[d,T]=f.useState(),[S,R]=bs(s||"tmp"),[k,C]=s?[S,R]:[d,T],{storeList:m,teamDid:u}=lo({fromBlocklet:p,blocklet:x,nodeInfo:c}),v=co([...r.map(j=>({...j,protected:!0})),...m],"url"),w=k&&v.find(j=>k===j.url)||v[0];return t.jsxs(t.Fragment,{children:[t.jsxs(Ks,{children:[t.jsx(ae,{ref:b,color:"primary","data-cy":"add-component-select-store",endIcon:t.jsx(vs,{color:"primary"}),onClick:()=>{l(!0)},style:{padding:"0 2px"},children:t.jsx(te,{color:"primary",children:w.name})}),t.jsx(te,{color:"primary",children:a})]}),t.jsxs(K,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:h("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:w,autoFocus:!0,onChange:j=>{const N=j.target.value;C(N.url),e(N)},SelectProps:{open:g,MenuProps:{anchorEl:b.current},renderValue:j=>j==null?void 0:j.name,onClose:()=>{l(!1)}},style:{display:"none"},margin:"normal",children:[v==null?void 0:v.map(j=>t.jsx(ye,{sx:{width:"400px",maxWidth:"90vw"},value:j,"data-cy":j.url,children:t.jsx(Gr,{teamDid:u,store:j,onDelete:()=>{var N;k===j.url&&C((N=v[0])==null?void 0:N.url)}})},j.url)),!xo.isInServerlessMode(c)&&t.jsx(Fr,{disabled:o,storeList:v,teamDid:u,onAdd:j=>{C(j)}})]}),n({currentRegistry:w})]})}cn.propTypes={onChange:i.func,loading:i.bool,children:i.any.isRequired,extra:i.node,storageKey:i.string,stores:i.arrayOf(i.shape({name:i.string.isRequired,url:i.string.isRequired}))};cn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Ks=$.div`
|
|
129
129
|
display: flex;
|
|
130
130
|
justify-content: space-between;
|
|
131
131
|
align-items: center;
|
|
@@ -136,7 +136,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
136
136
|
color: ${e=>e.theme.palette.text.primary};
|
|
137
137
|
// font-weight: bold;
|
|
138
138
|
}
|
|
139
|
-
`,Hs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Qs={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Zs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Xs=(e,o)=>gt(o,`/blocklets/${e.did}`),no=({blocklet:e,attribute:o,value:n})=>e._formatted?e._formatted[o]:n,Js=e=>e.inStore&&B.isFreeBlocklet(e)===!1;function dn({blocklet:e,blocklets:o,handleButtonClick:n,endpoint:a,serverVersion:r}){var R,k;const{t:s}=G();let h=gt(a,or(e.did,e.logo||""));try{const C=new URL(h);C.searchParams.set("v",e.version||+new Date),h=C.href}catch{}const[c,p]=f.useState(!1),x=async()=>{try{p(!0),await n({meta:e,registryUrl:a,blocklets:o})}catch(C){L.error(C.message)}finally{p(!1)}},{blocklet:g}=pe(),l=()=>((g==null?void 0:g.children)||[]).find(u=>u.meta.bundleDid===e.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(m=>m.meta.bundleDid===e.did);if(C){try{const m=C.meta.version,u=e.version;if(rr.gt(u,m))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),T=(R=e.requirements)==null?void 0:R.server,S=[];return d==="upgrade"?S.push({key:"upgrade",icon:t.jsx(Q,{icon:Zs,color:"success.light",width:20,height:20},"version"),title:`${l()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:t.jsx(y,{sx:{fontWeight:"bold"},children:s("blocklet.component.upgradeAvailable")})}):d==="disable"?S.push({key:"disable",icon:t.jsx(Q,{icon:Hs,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:s("blocklet.component.installed")}):Js(e)&&S.push({key:"purchase",icon:t.jsx(Q,{icon:Qs,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:s("blocklet.component.needBuy")}),t.jsx(ei,{title:no({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:no({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?h:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:d!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:d==="disable"?void 0:x,icons:(k=e.docker)!=null&&k.image?[{key:"docker",icon:t.jsx(y,{display:"flex",color:"primary.main",children:t.jsx(Q,{icon:yo})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:t.jsx(Vr,{serverVersion:r,requirementVersion:T,size:"small",children:t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Yr,{children:t.jsx(ae,{size:"small",disabled:c,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const m=Xs(e,a);m&&window.open(m,"_blank","noopener,noreferrer")},children:s("common.detail")},e.did)})})})})}dn.propTypes={blocklet:i.object.isRequired,blocklets:i.array,handleButtonClick:i.func,endpoint:i.string,serverVersion:i.string};dn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[],serverVersion:""};function un({handleButtonClick:e,handleSearchSelect:o,storeUrl:n,handleBlockletRender:a,extraFilter:r,serverVersion:s,resourceType:h,resourceDid:c,showResourcesSwitch:p,showCategory:x,compact:g,...l}){const b=ft(),{locale:d}=G(),[T,S]=f.useState(!1),[R,k]=f.useState({}),C=v=>{k(v)},m=n,u=f.useMemo(()=>Jo(b,{palette:{background:{default:b.palette.background.paper}}}),[b]);return f.useEffect(()=>{k({showResources:!0,resourceType:h,resourceDid:c})},[m,h,c]),f.useEffect(()=>{S(!0),k({showResources:!0,resourceType:h,resourceDid:c})},[]),t.jsx(er,{theme:u,children:t.jsx(tr,{FallbackComponent:nr,resetKeys:[m],children:t.jsxs(y,{...l,sx:[{overflow:"auto",".title-bar + div":{height:"unset"}},Array.isArray(l.sx)?l.sx:[l.sx]],children:[T&&t.jsx(
|
|
139
|
+
`,Hs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Qs={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Zs={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Xs=(e,o)=>gt(o,`/blocklets/${e.did}`),no=({blocklet:e,attribute:o,value:n})=>e._formatted?e._formatted[o]:n,Js=e=>e.inStore&&B.isFreeBlocklet(e)===!1;function dn({blocklet:e,blocklets:o,handleButtonClick:n,endpoint:a,serverVersion:r}){var R,k;const{t:s}=G();let h=gt(a,or(e.did,e.logo||""));try{const C=new URL(h);C.searchParams.set("v",e.version||+new Date),h=C.href}catch{}const[c,p]=f.useState(!1),x=async()=>{try{p(!0),await n({meta:e,registryUrl:a,blocklets:o})}catch(C){L.error(C.message)}finally{p(!1)}},{blocklet:g}=pe(),l=()=>((g==null?void 0:g.children)||[]).find(u=>u.meta.bundleDid===e.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(m=>m.meta.bundleDid===e.did);if(C){try{const m=C.meta.version,u=e.version;if(rr.gt(u,m))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),T=(R=e.requirements)==null?void 0:R.server,S=[];return d==="upgrade"?S.push({key:"upgrade",icon:t.jsx(Q,{icon:Zs,color:"success.light",width:20,height:20},"version"),title:`${l()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:t.jsx(y,{sx:{fontWeight:"bold"},children:s("blocklet.component.upgradeAvailable")})}):d==="disable"?S.push({key:"disable",icon:t.jsx(Q,{icon:Hs,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:s("blocklet.component.installed")}):Js(e)&&S.push({key:"purchase",icon:t.jsx(Q,{icon:Qs,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:s("blocklet.component.needBuy")}),t.jsx(ei,{title:no({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:no({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?h:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:d!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:d==="disable"?void 0:x,icons:(k=e.docker)!=null&&k.image?[{key:"docker",icon:t.jsx(y,{display:"flex",color:"primary.main",children:t.jsx(Q,{icon:yo})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:t.jsx(Vr,{serverVersion:r,requirementVersion:T,size:"small",children:t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Yr,{children:t.jsx(ae,{size:"small",disabled:c,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const m=Xs(e,a);m&&window.open(m,"_blank","noopener,noreferrer")},children:s("common.detail")},e.did)})})})})}dn.propTypes={blocklet:i.object.isRequired,blocklets:i.array,handleButtonClick:i.func,endpoint:i.string,serverVersion:i.string};dn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[],serverVersion:""};function un({handleButtonClick:e,handleSearchSelect:o,storeUrl:n,handleBlockletRender:a,extraFilter:r,serverVersion:s,resourceType:h,resourceDid:c,showResourcesSwitch:p,showCategory:x,compact:g,...l}){const b=ft(),{locale:d}=G(),[T,S]=f.useState(!1),[R,k]=f.useState({}),C=v=>{k(v)},m=n,u=f.useMemo(()=>Jo(b,{palette:{background:{default:b.palette.background.paper}}}),[b]);return f.useEffect(()=>{k({showResources:!0,resourceType:h,resourceDid:c})},[m,h,c]),f.useEffect(()=>{S(!0),k({showResources:!0,resourceType:h,resourceDid:c})},[]),t.jsx(er,{theme:u,children:t.jsx(tr,{FallbackComponent:nr,resetKeys:[m],children:t.jsxs(y,{...l,sx:[{overflow:"auto",".title-bar + div":{height:"unset"}},Array.isArray(l.sx)?l.sx:[l.sx]],children:[T&&t.jsx(zr,{showCategory:x,showResourcesSwitch:p,blockletRender:v=>{const w={...v,handleButtonClick:e,endpoint:m};return a({...v,defaultRender:t.jsx(dn,{...w})})},compact:g,minItemWidth:300,baseSearch:!0,endpoint:m,locale:d,onFilterChange:C,onSearchSelect:o,filters:R,extraFilter:r,serverVersion:s,fetchCategoryDelay:500}),t.jsx(y,{sx:{mt:2},children:" "})]})})})}un.propTypes={storeUrl:i.string.isRequired,handleButtonClick:i.func,handleSearchSelect:i.func,handleBlockletRender:i.func,extraFilter:i.func,serverVersion:i.string,resourceType:i.string,resourceDid:i.string,showResourcesSwitch:i.bool,showCategory:i.bool,compact:i.bool};un.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0,compact:!1};const ei=$(Kr)`
|
|
140
140
|
.ms-highlight {
|
|
141
141
|
color: ${e=>e.theme.palette.primary.main};
|
|
142
142
|
}
|
|
@@ -281,7 +281,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
281
281
|
& .connect {
|
|
282
282
|
background: white;
|
|
283
283
|
}
|
|
284
|
-
`,oi=pn,ri=e=>e.inStore&&B.isFreeBlocklet(e)===!1,si=e=>{var o;return[Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=e==null?void 0:e.capabilities)==null?void 0:o.didSpace)},Ot=e=>{var o,n;return((n=(o=e==null?void 0:e.configs)==null?void 0:o.find(a=>a.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:n.value)||null},ii=e=>(e.environments||[]).some(o=>o.required),ro=(e,o)=>e==null?void 0:e.some(n=>n.required&&!o[n.key]),ai=({params:e,blocklet:o,t:n})=>{const a=e.title||e.name;return a?((o==null?void 0:o.children)||[]).find(s=>s.meta.bundleDid===e.bundleDid)?n("blocklet.component.upgradeNext",{name:a}):n("blocklet.component.addNext",{name:a}):n("common.next")},so=({componentDid:e,timeout:o=1e3,manual:n=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:n},"*")},o)};function mn({onClose:e,mode:o,stores:n,resourceType:a,resourceDid:r,storageKey:s,inDialog:h,selectedMeta:c,storeUrl:p,showResourcesSwitch:x,showFromUrl:g,enableRunBackground:l,showCategory:b}){var _n,In,Dn,Un,Je,Nn,et,Ln,Bn,On;const{t:d,locale:T}=G(),[S,R]=f.useState(!1),[k,C]=f.useState(null),[m,u]=f.useState(""),[v,w]=f.useState(""),{api:j,ws:{useSubscription:N},inService:M,info:X}=H(),{blocklet:I,actions:{refreshBlocklet:ne}}=pe(),[me,J]=f.useState(null),[Pe,we]=f.useState(!1),Ee={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[_,fe]=f.useState(Ee),[W,he]=f.useState(0),A=f.useRef({}),ke=f.useRef({}),le=f.useRef({}),_e=uo(P=>P.breakpoints.down("md")),E=ir(),[V,ce]=f.useState(!0),{meta:z}=A.current,ee=as(z),be=f.useRef(!1),F=P=>fe(D=>({...D,...P}));f.useEffect(()=>{if(_.pathPrefix){const{errMsg:P}=kn({..._,pathPrefix:_.pathPrefix,locale:T});u(P)}},[_.pathPrefix]),f.useEffect(()=>{W===0&&fe(Ee)},[W]);const Ie=()=>{const P=Ot(I)??"";F({didSpaceEndpoint:P})},Re=()=>{var P;return(P=A==null?void 0:A.current)!=null&&P.meta?B.getDisplayName(A.current):""},Ge=()=>{R(!1),fe({}),be.current=!1,A.current={},e()},Le=P=>{const D=O=>{F({installResultProps:{variant:"error",title:Re(),subTitle:P,footer:t.jsx(ae,{className:"bottom-button",disabled:O,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await Pn(A.current.installInput)},children:t.jsxs(y,{display:"flex",alignItems:"center",children:[O&&t.jsx(ue,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};D()},Xe=P=>D=>{var O,q;(((O=D==null?void 0:D.meta)==null?void 0:O.did)||(D==null?void 0:D.meta))===((q=I==null?void 0:I.meta)==null?void 0:q.did)&&P(D)},_o=()=>{so({timeout:0,componentDid:E.componentDid,manual:!0}),Ge(),setTimeout(()=>{const P=document.getElementsByClassName("dashboard-main")[0];P&&(P.scrollTop=P.scrollHeight)},200)};N(Y.BlockletEvents.componentInstalled,Xe(()=>{F({installResultProps:{variant:"success",title:Re(),subTitle:d("blocklet.component.installSuccessTip")}}),so({componentDid:E.componentDid})}),[(_n=I==null?void 0:I.meta)==null?void 0:_n.did]),N(Y.BlockletEvents.statusChange,Xe(()=>{const P=Ot(I);F(D=>({...D,didSpaceEndpoint:P}))}),[(In=I==null?void 0:I.meta)==null?void 0:In.did]),N(Y.BlockletEvents.downloadFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Dn=I==null?void 0:I.meta)==null?void 0:Dn.did]),N(Y.BlockletEvents.installFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Un=I==null?void 0:I.meta)==null?void 0:Un.did]);const de=[],Tn=P=>((I==null?void 0:I.children)||[]).find(D=>D.meta.did===P),Pn=async P=>{var Oe,$e;be.current=!0;const{pathPrefix:D,bundleDid:O,title:q,componentName:De="",componentDid:Be=""}=_,Ue=((Oe=A.current)==null?void 0:Oe.meta)||{},{configs:Se=[],registryUrl:Te,inStore:Fe,inputUrl:Ve,dist:Pt}=Ue,Ye=($e=A.current)==null?void 0:$e.downloadTokenList,re=Ve||(Fe?Gn(Te,O,Pt):"");R(!0);const tt={rootDid:I.meta.did,url:re,mountPoint:D?je(D):`/${je(Ue.title||Ue.name)}`,title:q,name:De,did:Be,dist:{tarball:"",integrity:""},onlyRequired:!V,..._.hasEnvironmentsStep&&Se.length>0?{configs:Se.map(xe=>({...xe,value:_.configsValue[xe.key]||""}))}:{},...Ye?{downloadTokenList:Ye}:{},...P};try{if(await j.installComponent({input:tt}),Te){const{teamDid:xe,storeList:Me}=lo({fromBlocklet:M,nodeInfo:X,blocklet:I}),{isNew:kt,decoded:nt}=cr(Te,Me);kt&&await j.addBlockletStore({input:{teamDid:xe,url:nt}})}F({installResultProps:{}}),ne({showError:!1,attachRuntimeInfo:!1})}catch(xe){const Me=ie(xe);L.error(Me),console.error("installComponent error: ",xe),Le(Me)}finally{R(!1),A.current.installInput=tt}},kn=P=>{const D=jo({params:{...P,did:P.bundleDid},blocklets:[I],blocklet:I,locale:T});if(D){const O=Tn(P.bundleDid),q=js({params:{...P,did:P.bundleDid},blocklet:I});if(O&&O.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async P=>{var O,q;const{errMsg:D}=kn({..._,locale:T});u(D),W===de.length-2&&!be.current&&await Pn(P),(q=(O=ke.current)==null?void 0:O.setActiveStepByIndex)==null||q.call(O,De=>De+1)},ze=()=>{var P,D;(D=(P=ke.current)==null?void 0:P.setActiveStepByIndex)==null||D.call(P,O=>O-1)},Io=()=>{const{pathPrefix:P,bundleDid:D,title:O,componentName:q="",componentDid:De=""}=_,{meta:Be={}}=A.current||{},{registryUrl:Ue,inStore:Se,inputUrl:Te,dist:Fe}=Be,Ve=Se?Gn(Ue,D,Fe):Te;J({meta:Be,installOpts:{type:"component",rootDid:I.meta.did,mountPoint:P,url:Ve,title:O,name:q,did:De}})},Do=P=>{we(!1),F({purchaseResultProps:{variant:"error",title:Re(),subTitle:P,style:{paddingTop:120},footer:t.jsx(ae,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{F({purchaseResultProps:{}})},children:d("common.retry")})}})},Uo=({downloadTokenList:P})=>{A.current.downloadTokenList=P,we(!1),ge()},Tt=({chooseParams:P=A.current,componentDid:D,isInit:O=!1})=>{var nt,$n,Mn,An;const{meta:q,registryUrl:De,inStore:Be,inputUrl:Ue}=P,{did:Se,title:Te,name:Fe}=q,Ve=(((nt=I.settings)==null?void 0:nt.children)||[]).filter(se=>se.status==="deleted"&&se.meta.bundleDid===Se),Pt=D||"",Ye=($n=q.environments)==null?void 0:$n.map(se=>{const{name:_t,validation:ot,...rt}=se,It={validation:dr(ot)?"":ot};return{...rt,key:_t,...It}});A.current={...P,meta:{...q,configs:Ye,registryUrl:De,inStore:Be,inputUrl:Ue}};let re={};if(O){const se=[I],_t=Ye||[],ot=[],rt=co(lr([..._t,...ot]),"key").filter(Ae=>!!Ae.key).sort((Ae,st)=>Ae.required&&!st.required?-1:st.required&&!Ae.required?1:0),It=B.getSharedConfigObj(se[0],{configs:rt}),Dt={},qn=rt.map(Ae=>{const{default:st,key:it,...Lo}=Ae;return Dt[it]=It[it]||st,{...Lo,key:it,hidden:!!Y.BLOCKLET_CONFIGURABLE_KEY[it]}});re={...re,configsList:qn,configsValue:Dt,hasMissRequiredConfigs:ro(qn,Dt)}}const tt=I.children.some(se=>se.mountPoint==="/"),Oe=Ve.find(se=>se.meta.bundleDid===Se),$e=I.children.find(se=>se.meta.bundleDid===Se);re.title=Te||"",Oe?re={...re,pathPrefix:Oe.mountPoint||"",componentName:Oe.meta.name,hasEnvironmentsStep:!1}:$e?re={...re,pathPrefix:$e.mountPoint||"",componentName:$e.meta.name,hasEnvironmentsStep:!1}:re={...re,pathPrefix:tt?`/${je(Te)||je(Fe)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((An=(Mn=A.current.meta)==null?void 0:Mn.environments)==null?void 0:An.length)>0};const xe=ri(A.current.meta),Me=si(A.current.meta),kt=Ot(I);F({bundleDid:Se,componentDid:Pt,...re,hasRequiredEnvironments:ii(A.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:Me,didSpaceEndpoint:kt}),O&&xe&&Io()};f.useEffect(()=>{!c||W!==0||!I||(Tt({chooseParams:{blocklets:[c],meta:c,registryUrl:p||c.homepage,inStore:!0},isInit:!0}),F({showFromUrlDialog:!1}),ge())},[c,W,I]),de.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:t.jsxs(Ne,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[g&&_.showFromUrlDialog&&t.jsx(gs,{mode:"component",onCancel:()=>{F({showFromUrlDialog:!1})},onSuccess:({meta:P,inputUrl:D,inStore:O,registryUrl:q})=>{Tt({chooseParams:{meta:P,inputUrl:D,inStore:O,registryUrl:q},isInit:!0}),F({showFromUrlDialog:!1}),ge()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),t.jsx(cn,{stores:n,extra:xo.isInServerlessMode(X)?null:g?t.jsxs(ae,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{F({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[t.jsx(Yt,{style:{fontSize:20,marginRight:4}}),d("blocklet.component.addComponentTip.fromUrl")]}):null,loading:S,onChange:()=>{fe({}),A.current={}},storageKey:s,children:({currentRegistry:P})=>t.jsx(un,{showResourcesSwitch:x,showCategory:b,serverVersion:X==null?void 0:X.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:P.url,resourceType:a,resourceDid:r,handleButtonClick:D=>{Tt({chooseParams:{...D,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:D,defaultRender:O})=>{const q=(_==null?void 0:_.bundleDid)&&(_==null?void 0:_.bundleDid)===(D==null?void 0:D.did);return t.jsxs(ci,{children:[t.jsx(y,{className:q?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...q?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:O}),q&&t.jsx(y,{className:"check-container",children:t.jsx(ar,{className:"check-icon"})})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:_,blocklet:I,t:d}),onCancel:Ge,onConfirm:()=>{ge()}}),de.push({key:"agreement",name:d("launchBlocklet.introduction"),body:t.jsxs(Ne,{component:"div",className:"agreement-wrapper",children:[t.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),t.jsx(ls,{meta:z,onClickNext:ge,installRelated:V,onChangeInstallRelated:ce,handleDescEle:t.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:c?void 0:d("common.pre"),disabled:!ee,confirm:d(ee?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:c?Ge:ze,onConfirm:()=>{we(!1),ge()}}),z&&_.requirePurchase&&de.push({key:"purchase",name:t.jsxs(t.Fragment,{children:[d("common.verifyNFT"),t.jsx(dt,{})]}),body:t.jsxs(Ne,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Nn=(Je=le.current)==null?void 0:Je.getCurrentStep)==null?void 0:Nn.call(Je))===2||Pe)&&t.jsx(ct,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),at(_.purchaseResultProps)?me&&t.jsx(Gs,{ref:le,meta:me.meta,mode:_.componentDid?"verify":"both",onCancel:Do,installOpts:me.installOpts,handlePaySuccess:Uo}):t.jsx("div",{className:"flex-align-center flex-justify-center",children:t.jsx(Hn,{..._.purchaseResultProps})})]}),disabled:((Ln=(et=le.current)==null?void 0:et.getCurrentStep)==null?void 0:Ln.call(et))===2||Pe,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof le.current.onNext=="function"&&(le.current.onNext(),we(!0))},onCancel:()=>{ze()}}),B.hasStartEngine(z)&&po.hasMountPoint(z)?de.push({key:"config",name:d("common.config"),error:m,body:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),t.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:v||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:_.pathPrefix,onChange:P=>{const D=P.target.value;F({pathPrefix:D}),w(d("common.slugifyHint",{value:zt(D)}))}}),!!m&&t.jsx($t,{severity:"error",style:{width:"100%",marginTop:8},children:m})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:ze,onConfirm:()=>{ge()}}):z&&(_.pathPrefix=((On=(Bn=z.interfaces)==null?void 0:Bn[0])==null?void 0:On.path)||`/${z.did}`),z&&(_!=null&&_.hasEnvironmentsStep)&&de.push({key:"environment",name:t.jsxs(t.Fragment,{children:[d("common.environment")," ",_.hasRequiredEnvironments&&t.jsx(dt,{})]}),disabled:!!k||(_==null?void 0:_.hasMissRequiredConfigs),body:()=>t.jsxs(Ne,{component:"div",style:{overflowY:"auto"},children:[t.jsx(ct,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),t.jsx(on,{style:{marginTop:-12,width:"100%"},schema:_.configsList,defaultValue:_.configsValue,onChange:(P,{action:D,currentItem:O,allValues:q})=>{D==="confirm"&&F({hasMissRequiredConfigs:ro(_.configsList,q),configsValue:q}),D==="edit"?C(O):["cancel","confirm"].includes(D)&&C(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:ze,onConfirm:ge}),z&&(_!=null&&_.didSpaceIsRequiredSetup)&&de.push({key:"didSpace",name:t.jsxs(t.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",_.didSpaceIsRequiredSetup==="required"&&t.jsx(dt,{})]}),disabled:(_==null?void 0:_.didSpaceIsRequiredSetup)&&!_.didSpaceEndpoint,body:()=>t.jsx(ss,{children:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),t.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:t.jsx(ln,{blockletMeta:A.current.meta,onNext:()=>{ge()},onEndpointUpdate:Ie})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:ze,onConfirm:ge}),de.push({key:"install",name:Tn(z==null?void 0:z.did)?d("common.upgrade"):d("common.install"),disabled:l?!1:at(_.installResultProps),loading:l?!1:at(_.installResultProps),body:t.jsx(Ne,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:at(_.installResultProps)?t.jsx(Jr,{message:t.jsx(di,{children:d(l?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):t.jsx("div",{style:{marginTop:120},children:t.jsx(Hn,{..._.installResultProps})})}),confirm:d("common.complete"),onConfirm:_o});const oe=de[W]||{},No=()=>S||oe.error||!_.bundleDid?!0:W>1?!_.pathPrefix:!1;return I?t.jsxs(li,{sx:h?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[t.jsx(es,{steps:de,mode:"memory",children:t.jsx(oi,{ref:ke,meta:z,isMobile:_e,onStepChange:P=>{he(P)}})}),t.jsxs(y,{className:"action-bar",children:[oe.cancel&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onCancel()},disabled:W===de.length-2&&S,color:"inherit",children:oe.cancel||d("common.cancel")}),oe.confirm&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:S||(typeof oe.disabled=="boolean"?oe.disabled:No()),variant:"contained",autoFocus:!0,title:oe.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:t.jsxs(y,{display:"flex",alignItems:"center",overflow:"hidden",children:[(typeof oe.loading=="boolean"?oe.loading:S)&&t.jsx(ue,{style:{marginRight:8},size:16}),t.jsx(y,{component:"span",flex:1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe.confirm})]})})]})]}):null}mn.propTypes={onClose:i.func,mode:i.oneOf(["normal","embed"]),inDialog:i.bool,stores:i.arrayOf(i.string),storeUrl:i.string,resourceType:i.string,resourceDid:i.string,storageKey:i.string,selectedMeta:i.object,showResourcesSwitch:i.bool,showFromUrl:i.bool,enableRunBackground:i.bool,showCategory:i.bool};mn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=$(y)`
|
|
284
|
+
`,oi=pn,ri=e=>e.inStore&&B.isFreeBlocklet(e)===!1,si=e=>{var o;return[Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((o=e==null?void 0:e.capabilities)==null?void 0:o.didSpace)},Ot=e=>{var o,n;return((n=(o=e==null?void 0:e.configs)==null?void 0:o.find(a=>a.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:n.value)||null},ii=e=>(e.environments||[]).some(o=>o.required),ro=(e,o)=>e==null?void 0:e.some(n=>n.required&&!o[n.key]),ai=({params:e,blocklet:o,t:n})=>{const a=e.title||e.name;return a?((o==null?void 0:o.children)||[]).find(s=>s.meta.bundleDid===e.bundleDid)?n("blocklet.component.upgradeNext",{name:a}):n("blocklet.component.addNext",{name:a}):n("common.next")},so=({componentDid:e,timeout:o=1e3,manual:n=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:n},"*")},o)};function mn({onClose:e,mode:o,stores:n,resourceType:a,resourceDid:r,storageKey:s,inDialog:h,selectedMeta:c,storeUrl:p,showResourcesSwitch:x,showFromUrl:g,enableRunBackground:l,showCategory:b}){var _n,In,Dn,Un,Je,Nn,et,Ln,Bn,On;const{t:d,locale:T}=G(),[S,R]=f.useState(!1),[k,C]=f.useState(null),[m,u]=f.useState(""),[v,w]=f.useState(""),{api:j,ws:{useSubscription:N},inService:M,info:X}=H(),{blocklet:I,actions:{refreshBlocklet:ne}}=pe(),[me,J]=f.useState(null),[Pe,we]=f.useState(!1),Ee={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[_,fe]=f.useState(Ee),[W,he]=f.useState(0),A=f.useRef({}),ke=f.useRef({}),le=f.useRef({}),_e=uo(P=>P.breakpoints.down("md")),E=ir(),[V,ce]=f.useState(!0),{meta:F}=A.current,ee=as(F),be=f.useRef(!1),z=P=>fe(D=>({...D,...P}));f.useEffect(()=>{if(_.pathPrefix){const{errMsg:P}=kn({..._,pathPrefix:_.pathPrefix,locale:T});u(P)}},[_.pathPrefix]),f.useEffect(()=>{W===0&&fe(Ee)},[W]);const Ie=()=>{const P=Ot(I)??"";z({didSpaceEndpoint:P})},Re=()=>{var P;return(P=A==null?void 0:A.current)!=null&&P.meta?B.getDisplayName(A.current):""},Ge=()=>{R(!1),fe({}),be.current=!1,A.current={},e()},Le=P=>{const D=O=>{z({installResultProps:{variant:"error",title:Re(),subTitle:P,footer:t.jsx(ae,{className:"bottom-button",disabled:O,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await Pn(A.current.installInput)},children:t.jsxs(y,{display:"flex",alignItems:"center",children:[O&&t.jsx(ue,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};D()},Xe=P=>D=>{var O,q;(((O=D==null?void 0:D.meta)==null?void 0:O.did)||(D==null?void 0:D.meta))===((q=I==null?void 0:I.meta)==null?void 0:q.did)&&P(D)},_o=()=>{so({timeout:0,componentDid:E.componentDid,manual:!0}),Ge(),setTimeout(()=>{const P=document.getElementsByClassName("dashboard-main")[0];P&&(P.scrollTop=P.scrollHeight)},200)};N(Y.BlockletEvents.componentInstalled,Xe(()=>{z({installResultProps:{variant:"success",title:Re(),subTitle:d("blocklet.component.installSuccessTip")}}),so({componentDid:E.componentDid})}),[(_n=I==null?void 0:I.meta)==null?void 0:_n.did]),N(Y.BlockletEvents.statusChange,Xe(()=>{const P=Ot(I);z(D=>({...D,didSpaceEndpoint:P}))}),[(In=I==null?void 0:I.meta)==null?void 0:In.did]),N(Y.BlockletEvents.downloadFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Dn=I==null?void 0:I.meta)==null?void 0:Dn.did]),N(Y.BlockletEvents.installFailed,Xe(()=>{be.current=!1,Le(d("blocklet.component.installComponentError"))}),[(Un=I==null?void 0:I.meta)==null?void 0:Un.did]);const de=[],Tn=P=>((I==null?void 0:I.children)||[]).find(D=>D.meta.did===P),Pn=async P=>{var Oe,$e;be.current=!0;const{pathPrefix:D,bundleDid:O,title:q,componentName:De="",componentDid:Be=""}=_,Ue=((Oe=A.current)==null?void 0:Oe.meta)||{},{configs:Se=[],registryUrl:Te,inStore:ze,inputUrl:Ve,dist:Pt}=Ue,Ye=($e=A.current)==null?void 0:$e.downloadTokenList,re=Ve||(ze?Gn(Te,O,Pt):"");R(!0);const tt={rootDid:I.meta.did,url:re,mountPoint:D?je(D):`/${je(Ue.title||Ue.name)}`,title:q,name:De,did:Be,dist:{tarball:"",integrity:""},onlyRequired:!V,..._.hasEnvironmentsStep&&Se.length>0?{configs:Se.map(xe=>({...xe,value:_.configsValue[xe.key]||""}))}:{},...Ye?{downloadTokenList:Ye}:{},...P};try{if(await j.installComponent({input:tt}),Te){const{teamDid:xe,storeList:Me}=lo({fromBlocklet:M,nodeInfo:X,blocklet:I}),{isNew:kt,decoded:nt}=cr(Te,Me);kt&&await j.addBlockletStore({input:{teamDid:xe,url:nt}})}z({installResultProps:{}}),ne({showError:!1,attachRuntimeInfo:!1})}catch(xe){const Me=ie(xe);L.error(Me),console.error("installComponent error: ",xe),Le(Me)}finally{R(!1),A.current.installInput=tt}},kn=P=>{const D=jo({params:{...P,did:P.bundleDid},blocklets:[I],blocklet:I,locale:T});if(D){const O=Tn(P.bundleDid),q=js({params:{...P,did:P.bundleDid},blocklet:I});if(O&&O.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async P=>{var O,q;const{errMsg:D}=kn({..._,locale:T});u(D),W===de.length-2&&!be.current&&await Pn(P),(q=(O=ke.current)==null?void 0:O.setActiveStepByIndex)==null||q.call(O,De=>De+1)},Fe=()=>{var P,D;(D=(P=ke.current)==null?void 0:P.setActiveStepByIndex)==null||D.call(P,O=>O-1)},Io=()=>{const{pathPrefix:P,bundleDid:D,title:O,componentName:q="",componentDid:De=""}=_,{meta:Be={}}=A.current||{},{registryUrl:Ue,inStore:Se,inputUrl:Te,dist:ze}=Be,Ve=Se?Gn(Ue,D,ze):Te;J({meta:Be,installOpts:{type:"component",rootDid:I.meta.did,mountPoint:P,url:Ve,title:O,name:q,did:De}})},Do=P=>{we(!1),z({purchaseResultProps:{variant:"error",title:Re(),subTitle:P,style:{paddingTop:120},footer:t.jsx(ae,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{z({purchaseResultProps:{}})},children:d("common.retry")})}})},Uo=({downloadTokenList:P})=>{A.current.downloadTokenList=P,we(!1),ge()},Tt=({chooseParams:P=A.current,componentDid:D,isInit:O=!1})=>{var nt,$n,Mn,An;const{meta:q,registryUrl:De,inStore:Be,inputUrl:Ue}=P,{did:Se,title:Te,name:ze}=q,Ve=(((nt=I.settings)==null?void 0:nt.children)||[]).filter(se=>se.status==="deleted"&&se.meta.bundleDid===Se),Pt=D||"",Ye=($n=q.environments)==null?void 0:$n.map(se=>{const{name:_t,validation:ot,...rt}=se,It={validation:dr(ot)?"":ot};return{...rt,key:_t,...It}});A.current={...P,meta:{...q,configs:Ye,registryUrl:De,inStore:Be,inputUrl:Ue}};let re={};if(O){const se=[I],_t=Ye||[],ot=[],rt=co(lr([..._t,...ot]),"key").filter(Ae=>!!Ae.key).sort((Ae,st)=>Ae.required&&!st.required?-1:st.required&&!Ae.required?1:0),It=B.getSharedConfigObj(se[0],{configs:rt}),Dt={},qn=rt.map(Ae=>{const{default:st,key:it,...Lo}=Ae;return Dt[it]=It[it]||st,{...Lo,key:it,hidden:!!Y.BLOCKLET_CONFIGURABLE_KEY[it]}});re={...re,configsList:qn,configsValue:Dt,hasMissRequiredConfigs:ro(qn,Dt)}}const tt=I.children.some(se=>se.mountPoint==="/"),Oe=Ve.find(se=>se.meta.bundleDid===Se),$e=I.children.find(se=>se.meta.bundleDid===Se);re.title=Te||"",Oe?re={...re,pathPrefix:Oe.mountPoint||"",componentName:Oe.meta.name,hasEnvironmentsStep:!1}:$e?re={...re,pathPrefix:$e.mountPoint||"",componentName:$e.meta.name,hasEnvironmentsStep:!1}:re={...re,pathPrefix:tt?`/${je(Te)||je(ze)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((An=(Mn=A.current.meta)==null?void 0:Mn.environments)==null?void 0:An.length)>0};const xe=ri(A.current.meta),Me=si(A.current.meta),kt=Ot(I);z({bundleDid:Se,componentDid:Pt,...re,hasRequiredEnvironments:ii(A.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:Me,didSpaceEndpoint:kt}),O&&xe&&Io()};f.useEffect(()=>{!c||W!==0||!I||(Tt({chooseParams:{blocklets:[c],meta:c,registryUrl:p||c.homepage,inStore:!0},isInit:!0}),z({showFromUrlDialog:!1}),ge())},[c,W,I]),de.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:t.jsxs(Ne,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[g&&_.showFromUrlDialog&&t.jsx(gs,{mode:"component",onCancel:()=>{z({showFromUrlDialog:!1})},onSuccess:({meta:P,inputUrl:D,inStore:O,registryUrl:q})=>{Tt({chooseParams:{meta:P,inputUrl:D,inStore:O,registryUrl:q},isInit:!0}),z({showFromUrlDialog:!1}),ge()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),t.jsx(cn,{stores:n,extra:xo.isInServerlessMode(X)?null:g?t.jsxs(ae,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{z({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[t.jsx(Yt,{style:{fontSize:20,marginRight:4}}),d("blocklet.component.addComponentTip.fromUrl")]}):null,loading:S,onChange:()=>{fe({}),A.current={}},storageKey:s,children:({currentRegistry:P})=>t.jsx(un,{showResourcesSwitch:x,showCategory:b,serverVersion:X==null?void 0:X.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:P.url,resourceType:a,resourceDid:r,handleButtonClick:D=>{Tt({chooseParams:{...D,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:D,defaultRender:O})=>{const q=(_==null?void 0:_.bundleDid)&&(_==null?void 0:_.bundleDid)===(D==null?void 0:D.did);return t.jsxs(ci,{children:[t.jsx(y,{className:q?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...q?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:O}),q&&t.jsx(y,{className:"check-container",children:t.jsx(ar,{className:"check-icon"})})]})}})})]}),cancel:o==="embed"?void 0:d("common.cancel"),confirm:ai({params:_,blocklet:I,t:d}),onCancel:Ge,onConfirm:()=>{ge()}}),de.push({key:"agreement",name:d("launchBlocklet.introduction"),body:t.jsxs(Ne,{component:"div",className:"agreement-wrapper",children:[t.jsx(Co,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),t.jsx(ls,{meta:F,onClickNext:ge,installRelated:V,onChangeInstallRelated:ce,handleDescEle:t.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:c?void 0:d("common.pre"),disabled:!ee,confirm:d(ee?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:c?Ge:Fe,onConfirm:()=>{we(!1),ge()}}),F&&_.requirePurchase&&de.push({key:"purchase",name:t.jsxs(t.Fragment,{children:[d("common.verifyNFT"),t.jsx(dt,{})]}),body:t.jsxs(Ne,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Nn=(Je=le.current)==null?void 0:Je.getCurrentStep)==null?void 0:Nn.call(Je))===2||Pe)&&t.jsx(ct,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),at(_.purchaseResultProps)?me&&t.jsx(Gs,{ref:le,meta:me.meta,mode:_.componentDid?"verify":"both",onCancel:Do,installOpts:me.installOpts,handlePaySuccess:Uo}):t.jsx("div",{className:"flex-align-center flex-justify-center",children:t.jsx(Hn,{..._.purchaseResultProps})})]}),disabled:((Ln=(et=le.current)==null?void 0:et.getCurrentStep)==null?void 0:Ln.call(et))===2||Pe,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof le.current.onNext=="function"&&(le.current.onNext(),we(!0))},onCancel:()=>{Fe()}}),B.hasStartEngine(F)&&po.hasMountPoint(F)?de.push({key:"config",name:d("common.config"),error:m,body:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),t.jsx(K,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:v||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:_.pathPrefix,onChange:P=>{const D=P.target.value;z({pathPrefix:D}),w(d("common.slugifyHint",{value:Ft(D)}))}}),!!m&&t.jsx($t,{severity:"error",style:{width:"100%",marginTop:8},children:m})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Fe,onConfirm:()=>{ge()}}):F&&(_.pathPrefix=((On=(Bn=F.interfaces)==null?void 0:Bn[0])==null?void 0:On.path)||`/${F.did}`),F&&(_!=null&&_.hasEnvironmentsStep)&&de.push({key:"environment",name:t.jsxs(t.Fragment,{children:[d("common.environment")," ",_.hasRequiredEnvironments&&t.jsx(dt,{})]}),disabled:!!k||(_==null?void 0:_.hasMissRequiredConfigs),body:()=>t.jsxs(Ne,{component:"div",style:{overflowY:"auto"},children:[t.jsx(ct,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),t.jsx(on,{style:{marginTop:-12,width:"100%"},schema:_.configsList,defaultValue:_.configsValue,onChange:(P,{action:D,currentItem:O,allValues:q})=>{D==="confirm"&&z({hasMissRequiredConfigs:ro(_.configsList,q),configsValue:q}),D==="edit"?C(O):["cancel","confirm"].includes(D)&&C(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Fe,onConfirm:ge}),F&&(_!=null&&_.didSpaceIsRequiredSetup)&&de.push({key:"didSpace",name:t.jsxs(t.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",_.didSpaceIsRequiredSetup==="required"&&t.jsx(dt,{})]}),disabled:(_==null?void 0:_.didSpaceIsRequiredSetup)&&!_.didSpaceEndpoint,body:()=>t.jsx(ss,{children:t.jsxs(Ne,{component:"div",children:[t.jsx(ct,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),t.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:t.jsx(ln,{blockletMeta:A.current.meta,onNext:()=>{ge()},onEndpointUpdate:Ie})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Fe,onConfirm:ge}),de.push({key:"install",name:Tn(F==null?void 0:F.did)?d("common.upgrade"):d("common.install"),disabled:l?!1:at(_.installResultProps),loading:l?!1:at(_.installResultProps),body:t.jsx(Ne,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:at(_.installResultProps)?t.jsx(Jr,{message:t.jsx(di,{children:d(l?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):t.jsx("div",{style:{marginTop:120},children:t.jsx(Hn,{..._.installResultProps})})}),confirm:d("common.complete"),onConfirm:_o});const oe=de[W]||{},No=()=>S||oe.error||!_.bundleDid?!0:W>1?!_.pathPrefix:!1;return I?t.jsxs(li,{sx:h?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[t.jsx(es,{steps:de,mode:"memory",children:t.jsx(oi,{ref:ke,meta:F,isMobile:_e,onStepChange:P=>{he(P)}})}),t.jsxs(y,{className:"action-bar",children:[oe.cancel&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onCancel()},disabled:W===de.length-2&&S,color:"inherit",children:oe.cancel||d("common.cancel")}),oe.confirm&&t.jsx(ae,{onClick:P=>{P.stopPropagation(),oe.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:S||(typeof oe.disabled=="boolean"?oe.disabled:No()),variant:"contained",autoFocus:!0,title:oe.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:t.jsxs(y,{display:"flex",alignItems:"center",overflow:"hidden",children:[(typeof oe.loading=="boolean"?oe.loading:S)&&t.jsx(ue,{style:{marginRight:8},size:16}),t.jsx(y,{component:"span",flex:1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:oe.confirm})]})})]})]}):null}mn.propTypes={onClose:i.func,mode:i.oneOf(["normal","embed"]),inDialog:i.bool,stores:i.arrayOf(i.string),storeUrl:i.string,resourceType:i.string,resourceDid:i.string,storageKey:i.string,selectedMeta:i.object,showResourcesSwitch:i.bool,showFromUrl:i.bool,enableRunBackground:i.bool,showCategory:i.bool};mn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const li=$(y)`
|
|
285
285
|
.action-bar {
|
|
286
286
|
display: flex;
|
|
287
287
|
justify-content: flex-end;
|
|
@@ -358,7 +358,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
358
358
|
.MuiDialogContent-root {
|
|
359
359
|
background-color: ${({theme:e})=>e.palette.background.paper};
|
|
360
360
|
}
|
|
361
|
-
`;function fn({blocklet:e,children:o}){const{t:n}=G(),[a,r]=f.useState(!1),s=h=>{h.stopPropagation(),r(!0)};return t.jsxs(t.Fragment,{children:[typeof o=="function"?o({open:s}):t.jsxs(ye,{onClick:s,className:"component-action","data-cy":"action-add-component",children:[t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),n("blocklet.component.add")]}),t.jsx(bt,{showDialog:a,setShowDialog:r,blocklet:e})]})}fn.propTypes={children:i.any,blocklet:i.object.isRequired};fn.defaultProps={children:null};const pi=e=>e.children.filter(o=>o.meta.interfaces.find(n=>n.type===Y.BLOCKLET_INTERFACE_TYPE_WEB));function Rt({params:e,setParams:o,setError:n,serviceTypes:a}){const{t:r}=G(),{blocklet:s}=pe(),h=s.meta.did,c=pi(s),[p,x]=f.useState([]),g={301:r("common.redirectPermanently"),302:r("common.redirectTemporary"),307:r("common.redirectTemporary"),308:r("common.redirectPermanently")};return f.useEffect(()=>{if(e.type===U.ROUTING_RULE_TYPES.COMPONENT&&e.componentId){const l=c.find(T=>T.meta.did===e.componentId),b=B.findWebInterface(l.meta),d=(Array.isArray(b==null?void 0:b.pageGroups)?b.pageGroups:[]).map(T=>({value:T,label:`${T} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),x(d),e.pageGroup&&d.find(T=>T.value===e.pageGroup)===!1&&o({...e,pageGroups:""})}},[e.componentId,e.type]),t.jsxs(t.Fragment,{children:[t.jsx(K,{select:!0,label:r("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:e.type,onChange:l=>{n(""),o({...e,type:l.target.value,did:l.target.value===U.ROUTING_RULE_TYPES.BLOCKLET?h:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:a.map(({name:l,value:b})=>t.jsx(ye,{value:b,children:l},b))}),e.type===U.ROUTING_RULE_TYPES.REDIRECT&&[t.jsx(K,{select:!0,label:r("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:e.redirectCode,onChange:l=>o({...e,redirectCode:l.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(l=>t.jsx(ye,{value:l,children:`${g[l]} - ${l}`},l))},"redirectCode"),t.jsx(K,{label:r("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{o({...e,url:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?n(""):n(r("router.validation.redirectUrlRequired"))}},"redirectUrl")],e.type===U.ROUTING_RULE_TYPES.COMPONENT&&[t.jsx(K,{select:!0,label:r("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:e.componentId,onChange:l=>{o({...e,componentId:l.target.value})},style:{marginBottom:32},SelectProps:{},children:c.map(l=>t.jsx(ye,{value:l.meta.did,selected:l.meta.did===e.componentId,children:B.getDisplayName(l,!0)},l.meta.did))},"componentId"),p.length?t.jsx(K,{select:!0,label:r("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:e.pageGroup,helperText:r("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:l=>{o({...e,pageGroup:l.target.value})},SelectProps:{},children:p.map(l=>t.jsx(ye,{value:l.value,selected:l.value===e.pageGroup,children:l.label},l.label))},"pageGroup"):null].filter(Boolean),e.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(K,{label:r("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,url:l.target.value,__disableConfirm:!b}),n(b?"":r("router.validation.rewriteUrlRequired"))}},"url"),e.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[t.jsx(K,{select:!0,label:r("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:e.responseType,onChange:l=>o({...e,responseType:l.target.value}),style:{marginBottom:32},SelectProps:{},children:U.ROUTING_RESPONSE_TYPES.map(l=>t.jsx(ye,{value:l.value,children:l.text},l.value))},"responseType"),t.jsx(K,{label:r("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:e.responseBody,helperText:r("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,responseBody:l.target.value,__disableConfirm:!b}),n(b?"":r("router.rule.add.responseBodyRequired"))}},"response-body")]]})}Rt.propTypes={params:i.object,serviceTypes:i.array,setParams:i.func,setError:i.func};Rt.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:U.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:U.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:U.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:U.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:U.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function hn({children:e,hiddenChildren:o,open:n,onClose:a}){const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(!1),l=h.meta.did,b=h.site.id,d=()=>{a==null||a(),p(!1),g(!1)},T=async C=>{try{const m=await ut(C,r);if(m)throw m;p(!0);const u={from:{pathPrefix:je(C.pathPrefix)},to:{type:C.type}};C.type===U.ROUTING_RULE_TYPES.REDIRECT&&(u.to.url=C.url.trim(),u.to.redirectCode=C.redirectCode),C.type===U.ROUTING_RULE_TYPES.COMPONENT&&(u.to.did=l,u.to.componentId=C.componentId,u.to.pageGroup=C.pageGroup),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(u.to.url=je(C.url)),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(u.to.response={status:200,contentType:C.responseType,body:C.responseBody}),await s.addRoutingRule({input:{id:b,rule:u,teamDid:l}}),a==null||a()}catch(m){L.error(m.message)}finally{p(!1),g(!1)}},S={title:r("router.rule.add.title"),description:(C,m,u)=>{const v=w=>{if(u(null),ut(w,r)){m({...w,__disableConfirm:!0});return}m({...w})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:C.pathPrefixHint||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:C.pathPrefix,onChange:w=>{let j=!1;const N=jo({params:{...C,pathPrefix:w.target.value},blocklets:[h]});u(N),C.type===U.ROUTING_RULE_TYPES.BLOCKLET&&N&&(j=!0),C.type===U.ROUTING_RULE_TYPES.REDIRECT&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!C.responseType||!C.responseBody)&&(j=!0),w.target.value.trim()||(j=!0,u(r("router.validation.pathPrefixRequired"))),j||u("");const M=r("common.slugifyHint",{value:zt(w.target.value)});m({...C,pathPrefix:w.target.value,pathPrefixHint:M,__disableConfirm:j})}}),t.jsx(Rt,{params:C,setParams:v,setError:u})]})},confirm:r("router.rule.add.confirm"),cancel:r("common.cancel"),params:{did:"",pathPrefix:"",type:U.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:T,onCancel:d},R=C=>{C.stopPropagation(),g(!0)};let k=null;return o||(k=typeof e=="function"?e({open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-add-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),r("router.rule.add.title")]})),t.jsxs(t.Fragment,{children:[k,(n||x)&&t.jsx(We,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel,color:"primary"})]})}hn.propTypes={children:i.any,onClose:i.func,hiddenChildren:i.bool,open:i.bool};hn.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function Ze({depth:e,className:o}){return t.jsx(y,{ml:Math.max((e-1)*2,0),className:o,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}Ze.propTypes={depth:i.number,className:i.string};Ze.defaultProps={depth:1,className:""};function gn({id:e,from:o,children:n}){const{t:a}=G(),{api:r}=H(),{blocklet:s}=pe(),[h,c]=f.useState(!1),[p,x]=f.useState(null),g=s.meta.did,l=s.site.id,b=o.pathPrefix,d=()=>{c(!1),x(null)},T=async()=>{c(!0);try{await r.deleteRoutingRule({input:{id:l,ruleId:e,teamDid:g}})}catch(k){L.error(k.message)}finally{x(null),c(!1)}},S={keyName:b,title:a("router.rule.delete.title"),description:a("router.rule.delete.description",{name:`<b>${b}</b>`}),confirmPlaceholder:a("router.rule.delete.confirm_desc",{name:b}),confirm:a("common.delConfirm"),cancel:a("router.rule.delete.cancel"),onConfirm:T,onCancel:d},R=k=>{k.stopPropagation(),x(S)};return t.jsxs(t.Fragment,{children:[typeof n=="function"?n({loading:h,open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-delete-rule",children:[h?t.jsx(ue,{size:16}):t.jsx(Ct,{style:{fontSize:18,marginRight:5}}),a("router.rule.delete.title")]}),p&&t.jsx(Rs,{keyName:p.keyName,title:p.title,description:p.description,confirmPlaceholder:p.confirmPlaceholder,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}gn.propTypes={id:i.string.isRequired,from:i.object.isRequired,children:i.any};gn.defaultProps={children:null};function xn({id:e,from:o,to:n,children:a}){var C,m;const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(null),l=h.meta.did,b=h.site.id,d=o.pathPrefix,T=()=>{p(!1),g(null)},S=async u=>{try{const v=await ut(u,r);if(v)throw v;p(!0);const w={id:e,from:{pathPrefix:je(u.pathPrefix)},to:{type:u.type}};u.type===U.ROUTING_RULE_TYPES.REDIRECT&&(w.to.url=u.url,w.to.redirectCode=u.redirectCode),u.type===U.ROUTING_RULE_TYPES.COMPONENT&&(w.to.did=l,w.to.componentId=u.componentId,w.to.pageGroup=u.pageGroup),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(w.to.url=je(u.url)),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(w.to.response={status:200,contentType:u.responseType,body:u.responseBody}),await s.updateRoutingRule({input:{id:b,rule:w,teamDid:l}})}catch(v){L.error(v.message)}finally{p(!1),g(null)}},R={title:r("router.rule.update.title"),description:(u,v,w)=>{const j=N=>{if(ut(N,r)){v({...N,__disableConfirm:!0});return}v({...N})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:u.helperText||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:u.pathPrefix,onChange:N=>{let M=!1;u.type===U.ROUTING_RULE_TYPES.REDIRECT&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!u.responseType||!u.responseBody)&&(M=!0),N.target.value.trim()||(M=!0,w(r("router.validation.pathPrefixRequired"))),M||w("");const X=r("common.slugifyHint",{value:zt(N.target.value)});v({...u,pathPrefix:N.target.value,helperText:X,__disableConfirm:M})}}),t.jsx(Rt,{params:u,setParams:j,setError:w})]})},confirm:r("router.rule.update.confirm"),cancel:r("router.rule.update.cancel"),color:"primary",params:{did:n.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:n.type||U.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:n.redirectCode||302,componentId:n.componentId||"",pageGroup:n.pageGroup||"",url:n.url||"",responseType:((C=n.response)==null?void 0:C.contentType)||"",responseBody:(((m=n.response)==null?void 0:m.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:S,onCancel:T},k=u=>{u.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof a=="function"?a({loading:c,open:k}):t.jsxs(ye,{onClick:k,className:"rule-action","data-cy":"action-update-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(go,{style:{fontSize:18,marginRight:5}}),r("router.rule.update.title")]}),x&&t.jsx(We,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}xn.propTypes={id:i.string.isRequired,from:i.object.isRequired,to:i.object.isRequired,children:i.any};xn.defaultProps={children:null};function yn(e){const{locale:o}=G(),{blocklet:n,recommendedDomain:a}=pe(),r=mo(a,e.from.pathPrefix,Ft(n,o));return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:r,rel:"noopener noreferrer",title:r,children:t.jsx(Z,{size:"small",children:t.jsx(bo,{})})}),t.jsx(xn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-update-rule",children:t.jsx(Mr,{})})}),t.jsx(gn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-delete-rule",children:t.jsx(Ct,{})})})]})}yn.propTypes={isProtected:i.bool};yn.defaultProps={isProtected:!1};function Eo({group:e,...o}){return e?t.jsx(Qe,{type:"reverse",...o,children:e}):null}Eo.propTypes={group:i.string.isRequired};function pt({domain:e,isHttps:o,toUrl:n}){const a=o?"https":"http";let r=n;return mr(r)||(r=`${a}://${e}${n}`),t.jsx(xt,{href:r,target:"_blank",style:{fontSize:14},underline:"hover",children:n},r)}pt.propTypes={domain:i.string.isRequired,toUrl:i.string.isRequired,isHttps:i.bool};pt.defaultProps={isHttps:!1};function St({hasPermission:e}){const{t:o,locale:n}=G(),a=ft(),{blocklet:r,recommendedDomain:s}=pe();return r.site.rules.filter(c=>c.to.type!==U.ROUTING_RULE_TYPES.BLOCKLET).map(c=>{var l;let p=null,x=null;c.to.type===U.ROUTING_RULE_TYPES.NONE?p="404":c.to.type===U.ROUTING_RULE_TYPES.REDIRECT?p=c.to.redirectCode:c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE?p="R":c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE?p=t.jsx(Ps,{sx:{color:"text.secondary",fontSize:"45px"}}):c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&(x=r.children.find(b=>b.meta.did===c.to.componentId),p="C");const g=c.isProtected?t.jsx(Ce,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:t.jsx("span",{children:t.jsx(Z,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:t.jsx(hs,{style:{fill:a.palette.text.disabled}})})})}):t.jsx(yn,{...c});return[t.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[t.jsx(y,{className:"component-item__indent",width:28}),typeof p=="object"?p:t.jsx(ur,{children:p}),t.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[t.jsxs(y,{style:{color:"text.primary",fontSize:16},children:[c.to.type===U.ROUTING_RULE_TYPES.NONE&&o("common.page404"),c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((l=U.ROUTING_RESPONSE_TYPES.find(b=>b.value===c.to.response.contentType))==null?void 0:l.text),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&B.getDisplayName(x,!0)]}),t.jsxs(y,{display:"flex",alignItems:"center",children:[c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&t.jsx(Eo,{group:c.to.pageGroup})]})]})]}),t.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:t.jsx(xt,{href:mo(s,c.from.pathPrefix,Ft(r,n)),target:"_blank",style:{fontSize:16,color:"inherit"},underline:"hover",children:pr(c.from.pathPrefix,"/")||"/"})},c.from.pathPrefix),t.jsx(y,{children:e&&t.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),t.jsx(Ze,{},"divider")]})}St.propTypes={hasPermission:i.bool};St.defaultProps={hasPermission:!1};const mi=yt(St,"mutate_blocklets"),fi=yt(St,"",He);function hi(e){const{inService:o}=H();return o?t.jsx(fi,{...e}):t.jsx(mi,{...e})}function gi(e,o){const n=f.useRef(o);f.useEffect(()=>{const a=r=>n.current(r.detail);return window.addEventListener(e,a),()=>window.removeEventListener(e,a)},[e])}function xi(e){const o=fo(),{t:n}=G(),a=()=>{const r=new URLSearchParams(window.location.search);r.get("checkUpdate")&&(r.delete("checkUpdate"),o(r.toString()),e(),L.success(n("notification.checkingForUpdates")))};f.useEffect(a,[]),gi("checkUpdate",a)}function yi({blocklet:e,scrollToComponent:o}={blocklet:null,scrollToComponent:!1}){const n=fo(),{t:a}=G(),r=f.useRef(null),s=f.useMemo(()=>{if(!e||!e.optionalComponents)return null;const h=new URLSearchParams(window.location.search),c=h.get("install-component");if(c){r.current=c,h.delete("install-component"),n(h.toString());const p=e.optionalComponents.find(g=>g.meta.did===c);if(!p)return L.success(a("notification.installComponentError",{did:c})),null;const{meta:x}=p;if(o){const g=document.getElementById(`optional-component-${c}`),l=document.querySelector(".dashboard-main");if(g){const b=g.getBoundingClientRect(),d=l.getBoundingClientRect();l.scrollTo({top:b.top-d.top+l.scrollTop,behavior:"smooth"})}}return x}return null},[e,n,a,o]);return f.useEffect(()=>{var h;r.current&&window.opener&&window.opener.postMessage({blocklet:e,kind:"component-installer"},(h=window.blocklet)==null?void 0:h.appUrl)},[e]),s}function wt({open:e,onClose:o,blocklet:n,ancestors:a}){var x;const{t:r}=G(),s=[...(a||[]).map(g=>{var l;return((l=g==null?void 0:g.meta)==null?void 0:l.did)||""}),((x=n==null?void 0:n.meta)==null?void 0:x.did)||""].filter(Boolean).join("/"),h=r("preferencesFor",{name:B.getDisplayName(n,!0)}),c=f.useMemo(()=>({position:"relative",minHeight:"50vh",height:"100%",overflow:"hidden",border:0}),[]);if(qe(n.status)||n.status==="unknown"&&qe(n.status))return null;const p=()=>{o==null||o()};return t.jsx(Ci,{open:e,fullWidth:!0,maxWidth:"md",title:h,onClose:p,PaperProps:{style:{minHeight:"500px"}},children:t.jsxs(ao,{gap:1,children:[t.jsx(te,{sx:{fontSize:12,color:"text.secondary",mb:.5},children:r("description.preferences",{name:B.getDisplayName(n,!0)})}),t.jsx(Ar,{id:s,styles:c})]})})}wt.propTypes={blocklet:i.object.isRequired,ancestors:i.array,open:i.bool,onClose:i.func};wt.defaultProps={ancestors:[],open:!1,onClose:null};const Ci=$(ht)`
|
|
361
|
+
`;function fn({blocklet:e,children:o}){const{t:n}=G(),[a,r]=f.useState(!1),s=h=>{h.stopPropagation(),r(!0)};return t.jsxs(t.Fragment,{children:[typeof o=="function"?o({open:s}):t.jsxs(ye,{onClick:s,className:"component-action","data-cy":"action-add-component",children:[t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),n("blocklet.component.add")]}),t.jsx(bt,{showDialog:a,setShowDialog:r,blocklet:e})]})}fn.propTypes={children:i.any,blocklet:i.object.isRequired};fn.defaultProps={children:null};const pi=e=>e.children.filter(o=>o.meta.interfaces.find(n=>n.type===Y.BLOCKLET_INTERFACE_TYPE_WEB));function Rt({params:e,setParams:o,setError:n,serviceTypes:a}){const{t:r}=G(),{blocklet:s}=pe(),h=s.meta.did,c=pi(s),[p,x]=f.useState([]),g={301:r("common.redirectPermanently"),302:r("common.redirectTemporary"),307:r("common.redirectTemporary"),308:r("common.redirectPermanently")};return f.useEffect(()=>{if(e.type===U.ROUTING_RULE_TYPES.COMPONENT&&e.componentId){const l=c.find(T=>T.meta.did===e.componentId),b=B.findWebInterface(l.meta),d=(Array.isArray(b==null?void 0:b.pageGroups)?b.pageGroups:[]).map(T=>({value:T,label:`${T} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),x(d),e.pageGroup&&d.find(T=>T.value===e.pageGroup)===!1&&o({...e,pageGroups:""})}},[e.componentId,e.type]),t.jsxs(t.Fragment,{children:[t.jsx(K,{select:!0,label:r("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:e.type,onChange:l=>{n(""),o({...e,type:l.target.value,did:l.target.value===U.ROUTING_RULE_TYPES.BLOCKLET?h:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:a.map(({name:l,value:b})=>t.jsx(ye,{value:b,children:l},b))}),e.type===U.ROUTING_RULE_TYPES.REDIRECT&&[t.jsx(K,{select:!0,label:r("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:e.redirectCode,onChange:l=>o({...e,redirectCode:l.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(l=>t.jsx(ye,{value:l,children:`${g[l]} - ${l}`},l))},"redirectCode"),t.jsx(K,{label:r("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{o({...e,url:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?n(""):n(r("router.validation.redirectUrlRequired"))}},"redirectUrl")],e.type===U.ROUTING_RULE_TYPES.COMPONENT&&[t.jsx(K,{select:!0,label:r("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:e.componentId,onChange:l=>{o({...e,componentId:l.target.value})},style:{marginBottom:32},SelectProps:{},children:c.map(l=>t.jsx(ye,{value:l.meta.did,selected:l.meta.did===e.componentId,children:B.getDisplayName(l,!0)},l.meta.did))},"componentId"),p.length?t.jsx(K,{select:!0,label:r("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:e.pageGroup,helperText:r("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:l=>{o({...e,pageGroup:l.target.value})},SelectProps:{},children:p.map(l=>t.jsx(ye,{value:l.value,selected:l.value===e.pageGroup,children:l.label},l.label))},"pageGroup"):null].filter(Boolean),e.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(K,{label:r("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:e.url,helperText:r("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,url:l.target.value,__disableConfirm:!b}),n(b?"":r("router.validation.rewriteUrlRequired"))}},"url"),e.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[t.jsx(K,{select:!0,label:r("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:e.responseType,onChange:l=>o({...e,responseType:l.target.value}),style:{marginBottom:32},SelectProps:{},children:U.ROUTING_RESPONSE_TYPES.map(l=>t.jsx(ye,{value:l.value,children:l.text},l.value))},"responseType"),t.jsx(K,{label:r("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:e.responseBody,helperText:r("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();o({...e,responseBody:l.target.value,__disableConfirm:!b}),n(b?"":r("router.rule.add.responseBodyRequired"))}},"response-body")]]})}Rt.propTypes={params:i.object,serviceTypes:i.array,setParams:i.func,setError:i.func};Rt.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:U.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:U.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:U.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:U.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:U.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function hn({children:e,hiddenChildren:o,open:n,onClose:a}){const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(!1),l=h.meta.did,b=h.site.id,d=()=>{a==null||a(),p(!1),g(!1)},T=async C=>{try{const m=await ut(C,r);if(m)throw m;p(!0);const u={from:{pathPrefix:je(C.pathPrefix)},to:{type:C.type}};C.type===U.ROUTING_RULE_TYPES.REDIRECT&&(u.to.url=C.url.trim(),u.to.redirectCode=C.redirectCode),C.type===U.ROUTING_RULE_TYPES.COMPONENT&&(u.to.did=l,u.to.componentId=C.componentId,u.to.pageGroup=C.pageGroup),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(u.to.url=je(C.url)),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(u.to.response={status:200,contentType:C.responseType,body:C.responseBody}),await s.addRoutingRule({input:{id:b,rule:u,teamDid:l}}),a==null||a()}catch(m){L.error(m.message)}finally{p(!1),g(!1)}},S={title:r("router.rule.add.title"),description:(C,m,u)=>{const v=w=>{if(u(null),ut(w,r)){m({...w,__disableConfirm:!0});return}m({...w})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:C.pathPrefixHint||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:C.pathPrefix,onChange:w=>{let j=!1;const N=jo({params:{...C,pathPrefix:w.target.value},blocklets:[h]});u(N),C.type===U.ROUTING_RULE_TYPES.BLOCKLET&&N&&(j=!0),C.type===U.ROUTING_RULE_TYPES.REDIRECT&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!C.url&&(j=!0),C.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!C.responseType||!C.responseBody)&&(j=!0),w.target.value.trim()||(j=!0,u(r("router.validation.pathPrefixRequired"))),j||u("");const M=r("common.slugifyHint",{value:Ft(w.target.value)});m({...C,pathPrefix:w.target.value,pathPrefixHint:M,__disableConfirm:j})}}),t.jsx(Rt,{params:C,setParams:v,setError:u})]})},confirm:r("router.rule.add.confirm"),cancel:r("common.cancel"),params:{did:"",pathPrefix:"",type:U.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:T,onCancel:d},R=C=>{C.stopPropagation(),g(!0)};let k=null;return o||(k=typeof e=="function"?e({open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-add-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(Yt,{style:{fontSize:18,marginRight:5}}),r("router.rule.add.title")]})),t.jsxs(t.Fragment,{children:[k,(n||x)&&t.jsx(We,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel,color:"primary"})]})}hn.propTypes={children:i.any,onClose:i.func,hiddenChildren:i.bool,open:i.bool};hn.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function Ze({depth:e,className:o}){return t.jsx(y,{ml:Math.max((e-1)*2,0),className:o,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}Ze.propTypes={depth:i.number,className:i.string};Ze.defaultProps={depth:1,className:""};function gn({id:e,from:o,children:n}){const{t:a}=G(),{api:r}=H(),{blocklet:s}=pe(),[h,c]=f.useState(!1),[p,x]=f.useState(null),g=s.meta.did,l=s.site.id,b=o.pathPrefix,d=()=>{c(!1),x(null)},T=async()=>{c(!0);try{await r.deleteRoutingRule({input:{id:l,ruleId:e,teamDid:g}})}catch(k){L.error(k.message)}finally{x(null),c(!1)}},S={keyName:b,title:a("router.rule.delete.title"),description:a("router.rule.delete.description",{name:`<b>${b}</b>`}),confirmPlaceholder:a("router.rule.delete.confirm_desc",{name:b}),confirm:a("common.delConfirm"),cancel:a("router.rule.delete.cancel"),onConfirm:T,onCancel:d},R=k=>{k.stopPropagation(),x(S)};return t.jsxs(t.Fragment,{children:[typeof n=="function"?n({loading:h,open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-delete-rule",children:[h?t.jsx(ue,{size:16}):t.jsx(Ct,{style:{fontSize:18,marginRight:5}}),a("router.rule.delete.title")]}),p&&t.jsx(Rs,{keyName:p.keyName,title:p.title,description:p.description,confirmPlaceholder:p.confirmPlaceholder,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}gn.propTypes={id:i.string.isRequired,from:i.object.isRequired,children:i.any};gn.defaultProps={children:null};function xn({id:e,from:o,to:n,children:a}){var C,m;const{t:r}=G(),{api:s}=H(),{blocklet:h}=pe(),[c,p]=f.useState(!1),[x,g]=f.useState(null),l=h.meta.did,b=h.site.id,d=o.pathPrefix,T=()=>{p(!1),g(null)},S=async u=>{try{const v=await ut(u,r);if(v)throw v;p(!0);const w={id:e,from:{pathPrefix:je(u.pathPrefix)},to:{type:u.type}};u.type===U.ROUTING_RULE_TYPES.REDIRECT&&(w.to.url=u.url,w.to.redirectCode=u.redirectCode),u.type===U.ROUTING_RULE_TYPES.COMPONENT&&(w.to.did=l,w.to.componentId=u.componentId,w.to.pageGroup=u.pageGroup),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(w.to.url=je(u.url)),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(w.to.response={status:200,contentType:u.responseType,body:u.responseBody}),await s.updateRoutingRule({input:{id:b,rule:w,teamDid:l}})}catch(v){L.error(v.message)}finally{p(!1),g(null)}},R={title:r("router.rule.update.title"),description:(u,v,w)=>{const j=N=>{if(ut(N,r)){v({...N,__disableConfirm:!0});return}v({...N})};return t.jsxs(te,{component:"div",children:[t.jsx(K,{label:r("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:u.helperText||r("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:u.pathPrefix,onChange:N=>{let M=!1;u.type===U.ROUTING_RULE_TYPES.REDIRECT&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!u.url&&(M=!0),u.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!u.responseType||!u.responseBody)&&(M=!0),N.target.value.trim()||(M=!0,w(r("router.validation.pathPrefixRequired"))),M||w("");const X=r("common.slugifyHint",{value:Ft(N.target.value)});v({...u,pathPrefix:N.target.value,helperText:X,__disableConfirm:M})}}),t.jsx(Rt,{params:u,setParams:j,setError:w})]})},confirm:r("router.rule.update.confirm"),cancel:r("router.rule.update.cancel"),color:"primary",params:{did:n.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:n.type||U.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:n.redirectCode||302,componentId:n.componentId||"",pageGroup:n.pageGroup||"",url:n.url||"",responseType:((C=n.response)==null?void 0:C.contentType)||"",responseBody:(((m=n.response)==null?void 0:m.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:S,onCancel:T},k=u=>{u.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof a=="function"?a({loading:c,open:k}):t.jsxs(ye,{onClick:k,className:"rule-action","data-cy":"action-update-rule",children:[c?t.jsx(ue,{size:16}):t.jsx(go,{style:{fontSize:18,marginRight:5}}),r("router.rule.update.title")]}),x&&t.jsx(We,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}xn.propTypes={id:i.string.isRequired,from:i.object.isRequired,to:i.object.isRequired,children:i.any};xn.defaultProps={children:null};function yn(e){const{locale:o}=G(),{blocklet:n,recommendedDomain:a}=pe(),r=mo(a,e.from.pathPrefix,zt(n,o));return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:r,rel:"noopener noreferrer",title:r,children:t.jsx(Z,{size:"small",children:t.jsx(bo,{})})}),t.jsx(xn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-update-rule",children:t.jsx(Mr,{})})}),t.jsx(gn,{...e,children:({open:s})=>t.jsx(Z,{size:"small",onClick:s,disabled:e.isProtected,"data-cy":"action-delete-rule",children:t.jsx(Ct,{})})})]})}yn.propTypes={isProtected:i.bool};yn.defaultProps={isProtected:!1};function Eo({group:e,...o}){return e?t.jsx(Qe,{type:"reverse",...o,children:e}):null}Eo.propTypes={group:i.string.isRequired};function pt({domain:e,isHttps:o,toUrl:n}){const a=o?"https":"http";let r=n;return mr(r)||(r=`${a}://${e}${n}`),t.jsx(xt,{href:r,target:"_blank",style:{fontSize:14},underline:"hover",children:n},r)}pt.propTypes={domain:i.string.isRequired,toUrl:i.string.isRequired,isHttps:i.bool};pt.defaultProps={isHttps:!1};function St({hasPermission:e}){const{t:o,locale:n}=G(),a=ft(),{blocklet:r,recommendedDomain:s}=pe();return r.site.rules.filter(c=>c.to.type!==U.ROUTING_RULE_TYPES.BLOCKLET).map(c=>{var l;let p=null,x=null;c.to.type===U.ROUTING_RULE_TYPES.NONE?p="404":c.to.type===U.ROUTING_RULE_TYPES.REDIRECT?p=c.to.redirectCode:c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE?p="R":c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE?p=t.jsx(Ps,{sx:{color:"text.secondary",fontSize:"45px"}}):c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&(x=r.children.find(b=>b.meta.did===c.to.componentId),p="C");const g=c.isProtected?t.jsx(Ce,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:t.jsx("span",{children:t.jsx(Z,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:t.jsx(hs,{style:{fill:a.palette.text.disabled}})})})}):t.jsx(yn,{...c});return[t.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[t.jsx(y,{className:"component-item__indent",width:28}),typeof p=="object"?p:t.jsx(ur,{children:p}),t.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[t.jsxs(y,{style:{color:"text.primary",fontSize:16},children:[c.to.type===U.ROUTING_RULE_TYPES.NONE&&o("common.page404"),c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),c.to.type===U.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((l=U.ROUTING_RESPONSE_TYPES.find(b=>b.value===c.to.response.contentType))==null?void 0:l.text),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&B.getDisplayName(x,!0)]}),t.jsxs(y,{display:"flex",alignItems:"center",children:[c.to.type===U.ROUTING_RULE_TYPES.REDIRECT&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(pt,{domain:s,toUrl:c.to.url}),c.to.type===U.ROUTING_RULE_TYPES.COMPONENT&&t.jsx(Eo,{group:c.to.pageGroup})]})]})]}),t.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:t.jsx(xt,{href:mo(s,c.from.pathPrefix,zt(r,n)),target:"_blank",style:{fontSize:16,color:"inherit"},underline:"hover",children:pr(c.from.pathPrefix,"/")||"/"})},c.from.pathPrefix),t.jsx(y,{children:e&&t.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),t.jsx(Ze,{},"divider")]})}St.propTypes={hasPermission:i.bool};St.defaultProps={hasPermission:!1};const mi=yt(St,"mutate_blocklets"),fi=yt(St,"",He);function hi(e){const{inService:o}=H();return o?t.jsx(fi,{...e}):t.jsx(mi,{...e})}function gi(e,o){const n=f.useRef(o);f.useEffect(()=>{const a=r=>n.current(r.detail);return window.addEventListener(e,a),()=>window.removeEventListener(e,a)},[e])}function xi(e){const o=fo(),{t:n}=G(),a=()=>{const r=new URLSearchParams(window.location.search);r.get("checkUpdate")&&(r.delete("checkUpdate"),o(r.toString()),e(),L.success(n("notification.checkingForUpdates")))};f.useEffect(a,[]),gi("checkUpdate",a)}function yi({blocklet:e,scrollToComponent:o}={blocklet:null,scrollToComponent:!1}){const n=fo(),{t:a}=G(),r=f.useRef(null),s=f.useMemo(()=>{if(!e||!e.optionalComponents)return null;const h=new URLSearchParams(window.location.search),c=h.get("install-component");if(c){r.current=c,h.delete("install-component"),n(h.toString());const p=e.optionalComponents.find(g=>g.meta.did===c);if(!p)return L.success(a("notification.installComponentError",{did:c})),null;const{meta:x}=p;if(o){const g=document.getElementById(`optional-component-${c}`),l=document.querySelector(".dashboard-main");if(g){const b=g.getBoundingClientRect(),d=l.getBoundingClientRect();l.scrollTo({top:b.top-d.top+l.scrollTop,behavior:"smooth"})}}return x}return null},[e,n,a,o]);return f.useEffect(()=>{var h;r.current&&window.opener&&window.opener.postMessage({blocklet:e,kind:"component-installer"},(h=window.blocklet)==null?void 0:h.appUrl)},[e]),s}function wt({open:e,onClose:o,blocklet:n,ancestors:a}){var x;const{t:r}=G(),s=[...(a||[]).map(g=>{var l;return((l=g==null?void 0:g.meta)==null?void 0:l.did)||""}),((x=n==null?void 0:n.meta)==null?void 0:x.did)||""].filter(Boolean).join("/"),h=r("preferencesFor",{name:B.getDisplayName(n,!0)}),c=f.useMemo(()=>({position:"relative",minHeight:"50vh",height:"100%",overflow:"hidden",border:0}),[]);if(qe(n.status)||n.status==="unknown"&&qe(n.status))return null;const p=()=>{o==null||o()};return t.jsx(Ci,{open:e,fullWidth:!0,maxWidth:"md",title:h,onClose:p,PaperProps:{style:{minHeight:"500px"}},children:t.jsxs(ao,{gap:1,children:[t.jsx(te,{sx:{fontSize:12,color:"text.secondary",mb:.5},children:r("description.preferences",{name:B.getDisplayName(n,!0)})}),t.jsx(Ar,{id:s,styles:c})]})})}wt.propTypes={blocklet:i.object.isRequired,ancestors:i.array,open:i.bool,onClose:i.func};wt.defaultProps={ancestors:[],open:!1,onClose:null};const Ci=$(ht)`
|
|
362
362
|
.MuiDialogContent-root {
|
|
363
363
|
padding-top: 0;
|
|
364
364
|
padding-bottom: 24px;
|
|
@@ -480,7 +480,7 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
480
480
|
margin-left: 4px;
|
|
481
481
|
transform: translateY(-1px);
|
|
482
482
|
}
|
|
483
|
-
`;function En({blocklet:e,onUpdate:o,getComponentUrl:n,...a}){var _e;const{t:r}=f.useContext(ve),{api:s,inService:h,info:c}=H(),{addDeletingDid:p,removeDeletingDid:x,matchDeletingDid:g}=Vt(),[l,b]=f.useState(!1),[d,T]=f.useState(null),[S,R]=f.useState(null),[k,C]=f.useState(!1),[m,u]=f.useState(!1),[v,w]=f.useState(!1),[j,N]=f.useState(!1),[M,X]=f.useState(null),I=e&&e.structVersion!==U.APP_STRUCT_VERSION,[ne,me]=f.useState(!1),J=[...e.children];e.meta.group!=="gateway"&&J.unshift(e),g(J.map(E=>E.meta.did));const Pe=async()=>{if(!l){b(!0);try{const{updateId:E,updateList:V}=(await s.checkComponentsForUpdates({input:{did:e.meta.did}})).preUpdateInfo||{};if(b(!1),!E){L.info(r("blocklet.component.noUpdate"));return}const ce=[];B.forEachChildSync(e,(ee,{id:be,ancestors:
|
|
483
|
+
`;function En({blocklet:e,onUpdate:o,getComponentUrl:n,...a}){var _e;const{t:r}=f.useContext(ve),{api:s,inService:h,info:c}=H(),{addDeletingDid:p,removeDeletingDid:x,matchDeletingDid:g}=Vt(),[l,b]=f.useState(!1),[d,T]=f.useState(null),[S,R]=f.useState(null),[k,C]=f.useState(!1),[m,u]=f.useState(!1),[v,w]=f.useState(!1),[j,N]=f.useState(!1),[M,X]=f.useState(null),I=e&&e.structVersion!==U.APP_STRUCT_VERSION,[ne,me]=f.useState(!1),J=[...e.children];e.meta.group!=="gateway"&&J.unshift(e),g(J.map(E=>E.meta.did));const Pe=async()=>{if(!l){b(!0);try{const{updateId:E,updateList:V}=(await s.checkComponentsForUpdates({input:{did:e.meta.did}})).preUpdateInfo||{};if(b(!1),!E){L.info(r("blocklet.component.noUpdate"));return}const ce=[];B.forEachChildSync(e,(ee,{id:be,ancestors:z})=>{const Ie=V.find(Re=>Re.id===be);if(Ie){const Re=z.slice(1).concat(ee).map(Le=>Le.meta.title||Le.meta.name).join(" / "),Ge=(z[1]||ee).meta.did;ce.push({groupId:Ge,name:Re,version:ee.meta.version,newVersion:Ie.meta.version})}});const F={};ce.forEach(ee=>{F[ee.groupId]?ee.disabled=!0:F[ee.groupId]=!0}),T({params:{updateId:E},list:ce,checks:F,hasChecks:!0})}catch(E){b(!1),L.error(ie(E))}}},we=async()=>{if(!l)try{b(!0);const E=Object.keys(d.checks).filter(ce=>d.checks[ce]),V={updateId:d.params.updateId,rootDid:e.meta.did,selectedComponents:E};await s.upgradeComponents({input:V}),b(!1),T(null),me(null)}catch(E){b(!1),L.error(ie(E))}},Ee=async(E,V)=>{p(E.meta.did);try{await s.deleteComponent({input:{did:E.meta.did,keepData:V==="keepData",rootDid:e.meta.did}}),await Ke(800)}catch(ce){L.error(ie(ce)),x(E.meta.did)}},_=async E=>{try{await s.startBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},fe=async E=>{try{await s.stopBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},W=async E=>{try{await s.restartBlocklet({input:{did:e.meta.did,componentDids:[E.meta.did]}}),await Ke(800)}catch(V){L.error(ie(V))}},he=(E,V)=>{const{checked:ce}=E.target;T(F=>{const ee=Object.entries(F.checks).reduce((z,[Ie,Re])=>(z[Ie]=V===Ie||V==="all"?ce:Re,z),{}),be=Object.values(ee).includes(!0);return{...F,checks:ee,hasChecks:be}})},A=f.useMemo(()=>d==null?void 0:d.list.filter(E=>!E.disabled).every(E=>d.checks[E.groupId]),[d]);xi(Pe);const ke=yi({blocklet:e,scrollToComponent:!0}),le=M||ke;return t.jsxs(Ni,{component:"div",...a,children:[t.jsxs(Li,{display:"flex",children:[t.jsxs(Bi,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[J!=null&&J.length?`${r("common.components")} (${J.length})`:`${r("common.components")}`,!I&&t.jsx(At,{permission:h?"":"mutate_blocklets",role:h?He:[],children:t.jsx(Zt,{children:t.jsx(qt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!ne,children:t.jsxs(ae,{disabled:l||B.isInProgress(e.status),onClick:()=>{Pe()},"data-cy":"check-for-updates",children:[t.jsx(y,{ml:.5,mr:.5,display:"flex",children:l?t.jsx(ue,{size:16}):t.jsx(wo,{style:{fontSize:"1em"}})}),r("blocklet.component.checkUpdateTitle")]})})})})]}),t.jsx(At,{permission:h?"":"mutate_blocklets",role:h?He:[],children:t.jsxs(y,{display:"flex",alignItems:"center",children:[!I&&t.jsx(fn,{blocklet:e,serverVersion:c.version,children:({open:E})=>t.jsxs(ae,{disabled:l||B.isInProgress(e.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:E,children:[t.jsx(Er,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.component.add")]})}),t.jsx(So,{"data-cy":"component-actions",actions:[{icon:t.jsx(Q,{icon:"fluent:link-20-filled"}),onClick:()=>u(!0),text:r("router.rule.add.title"),disabled:l||B.isInProgress(e.status)},...I?[]:[{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{w(!0)},text:r("common.environments")},{icon:t.jsx(Qt,{}),onClick:()=>{N(!0)},text:r("common.preferences")}]].filter(Boolean)})]})})]}),J!=null&&J.length?t.jsxs(t.Fragment,{children:[t.jsxs(y,{mt:2,children:[e.meta.group!=="gateway"&&t.jsx(mt,{blocklet:e,app:e,onRemove:Ee,onStart:_,onStop:fe,onRestart:W,getComponentUrl:n},`0-${e.meta.did}`),e.children.map(E=>t.jsx(mt,{depth:1,blocklet:E,ancestors:[e],app:e,onRemove:Ee,onStart:_,onStop:fe,onRestart:W,getComponentUrl:n},`1-${E.meta.did}`))]},`top-blocklet-${e.meta.did}`),(_e=e.optionalComponents)==null?void 0:_e.map(E=>t.jsx(Sn,{children:t.jsx(wn,{setInstallComponentMeta:X,...E})},E.meta.did))]}):t.jsx(y,{mt:8,children:t.jsx(Tr,{children:r("blocklet.component.noComponent")})}),!!e.site.rules.length&&t.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:t.jsx(hi,{})}),!!d&&t.jsx(Fn,{open:!0,fullWidth:!0,children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(zn,{children:r("blocklet.component.updateTitle")}),t.jsxs(y,{component:Vn,py:4,children:[d.list.filter(E=>!E.disabled).length>1&&t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(Yn,{checked:A,onChange:E=>he(E,"all")}),t.jsx(y,{children:r(A?"common.unselectAll":"common.selectAll")})]}),d.list.map(E=>t.jsxs(y,{display:"flex",alignItems:"center",mb:1,children:[t.jsx(Yn,{checked:d.checks[E.groupId],onChange:V=>he(V,E.groupId),style:{marginLeft:E.disabled?16:0,alignSelf:"flex-start"},defaultChecked:!0,disabled:E.disabled}),t.jsxs(y,{flexGrow:1,children:[t.jsx(y,{pt:1,xs:8,children:E.name}),E.version&&t.jsxs(lt,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[t.jsx(lt,{item:!0,xs:3,children:E.version}),t.jsx(lt,{item:!0,xs:1,children:t.jsx(br,{style:{fontSize:"0.9em"}})}),t.jsx(lt,{item:!0,xs:3,children:t.jsx(y,{color:"secondary.main",children:E.newVersion})})]})]},`${E.name}-${E.newVersion}`)]},E.name))]}),t.jsxs(Rr,{style:{padding:"8px 24px 24px"},children:[t.jsx(ae,{onClick:()=>{T(null)},children:r("common.cancel")}),t.jsxs(ae,{onClick:E=>{E.stopPropagation(),we()},color:"primary",disabled:l||!d.hasChecks,variant:"contained",autoFocus:!0,children:[l&&t.jsx(ue,{size:16}),r("common.update")]})]})]})}),!!S&&t.jsx(Fn,{open:!0,fullWidth:!0,onClose:()=>R(!1),children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(zn,{children:r("common.configuration")}),t.jsx(Vn,{children:t.jsx(y,{py:2,children:t.jsx(Mt,{control:t.jsx(Es,{checked:k,onChange:E=>C(!!E.target.checked)}),label:r("blocklet.component.showContainer")})})})]})}),t.jsx(bt,{selectedMeta:le,blocklet:e,showDialog:!!le,setShowDialog:()=>X(null)}),m&&t.jsx(hn,{hiddenChildren:!0,open:!0,onClose:()=>u(!1)}),v&&t.jsx(jt,{open:!0,onClose:()=>w(!1),hiddenChildren:!0,blocklet:e,ancestors:[]}),j&&t.jsx(wt,{open:!0,onClose:()=>N(!1),blocklet:e,ancestors:[]})]})}En.propTypes={blocklet:i.object.isRequired,onUpdate:i.func,getComponentUrl:i.func};En.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const Ni=$.div`
|
|
484
484
|
.title {
|
|
485
485
|
font-size: 1.2rem;
|
|
486
486
|
font-weight: bold;
|
|
@@ -518,4 +518,4 @@ import{bW as Bo,j as t,f7 as Oo,hL as $o,l2 as Mo,aP as Wt,aQ as Gt,m as G,bq as
|
|
|
518
518
|
width: 100%;
|
|
519
519
|
justify-content: space-between;
|
|
520
520
|
}
|
|
521
|
-
`;function ko(e){const{locale:o}=f.useContext(ve),{blocklet:n,recommendedDomain:a}=Ts(),r=s=>Sr({blocklet:n,domain:{value:a||`${wr.encode(n.appPid)}.${U.DEFAULT_DID_DOMAIN}`},mountPoint:s,params:
|
|
521
|
+
`;function ko(e){const{locale:o}=f.useContext(ve),{blocklet:n,recommendedDomain:a}=Ts(),r=s=>Sr({blocklet:n,domain:{value:a||`${wr.encode(n.appPid)}.${U.DEFAULT_DID_DOMAIN}`},mountPoint:s,params:zt(n,o)});return t.jsx(En,{blocklet:n,getComponentUrl:r,...e})}ko.propTypes={};ko.defaultProps={};export{ko as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as y,u as J,_ as Me,aJ as ii,j as e,A as D,aK as In,aL as pr,aM as oi,aN as Ln,aO as rt,aP as Ce,aQ as Se,P as f,n as re,m as z,ae as le,aR as On,aS as ai,aT as Fn,aU as si,y as se,M as Nn,k as A,t as G,aB as pe,aV as Oe,C as Y,V as je,B as X,aW as gr,X as xe,K as q,e as Kt,R as it,aX as li,d as Yt,aY as $e,aZ as fe,ab as ci,a_ as di,a$ as ui,a2 as mi,x as hr,W as $n,T as Un,h as ne,b0 as Vt,a as Nt,Q as Z,b as pt,b1 as xr,b2 as yr,U as br,a4 as $t,b3 as fi,b4 as pi,b5 as gi,b6 as hi,b7 as ot,b8 as vr,a9 as xi,H as yi,b9 as bi,aI as Ze,ba as vi,aa as Et,a7 as At,bb as ji,a8 as Ut,g as Xt,I as wi,bc as Ci,bd as jr,be as Ee,bf as Ae,bg as Si,bh as Di,D as wr,s as zt,al as _i,f as ki,bi as Ri,bj as zn,am as Ti,bk as Pi,bl as Cr,bm as te,bn as Ei,S as Bn,p as Mn,l as Wn,bo as Ai,bp as Ii}from"./index-
|
|
1
|
+
import{r as y,u as J,_ as Me,aJ as ii,j as e,A as D,aK as In,aL as pr,aM as oi,aN as Ln,aO as rt,aP as Ce,aQ as Se,P as f,n as re,m as z,ae as le,aR as On,aS as ai,aT as Fn,aU as si,y as se,M as Nn,k as A,t as G,aB as pe,aV as Oe,C as Y,V as je,B as X,aW as gr,X as xe,K as q,e as Kt,R as it,aX as li,d as Yt,aY as $e,aZ as fe,ab as ci,a_ as di,a$ as ui,a2 as mi,x as hr,W as $n,T as Un,h as ne,b0 as Vt,a as Nt,Q as Z,b as pt,b1 as xr,b2 as yr,U as br,a4 as $t,b3 as fi,b4 as pi,b5 as gi,b6 as hi,b7 as ot,b8 as vr,a9 as xi,H as yi,b9 as bi,aI as Ze,ba as vi,aa as Et,a7 as At,bb as ji,a8 as Ut,g as Xt,I as wi,bc as Ci,bd as jr,be as Ee,bf as Ae,bg as Si,bh as Di,D as wr,s as zt,al as _i,f as ki,bi as Ri,bj as zn,am as Ti,bk as Pi,bl as Cr,bm as te,bn as Ei,S as Bn,p as Mn,l as Wn,bo as Ai,bp as Ii}from"./index-D6xNQO9D.js";import{T as Li}from"./index-0tIu-1zK.js";import{d as Oi}from"./ArrowDropDown-lSBhitmG.js";import{u as Qt,C as M,a as qn}from"./index.esm-UxoaB6Mu.js";import{S as ae}from"./switch-control-D_7zaAA3.js";import{P as ie}from"./permission-fFO3ZJsb.js";import{D as Sr,g as Fi}from"./index-BH6N9kiW.js";import{d as Dr}from"./Link-C4RjtlPw.js";import{d as we}from"./Delete-EgRRDgvd.js";import{D as gt}from"./delete-confirm-BSpKG6TK.js";import{I as at}from"./index-FAOrsHzs.js";import{s as Ni}from"./logo-BKA11TRi.js";import{R as _r,a as Bt,b as $i,W as Je}from"./url-evaluation-D2mP9Xpx.js";import{_ as Ui}from"./useLocalStorage-BvE_hswD.js";import{d as zi}from"./Refresh-By8bfp9S.js";import{L as Bi}from"./LoadingButton-bxrmduDd.js";import{C as Mi,R as Wi,d as kr}from"./Public-DYzbOE-T.js";import{d as Ue}from"./Add-BvcTJL6g.js";import{B as Rr,D as Hn}from"./status-AY9VNZQw.js";import{i as qi}from"./is-path-prefix-equal-1KjO4UlG.js";import{d as Hi}from"./ChevronRight-BlhG3yZY.js";import{d as Gi}from"./MoreVert-C7ADSe__.js";import{d as Tr}from"./Edit-WOZnUVvS.js";import{d as Ki}from"./CallMerge-ChAxopdM.js";import{C as Yi}from"./CardContent-BQOdBMgK.js";import{w as Vi}from"./withStyles-Cj7JqeJd.js";import{S as Xi}from"./Slider-14Xp1QE3.js";import"./index-BjO4wh2H.js";import"./Switch-lDUha6nF.js";import"./TableRow-uM5dbbKH.js";import"./useThemeProps-Daih-0Xh.js";import"./emotion-react.browser.esm-CZUhgARx.js";import"./ViewColumn-BncCRTIT.js";import"./Search-CjaYHOuY.js";import"./Clear-9k4hE_iq.js";import"./index-gWj5DPOC.js";import"./TableSearch-CUrFzIWx.js";import"./click-to-copy-CVJCV48Y.js";const ve="Dashboard",Pr=y.createContext({}),{Provider:Qi,Consumer:Hs}=Pr,Gn=[ve,D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP],Zi=(t,n)=>{if(t.name===D.DOMAIN_FOR_DEFAULT_SITE)return-1;if(n.name===D.DOMAIN_FOR_DEFAULT_SITE)return 1;const r=Gn.includes(t.name),i=Gn.includes(n.name);return r&&i?Ln(t.name,n.name):r?-1:i?1:Ln(t.name,n.name)},Ji=({sites:t,nodePort:n})=>{const r=window.location.hostname,o=(t||[]).map(a=>{const{id:s,rules:d=[],corsAllowedOrigins:x=[]}=a;let{domain:c,domainAliases:u}=a;u=u||[],[D.DOMAIN_FOR_IP_SITE,D.DOMAIN_FOR_IP_SITE_REGEXP].includes(c)&&(c=ve,u.find(w=>w.value===r)||u.unshift({protected:!1,value:r}));const p={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:a.isProtected,corsAllowedOrigins:x};return(d||[]).forEach(w=>{const{id:j,isProtected:R,from:{pathPrefix:v},to:S}=w;if(S.type===D.ROUTING_RULE_TYPES.BLOCKLET){let _="";Number.parseInt(S.port,10)===Number.parseInt(n,10)?(_="Blocklet Server Dashboard",S.type=D.ROUTING_RULE_TYPES.DAEMON):_=S.did,p.items.push({id:j,name:In(v||"/"),title:_,type:"rule",isProtected:R,pathPrefix:v,to:S})}else p.items.push({id:j,pathPrefix:v,name:In(v||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:R,to:S})}),p.items=pr(p.items,w=>w.name),p}).sort(Zi),l=o.reduce((a,s)=>{let{name:d}=s;return d.endsWith(D.BLOCKLET_SITE_GROUP_SUFFIX)&&([d]=d.split(".")),a[d]={...s,rules:s.items},a},{});return{sites:o,siteMap:l}},eo=({did:t,domain:n,mountPoint:r,siteMap:i,params:o}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const a=n||(l.domainAliases||[])[0];if(!a)return null;let s=r;if(!s){const d=l.rules.filter(x=>!x.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];s=d?d.name:"/"}return rt(a.value,s,o)},to=({did:t,mountPoint:n,siteMap:r,params:i}={})=>{if(!r)return[];const o=r[t];if(!o)return[];const l=o.domainAliases||[];if(!l.length)return[];let a=n;if(!a){const s=o.rules.filter(d=>!d.name.startsWith(D.WELLKNOWN_PATH_PREFIX))[0];a=s?s.name:"/"}return l.map(s=>rt(s.value,a,i))},no=t=>{const n=t.map(i=>i.domain).filter(i=>![D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE].includes(i));let r=[];return t.forEach(i=>r.push(...i.domainAliases||[])),r=r.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:n,domainsAliases:r}};function Kn({children:t}){const{api:n,info:r}=J(),[i,o]=y.useState([]),[l,a]=y.useState([]),[s,d]=y.useState([]),x=Me(async()=>{const{sites:O}=await n.getRoutingSites({input:{snapshotHash:""}}),b=O||[];await Promise.all(b.map(async g=>(g.domainAliases=await ii(g.domainAliases,{getIP:oi}),g)));const m=no(b);o(b),a(m.domains),d([window.location.hostname,...m.domains,...m.domainsAliases.map(g=>g.value)])},[r]),c=(O,b)=>{o(m=>m.map(g=>g.id===O?b.domain?b:{...b,domain:g.domain}:g))},u=O=>n.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(O)}}),p=async O=>{const b=await n.addRoutingSite({input:O});o(i.concat(b.site))},w=async(O,b)=>{const m=await n.updateRoutingSite({input:{id:O,...b}});if(m.site&&m.site.id){const g=i.findIndex(k=>k.id===m.site.id);g!==-1&&(i.splice(g,1,m.site),o([].concat(i)))}},j=async O=>{await n.deleteRoutingSite({input:{id:O}}),o(i.filter(b=>b.id!==O))},R=async(O,b,m)=>{const g=await n.addDomainAlias({input:{id:O,domainAlias:b,force:m}});c(O,g.site)},v=async(O,b)=>{const m=await n.deleteDomainAlias({input:{id:O,domainAlias:b}});c(O,m.site)},S=async(O,b)=>{const{site:m}=await n.addRoutingRule({input:{id:O,rule:b}});c(O,m)},_=async(O,b)=>{const{site:m}=await n.updateRoutingRule({input:{id:O,rule:b}});c(O,m)},C=async(O,b)=>{const{site:m}=await n.deleteRoutingRule({input:{id:O,ruleId:b}});c(O,m)},h={loading:x.loading,error:x.error,refresh:x.retry,api:n,actions:{addSite:p,updateSite:w,deleteSite:j,addDomainAlias:R,deleteDomainAlias:v,takeSnapshot:u,addRule:S,updateRule:_,deleteRule:C}},{sites:P,siteMap:I}=Ji({sites:i,nodePort:r.port});return h.sites=P,h.siteMap=I,h.domains=l,h.allDomains=s,h.getBlockletUrl=({did:O,domain:b,mountPoint:m,params:g})=>eo({did:O,domain:b,mountPoint:m,siteMap:h.siteMap,params:g}),h.getBlockletUrls=({did:O,mountPoint:b,params:m})=>to({did:O,mountPoint:b,siteMap:h.siteMap,params:m}),e.jsx(Qi,{value:{routing:h},children:t})}function ue(){const{routing:t}=y.useContext(Pr);return t}function Zt(t){const n=[D.DOMAIN_FOR_IP_SITE_REGEXP,D.DOMAIN_FOR_DEFAULT_SITE,D.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&n.push(window.location.hostname),n.includes(t)}var Jt={},ro=Se;Object.defineProperty(Jt,"__esModule",{value:!0});var Er=Jt.default=void 0,io=ro(Ce()),oo=e;Er=Jt.default=(0,io.default)((0,oo.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");function ao(){return null}function en({confirm:t}){const[n,r]=y.useState(null),{t:i}=z(),o=()=>{r(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?On.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),On.push(`${d}${s.pathname}`)),window.location.reload()}},a=(s,...d)=>{let x=typeof t=="function"?t(s,...d):t;return x?(typeof x=="string"&&(x={description:x}),r({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>o(),...x}),!1):!0};return e.jsxs(so,{children:[e.jsx(ao,{message:a}),n&&e.jsx(le,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})]})}en.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};en.defaultProps={confirm:null};const so=re.div`
|
|
2
2
|
margin-bottom: 24px;
|
|
3
3
|
.top-btns-alert {
|
|
4
4
|
@media (max-width: ${t=>t.theme.breakpoints.values.sm}px) {
|