@abtnode/blocklet-services 1.16.17-beta-4f13d99d → 1.16.17-beta-1cab4b42

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.
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[9253],{70998:function(e,t,n){n.d(t,{Z:function(){return f}});var o=n(33028),l=n(59740),r=n(24974),i=n.n(r),c=n(59467),s=n(62399),a=n(19611),d=n.n(a),u=n(20244),p=n(41395),m=n(24891);var h=n(37574),b=["blocklet","style","size","ancestors"];function f(e){var t=e.blocklet,n=e.style,r=e.size,i=e.ancestors,a=(0,l.Z)(e,b),f=(0,p.h6)(),x=function(e){var t,n=e.blocklet,o=e.ancestors,l=void 0===o?[]:o,r=(0,p.h6)(),i=r.inService,c="?v=".concat(null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.version).concat((0,m.XN)(null===n||void 0===n?void 0:n.status)?"~":""),s=i?d()(m.zn,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",c):d()(r.imgPrefix,"blocklet.png");if("registry"===n.source&&n.deployedFrom&&n.meta.logo)s=d()(n.deployedFrom,(0,m.lk)(n.meta.bundleDid,n.meta.logo),c);else{var a=window.env.apiPrefix||"/",h=l.concat(n),b=i?h.slice(1):h;s=d()(a,"/blocklet/logo-bundle".concat(b.map((function(e){return"/".concat(e.meta.did)})).join("")),c)}return{logoUrl:s,inService:i}}({blocklet:t,ancestors:i}),v=x.logoUrl,j=x.inService,k=a.variant,Z=j?function(){}:function(e){e.target.src="".concat(f.imgPrefix,"/blocklet.png")},g=(0,h.jsx)("img",{src:v,onError:Z,alt:t.meta.name,style:{width:r}});return t.meta.logo||(g=(0,h.jsx)(s.Z,{did:t.meta.did||"",responsive:!0})),(0,h.jsx)(c.Z,(0,o.Z)((0,o.Z)({variant:k||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n)},a),{},{children:g}))}f.propTypes={blocklet:i().object.isRequired,style:i().object,size:i().oneOfType([i().number,i().string]),ancestors:i().array},f.defaultProps={style:{},size:40,ancestors:[]}},49253:function(e,t,n){n.r(t),n.d(t,{default:function(){return Re}});var o=n(71171),l=n(30969),r=n(30734),i=n(16380),c=n(38361),s=n(96234),a=n(86822),d=n(26022),u=n(94551),p=n(10814),m=n(2291),h=n(29996),b=n(1986),f=n(9715),x=n(16438),v=n(45008),j=n(41395),k=n(33028),Z=n(59740),g=n(24974),y=n.n(g),T=n(94308),P=n(37574),E=["size"];function R(e){var t=e.size,n=(0,Z.Z)(e,E);return(0,P.jsx)(c.Z,(0,k.Z)((0,k.Z)({display:"flex",mt:4},n),{},{children:(0,P.jsx)(T.Z,{size:t})}))}R.propTypes={size:y().number},R.defaultProps={size:24};var I,S=n(36558),C=n(8479);function N(){var e=(0,d.PE)(),t=e.t,n=e.locale,o=(0,j.h6)().api,r=(0,l.useState)(!0),i=(0,s.Z)(r,2),k=i[0],Z=i[1],g=(0,v.y0)().blocklet,y=(0,l.useState)(null),T=(0,s.Z)(y,2),E=T[0],I=T[1],N=(0,l.useState)(null),w=(0,s.Z)(N,2),_=w[0],V=w[1],L=function(){o.getProjects({input:{did:g.meta.did}}).then((function(e){var t=(null===e||void 0===e?void 0:e.projects)||[];Z(!1),V(t)})).catch((function(e){Z(!1),b.Z.error(e.message)}))};if((0,l.useEffect)((function(){L()}),[]),!_&&k)return(0,P.jsx)(R,{});if(!_)return null;if(!_.length)return(0,P.jsxs)(c.Z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[(0,P.jsx)(c.Z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.blockletEmptyTip")}),(0,P.jsx)(c.Z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createBlockletTip")}),(0,P.jsx)(a.rU,{to:"create",children:(0,P.jsx)(h.Z,{variant:"contained",children:t("blocklet.publish.createBlocklet")})})]});var z=[{label:"Blocklet",name:"blockletTitle",options:{customBodyRenderLite:function(e){var t=_[e];return(0,P.jsx)(a.rU,{to:"".concat(t.id),children:t.blockletTitle||"/"})}}},{label:"DID",name:"blockletDid",options:{customBodyRender:function(e){return(0,P.jsx)(S.Z,{size:14,responsive:!0,did:e})}}},{label:"Version",name:"blockletVersion",options:{customBodyRender:function(e){return e?(0,P.jsx)(f.Z,{type:"success",children:e}):""}}},{label:t("common.updatedAt"),name:"updatedAt",options:{customBodyRender:function(e){return(0,P.jsx)(x.Z,{value:Number(e),locale:n})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var t=_[e];return(0,P.jsx)(c.Z,{display:"flex",children:(0,P.jsx)(u.Z,{color:"error","aria-label":"delete",onClick:function(){return function(e){I(e)}(t)},children:(0,P.jsx)(p.default,{sx:{fontSize:18}})})})}}}];return(0,P.jsxs)(B,{children:[(0,P.jsx)(c.Z,{sx:{textAlign:"right"},children:(0,P.jsx)(a.rU,{to:"create",children:(0,P.jsx)(h.Z,{variant:"contained",children:t("blocklet.publish.createBlocklet")})})}),(0,P.jsx)(m.Z,{className:"main-table",locale:n,data:_,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),E&&(0,P.jsx)(C.Z,{title:"".concat(t("common.delete")," ").concat(E.blockletTitle),description:t("blocklet.publish.deleteBlockletTip"),confirm:t("common.confirm"),onConfirm:function(){Z(!1);var e=E.id;o.deleteProject({input:{did:g.meta.did,projectId:e}}).then((function(){Z(!1),L(),b.Z.success(t("common.removeSuccess"))})).catch((function(e){Z(!1),b.Z.error(e.message)}))},onCancel:function(){return I(null)}})]})}N.propTypes={};var w,B=(0,i.Z)(c.Z)(I||(I=(0,o.Z)(["\n .main-table > div:first-child {\n display: none;\n }\n"]))),_=n(33665),V=n(2689),L=n(87006),z=n(33359),A=n(15012),O=n(4953),W=n(72836),D=n(77370),U=[{label:{en:"Resource",zh:"\u8d44\u6e90"},value:"resource"},{label:{en:"Application",zh:"\u5e94\u7528"},value:"pack",disabled:!0}];function F(e){var t=Object.assign({},((0,_.Z)(e),e)),n=(0,r.useNavigate)(),o=(0,d.PE)(),i=o.t,u=o.locale,p=(0,v.y0)().blocklet,m=(0,l.useState)(""),f=(0,s.Z)(m,2),x=f[0],Z=f[1],g=(0,l.useState)(!1),y=(0,s.Z)(g,2),T=y[0],E=y[1],R=(0,l.useState)("resource"),I=(0,s.Z)(R,2),S=I[0],C=I[1],N=(0,D.T)().api,w=(0,j.h6)().api,B=(0,l.useState)(),F=(0,s.Z)(B,2),M=F[0],q=F[1],H=(0,l.useState)(!1),K=(0,s.Z)(H,2),J=K[0],G=K[1];return(0,P.jsxs)(X,(0,k.Z)((0,k.Z)({},t),{},{children:[(0,P.jsxs)(A.Z,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,P.jsx)(a.rU,{to:"..",children:i("common.publish")}),(0,P.jsxs)(z.Z,{color:"text.primary",children:[i("common.create")," Blocklet"]})]}),(0,P.jsxs)(c.Z,{style:{maxWidth:500},children:[(0,P.jsx)(L.Z,{required:!0,sx:{mb:4},label:"Blocklet DID",fullWidth:!0,readonly:!0,autoComplete:"off",variant:"outlined",onClick:function(){return!M&&G(!0)},InputProps:{"data-cy":"export-blocklet-did",endAdornment:(0,P.jsx)(O.Z,{position:"end",children:(0,P.jsx)(h.Z,{onClick:function(){return G(!0)},children:i(M?"common.update":"common.create")})})},helperText:"",value:M||""}),J&&(0,P.jsx)(W.default,{open:!0,popup:!0,onClose:function(){return G(!1)},action:"gen-blocklet-key-pair",locale:u,checkFn:N.get,saveConnect:!1,forceConnected:!1,checkTimeout:3e5,onSuccess:function(e){var t,n=null===e||void 0===e||null===(t=e.blockletWallet)||void 0===t?void 0:t.address;n?q(n):b.Z.error("Empty Blocklet DID"),G(!1)},onError:function(e){b.Z.error(e.message),G(!1)},extraParams:{did:p.meta.did},messages:{title:i("blocklet.publish.connect.title"),scan:i("blocklet.publish.connect.scan"),confirm:i("blocklet.publish.connect.confirm"),success:i("blocklet.publish.connect.success")}}),(0,P.jsx)(L.Z,{required:!0,label:"Blocklet ".concat(i("common.title")),autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-title"},fullWidth:!0,helperText:"",value:x||"",onChange:function(e){Z(e.target.value)}}),(0,P.jsx)(L.Z,{sx:{my:4},id:"blocklet-type",select:!0,label:"Blocklet ".concat(i("common.type")),helperText:"",fullWidth:!0,value:S,onChange:function(e){return C(e.target.value)},children:U.map((function(e){return(0,P.jsx)(V.Z,{value:e.value,disabled:e.disabled,children:e.label[u]||e.label.en},e.value)}))})]}),(0,P.jsx)(h.Z,{variant:"contained",disabled:T,onClick:function(){M?x?(E(!0),w.createProject({input:{did:p.meta.did,blockletTitle:x||"",blockletDid:M,type:S}}).then((function(){E(!1),n("../",{replace:!0})})).catch((function(e){E(!1),b.Z.error(e.message)}))):b.Z.error(i("blocklet.publish.errorTip.noTitle")):b.Z.error(i("blocklet.publish.errorTip.noDid"))},children:i("common.create")})]}))}F.propTypes={},F.defaultProps={};var M,X=i.Z.div(w||(w=(0,o.Z)(["\n .breadcrumbs {\n margin-bottom: 24px;\n }\n"]))),q=n(19611),H=n.n(q),K=n(70093),J=n.n(K),G=n(32677),Q=n(20244),Y=n(59505);function $(){var e=(0,d.PE)(),t=e.t,n=e.locale,o=(0,r.useParams)().projectId,i=(0,j.h6)().api,k=(0,l.useState)(!0),Z=(0,s.Z)(k,2),g=Z[0],y=Z[1],T=(0,v.y0)().blocklet,E=(0,l.useState)(null),I=(0,s.Z)(E,2),S=I[0],N=I[1],w=(0,l.useState)(null),B=(0,s.Z)(w,2),_=B[0],V=B[1],L=(0,l.useState)(null),O=(0,s.Z)(L,2),W=O[0],D=O[1];(0,l.useEffect)((function(){i.doBatchQuery({getProject:{input:{did:T.meta.did,projectId:o}},getReleases:{input:{did:T.meta.did,projectId:o}}}).then((function(e){V(e.getProject.project||{}),N(e.getReleases.releases||[]),y(!1)})).catch((function(e){y(!1),b.Z.error(e.message)}))}),[]);if(!S&&g)return(0,P.jsx)(R,{});if(!S)return null;var U=(0,P.jsxs)(A.Z,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,P.jsx)(a.rU,{to:"..",children:t("common.publish")}),(0,P.jsx)(z.Z,{color:"text.primary",children:_.blockletTitle})]});if(!S.length)return(0,P.jsxs)(P.Fragment,{children:[U,(0,P.jsxs)(c.Z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[(0,P.jsx)(c.Z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),(0,P.jsx)(c.Z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),(0,P.jsx)(a.rU,{to:"create",children:(0,P.jsx)(h.Z,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});var F=[{label:t("common.version"),name:"blockletVersion",options:{customBodyRenderLite:function(e){var t=S[e];return(0,P.jsx)(a.rU,{to:"".concat(t.id),children:t.blockletVersion||"/"})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:function(e){var t=S[e];return(0,P.jsx)(z.Z,{className:"note",children:t.note||""})}}},{label:t("common.status"),name:"status",options:{customBodyRender:function(e){return(0,P.jsx)(f.Z,{type:"published"===e?"success":"warning",children:J()(e)})}}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:function(e){var t=S[e];return t.status!==Y.PROJECT.RELEASE_STATUS.published?"":(0,P.jsx)(x.Z,{value:Number(t.updatedAt),locale:n})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var t=S[e];return(0,P.jsxs)(c.Z,{display:"flex",alignItems:"center",children:[(0,P.jsx)(u.Z,{color:"primary","aria-label":"download",disabled:"published"!==t.status,children:"published"===t.status?(0,P.jsx)("a",{style:{display:"flex"},href:H()("".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(T.meta.did,"/").concat(_.id,"/").concat(t.id,"/download/").concat((t.files||[])[0])),children:(0,P.jsx)(G.Z,{sx:{fontSize:18}})}):(0,P.jsx)(G.Z,{sx:{fontSize:18}})}),(0,P.jsx)(u.Z,{color:"error","aria-label":"delete",onClick:function(){return function(e){D(e)}(t)},children:(0,P.jsx)(p.default,{sx:{fontSize:18}})})]})}}}];return(0,P.jsxs)(te,{children:[(0,P.jsxs)(c.Z,{className:"header",children:[U,(0,P.jsx)(a.rU,{to:"create",children:(0,P.jsx)(h.Z,{variant:"contained",children:t("blocklet.publish.createRelease")})})]}),(0,P.jsx)(m.Z,{className:"main-table",verticalKeyWidth:100,locale:n,data:S,columns:F,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),W&&(0,P.jsx)(C.Z,{title:t("".concat(t("common.delete")," ").concat(W.blockletVersion)),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:function(){y(!1);var e=W.id;i.deleteRelease({input:{did:T.meta.did,projectId:o,releaseId:e}}).then((function(){y(!1),i.getReleases({input:{did:T.meta.did,projectId:o}}).then((function(e){var t=(null===e||void 0===e?void 0:e.releases)||[];y(!1),N(t)})).catch((function(e){y(!1),b.Z.error(e.message)})),b.Z.success(t("common.removeSuccess"))})).catch((function(e){y(!1),b.Z.error(e.message)}))},onCancel:function(){return D(null)}})]})}$.propTypes={};var ee,te=(0,i.Z)(c.Z)(M||(M=(0,o.Z)(["\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .main-table > div:first-child {\n display: none;\n }\n .note {\n word-break: break-all;\n white-space: pre-line;\n }\n"]))),ne=n(68079),oe=n(56666),le=n(43178),re=n(49735),ie=n.n(re),ce=n(60451),se=n.n(ce),ae=n(59467),de=n(30291),ue=n(19865),pe=n(78789),me=n(70998),he=n(24891);function be(e){e.app;var t=e.component,n=e.projectId,o=e.release,r=(0,d.PE)(),i=r.t,s=r.locale,a=(0,l.useRef)(null),u=o.id,p="published"===o.status,m=((null===t||void 0===t?void 0:t.meta.capabilities)||{}).resourceExportPage,h=void 0===m?"/":m,b=new URL(H()("http://127.0.0.1",t.mountPoint,h).replace(/\/+/g,"/"));b.searchParams.set("projectId",n),b.searchParams.set("releaseId",u),b.searchParams.set("local",s),p&&b.searchParams.set("readonly","1");var f="".concat(b.pathname).concat(b.search);return"running"!==t.status?(0,P.jsx)(xe,{children:(0,P.jsx)(c.Z,{pt:6,children:i("blocklet.publish.componentNotRunning",{name:t.meta.title})})}):(0,P.jsx)(xe,{children:(0,P.jsx)("iframe",{ref:a,title:t.meta.title,src:f,width:"100%",height:"600px"})})}be.propTypes={component:y().object.isRequired,app:y().object.isRequired,projectId:y().string.isRequired,release:y().shape({id:y().string.isRequired,status:y().string})},be.defaultProps={release:{id:""}};var fe,xe=(0,i.Z)(c.Z)(ee||(ee=(0,o.Z)(["\n iframe {\n border: none;\n }\n"]))),ve=["image/*",".jpg",".jpeg",".png",".gif",".svg"],je=10485760,ke=(0,l.lazy)((function(){return Promise.all([n.e(4917),n.e(5547)]).then(n.bind(n,25547)).then((function(e){return{default:e.Uploader}}))})),Ze=function(e,t,n){var o=[];return e.blockletTitle||o.push({param:"blockletTitle",message:n("blocklet.publish.errorTip.noTitle")}),e.blockletVersion?se().valid(e.blockletVersion)||o.push({param:"blockletVersion",message:"Invalid Blocklet Version"}):o.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.noVersion")}),t===Y.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||o.push({param:"blockletDescription",message:n("blocklet.publish.errorTip.noDescription")}),e.note||o.push({param:"note",message:n("blocklet.publish.errorTip.noNote")})),o.length?o:null},ge=function(e){var t=e.tabs,n=e.blocklet,o=e.ancestors,l=void 0===o?[]:o,r=n.meta.did;t.push({label:(0,P.jsxs)(c.Z,{ml:-4,display:"flex",alignItems:"center",justifyContent:"flex-start",children:[(0,P.jsx)(me.Z,{size:24,blocklet:n,ancestors:l}),(0,P.jsx)(c.Z,{ml:"16px",className:"text",children:(0,P.jsx)(c.Z,{children:n.meta.title})})]},r),value:r})},ye=function(e){var t=ie()(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","note"]);return t.blockletScreenshots||(t.blockletScreenshots=[]),t};function Te(e){var t,n,o,i=Object.assign({},((0,_.Z)(e),e)),p=(0,r.useNavigate)(),m=(0,r.useParams)(),f=m.projectId,x=m.releaseId,Z=(0,d.PE)().t,g=(0,v.y0)().blocklet,y=(0,le.Z)(null),T=(0,s.Z)(y,2),E=T[0],I=T[1],S=(0,l.useState)({}),C=(0,s.Z)(S,2),N=C[0],w=C[1],B=(0,l.useState)(!1),V=(0,s.Z)(B,2),W=V[0],D=V[1],U=(0,l.useState)(null),F=(0,s.Z)(U,2),M=F[0],X=F[1],q=(0,j.h6)().api,K=(0,l.useRef)(null),J=(0,l.useRef)(null),G="create"===x?"":x,$="create"===x?"create":"edit",ee=[],te=((null===g||void 0===g?void 0:g.children)||[]).filter((function(e){return e.meta.capabilities.resourceExportPage}));te.forEach((function(e){ge({tabs:ee,blocklet:e,t:Z,ancestors:[g]})}));var re=(0,l.useState)(null===(t=ee[0])||void 0===t?void 0:t.value),ie=(0,s.Z)(re,2),ce=ie[0],me=ie[1],fe="published"===(null===M||void 0===M?void 0:M.status),xe=fe,Te=function(){if("edit"===$){if(!G)return void b.Z.error("Empty release id");q.getRelease({input:{did:g.meta.did,projectId:f,releaseId:G}}).then((function(e){D(!1),I(ye(null===e||void 0===e?void 0:e.release)),X(null===e||void 0===e?void 0:e.release)})).catch((function(e){D(!1),b.Z.error((0,he.Z)(e))}))}"create"===$&&q.getProject({input:{did:g.meta.did,projectId:f}}).then((function(e){D(!1);var t=e.project||{};t.blockletVersion?se().valid(t.blockletVersion)&&(t.blockletVersion=se().inc(t.blockletVersion,"patch")):t.blockletVersion="1.0.0",I(ye(t))})).catch((function(e){D(!1),b.Z.error((0,he.Z)(e))}))};(0,l.useEffect)((function(){Te()}),[]);var Pe=function(e){var t=Ze(E,e,Z);if(t)return b.Z.error(t.map((function(e){return e.message})).join("; ")),void w(t.reduce((function(e,t){return(0,k.Z)((0,k.Z)({},e),{},(0,oe.Z)({},t.param,t.message))}),{}));var n=(0,k.Z)({},E);if(n.blockletVersion=se().valid(n.blockletVersion),!n.blockletVersion)return b.Z.error("Invalid Blocklet Version"),void w({blockletVersion:"Invalid Blocklet Version"});n.blockletTitle=(n.blockletTitle||"").trim(),n.blockletDescription=(n.blockletDescription||"").trim(),n.blockletIntroduction=(n.blockletIntroduction||"").trim(),n.note=(n.note||"").trim(),q.createRelease({input:(0,k.Z)((0,k.Z)({},n),{},{did:g.meta.did,projectId:f,releaseId:G,status:e})}).then((function(){"draft"===e?(b.Z.success("Save draft success"),"create"===$&&p("../".concat(f),{replace:!0})):(b.Z.success("Create Release success"),p("../".concat(f),{replace:!0}))})).catch((function(e){b.Z.error((0,he.Z)(e))}))};if(!E&&W)return(0,P.jsx)(R,{});if(!E)return null;var Re="".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(g.meta.did,"/").concat(f,"/logo/upload"),Ie="".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(g.meta.did,"/").concat(f,"/screenshot/upload"),Se=null!==E&&void 0!==E&&E.blockletLogo?"".concat(Re,"/").concat(E.blockletLogo):"".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/static/images/logo.png"),Ce=((null===E||void 0===E?void 0:E.blockletScreenshots)||[]).filter(Boolean).map((function(e){return"".concat(Ie,"/").concat(e)})),Ne=te.find((function(e){return e.meta.did===ce})),we=Ne?(0,P.jsx)(c.Z,{children:(0,P.jsx)(be,{app:g,component:Ne,projectId:f,release:(0,k.Z)((0,k.Z)({},M),{},{id:G})})}):(0,P.jsx)(c.Z,{display:"flex",mt:-3,children:(0,P.jsx)(pe.Z,{children:Z("common.empty")})});return(0,P.jsxs)(Ee,(0,k.Z)((0,k.Z)({},i),{},{children:[(0,P.jsxs)(c.Z,{className:"sticky-header",children:[(0,P.jsxs)(A.Z,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,P.jsx)(a.rU,{to:"../",children:Z("common.publish")}),(0,P.jsx)(a.rU,{to:"../".concat(f),children:(null===E||void 0===E?void 0:E.blockletTitle)||"Blocklet"}),(0,P.jsx)(z.Z,{color:"text.primary",children:"create"===$?Z("common.create"):(null===E||void 0===E?void 0:E.blockletVersion)||Z("common.edit")})]}),(0,P.jsxs)(c.Z,{display:"flex",children:[!fe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h.Z,{variant:"outlined",disabled:W,onClick:function(){return Pe(Y.PROJECT.RELEASE_STATUS.draft)},style:{marginRight:12},children:Z("blocklet.publish.saveDraft")}),(0,P.jsx)(h.Z,{variant:"contained",disabled:W,onClick:function(){return Pe(Y.PROJECT.RELEASE_STATUS.published)},children:Z("common.release")})]}),fe&&(0,P.jsx)(h.Z,{variant:"contained",children:(0,P.jsx)("a",{href:H()("".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(g.meta.did,"/").concat(f,"/").concat(G,"/download/").concat((M.files||[])[0])),children:Z("common.download")})})]})]}),(0,P.jsxs)(c.Z,{pt:3,children:[(0,P.jsxs)(c.Z,{display:"flex",className:"section",children:[(0,P.jsx)(z.Z,{variant:"h3",className:"left",children:Z("blocklet.publish.productTitle")}),(0,P.jsxs)(c.Z,{sx:{flex:1},children:[(0,P.jsx)(L.Z,{label:"Blocklet ".concat(Z("common.title")),placeholder:"Blocklet ".concat(Z("common.title")),InputProps:{"data-cy":"blocklet-title",readOnly:xe},autoComplete:"off",variant:"outlined",fullWidth:!0,value:E.blockletTitle||"",onChange:function(e){w({blockletTitle:""}),I({blockletTitle:e.target.value})},error:!!N.blockletTitle,helperText:N.blockletTitle||""}),(0,P.jsx)(L.Z,{label:"Blocklet ".concat(Z("common.description")),placeholder:"Blocklet ".concat(Z("common.description")),InputProps:{"data-cy":"blocklet-description",readOnly:xe},autoComplete:"off",variant:"outlined",fullWidth:!0,value:E.blockletDescription||"",onChange:function(e){w({blockletDescription:""}),I({blockletDescription:e.target.value})},error:!!N.blockletDescription,helperText:N.blockletDescription||"",sx:{mt:3}}),(0,P.jsx)(L.Z,{label:"Blocklet ".concat(Z("common.introduction")),placeholder:"Blocklet ".concat(Z("common.introduction")),InputProps:{"data-cy":"export-blocklet-introduction",readOnly:xe,endAdornment:(0,P.jsxs)(O.Z,{position:"end",children:[(null===E||void 0===E||null===(n=E.blockletIntroduction)||void 0===n?void 0:n.length)||0," / ",Y.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:E.blockletIntroduction||"",onChange:function(e){w({blockletIntroduction:""}),I({blockletIntroduction:e.target.value.slice(0,Y.PROJECT.MAX_INTRO_LENGTH)})},error:!!N.blockletIntroduction,helperText:N.blockletIntroduction||"",sx:{mt:3}})]})]}),(0,P.jsxs)(c.Z,{display:"flex",mt:3,className:"section",children:[(0,P.jsx)(z.Z,{variant:"h3",className:"left",children:Z("blocklet.publish.versionTitle")}),(0,P.jsxs)(c.Z,{sx:{flex:1},children:[(0,P.jsx)(L.Z,{label:"Blocklet ".concat(Z("common.version")),placeholder:"Blocklet ".concat(Z("common.version")),InputProps:{"data-cy":"blocklet-version",readOnly:xe},autoComplete:"off",variant:"outlined",fullWidth:!0,value:E.blockletVersion,onChange:function(e){w({blockletVersion:""}),I({blockletVersion:e.target.value})},error:!!N.blockletVersion,helperText:N.blockletVersion||""}),(0,P.jsx)(L.Z,{label:Z("blocklet.publish.releaseNote"),autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:xe,endAdornment:(0,P.jsxs)(O.Z,{position:"end",children:[(null===E||void 0===E||null===(o=E.note)||void 0===o?void 0:o.length)||0," / ",Y.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,value:E.note,onChange:function(e){w({note:""}),I({note:e.target.value.slice(0,Y.PROJECT.MAX_NOTE_LENGTH)})},error:!!N.note,helperText:N.note||"",sx:{mt:3}})]})]}),(0,P.jsxs)(c.Z,{display:"flex",mt:3,className:"section full-width",children:[(0,P.jsx)(z.Z,{variant:"h3",className:"left",children:Z("blocklet.publish.imgTitle")}),(0,P.jsxs)(c.Z,{sx:{flex:1},children:[(0,P.jsxs)(c.Z,{display:"flex",children:[(0,P.jsx)(z.Z,{variant:"subtitle1",sx:{mr:2},children:Z("common.logo")}),(0,P.jsx)(c.Z,{sx:{flex:1,cursor:xe?"default":"pointer"},children:(0,P.jsx)(ae.Z,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:Se,onClick:function(){return!xe&&K.current.open()}})})]}),(0,P.jsxs)(c.Z,{display:"flex",mt:3,children:[(0,P.jsx)(z.Z,{variant:"subtitle1",sx:{mr:2},children:Z("common.screenshot")}),(0,P.jsxs)(c.Z,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[Ce.map((function(e,t){return(0,P.jsxs)(c.Z,{className:"screenshot",children:[(0,P.jsx)("img",{alt:"screenshot",src:e}),!xe&&(0,P.jsx)(u.Z,{className:"action",onClick:function(){var e=(0,ne.Z)(E.blockletScreenshots);e.splice(t,1),I({blockletScreenshots:e})},children:(0,P.jsx)(de.default,{})})]})})),Ce.length<5&&(0,P.jsx)(c.Z,{sx:{width:200,height:140,background:"#eee",cursor:xe?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:function(){return!xe&&J.current.open()},children:"+"})]})]})]}),(0,P.jsx)(ke,{id:"\u200buploader-logo",ref:K,popup:!0,onUploadFinish:function(e){I({blockletLogo:e.data.filename}),K.current.close()},plugins:[],apiPathProps:{uploader:Re,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:ve,maxFileSize:je,maxNumberOfFiles:1}}},"uploader-screenshot"),(0,P.jsx)(ke,{id:"\u200buploader-screenshot",ref:J,popup:!0,onUploadFinish:function(e){var t,n=E.blockletScreenshots||[];n.push(null===(t=e.data)||void 0===t?void 0:t.filename),I({blockletScreenshots:n}),J.current.close()},plugins:[],apiPathProps:{uploader:Ie,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:ve,maxFileSize:je,maxNumberOfFiles:5-Ce.length}}},"uploader-screenshot")]}),(0,P.jsxs)(c.Z,{display:"flex",mt:3,className:"section full-width",children:[(0,P.jsxs)(c.Z,{className:"left",children:[(0,P.jsx)(z.Z,{variant:"h3",children:Z("blocklet.publish.resourceTitle")}),(0,P.jsx)(ue.Z,{tabs:ee,current:ce,orientation:"vertical",onChange:function(e){me(e)},sx:{width:"100%"}})]}),(0,P.jsx)(c.Z,{sx:{flex:1},children:(0,P.jsx)(c.Z,{children:we})})]})]})]}))}Te.propTypes={},Te.defaultProps={};var Pe,Ee=i.Z.div(fe||(fe=(0,o.Z)(["\n .sticky-header {\n margin-top: -12px;\n padding: 12px 0;\n position: sticky;\n top: 0;\n z-index: 99;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: #fff;\n padding-bottom: 12px;\n border-bottom: ",";\n }\n .screenshot {\n margin-bottom: 16px;\n max-width: 200px;\n max-height: 140px;\n width: 200px;\n height: 140px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #eee;\n margin-right: 16px;\n position: relative;\n .action {\n visibility: hidden;\n position: absolute;\n top: 0px;\n right: 0px;\n background-color: rgba(0, 0, 0, 0.2);\n color: rgba(255, 255, 255, 0.8);\n }\n &:hover .action {\n visibility: visible;\n }\n }\n .screenshot img {\n width: 100%; /* \u56fe\u50cf\u5bbd\u5ea6\u586b\u5145\u5bb9\u5668 */\n height: auto; /* \u56fe\u50cf\u9ad8\u5ea6\u81ea\u9002\u5e94 */\n }\n .section {\n max-width: 800px;\n &.full-width {\n max-width: 100%;\n }\n .MuiTypography-h3 {\n font-size: 1.1rem;\n font-weight: 700;\n }\n .left {\n flex-shrink: 0;\n width: 140px;\n }\n .MuiTabs-root {\n margin-top: 8px;\n transform: translateX(-16px);\n .MuiButtonBase-root .text {\n color: ",";\n }\n .MuiButtonBase-root.Mui-selected .text {\n color: ",";\n }\n }\n .MuiTabs-indicator {\n display: none;\n }\n .MuiTypography-subtitle1 {\n width: 120px;\n font-weight: 700;\n font-size: 1rem;\n "," {\n width: 80px;\n }\n }\n }\n .MuiButtonBase-root {\n a {\n color: inherit;\n }\n }\n .MuiInputBase-multiline .MuiInputAdornment-positionEnd {\n align-self: flex-end;\n .MuiTypography-root {\n font-size: 0.8rem;\n }\n font-size: 0.8rem;\n }\n"])),(function(e){var t=e.theme;return"1px solid ".concat(t.palette.divider)}),(function(e){return e.theme.palette.text.primary}),(function(e){return e.theme.palette.primary.main}),(function(e){return e.theme.breakpoints.down("sm")}));function Re(){return(0,P.jsx)(Ie,{children:(0,P.jsxs)(r.Routes,{children:[(0,P.jsx)(r.Route,{path:"/",element:(0,P.jsx)(N,{})}),(0,P.jsx)(r.Route,{path:"/create",element:(0,P.jsx)(F,{})}),(0,P.jsx)(r.Route,{path:"/:projectId",element:(0,P.jsx)($,{})}),(0,P.jsx)(r.Route,{path:"/:projectId/:releaseId",element:(0,P.jsx)(Te,{})})]})})}Re.propTypes={};var Ie=(0,i.Z)(c.Z)(Pe||(Pe=(0,o.Z)(["\n a {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main}))},36558:function(e,t,n){var o=n(33028),l=n(59740),r=n(24974),i=n.n(r),c=n(86822),s=n(19638),a=n(23586),d=n(37574),u=["did","href","external","avatarProps"];function p(e){var t=e.did,n=e.href,r=e.external,i=(e.avatarProps,(0,l.Z)(e,u)),p=(0,d.jsx)(a.Z,(0,o.Z)({did:t},i));return n?r?(0,d.jsx)(s.Z,{target:"_blank",href:n,underline:"hover",children:p}):(0,d.jsx)(c.rU,{to:n,children:p}):p}p.propTypes={did:i().string.isRequired,to:i().string,href:i().string,avatarProps:i().object,external:i().bool},p.defaultProps={to:"",href:"",avatarProps:{},external:!1},t.Z=p}}]);
2
- //# sourceMappingURL=9253.0de2d9f9.chunk.js.map