@abtnode/blocklet-services 1.16.17-beta-d282d63e → 1.16.17-beta-4f13d99d

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.
Files changed (63) hide show
  1. package/build/asset-manifest.json +71 -69
  2. package/build/index.html +1 -1
  3. package/build/service-worker.js +1 -1
  4. package/build/service-worker.js.map +1 -1
  5. package/build/static/js/1190.80a05205.chunk.js +2 -0
  6. package/build/static/js/{1431.1187b8fa.chunk.js → 1431.3379c73c.chunk.js} +3 -3
  7. package/build/static/js/{1480.4d4dda1b.chunk.js → 1480.88c590c2.chunk.js} +2 -2
  8. package/build/static/js/1565.2d2fca2c.chunk.js +2 -0
  9. package/build/static/js/{1760.e68661c0.chunk.js → 1760.1e5aaa46.chunk.js} +2 -2
  10. package/build/static/js/2093.185a5563.chunk.js +3 -0
  11. package/build/static/js/2291.7ffdc7df.chunk.js +2 -0
  12. package/build/static/js/{2393.29558f48.chunk.js → 2393.528e5343.chunk.js} +2 -2
  13. package/build/static/js/{2631.58f5f3bd.chunk.js → 2631.54f86f84.chunk.js} +2 -2
  14. package/build/static/js/2653.3873eb86.chunk.js +2 -0
  15. package/build/static/js/2836.7d300d72.chunk.js +2 -0
  16. package/build/static/js/{2838.777de983.chunk.js → 2838.4277f326.chunk.js} +3 -3
  17. package/build/static/js/3490.4d3a51ea.chunk.js +2 -0
  18. package/build/static/js/{3688.a821d97e.chunk.js → 3688.15a9bdc4.chunk.js} +2 -2
  19. package/build/static/js/4023.8cfc3ec6.chunk.js +2 -0
  20. package/build/static/js/{4355.7ff96d41.chunk.js → 4355.c4951dfb.chunk.js} +2 -2
  21. package/build/static/js/4461.35971122.chunk.js +2 -0
  22. package/build/static/js/{4802.c534aa74.chunk.js → 4802.534357c1.chunk.js} +2 -2
  23. package/build/static/js/4932.c7c954aa.chunk.js +2 -0
  24. package/build/static/js/{5465.19cd4b1f.chunk.js → 5465.dd0f7a20.chunk.js} +2 -2
  25. package/build/static/js/5547.30a1f137.chunk.js +3 -0
  26. package/build/static/js/{5673.24aec022.chunk.js → 5673.0dd67df6.chunk.js} +2 -2
  27. package/build/static/js/5683.47011724.chunk.js +2 -0
  28. package/build/static/js/{5960.e6da30ae.chunk.js → 5960.35db200d.chunk.js} +2 -2
  29. package/build/static/js/{5982.27671e0b.chunk.js → 5982.0abe67c3.chunk.js} +2 -2
  30. package/build/static/js/6186.763376e7.chunk.js +2 -0
  31. package/build/static/js/{6737.16a327aa.chunk.js → 6737.53cccea9.chunk.js} +2 -2
  32. package/build/static/js/{6868.b4a7c4d1.chunk.js → 6868.881bd141.chunk.js} +2 -2
  33. package/build/static/js/{7226.c6ae41f1.chunk.js → 7226.4eca7c02.chunk.js} +3 -3
  34. package/build/static/js/{7367.c5adfbb1.chunk.js → 7367.15383006.chunk.js} +2 -2
  35. package/build/static/js/{807.d7d92ccb.chunk.js → 807.249d2d01.chunk.js} +3 -3
  36. package/build/static/js/{8604.ad426a4a.chunk.js → 8604.12e79f46.chunk.js} +3 -3
  37. package/build/static/js/9253.0de2d9f9.chunk.js +2 -0
  38. package/build/static/js/9529.4c67a788.chunk.js +2 -0
  39. package/build/static/js/main.ccc0dd14.js +3 -0
  40. package/build/static/js/{main.f403ce77.js.LICENSE.txt → main.ccc0dd14.js.LICENSE.txt} +1 -1
  41. package/package.json +34 -34
  42. package/build/static/js/1565.a119b8f0.chunk.js +0 -2
  43. package/build/static/js/2291.1627e4db.chunk.js +0 -2
  44. package/build/static/js/2653.e7392aa1.chunk.js +0 -2
  45. package/build/static/js/2836.39678084.chunk.js +0 -2
  46. package/build/static/js/299.7dd796c5.chunk.js +0 -3
  47. package/build/static/js/4023.c145cf94.chunk.js +0 -2
  48. package/build/static/js/4461.8346dcf5.chunk.js +0 -2
  49. package/build/static/js/5010.a689a6b9.chunk.js +0 -2
  50. package/build/static/js/5547.ee22d0a8.chunk.js +0 -3
  51. package/build/static/js/5683.19dfa1f2.chunk.js +0 -2
  52. package/build/static/js/6186.571ac113.chunk.js +0 -2
  53. package/build/static/js/7172.52c5e4b4.chunk.js +0 -2
  54. package/build/static/js/7516.eb541f26.chunk.js +0 -2
  55. package/build/static/js/8143.34374ce2.chunk.js +0 -2
  56. package/build/static/js/main.f403ce77.js +0 -3
  57. /package/build/static/js/{1431.1187b8fa.chunk.js.LICENSE.txt → 1431.3379c73c.chunk.js.LICENSE.txt} +0 -0
  58. /package/build/static/js/{299.7dd796c5.chunk.js.LICENSE.txt → 2093.185a5563.chunk.js.LICENSE.txt} +0 -0
  59. /package/build/static/js/{2838.777de983.chunk.js.LICENSE.txt → 2838.4277f326.chunk.js.LICENSE.txt} +0 -0
  60. /package/build/static/js/{5547.ee22d0a8.chunk.js.LICENSE.txt → 5547.30a1f137.chunk.js.LICENSE.txt} +0 -0
  61. /package/build/static/js/{7226.c6ae41f1.chunk.js.LICENSE.txt → 7226.4eca7c02.chunk.js.LICENSE.txt} +0 -0
  62. /package/build/static/js/{807.d7d92ccb.chunk.js.LICENSE.txt → 807.249d2d01.chunk.js.LICENSE.txt} +0 -0
  63. /package/build/static/js/{8604.ad426a4a.chunk.js.LICENSE.txt → 8604.12e79f46.chunk.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[5010],{70998:function(e,t,n){n.d(t,{Z:function(){return b}});var o=n(33028),l=n(59740),r=n(24974),i=n.n(r),a=n(59467),c=n(62399),s=n(19611),d=n.n(s),u=n(20244),p=n(41395),h=n(24891);var m=n(37574),f=["blocklet","style","size","ancestors"];function b(e){var t=e.blocklet,n=e.style,r=e.size,i=e.ancestors,s=(0,l.Z)(e,f),b=(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,a="?v=".concat(null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.version).concat((0,h.XN)(null===n||void 0===n?void 0:n.status)?"~":""),c=i?d()(h.zn,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",a):d()(r.imgPrefix,"blocklet.png");if("registry"===n.source&&n.deployedFrom&&n.meta.logo)c=d()(n.deployedFrom,(0,h.lk)(n.meta.bundleDid,n.meta.logo),a);else{var s=window.env.apiPrefix||"/",m=l.concat(n),f=i?m.slice(1):m;c=d()(s,"/blocklet/logo-bundle".concat(f.map((function(e){return"/".concat(e.meta.did)})).join("")),a)}return{logoUrl:c,inService:i}}({blocklet:t,ancestors:i}),v=x.logoUrl,Z=x.inService,j=s.variant,g=Z?function(){}:function(e){e.target.src="".concat(b.imgPrefix,"/blocklet.png")},k=(0,m.jsx)("img",{src:v,onError:g,alt:t.meta.name,style:{width:r}});return t.meta.logo||(k=(0,m.jsx)(c.Z,{did:t.meta.did||"",responsive:!0})),(0,m.jsx)(a.Z,(0,o.Z)((0,o.Z)({variant:j||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},n)},s),{},{children:k}))}b.propTypes={blocklet:i().object.isRequired,style:i().object,size:i().oneOfType([i().number,i().string]),ancestors:i().array},b.defaultProps={style:{},size:40,ancestors:[]}},79414:function(e,t,n){n.r(t),n.d(t,{default:function(){return Fe}});var o=n(71171),l=n(30969),r=n(30734),i=n(16380),a=n(38361),c=n(96234),s=n(86822),d=n(26022),u=n(94551),p=n(10814),h=n(2291),m=n(29996),f=n(1986),b=n(45008),x=n(41395),v=n(33028),Z=n(59740),j=n(24974),g=n.n(j),k=n(94308),y=n(37574),P=["size"];function S(e){var t=e.size,n=(0,Z.Z)(e,P);return(0,y.jsx)(a.Z,(0,v.Z)((0,v.Z)({display:"flex",mt:4},n),{},{children:(0,y.jsx)(k.Z,{size:t})}))}S.propTypes={size:g().number},S.defaultProps={size:24};var R,T=n(36558),C=n(8479);function I(){var e=(0,d.PE)(),t=e.t,n=e.locale,o=(0,x.h6)().api,r=(0,l.useState)(!0),i=(0,c.Z)(r,2),v=i[0],Z=i[1],j=(0,b.y0)().blocklet,g=(0,l.useState)(null),k=(0,c.Z)(g,2),P=k[0],R=k[1],I=(0,l.useState)(null),w=(0,c.Z)(I,2),B=w[0],N=w[1],z=function(){o.getProjects({input:{did:j.meta.did}}).then((function(e){var t=(null===e||void 0===e?void 0:e.projects)||[];Z(!1),N(t)})).catch((function(e){Z(!1),f.Z.error(e.message)}))};if((0,l.useEffect)((function(){z()}),[]),!B&&v)return(0,y.jsx)(S,{});if(!B)return null;if(!B.length)return(0,y.jsxs)(a.Z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[(0,y.jsx)(a.Z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.blockletEmptyTip")}),(0,y.jsx)(a.Z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createBlockletTip")}),(0,y.jsx)(s.rU,{to:"create",children:(0,y.jsx)(m.Z,{variant:"contained",children:t("blocklet.publish.createBlocklet")})})]});var _=[{label:t("common.name"),name:"blockletTitle",options:{customBodyRenderLite:function(e){var t=B[e];return(0,y.jsx)(s.rU,{to:"".concat(t.id),children:t.blockletTitle||"/"})}}},{label:t("common.address"),name:"blockletDid",options:{customBodyRender:function(e){return(0,y.jsx)(T.Z,{size:14,responsive:!0,did:e})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var t=B[e];return(0,y.jsx)(a.Z,{display:"flex",children:(0,y.jsx)(u.Z,{color:"error","aria-label":"delete",onClick:function(){return function(e){R(e)}(t)},children:(0,y.jsx)(p.default,{sx:{fontSize:18}})})})}}}];return(0,y.jsxs)(E,{children:[(0,y.jsx)(a.Z,{sx:{textAlign:"right"},children:(0,y.jsx)(s.rU,{to:"create",children:(0,y.jsx)(m.Z,{variant:"contained",children:t("blocklet.publish.createBlocklet")})})}),(0,y.jsx)(h.Z,{className:"main-table",locale:n,data:B,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),P&&(0,y.jsx)(C.Z,{title:"".concat(t("common.delete")," ").concat(P.blockletTitle),description:t("blocklet.publish.deleteBlockletTip"),confirm:t("common.confirm"),onConfirm:function(){Z(!1);var e=P.id;o.deleteProject({input:{did:j.meta.did,projectId:e}}).then((function(){Z(!1),z(),f.Z.success(t("common.removeSuccess"))})).catch((function(e){Z(!1),f.Z.error(e.message)}))},onCancel:function(){return R(null)}})]})}I.propTypes={};var E=(0,i.Z)(a.Z)(R||(R=(0,o.Z)(["\n .main-table > div:first-child {\n display: none;\n }\n"]))),w=n(33665),B=n(2689),N=n(87006),z=n(33359),_=n(68079),V=n(56666),L=n(7896),W=n(31461),M=(n(9479),n(87023)),U=n(26540),O=n(20655),D=n(45971),A=n(17363),F=n(74262),H=(0,n(17469).Z)((0,y.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"),q=n(4839),K=["slots","slotProps"],X=(0,D.ZP)(q.Z)((function(e){var t=e.theme;return(0,L.Z)({display:"flex",marginLeft:"calc(".concat(t.spacing(1)," * 0.5)"),marginRight:"calc(".concat(t.spacing(1)," * 0.5)")},"light"===t.palette.mode?{backgroundColor:t.palette.grey[100],color:t.palette.grey[700]}:{backgroundColor:t.palette.grey[700],color:t.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":(0,L.Z)({},"light"===t.palette.mode?{backgroundColor:t.palette.grey[200]}:{backgroundColor:t.palette.grey[600]}),"&:active":(0,L.Z)({boxShadow:t.shadows[0]},"light"===t.palette.mode?{backgroundColor:(0,F._4)(t.palette.grey[200],.12)}:{backgroundColor:(0,F._4)(t.palette.grey[600],.12)})})})),J=(0,D.ZP)(H)({width:24,height:16});var Q=function(e){var t=e.slots,n=void 0===t?{}:t,o=e.slotProps,l=void 0===o?{}:o,r=(0,W.Z)(e,K),i=e;return(0,y.jsx)("li",{children:(0,y.jsx)(X,(0,L.Z)({focusRipple:!0},r,{ownerState:i,children:(0,y.jsx)(J,(0,L.Z)({as:n.CollapsedIcon,ownerState:i},l.collapsedIcon))}))})},G=n(62746),Y=n(2975);function $(e){return(0,Y.Z)("MuiBreadcrumbs",e)}var ee=(0,G.Z)("MuiBreadcrumbs",["root","ol","li","separator"]),te=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],ne=(0,D.ZP)(z.Z,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:function(e,t){return[(0,V.Z)({},"& .".concat(ee.li),t.li),t.root]}})({}),oe=(0,D.ZP)("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:function(e,t){return t.ol}})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),le=(0,D.ZP)("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:function(e,t){return t.separator}})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function re(e,t,n,o){return e.reduce((function(l,r,i){return i<e.length-1?l=l.concat(r,(0,y.jsx)(le,{"aria-hidden":!0,className:t,ownerState:o,children:n},"separator-".concat(i))):l.push(r),l}),[])}var ie,ae=l.forwardRef((function(e,t){var n=(0,A.Z)({props:e,name:"MuiBreadcrumbs"}),o=n.children,r=n.className,i=n.component,a=void 0===i?"nav":i,s=n.slots,d=void 0===s?{}:s,u=n.slotProps,p=void 0===u?{}:u,h=n.expandText,m=void 0===h?"Show path":h,f=n.itemsAfterCollapse,b=void 0===f?1:f,x=n.itemsBeforeCollapse,v=void 0===x?1:x,Z=n.maxItems,j=void 0===Z?8:Z,g=n.separator,k=void 0===g?"/":g,P=(0,W.Z)(n,te),S=l.useState(!1),R=(0,c.Z)(S,2),T=R[0],C=R[1],I=(0,L.Z)({},n,{component:a,expanded:T,expandText:m,itemsAfterCollapse:b,itemsBeforeCollapse:v,maxItems:j,separator:k}),E=function(e){var t=e.classes;return(0,U.Z)({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},$,t)}(I),w=(0,O.y)({elementType:d.CollapsedIcon,externalSlotProps:p.collapsedIcon,ownerState:I}),B=l.useRef(null),N=l.Children.toArray(o).filter((function(e){return l.isValidElement(e)})).map((function(e,t){return(0,y.jsx)("li",{className:E.li,children:e},"child-".concat(t))}));return(0,y.jsx)(ne,(0,L.Z)({ref:t,component:a,color:"text.secondary",className:(0,M.Z)(E.root,r),ownerState:I},P,{children:(0,y.jsx)(oe,{className:E.ol,ref:B,ownerState:I,children:re(T||j&&N.length<=j?N:function(e){return v+b>=e.length?e:[].concat((0,_.Z)(e.slice(0,v)),[(0,y.jsx)(Q,{"aria-label":m,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:w},onClick:function(){C(!0);var e=B.current.querySelector("a[href],button,[tabindex]");e&&e.focus()}},"ellipsis")],(0,_.Z)(e.slice(e.length-b,e.length)))}(N),E.separator,k,I)})}))})),ce=n(72836),se=n(77370),de=[{label:{en:"Resource",zh:"\u8d44\u6e90"},value:"resource"},{label:{en:"Application",zh:"\u5e94\u7528"},value:"pack",disabled:!0}];function ue(e){var t=Object.assign({},((0,w.Z)(e),e)),n=(0,r.useNavigate)(),o=(0,d.PE)(),i=o.t,u=o.locale,p=(0,b.y0)().blocklet,h=(0,l.useState)(""),Z=(0,c.Z)(h,2),j=Z[0],g=Z[1],k=(0,l.useState)(!1),P=(0,c.Z)(k,2),S=P[0],R=P[1],C=(0,l.useState)("resource"),I=(0,c.Z)(C,2),E=I[0],_=I[1],V=(0,se.T)().api,L=(0,x.h6)().api,W=(0,l.useState)(),M=(0,c.Z)(W,2),U=M[0],O=M[1],D=(0,l.useState)(!1),A=(0,c.Z)(D,2),F=A[0],H=A[1];return(0,y.jsxs)(he,(0,v.Z)((0,v.Z)({},t),{},{children:[(0,y.jsxs)(ae,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,y.jsx)(s.rU,{to:"..",children:i("common.publish")}),(0,y.jsxs)(z.Z,{color:"text.primary",children:[i("common.create")," Blocklet"]})]}),(0,y.jsxs)(a.Z,{style:{maxWidth:500},children:[(0,y.jsxs)(a.Z,{sx:{mb:3},display:"flex",alignItems:"center",children:[(0,y.jsxs)(z.Z,{variant:"h6",sx:{mr:3},children:["Blocklet DID:"," "]}),U?(0,y.jsx)(T.Z,{size:14,responsive:!0,did:U}):(0,y.jsx)(m.Z,{onClick:function(){return H(!0)},children:i("blocklet.publish.createBlockletDid")})]}),F&&(0,y.jsx)(ce.default,{open:!0,popup:!0,onClose:function(){return H(!1)},action:"gen-blocklet-key-pair",locale:u,checkFn:V.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?O(n):f.Z.error("Empty Blocklet DID"),H(!1)},onError:function(e){f.Z.error(e.message),H(!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,y.jsx)(N.Z,{label:"Blocklet ".concat(i("common.title")),autoComplete:"off",variant:"outlined",inputProps:{"data-cy":"export-blocklet-title"},fullWidth:!0,helperText:"",value:j||"",onChange:function(e){g(e.target.value)}}),(0,y.jsx)(N.Z,{sx:{my:4},id:"blocklet-type",select:!0,label:"Blocklet ".concat(i("common.type")),helperText:"",fullWidth:!0,value:E,onChange:function(e){return _(e.target.value)},children:de.map((function(e){return(0,y.jsx)(B.Z,{value:e.value,disabled:e.disabled,children:e.label[u]||e.label.en},e.value)}))})]}),(0,y.jsx)(m.Z,{variant:"contained",disabled:S||!U||!j,onClick:function(){R(!0),L.createProject({input:{did:p.meta.did,blockletTitle:j||"",blockletDid:U,type:E}}).then((function(){R(!1),n("../",{replace:!0})})).catch((function(e){R(!1),f.Z.error(e.message)}))},children:i("common.create")})]}))}ue.propTypes={},ue.defaultProps={};var pe,he=i.Z.div(ie||(ie=(0,o.Z)(["\n .breadcrumbs {\n margin-bottom: 24px;\n }\n"]))),me=n(19611),fe=n.n(me),be=n(70093),xe=n.n(be),ve=n(32677),Ze=n(20244),je=n(9715);function ge(){var e=(0,d.PE)(),t=e.t,n=e.locale,o=(0,r.useParams)().projectId,i=(0,x.h6)().api,v=(0,l.useState)(!0),Z=(0,c.Z)(v,2),j=Z[0],g=Z[1],k=(0,b.y0)().blocklet,P=(0,l.useState)(null),R=(0,c.Z)(P,2),T=R[0],I=R[1],E=(0,l.useState)(null),w=(0,c.Z)(E,2),B=w[0],N=w[1],_=(0,l.useState)(null),V=(0,c.Z)(_,2),L=V[0],W=V[1];(0,l.useEffect)((function(){i.doBatchQuery({getProject:{input:{did:k.meta.did,projectId:o}},getReleases:{input:{did:k.meta.did,projectId:o}}}).then((function(e){N(e.getProject.project||{}),I(e.getReleases.releases||[]),g(!1)})).catch((function(e){g(!1),f.Z.error(e.message)}))}),[]);if(!T&&j)return(0,y.jsx)(S,{});if(!T)return null;var M=(0,y.jsxs)(ae,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,y.jsx)(s.rU,{to:"..",children:t("common.publish")}),(0,y.jsx)(z.Z,{color:"text.primary",children:B.blockletTitle})]});if(!T.length)return(0,y.jsxs)(y.Fragment,{children:[M,(0,y.jsxs)(a.Z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[(0,y.jsx)(a.Z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),(0,y.jsx)(a.Z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),(0,y.jsx)(s.rU,{to:"create",children:(0,y.jsx)(m.Z,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});var U=[{label:t("common.version"),name:"blockletVersion",options:{customBodyRenderLite:function(e){var t=T[e];return(0,y.jsx)(s.rU,{to:"".concat(t.id),children:t.blockletVersion||"/"})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:function(e){var t=T[e];return(0,y.jsx)(z.Z,{className:"note",children:t.note||""})}}},{label:t("common.status"),name:"status",options:{customBodyRender:function(e){return(0,y.jsx)(je.Z,{type:"published"===e?"success":"warning",children:xe()(e)})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var t=T[e];return(0,y.jsxs)(a.Z,{display:"flex",children:[(0,y.jsx)(u.Z,{color:"primary","aria-label":"download",disabled:"published"!==t.status,children:"published"===t.status?(0,y.jsx)("a",{href:fe()("".concat(Ze.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(k.meta.did,"/").concat(B.id,"/").concat(t.id,"/download/").concat((t.files||[])[0])),children:(0,y.jsx)(ve.Z,{sx:{fontSize:18}})}):(0,y.jsx)(ve.Z,{sx:{fontSize:18}})}),(0,y.jsx)(u.Z,{color:"error","aria-label":"delete",onClick:function(){return function(e){W(e)}(t)},children:(0,y.jsx)(p.default,{sx:{fontSize:18}})})]})}}}];return(0,y.jsxs)(ye,{children:[(0,y.jsxs)(a.Z,{className:"header",children:[M,(0,y.jsx)(s.rU,{to:"create",children:(0,y.jsx)(m.Z,{variant:"contained",children:t("blocklet.publish.createRelease")})})]}),(0,y.jsx)(h.Z,{className:"main-table",verticalKeyWidth:100,locale:n,data:T,columns:U,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),L&&(0,y.jsx)(C.Z,{title:t("".concat(t("common.delete")," ").concat(L.blockletVersion)),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:function(){g(!1);var e=L.id;i.deleteRelease({input:{did:k.meta.did,projectId:o,releaseId:e}}).then((function(){g(!1),i.getReleases({input:{did:k.meta.did,projectId:o}}).then((function(e){var t=(null===e||void 0===e?void 0:e.releases)||[];g(!1),I(t)})).catch((function(e){g(!1),f.Z.error(e.message)})),f.Z.success(t("common.removeSuccess"))})).catch((function(e){g(!1),f.Z.error(e.message)}))},onCancel:function(){return W(null)}})]})}ge.propTypes={};var ke,ye=(0,i.Z)(a.Z)(pe||(pe=(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"]))),Pe=n(43178),Se=n(49735),Re=n.n(Se),Te=n(60451),Ce=n.n(Te),Ie=n(59467),Ee=n(30291),we=n(19865),Be=n(78789),Ne=n(59505),ze=n(70998);function _e(e){e.app;var t=e.component,n=e.projectId,o=e.release,r=(0,d.PE)(),i=r.t,c=r.locale,s=(0,l.useRef)(null),u=o.id,p="published"===o.status,h=((null===t||void 0===t?void 0:t.meta.capabilities)||{}).resourceExportPage,m=void 0===h?"/":h,f=new URL(fe()("http://127.0.0.1",t.mountPoint,m).replace(/\/+/g,"/"));f.searchParams.set("projectId",n),f.searchParams.set("releaseId",u),f.searchParams.set("local",c),p&&f.searchParams.set("readonly","1");var b="".concat(f.pathname).concat(f.search);return"running"!==t.status?(0,y.jsx)(Le,{children:(0,y.jsx)(a.Z,{pt:6,children:i("blocklet.publish.componentNotRunning",{name:t.meta.title})})}):(0,y.jsx)(Le,{children:(0,y.jsx)("iframe",{ref:s,title:t.meta.title,src:b,width:"100%",height:"600px"})})}_e.propTypes={component:g().object.isRequired,app:g().object.isRequired,projectId:g().string.isRequired,release:g().shape({id:g().string.isRequired,status:g().string})},_e.defaultProps={release:{id:""}};var Ve,Le=(0,i.Z)(a.Z)(ke||(ke=(0,o.Z)(["\n iframe {\n border: none;\n }\n"]))),We=(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}}))})),Me=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,y.jsxs)(a.Z,{ml:-4,display:"flex",alignItems:"center",justifyContent:"flex-start",children:[(0,y.jsx)(ze.Z,{size:24,blocklet:n,ancestors:l}),(0,y.jsx)(a.Z,{ml:"16px",className:"text",children:(0,y.jsx)(a.Z,{children:n.meta.title})})]},r),value:r})},Ue=function(e){return Re()(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","note"])};function Oe(e){var t,n=Object.assign({},((0,w.Z)(e),e)),o=(0,r.useNavigate)(),i=(0,r.useParams)(),p=i.projectId,h=i.releaseId,Z=(0,d.PE)().t,j=(0,b.y0)().blocklet,g=(0,Pe.Z)(null),k=(0,c.Z)(g,2),P=k[0],R=k[1],T=(0,l.useState)(!1),C=(0,c.Z)(T,2),I=C[0],E=C[1],B=(0,l.useState)(null),V=(0,c.Z)(B,2),L=V[0],W=V[1],M=(0,x.h6)().api,U=(0,l.useRef)(null),O=(0,l.useRef)(null),D="create"===h?"":h,A="create"===h?"create":"edit",F=[],H=((null===j||void 0===j?void 0:j.children)||[]).filter((function(e){return e.meta.capabilities.resourceExportPage}));H.forEach((function(e){Me({tabs:F,blocklet:e,t:Z,ancestors:[j]})}));var q=(0,l.useState)(null===(t=F[0])||void 0===t?void 0:t.value),K=(0,c.Z)(q,2),X=K[0],J=K[1],Q="published"===(null===L||void 0===L?void 0:L.status),G=Q,Y=function(){if("edit"===A){if(!D)return void f.Z.error("Empty release id");M.getRelease({input:{did:j.meta.did,projectId:p,releaseId:D}}).then((function(e){E(!1),R(Ue(null===e||void 0===e?void 0:e.release)),W(null===e||void 0===e?void 0:e.release)})).catch((function(e){E(!1),f.Z.error(e.message)}))}"create"===A&&M.getProject({input:{did:j.meta.did,projectId:p}}).then((function(e){E(!1);var t=e.project||{};t.blockletVersion?Ce().valid(t.blockletVersion)&&(t.blockletVersion=Ce().inc(t.blockletVersion,"patch")):t.blockletVersion="1.0.0",R(Ue(t))})).catch((function(e){E(!1),f.Z.error(e.message)}))};(0,l.useEffect)((function(){Y()}),[]);var $=function(e){if(P.blockletTitle)if(P.blockletVersion){if(e===Ne.PROJECT.RELEASE_STATUS.published){if(!P.blockletDescription)return void f.Z.error(Z("blocklet.publish.errorTip.noDescription"));if(!P.note)return void f.Z.error(Z("blocklet.publish.errorTip.noNote"))}var t=(0,v.Z)({},P);t.blockletVersion=Ce().valid(t.blockletVersion),t.blockletVersion?(t.blockletTitle=(t.blockletTitle||"").trim(),t.blockletDescription=(t.blockletDescription||"").trim(),t.blockletIntroduction=(t.blockletIntroduction||"").trim(),t.note=(t.note||"").trim(),M.createRelease({input:(0,v.Z)((0,v.Z)({},t),{},{did:j.meta.did,projectId:p,releaseId:D,status:e})}).then((function(){"draft"===e?(f.Z.success("Save draft success"),"create"===A&&o("../".concat(p),{replace:!0})):(f.Z.success("Create Release success"),o("../".concat(p),{replace:!0}))})).catch((function(e){f.Z.error(e.message)}))):f.Z.error("Invalid Blocklet Version")}else f.Z.error(Z("blocklet.publish.errorTip.noVersion"));else f.Z.error(Z("blocklet.publish.errorTip.noTitle"))};if(!P&&I)return(0,y.jsx)(S,{});if(!P)return null;var ee="".concat(Ze.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(j.meta.did,"/").concat(p,"/logo/upload"),te="".concat(Ze.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(j.meta.did,"/").concat(p,"/screenshot/upload"),ne=null!==P&&void 0!==P&&P.blockletLogo?"".concat(ee,"/").concat(P.blockletLogo):"".concat(Ze.WELLKNOWN_SERVICE_PATH_PREFIX,"/static/images/logo.png"),oe=((null===P||void 0===P?void 0:P.blockletScreenshots)||[]).filter(Boolean).map((function(e){return"".concat(te,"/").concat(e)})),le=H.find((function(e){return e.meta.did===X})),re=le?(0,y.jsx)(a.Z,{children:(0,y.jsx)(_e,{app:j,component:le,projectId:p,release:(0,v.Z)((0,v.Z)({},L),{},{id:D})})}):(0,y.jsx)(a.Z,{display:"flex",mt:-3,children:(0,y.jsx)(Be.Z,{children:Z("common.empty")})});return(0,y.jsxs)(Ae,(0,v.Z)((0,v.Z)({},n),{},{children:[(0,y.jsxs)(a.Z,{className:"sticky-header",children:[(0,y.jsxs)(ae,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,y.jsx)(s.rU,{to:"../",children:Z("common.publish")}),(0,y.jsx)(s.rU,{to:"../".concat(p),children:(null===P||void 0===P?void 0:P.blockletTitle)||"Blocklet"}),(0,y.jsx)(z.Z,{color:"text.primary",children:"create"===A?Z("common.create"):(null===P||void 0===P?void 0:P.blockletVersion)||Z("common.edit")})]}),(0,y.jsxs)(a.Z,{display:"flex",children:[!Q&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m.Z,{variant:"outlined",disabled:I,onClick:function(){return $(Ne.PROJECT.RELEASE_STATUS.draft)},style:{marginRight:12},children:Z("blocklet.publish.saveDraft")}),(0,y.jsx)(m.Z,{variant:"contained",disabled:I,onClick:function(){return $(Ne.PROJECT.RELEASE_STATUS.published)},children:Z("common.release")})]}),Q&&(0,y.jsx)(m.Z,{variant:"contained",children:(0,y.jsx)("a",{href:fe()("".concat(Ze.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(j.meta.did,"/").concat(p,"/").concat(D,"/download/").concat((L.files||[])[0])),children:Z("common.download")})})]})]}),(0,y.jsxs)(a.Z,{pt:3,children:[(0,y.jsxs)(a.Z,{display:"flex",className:"section",children:[(0,y.jsx)(z.Z,{variant:"h3",className:"left",children:Z("blocklet.publish.productTitle")}),(0,y.jsxs)(a.Z,{sx:{flex:1},children:[(0,y.jsx)(N.Z,{label:"Blocklet ".concat(Z("common.title")),placeholder:"Blocklet ".concat(Z("common.title")),inputProps:{"data-cy":"blocklet-title",readOnly:G},autoComplete:"off",variant:"outlined",fullWidth:!0,value:P.blockletTitle||"",onChange:function(e){R({blockletTitle:e.target.value})}}),(0,y.jsx)(N.Z,{label:"Blocklet ".concat(Z("common.description")),placeholder:"Blocklet ".concat(Z("common.description")),inputProps:{"data-cy":"blocklet-description",readOnly:G},autoComplete:"off",variant:"outlined",fullWidth:!0,value:P.blockletDescription||"",onChange:function(e){R({blockletDescription:e.target.value})},sx:{mt:3}}),(0,y.jsx)(N.Z,{label:"Blocklet ".concat(Z("common.introduction")),placeholder:"Blocklet ".concat(Z("common.introduction")),inputProps:{"data-cy":"export-blocklet-introduction",readOnly:G},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,rows:4,value:P.blockletIntroduction||"",onChange:function(e){R({blockletIntroduction:e.target.value})},sx:{mt:3}})]})]}),(0,y.jsxs)(a.Z,{display:"flex",mt:3,className:"section",children:[(0,y.jsx)(z.Z,{variant:"h3",className:"left",children:Z("blocklet.publish.versionTitle")}),(0,y.jsxs)(a.Z,{sx:{flex:1},children:[(0,y.jsx)(N.Z,{label:"Blocklet ".concat(Z("common.version")),placeholder:"Blocklet ".concat(Z("common.version")),inputProps:{"data-cy":"blocklet-version",readOnly:G},autoComplete:"off",variant:"outlined",fullWidth:!0,value:P.blockletVersion,onChange:function(e){R({blockletVersion:e.target.value})}}),(0,y.jsx)(N.Z,{label:Z("blocklet.publish.releaseNote"),autoComplete:"off",variant:"outlined",inputProps:{"data-cy":"release-note",readOnly:G},fullWidth:!0,multiline:!0,rows:4,value:P.note,onChange:function(e){R({note:e.target.value})},sx:{mt:3}})]})]}),(0,y.jsxs)(a.Z,{display:"flex",mt:3,className:"section full-width",children:[(0,y.jsx)(z.Z,{variant:"h3",className:"left",children:Z("blocklet.publish.imgTitle")}),(0,y.jsxs)(a.Z,{sx:{flex:1},children:[(0,y.jsxs)(a.Z,{display:"flex",children:[(0,y.jsx)(z.Z,{variant:"subtitle1",sx:{mr:2},children:Z("common.logo")}),(0,y.jsx)(a.Z,{sx:{flex:1,cursor:G?"default":"pointer"},children:(0,y.jsx)(Ie.Z,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:ne,onClick:function(){return!G&&U.current.open()}})})]}),(0,y.jsxs)(a.Z,{display:"flex",mt:3,children:[(0,y.jsx)(z.Z,{variant:"subtitle1",sx:{mr:2},children:Z("common.screenshot")}),(0,y.jsxs)(a.Z,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[oe.map((function(e,t){return(0,y.jsxs)(a.Z,{className:"screenshot",children:[(0,y.jsx)("img",{alt:"screenshot",src:e}),!G&&(0,y.jsx)(u.Z,{className:"action",onClick:function(){var e=(0,_.Z)(P.blockletScreenshots);e.splice(t,1),R({blockletScreenshots:e})},children:(0,y.jsx)(Ee.default,{})})]})})),oe.length<5&&(0,y.jsx)(a.Z,{sx:{width:200,height:140,background:"#eee",cursor:G?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:function(){return!G&&O.current.open()},children:"+"})]})]})]}),(0,y.jsx)(We,{id:"\u200buploader-logo",ref:U,popup:!0,onUploadFinish:function(e){R({blockletLogo:e.data.filename})},plugins:["ImageEditor","Url","Webcam"],apiPathProps:{uploader:ee,disableMediaKitPrefix:!0}},"uploader-screenshot"),(0,y.jsx)(We,{id:"\u200buploader-screenshot",ref:O,popup:!0,onUploadFinish:function(e){var t,n=P.blockletScreenshots||[];n.push(null===(t=e.data)||void 0===t?void 0:t.filename),R({blockletScreenshots:n})},plugins:["ImageEditor","Url","Webcam"],apiPathProps:{uploader:te,disableMediaKitPrefix:!0}},"uploader-screenshot")]}),(0,y.jsxs)(a.Z,{display:"flex",mt:3,className:"section full-width",children:[(0,y.jsxs)(a.Z,{className:"left",children:[(0,y.jsx)(z.Z,{variant:"h3",children:Z("blocklet.publish.resourceTitle")}),(0,y.jsx)(we.Z,{tabs:F,current:X,orientation:"vertical",onChange:function(e){J(e)},sx:{width:"100%"}})]}),(0,y.jsx)(a.Z,{sx:{flex:1},children:(0,y.jsx)(a.Z,{children:re})})]})]})]}))}Oe.propTypes={},Oe.defaultProps={};var De,Ae=i.Z.div(Ve||(Ve=(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"])),(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 Fe(){return(0,y.jsx)(He,{children:(0,y.jsxs)(r.Routes,{children:[(0,y.jsx)(r.Route,{path:"/",element:(0,y.jsx)(I,{})}),(0,y.jsx)(r.Route,{path:"/create",element:(0,y.jsx)(ue,{})}),(0,y.jsx)(r.Route,{path:"/:projectId",element:(0,y.jsx)(ge,{})}),(0,y.jsx)(r.Route,{path:"/:projectId/:releaseId",element:(0,y.jsx)(Oe,{})})]})})}Fe.propTypes={};var He=(0,i.Z)(a.Z)(De||(De=(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),a=n(86822),c=n(19638),s=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)(s.Z,(0,o.Z)({did:t},i));return n?r?(0,d.jsx)(c.Z,{target:"_blank",href:n,underline:"hover",children:p}):(0,d.jsx)(a.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},30291:function(e,t,n){var o=n(71600);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=o(n(48035)),r=n(37574),i=(0,l.default)((0,r.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutline");t.default=i},32677:function(e,t,n){var o=n(71600);t.Z=void 0;var l=o(n(48035)),r=n(37574),i=(0,l.default)((0,r.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");t.Z=i}}]);
2
- //# sourceMappingURL=5010.a689a6b9.chunk.js.map