1"use strict";(self.webpackChunkalfred=self.webpackChunkalfred||[]).push([[21334],{82411:function(e,n,a){a.r(n),a.d(n,{default:function(){return _}});var t=a(74165),l=a(15861),s=a(29439),i=a(56641),r=a(42380),o=a(77980),c=a(86334),u=a(91482),d=a(77671),p=a(33083),m=a(93433),f=a(43282),h=a(90524),x=a(47313),g=a(15146),Z=a(46417),b=function(e){var n=e.LeftColumn,a=e.RightColumn;return(0,Z.jsxs)(o.Z,{direction:"row",justify:"center",as:r.Z,mt:"xs",children:[(0,Z.jsx)(o.Z.Item,{colspan:6,children:n}),(0,Z.jsx)(o.Z.Item,{colspan:15,children:a})]})},j=function(e){var n=e.uploadedMedia,a=e.onReset,t=x.useCallback((function(){var e=[["file_name","s3_url"]].concat((0,m.Z)(n.map((function(e){return['"'+e.fileName+'"','"'+e.url+'"']})))).map((function(e){return e.join(",")})).join("\n");(0,g.EZ)(e,"s3Url")}),[n]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(o.Z,{direction:"row",justify:"center",align:"middle",gutter:"sm",as:r.Z,mb:"lg",children:[(0,Z.jsx)(o.Z.Item,{colspan:4,children:(0,Z.jsx)(i.Z,{appearance:"link",size:"md",block:!0,color:"red",onClick:a,dataSdEvent:"uploadMediaReset",children:"Reset"})}),(0,Z.jsx)(o.Z.Item,{colspan:4,children:(0,Z.jsx)(i.Z,{appearance:"primary",size:"md",block:!0,onClick:t,dataSdEvent:"downloadUploadMediaCsv",children:"Download CSV"})})]}),(0,Z.jsx)(b,{LeftColumn:(0,Z.jsx)(f.Z,{styleguide:"heading4",children:"File Name"}),RightColumn:(0,Z.jsx)(f.Z,{styleguide:"heading4",children:"S3 Url"})}),n.map((function(e,n){return(0,Z.jsx)(b,{LeftColumn:(0,Z.jsx)(f.Z,{styleguide:"body2",children:e.fileName}),RightColumn:(0,Z.jsx)(h.Z,{relative:"full",to:e.url,underline:!0,target:"_blank",children:e.url})},"upload_media_two_column_container_".concat(e.url,"__").concat(n))}))]})}
1,k=a(73782),v=function(){var e=(0,l.Z)((0,t.Z)().mark((function e(n,a,l){var s,i,r;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={fileType:l,uploadCategory:a},i=new FormData,n.blobFile&&i.append("media",n.blobFile),i.append("category",JSON.stringify(s)),e.next=6,k.Lp.post({url:"inventory/media/",payload:i});case 6:return r=e.sent,e.abrupt("return",r.data);case 8:case"end":return e.stop()}}),e)})));return function(n,a,t){return e.apply(this,arguments)}}(),y=a(33678),C=a(24002),w=a(27190),S=[{label:"Nushop Website Assets",value:"nushop-website-assets"},{label:"Nushop Operation Assets",value:"nushop-ops-assets"}],I=[{label:"Image",value:"image"},{label:"Video",value:"video"}],_=function(){var e=x.useState("nushop-website-assets"),n=(0,s.Z)(e,2),a=n[0],m=n[1],f=x.useState("image"),h=(0,s.Z)(f,2),g=h[0],b=h[1],k=x.useState([]),_=(0,s.Z)(k,2),F=_[0],L=_[1],N=x.useState(!1),M=(0,s.Z)(N,2),R=M[0],U=M[1],z=x.useState([]),E=(0,s.Z)(z,2),G=E[0],T=E[1],V=(0,C.Z)(),O=x.useCallback((function(e){L([]),b(e[0])}),[]),P=x.useCallback((function(e){m(e[0])}),[]),A=x.useCallback((function(e){L(e)}),[]),D=x.useCallback((function(){U(!0);var e=[];(0,y.x)((0,l.Z)((0,t.Z)().mark((function n(){var l,s,i;return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:l=0;case 1:if(!(l<F.length)){n.next=10;break}return n.next=4,v(F[l],a,g);case 4:s=n.sent,i={fileName:F[l].name,url:s.data.s3_link},e.push(i);case 7:l++,n.next=1;break;case 10:T(e),U(!1),L([]),V.push({type:"success",message:"Links Generated Successfully!"});case 14:case"end":return n.stop()}}),n)}))),(function(){return U(!1)}))()}),[a,g,F,V]),H=x.useCallback((function(){b("image"),m("nushop-website-assets"),L([]),T([])}),[]);return R?(0,Z.jsx)(w.default,{description:"Uploading Media and Generating Link"}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(r.Z,{mb:"md",children:[(0,Z.jsx)(u.Z,{Icon:function(e){var n=e.fillPath;return(0,Z.jsx)(d.default,{width:100,height:56,fillPath:n})},IconHover:function(){return(0,Z.jsx)(p.default,{})},title:"image"===g?"Upload Images":"Upload Videos",listType:"picture-text",subtitle:"You can Upload Single or Multiple Images/Videos",filetype:"image"===g?"image/*":"video/mp4",maxNoOfFiles:20,maxSize:20,fileList:F,handleFileList:A}),(0,Z.jsxs)(o.Z,{direction:"row",as:r.Z,justify:"center",align:"middle",gutter:"sm",children:[(0,Z.jsx)(o.Z.Item,{colspan:5,children:(0,Z.jsx)(c.Z,{data:S,size:"md",placeholder:"Please Select S3 bucket Type",block:!0,value:a,onChange:P,cleanable:!1})}),(0,Z.jsx)(o.Z.Item,{colspan:5,children:(0,Z.jsx)(c.Z,{data:I,placeholder:"Select File Type",size:"md",block:!0,value:g,onChange:O,cleanable:!1})}),(0,Z.jsx)(o.Z.Item,{colspan:5,children:(0,Z.jsx)(i.Z,{appearance:"primary",size:"md",disabled:!F.length,onClick:D,block:!0,loading:R,dataSdEvent:"uploadMediaGenerateLink",children:"Generate Link"})})]})]}),G.length?(0,Z.jsx)(j,{uploadedMedia:G,onReset:H}):(0,Z.jsx)(Z.Fragment,{})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.