@abtnode/blocklet-services 1.16.20 → 1.16.21-beta-edf184e1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/emails/components/footer.js +11 -5
- package/api/emails/pages/notification.js +2 -2
- package/api/libs/email.js +5 -3
- package/api/socket/channel/did.js +14 -6
- package/dist/assets/{Add-35c1e7a3.js → Add-dbdcac96.js} +1 -1
- package/dist/assets/{Alert-009b0c1c.js → Alert-850c6ed5.js} +1 -1
- package/dist/assets/{ArrowDropDown-29b43f8b.js → ArrowDropDown-b5cd6602.js} +1 -1
- package/dist/assets/Autocomplete-0c305d3c.js +1 -0
- package/dist/assets/{Avatar-83c4ee8f.js → Avatar-a3ed8c85.js} +1 -1
- package/dist/assets/{ButtonGroup-f103599e.js → ButtonGroup-8965d696.js} +1 -1
- package/dist/assets/{CardContent-f369b9ba.js → CardContent-07c410e6.js} +1 -1
- package/dist/assets/{CheckCircle-4e2c4fac.js → CheckCircle-1625a049.js} +1 -1
- package/dist/assets/{Checkbox-1d5dfa7c.js → Checkbox-93b1ae12.js} +1 -1
- package/dist/assets/{ChevronRight-3edcf2ad.js → ChevronRight-4cba63fe.js} +1 -1
- package/dist/assets/{DeleteOutline-715a5bfd.js → DeleteOutline-99b46f8b.js} +1 -1
- package/dist/assets/{DialogContentText-0a4a52ae.js → DialogContentText-413bb94f.js} +1 -1
- package/dist/assets/{Done-fccc6f61.js → Done-d9c0a45c.js} +1 -1
- package/dist/assets/{Download-b8c981b2.js → Download-c45f9492.js} +1 -1
- package/dist/assets/{Edit-5432504f.js → Edit-88f5d9ce.js} +1 -1
- package/dist/assets/{EditIcon-867288b0.js → EditIcon-51f0c899.js} +1 -1
- package/dist/assets/{ExpandMore-566f7011.js → ExpandMore-3020171f.js} +1 -1
- package/dist/assets/{FilterList-31ac6003.js → FilterList-dbb51894.js} +1 -1
- package/dist/assets/{FormControl-02338c4d.js → FormControl-77e38e88.js} +1 -1
- package/dist/assets/{FormControlLabel-00c8c0c3.js → FormControlLabel-6c1055c3.js} +1 -1
- package/dist/assets/{FormGroup-ed1feffd.js → FormGroup-03a8abc6.js} +1 -1
- package/dist/assets/{Google-e43467e7.js → Google-b1f76688.js} +1 -1
- package/dist/assets/{Grid-407a7664.js → Grid-5f9be0bf.js} +1 -1
- package/dist/assets/{Hidden-0998adb7.js → Hidden-1d1d2e86.js} +1 -1
- package/dist/assets/{Icon-ebf30f9d.js → Icon-2bb6c88f.js} +1 -1
- package/dist/assets/{InfoOutlined-8723e21f.js → InfoOutlined-544fc885.js} +1 -1
- package/dist/assets/{InputAdornment-2f5461d2.js → InputAdornment-53f09810.js} +1 -1
- package/dist/assets/{InputLabel-450f8388.js → InputLabel-710219b5.js} +1 -1
- package/dist/assets/{LastPage-36b480d0.js → LastPage-f494bc19.js} +1 -1
- package/dist/assets/{Launch-83420006.js → Launch-55624d0f.js} +1 -1
- package/dist/assets/{LaunchOutlined-64a7c2a1.js → LaunchOutlined-c4139939.js} +1 -1
- package/dist/assets/ListItem-72014ca6.js +1 -0
- package/dist/assets/{LockIcon-89e8321d.js → LockIcon-6c5a73df.js} +1 -1
- package/dist/assets/{Loop-ff30ff72.js → Loop-533a11b4.js} +1 -1
- package/dist/assets/{MoreVert-def77f12.js → MoreVert-7812832e.js} +2 -2
- package/dist/assets/{OpenInNew-04f4aa46.js → OpenInNew-2ec888fc.js} +1 -1
- package/dist/assets/Pagination-cf21f3a8.js +2 -0
- package/dist/assets/{PlayArrow-a5453921.js → PlayArrow-f029bdd7.js} +1 -1
- package/dist/assets/{RadioGroup-94cff5e2.js → RadioGroup-dc385527.js} +1 -1
- package/dist/assets/{Search-e672d13d.js → Search-70432ee8.js} +1 -1
- package/dist/assets/{Select-a57add80.js → Select-a3cf4deb.js} +2 -2
- package/dist/assets/{ServerLogo-ce67f704.js → ServerLogo-fabaf568.js} +1 -1
- package/dist/assets/{Slider-2fc0b3c7.js → Slider-8cdedbce.js} +1 -1
- package/dist/assets/{Stepper-c6967750.js → Stepper-3a597824.js} +1 -1
- package/dist/assets/{Switch-f3833b60.js → Switch-daa0812f.js} +1 -1
- package/dist/assets/{TableRow-83a923bc.js → TableRow-722353c4.js} +2 -2
- package/dist/assets/{TextField-e4b28fa4.js → TextField-fe08d197.js} +1 -1
- package/dist/assets/{Toolbar-0317e6c5.js → Toolbar-f8956d67.js} +1 -1
- package/dist/assets/{access-control-bd916c40.js → access-control-638317e3.js} +1 -1
- package/dist/assets/{actions-d5ebb37b.js → actions-3a323c3a.js} +1 -1
- package/dist/assets/{add-component-core-4fff278d.js → add-component-core-f91defa4.js} +54 -54
- package/dist/assets/add-resource-65208122.js +1 -0
- package/dist/assets/{addon-3b37ad08.js → addon-5a52f3d8.js} +1 -1
- package/dist/assets/{analytics-92d48424.js → analytics-3bddb510.js} +6 -6
- package/dist/assets/api-dcff568c.js +1 -0
- package/dist/assets/{audit-logs-59de4025.js → audit-logs-77897bc1.js} +26 -27
- package/dist/assets/{button-1b5fd475.js → button-395bdffd.js} +1 -1
- package/dist/assets/{click-to-copy-2403c2eb.js → click-to-copy-d3024fee.js} +1 -1
- package/dist/assets/{complete-fa68395a.js → complete-deb1d2a3.js} +2 -2
- package/dist/assets/{component-fbb33599.js → component-63f6bb0a.js} +1 -1
- package/dist/assets/{config-278d0f4b.js → config-0940c67a.js} +2 -2
- package/dist/assets/{config-e982ed4f.js → config-29b974d4.js} +1 -1
- package/dist/assets/config-navigation-c7ec2a55.js +259 -0
- package/dist/assets/confirm-2682d0fc.js +7 -0
- package/dist/assets/{confirm-7ba96127.js → confirm-fef96ddf.js} +1 -1
- package/dist/assets/{connect-d4789c01.js → connect-51e2dc72.js} +1 -1
- package/dist/assets/{connect-2b0b92a5.js → connect-a02af466.js} +1 -1
- package/dist/assets/{content-layout-b52953f5.js → content-layout-9b8df0f2.js} +1 -1
- package/dist/assets/dashboard-4a3964de.js +146 -0
- package/dist/assets/{did-address-7fb4ba30.js → did-address-868daf20.js} +1 -1
- package/dist/assets/{did-utils-099ad896.js → did-utils-8cc43e95.js} +1 -1
- package/dist/assets/domain-9ea669cb.js +9 -0
- package/dist/assets/domain-list-2ebc159e.js +12 -0
- package/dist/assets/{exchange-passport-37484686.js → exchange-passport-c76fd004.js} +1 -1
- package/dist/assets/{fallback-79303f3f.js → fallback-f2622fec.js} +2 -2
- package/dist/assets/{format-error-b1bc93cf.js → format-error-1642e1d0.js} +1 -1
- package/dist/assets/{fuel-7ec1fda0.js → fuel-4c6a2fbe.js} +1 -1
- package/dist/assets/{home-a1151635.js → home-cd95e3af.js} +1 -1
- package/dist/assets/{iframe-83488b29.js → iframe-8ba3ad2d.js} +1 -1
- package/dist/assets/{index-00c00746.js → index-0a9e8751.js} +11 -11
- package/dist/assets/{index-69712afe.js → index-1b28a8cb.js} +2 -2
- package/dist/assets/{index-42cd7110.js → index-1b818f05.js} +2 -2
- package/dist/assets/{index-ba27e98f.js → index-1c8fb01b.js} +1 -1
- package/dist/assets/index-298c12a2.js +262 -0
- package/dist/assets/{index-f76cd15b.js → index-378aa16e.js} +1 -1
- package/dist/assets/{index-8937c3ad.js → index-3fb520ed.js} +1 -1
- package/dist/assets/{index-21bed9e6.js → index-434f3a23.js} +1 -1
- package/dist/assets/{index-26b1e0dd.js → index-48d4efa9.js} +1 -1
- package/dist/assets/{index-485b5b11.js → index-53d55e82.js} +150 -150
- package/dist/assets/{index-7f9d0b5f.js → index-6366c361.js} +2 -2
- package/dist/assets/index-657787c9.js +54 -0
- package/dist/assets/{index-3276c24f.js → index-687f9742.js} +1 -1
- package/dist/assets/{index-cef4db4f.js → index-6bd14f76.js} +1 -1
- package/dist/assets/{index-e0cd5d47.js → index-780c16c8.js} +2 -2
- package/dist/assets/{index-c550be87.js → index-7dfff741.js} +1 -1
- package/dist/assets/{index-1166f20f.js → index-895140d4.js} +1 -1
- package/dist/assets/{index-e9c8b7d0.js → index-92c6d1d4.js} +5 -5
- package/dist/assets/{index-73755685.js → index-9ad53f5f.js} +1 -1
- package/dist/assets/{index-24b06982.js → index-a5597e66.js} +2 -2
- package/dist/assets/{index-0f09a726.js → index-a7294263.js} +1 -1
- package/dist/assets/{index-64c3fd59.js → index-b0167500.js} +1 -1
- package/dist/assets/{index-a11b4e31.js → index-c7baa6f9.js} +1 -1
- package/dist/assets/{index-5157427d.js → index-c969afd7.js} +1 -1
- package/dist/assets/{index-68070209.js → index-d576ddff.js} +9 -9
- package/dist/assets/{index-435a098e.js → index-d71a5fed.js} +1 -1
- package/dist/assets/{index-63862c54.js → index-e8fabd51.js} +1 -1
- package/dist/assets/{index-2778f2d8.js → index-f92a64b0.js} +1 -1
- package/dist/assets/{index.es-70938426.js → index.es-dd58e566.js} +3 -3
- package/dist/assets/{index.esm-8304e682.js → index.esm-d1edc7ef.js} +1 -1
- package/dist/assets/{invite-f4b9c3aa.js → invite-2dce9db0.js} +1 -1
- package/dist/assets/{issue-passport-ad6eb00f.js → issue-passport-d292952e.js} +1 -1
- package/dist/assets/{launch-result-message-ab912670.js → launch-result-message-99b95037.js} +1 -1
- package/dist/assets/{layout-cb81d145.js → layout-6e6d83db.js} +1 -1
- package/dist/assets/{list-header-6db961af.js → list-header-dbcc3aa5.js} +1 -1
- package/dist/assets/localization-ed77805e.js +1 -0
- package/dist/assets/{log-773fc78b.js → log-5d897ee6.js} +7 -7
- package/dist/assets/{login-150d3817.js → login-5918b188.js} +1 -1
- package/dist/assets/{logo-uploader-32e9ef5a.js → logo-uploader-2fc06d0d.js} +2 -2
- package/dist/assets/{lost-passport-71c0e73c.js → lost-passport-cd33a794.js} +2 -2
- package/dist/assets/{lottie-e6775302.js → lottie-3067a318.js} +1 -1
- package/dist/assets/makeStyles-58ab7ac6.js +14 -0
- package/dist/assets/{memoize-one.esm-034844b1.js → memoize-one.esm-42dfe724.js} +1 -1
- package/dist/assets/{nav-menu-b0f4cb87.js → nav-menu-2414a713.js} +4 -4
- package/dist/assets/notifications-c23feea3.js +62 -0
- package/dist/assets/overview-dcefb261.js +12 -0
- package/dist/assets/{page-header-9bc17488.js → page-header-65d7734f.js} +1 -1
- package/dist/assets/permission-956ee928.js +7 -0
- package/dist/assets/{preferences-5b0c0d33.js → preferences-9f1610b9.js} +1 -1
- package/dist/assets/publish-resource-38d5466f.js +1 -0
- package/dist/assets/{react-47aaa975.js → react-fb9eff86.js} +2 -2
- package/dist/assets/{redux-87617816.js → redux-ba45a372.js} +1 -1
- package/dist/assets/{selector-e318351a.js → selector-be6aba8d.js} +1 -1
- package/dist/assets/session-8a8645ce.js +1 -0
- package/dist/assets/setup-c2ed2ae8.js +13 -0
- package/dist/assets/{slicedToArray-842f424b.js → slicedToArray-f24592cf.js} +2 -2
- package/dist/assets/{spaces-99912d52.js → spaces-d6a3929c.js} +1 -1
- package/dist/assets/{start-d931236c.js → start-df72b89b.js} +1 -1
- package/dist/assets/step-actions-739b43a4.js +31 -0
- package/dist/assets/{studio-431842c7.js → studio-9d0ed995.js} +1 -1
- package/dist/assets/{switch-control-336ce239.js → switch-control-16f6e60a.js} +1 -1
- package/dist/assets/toPropertyKey-f41ee07b.js +1 -0
- package/dist/assets/{transfer-154a4ff9.js → transfer-99249ba2.js} +1 -1
- package/dist/assets/uniqBy-30d716d5.js +1 -0
- package/dist/assets/{unsubscribe-5ae656ed.js → unsubscribe-01a58d73.js} +1 -1
- package/dist/assets/{use-blocklet-info-for-connect-did-spaces-120795c1.js → use-blocklet-info-for-connect-did-spaces-b2cbc055.js} +1 -1
- package/dist/assets/useAsync-80128455.js +1 -0
- package/dist/assets/{useFormControl-5698ec3f.js → useFormControl-df015b19.js} +1 -1
- package/dist/assets/{useSetState-d402986d.js → useSetState-840de1df.js} +1 -1
- package/dist/assets/{user-177d7e56.js → user-086a4174.js} +2 -2
- package/dist/assets/{util-46df2e3d.js → util-74fc13da.js} +1 -1
- package/dist/assets/{wallet-hidden-topbar-379a7028.js → wallet-hidden-topbar-1d0c7c1f.js} +2 -2
- package/dist/assets/wrap-locale-525fe909.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +18 -18
- package/dist/assets/ListItem-23dd1c08.js +0 -1
- package/dist/assets/add-resource-47de62cd.js +0 -1
- package/dist/assets/api-29512a1d.js +0 -1
- package/dist/assets/config-navigation-e6e31f42.js +0 -259
- package/dist/assets/confirm-890b0518.js +0 -7
- package/dist/assets/dashboard-84abf890.js +0 -83
- package/dist/assets/domain-af22b5d6.js +0 -8
- package/dist/assets/domain-list-8af6e6f9.js +0 -12
- package/dist/assets/index-3d03d750.js +0 -54
- package/dist/assets/index-6426097d.js +0 -255
- package/dist/assets/jss-plugin-props-sort.esm-bfc9900a.js +0 -14
- package/dist/assets/localization-5e5ec62d.js +0 -1
- package/dist/assets/overview-58d5f9b3.js +0 -12
- package/dist/assets/permission-c0184b81.js +0 -1
- package/dist/assets/publish-resource-f9b23ca2.js +0 -1
- package/dist/assets/session-d6a9c813.js +0 -1
- package/dist/assets/setup-0a94725a.js +0 -13
- package/dist/assets/step-actions-34516285.js +0 -31
- package/dist/assets/toPropertyKey-148bb9ef.js +0 -1
- package/dist/assets/uniqBy-33f8a43d.js +0 -1
- package/dist/assets/useAsync-173ed2b5.js +0 -1
- package/dist/assets/useAsyncRetry-692f444b.js +0 -7
- package/dist/assets/useLocalStorage-0397501d.js +0 -1
- package/dist/assets/wrap-locale-7964d367.js +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{H as O,I as B,j as e,cv as Me,cB as Ne,P as o,cC as be,u as w,r as v,a7 as F,a$ as ve,X as he,a as z,S as N,n as J,cD as Oe,aW as Be,cE as We,cF as He,cG as Ue,cH as Ve,cI as Je,cJ as Ke,cK as De,B as h,O as Ce,bp as W,T as A,cL as Ge,c as Qe,a0 as Xe,G as L,x as Ye,bW as Ze,b8 as Z,bJ as xe,cj as Se,b5 as Te,bn as Ae,c7 as we,bH as et,cM as ge,cN as tt,y as nt,br as st,bC as it,cO as ot,cP as rt,a_ as at,cQ as lt,bI as ct,av as dt}from"./index-53d55e82.js";import{d as mt}from"./Add-dbdcac96.js";import{d as ut}from"./ExpandMore-3020171f.js";import{d as pt}from"./LockIcon-6c5a73df.js";import{W as ft}from"./did-address-868daf20.js";import{_ as ht,D as je,w as Ie}from"./permission-956ee928.js";import{A as xt}from"./index-780c16c8.js";import{C as ee,L as gt,a as jt}from"./confirm-2682d0fc.js";import{_ as te,d as Re}from"./useSetState-840de1df.js";import{d as yt}from"./InfoOutlined-544fc885.js";import{d as bt}from"./OpenInNew-2ec888fc.js";import"./api-dcff568c.js";import{I as vt}from"./index-e8fabd51.js";import{p as Pe}from"./util-74fc13da.js";import{T as Dt}from"./TextField-fe08d197.js";import{A as Ct}from"./actions-3a323c3a.js";import{C as _e}from"./CardContent-07c410e6.js";import{A as St}from"./Alert-850c6ed5.js";var ne={},Tt=B;Object.defineProperty(ne,"__esModule",{value:!0});var K=ne.default=void 0,At=Tt(O()),wt=e,It=(0,At.default)((0,wt.jsx)("path",{d:"M12.16 3h-.32L9.21 8.25h5.58zm4.3 5.25h5.16L19 3h-5.16zm4.92 1.5h-8.63V20.1zM11.25 20.1V9.75H2.62zM7.54 8.25 10.16 3H5L2.38 8.25z"}),"Diamond");K=ne.default=It;var se={},Rt=B;Object.defineProperty(se,"__esModule",{value:!0});var ke=se.default=void 0,Pt=Rt(O()),_t=e,kt=(0,Pt.default)((0,_t.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");ke=se.default=kt;class Et{constructor(t,n,i){this.name=t,this.prefix=n,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class $t{constructor(t,n,i){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Ee(this,t)}}class qt{constructor(t){this.decoders=t}or(t){return Ee(this,t)}decode(t){const n=t[0],i=this.decoders[n];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ee=(s,t)=>new qt({...s.decoders||{[s.prefix]:s},...t.decoders||{[t.prefix]:t}});class zt{constructor(t,n,i,a){this.name=t,this.prefix=n,this.baseEncode=i,this.baseDecode=a,this.encoder=new Et(t,n,i),this.decoder=new $t(t,n,a)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const Ft=({name:s,prefix:t,encode:n,decode:i})=>new zt(s,t,n,i),Lt=(s,t,n,i)=>{const a={};for(let p=0;p<t.length;++p)a[t[p]]=p;let r=s.length;for(;s[r-1]==="=";)--r;const l=new Uint8Array(r*n/8|0);let c=0,m=0,u=0;for(let p=0;p<r;++p){const j=a[s[p]];if(j===void 0)throw new SyntaxError(`Non-${i} character`);m=m<<n|j,c+=n,c>=8&&(c-=8,l[u++]=255&m>>c)}if(c>=n||255&m<<8-c)throw new SyntaxError("Unexpected end of data");return l},Mt=(s,t,n)=>{const i=t[t.length-1]==="=",a=(1<<n)-1;let r="",l=0,c=0;for(let m=0;m<s.length;++m)for(c=c<<8|s[m],l+=8;l>n;)l-=n,r+=t[a&c>>l];if(l&&(r+=t[a&c<<n-l]),i)for(;r.length*n&7;)r+="=";return r},$=({name:s,prefix:t,bitsPerChar:n,alphabet:i})=>Ft({prefix:t,name:s,encode(a){return Mt(a,i,n)},decode(a){return Lt(a,i,n,s)}}),Nt=$({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ot=$({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Bt=$({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wt=$({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ht=$({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ut=$({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vt=$({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Jt=$({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Kt=$({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Gt=Object.freeze(Object.defineProperty({__proto__:null,base32:Nt,base32hex:Ht,base32hexpad:Vt,base32hexpadupper:Jt,base32hexupper:Ut,base32pad:Bt,base32padupper:Wt,base32upper:Ot,base32z:Kt},Symbol.toStringTag,{value:"Module"})),Qt=Me(Gt),{toBuffer:Xt,toAddress:Yt}=Ne,{base32:Zt}=Qt,en=s=>{if(!s)return s;const t=Xt(Yt(s));return Zt.encode(t)};var tn={encode:en};const nn=s=>["waiting","creating","renewaling"].includes(s);function ie(s){var E,I;const{t}=w(),[n,i]=v.useState(!1),{inService:a}=F(),[r,l]=v.useState(null),{siteId:c,domain:m,onAdd:u,children:p,did:j}=s,[g,T]=v.useState(!1),{api:R,ws:{useSubscription:y}}=F(),{mode:D,actions:{refreshDomainStatus:C}}=ve(),x=ht(async()=>{const{cert:f}=await R.findCertificateByDomain({input:{domain:m,did:j}});return f}),b=(f,P)=>{f.domain===m&&(T(!1),i(!1),a&&D!=="setup"&&(P==="success"?J.success(t("setup.domain.genCertSuccess",{domain:f.domain})):P==="error"&&J.error(t("setup.domain.genCertFailed",{domain:f.domain,message:f.message}))))};if(v.useEffect(()=>{var f;x.loading||T(nn((f=x.value)==null?void 0:f.status))},[x.loading,(E=x.value)==null?void 0:E.status]),y(he.BlockletEvents.certError,f=>b(f,"error")),y(he.BlockletEvents.certIssued,f=>{x.retry(),C(f.domain),b(f,"success")}),x.loading||((I=x.value)==null?void 0:I.status)==="normal")return"";const _=()=>{i(!1),l(null)},d=async()=>{i(!0);try{await R.issueLetsEncryptCert({input:{siteId:c,domain:m,did:j,inBlockletSetup:D==="setup"}}),u(),T(!0)}catch(f){console.error(f),T(!1)}finally{i(!1),l(null)}},S={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(xt,{type:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:d,onCancel:_},k=f=>{f.stopPropagation(),l(S)};return e.jsxs(e.Fragment,{children:[g?e.jsx(z,{title:t("router.cert.issuing"),children:e.jsx(N,{size:12})}):p({loading:n,open:k}),r&&e.jsx(ee,{color:"primary",title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}ie.propTypes={domain:o.string.isRequired,did:o.string.isRequired,siteId:o.string.isRequired,onAdd:o.func,children:o.any};ie.defaultProps={onAdd:()=>{},children:null};function oe(s){const{domain:t,domainStatus:n,...i}=s;return!be(t)||n!=null&&n.isHttps?"":e.jsx(ie,{domain:t,...i})}oe.propTypes={domain:o.string.isRequired,domainStatus:o.shape({isHttps:o.bool}).isRequired,did:o.string.isRequired,onAdd:o.func,children:o.any};oe.defaultProps={onAdd:()=>{},children:null};var re={},sn=B;Object.defineProperty(re,"__esModule",{value:!0});var $e=re.default=void 0,on=sn(O()),rn=e,an=(0,on.default)((0,rn.jsx)("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17 17 20.41zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5 7.5 8z"}),"CallMerge");$e=re.default=an;var ln=Oe;function cn(s,t){for(var n=-1,i=s.length;++n<i&&ln(t,s[n],0)>-1;);return n}var dn=cn,mn=We,un=He,pn=Ue,fn=Ve,hn=dn,ye=Je,xn=Ke;function gn(s,t,n){if(s=xn(s),s&&(n||t===void 0))return un(s);if(!s||!(t=mn(t)))return s;var i=ye(s),a=ye(t),r=hn(i,a),l=fn(i,a)+1;return pn(i,r,l).join("")}var jn=gn;const qe=Be(jn),ze=v.createContext({}),{Provider:yn,Consumer:Vn}=ze;function bn({children:s}){const[t,n]=te({domain:"",error:null}),{locale:i,t:a}=w(),{api:r}=F(),l={error:t.error,domain:t.domain,setError:c=>{n({error:c})},setDomain:c=>{const m=qe(c),u=De(m,i);n({domain:m,error:u})},validateDomain:async c=>!t.error&&(await r.isDidDomain({input:{domain:c}})).value===!0?(n({error:a("router.domainAlias.add.isDidDomainError")}),!1):!0};return e.jsx(yn,{value:{value:l},children:s})}function Fe(){const{value:s}=v.useContext(ze);return s}function ae({domain:s,resolvedTarget:t,...n}){const{t:i,locale:a}=w();return e.jsxs(h,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...n,children:[e.jsxs(h,{display:"flex",children:[i("router.domain.setup.tipStart"),s&&e.jsx(h,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:s}),i("router.domain.setup.tipEnd"),":"]}),e.jsxs(h,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(G,{label:i("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(G,{label:i("router.domain.setup.recordValue"),value:t,locale:a})]})]})}ae.propTypes={domain:o.string,resolvedTarget:o.string.isRequired};ae.defaultProps={domain:""};function G({locale:s,label:t,value:n}){const i=Ce(r=>r.breakpoints.down("md")),a=W();return e.jsx(vt,{name:t,nameWidth:120,children:e.jsxs(h,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(A,{component:"span",color:"primary.main",overflow:"auto",sx:i?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:n}),e.jsx(Ge,{content:n,locale:s,style:{marginLeft:"4px",color:a.palette.text.secondary}})]})})}G.propTypes={locale:o.string.isRequired,label:o.string.isRequired,value:o.string.isRequired};function le({siteId:s,teamDid:t,cnameDomain:n,defaultCustomDomain:i,onInputDomain:a,appId:r,appPk:l,onSuccess:c,disabled:m,autoFocus:u,inBlockletSetup:p,...j}){const{t:g,locale:T}=w(),{api:R,info:y}=F(),D=Fe(),C=W(),[x,b]=te({domain:i,error:null,type:y!=null&&y.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1});let _="";y.nftDomainUrl&&(_=Qe(y.nftDomainUrl,"/api"));const d=async({domain:I,nftDid:f,chainHost:P})=>{try{const q=Pe(I);await R.addDomainAlias({input:{id:s,type:"nft-domain",domainAlias:q,nftDid:f,chainHost:P,teamDid:t,inBlockletSetup:p}}),await Z(2e3),b({confirmSetting:null,showNFTDomainAuth:!1}),c({domain:q,type:x.type,nftDid:f,chainHost:P})}finally{b({openAuthNFTDomain:!1})}},S=x.error||D.error,k={inputDomain:{name:g("router.domainAlias.inputDomain"),component:e.jsxs(e.Fragment,{children:[e.jsx(Dt,{label:g("router.domainAlias.add.domainDescription"),helperText:S||g("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:m,value:x.domain,size:"small",variant:"outlined",error:!!S,onChange:I=>{var q;const f=qe((q=I.target)==null?void 0:q.value);D.setDomain(f);const P=De(f,T);b({domain:f,error:P}),a({domain:f,error:P})},autoFocus:u,onBlur:()=>{D.domain||(b({error:null}),D.setError(null))}}),e.jsxs(h,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",marginTop:"8px",lineHeight:1,color:C.palette.primary.main},onClick:()=>b({showDnsTip:!x.showDnsTip}),children:[e.jsx(yt,{fontSize:"1em"}),g("router.domainAlias.showTipHint")]}),x.showDnsTip&&e.jsx(ae,{domain:x.domain,resolvedTarget:n,style:{marginTop:"4px"}})]})}};y!=null&&y.nftDomainUrl&&(k.nftDomain={name:g("router.domainAlias.nftDomain"),component:e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{maxWidth:"640px",color:"text.secondary",fontSize:"14px"},children:[e.jsx("div",{children:g("router.domainAlias.addDomainNFT.tips")}),e.jsxs("div",{children:[g("router.domainAlias.addDomainNFT.buyTip"),e.jsxs(Xe,{href:y.nftDomainUrl,sx:{fontSize:"14px",display:"inline-flex",alignItems:"center"},target:"_blank",children:[e.jsx("i",{children:g("router.domainAlias.addDomainNFT.buy")}),e.jsx(bt,{fontSize:"small"})]})]})]}),e.jsx(L,{sx:{marginTop:"8px"},disabled:m,onClick:()=>b({showNFTDomainAuth:!0}),variant:"contained",children:g("router.domainAlias.addDomainNFT.showNFT")}),e.jsx(Ye,{open:x.showNFTDomainAuth,popup:!0,useSocket:!1,action:"authorize",baseUrl:_,checkFn:Ze.create({baseURL:_}).get,extraParams:{delegatee:r,delegateePk:l},onSuccess:d,onClose:()=>b({showNFTDomainAuth:!1}),checkTimeout:60*5e3,showDownload:!1,messages:{title:g("router.domainAlias.addDomainNFT.connect.title"),scan:g("router.domainAlias.addDomainNFT.connect.scan"),confirm:g("router.domainAlias.addDomainNFT.connect.confirm"),success:g("router.domainAlias.addDomainNFT.connect.success")}})]})});const E=Object.keys(k);return E.sort(I=>I==="inputDomain"?1:-1),e.jsx(h,{...j,children:e.jsx(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:E.map((I,f)=>{var P,q;return e.jsxs(h,{children:[E.length>1&&e.jsx(h,{sx:{fontWeight:700,color:C.palette.text.primary},children:`${g(`optionsOrder.${f+1}`)}: ${(P=k[I])==null?void 0:P.name}`}),e.jsx(h,{sx:{marginTop:"8px"},children:(q=k[I])==null?void 0:q.component})]},I)})})})}le.propTypes={siteId:o.string.isRequired,teamDid:o.string.isRequired,cnameDomain:o.string.isRequired,defaultCustomDomain:o.string,onInputDomain:o.func,onSuccess:o.func,appId:o.string,appPk:o.string,disabled:o.bool,autoFocus:o.bool,inBlockletSetup:o.bool};le.defaultProps={defaultCustomDomain:"",onInputDomain:xe,onSuccess:xe,appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1};function ce({id:s,children:t,title:n,teamDid:i,systemDomains:a,appId:r,appPk:l}){const{t:c}=w(),{api:m}=F(),[u,p]=te({loading:!1,confirmSetting:null}),j=a.find(C=>Se.isDidDomain(C)),g=Fe(),T=()=>{p({loading:!1,confirmSetting:null})},R=async C=>{if(!u.loading){p({loading:!0});try{const x=Pe(C.domain);if(!await g.validateDomain(x))return!1;await m.addDomainAlias({input:{id:s,domainAlias:x,teamDid:i}}),await Z(2e3),p({confirmSetting:null})}catch(x){return g.setError(x.message),!1}finally{p({loading:!1})}}},y={title:n||c("router.domainAlias.add.title"),description:function(x,b,_){return e.jsx(le,{siteId:s,teamDid:i,cnameDomain:j,onSuccess:()=>p({confirmSetting:null}),onInputDomain:({domain:d,error:S})=>{b({...x,domain:d,__disableConfirm:!!S}),_(S)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onConfirm:R,onCancel:T},D=C=>{C.stopPropagation(),p({confirmSetting:y})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:u.loading,open:D}):e.jsxs(Te,{onClick:D,className:"rule-action","data-cy":"action-add-domain-alias",children:[u.loading?e.jsx(N,{size:16}):e.jsx($e,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),u.confirmSetting&&e.jsx(ee,{title:u.confirmSetting.title,description:u.confirmSetting.description,confirm:u.confirmSetting.confirm,cancel:u.confirmSetting.cancel,params:u.confirmSetting.params,onConfirm:u.confirmSetting.onConfirm,onCancel:u.confirmSetting.onCancel,displayError:!1,color:"primary",loading:u.loading,maxWidth:"lg"})]})}ce.propTypes={id:o.string.isRequired,children:o.any,title:o.string,teamDid:o.string,systemDomains:o.arrayOf(o.string).isRequired,appId:o.string,appPk:o.string.isRequired};ce.defaultProps={children:null,title:"",teamDid:"",appId:null};function vn(s){return e.jsx(bn,{children:e.jsx(ce,{...s})})}function de(s){const{t}=w(),[n,i]=v.useState(!1),[a,r]=v.useState(null),{id:l,domain:c,children:m,teamDid:u}=s,{api:p}=F(),j=()=>{i(!1),r(null)},g=async()=>{i(!0);try{await p.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:u}}),await Z(2e3)}catch(y){J.error(y.message)}finally{r(null),i(!1)}},T={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:g,onCancel:j},R=y=>{y.stopPropagation(),r(T)};return e.jsxs(e.Fragment,{children:[typeof m=="function"?m({loading:n,open:R}):e.jsxs(L,{edge:"end",onClick:R,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[n?e.jsx(N,{size:16}):e.jsx(Re,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(ee,{title:a.title,description:a.description,confirm:a.confirm,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}de.propTypes={id:o.string.isRequired,domain:o.string.isRequired,children:o.any,teamDid:o.string};de.defaultProps={children:null,teamDid:""};function me({site:s,domain:t,blocklet:n}){const{t:i}=w(),a=t.value===window.location.hostname;return e.jsx(Ct,{"data-cy":"domain-actions",size:"large",actions:[({close:r})=>{var l;return e.jsx(de,{id:s.id,domain:t.value,teamDid:(l=n==null?void 0:n.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(z,{title:a?i("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Te,{disabled:t.isProtected||a,dense:!0,onClick:m=>{r(),c(m)},"data-cy":"action-toggle-block",children:[e.jsx(gt,{style:{minWidth:24,marginRight:8},children:e.jsx(Re,{})}),e.jsx(jt,{primary:i("common.delete")})]},"remove")})})})}]})}me.propTypes={site:o.object.isRequired,domain:o.object.isRequired,blocklet:o.object.isRequired};me.defaultProps={};var ue={},Dn=B;Object.defineProperty(ue,"__esModule",{value:!0});var pe=ue.default=void 0,Cn=Dn(O()),Sn=e,Tn=(0,Cn.default)((0,Sn.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"}),"Https");pe=ue.default=Tn;const H=o.shape({href:o.string,accessibility:o.shape({loading:o.bool,accessible:o.bool}),domainStatus:o.shape({isHttps:o.bool,matchedCert:o.object}),dns:o.shape({resolved:o.bool,ip:o.string})});function fe({certificate:s}){const[t,n]=v.useState(null),i=F(),{t:a,locale:r}=w(),l=u=>{n(u.currentTarget)},c=()=>{n(null)},m=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(pe,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:l,onMouseLeave:c,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),e.jsx(Ae,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:e.jsx(we,{children:e.jsxs(_e,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${i.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(A,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(A,{component:"div",style:{fontWeight:"bold"},children:s.domain}),e.jsx(A,{component:"div",children:`${a("common.issuer")}: ${et(s,"issuer.commonName","")}`}),e.jsx(A,{component:"div",children:`${a("router.cert.issuedOn")}: ${ge(s.validFrom,r)}`}),e.jsx(A,{component:"div",children:`${a("router.cert.expiryOn")}: ${ge(s.validTo,r)}`})]})]})})})]})}fe.propTypes={certificate:o.object};fe.defaultProps={certificate:{}};function M({domain:s,filters:t}){const{t:n}=w(),{value:i,domainStatus:a}=s;if(!be(i))return null;let r=null,l=null;const{isHttps:c,matchedCert:m}=a;if(!tt(i)){const{dns:{resolved:p,ip:j}={}}=a;p||j==="127.0.0.1"?r=e.jsx(z,{title:n("router.domain.verify.ok"),children:e.jsx(je,{color:"success"})}):r=e.jsx(z,{title:n("router.domain.verify.notResolved"),children:e.jsx(je,{color:"error"})})}c?l=e.jsx(fe,{certificate:m}):l=e.jsx(z,{title:n("router.domain.https.bad"),children:e.jsx(pe,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const u=t.map(p=>p==="domain"?r:p==="http"?l:null);return v.createElement(v.Fragment,null,...u)}M.propTypes={domain:H.isRequired,filters:o.array};M.defaultProps={filters:["domain","http"]};const An=Ie(U,"mutate_blocklets"),wn=Ie(U,"",st);function Le(s){const{inService:t}=F(),{blocklet:n,loadingRuntimeInfo:i}=ve();let a=An;return t&&(a=wn),e.jsx(a,{...s,blocklet:n,inService:t,loadingRuntimeInfo:i})}Le.propTypes={listOnly:o.bool};Le.defaultProps={listOnly:!1};function U({hasPermission:s,blocklet:t,loadingRuntimeInfo:n,inService:i,listOnly:a}){var C,x,b,_;const{t:r}=w(),[l,c]=v.useState(!1),m=Ce(d=>d.breakpoints.down("md")),u=v.useMemo(()=>{let d=s;return it(t)&&(d=d&&i),d},[s,i,t]),{site:p}=t,j=v.useMemo(()=>{var d;return ot((d=t.site)==null?void 0:d.domainAliases)},[(C=t.site)==null?void 0:C.domainAliases]),g=[],T=[],R=tn.encode(t.appPid),y=(b=(x=t.environments)==null?void 0:x.find(d=>d.key==="BLOCKLET_APP_PK"))==null?void 0:b.value,D=rt(j);return j.forEach(d=>{const S=d.value||"";Se.isDidDomain(S)&&!S.startsWith(R)?T.push(d):g.push(d)}),e.jsxs(e.Fragment,{children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs(h,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(h,{children:r("common.domain")}),u&&e.jsx(vn,{id:p.id,title:r("router.domain.add.title"),teamDid:(_=t.meta)==null?void 0:_.did,appId:t.appPid,appPk:y,systemDomains:D==null?void 0:D.map(d=>d.value),children:({open:d})=>e.jsxs(L,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:d,disabled:at(t.status),children:[e.jsx(mt,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})})]}),lt(t.status)===!1&&e.jsx(h,{mt:1.5,mb:1.5,children:e.jsx(St,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(h,{sx:{display:"flex",flexDirection:"column",gap:1},children:(l?j:g).map(d=>{var k,E;const S=d.value;return e.jsxs(v.Fragment,{children:[m&&e.jsxs(h,{display:"flex",flexDirection:"column",children:[e.jsx(h,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:e.jsx(Q,{domain:d,target:"_blank",children:d.value})}),e.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[e.jsx(M,{domain:d,filters:["domain"]},`${d.value}-domain`),e.jsx(Y,{siteId:(k=t.site)==null?void 0:k.id,domain:d,blocklet:t,hasMutatePermission:u})]}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(X,{hasMutatePermission:u,site:p,domain:d,blocklet:t})})]})]},S),!m&&e.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(h,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(M,{domain:d,filters:["domain"]},`${d.value}-domain`),e.jsx(h,{sx:{ml:2,mr:.5},children:e.jsx(Q,{domain:d,target:"_blank",children:d.value})}),e.jsx(Y,{siteId:(E=t.site)==null?void 0:E.id,domain:d,blocklet:t,hasMutatePermission:u})]}),e.jsx(h,{sx:{button:{padding:0}},children:e.jsx(X,{hasMutatePermission:u,site:p,domain:d,blocklet:t})})]},S)]},S)})}),T.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(L,{endIcon:l?e.jsx(ke,{}):e.jsx(ut,{}),onClick:()=>c(!l),children:r(l?"common.collapseAll":"blocklet.router.showAllDomains")})}),!j.length&&(n?e.jsx(N,{size:16}):e.jsx(ct,{children:r("common.empty")}))]})}U.propTypes={hasPermission:o.bool,blocklet:o.object.isRequired,loadingRuntimeInfo:o.bool,inService:o.bool.isRequired,listOnly:o.bool};U.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1};function Q({domain:s,children:t,...n}){const{t:i}=w(),{href:a,accessibility:r}=s;return!r||r.loading?e.jsxs(V,{...n,children:[t,e.jsx(z,{title:i("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(N,{size:12})})})]}):r.accessible?e.jsx(V,{...n,children:e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:t})}):e.jsx(V,{...n,children:e.jsx(z,{title:i("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})})})}Q.propTypes={domain:H.isRequired,children:o.any.isRequired};const V=nt.span`
|
|
2
|
+
&,
|
|
3
|
+
& > * {
|
|
4
|
+
color: #222;
|
|
5
|
+
font-size: 18px;
|
|
6
|
+
word-break: break-all;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.status {
|
|
10
|
+
margin-left: 8px;
|
|
11
|
+
}
|
|
12
|
+
`;function X({hasMutatePermission:s,site:t,domain:n,blocklet:i}){const a=W(),{t:r}=w();return s&&!n.isProtected?e.jsx(me,{site:t,domain:n,blocklet:i}):e.jsx(z,{title:r("blocklet.router.domainLockTooltip"),placement:"top",children:e.jsx(dt,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:e.jsx(pt,{style:{fill:a.palette.text.disabled}})})})}X.propTypes={hasMutatePermission:o.bool.isRequired,site:o.object.isRequired,domain:H.isRequired,blocklet:o.object.isRequired};function Y({siteId:s,domain:t,blocklet:n,hasMutatePermission:i}){const a=W(),{t:r}=w(),[l,c]=v.useState(null),m=p=>{c(p.currentTarget)},u=()=>{c(null)};return e.jsxs(h,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:[t.type==="nft-domain"&&e.jsxs(e.Fragment,{children:[e.jsx(K,{onMouseEnter:m,onMouseLeave:u,style:{cursor:"pointer",fill:a.palette.primary.main}}),e.jsx(Ae,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:!!l,anchorEl:l,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:u,disableRestoreFocus:!0,children:e.jsx(we,{children:e.jsxs(_e,{style:{display:"flex",flexDirection:"column"},children:[e.jsxs(A,{component:"div",style:{display:"flex",alignItems:"center"},children:[e.jsx(K,{style:{fill:a.palette.primary.main}}),e.jsx(A,{component:"span",style:{marginLeft:"8px",fontSize:"18px",fontWeight:"bolder"},children:r("router.domainAlias.nftDomain")})]}),e.jsxs(A,{component:"div",style:{display:"flex",marginTop:"12px"},children:[e.jsx(A,{component:"span",style:{width:"80px",marginRight:"8px"},children:r("common.domain")}),e.jsx(A,{component:"span",children:t.value})]}),e.jsxs(A,{component:"div",style:{display:"flex"},children:[e.jsx(A,{component:"span",style:{width:"80px",marginRight:"8px"},children:"NFT"}),e.jsx(ft,{did:t.nftDid})]})]})})})]}),e.jsx(M,{domain:t,filters:["http"]},`${t.value}-http`),i&&e.jsx(oe,{siteId:s,domain:t.value,domainStatus:t.domainStatus,did:n.meta.did,children:({open:p})=>e.jsx(L,{sx:{padding:0},size:"small",onClick:j=>p(j),children:r("router.cert.genLetsEncryptCert.title")})})]})}Y.propTypes={siteId:o.string.isRequired,domain:H.isRequired,blocklet:o.object.isRequired,hasMutatePermission:o.bool.isRequired};export{le as A,bn as D,Le as a,ke as d,Fe as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as P,u as E,e as v,j as e,C,S as T,x as j,y as k,n as g,w as S,z as b,E as W,s as I,o as R}from"./index-
|
|
1
|
+
import{r as P,u as E,e as v,j as e,C,S as T,x as j,y as k,n as g,w as S,z as b,E as W,s as I,o as R}from"./index-53d55e82.js";import{w as L}from"./wrap-locale-525fe909.js";function N({SessionContext:a,webWalletUrl:t,onSuccess:s}){const{api:o,session:i}=P.useContext(a),{t:n,locale:h}=E(),f=v(),{searchParams:l}=new URL(window.location.href),x=l.get("redirect"),u=async(c,w)=>{s(c,w),await i.refresh(),g.success(n("exchangePassport.success")),setTimeout(()=>{if(x){const r=decodeURIComponent(x);r.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?f(r,{replace:!0}):window.location=r}else window.location=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},m=c=>{g.error(c.message)},p={},d=l.get("componentId");return d&&(p.componentId=d),i.loading?e.jsx(C,{children:e.jsx(T,{})}):e.jsx(y,{children:e.jsx("div",{className:"connect-wrapper",children:e.jsx(j,{className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:t,onSuccess:u,onError:m,locale:h,messages:{title:n("exchangePassport.dialog.title"),scan:n("exchangePassport.dialog.scan"),confirm:n("exchangePassport.dialog.confirm"),success:n("exchangePassport.dialog.success")},extraParams:p,extraContent:null})})})}const U=L(N),y=k.div`
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100vh;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as e,j as o,
|
|
1
|
+
import{P as e,j as o,bM as i,c0 as a,G as l}from"./index-53d55e82.js";function n({title:r,desc:t,retryFunc:s}){return o.jsxs(p,{role:"alert",children:[o.jsx("h3",{children:r}),o.jsx("pre",{children:t}),s&&o.jsx(l,{variant:"contained",color:"error",size:"small",onClick:s,children:"Try again"})]})}n.propTypes={title:e.string,desc:e.string.isRequired,retryFunc:e.func};n.defaultProps={title:"Something went wrong...",retryFunc:null};function c({error:r}){return o.jsx(n,{desc:r.message})}c.propTypes={error:e.instanceOf(Error).isRequired};e.instanceOf(Error).isRequired,e.func.isRequired;const p=i("div")`
|
|
2
2
|
padding: 16px;
|
|
3
3
|
border: 2px solid ${r=>r.theme.palette.error.main};
|
|
4
4
|
border-radius: 4px;
|
|
@@ -12,4 +12,4 @@ import{P as e,j as o,bx as i,bM as a,G as l}from"./index-485b5b11.js";function n
|
|
|
12
12
|
pre {
|
|
13
13
|
white-space: normal;
|
|
14
14
|
}
|
|
15
|
-
`;export{
|
|
15
|
+
`;export{c as E};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aW as i}from"./index-53d55e82.js";const f=t=>{const{details:a,errors:e,response:r}=t;return Array.isArray(e)?e.map(s=>s.message).join(`
|
|
2
2
|
`):Array.isArray(a)?`Validate failed: ${a.map(o=>{const n=o.message.replace(/["]/g,"'");return`${o.path.join(".")}: ${n}`}).join(";")}`:r?`Request failed: ${r.status} ${r.statusText}: ${JSON.stringify(r.data)}`:t.message};var m=f;const c=i(m);export{c as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,F as N,a6 as P,d as W,j as e,B as t,S as v,a0 as E,c as I,x as $,P as p,y as D}from"./index-
|
|
1
|
+
import{r as l,F as N,a6 as P,d as W,j as e,B as t,S as v,a0 as E,c as I,x as $,P as p,y as D}from"./index-53d55e82.js";import{d as F}from"./Launch-55624d0f.js";import{W as L}from"./did-address-868daf20.js";import{P as T}from"./page-header-65d7734f.js";import{S as z}from"./layout-6e6d83db.js";import{S as A}from"./step-actions-739b43a4.js";import{S as u}from"./button-395bdffd.js";import"./content-layout-9b8df0f2.js";function m({onNext:n,onPrevious:x}){const{locale:f,t:s}=l.useContext(N),{blocklet:a,gas:c,tokenInfo:h,actions:j}=P(),{api:y}=W(),[g,o]=l.useState(!1),{need:d="",current:S="",owe:r=99999,deficiency:k,symbol:b="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const B=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(B)}},[]);const w=()=>{o(!1)};return c?e.jsxs(q,{children:[e.jsx("div",{className:"header",children:e.jsx(T,{title:s("setup.fuel.title"),onClickBack:x})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${d} ${b}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(L,{className:"address",did:a.appDid}),e.jsx(E,{style:{lineHeight:1},target:"_blank",href:I(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(F,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(u,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:f,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:d})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:S})]})]})]}),e.jsx(A,{mt:8,children:e.jsx(u,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(v,{})})}m.propTypes={onNext:p.func,onPrevious:p.func};m.defaultProps={onNext:()=>{},onPrevious:()=>{}};const q=D(z)`
|
|
2
2
|
.qr-body {
|
|
3
3
|
width: 580px;
|
|
4
4
|
${n=>n.theme.breakpoints.down("md")} {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,B as e,G as t,L as r,w as i}from"./index-
|
|
1
|
+
import{j as o,B as e,G as t,L as r,w as i}from"./index-53d55e82.js";import{S as n}from"./studio-9d0ed995.js";import"./index-c969afd7.js";import"./nav-menu-2414a713.js";import"./ExpandMore-3020171f.js";import"./Toolbar-f8956d67.js";import"./Hidden-1d1d2e86.js";import"./fallback-f2622fec.js";function E(){return o.jsx(n,{children:o.jsxs(e,{m:4,children:[o.jsx(t,{component:r,to:`${i.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(t,{component:r,style:{marginLeft:16},to:`${i.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bQ as x}from"./index-53d55e82.js";import{o as E}from"./index-c969afd7.js";const L=({url:o,allowFullScreen:r,position:a,display:i,height:u,width:c,overflow:f,styles:y,onLoad:p,onMouseOver:m,onMouseOut:b,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:I,name:P,target:v,loading:A,importance:F,referrerpolicy:M,allowpaymentrequest:S,src:$,key:q})=>{const t=E({src:$||o,target:v||null,style:{position:a||null,display:i||"initial",overflow:f||null},scrolling:w||null,allowpaymentrequest:S||null,importance:F||null,sandbox:s&&[...s].join(" ")||null,loading:A||null,styles:y||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":I||null,"aria-hidden":O||null,"aria-label":k||null,width:c||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:b||null,key:q||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(r)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),x.createElement("iframe",Object.assign({},l))},R=L;export{R as I};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{aj as yo,j as t,az as ce,
|
|
1
|
+
import{aj as yo,j as t,az as ce,aH as Co,aB as F,er as xt,aD as Ne,ax as Qe,ay as Ze,T as Z,r as c,aC as et,aE as To,aF as He,aG as tt,B as j,S as Ge,P as W,u as Me,a7 as Oe,a$ as _e,bE as Le,L as re,G as le,cW as Nt,av as Ue,n as _,y as je,e as vt,x as So,b5 as Io,cY as wo,X as ne,c as ot,w as Ae,aL as Ro,bp as Eo,dq as Po,aM as $t,dp as bt,c5 as Bt,aJ as ze,db as Dt,es as No,bW as gt,bI as vo,M as $o,et as Ke,cd as Bo,au as Do,ag as Ao,ah as We}from"./index-53d55e82.js";import{d as At,_ as Mo}from"./useSetState-840de1df.js";import{D as Mt}from"./index-f92a64b0.js";import{T as Ot}from"./MoreVert-7812832e.js";import{W as Oo}from"./did-address-868daf20.js";import{C as _t}from"./confirm-2682d0fc.js";import{B as Lt,d as _o}from"./ChevronRight-4cba63fe.js";import{_ as Lo}from"./toPropertyKey-f41ee07b.js";import{u as Vo}from"./session-8a8645ce.js";import{T as ke}from"./TextField-fe08d197.js";import{M as Ye}from"./InputAdornment-53f09810.js";import{d as kt}from"./Download-c45f9492.js";import{d as Fo}from"./DeleteOutline-99b46f8b.js";import{T as zo}from"./index-9ad53f5f.js";import{c as Vt}from"./index-3fb520ed.js";import{i as Wo}from"./index-c7baa6f9.js";import{d as Ko}from"./ExpandMore-3020171f.js";import{d as Uo}from"./OpenInNew-2ec888fc.js";import{F as Ho}from"./FormControlLabel-6c1055c3.js";import{C as qo}from"./Checkbox-93b1ae12.js";import"./api-dcff568c.js";import{A as Jo}from"./Avatar-a3ed8c85.js";import{f as Je}from"./format-error-1642e1d0.js";import"./FilterList-dbb51894.js";import"./TableRow-722353c4.js";import"./FormControl-77e38e88.js";import"./useFormControl-df015b19.js";import"./FormGroup-03a8abc6.js";import"./InputLabel-710219b5.js";import"./Select-a3cf4deb.js";import"./LastPage-f494bc19.js";import"./Toolbar-f8956d67.js";import"./index-a7294263.js";import"./redux-ba45a372.js";import"./Grid-5f9be0bf.js";import"./Search-70432ee8.js";import"./DialogContentText-413bb94f.js";import"./Alert-850c6ed5.js";const Xo=yo(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz"),Go=["slots","slotProps"],Yo=ce(Co)(({theme:e})=>F({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`},e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":F({},e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}),"&:active":F({boxShadow:e.shadows[0]},e.palette.mode==="light"?{backgroundColor:xt(e.palette.grey[200],.12)}:{backgroundColor:xt(e.palette.grey[600],.12)})})),Qo=ce(Xo)({width:24,height:16});function Zo(e){const{slots:n={},slotProps:r={}}=e,l=Ne(e,Go),m=e;return t.jsx("li",{children:t.jsx(Yo,F({focusRipple:!0},l,{ownerState:m,children:t.jsx(Qo,F({as:n.CollapsedIcon,ownerState:m},r.collapsedIcon))}))})}function es(e){return Ze("MuiBreadcrumbs",e)}const ts=Qe("MuiBreadcrumbs",["root","ol","li","separator"]),os=ts,ss=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],ns=e=>{const{classes:n}=e;return tt({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},es,n)},rs=ce(Z,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,n)=>[{[`& .${os.li}`]:n.li},n.root]})({}),ls=ce("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,n)=>n.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),as=ce("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,n)=>n.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function is(e,n,r,l){return e.reduce((m,d,b)=>(b<e.length-1?m=m.concat(d,t.jsx(as,{"aria-hidden":!0,className:n,ownerState:l,children:r},`separator-${b}`)):m.push(d),m),[])}const cs=c.forwardRef(function(n,r){const l=et({props:n,name:"MuiBreadcrumbs"}),{children:m,className:d,component:b="nav",slots:u={},slotProps:y={},expandText:g="Show path",itemsAfterCollapse:S=1,itemsBeforeCollapse:I=1,maxItems:E=8,separator:i="/"}=l,k=Ne(l,ss),[a,C]=c.useState(!1),v=F({},l,{component:b,expanded:a,expandText:g,itemsAfterCollapse:S,itemsBeforeCollapse:I,maxItems:E,separator:i}),$=ns(v),p=To({elementType:u.CollapsedIcon,externalSlotProps:y.collapsedIcon,ownerState:v}),w=c.useRef(null),K=N=>{const U=()=>{C(!0);const ee=w.current.querySelector("a[href],button,[tabindex]");ee&&ee.focus()};return I+S>=N.length?N:[...N.slice(0,I),t.jsx(Zo,{"aria-label":g,slots:{CollapsedIcon:u.CollapsedIcon},slotProps:{collapsedIcon:p},onClick:U},"ellipsis"),...N.slice(N.length-S,N.length)]},h=c.Children.toArray(m).filter(N=>c.isValidElement(N)).map((N,U)=>t.jsx("li",{className:$.li,children:N},`child-${U}`));return t.jsx(rs,F({ref:r,component:b,color:"text.secondary",className:He($.root,d),ownerState:v},k,{children:t.jsx(ls,{className:$.ol,ref:w,ownerState:v,children:is(a||E&&h.length<=E?h:K(h),$.separator,i,v)})}))}),st=cs;function Ve({size:e,...n}){return t.jsx(j,{display:"flex",mt:4,...n,children:t.jsx(Ge,{size:e})})}Ve.propTypes={size:W.number};Ve.defaultProps={size:24};function Ft(){const{t:e,locale:n}=Me(),{api:r}=Oe(),[l,m]=c.useState(!0),{blocklet:d}=_e(),[b,u]=c.useState(null),{componentDid:y=""}=Le(),[g,S]=c.useState(null),I=()=>{r.getProjects({input:{did:d.meta.did,componentDid:y}}).then(a=>{const C=(a==null?void 0:a.projects)||[];m(!1),S(C)}).catch(a=>{m(!1),_.error(a.message)})},E=a=>{u(a)},i=()=>{m(!1);const a=b.id;r.deleteProject({input:{did:d.meta.did,projectId:a}}).then(()=>{m(!1),I(),_.success(e("common.removeSuccess")),u(null)}).catch(C=>{m(!1),_.error(C.message)})};if(c.useEffect(()=>{I()},[]),!g&&l)return t.jsx(Ve,{});if(!g)return null;if(!g.length)return t.jsxs(j,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(j,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.blockletEmptyTip")}),t.jsx(j,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createBlockletTip")}),t.jsx(re,{to:"create",children:t.jsx(le,{variant:"contained",children:e("blocklet.publish.createBlocklet")})})]});const k=[{label:"Blocklet",name:"blockletTitle",options:{customBodyRenderLite:a=>{const C=g[a];return t.jsx(re,{to:`${C.id}`,children:C.blockletTitle||"/"})}}},{label:"DID",name:"blockletDid",options:{customBodyRender:a=>t.jsx(Oo,{size:14,responsive:!0,did:a})}},{label:"Version",name:"blockletVersion",options:{customBodyRender:a=>a?t.jsx(Ot,{type:"success",children:a}):""}},y?null:{label:e("common.scope"),name:"componentDid",options:{customBodyRender:a=>{const C=(d.children||[]).find(v=>v.meta.did===a);return C?t.jsxs(j,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:14,blocklet:C,ancestors:[d]}),t.jsx(j,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:C.meta.title})]},a):""}}},{label:e("common.updatedAt"),name:"updatedAt",options:{customBodyRender:a=>t.jsx(Nt,{value:Number(a),locale:n})}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:a=>{const C=g[a];return t.jsx(j,{display:"flex",children:t.jsx(Ue,{color:"error","aria-label":"delete",onClick:()=>E(C),children:t.jsx(At,{sx:{fontSize:18}})})})}}}].filter(Boolean);return t.jsxs(ds,{children:[t.jsx(j,{sx:{textAlign:"right"},children:t.jsx(re,{to:"create",children:t.jsx(le,{variant:"contained",children:e("blocklet.publish.createBlocklet")})})}),t.jsx(Mt,{className:"main-table",locale:n,data:g,columns:k,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),b&&t.jsx(_t,{title:`${e("common.delete")} ${b.blockletTitle}`,description:e("blocklet.publish.deleteBlockletTip"),confirm:e("common.confirm"),onConfirm:i,onCancel:()=>u(null)})]})}Ft.propTypes={};const ds=je(j)`
|
|
2
2
|
.main-table > div:first-child {
|
|
3
3
|
display: none;
|
|
4
4
|
}
|
|
5
|
-
`,us=[{label:{en:"Resource",zh:"资源"},value:"resource"},{label:{en:"Application",zh:"应用"},value:"pack",disabled:!0}];function nt({...e}){const n=vt(),{t:r,locale:l}=
|
|
5
|
+
`,us=[{label:{en:"Resource",zh:"资源"},value:"resource"},{label:{en:"Application",zh:"应用"},value:"pack",disabled:!0}];function nt({...e}){const n=vt(),{t:r,locale:l}=Me(),{blocklet:m}=_e(),[d,b]=c.useState(""),[u,y]=c.useState(!1),[g,S]=c.useState("resource"),{api:I}=Vo(),{api:E}=Oe(),[i,k]=c.useState(),[a,C]=c.useState(!1),[v]=Lo("manual-create-blocklet-did",!1),{componentDid:$=""}=Le(),p=h=>{_.error(h.message),C(!1)},w=h=>{var U;const N=(U=h==null?void 0:h.blockletWallet)==null?void 0:U.address;N?k(N):_.error("Empty Blocklet DID"),C(!1)},K=()=>{if(!i){_.error(r("blocklet.publish.errorTip.noDid"));return}if(!d){_.error(r("blocklet.publish.errorTip.noTitle"));return}y(!0),E.createProject({input:{did:m.meta.did,blockletTitle:d||"",blockletDid:i,type:g,componentDid:$}}).then(()=>{y(!1),n("../",{replace:!0})}).catch(h=>{y(!1),_.error(h.message)})};return t.jsxs(ps,{...e,children:[t.jsxs(st,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(re,{to:"..",children:r("common.publish")}),t.jsxs(Z,{color:"text.primary",children:[r("common.create")," Blocklet"]})]}),t.jsxs(j,{style:{maxWidth:500},children:[t.jsx(ke,{required:!0,sx:{mb:4},label:"Blocklet DID",fullWidth:!0,readonly:!0,autoComplete:"off",variant:"outlined",onChange:h=>v&&k(h.target.value),onClick:()=>!v&&!i&&C(!0),InputProps:{"data-cy":"export-blocklet-did",endAdornment:!v&&t.jsx(Ye,{position:"end",children:t.jsx(le,{onClick:()=>C(!0),children:r(i?"common.update":"common.create")})})},helperText:"",value:i||""}),a&&t.jsx(So,{open:!0,popup:!0,onClose:()=>C(!1),action:"gen-blocklet-key-pair",locale:l,checkFn:I.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:p,extraParams:{did:m.meta.did},messages:{title:r("blocklet.publish.connect.title"),scan:r("blocklet.publish.connect.scan"),confirm:r("blocklet.publish.connect.confirm"),success:r("blocklet.publish.connect.success")}}),t.jsx(ke,{required:!0,label:`Blocklet ${r("common.title")}`,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-title"},fullWidth:!0,helperText:"",value:d||"",onChange:h=>{b(h.target.value)}}),t.jsx(ke,{sx:{my:4},id:"blocklet-type",select:!0,label:`Blocklet ${r("common.type")}`,helperText:"",fullWidth:!0,value:g,onChange:h=>S(h.target.value),children:us.map(h=>t.jsx(Io,{value:h.value,disabled:h.disabled,children:h.label[l]||h.label.en},h.value))})]}),t.jsx(le,{variant:"contained",disabled:u,onClick:K,children:r("common.create")})]})}nt.propTypes={};nt.defaultProps={};const ps=je.div`
|
|
6
6
|
.breadcrumbs {
|
|
7
7
|
margin-bottom: 24px;
|
|
8
8
|
}
|
|
9
|
-
`;function zt(){const{t:e,locale:n}=
|
|
9
|
+
`;function zt(){const{t:e,locale:n}=Me(),{projectId:r}=Le(),{api:l}=Oe(),[m,d]=c.useState(!0),{blocklet:b}=_e(),[u,y]=c.useState(null),[g,S]=c.useState(null),[I,E]=c.useState(null),i=()=>{l.getReleases({input:{did:b.meta.did,projectId:r}}).then(p=>{const w=(p==null?void 0:p.releases)||[];d(!1),y(w)}).catch(p=>{d(!1),_.error(p.message)})},k=()=>{l.doBatchQuery({getProject:{input:{did:b.meta.did,projectId:r}},getReleases:{input:{did:b.meta.did,projectId:r}}}).then(p=>{S(p.getProject.project||{}),y(p.getReleases.releases||[]),d(!1)}).catch(p=>{d(!1),_.error(p.message)})};c.useEffect(()=>{k()},[]);const a=()=>{d(!1);const p=I.id;l.deleteRelease({input:{did:b.meta.did,projectId:r,releaseId:p}}).then(()=>{d(!1),i(),_.success(e("common.removeSuccess")),E(null)}).catch(w=>{d(!1),_.error(w.message)})},C=p=>{E(p)};if(!u&&m)return t.jsx(Ve,{});if(!u)return null;const v=t.jsxs(st,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(re,{to:"..",children:e("common.publish")}),t.jsx(Z,{color:"text.primary",children:g.blockletTitle})]});if(!u.length)return t.jsxs(t.Fragment,{children:[v,t.jsxs(j,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(j,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(j,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(re,{to:"create",children:t.jsx(le,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const $=[{label:e("common.version"),name:"blockletVersion",options:{customBodyRenderLite:p=>{const w=u[p];return t.jsx(re,{to:`${w.id}`,children:w.blockletVersion||"/"})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:p=>{const w=u[p];return t.jsx(Z,{className:"note",children:w.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:p=>t.jsx(Ot,{type:p==="published"?"success":"warning",children:wo(p)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:p=>{const w=u[p];return w.status!==ne.PROJECT.RELEASE_STATUS.published?"":t.jsx(Nt,{value:Number(w.updatedAt),locale:n})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:p=>{const w=u[p];return t.jsxs(j,{display:"flex",alignItems:"center",children:[t.jsx(Ue,{color:"primary","aria-label":"download",disabled:w.status!=="published",children:w.status==="published"?t.jsx("a",{style:{display:"flex"},href:ot(`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${g.id}/${w.id}/download/${(w.files||[])[0]}`),children:t.jsx(kt,{sx:{fontSize:18}})}):t.jsx(kt,{sx:{fontSize:18}})}),t.jsx(Ue,{color:"error","aria-label":"delete",onClick:()=>C(w),children:t.jsx(At,{sx:{fontSize:18}})})]})}}}];return t.jsxs(fs,{children:[t.jsxs(j,{className:"header",children:[v,t.jsx(re,{to:"create",children:t.jsx(le,{variant:"contained",children:e("blocklet.publish.createRelease")})})]}),t.jsx(Mt,{className:"main-table",verticalKeyWidth:100,locale:n,data:u,columns:$,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),I&&t.jsx(_t,{title:e(`${e("common.delete")} ${I.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:a,onCancel:()=>E(null)})]})}zt.propTypes={};const fs=je(j)`
|
|
10
10
|
.header {
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
@@ -19,9 +19,9 @@ import{aj as yo,j as t,az as ce,bO as Co,aB as F,en as xt,aD as Ne,ax as Qe,ay a
|
|
|
19
19
|
word-break: break-all;
|
|
20
20
|
white-space: pre-line;
|
|
21
21
|
}
|
|
22
|
-
`,rt=c.createContext({registerNode:()=>{},unregisterNode:()=>{},isFocused:()=>!1,isSelected:()=>!1,isExpanded:()=>!1,isExpandable:()=>!1,isDisabled:()=>!1,mapFirstChar:()=>{},unMapFirstChar:()=>{},focus:()=>{},toggleExpansion:()=>{},selectNode:()=>{},selectRange:()=>{},multiSelect:!1,disabledItemsFocusable:!1,treeId:void 0,icons:{defaultCollapseIcon:null,defaultExpandIcon:null,defaultParentIcon:null,defaultEndIcon:null}}),ms=["element"];function hs(e,n){for(let r=0;r<e.length;r+=1)if(n(e[r]))return r;return-1}function xs(e,n){let r=0,l=e.length-1;for(;r<=l;){const m=Math.floor((r+l)/2);if(e[m].element===n)return m;e[m].element.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING?l=m-1:r=m+1}return r}const
|
|
23
|
-
`)),Tt=!0)},Es=c.forwardRef(function(n,r){return Rs(),t.jsx(ws,F({},n,{ref:r}))}),Ps=Es;function Ns(e){const{focus:n,isExpanded:r,isExpandable:l,isFocused:m,isDisabled:d,isSelected:b,multiSelect:u,selectNode:y,selectRange:g,toggleExpansion:S}=c.useContext(rt),I=l?l(e):!1,E=r?r(e):!1,i=m?m(e):!1,k=d?d(e):!1,a=b?b(e):!1;return{disabled:k,expanded:E,selected:a,focused:i,handleExpansion:p=>{if(!k){i||n(p,e);const w=u&&(p.shiftKey||p.ctrlKey||p.metaKey);I&&!(w&&r(e))&&S(p,e)}},handleSelection:p=>{k||(i||n(p,e),u&&(p.shiftKey||p.ctrlKey||p.metaKey)?p.shiftKey?g(p,{end:e}):y(p,e,!0):y(p,e))},preventSelection:p=>{(p.shiftKey||p.ctrlKey||p.metaKey||k)&&p.preventDefault()}}}const vs=["classes","className","displayIcon","expansionIcon","icon","label","nodeId","onClick","onMouseDown"],Ut=c.forwardRef(function(n,r){const{classes:l,className:m,displayIcon:d,expansionIcon:b,icon:u,label:y,nodeId:g,onClick:S,onMouseDown:I}=n,E=Ne(n,vs),{disabled:i,expanded:k,selected:a,focused:C,handleExpansion:v,handleSelection:$,preventSelection:p}=Ns(g),w=u||b||d,
|
|
24
|
-
`)),St=!0)},Vs=c.forwardRef(function(n,r){return Ls(),t.jsx(_s,F({},n,{ref:r}))}),Fs=Vs;function lt({data:e,...n}){return!e||!e.length?null:t.jsx(zs,{...n,children:e.map(r=>t.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:t.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}lt.propTypes={data:
|
|
22
|
+
`,rt=c.createContext({registerNode:()=>{},unregisterNode:()=>{},isFocused:()=>!1,isSelected:()=>!1,isExpanded:()=>!1,isExpandable:()=>!1,isDisabled:()=>!1,mapFirstChar:()=>{},unMapFirstChar:()=>{},focus:()=>{},toggleExpansion:()=>{},selectNode:()=>{},selectRange:()=>{},multiSelect:!1,disabledItemsFocusable:!1,treeId:void 0,icons:{defaultCollapseIcon:null,defaultExpandIcon:null,defaultParentIcon:null,defaultEndIcon:null}}),ms=["element"];function hs(e,n){for(let r=0;r<e.length;r+=1)if(n(e[r]))return r;return-1}function xs(e,n){let r=0,l=e.length-1;for(;r<=l;){const m=Math.floor((r+l)/2);if(e[m].element===n)return m;e[m].element.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING?l=m-1:r=m+1}return r}const Wt=c.createContext({});function bs(e){const n=c.useRef(null);return c.useEffect(()=>{n.current=e},[e]),n.current}const jt=()=>{};function gs(e){const[,n]=c.useState(),{registerDescendant:r=jt,unregisterDescendant:l=jt,descendants:m=[],parentId:d=null}=c.useContext(Wt),b=hs(m,g=>g.element===e.element),u=bs(m),y=m.some((g,S)=>u&&u[S]&&u[S].element!==g.element);return Ro(()=>{if(e.element)return r(F({},e,{index:b})),()=>{l(e.element)};n({})},[r,l,b,y,e]),{parentId:d,index:b}}function Kt(e){const{children:n,id:r}=e,[l,m]=c.useState([]),d=c.useCallback(y=>{let{element:g}=y,S=Ne(y,ms);m(I=>{if(I.length===0)return[F({},S,{element:g,index:0})];const E=xs(I,g);let i;if(I[E]&&I[E].element===g)i=I;else{const k=F({},S,{element:g,index:E});i=I.slice(),i.splice(E,0,k)}return i.forEach((k,a)=>{k.index=a}),i})},[]),b=c.useCallback(y=>{m(g=>g.filter(S=>y!==S.element))},[]),u=c.useMemo(()=>({descendants:l,registerDescendant:d,unregisterDescendant:b,parentId:r}),[l,d,b,r]);return t.jsx(Wt.Provider,{value:u,children:n})}function ks(e){return Ze("MuiTreeView",e)}Qe("MuiTreeView",["root"]);const js=["children","className","defaultCollapseIcon","defaultEndIcon","defaultExpanded","defaultExpandIcon","defaultParentIcon","defaultSelected","disabledItemsFocusable","disableSelection","expanded","id","multiSelect","onBlur","onFocus","onKeyDown","onNodeFocus","onNodeSelect","onNodeToggle","selected"],ys=e=>{const{classes:n}=e;return tt({root:["root"]},ks,n)},Cs=ce("ul",{name:"MuiTreeView",slot:"Root",overridesResolver:(e,n)=>n.root})({padding:0,margin:0,listStyle:"none",outline:0});function Ts(e){return e&&e.length===1&&e.match(/\S/)}function yt(e,n,r){for(let l=n;l<e.length;l+=1)if(r===e[l])return l;return-1}function Ct(){return!1}const Ss=[],Is=[],ws=c.forwardRef(function(n,r){var l,m,d,b,u;const y=et({props:n,name:"MuiTreeView"}),g=F({},y,{disabledItemsFocusable:(l=y.disabledItemsFocusable)!=null?l:!1,disableSelection:(m=y.disableSelection)!=null?m:!1,multiSelect:(d=y.multiSelect)!=null?d:!1,defaultExpanded:(b=y.defaultExpanded)!=null?b:Ss,defaultSelected:(u=y.defaultSelected)!=null?u:Is}),{children:S,className:I,defaultCollapseIcon:E,defaultEndIcon:i,defaultExpanded:k,defaultExpandIcon:a,defaultParentIcon:C,defaultSelected:v,disabledItemsFocusable:$,disableSelection:p,expanded:w,id:K,multiSelect:h,onBlur:N,onFocus:U,onKeyDown:ee,onNodeFocus:ae,onNodeSelect:z,onNodeToggle:de,selected:ue}=g,pe=Ne(g,js),ie=Eo().direction==="rtl",fe=ys(g),te=Po(K),oe=c.useRef(null),we=$t(oe,r),[R,Ce]=c.useState(null),M=c.useRef({}),Y=c.useRef({}),[G,x]=bt({controlled:w,default:k,name:"TreeView",state:"expanded"}),[B,O]=bt({controlled:ue,default:v,name:"TreeView",state:"selected"}),L=c.useCallback(o=>Array.isArray(G)?G.indexOf(o)!==-1:!1,[G]),H=c.useCallback(o=>M.current[o]&&M.current[o].expandable,[]),Te=c.useCallback(o=>Array.isArray(B)?B.indexOf(o)!==-1:B===o,[B]),V=c.useCallback(o=>{if(o==null)return!1;let s=M.current[o];if(!s)return!1;if(s.disabled)return!0;for(;s.parentId!=null;)if(s=M.current[s.parentId],s.disabled)return!0;return!1},[]),ve=o=>R===o,me=o=>Object.keys(M.current).map(s=>M.current[s]).filter(s=>s.parentId===o).sort((s,f)=>s.index-f.index).map(s=>s.id),X=o=>{let s=me(o);return $||(s=s.filter(f=>!V(f))),s},Re=o=>{if(L(o)&&X(o).length>0)return X(o)[0];let s=M.current[o];for(;s!=null;){const f=X(s.parentId),T=f[f.indexOf(s.id)+1];if(T)return T;s=M.current[s.parentId]}return null},J=o=>{const s=M.current[o],f=X(s.parentId),T=f.indexOf(o);if(T===0)return s.parentId;let P=f[T-1];for(;L(P)&&X(P).length>0;)P=X(P).pop();return P},he=()=>{let o=X(null).pop();for(;L(o);)o=X(o).pop();return o},Se=()=>X(null)[0],Jt=o=>M.current[o].parentId,Xt=(o,s)=>{if(o===s)return[o,s];const f=M.current[o],T=M.current[s];if(f.parentId===T.id||T.parentId===f.id)return T.parentId===f.id?[f.id,T.id]:[T.id,f.id];const P=[f.id],D=[T.id];let A=f.parentId,q=T.parentId,Q=D.indexOf(A)!==-1,Pe=P.indexOf(q)!==-1,Be=!0,De=!0;for(;!Pe&&!Q;)Be&&(P.push(A),Q=D.indexOf(A)!==-1,Be=A!==null,!Q&&Be&&(A=M.current[A].parentId)),De&&!Q&&(D.push(q),Pe=P.indexOf(q)!==-1,De=q!==null,!Pe&&De&&(q=M.current[q].parentId));const qe=Q?A:q,ht=me(qe),ko=P[P.indexOf(qe)-1],jo=D[D.indexOf(qe)-1];return ht.indexOf(ko)<ht.indexOf(jo)?[o,s]:[s,o]},Gt=(o,s)=>{const[f,T]=Xt(o,s),P=[f];let D=f;for(;D!==T;)D=Re(D),P.push(D);return P},xe=(o,s)=>{s&&(Ce(s),ae&&ae(o,s))},ut=(o,s)=>xe(o,Re(s)),Yt=(o,s)=>xe(o,J(s)),Qt=o=>xe(o,Se()),Zt=o=>xe(o,he()),eo=(o,s,f)=>{let T,P;const D=f.toLowerCase(),A=[],q=[];Object.keys(Y.current).forEach(Q=>{const Pe=M.current[Q],Be=Pe.parentId?L(Pe.parentId):!0,De=$?!1:V(Q);Be&&!De&&(A.push(Q),q.push(Y.current[Q]))}),T=A.indexOf(s)+1,T>=A.length&&(T=0),P=yt(q,T,D),P===-1&&(P=yt(q,0,D)),P>-1&&xe(o,A[P])},Fe=(o,s=R)=>{if(s==null)return;let f;G.indexOf(s)!==-1?f=G.filter(T=>T!==s):f=[s].concat(G),de&&de(o,f),x(f)},to=(o,s)=>{const f=M.current[s],P=me(f.parentId).filter(A=>H(A)&&!L(A)),D=G.concat(P);P.length>0&&(x(D),de&&de(o,D))},be=c.useRef(null),Ee=c.useRef(!1),se=c.useRef([]),oo=(o,s)=>{let f=B.slice();const{start:T,next:P,current:D}=s;!P||!D||(se.current.indexOf(D)===-1&&(se.current=[]),Ee.current?se.current.indexOf(P)!==-1?(f=f.filter(A=>A===T||A!==D),se.current=se.current.filter(A=>A===T||A!==D)):(f.push(P),se.current.push(P)):(f.push(P),se.current.push(D,P)),z&&z(o,f),O(f))},so=(o,s)=>{let f=B.slice();const{start:T,end:P}=s;Ee.current&&(f=f.filter(q=>se.current.indexOf(q)===-1));let D=Gt(T,P);D=D.filter(q=>!V(q)),se.current=D;let A=f.concat(D);A=A.filter((q,Q)=>A.indexOf(q)===Q),z&&z(o,A),O(A)},no=(o,s)=>{if(!Array.isArray(B))return;let f;B.indexOf(s)!==-1?f=B.filter(T=>T!==s):f=[s].concat(B),z&&z(o,f),O(f)},ro=(o,s)=>{const f=h?[s]:s;z&&z(o,f),O(f)},$e=(o,s,f=!1)=>s?(f?no(o,s):ro(o,s),be.current=s,Ee.current=!1,se.current=[],!0):!1,Ie=(o,s,f=!1)=>{const{start:T=be.current,end:P,current:D}=s;f?oo(o,{start:T,next:P,current:D}):T!=null&&P!=null&&so(o,{start:T,end:P}),Ee.current=!0},lo=(o,s)=>{be.current||(be.current=s);const f=Ee.current?be.current:s;Ie(o,{start:f,end:Se()})},ao=(o,s)=>{be.current||(be.current=s);const f=Ee.current?be.current:s;Ie(o,{start:f,end:he()})},io=(o,s)=>{V(Re(s))||Ie(o,{end:Re(s),current:s},!0)},co=(o,s)=>{V(J(s))||Ie(o,{end:J(s),current:s},!0)},uo=o=>{Ie(o,{start:Se(),end:he()})},po=c.useCallback(o=>{const{id:s,index:f,parentId:T,expandable:P,idAttribute:D,disabled:A}=o;M.current[s]={id:s,index:f,parentId:T,expandable:P,idAttribute:D,disabled:A}},[]),fo=c.useCallback(o=>{const s=F({},M.current);delete s[o],M.current=s,Ce(f=>f===o&&oe.current===Bt(oe.current).activeElement?me(null)[0]:f)},[]),mo=c.useCallback((o,s)=>{Y.current[o]=s},[]),ho=c.useCallback(o=>{const s=F({},Y.current);delete s[o],Y.current=s},[]),pt=o=>(R!=null&&H(R)&&(L(R)?ut(o,R):V(R)||Fe(o)),!0),ft=o=>{if(R==null)return!1;if(L(R)&&!V(R))return Fe(o,R),!0;const s=Jt(R);return s?(xe(o,s),!0):!1},xo=o=>{let s=!1;const f=o.key;if(o.altKey||o.currentTarget!==o.target||!R)return;const T=o.ctrlKey||o.metaKey;switch(f){case" ":!p&&R!=null&&!V(R)&&(h&&o.shiftKey?(Ie(o,{end:R}),s=!0):h?s=$e(o,R,!0):s=$e(o,R)),o.stopPropagation();break;case"Enter":V(R)||(H(R)?(Fe(o),s=!0):h?s=$e(o,R,!0):s=$e(o,R)),o.stopPropagation();break;case"ArrowDown":h&&o.shiftKey&&!p&&io(o,R),ut(o,R),s=!0;break;case"ArrowUp":h&&o.shiftKey&&!p&&co(o,R),Yt(o,R),s=!0;break;case"ArrowRight":ie?s=ft(o):s=pt(o);break;case"ArrowLeft":ie?s=pt(o):s=ft(o);break;case"Home":h&&T&&o.shiftKey&&!p&&!V(R)&&lo(o,R),Qt(o),s=!0;break;case"End":h&&T&&o.shiftKey&&!p&&!V(R)&&ao(o,R),Zt(o),s=!0;break;default:f==="*"?(to(o,R),s=!0):h&&T&&f.toLowerCase()==="a"&&!p?(uo(o),s=!0):!T&&!o.shiftKey&&Ts(f)&&(eo(o,R,f),s=!0)}s&&(o.preventDefault(),o.stopPropagation()),ee&&ee(o)},bo=o=>{if(o.target===o.currentTarget){const s=Array.isArray(B)?B[0]:B;xe(o,s||X(null)[0])}U&&U(o)},go=o=>{Ce(null),N&&N(o)},mt=M.current[R]?M.current[R].idAttribute:null;return t.jsx(rt.Provider,{value:{icons:{defaultCollapseIcon:E,defaultExpandIcon:a,defaultParentIcon:C,defaultEndIcon:i},focus:xe,toggleExpansion:Fe,isExpanded:L,isExpandable:H,isFocused:ve,isSelected:Te,isDisabled:V,selectNode:p?Ct:$e,selectRange:p?Ct:Ie,multiSelect:h,disabledItemsFocusable:$,mapFirstChar:mo,unMapFirstChar:ho,registerNode:po,unregisterNode:fo,treeId:te},children:t.jsx(Kt,{children:t.jsx(Cs,F({role:"tree",id:te,"aria-activedescendant":mt??void 0,"aria-multiselectable":h,className:He(fe.root,I),tabIndex:0,onKeyDown:xo,onFocus:bo,onBlur:go,ownerState:g},pe,{ref:we,children:S}))})})});let Tt=!1;const Rs=()=>{Tt||(console.warn(["MUI: The TreeView component was moved from `@mui/lab` to `@mui/x-tree-view`.","The component will no longer be exported from `@mui/lab` in the first release of October 2023.","","You should use `import { TreeView } from '@mui/x-tree-view'`","or `import { TreeView } from '@mui/x-tree-view/TreeView'`","","More information about this migration on our blog: https://mui.com/blog/lab-tree-view-to-mui-x/."].join(`
|
|
23
|
+
`)),Tt=!0)},Es=c.forwardRef(function(n,r){return Rs(),t.jsx(ws,F({},n,{ref:r}))}),Ps=Es;function Ns(e){const{focus:n,isExpanded:r,isExpandable:l,isFocused:m,isDisabled:d,isSelected:b,multiSelect:u,selectNode:y,selectRange:g,toggleExpansion:S}=c.useContext(rt),I=l?l(e):!1,E=r?r(e):!1,i=m?m(e):!1,k=d?d(e):!1,a=b?b(e):!1;return{disabled:k,expanded:E,selected:a,focused:i,handleExpansion:p=>{if(!k){i||n(p,e);const w=u&&(p.shiftKey||p.ctrlKey||p.metaKey);I&&!(w&&r(e))&&S(p,e)}},handleSelection:p=>{k||(i||n(p,e),u&&(p.shiftKey||p.ctrlKey||p.metaKey)?p.shiftKey?g(p,{end:e}):y(p,e,!0):y(p,e))},preventSelection:p=>{(p.shiftKey||p.ctrlKey||p.metaKey||k)&&p.preventDefault()}}}const vs=["classes","className","displayIcon","expansionIcon","icon","label","nodeId","onClick","onMouseDown"],Ut=c.forwardRef(function(n,r){const{classes:l,className:m,displayIcon:d,expansionIcon:b,icon:u,label:y,nodeId:g,onClick:S,onMouseDown:I}=n,E=Ne(n,vs),{disabled:i,expanded:k,selected:a,focused:C,handleExpansion:v,handleSelection:$,preventSelection:p}=Ns(g),w=u||b||d,K=N=>{p(N),I&&I(N)},h=N=>{v(N),$(N),S&&S(N)};return t.jsxs("div",F({},E,{className:He(m,l.root,k&&l.expanded,a&&l.selected,C&&l.focused,i&&l.disabled),onClick:h,onMouseDown:K,ref:r,children:[t.jsx("div",{className:l.iconContainer,children:w}),t.jsx("div",{className:l.label,children:y})]}))});function $s(e){return Ze("MuiTreeItem",e)}const ge=Qe("MuiTreeItem",["root","group","content","expanded","selected","focused","disabled","iconContainer","label"]),Bs=["children","className","collapseIcon","ContentComponent","ContentProps","endIcon","expandIcon","disabled","icon","id","label","nodeId","onClick","onMouseDown","TransitionComponent","TransitionProps"],Ds=e=>{const{classes:n}=e;return tt({root:["root"],content:["content"],expanded:["expanded"],selected:["selected"],focused:["focused"],disabled:["disabled"],iconContainer:["iconContainer"],label:["label"],group:["group"]},$s,n)},As=ce("li",{name:"MuiTreeItem",slot:"Root",overridesResolver:(e,n)=>n.root})({listStyle:"none",margin:0,padding:0,outline:0}),Ms=ce(Ut,{name:"MuiTreeItem",slot:"Content",overridesResolver:(e,n)=>[n.content,n.iconContainer&&{[`& .${ge.iconContainer}`]:n.iconContainer},n.label&&{[`& .${ge.label}`]:n.label}]})(({theme:e})=>({padding:"0 8px",width:"100%",display:"flex",alignItems:"center",cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${ge.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent"},[`&.${ge.focused}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${ge.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:ze(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:ze(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:ze(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${ge.focused}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:ze(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`& .${ge.iconContainer}`]:{marginRight:4,width:15,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}},[`& .${ge.label}`]:F({width:"100%",minWidth:0,paddingLeft:4,position:"relative"},e.typography.body1)})),Os=ce(Dt,{name:"MuiTreeItem",slot:"Group",overridesResolver:(e,n)=>n.group})({margin:0,padding:0,marginLeft:17}),_s=c.forwardRef(function(n,r){const l=et({props:n,name:"MuiTreeItem"}),{children:m,className:d,collapseIcon:b,ContentComponent:u=Ut,ContentProps:y,endIcon:g,expandIcon:S,disabled:I,icon:E,id:i,label:k,nodeId:a,onClick:C,onMouseDown:v,TransitionComponent:$=Dt,TransitionProps:p}=l,w=Ne(l,Bs),{icons:K,focus:h,isExpanded:N,isFocused:U,isSelected:ee,isDisabled:ae,multiSelect:z,disabledItemsFocusable:de,mapFirstChar:ue,unMapFirstChar:pe,registerNode:ye,unregisterNode:ie,treeId:fe}=c.useContext(rt);let te;i!=null?te=i:fe&&a&&(te=`${fe}-${a}`);const[oe,we]=c.useState(null),R=c.useRef(null),Ce=$t(we,r),M=c.useMemo(()=>({element:oe,id:a}),[a,oe]),{index:Y,parentId:G}=gs(M),x=!!(Array.isArray(m)?m.length:m),B=N?N(a):!1,O=U?U(a):!1,L=ee?ee(a):!1,H=ae?ae(a):!1,Te=F({},l,{expanded:B,focused:O,selected:L,disabled:H}),V=Ds(Te);let ve,me;x&&(B?me=b||K.defaultCollapseIcon:me=S||K.defaultExpandIcon),x?ve=K.defaultParentIcon:ve=g||K.defaultEndIcon,c.useEffect(()=>{if(ye&&ie&&Y!==-1)return ye({id:a,idAttribute:te,index:Y,parentId:G,expandable:x,disabled:I}),()=>{ie(a)}},[ye,ie,G,Y,a,x,I,te]),c.useEffect(()=>{if(ue&&pe&&k){var J,he;return ue(a,((J=(he=R.current)==null?void 0:he.textContent)!=null?J:"").substring(0,1).toLowerCase()),()=>{pe(a)}}},[ue,pe,a,k]);let X;z?X=L:L&&(X=!0);function Re(J){if(J.target===J.currentTarget){let Se;typeof J.target.getRootNode=="function"?Se=J.target.getRootNode():Se=Bt(J.target),Se.getElementById(fe).focus({preventScroll:!0})}const he=!de&&H;!O&&J.currentTarget===J.target&&!he&&h(J,a)}return t.jsxs(As,F({className:He(V.root,d),role:"treeitem","aria-expanded":x?B:void 0,"aria-selected":X,"aria-disabled":H||void 0,id:te,tabIndex:-1},w,{ownerState:Te,onFocus:Re,ref:Ce,children:[t.jsx(Ms,F({as:u,ref:R,classes:{root:V.content,expanded:V.expanded,selected:V.selected,focused:V.focused,disabled:V.disabled,iconContainer:V.iconContainer,label:V.label},label:k,nodeId:a,onClick:C,onMouseDown:v,icon:E,expansionIcon:me,displayIcon:ve,ownerState:Te},y)),m&&t.jsx(Kt,{id:a,children:t.jsx(Os,F({as:$,unmountOnExit:!0,className:V.group,in:B,component:"ul",role:"group"},p,{children:m}))})]}))});let St=!1;const Ls=()=>{St||(console.warn(["MUI: The TreeItem component was moved from `@mui/lab` to `@mui/x-tree-view`.","The component will no longer be exported from `@mui/lab` in the first release of October 2023.","","You should use `import { TreeItem } from '@mui/x-tree-view'`","or `import { TreeItem } from '@mui/x-tree-view/TreeItem'`","","More information about this migration on our blog: https://mui.com/blog/lab-tree-view-to-mui-x/."].join(`
|
|
24
|
+
`)),St=!0)},Vs=c.forwardRef(function(n,r){return Ls(),t.jsx(_s,F({},n,{ref:r}))}),Fs=Vs;function lt({data:e,...n}){return!e||!e.length?null:t.jsx(zs,{...n,children:e.map(r=>t.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:t.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}lt.propTypes={data:W.arrayOf(W.shape({url:W.string,alt:W.string}))};lt.defaultProps={data:[]};const zs=je(j)`
|
|
25
25
|
display: flex;
|
|
26
26
|
justify-content: flex-start;
|
|
27
27
|
flex-wrap: wrap;
|
|
@@ -35,7 +35,7 @@ import{aj as yo,j as t,az as ce,bO as Co,aB as F,en as xt,aD as Ne,ax as Qe,ay a
|
|
|
35
35
|
margin-right: 12px;
|
|
36
36
|
margin-bottom: 12px;
|
|
37
37
|
}
|
|
38
|
-
`,Xe=(e,n)=>{const r=[...e];for(;r.length>0;){const l=r.shift();if(l.id===n)return l;l.children&&r.push(...l.children)}return[]};function at({icon:e}){return e?
|
|
38
|
+
`,Xe=(e,n)=>{const r=[...e];for(;r.length>0;){const l=r.shift();if(l.id===n)return l;l.children&&r.push(...l.children)}return[]};function at({icon:e}){return e?Wo(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(No,{className:"resource-icon",icon:e}):null}at.propTypes={icon:W.string};at.defaultProps={icon:""};function it({disabled:e,data:n,onChange:r,value:l}){const m=l;function d(i,k=[]){return k.push(i.id),i.children&&i.children.forEach(a=>d(a,k)),k}const b=i=>d(Xe(n,i)),u=(i,k=[])=>{const a=Xe(n,i);return a.parent?(k.push(a.parent),u(a.parent,k)):k};function y(i,k){const a=b(i.id),C=a.indexOf(i.id);return a.splice(C,1),a.every(v=>m.concat(k).includes(v))}const g=(i,k)=>{i.stopPropagation();const a=b(k),C=u(k);if(m.includes(k)){const v=m.filter($=>!a.concat(C).includes($));r(v)}else{const v=a;for(let $=0;$<C.length;++$)y(Xe(n,C[$]),v)&&v.push(C[$]);r([...m].concat(v))}},S=i=>{i.stopPropagation()},I=n.some(i=>{var k;return((k=i.children)==null?void 0:k.length)>0}),E=i=>{var k;return t.jsx(Fs,{nodeId:i.id,label:t.jsx(Ho,{onClick:S,control:t.jsx(qo,{size:"small",checked:m.indexOf(i.id)!==-1,tabIndex:-1,disableRipple:!0,onClick:a=>g(a,i.id),disabled:e}),label:t.jsxs(j,{className:"content",children:[t.jsxs(j,{display:"flex",alignItems:"center",children:[i.icon&&t.jsx(at,{icon:i.icon}),t.jsx(j,{className:"name",children:i.name}),i.url&&t.jsx("a",{href:i.url,target:"_blank",rel:"noreferrer",className:"link",children:t.jsx(Uo,{className:"link-icon"})})]}),!!i.description&&t.jsx(j,{className:"description",children:i.description}),!!((k=i.images)!=null&&k.length)&&t.jsx(lt,{className:"images",data:i.images})]})}),children:Array.isArray(i.children)?i.children.map(E):null},i.id)};return t.jsx(Ws,{className:Vt(!I&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(Ko,{}),defaultExpandIcon:t.jsx(_o,{}),selected:m,children:n.map(i=>E(i))})}it.propTypes={data:W.array,value:W.array,onChange:W.func,disabled:W.bool};it.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const Ws=je(Ps)`
|
|
39
39
|
&.no-children {
|
|
40
40
|
.MuiTreeItem-content {
|
|
41
41
|
padding: 0;
|
|
@@ -90,7 +90,7 @@ import{aj as yo,j as t,az as ce,bO as Co,aB as F,en as xt,aD as Ne,ax as Qe,ay a
|
|
|
90
90
|
font-size: 14px;
|
|
91
91
|
color: ${({theme:e})=>e.palette.text.secondary};
|
|
92
92
|
}
|
|
93
|
-
`,
|
|
93
|
+
`,Ht=(e,n)=>(e.forEach(r=>{n&&(r.parent=n),(r.children||[]).forEach(l=>{l.parent=r.id,Ht(l.children||[],l.id)})}),e);function ct({app:e,component:n,projectId:r,release:l,error:m,onSave:d}){const{t:b,locale:u}=Me(),{api:y}=Oe(),[g,S]=c.useState([]),[I,E]=c.useState([]),[i,k]=c.useState(!1),a=l.id,C=l.status==="published",{resourceExportApi:v="/"}=(n==null?void 0:n.meta.capabilities)||{},$=new URL(ot("http://127.0.0.1",n.mountPoint,v||"/").replace(/\/+/g,"/"));$.searchParams.set("projectId",r),$.searchParams.set("releaseId",a),$.searchParams.set("local",u);const p=`${$.pathname}${$.search}`,w=async h=>{try{await y.updateSelectedResources({input:{did:e.meta.did,projectId:r,releaseId:a,componentDid:n.meta.did,resources:h}})}catch(N){_.error(N.message)}},K=async()=>{const h=I;try{k(!0),await gt.post(p,{resources:h,projectId:r,releaseId:a,locale:u}),_.success(b("common.saveSuccess")),k(!1),w(I),d(I)}catch(N){k(!1),_.error(N.message)}};return c.useEffect(()=>{gt.get(p).then(h=>{var U;const N=Ht(((U=h.data)==null?void 0:U.resources)||[]);S(N)}).catch(h=>{_.error(h.message)}),y.getSelectedResources({input:{did:e.meta.did,projectId:r,releaseId:a,componentDid:n.meta.did}}).then(h=>{const N=(h==null?void 0:h.resources)||[];E(N)}).catch(h=>{_.error(h.message)})},[p]),n.status!=="running"?t.jsx(It,{children:t.jsx(j,{pt:6,children:b("blocklet.publish.componentNotRunning",{name:n.meta.title})})}):[t.jsx(It,{className:Vt(m&&"error"),children:t.jsxs(j,{children:[t.jsx(it,{data:g,value:I,onChange:h=>{E(h)},disabled:i||C}),!C&&t.jsx(j,{className:"footer",children:t.jsx(le,{variant:"contained",disabled:i,onClick:()=>K(),children:b("common.save")})})]})}),!!m&&t.jsx(j,{color:"error.main",mt:1,fontSize:14,children:m})]}ct.propTypes={component:W.object.isRequired,app:W.object.isRequired,projectId:W.string.isRequired,error:W.string,release:W.shape({id:W.string.isRequired,status:W.string}),onSave:W.func};ct.defaultProps={error:"",release:{id:""},onSave:()=>{}};const It=je(j)`
|
|
94
94
|
border: 1px solid #ccc;
|
|
95
95
|
&.error {
|
|
96
96
|
border-color: ${e=>e.theme.palette.error.main};
|
|
@@ -110,7 +110,7 @@ import{aj as yo,j as t,az as ce,bO as Co,aB as F,en as xt,aD as Ne,ax as Qe,ay a
|
|
|
110
110
|
background: #fff;
|
|
111
111
|
z-index: 10;
|
|
112
112
|
}
|
|
113
|
-
`,wt=["image/*",".jpg",".jpeg",".png",".gif",".svg"],Rt=1024*1024*10,Et=c.lazy(()=>$o(()=>import("./react-47aaa975.js").then(e=>e.r),["assets/react-47aaa975.js","assets/index-485b5b11.js","assets/index-d8bbb108.css","assets/index-c550be87.js","assets/preact.module-c0a7ffab.js","assets/index-26b1e0dd.js","assets/index-8937c3ad.js","assets/memoize-one.esm-034844b1.js","assets/uniqBy-33f8a43d.js","assets/react-1ee50eda.css"]).then(e=>({default:e.Uploader}))),Ws=(e,n,r)=>{const l=[];return e.blockletTitle||l.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),e.blockletVersion?We.valid(e.blockletVersion)||l.push({param:"blockletVersion",message:"Invalid Blocklet Version"}):l.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===ne.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||l.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),e.note||l.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),l.length?l:null},Us=({tabs:e,blocklet:n,ancestors:r=[]})=>{const l=n.meta.did;e.push({label:t.jsxs(j,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:24,blocklet:n,ancestors:r}),t.jsx(j,{ml:"4px",className:"text",children:t.jsx(j,{children:n.meta.title})})]},l),value:l})},Pt=e=>{const n=Bo(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","note"]);return n.blockletScreenshots||(n.blockletScreenshots=[]),n};function dt({...e}){var O,Y,G;const n=vt(),{projectId:r,releaseId:l,componentDid:m}=Le(),{t:d}=Oe(),{blocklet:b}=_e(),[u,y]=Oo(null),[g,S]=c.useState({}),[I,E]=c.useState(!1),[i,k]=c.useState(!1),[a,C]=c.useState(null),{api:v}=Me(),$=c.useRef(null),p=c.useRef(null),w=l==="create"?"":l,W=l==="create"?"create":"edit",h=[],N=((b==null?void 0:b.children)||[]).filter(x=>x.meta.capabilities.resourceExportApi).filter(x=>!m||x.meta.did===m);N.forEach(x=>{Us({tabs:h,blocklet:x,t:d,ancestors:[b]})});const[U,ee]=c.useState((O=h[0])==null?void 0:O.value),ae=(a==null?void 0:a.status)==="published",z=ae,de=()=>{v.getProject({input:{did:b.meta.did,projectId:r}}).then(x=>{E(!1);const B=x.project||{};B.blockletVersion?We.valid(B.blockletVersion)&&(B.blockletVersion=We.inc(B.blockletVersion,"patch")):B.blockletVersion="1.0.0",y(Pt(B))}).catch(x=>{E(!1),_.error(Je(x))})},ue=()=>{v.getRelease({input:{did:b.meta.did,projectId:r,releaseId:w}}).then(x=>{E(!1),y(Pt(x==null?void 0:x.release)),C(x==null?void 0:x.release)}).catch(x=>{E(!1),_.error(Je(x))})},pe=c.useCallback(()=>{if(W==="edit"){if(!w){_.error("Empty release id");return}ue()}W==="create"&&de()},[W,w]);c.useEffect(()=>{pe()},[pe]);const ye=x=>{const B=Ws(u,x,d);if(B){_.error(B.map(L=>L.message).join("; ")),S(B.reduce((L,q)=>({...L,[q.param]:q.message}),{}));return}const M={...u};if(M.blockletVersion=We.valid(M.blockletVersion),!M.blockletVersion){_.error("Invalid Blocklet Version"),S({blockletVersion:"Invalid Blocklet Version"});return}M.blockletTitle=(M.blockletTitle||"").trim(),M.blockletDescription=(M.blockletDescription||"").trim(),M.blockletIntroduction=(M.blockletIntroduction||"").trim(),M.note=(M.note||"").trim(),k(x),E(!0),v.createRelease({input:{...M,did:b.meta.did,projectId:r,releaseId:w,status:x}}).then(L=>{var q;if(k(!1),E(!1),x==="draft"?_.success(d("blocklet.publish.saveDraftSuccess")):_.success(d("blocklet.publish.createReleaseSuccess")),W==="create"){const Te=(q=L==null?void 0:L.release)==null?void 0:q.id;n(`../${r}/${Te}`,{replace:!0})}else ue()}).catch(L=>{k(!1),E(!1);const q=Je(L);_.error(q),/resource.*empty/.test(q)&&S({blockletResource:q})})};if(!u&&I)return t.jsx(Ve,{});if(!u)return null;const ie=`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${r}/logo/upload`,fe=`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${r}/screenshot/upload`,te=u!=null&&u.blockletLogo?`${ie}/${u.blockletLogo}`:`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,oe=((u==null?void 0:u.blockletScreenshots)||[]).filter(Boolean).map(x=>`${fe}/${x}`),we=N.find(x=>x.meta.did===U),R=we?t.jsx(j,{children:t.jsx(ct,{error:g.blockletResource,app:b,component:we,projectId:r,release:{...a,id:w},onSave:x=>{x.length&&S({blockletResource:""})}})}):t.jsx(j,{display:"flex",mt:-3,children:t.jsx(vo,{children:d("common.empty")})}),Ce=x=>{ee(x)};return t.jsxs(qs,{...e,children:[t.jsxs(j,{className:"sticky-header",children:[t.jsxs(st,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(re,{to:"../",children:d("common.publish")}),t.jsx(re,{to:`../${r}`,children:(u==null?void 0:u.blockletTitle)||"Blocklet"}),t.jsx(Z,{color:"text.primary",children:W==="create"?d("common.create"):(u==null?void 0:u.blockletVersion)||d("common.edit")})]}),t.jsxs(j,{display:"flex",children:[!ae&&t.jsxs(t.Fragment,{children:[t.jsxs(le,{variant:"outlined",disabled:I||i,onClick:()=>ye(ne.PROJECT.RELEASE_STATUS.draft),style:{marginRight:12},children:[i===ne.PROJECT.RELEASE_STATUS.draft&&t.jsx(Ge,{size:14,sx:{mr:.5}}),d("blocklet.publish.saveDraft")]}),t.jsxs(le,{variant:"contained",disabled:I||i,onClick:()=>ye(ne.PROJECT.RELEASE_STATUS.published),children:[i===ne.PROJECT.RELEASE_STATUS.published&&t.jsx(Ge,{size:14,sx:{mr:.5},color:"inherit"}),d("common.release")]})]}),ae&&t.jsx(le,{variant:"contained",children:t.jsx("a",{href:ot(`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${r}/${w}/download/${(a.files||[])[0]}`),children:d("common.download")})})]})]}),t.jsxs(j,{pt:3,children:[t.jsxs(j,{display:"flex",className:"section",children:[t.jsx(Z,{variant:"h3",className:"left",children:d("blocklet.publish.productTitle")}),t.jsxs(j,{sx:{flex:1},children:[t.jsx(ke,{label:`Blocklet ${d("common.title")}`,placeholder:`Blocklet ${d("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:z},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:u.blockletTitle||"",onChange:x=>{S({blockletTitle:""}),y({blockletTitle:x.target.value})},error:!!g.blockletTitle,helperText:g.blockletTitle||""}),t.jsx(ke,{label:`Blocklet ${d("common.description")}`,placeholder:`Blocklet ${d("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:z},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:u.blockletDescription||"",onChange:x=>{S({blockletDescription:""}),y({blockletDescription:x.target.value})},error:!!g.blockletDescription,helperText:g.blockletDescription||"",sx:{mt:3}}),t.jsx(ke,{label:`Blocklet ${d("common.introduction")}`,placeholder:`Blocklet ${d("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:z,endAdornment:t.jsxs(Ye,{position:"end",children:[((Y=u==null?void 0:u.blockletIntroduction)==null?void 0:Y.length)||0," / ",ne.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:u.blockletIntroduction||"",onChange:x=>{S({blockletIntroduction:""}),y({blockletIntroduction:x.target.value.slice(0,ne.PROJECT.MAX_INTRO_LENGTH)})},error:!!g.blockletIntroduction,helperText:g.blockletIntroduction||"",sx:{mt:3}})]})]}),t.jsxs(j,{display:"flex",mt:3,className:"section",children:[t.jsx(Z,{variant:"h3",className:"left",children:d("blocklet.publish.versionTitle")}),t.jsxs(j,{sx:{flex:1},children:[t.jsx(ke,{required:!0,label:`Blocklet ${d("common.version")}`,placeholder:`Blocklet ${d("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:z},autoComplete:"off",variant:"outlined",fullWidth:!0,value:u.blockletVersion,onChange:x=>{S({blockletVersion:""}),y({blockletVersion:x.target.value})},error:!!g.blockletVersion,helperText:g.blockletVersion||""}),t.jsx(ke,{label:d("blocklet.publish.releaseNote"),autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:z,endAdornment:t.jsxs(Ye,{position:"end",children:[((G=u==null?void 0:u.note)==null?void 0:G.length)||0," / ",ne.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:u.note,onChange:x=>{S({note:""}),y({note:x.target.value.slice(0,ne.PROJECT.MAX_NOTE_LENGTH)})},error:!!g.note,helperText:g.note||"",sx:{mt:3}})]})]}),t.jsxs(j,{display:"flex",mt:3,className:"section full-width",children:[t.jsx(Z,{variant:"h3",className:"left",children:d("blocklet.publish.imgTitle")}),t.jsxs(j,{sx:{flex:1},children:[t.jsxs(j,{display:"flex",children:[t.jsx(Z,{variant:"subtitle1",sx:{mr:2},children:d("common.logo")}),t.jsx(j,{sx:{flex:1,cursor:z?"default":"pointer"},children:t.jsx(Jo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:te,onClick:()=>!z&&$.current.open()})})]}),t.jsxs(j,{display:"flex",mt:3,children:[t.jsx(Z,{variant:"subtitle1",sx:{mr:2},children:d("common.screenshot")}),t.jsxs(j,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[oe.map((x,B)=>t.jsxs(j,{className:"screenshot",children:[t.jsx("img",{alt:"screenshot",src:x}),!z&&t.jsx(Ue,{className:"action",onClick:()=>{const M=[...u.blockletScreenshots];M.splice(B,1),y({blockletScreenshots:M})},children:t.jsx(Fo,{})})]})),oe.length<5&&t.jsx(j,{sx:{width:200,height:140,background:"#eee",cursor:z?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>!z&&p.current.open(),children:"+"})]})]})]}),t.jsx(Et,{id:"uploader-logo",ref:$,popup:!0,onUploadFinish:x=>{y({blockletLogo:x.data.filename}),$.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:ie,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:wt,maxFileSize:Rt,maxNumberOfFiles:1}}},"uploader-logo"),t.jsx(Et,{id:"uploader-screenshot",ref:p,popup:!0,onUploadFinish:x=>{var M;const B=u.blockletScreenshots||[];B.push((M=x.data)==null?void 0:M.filename),y({blockletScreenshots:B}),p.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:fe,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:wt,maxFileSize:Rt,maxNumberOfFiles:5-oe.length}}},"uploader-screenshot")]}),t.jsxs(j,{display:"flex",mt:3,className:"section full-width",children:[t.jsx(j,{className:"left",children:t.jsx(Z,{variant:"h3",children:d("blocklet.publish.resourceTitle")})}),t.jsxs(j,{sx:{flex:1},children:[t.jsx(zo,{tabs:h,current:U,onChange:Ce,sx:{ml:-2,mt:-1.5}}),t.jsx(j,{children:R})]})]})]})]})}dt.propTypes={};dt.defaultProps={};const qs=je.div`
|
|
113
|
+
`,wt=["image/*",".jpg",".jpeg",".png",".gif",".svg"],Rt=1024*1024*10,Et=c.lazy(()=>$o(()=>import("./react-fb9eff86.js").then(e=>e.r),["assets/react-fb9eff86.js","assets/index-53d55e82.js","assets/index-d8bbb108.css","assets/index-7dfff741.js","assets/preact.module-c0a7ffab.js","assets/index-48d4efa9.js","assets/index-3fb520ed.js","assets/memoize-one.esm-42dfe724.js","assets/uniqBy-30d716d5.js","assets/react-1ee50eda.css"]).then(e=>({default:e.Uploader}))),Ks=(e,n,r)=>{const l=[];return e.blockletTitle||l.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),e.blockletVersion?Ke.valid(e.blockletVersion)||l.push({param:"blockletVersion",message:"Invalid Blocklet Version"}):l.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===ne.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||l.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),e.note||l.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),l.length?l:null},Us=({tabs:e,blocklet:n,ancestors:r=[]})=>{const l=n.meta.did;e.push({label:t.jsxs(j,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:24,blocklet:n,ancestors:r}),t.jsx(j,{ml:"4px",className:"text",children:t.jsx(j,{children:n.meta.title})})]},l),value:l})},Pt=e=>{const n=Bo(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","note"]);return n.blockletScreenshots||(n.blockletScreenshots=[]),n};function dt({...e}){var M,Y,G;const n=vt(),{projectId:r,releaseId:l,componentDid:m}=Le(),{t:d}=Me(),{blocklet:b}=_e(),[u,y]=Mo(null),[g,S]=c.useState({}),[I,E]=c.useState(!1),[i,k]=c.useState(!1),[a,C]=c.useState(null),{api:v}=Oe(),$=c.useRef(null),p=c.useRef(null),w=l==="create"?"":l,K=l==="create"?"create":"edit",h=[],N=((b==null?void 0:b.children)||[]).filter(x=>x.meta.capabilities.resourceExportApi).filter(x=>!m||x.meta.did===m);N.forEach(x=>{Us({tabs:h,blocklet:x,t:d,ancestors:[b]})});const[U,ee]=c.useState((M=h[0])==null?void 0:M.value),ae=(a==null?void 0:a.status)==="published",z=ae,de=()=>{v.getProject({input:{did:b.meta.did,projectId:r}}).then(x=>{E(!1);const B=x.project||{};B.blockletVersion?Ke.valid(B.blockletVersion)&&(B.blockletVersion=Ke.inc(B.blockletVersion,"patch")):B.blockletVersion="1.0.0",y(Pt(B))}).catch(x=>{E(!1),_.error(Je(x))})},ue=()=>{v.getRelease({input:{did:b.meta.did,projectId:r,releaseId:w}}).then(x=>{E(!1),y(Pt(x==null?void 0:x.release)),C(x==null?void 0:x.release)}).catch(x=>{E(!1),_.error(Je(x))})},pe=c.useCallback(()=>{if(K==="edit"){if(!w){_.error("Empty release id");return}ue()}K==="create"&&de()},[K,w]);c.useEffect(()=>{pe()},[pe]);const ye=x=>{const B=Ks(u,x,d);if(B){_.error(B.map(L=>L.message).join("; ")),S(B.reduce((L,H)=>({...L,[H.param]:H.message}),{}));return}const O={...u};if(O.blockletVersion=Ke.valid(O.blockletVersion),!O.blockletVersion){_.error("Invalid Blocklet Version"),S({blockletVersion:"Invalid Blocklet Version"});return}O.blockletTitle=(O.blockletTitle||"").trim(),O.blockletDescription=(O.blockletDescription||"").trim(),O.blockletIntroduction=(O.blockletIntroduction||"").trim(),O.note=(O.note||"").trim(),k(x),E(!0),v.createRelease({input:{...O,did:b.meta.did,projectId:r,releaseId:w,status:x}}).then(L=>{var H;if(k(!1),E(!1),x==="draft"?_.success(d("blocklet.publish.saveDraftSuccess")):_.success(d("blocklet.publish.createReleaseSuccess")),K==="create"){const Te=(H=L==null?void 0:L.release)==null?void 0:H.id;n(`../${r}/${Te}`,{replace:!0})}else ue()}).catch(L=>{k(!1),E(!1);const H=Je(L);_.error(H),/resource.*empty/.test(H)&&S({blockletResource:H})})};if(!u&&I)return t.jsx(Ve,{});if(!u)return null;const ie=`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${r}/logo/upload`,fe=`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${r}/screenshot/upload`,te=u!=null&&u.blockletLogo?`${ie}/${u.blockletLogo}`:`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,oe=((u==null?void 0:u.blockletScreenshots)||[]).filter(Boolean).map(x=>`${fe}/${x}`),we=N.find(x=>x.meta.did===U),R=we?t.jsx(j,{children:t.jsx(ct,{error:g.blockletResource,app:b,component:we,projectId:r,release:{...a,id:w},onSave:x=>{x.length&&S({blockletResource:""})}})}):t.jsx(j,{display:"flex",mt:-3,children:t.jsx(vo,{children:d("common.empty")})}),Ce=x=>{ee(x)};return t.jsxs(Hs,{...e,children:[t.jsxs(j,{className:"sticky-header",children:[t.jsxs(st,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(re,{to:"../",children:d("common.publish")}),t.jsx(re,{to:`../${r}`,children:(u==null?void 0:u.blockletTitle)||"Blocklet"}),t.jsx(Z,{color:"text.primary",children:K==="create"?d("common.create"):(u==null?void 0:u.blockletVersion)||d("common.edit")})]}),t.jsxs(j,{display:"flex",children:[!ae&&t.jsxs(t.Fragment,{children:[t.jsxs(le,{variant:"outlined",disabled:I||i,onClick:()=>ye(ne.PROJECT.RELEASE_STATUS.draft),style:{marginRight:12},children:[i===ne.PROJECT.RELEASE_STATUS.draft&&t.jsx(Ge,{size:14,sx:{mr:.5}}),d("blocklet.publish.saveDraft")]}),t.jsxs(le,{variant:"contained",disabled:I||i,onClick:()=>ye(ne.PROJECT.RELEASE_STATUS.published),children:[i===ne.PROJECT.RELEASE_STATUS.published&&t.jsx(Ge,{size:14,sx:{mr:.5},color:"inherit"}),d("common.release")]})]}),ae&&t.jsx(le,{variant:"contained",children:t.jsx("a",{href:ot(`${Ae.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${b.meta.did}/${r}/${w}/download/${(a.files||[])[0]}`),children:d("common.download")})})]})]}),t.jsxs(j,{pt:3,children:[t.jsxs(j,{display:"flex",className:"section",children:[t.jsx(Z,{variant:"h3",className:"left",children:d("blocklet.publish.productTitle")}),t.jsxs(j,{sx:{flex:1},children:[t.jsx(ke,{label:`Blocklet ${d("common.title")}`,placeholder:`Blocklet ${d("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:z},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:u.blockletTitle||"",onChange:x=>{S({blockletTitle:""}),y({blockletTitle:x.target.value})},error:!!g.blockletTitle,helperText:g.blockletTitle||""}),t.jsx(ke,{label:`Blocklet ${d("common.description")}`,placeholder:`Blocklet ${d("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:z},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:u.blockletDescription||"",onChange:x=>{S({blockletDescription:""}),y({blockletDescription:x.target.value})},error:!!g.blockletDescription,helperText:g.blockletDescription||"",sx:{mt:3}}),t.jsx(ke,{label:`Blocklet ${d("common.introduction")}`,placeholder:`Blocklet ${d("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:z,endAdornment:t.jsxs(Ye,{position:"end",children:[((Y=u==null?void 0:u.blockletIntroduction)==null?void 0:Y.length)||0," / ",ne.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:u.blockletIntroduction||"",onChange:x=>{S({blockletIntroduction:""}),y({blockletIntroduction:x.target.value.slice(0,ne.PROJECT.MAX_INTRO_LENGTH)})},error:!!g.blockletIntroduction,helperText:g.blockletIntroduction||"",sx:{mt:3}})]})]}),t.jsxs(j,{display:"flex",mt:3,className:"section",children:[t.jsx(Z,{variant:"h3",className:"left",children:d("blocklet.publish.versionTitle")}),t.jsxs(j,{sx:{flex:1},children:[t.jsx(ke,{required:!0,label:`Blocklet ${d("common.version")}`,placeholder:`Blocklet ${d("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:z},autoComplete:"off",variant:"outlined",fullWidth:!0,value:u.blockletVersion,onChange:x=>{S({blockletVersion:""}),y({blockletVersion:x.target.value})},error:!!g.blockletVersion,helperText:g.blockletVersion||""}),t.jsx(ke,{label:d("blocklet.publish.releaseNote"),autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:z,endAdornment:t.jsxs(Ye,{position:"end",children:[((G=u==null?void 0:u.note)==null?void 0:G.length)||0," / ",ne.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:u.note,onChange:x=>{S({note:""}),y({note:x.target.value.slice(0,ne.PROJECT.MAX_NOTE_LENGTH)})},error:!!g.note,helperText:g.note||"",sx:{mt:3}})]})]}),t.jsxs(j,{display:"flex",mt:3,className:"section full-width",children:[t.jsx(Z,{variant:"h3",className:"left",children:d("blocklet.publish.imgTitle")}),t.jsxs(j,{sx:{flex:1},children:[t.jsxs(j,{display:"flex",children:[t.jsx(Z,{variant:"subtitle1",sx:{mr:2},children:d("common.logo")}),t.jsx(j,{sx:{flex:1,cursor:z?"default":"pointer"},children:t.jsx(Jo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:te,onClick:()=>!z&&$.current.open()})})]}),t.jsxs(j,{display:"flex",mt:3,children:[t.jsx(Z,{variant:"subtitle1",sx:{mr:2},children:d("common.screenshot")}),t.jsxs(j,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[oe.map((x,B)=>t.jsxs(j,{className:"screenshot",children:[t.jsx("img",{alt:"screenshot",src:x}),!z&&t.jsx(Ue,{className:"action",onClick:()=>{const O=[...u.blockletScreenshots];O.splice(B,1),y({blockletScreenshots:O})},children:t.jsx(Fo,{})})]})),oe.length<5&&t.jsx(j,{sx:{width:200,height:140,background:"#eee",cursor:z?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>!z&&p.current.open(),children:"+"})]})]})]}),t.jsx(Et,{id:"uploader-logo",ref:$,popup:!0,onUploadFinish:x=>{y({blockletLogo:x.data.filename}),$.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:ie,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:wt,maxFileSize:Rt,maxNumberOfFiles:1}}},"uploader-logo"),t.jsx(Et,{id:"uploader-screenshot",ref:p,popup:!0,onUploadFinish:x=>{var O;const B=u.blockletScreenshots||[];B.push((O=x.data)==null?void 0:O.filename),y({blockletScreenshots:B}),p.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:fe,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:wt,maxFileSize:Rt,maxNumberOfFiles:5-oe.length}}},"uploader-screenshot")]}),t.jsxs(j,{display:"flex",mt:3,className:"section full-width",children:[t.jsx(j,{className:"left",children:t.jsx(Z,{variant:"h3",children:d("blocklet.publish.resourceTitle")})}),t.jsxs(j,{sx:{flex:1},children:[t.jsx(zo,{tabs:h,current:U,onChange:Ce,sx:{ml:-2,mt:-1.5}}),t.jsx(j,{children:R})]})]})]})]})}dt.propTypes={};dt.defaultProps={};const Hs=je.div`
|
|
114
114
|
.sticky-header {
|
|
115
115
|
margin-top: -12px;
|
|
116
116
|
padding: 12px 0;
|
|
@@ -190,8 +190,8 @@ import{aj as yo,j as t,az as ce,bO as Co,aB as F,en as xt,aD as Ne,ax as Qe,ay a
|
|
|
190
190
|
}
|
|
191
191
|
font-size: 0.8rem;
|
|
192
192
|
}
|
|
193
|
-
`;function
|
|
193
|
+
`;function qt({padding:e}){const{blocklet:n}=_e(),r=Do(),{componentDid:l}=Le();if(c.useEffect(()=>{if(l&&window.parent){const d=`${r.pathname}${r.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:l,path:d},"*")}},[l,r]),!n)return null;const m={};return e&&(m.padding=e),t.jsx(qs,{style:m,children:t.jsxs(Ao,{children:[t.jsx(We,{path:"/",element:t.jsx(Ft,{})}),t.jsx(We,{path:"/create",element:t.jsx(nt,{})}),t.jsx(We,{path:"/:projectId",element:t.jsx(zt,{})}),t.jsx(We,{path:"/:projectId/:releaseId",element:t.jsx(dt,{})})]})})}qt.propTypes={padding:W.oneOfType([W.string,W.number])};qt.defaultProps={padding:""};const qs=je(j)`
|
|
194
194
|
a {
|
|
195
195
|
color: ${({theme:e})=>e.palette.primary.main};
|
|
196
196
|
}
|
|
197
|
-
`;export{
|
|
197
|
+
`;export{qt as default};
|