@abtnode/webapp 1.16.44-beta-20250603-231026-30a9d27f → 1.16.44-beta-20250606-000924-3db49e6a
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-C1BR9cKq.js → AdapterDayjs-COWD5JtG.js} +6 -6
- package/dist/assets/{Add-_FLiPvnr.js → Add-DmsQfZg1.js} +1 -1
- package/dist/assets/{ArrowDropDown-MtffWzvM.js → ArrowDropDown-BJF8xwac.js} +1 -1
- package/dist/assets/{Autocomplete-CgmVM_mh.js → Autocomplete-vxSKHMGU.js} +1 -1
- package/dist/assets/{Breadcrumbs-9te9YWGO.js → Breadcrumbs-CwVp5iih.js} +1 -1
- package/dist/assets/{ButtonGroup-CyZftEPU.js → ButtonGroup-BdUxJL6j.js} +1 -1
- package/dist/assets/{CSSTransition-BiIQcYkx.js → CSSTransition-Buin4nmE.js} +1 -1
- package/dist/assets/{CallMerge-PsrB7Tkl.js → CallMerge-DzNVze2f.js} +1 -1
- package/dist/assets/{CardContent-BVxQxAFx.js → CardContent-Ck8bPS3T.js} +1 -1
- package/dist/assets/{ChevronLeft-CCxHGEqu.js → ChevronLeft-CHpKcvOt.js} +1 -1
- package/dist/assets/{ChevronRight-CfdjNfdi.js → ChevronRight-CDh3IWPn.js} +1 -1
- package/dist/assets/{Clear-CzzSn6gi.js → Clear-CUuU2COm.js} +1 -1
- package/dist/assets/{Close-B53jEGex.js → Close-CYDPl-BR.js} +1 -1
- package/dist/assets/{Community-BBDlY1li.js → Community-B1vZfC0n.js} +1 -1
- package/dist/assets/{Delete-B03xny6i.js → Delete-BFvNvkKH.js} +1 -1
- package/dist/assets/{DeleteOutline-C_C-bBpS.js → DeleteOutline-XxJJPccl.js} +1 -1
- package/dist/assets/{Done-CEnGV2P1.js → Done-DXL_lboj.js} +1 -1
- package/dist/assets/{Edit-CjM24S2u.js → Edit-BDLQHBfv.js} +1 -1
- package/dist/assets/{ErrorOutline-D6y9_qL6.js → ErrorOutline-BqCgruIq.js} +1 -1
- package/dist/assets/{HelpOutline-B4MIH072.js → HelpOutline-DOTVANjl.js} +1 -1
- package/dist/assets/{Holiday-BIM_wngw.js → Holiday-C8QlqPiV.js} +1 -1
- package/dist/assets/{Launch-B3yvw_J_.js → Launch-75dDpbSE.js} +1 -1
- package/dist/assets/{Link-DKridYM9.js → Link-B_XSUMth.js} +1 -1
- package/dist/assets/{ListItemButton-vZmBkXWh.js → ListItemButton-BLW6bFI-.js} +1 -1
- package/dist/assets/{ListSubheader-BPhNB2Oc.js → ListSubheader-CfyBCO5n.js} +1 -1
- package/dist/assets/{LoadingButton-Davlvc6y.js → LoadingButton-COP8WH4-.js} +1 -1
- package/dist/assets/{LockIcon-1C9n63UW.js → LockIcon-D3Z4EOrH.js} +1 -1
- package/dist/assets/{Meeting-CbtQNFzo.js → Meeting-B3nrrSmd.js} +1 -1
- package/dist/assets/{MoreHoriz-D7yyKUPp.js → MoreHoriz-CyojT95D.js} +1 -1
- package/dist/assets/{MoreVert-D8KfjeMg.js → MoreVert-CY5UmTZf.js} +1 -1
- package/dist/assets/{OffSick-D11BmTrz.js → OffSick-CcxxzaCq.js} +1 -1
- package/dist/assets/{OpenInNew-CvtRLCd4.js → OpenInNew-DnrWV3yn.js} +1 -1
- package/dist/assets/{Public-BF2LKG2O.js → Public-BxlT4ar1.js} +1 -1
- package/dist/assets/{Refresh-CMdl0n4X.js → Refresh-CHCYG34h.js} +1 -1
- package/dist/assets/{SchemaReference.es-Bz1aIhgW.js → SchemaReference.es-DW_BaUmb.js} +1 -1
- package/dist/assets/{Search-C9hXwvmq.js → Search-CmNEQ5JZ.js} +1 -1
- package/dist/assets/{Slider-OBEuEr91.js → Slider-CRr1MgQd.js} +1 -1
- package/dist/assets/{Stepper-g85lhZ09.js → Stepper-i90G-x7z.js} +1 -1
- package/dist/assets/{Switch-DHcUbR0L.js → Switch-CAA_W5zU.js} +1 -1
- package/dist/assets/{TableRow-DQ5x-tZA.js → TableRow-CWePJwiC.js} +1 -1
- package/dist/assets/{TableSearch-Di-DZraN.js → TableSearch-CAfpRGt6.js} +2 -2
- package/dist/assets/{ToggleButtonGroup-DmZrsSwk.js → ToggleButtonGroup-uPOF6EI1.js} +1 -1
- package/dist/assets/{Verified-NpqHLdgb.js → Verified-Bx4tqzTo.js} +1 -1
- package/dist/assets/{VerifiedUser-DWougmnk.js → VerifiedUser-CbwUXG1q.js} +1 -1
- package/dist/assets/{ViewColumn-BcfEtc-F.js → ViewColumn-PuSNsBrC.js} +1 -1
- package/dist/assets/{ViewList-Bw5GBfRx.js → ViewList-BZG0GmGI.js} +1 -1
- package/dist/assets/{WorkingRemotely-Ddq9A0PU.js → WorkingRemotely-DPIGSwgw.js} +1 -1
- package/dist/assets/{_createAggregator-e8B5UuQb.js → _createAggregator-DjlOcyip.js} +1 -1
- package/dist/assets/{actions-D-CrDKrc.js → actions-BkIYt3iW.js} +1 -1
- package/dist/assets/{actions-n15iXAnz.js → actions-DmOI9K-e.js} +1 -1
- package/dist/assets/{agreement-DxiSkmRO.js → agreement-Bn3g7OX2.js} +1 -1
- package/dist/assets/api-CSXglyXM.js +1 -0
- package/dist/assets/appearance-CStOb7Fc.js +1 -0
- package/dist/assets/{audit-logs-Cm7Peo8d.js → audit-logs-CvCKyTWP.js} +2 -2
- package/dist/assets/{base-chart-sAweLHnI.js → base-chart-D1YvxcHM.js} +1 -1
- package/dist/assets/{blocklet-0XH8mmGQ.js → blocklet-d4uc0WVl.js} +1 -1
- package/dist/assets/{brace-fold.es-BSbx02n-.js → brace-fold.es-DHAkC_hg.js} +1 -1
- package/dist/assets/{chain-DXi01pCi.js → chain-D2t6gpcF.js} +1 -1
- package/dist/assets/{click-to-copy-CzLJWIzM.js → click-to-copy-ChrBL_sU.js} +1 -1
- package/dist/assets/cloneDeep-COa3K2Xz.js +1 -0
- package/dist/assets/{closebrackets.es-CgYkPTvg.js → closebrackets.es-hTcRhABj.js} +1 -1
- package/dist/assets/{codemirror.es-BZ0a_ivo.js → codemirror.es-DDz_iErr.js} +1 -1
- package/dist/assets/{collapse-BiA9C3xc.js → collapse-D5t7hqS5.js} +1 -1
- package/dist/assets/{comment.es-7f02Xyrt.js → comment.es-G52g7yxU.js} +1 -1
- package/dist/assets/{config-navigation-CVCS_wmz.js → config-navigation-e65eTLKt.js} +10 -10
- package/dist/assets/{connect-to-ChNP_InC.js → connect-to-BgFyoHV2.js} +1 -1
- package/dist/assets/{delete-confirm-BQv2uNjr.js → delete-confirm-B4su4n_V.js} +1 -1
- package/dist/assets/{detail-CmCy8OZl.js → detail-B7iGZT4H.js} +4 -4
- package/dist/assets/{dialog.es-WzckXrqD.js → dialog.es-UcyuRN52.js} +1 -1
- package/dist/assets/{domains-DJunvhC7.js → domains-mqMNm2Tp.js} +2 -2
- package/dist/assets/{download-BBnocOOE.js → download-Dq6eTZFv.js} +1 -1
- package/dist/assets/emotion-react.browser.esm-DHmVYDwC.js +1 -0
- package/dist/assets/{foldgutter.es-DEngPfJB.js → foldgutter.es-5Zfo0eAd.js} +1 -1
- package/dist/assets/{get-safe-url-CeasmSQ-.js → get-safe-url-Bzzqyia_.js} +1 -1
- package/dist/assets/{get-safe-url-DOD4GJn9.js → get-safe-url-CD7qzOkB.js} +1 -1
- package/dist/assets/getValidReactChildren-CBn6KsUs.js +1 -0
- package/dist/assets/{hint.es-DyRx1Cyd.js → hint.es-Cy1WIs0-.js} +1 -1
- package/dist/assets/{hint.es2-DzHCUANh.js → hint.es2-CwcvniV-.js} +1 -1
- package/dist/assets/{iframe-CaiV-sh3.js → iframe-BS7qzZNq.js} +1 -1
- package/dist/assets/{index-BLXylM3L.js → index-0iBmOBqA.js} +8 -8
- package/dist/assets/{index-wPkudHOp.js → index-24vP3TFg.js} +1 -1
- package/dist/assets/{index-CWrKe4Fn.js → index-7WgVD2cX.js} +1 -1
- package/dist/assets/{index-DhhYGftt.js → index-9ET6AQ0z.js} +1 -1
- package/dist/assets/index-B2CYtIF6.js +120 -0
- package/dist/assets/{index-BP-_EDED.js → index-B2RKnsbt.js} +1 -1
- package/dist/assets/{index-BI07C4m-.js → index-B4x111ud.js} +3 -3
- package/dist/assets/{index-BoaJIDrq.js → index-BI-wXMup.js} +1 -1
- package/dist/assets/{index-BId_FUnH.js → index-BIEjxXV4.js} +1 -1
- package/dist/assets/{index-CJYLnawL.js → index-BNFP0EOr.js} +2 -2
- package/dist/assets/{index-C3mZr8we.js → index-BRhMcCbm.js} +1 -1
- package/dist/assets/{index-CjKWQIp8.js → index-BUiqx3ej.js} +1 -1
- package/dist/assets/{index-DqemVNEB.js → index-BiWvMsKp.js} +1 -1
- package/dist/assets/{index-B3V-N3Wb.js → index-Bnvy96j6.js} +1 -1
- package/dist/assets/{index-F1az7AW1.js → index-BzZrayKh.js} +2 -2
- package/dist/assets/{index-DIn71jxf.js → index-C7zRydQ-.js} +4 -4
- package/dist/assets/{index-IEQvL11R.js → index-C8jxIi4G.js} +1 -1
- package/dist/assets/{index-UwyveOVh.js → index-C9mI5vPj.js} +1 -1
- package/dist/assets/{index-Dq5qISUc.js → index-CEiDEGi7.js} +1 -1
- package/dist/assets/{index-C2_kibHi.js → index-CJ0WKxjC.js} +1 -1
- package/dist/assets/{index-DGAkAa65.js → index-CPAsOeUj.js} +5 -5
- package/dist/assets/{index-ND43AQF3.js → index-CUYyceiu.js} +1 -1
- package/dist/assets/{index-Btk3r71p.js → index-CZmAlmGA.js} +1 -1
- package/dist/assets/index-CeQ4m-US.js +1 -0
- package/dist/assets/{index-C8E-LVoC.js → index-Cezw35sH.js} +1 -1
- package/dist/assets/{index-Dw_CLa5a.js → index-CvS3IBj0.js} +1 -1
- package/dist/assets/{index-CsTPddhu.js → index-CxB_JDvy.js} +3 -3
- package/dist/assets/{index-CzmPd2Yv.js → index-D03n0SWF.js} +2 -2
- package/dist/assets/{index-CfPPx3Iq.js → index-DD9HjQJ6.js} +1 -1
- package/dist/assets/index-DDLJvXRY.js +1 -0
- package/dist/assets/index-DGlKtoE6.js +20 -0
- package/dist/assets/{index-DuUh_tiX.js → index-DM32dRLJ.js} +1 -1
- package/dist/assets/{index-CJw-UBp7.js → index-DNly4LH-.js} +12 -12
- package/dist/assets/{index-B_Ia97sj.js → index-DcL-lrDX.js} +1 -1
- package/dist/assets/{index-uI9vL45f.js → index-DdaRfqLV.js} +12 -12
- package/dist/assets/{index-rqpjf_aL.js → index-DhJXa2uA.js} +1 -1
- package/dist/assets/index-Dk7_SdH3.js +161 -0
- package/dist/assets/{index-B9U9Suki.js → index-DnKnRPm_.js} +1 -1
- package/dist/assets/{index-BfFQSInC.js → index-DwLmgwkp.js} +1 -1
- package/dist/assets/{index-CdUA_Nw3.js → index-Dx0m3RKd.js} +1 -1
- package/dist/assets/{index-BvqxJBeo.js → index-EQLT-AhN.js} +1 -1
- package/dist/assets/{index-CjndCckY.js → index-HgvCb2Lj.js} +1 -1
- package/dist/assets/{index-yr2tw49U.js → index-d7wc64Rd.js} +1 -1
- package/dist/assets/{index-CO5SYnb0.js → index-dJwxhFtO.js} +1 -1
- package/dist/assets/{index-F9yX_03E.js → index-nulHR-ZA.js} +4 -4
- package/dist/assets/{index-BrmVQ0Dk.js → index-ojS5PteN.js} +1 -1
- package/dist/assets/index-wE9KlGoE.js +1 -0
- package/dist/assets/{index.esm-DFALq7M0.js → index.esm-CMjubPed.js} +1 -1
- package/dist/assets/{info-addon.es-BqpBr1a_.js → info-addon.es-BgNhM6Wh.js} +1 -1
- package/dist/assets/{info.es-XpHeRZxm.js → info.es-DAQPE_JF.js} +1 -1
- package/dist/assets/{install-from-url-C-0PYSod.js → install-from-url-DZ4S3QsL.js} +1 -1
- package/dist/assets/{invitation-CiC039B0.js → invitation-Ce0YFKCl.js} +6 -6
- package/dist/assets/is-path-prefix-equal-DVAFbf2C.js +1 -0
- package/dist/assets/item-BeUueDZb.js +277 -0
- package/dist/assets/{javascript.es-lbPUI9aU.js → javascript.es-CwRW0hf6.js} +1 -1
- package/dist/assets/{jump-to-line.es-M3uS8xdC.js → jump-to-line.es-BtUZlQja.js} +1 -1
- package/dist/assets/{jump.es-Cczg0IOe.js → jump.es-DjZeJser.js} +1 -1
- package/dist/assets/{lint.es-CV3CrdJN.js → lint.es-BdtYNG91.js} +1 -1
- package/dist/assets/{lint.es2-DVxe7fKQ.js → lint.es2-uSh0jHB2.js} +1 -1
- package/dist/assets/{lint.es3-B3ba4H3v.js → lint.es3-j6Yj27Ve.js} +1 -1
- package/dist/assets/{list-header-DphF1qCI.js → list-header-DfjKeMcS.js} +1 -1
- package/dist/assets/{log-CFdakmxI.js → log-DW0ANVNb.js} +1 -1
- package/dist/assets/{lottie-react.esm-B-RjdQsR.js → lottie-react.esm-CEC1G-RL.js} +1 -1
- package/dist/assets/{matchbrackets.es-BhPVZP1g.js → matchbrackets.es-rG_KCw2s.js} +1 -1
- package/dist/assets/{memory-exz0edFH.js → memory-BTbeFhis.js} +1 -1
- package/dist/assets/{metric-Cp_OG6Ar.js → metric-Dy6FsPJU.js} +1 -1
- package/dist/assets/{mode.es-BdIEUTT-.js → mode.es-8wscYxXP.js} +1 -1
- package/dist/assets/{mode.es2-DCGZNnw-.js → mode.es2-BLRE0Hzn.js} +1 -1
- package/dist/assets/{mode.es3-DCV5y4SV.js → mode.es3-CEzryh_W.js} +1 -1
- package/dist/assets/omit-DkVCPVbd.js +1 -0
- package/dist/assets/{onlineParser.es-C7-DSgy-.js → onlineParser.es-93Ks3PCe.js} +1 -1
- package/dist/assets/{overview-BcgyjCEc.js → overview-BcgcV1PJ.js} +1 -1
- package/dist/assets/{permission-imoW7Dag.js → permission-Bk3c5R-B.js} +1 -1
- package/dist/assets/{preference--W7SqmXq.js → preference-BrTc68Bl.js} +5 -5
- package/dist/assets/{raf-schd.esm-FMWvAY6y.js → raf-schd.esm-BIqHN8M2.js} +1 -1
- package/dist/assets/refType-CkFpKu0E.js +1 -0
- package/dist/assets/{resource-dialog-OB8ZWKbP.js → resource-dialog-86DZdrSQ.js} +22 -22
- package/dist/assets/{runtime-DLa3pUwk.js → runtime-C25o0bRQ.js} +1 -1
- package/dist/assets/{schema-CB6vZuPk.js → schema-B3UXKlNA.js} +1 -1
- package/dist/assets/sdk-NJ5k0faj.js +1 -0
- package/dist/assets/{search.es-CxoPeMIs.js → search.es-BmzfuDmr.js} +1 -1
- package/dist/assets/{searchcursor.es-BLi5Jaz_.js → searchcursor.es-CEv_VY8-.js} +1 -1
- package/dist/assets/{service-CM59EUE1.js → service-C0Vf0tgC.js} +1 -1
- package/dist/assets/{shorten-label-ROv_Kolv.js → shorten-label-97v5f_YO.js} +1 -1
- package/dist/assets/{show-hint.es-VA8ntogJ.js → show-hint.es-BtxSRXo1.js} +1 -1
- package/dist/assets/{simple-select-DZQHpfOs.js → simple-select-tEDbNxH9.js} +1 -1
- package/dist/assets/{spaces-pq4q-xcK.js → spaces-BxCxqkwa.js} +1 -1
- package/dist/assets/{status-BNtF-O7o.js → status-5WoJ8oHI.js} +1 -1
- package/dist/assets/{status-DQe5HrFt.js → status-Bf0_zjRO.js} +1 -1
- package/dist/assets/{sublime.es-B0oX3S1G.js → sublime.es-CG9Dsoao.js} +1 -1
- package/dist/assets/{switch-control-BkuPmwf0.js → switch-control--vCYy0zI.js} +1 -1
- package/dist/assets/{table-icons-mGCUcig8.js → table-icons-DMNKguF9.js} +1 -1
- package/dist/assets/{team-B7OFmIul.js → team-BHseiVH-.js} +1 -1
- package/dist/assets/{toLower-B6OvbucL.js → toLower-Oz-YHJel.js} +1 -1
- package/dist/assets/toUpper-HfeZ5aFq.js +1 -0
- package/dist/assets/{traffic-B4Jt45EJ.js → traffic-DaZjmS2R.js} +1 -1
- package/dist/assets/url-evaluation-CMq6nekH.js +1 -0
- package/dist/assets/{url-join-ChoyKXT9.js → url-join-dryc4Z0o.js} +1 -1
- package/dist/assets/{use-mobile-BGEwy1l2.js → use-mobile-CLF4xz_r.js} +1 -1
- package/dist/assets/{use-mobile-DTCaLf5g.js → use-mobile-CXuUpusU.js} +1 -1
- package/dist/assets/{useAsync-DUqq2w5l.js → useAsync-D1EHGwrn.js} +1 -1
- package/dist/assets/{useAsyncRetry-B5nI7RKf.js → useAsyncRetry-PWMLztvS.js} +1 -1
- package/dist/assets/{useLocalStorage-BJuW1NlC.js → useLocalStorage-Qz-M059E.js} +1 -1
- package/dist/assets/{useThemeProps-BK5mEVp3.js → useThemeProps-ByrDiWpN.js} +1 -1
- package/dist/assets/{util-D0meRqEm.js → util-BercmLrO.js} +1 -1
- package/dist/assets/{wait-container-BatWKxuP.js → wait-container-CkiVV7wb.js} +1 -1
- package/dist/assets/withStyles-DHVvCz_s.js +1 -0
- package/dist/assets/{wrap-locale-BhcfayAL.js → wrap-locale-Bq5Aw9d0.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Delete-Ckjh8fiz.js +0 -1
- package/dist/assets/api-BdCtM-JU.js +0 -1
- package/dist/assets/appearance-CmkcRR-A.js +0 -1
- package/dist/assets/cloneDeep-DrIYfJtK.js +0 -1
- package/dist/assets/emotion-react.browser.esm-Bw_a1zYt.js +0 -1
- package/dist/assets/getValidReactChildren-Dpq0Aubw.js +0 -1
- package/dist/assets/index-B6Sh3GL-.js +0 -109
- package/dist/assets/index-BS6EkSO3.js +0 -1
- package/dist/assets/index-BfJyRoJf.js +0 -1
- package/dist/assets/index-C2yIkz2Y.js +0 -1
- package/dist/assets/index-C3V0tJaS.js +0 -1
- package/dist/assets/index-CXWISdb1.js +0 -20
- package/dist/assets/index-CoLl5HNr.js +0 -161
- package/dist/assets/index-DQ3oLIL5.js +0 -7
- package/dist/assets/is-path-prefix-equal-CSbxgWMC.js +0 -1
- package/dist/assets/item-C8WBT7Kr.js +0 -277
- package/dist/assets/omit-D6CPuAva.js +0 -1
- package/dist/assets/refType-CPeRd-dg.js +0 -1
- package/dist/assets/sdk-Dhp8eIdk.js +0 -1
- package/dist/assets/table-tips-s8yom9jj.js +0 -1
- package/dist/assets/toUpper-1vQFjHq5.js +0 -1
- package/dist/assets/url-evaluation-UX_hT3EN.js +0 -1
- package/dist/assets/withStyles-Bg0r5eKS.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,bq as H,K as y,aB as Ce,P as i,y as L,al as ft,r as f,e as ve,bD as qe,b as Y,H as B,V as $t,bC 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 Go,gL as Wo,e1 as zo,C as ue,fM as Fo,w as Vo,az as Gn,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,dF as Jo,dS as er,aD as tr,aE as nr,aF as or,aH as Q,aS as rr,cQ 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 Wn,cO as cr,k0 as dr,A as U,ae as Ge,aO as mo,bU as Ft,cy 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,bE as ho,gJ as gr,ct as xr,aK as yr,bw as Cr,aV as jr,en as vr,fV as zn,la as Fn,h9 as Vn,U as Yn,G as lt,cN as br,ha as Rr,bT as Sr,k1 as wr}from"./index-CsTPddhu.js";import{d as Er}from"./Add-_FLiPvnr.js";import{E as Tr}from"./index-Dq5qISUc.js";import{e as kr,f as Pr,g as _r,u as Vt,a as Ir}from"./actions-n15iXAnz.js";import{S as Dr}from"./switch-control-BkuPmwf0.js";import{u as pe}from"./blocklet-0XH8mmGQ.js";import{P as At,w as yt}from"./permission-imoW7Dag.js";import{d as go}from"./Edit-CjM24S2u.js";import{T as Ur,M as Nr,t as Lr}from"./table-icons-mGCUcig8.js";import{s as Br,R as dt,F as Or,L as $r,d as Mr,B as Ar}from"./preference--W7SqmXq.js";import{C as Kn}from"./click-to-copy-CzLJWIzM.js";import{d as Yt}from"./Link-DKridYM9.js";import{c as qr,C as Gr,b as Wr,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-C8WBT7Kr.js";import{u as Zr,a as Xr,P as Co,L as Hn,A as Jr,S as es}from"./index-BLXylM3L.js";import{u as ts,C as ns,D as os,a as rs,b as ss}from"./connect-to-ChNP_InC.js";import{C as is,u as as,A as ls}from"./agreement-DxiSkmRO.js";import{d as cs}from"./Done-CEnGV2P1.js";import{A as ds,a as us,d as ps,b as ms}from"./collapse-BiA9C3xc.js";import{C as fs,L as hs}from"./LockIcon-1C9n63UW.js";import{I as gs,a as xs,f as ys,B as Cs}from"./install-from-url-C-0PYSod.js";import{a as Qn}from"./api-BdCtM-JU.js";import{v as jo,e as js,a as ut}from"./util-D0meRqEm.js";import{u as vo}from"./use-mobile-DTCaLf5g.js";import{d as vs}from"./ArrowDropDown-MtffWzvM.js";import{_ as bs}from"./useLocalStorage-BJuW1NlC.js";import{d as Ct}from"./Delete-B03xny6i.js";import{d as bo}from"./Launch-B3yvw_J_.js";import{D as Rs}from"./delete-confirm-BQv2uNjr.js";import{W as Qe,R as Ss,a as Zn}from"./url-evaluation-UX_hT3EN.js";import{B as Ro}from"./status-DQe5HrFt.js";import{A as So}from"./actions-D-CrDKrc.js";import{I as Nt}from"./index-IEQvL11R.js";import{t as ws}from"./toUpper-1vQFjHq5.js";import{S as Es}from"./Switch-DHcUbR0L.js";import{a as Ts}from"./team-B7OFmIul.js";import"./MoreVert-D8KfjeMg.js";import"./get-safe-url-DOD4GJn9.js";import"./ButtonGroup-CyZftEPU.js";import"./getValidReactChildren-Dpq0Aubw.js";import"./index-yr2tw49U.js";import"./raf-schd.esm-FMWvAY6y.js";import"./index-B_Ia97sj.js";import"./ViewColumn-BcfEtc-F.js";import"./CSSTransition-BiIQcYkx.js";import"./index-C3mZr8we.js";import"./Clear-CzzSn6gi.js";import"./ChevronRight-CfdjNfdi.js";import"./ChevronLeft-CCxHGEqu.js";import"./Search-C9hXwvmq.js";import"./omit-D6CPuAva.js";import"./index-CWrKe4Fn.js";import"./index-B3V-N3Wb.js";import"./iframe-CaiV-sh3.js";import"./index-BS6EkSO3.js";import"./Autocomplete-CgmVM_mh.js";import"./ListSubheader-BPhNB2Oc.js";import"./Verified-NpqHLdgb.js";import"./VerifiedUser-DWougmnk.js";import"./DeleteOutline-C_C-bBpS.js";import"./url-join-ChoyKXT9.js";import"./Close-B53jEGex.js";import"./index-CjndCckY.js";import"./OpenInNew-CvtRLCd4.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-B4MIH072.js";import"./index-C2_kibHi.js";import"./spaces-pq4q-xcK.js";import"./index-CJw-UBp7.js";import"./cloneDeep-DrIYfJtK.js";import"./schema-CB6vZuPk.js";import"./ListItemButton-vZmBkXWh.js";import"./Stepper-g85lhZ09.js";import"./is-path-prefix-equal-CSbxgWMC.js";import"./MoreHoriz-D7yyKUPp.js";const ks=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={},Ps=Wt;Object.defineProperty(Kt,"__esModule",{value:!0});var wo=Kt.default=void 0,_s=Ps(Gt()),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=Wt;Object.defineProperty(Ht,"__esModule",{value:!0});var Qt=Ht.default=void 0,Us=Ds(Gt()),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}=W(),{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(kr,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_")),P={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?P:{}})})})]})}Xt.propTypes={blocklet:i.object.isRequired,ancestors:i.array};Xt.defaultProps={ancestors:[]};const Os=$.div`
|
|
1
|
+
import{bW as Bo,j as t,f6 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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 Go,gL as Wo,e2 as zo,C as ue,fQ as Fo,w as Vo,az as Gn,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,dG as Jo,dT 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 Wn,cP as cr,k0 as dr,A as U,ae as Ge,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,eo 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-CxB_JDvy.js";import{d as Er}from"./Add-DmsQfZg1.js";import{E as Tr}from"./index-CEiDEGi7.js";import{e as Pr,f as kr,g as _r,u as Vt,a as Ir}from"./actions-DmOI9K-e.js";import{S as Dr}from"./switch-control--vCYy0zI.js";import{u as pe}from"./blocklet-d4uc0WVl.js";import{P as At,w as yt}from"./permission-Bk3c5R-B.js";import{d as go}from"./Edit-BDLQHBfv.js";import{T as Ur,M as Nr,t as Lr}from"./table-icons-DMNKguF9.js";import{s as Br,R as dt,F as Or,L as $r,d as Mr,B as Ar}from"./preference-BrTc68Bl.js";import{C as Kn}from"./click-to-copy-ChrBL_sU.js";import{d as Yt}from"./Link-B_XSUMth.js";import{c as qr,C as Gr,b as Wr,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-BeUueDZb.js";import{u as Zr,a as Xr,P as Co,L as Hn,A as Jr,S as es}from"./index-0iBmOBqA.js";import{u as ts,C as ns,D as os,a as rs,b as ss}from"./connect-to-BgFyoHV2.js";import{C as is,u as as,A as ls}from"./agreement-Bn3g7OX2.js";import{d as cs}from"./Done-DXL_lboj.js";import{A as ds,a as us,d as ps,b as ms}from"./collapse-D5t7hqS5.js";import{C as fs,L as hs}from"./LockIcon-D3Z4EOrH.js";import{I as gs,a as xs,f as ys,B as Cs}from"./install-from-url-DZ4S3QsL.js";import{a as Qn}from"./api-CSXglyXM.js";import{v as jo,e as js,a as ut}from"./util-BercmLrO.js";import{u as vo}from"./use-mobile-CXuUpusU.js";import{d as vs}from"./ArrowDropDown-BJF8xwac.js";import{_ as bs}from"./useLocalStorage-Qz-M059E.js";import{d as Ct}from"./Delete-BFvNvkKH.js";import{d as bo}from"./Launch-75dDpbSE.js";import{D as Rs}from"./delete-confirm-B4su4n_V.js";import{W as Qe,R as Ss,a as Zn}from"./url-evaluation-CMq6nekH.js";import{B as Ro}from"./status-Bf0_zjRO.js";import{A as So}from"./actions-BkIYt3iW.js";import{I as Nt}from"./index-C8jxIi4G.js";import{t as ws}from"./toUpper-HfeZ5aFq.js";import{S as Es}from"./Switch-CAA_W5zU.js";import{a as Ts}from"./team-BHseiVH-.js";import"./MoreVert-CY5UmTZf.js";import"./get-safe-url-CD7qzOkB.js";import"./ButtonGroup-BdUxJL6j.js";import"./getValidReactChildren-CBn6KsUs.js";import"./index-d7wc64Rd.js";import"./raf-schd.esm-BIqHN8M2.js";import"./index-DcL-lrDX.js";import"./ViewColumn-PuSNsBrC.js";import"./CSSTransition-Buin4nmE.js";import"./index-BRhMcCbm.js";import"./Clear-CUuU2COm.js";import"./ChevronRight-CDh3IWPn.js";import"./ChevronLeft-CHpKcvOt.js";import"./Search-CmNEQ5JZ.js";import"./omit-DkVCPVbd.js";import"./index-7WgVD2cX.js";import"./index-Bnvy96j6.js";import"./iframe-BS7qzZNq.js";import"./Autocomplete-vxSKHMGU.js";import"./ListSubheader-CfyBCO5n.js";import"./Verified-Bx4tqzTo.js";import"./VerifiedUser-CbwUXG1q.js";import"./DeleteOutline-XxJJPccl.js";import"./url-join-dryc4Z0o.js";import"./Close-CYDPl-BR.js";import"./index-HgvCb2Lj.js";import"./OpenInNew-DnrWV3yn.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-DOTVANjl.js";import"./index-CJ0WKxjC.js";import"./spaces-BxCxqkwa.js";import"./index-DNly4LH-.js";import"./cloneDeep-COa3K2Xz.js";import"./schema-B3UXKlNA.js";import"./ListItemButton-BLW6bFI-.js";import"./Stepper-i90G-x7z.js";import"./is-path-prefix-equal-DVAFbf2C.js";import"./MoreHoriz-CyojT95D.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=Wt;Object.defineProperty(Kt,"__esModule",{value:!0});var wo=Kt.default=void 0,_s=ks(Gt()),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=Wt;Object.defineProperty(Ht,"__esModule",{value:!0});var Qt=Ht.default=void 0,Us=Ds(Gt()),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}=W(),{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;
|
|
@@ -75,7 +75,7 @@ import{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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:
|
|
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(Fo,{})})]}):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(Gs,{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 Gs=$(Or)``;function rn({meta:e,onCancel:o,mode:n,handlePaySuccess:a}){const{t:r,locale:s}=W(),{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:Gn.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:Gn.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(Gr,{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 Ws=sn;function zs({...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}=W(),s=vo();return!e||Qo(e.meta)?t.jsx(Fs,{children:n}):t.jsxs(Vs,{isMobile:s,children:[t.jsx(zs,{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 Fs=$(y)`
|
|
79
79
|
width: 100%;
|
|
80
80
|
margin-top: auto;
|
|
81
81
|
padding-top: 24px;
|
|
@@ -125,7 +125,7 @@ import{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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}=W(),{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"),[
|
|
128
|
+
`;function cn({onChange:e,loading:o,children:n,extra:a,stores:r,storageKey:s}){const{t:h}=W(),{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(Wr,{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(zr,{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{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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,
|
|
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}=W();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}=W(),[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(Fr,{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{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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}=W(),[S,R]=f.useState(!1),[P,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),[ke,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),[G,he]=f.useState(0),A=f.useRef({}),Pe=f.useRef({}),le=f.useRef({}),_e=uo(k=>k.breakpoints.down("md")),E=ir(),[V,ce]=f.useState(!0),{meta:z}=A.current,ee=as(z),be=f.useRef(!1),F=k=>fe(D=>({...D,...k}));f.useEffect(()=>{if(_.pathPrefix){const{errMsg:k}=Pn({..._,pathPrefix:_.pathPrefix,locale:T});u(k)}},[_.pathPrefix]),f.useEffect(()=>{G===0&&fe(Ee)},[G]);const Ie=()=>{const k=Ot(I)??"";F({didSpaceEndpoint:k})},Re=()=>{var k;return(k=A==null?void 0:A.current)!=null&&k.meta?B.getDisplayName(A.current):""},We=()=>{R(!1),fe({}),be.current=!1,A.current={},e()},Le=k=>{const D=O=>{F({installResultProps:{variant:"error",title:Re(),subTitle:k,footer:t.jsx(ae,{className:"bottom-button",disabled:O,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await kn(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=k=>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)&&k(D)},_o=()=>{so({timeout:0,componentDid:E.componentDid,manual:!0}),We(),setTimeout(()=>{const k=document.getElementsByClassName("dashboard-main")[0];k&&(k.scrollTop=k.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 k=Ot(I);F(D=>({...D,didSpaceEndpoint:k}))}),[(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=k=>((I==null?void 0:I.children)||[]).find(D=>D.meta.did===k),kn=async k=>{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:kt}=Ue,Ye=($e=A.current)==null?void 0:$e.downloadTokenList,re=Ve||(Fe?Wn(Te,O,kt):"");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}:{},...k};try{if(await j.installComponent({input:tt}),Te){const{teamDid:xe,storeList:Me}=lo({fromBlocklet:M,nodeInfo:X,blocklet:I}),{isNew:Pt,decoded:nt}=cr(Te,Me);Pt&&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}},Pn=k=>{const D=jo({params:{...k,did:k.bundleDid},blocklets:[I],blocklet:I,locale:T});if(D){const O=Tn(k.bundleDid),q=js({params:{...k,did:k.bundleDid},blocklet:I});if(O&&O.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async k=>{var O,q;const{errMsg:D}=Pn({..._,locale:T});u(D),G===de.length-2&&!be.current&&await kn(k),(q=(O=Pe.current)==null?void 0:O.setActiveStepByIndex)==null||q.call(O,De=>De+1)},ze=()=>{var k,D;(D=(k=Pe.current)==null?void 0:k.setActiveStepByIndex)==null||D.call(k,O=>O-1)},Io=()=>{const{pathPrefix:k,bundleDid:D,title:O,componentName:q="",componentDid:De=""}=_,{meta:Be={}}=A.current||{},{registryUrl:Ue,inStore:Se,inputUrl:Te,dist:Fe}=Be,Ve=Se?Wn(Ue,D,Fe):Te;J({meta:Be,installOpts:{type:"component",rootDid:I.meta.did,mountPoint:k,url:Ve,title:O,name:q,did:De}})},Do=k=>{we(!1),F({purchaseResultProps:{variant:"error",title:Re(),subTitle:k,style:{paddingTop:120},footer:t.jsx(ae,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{F({purchaseResultProps:{}})},children:d("common.retry")})}})},Uo=({downloadTokenList:k})=>{A.current.downloadTokenList=k,we(!1),ge()},Tt=({chooseParams:k=A.current,componentDid:D,isInit:O=!1})=>{var nt,$n,Mn,An;const{meta:q,registryUrl:De,inStore:Be,inputUrl:Ue}=k,{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),kt=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={...k,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),Pt=Ot(I);F({bundleDid:Se,componentDid:kt,...re,hasRequiredEnvironments:ii(A.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:Me,didSpaceEndpoint:Pt}),O&&xe&&Io()};f.useEffect(()=>{!c||G!==0||!I||(Tt({chooseParams:{blocklets:[c],meta:c,registryUrl:p||c.homepage,inStore:!0},isInit:!0}),F({showFromUrlDialog:!1}),ge())},[c,G,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:k,inputUrl:D,inStore:O,registryUrl:q})=>{Tt({chooseParams:{meta:k,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:k})=>t.jsx(un,{showResourcesSwitch:x,showCategory:b,serverVersion:X==null?void 0:X.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:k.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:We,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?We: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||ke)&&t.jsx(ct,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),at(_.purchaseResultProps)?me&&t.jsx(Ws,{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||ke,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:k=>{const D=k.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:!!P||(_==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:(k,{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[G]||{},No=()=>S||oe.error||!_.bundleDid?!0:G>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:Pe,meta:z,isMobile:_e,onStepChange:k=>{he(k)}})}),t.jsxs(y,{className:"action-bar",children:[oe.cancel&&t.jsx(ae,{onClick:k=>{k.stopPropagation(),oe.onCancel()},disabled:G===de.length-2&&S,color:"inherit",children:oe.cancel||d("common.cancel")}),oe.confirm&&t.jsx(ae,{onClick:k=>{k.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}=W(),[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),[G,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(()=>{G===0&&fe(Ee)},[G]);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):""},We=()=>{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}),We(),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?Wn(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),G===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?Wn(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||G!==0||!I||(Tt({chooseParams:{blocklets:[c],meta:c,registryUrl:p||c.homepage,inStore:!0},isInit:!0}),F({showFromUrlDialog:!1}),ge())},[c,G,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:We,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?We: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(Ws,{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[G]||{},No=()=>S||oe.error||!_.bundleDid?!0:G>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:G===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{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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}=W(),[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}=W(),{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}=W(),{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 P=null;return o||(P=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:[P,(n||x)&&t.jsx(Ge,{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}=W(),{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(P){L.error(P.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=P=>{P.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}=W(),{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},P=u=>{u.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof a=="function"?a({loading:c,open:P}):t.jsxs(ye,{onClick:P,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(Ge,{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}=W(),{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}=W(),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(ks,{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}=W(),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}=W(),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}=W(),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}=W(),[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}=W(),{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}=W(),{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(Ge,{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}=W(),{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}=W(),{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(Ge,{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}=W(),{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}=W(),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}=W(),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}=W(),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}=W(),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;
|
|
@@ -371,15 +371,15 @@ import{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,bq as
|
|
|
371
371
|
.ux-dialog_closeButton {
|
|
372
372
|
margin: 0;
|
|
373
373
|
}
|
|
374
|
-
`;function Cn({component:e,remove:o,disabled:n,tip:a,showConfirm:r,hideBtn:s,onCancel:h}){const{t:c}=f.useContext(ve),[p,x]=f.useState(!1),[g,l]=f.useState(null),b=async
|
|
374
|
+
`;function Cn({component:e,remove:o,disabled:n,tip:a,showConfirm:r,hideBtn:s,onCancel:h}){const{t:c}=f.useContext(ve),[p,x]=f.useState(!1),[g,l]=f.useState(null),b=async k=>{x(!0),await o(k.component,k.removeType),x(!1),l(null)},d=n||p,T=()=>{l({title:`${c("common.delete")} ${e.meta.title||e.meta.name}`,description:(k,C)=>t.jsxs(te,{component:"div",children:[t.jsx(te,{gutterBottom:!0,children:c("blocklet.action.removeComponentDescription")}),t.jsxs(Ss,{name:"removeType",value:k.removeType,onChange:m=>C({...k,removeType:m.target.value}),children:[t.jsx(Mt,{value:"keepData",control:t.jsx(Zn,{}),label:c("blocklet.action.removeComponentKeepData")}),t.jsx(Mt,{value:"complete",control:t.jsx(Zn,{}),label:c("blocklet.action.removeComponentComplete")})]})]}),confirm:c("common.confirm"),cancel:c("common.cancel"),params:{component:e,removeType:"keepData"},onConfirm:b,onCancel:()=>{l(null),h()}})};f.useEffect(()=>{r?T():(x(!1),l(null))},[r]);const S=t.jsx(ji,{size:"small",disabled:d,onClick:()=>T,"data-cy":"delete-component-btn",children:t.jsx(Ct,{disabled:d})}),R=t.jsx(Ce,{title:a||c("common.delete"),children:t.jsx("span",{children:S})});return t.jsxs(t.Fragment,{children:[!s&&R,g&&t.jsx(Ge,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}Cn.propTypes={component:i.object.isRequired,remove:i.func,onCancel:i.func,disabled:i.bool,showConfirm:i.bool,hideBtn:i.bool,tip:i.string};Cn.defaultProps={remove:async()=>{},disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:()=>{},tip:""};const ji=$(Z)`
|
|
375
375
|
&.Mui-disabled {
|
|
376
376
|
opacity: 0.5;
|
|
377
377
|
}
|
|
378
|
-
`;function jn({component:e,onStart:o,onStop:n,disabled:a,tip:r}){const{t:s}=f.useContext(ve),[h,c]=f.useState(!1),[p,x]=f.useState(),g=async()=>{c(!0);try{await o(e)}catch(R){L.error(R.message)}c(!1)},l=async()=>{c(!0);try{await n(e)}catch(R){L.error(R.message)}c(!1)},b=a||h,d=["starting","running","stopping"].includes(e.status),T=d?
|
|
378
|
+
`;function jn({component:e,onStart:o,onStop:n,disabled:a,tip:r}){const{t:s}=f.useContext(ve),[h,c]=f.useState(!1),[p,x]=f.useState(),g=async()=>{c(!0);try{await o(e)}catch(R){L.error(R.message)}c(!1)},l=async()=>{c(!0);try{await n(e)}catch(R){L.error(R.message)}c(!1)},b=a||h,d=["starting","running","stopping"].includes(e.status),T=d?kr:_r,S=t.jsx(vi,{disabled:b,onClick:()=>{var R;d?x({title:`${s("common.stop")} ${(R=e==null?void 0:e.meta)==null?void 0:R.title}`,description:s("blocklet.action.stopComponentDescription"),confirm:s("blocklet.action.confirmStop"),cancel:s("common.cancel"),onConfirm:()=>(x(null),l()),onCancel:()=>x(null)}):g()},"data-cy":`${d?"stop":"start"}-component-btn`,children:t.jsx(T,{disabled:b,fontSize:"small"})});return[t.jsx(Ce,{title:r||s(`common.${d?"stop":"start"}`),children:t.jsx("span",{children:S})},"btn"),p&&t.jsx(Ge,{title:p.title,description:p.description,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel},"connect")]}jn.propTypes={component:i.object.isRequired,onStart:i.func,onStop:i.func,disabled:i.bool,tip:i.string};jn.defaultProps={onStart:async()=>{},onStop:async()=>{},disabled:!1,tip:""};const vi=$(Z)`
|
|
379
379
|
&.Mui-disabled {
|
|
380
380
|
opacity: 0.5;
|
|
381
381
|
}
|
|
382
|
-
`;function vn({sourceInfo:e,blocklet:o}){var r;const{t:n}=f.useContext(ve);let{source:a}=e;return a==="registry"&&(a="Blocklet Store"),t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(fr,{type:"success",children:ws(a)},"source"),e.source==="registry"&&t.jsx(xt,{href:gt(e.deployedFrom,"blocklets",((r=o==null?void 0:o.meta)==null?void 0:r.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:n("blocklet.overview.viewInStore")})]})}vn.propTypes={sourceInfo:i.shape({source:i.string,deployedFrom:i.string}),blocklet:i.object};vn.defaultProps={sourceInfo:{},blocklet:{}};var bn={},bi=Wt;Object.defineProperty(bn,"__esModule",{value:!0});var To=bn.default=void 0,Ri=bi(Gt()),Si=t;To=bn.default=(0,Ri.default)((0,Si.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Et({blocklet:e,checkUpgrade:o,hasPermission:n,...a}){const{api:r}=H(),{t:s}=f.useContext(ve),[h,c]=f.useState(!1),[p,x]=f.useState(""),[g,l]=f.useState(null),[b,d]=f.useState(null);f.useEffect(()=>{l(null),o&&(e.mode,Y.BLOCKLET_MODES.DEVELOPMENT)},[e,o]);const T=()=>{c(!1),d(null)},S=async()=>{c(!0);try{const
|
|
382
|
+
`;function vn({sourceInfo:e,blocklet:o}){var r;const{t:n}=f.useContext(ve);let{source:a}=e;return a==="registry"&&(a="Blocklet Store"),t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(fr,{type:"success",children:ws(a)},"source"),e.source==="registry"&&t.jsx(xt,{href:gt(e.deployedFrom,"blocklets",((r=o==null?void 0:o.meta)==null?void 0:r.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:n("blocklet.overview.viewInStore")})]})}vn.propTypes={sourceInfo:i.shape({source:i.string,deployedFrom:i.string}),blocklet:i.object};vn.defaultProps={sourceInfo:{},blocklet:{}};var bn={},bi=Wt;Object.defineProperty(bn,"__esModule",{value:!0});var To=bn.default=void 0,Ri=bi(Gt()),Si=t;To=bn.default=(0,Ri.default)((0,Si.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Et({blocklet:e,checkUpgrade:o,hasPermission:n,...a}){const{api:r}=H(),{t:s}=f.useContext(ve),[h,c]=f.useState(!1),[p,x]=f.useState(""),[g,l]=f.useState(null),[b,d]=f.useState(null);f.useEffect(()=>{l(null),o&&(e.mode,Y.BLOCKLET_MODES.DEVELOPMENT)},[e,o]);const T=()=>{c(!1),d(null)},S=async()=>{c(!0);try{const k={did:e.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Ke(2e3),await r.upgradeBlocklet({input:k})}catch(k){L.error(`Blocklet upgrade failed: ${ie(k)}`)}finally{c(!1),d(null)}},R={title:`${s("common.upgrade")} ${s("common.blocklet")} ${B.getDisplayName(e)}`,description:s("blocklet.action.upgradeDescription"),confirm:s("blocklet.action.confirmUpgrade"),cancel:s("common.cancel"),onConfirm:S,onCancel:T};return n&&g&&!B.isInProgress(e.status)?t.jsxs(t.Fragment,{children:[t.jsx(Qe,{...a,children:e.meta.version}),t.jsx(Ce,{title:s("common.updateAvailable",{version:g.version}),children:t.jsx(Z,{size:"small",style:{marginLeft:8},disabled:h,onClick:()=>d(R),children:h?t.jsx(ue,{size:16}):t.jsx(To,{style:{fontSize:16,color:"red"}})})}),!!p&&t.jsx(L,{variant:"error",message:p,onClose:()=>x("")}),b&&t.jsx(Ge,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):t.jsx(Qe,{...a,children:e.meta.version})}Et.propTypes={blocklet:i.object.isRequired,checkUpgrade:i.bool,hasPermission:i.bool};Et.defaultProps={checkUpgrade:!1,hasPermission:!1};const wi=yt(Et,"mutate_blocklets"),Ei=yt(Et,"",He);function Ti(e){const{inService:o}=H();return o?t.jsx(Ei,{...e}):t.jsx(wi,{...e})}const Pi=e=>{var o;return!((o=e==null?void 0:e.meta)!=null&&o.group)},ki=(e,o)=>e?[{name:o("common.name"),value:e.displayName},{name:o("common.description"),value:e.description},{name:o("common.version"),value:t.jsx(Qe,{children:e.version})}]:[],_i=e=>{const{source:o,deployedFrom:n,bundleSource:a}=e;if(o)return{source:o,deployedFrom:n};if(!a)return{source:"upload",deployedFrom:n};if(a.url){const r=n||Array.isArray(a.url)?a.url[0]:a.url;return{source:"url",deployedFrom:r,link:r}}if(a.store){const r=n||Array.isArray(a.store)?a.store[0]:a.store;return{source:"registry",deployedFrom:r,link:r}}return{}},Ii=(e,o)=>{const n=e.split("/").slice(1);let a=o,r=0;const s=[];for(;a&&r<n.length;){const h=a.children.find(c=>c.meta.did===n[r]);a=h,r++,h&&s.push(h.meta.title)}return s.join(" / ")};function Rn({blocklet:e,depth:o,componentInfo:n,app:a,onClose:r}){var d,T;const{t:s,locale:h}=f.useContext(ve),{deletingBlocklets:c}=Vt();let{status:p}=e;o===1&&c.includes(e.meta.did)&&(p="deleting");const x=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),g=S=>S.map(R=>R.name===s("common.did")||R.name===s("blocklet.appId")?t.jsx(Nt,{valueComponent:"div",nameWidth:120,name:R.name,nameFormatter:()=>R.name,children:R.value},R.name):t.jsx(Nt,{valueComponent:"div",nameWidth:120,name:R.name,children:R.link?t.jsx(xt,{href:R.link,target:"_blank",className:"page-link",underline:"hover",children:R.value}):R.value},R.name)),l=n?_i(n):{},b=n?[{name:s("common.name"),value:B.getDisplayName(n,!0)},{name:s("common.version"),value:t.jsx(Ti,{blocklet:n,checkUpgrade:!1})},{name:s("common.status"),value:t.jsx(Ro,{isResource:Pi(e),status:p,source:n.source,progress:e.progress})},e.status==="running"?{name:s("blocklet.startedAt"),value:e.startedAt?t.jsx(Ut,{value:e.startedAt,type:"all",locale:h}):"-"}:null,e.status!=="running"?{name:s("blocklet.stoppedAt"),value:e.stoppedAt?t.jsx(Ut,{value:e.stoppedAt,type:"all",locale:h}):"-"}:null,e.installedAt?{name:s("blocklet.installedAt"),value:e.installedAt?t.jsx(Ut,{value:e.installedAt,type:"all",locale:h}):"-"}:null,B.hasStartEngine(e.meta)?{name:s("common.mountPoint"),value:x}:null,n.meta.group?{name:s("common.group"),value:t.jsx(Qe,{type:"success",children:n.meta.group})}:null,{name:s("blocklet.overview.source"),value:t.jsx(vn,{sourceInfo:l,blocklet:e})},{name:s("blocklet.overview.deployedFrom"),value:l.deployedFrom||"-",link:l.link??""},{name:s("common.did"),value:t.jsx(hr,{did:n.meta.did,showQrcode:!0})},{name:s("common.author"),value:n.meta.owner?t.jsx(xs,{owner:n.meta.owner,locale:h}):ys.formatPerson(n.meta.author)},{name:s("common.engine"),value:ki(n.engine,s).map(({name:S,value:R})=>t.jsx(Nt,{style:{marginBottom:4},nameWidth:120,name:S,children:R},S))},(d=e.dependents)!=null&&d.length?{name:s("common.dependents"),value:t.jsx(y,{children:e.dependents.map(S=>t.jsx(y,{children:`${Ii(S.id,a)} ${S.required?`(${s("common.required")})`:""}`},S.id))})}:null,(T=e.meta.resources)!=null&&T.length?{name:s("common.resource"),value:e.meta.resources.join(", ")}:null].filter(Boolean):[];return n?t.jsx(ht,{open:!0,title:s("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{r(null)},children:t.jsx(y,{paddingBottom:1.5,children:g(b)},"dialog-wrapper")},"base-info-dialog"):null}Rn.propTypes={blocklet:i.object.isRequired,depth:i.number,app:i.object,componentInfo:i.object,onClose:i.func.isRequired};Rn.defaultProps={depth:0,app:null,componentInfo:null};$(ho)`
|
|
383
383
|
.BaseBadge-badge {
|
|
384
384
|
top: ${e=>e.top*8||6}px;
|
|
385
385
|
right: ${e=>e.right*8||6}px;
|
|
@@ -401,7 +401,7 @@ import{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,bq as
|
|
|
401
401
|
margin-left: 4px;
|
|
402
402
|
transform: translateY(-1px);
|
|
403
403
|
}
|
|
404
|
-
`;function
|
|
404
|
+
`;function Po({blocklet:e,ancestors:o,mountPoint:n,href:a}){const[r,s]=f.useState(!1),[h,c]=f.useState(!1),[p,x]=f.useState(!1),[g,l]=f.useState(n),{api:b}=H(),d=!o.length,T=d?e.meta.did:o.map(j=>j.meta.did)[0],{t:S}=W(),{confirmApi:R,confirmHolder:k}=gr();f.useEffect(()=>{c(!1),s(!1),x(!1)},[n]);const C=()=>{s(!1),c(!1),l(n)},m=async()=>{x(!0),s(!1);try{const j={rootDid:T,mountPoint:je(g)};d||(j.did=e.meta.did),await b.updateComponentMountPoint({input:j})}catch(j){throw j.message=ie(j),L.error(j.message),j}finally{C()}},u=xr(()=>{R.open({title:S("common.noticeTitle"),content:t.jsxs(y,{sx:{color:"#9397A1","& > li":{listStyle:"disc",ml:1.5}},children:[t.jsx(te,{sx:{mb:1.5},children:S("blocklet.mountPoint.description1")}),t.jsx(te,{component:"li",children:S("blocklet.mountPoint.case1")}),t.jsx(te,{component:"li",children:S("blocklet.mountPoint.case2")}),t.jsx(te,{sx:{mt:1.5},children:S("blocklet.mountPoint.description2")})]}),confirmButtonText:S("common.confirm"),cancelButtonText:S("common.cancel"),async onConfirm(j){await m(),j()},confirmButtonProps:{"data-cy":"edit-mount-point-confirm"}})}),v=j=>{j==null||j.preventDefault(),je(g)!==n?u():c(!1)},w=h?t.jsxs(y,{sx:{ml:1},children:[t.jsx(Z,{size:"medium",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"data-cy":"edit-mount-point-submit",onClick:v,children:t.jsx(y,{component:Q,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),t.jsx(Z,{size:"medium",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onClick:C,children:t.jsx(y,{component:Q,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):t.jsx(Z,{size:"medium",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onClick:()=>c(!0),children:t.jsx(y,{component:Q,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:r?1:0,color:"primary.main",transition:"0.3s opacity"}})});return t.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[k,h?t.jsx("form",{onSubmit:v,children:t.jsx(K,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:j=>l(j.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:n})}):t.jsx(y,{component:"a",target:"_blank",href:a,rel:"noopener noreferrer",title:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:t.jsx(y,{maxWidth:400,sx:{color:"primary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:yr(n)})}),p?t.jsx(ue,{size:20,sx:{ml:1}}):w]},n)}Po.propTypes={mountPoint:i.string.isRequired,href:i.string.isRequired,blocklet:i.object.isRequired,ancestors:i.array.isRequired};const Di=e=>{var o;return!((o=e==null?void 0:e.meta)!=null&&o.group)},io=(e,o)=>{const n=e.split("/").slice(1);let a=o,r=0;const s=[];for(;a&&r<n.length;){const h=a.children.find(c=>c.meta.did===n[r]);a=h,r++,h&&s.push(h.meta.title)}return s.join(" / ")};function mt({blocklet:e,ancestors:o,depth:n,onRemove:a,onStart:r,onStop:s,onRestart:h,getComponentUrl:c,app:p}){var Ee,_,fe;const{t:x}=f.useContext(ve),[g,l]=f.useState(),[b,d]=f.useState(!1),[T,S]=f.useState(!1),[R,k]=f.useState(null),{info:C}=H(),[m,u]=f.useState(!1),[v,w]=f.useState(!1),{deletingBlocklets:j}=Vt();let{status:N}=e;n===1&&j.includes(e.meta.did)&&(N="deleting");const M=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),X=c(M),I=B.isInProgress(p.status),ne=B.isInProgress(e.status);let me="";if(I||ne||n===1&&j.includes(e.meta.did))me=x("blocklet.component.tip.stopBlocklet");else if((Ee=e.dependents)!=null&&Ee.length){const G=e.dependents.filter(he=>he.required);if(G.length){const he=G.map(A=>io(A.id,p));me=x("blocklet.component.tip.requiredBy",{name:he.join(", ")})}}const J=async(...G)=>{S(!0);try{await a(...G)}catch{}S(!1),d(!1)},{usingDocker:Pe,usingIsolation:we}=f.useMemo(()=>{var le,_e;if(!e.meta.group||e.meta.group==="static")return{usingDocker:!1,usingIsolation:!1};const G=!!(C!=null&&C.enableDocker)||((le=window.blocklet)==null?void 0:le.enableDocker),he=[...p.configs,...e.configs].find(E=>E.key==="SKIP_DOCKER"&&E.value),A=[...p.configs,...e.configs].find(E=>E.key==="USE_DOCKER"&&E.value),ke=[...p.configs,...e.configs].find(E=>E.key==="SKIP_DOCKER_NETWORK"&&E.value);return{usingDocker:G?!he:!!A,usingIsolation:G&&!ke&&((C==null?void 0:C.enableDockerNetwork)||((_e=window.blocklet)==null?void 0:_e.enableDockerNetwork))}},[e.configs,C==null?void 0:C.enableDocker,C==null?void 0:C.enableDockerNetwork,p.configs,e.meta.group]);return t.jsxs(t.Fragment,{children:[t.jsxs(Sn,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[t.jsxs(y,{pl:2,width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[t.jsx(Cr,{blocklet:e,ancestors:o}),t.jsxs(y,{ml:"16px",sx:{minWidth:0},children:[t.jsxs(y,{className:"component-header",onClick:()=>l(e),children:[t.jsx(y,{className:"component-name",children:B.getDisplayName(e,!0)}),t.jsx(y,{className:"component-version",children:(_=e==null?void 0:e.meta)==null?void 0:_.version})]}),t.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[N!=="unknown"&&t.jsx(Ro,{style:{marginLeft:4},status:N,source:e.source,progress:e.progress}),t.jsx(Cs,{style:{marginLeft:4},mode:e.mode||""}),e.mode!=="development"&&Pe&&t.jsx(Ce,{title:x("blocklet.usingDocker"),children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:yo})})}),e.mode!=="development"&&we&&t.jsx(Ce,{title:x("blocklet.usingIsolation"),children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:"streamline:network"})})}),!!((fe=e.dependents)!=null&&fe.length)&&t.jsx(Ce,{title:[`${x("common.dependents")}: `,e.dependents.map(G=>t.jsx(y,{pl:1,children:`${io(G.id,p)} ${G.required?`(${x("common.required")})`:""}`},G.id))],children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:"octicon:package-dependents-16"})})})]})]})]},e),po.hasMountPoint(e.meta)&&t.jsx(Po,{blocklet:e,ancestors:o,mountPoint:M,href:X},M),t.jsx("div",{style:{flex:1}}),t.jsxs(y,{display:"flex",alignItems:"center",children:[B.hasStartEngine(e.meta)&&t.jsx(Ce,{title:x("common.visit"),children:t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:X,rel:"noopener noreferrer",children:t.jsx(Z,{size:"small",children:t.jsx(bo,{})})})}),t.jsx(jn,{blocklet:p,component:e,onStart:r,onStop:s,disabled:!["starting","stopping"].includes(p.status)&&B.isInProgress(p.status)}),t.jsx(Z,{onClick:()=>w(!0),disabled:I||ne,children:t.jsx(Qt,{fontSize:"small"})}),t.jsx(qt,{color:"error",badgeContent:"",variant:"dot",invisible:!B.getComponentMissingConfigs(e,o[0]).length,children:t.jsx(So,{"data-cy":"component-actions",actions:[B.hasStartEngine(e.meta)||Di(e)?{icon:t.jsx(jr,{}),text:x("common.detail"),onClick:()=>{l(e)}}:null,{icon:t.jsx(Ir,{}),text:x("common.restart"),onClick:()=>{k({title:`${x("common.restart")} ${e.meta.title}`,description:x("blocklet.action.restartDescription"),confirm:x("blocklet.action.confirmRestart"),cancel:x("common.cancel"),onConfirm:async()=>{S(!0),await h(e),S(!1),k(null)},onCancel:()=>k(null)})},disabled:T||I||ne||e.status!=="running"},{icon:t.jsx(Ct,{}),text:x("common.delete"),onClick:()=>{d(!0)},disabled:I||ne||!!me,tip:me},{separator:!0},{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{u(!0)},text:t.jsx(qt,{color:"error",badgeContent:"",variant:"dot",invisible:!B.getComponentMissingConfigs(e,o[0]).length,children:t.jsx(y,{sx:{width:"100%"},children:x("common.environments")})}),disabled:I||ne}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),t.jsx(Ze,{},"line"),t.jsx(Rn,{componentInfo:g,onClose:l,blocklet:e,app:p,depth:n}),t.jsx(Cn,{blocklet:p,component:e,remove:J,onCancel:()=>d(!1),hideBtn:!0,showConfirm:b},"delete-component"),R&&t.jsx(Ge,{title:R.title,description:R.description,confirm:R.confirm,cancel:R.cancel,params:R.params,onConfirm:R.onConfirm,onCancel:R.onCancel},"confirm-setting"),m&&t.jsx(jt,{open:!0,hiddenChildren:!0,onClose:()=>u(!1),blocklet:e,ancestors:o}),v&&t.jsx(wt,{open:!0,onClose:()=>w(!1),blocklet:e,ancestors:o})]})}mt.propTypes={blocklet:i.object.isRequired,ancestors:i.array,depth:i.number,onRemove:i.func,onStart:i.func,onStop:i.func,onRestart:i.func,getComponentUrl:i.func,app:i.object};mt.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const qt=$(ho)`
|
|
405
405
|
.BaseBadge-badge {
|
|
406
406
|
top: ${e=>e.top*8||6}px;
|
|
407
407
|
right: ${e=>e.right*8||6}px;
|
|
@@ -480,7 +480,7 @@ import{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,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),[
|
|
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:F})=>{const Ie=V.find(Re=>Re.id===be);if(Ie){const Re=F.slice(1).concat(ee).map(Le=>Le.meta.title||Le.meta.name).join(" / "),We=(F[1]||ee).meta.did;ce.push({groupId:We,name:Re,version:ee.meta.version,newVersion:Ie.meta.version})}});const z={};ce.forEach(ee=>{z[ee.groupId]?ee.disabled=!0:z[ee.groupId]=!0}),T({params:{updateId:E},list:ce,checks:z,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))}},G=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(z=>{const ee=Object.entries(z.checks).reduce((F,[Ie,Re])=>(F[Ie]=V===Ie||V==="all"?ce:Re,F),{}),be=Object.values(ee).includes(!0);return{...z,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:G,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:G,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(zn,{open:!0,fullWidth:!0,children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(Fn,{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(zn,{open:!0,fullWidth:!0,onClose:()=>R(!1),children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(Fn,{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{bV as Bo,j as t,f5 as Oo,hL as $o,l2 as Mo,aP as Gt,aQ as Wt,m as W,bq as
|
|
|
518
518
|
width: 100%;
|
|
519
519
|
justify-content: space-between;
|
|
520
520
|
}
|
|
521
|
-
`;function
|
|
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:Ft(n,o)});return t.jsx(En,{blocklet:n,getComponentUrl:r,...e})}ko.propTypes={};ko.defaultProps={};export{ko as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,e,j as t,n}from"./index-
|
|
1
|
+
import{r as o,e,j as t,n}from"./index-CxB_JDvy.js";import{R as r}from"./index-BI-wXMup.js";function i(){const{t:s}=o.useContext(e);return t.jsx(a,{style:{paddingTop:"25vh"},children:t.jsx(r,{status:"404",description:s("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const a=n.main``;export{i as default};
|