PageSourceSearch

https://app.litcommerce.com/assets/EditView-DbbZhgpO.js

js litcommerce.com collected 2026-10-02 02:28:44 UTC 6,174 bytes, 1 lines download raw bytes

1import{m as me,d as Ne,g as fe,a_ as ge,r as a,aT as ke,cx as He,j as t,B as v,ae as Ae,bL as Oe,P as le,cy as Re,cv as ze,ab as $e,au as qe,ac as We,n as Ye}from"./index-DD7wEX2k.js";import{d as Ge}from"./ArrowBack-DPKRexet.js";import{H as Je}from"./index-BtNkM2il.js";import{P as Ke}from"./Page-mik8EZ_Q.js";import{C as Qe,t as g,T as pe,a as Xe,b as Ze,U as et,F as tt,c as st,B as ue,d as nt,s as at}from"./CSVDelimiter-B3UwS_NG.js";import"./AllProductContext-C2skYRpJ.js";import"./AllProductCountContext-DiWtSr9V.js";import"./InfoOutlined-BJLHdNY6.js";import"./Grid-eV9hG1VW.js";import"./Help-DIwhWvl8.js";import"./HeaderPageTitle-y5EsJ77J.js";import"./Autocomplete-w5JONlgQ.js";import"./CheckCircle-CmxgKwYs.js";import"./Lazy-B4elB764.js";import"./toString-BpP3vzIR.js";import"./Switch-y6CmP1sJ.js";const ot=me(o=>({root:{marginTop:o.spacing(3),padding:o.spacing(2),paddingBottom:50},content:{padding:16,minHeight:300,marginTop:24},contentMapping:{padding:16,marginTop:24}})),A={file:"upload",ftp:"ftp"};function it(){const o=ot(),b=Ne(),{defaultListing:l}=fe(e=>e.listing),{feedId:c}=ge(),[p,Ce]=a.useState(""),{enqueueSnackbar:ye}=ke(),w=l.id,{urlConnect:O,setUrlConnect:E,successUrl:C,setFile:R,file:he,listCustomCsv:y,dataFirstLine:xe,setDataFirstLine:u,customType:s,isTestConnect:V,setIsTestConnect:_,csvType:d,setSuccessUrl:M,isEnterColumnCSV:Fe,submitCsv:h,urlValid:D,setUrlValid:je,errorConnect:z,setErrorConnect:$,missingValue:I,setIsEnterColumnCsv:L,setMissingValue:P,setSubmitCsv:U,setCsvType:B,setIsReset:N,isValidFtp:q,ftpDirectory:W,ftpHost:Y,ftpUser:G,ftpPassword:J,setIsValidFtp:Se,setFtpHost:K,setFptPassword:Q,setFtpDirectory:X,setFtpUser:Z,isReset:Te,setCustomType:x,setListCustomCsv:F,feedName:ee,setFeedName:te,setDelimiter:se,delimiter:m}=Qe(),[ve,j]=a.useState(!0),[be,we]=a.useState(!1),[Ee,Ve]=a.useState("upload"),[_e,ne]=a.useState("url"),Me=e=>{var r;B(e.target.value),ne((r=at)==null?void 0:r[e.target.value]),j(Ee===e.target.value)},[De,ae]=a.useState(!1),[Ie,Le]=a.useState(!1),Pe=()=>b.push("/csv-feeds"),k=a.useMemo(()=>g[s]===pe?!1:!I.every(e=>e===!1),[I,s]),Ue=e=>{M(""),x(e.target.value),R(null),_(!1)},Be=()=>{let e={};return y==null?void 0:y.map(n=>(e[n.columnName]=n.columnIndex,null)),e},S=async(e=C,r=!1)=>{var n,re,ce,de;try{$(""),U(!0);const i={any:Be(),litc:null},f=()=>{let T={};return i[g[s]]?(T.mapping=i[g[s]],T.format=g[s]):T.format=pe,T};let H={channel_type:"file",feed_name:ee||"",url:e.toString(),delimiter:m,method:_e,...f(),feed_type:p,channel_name:"Csv"};r&&(H={...H,user:G,password:J,host:Y,directory:W}),await Re({feed_id:c,channel_id:w,body:H})&&(Pe(),ye("success",{variant:"success"}))}catch(i){const f=((re=(n=i==null?void 0:i.response)==null?void 0:n.data)==null?void 0:re.message)||((de=(ce=i==null?void 0:i.response)==null?void 0:ce.data)==null?void 0:de.errors);$(typeof f=="object"?ze(f,1):f||"Error edit new feed")}U(!1)},oe=async(e=O)=>{await S(e)},ie=a.useCallback(async()=>{ae(!0);try{const e=await He({feed_id:c,channel_id:w});if(e){if(te((e==null?void 0:e.feed_name)||""),Ce(e.feed_type),se((e==null?void 0:e.delimiter)||","),we(!!(e!=null&&e.delimiter)),Z((e==null?void 0:e.user)||""),X((e==null?void 0:e.directory)||""),K((e==null?void 0:e.host)||""),Q((e==null?void 0:e.password)||""),ne(e==null?void 0:e.method),typeof(e==null?void 0:e.mapping)=="object"&&Object.keys(e==null?void 0:e.mapping).length>0){const r=Object.keys(e.mapping).map(n=>({columnName:n,columnIndex:e.mapping[n],columnLabel:""}));P(r.map(n=>n.columnName===""||n.columnIndex==="")),F(r),x((e==null?void 0:e.format)==="litc"?"default":"custom")}Le(e==null?void 0:e.feed_type),u((e==null?void 0:e.first_line)||[]),B((A==null?void 0:A[e==null?void 0:e.method])||"download"),e!=null&&e.url&&(E(e.url),M(e==null?void 0:e.url),Ve("download"))}}catch(e){console.log(e)}ae(!1)},[c,w,B,E,F,x,P,u]);return a.useEffect(()=>{ie()},[ie]),a.useEffect(()=>{L(!0)},[L]),t.jsxs(v,{children:[De&&t.jsx(Ae,{}),z&&t.jsx(Oe,{content:t.jsx(v,{children:z}),type:"warning"}),t.jsxs(le,{className:o.content,children:[t.jsx(Xe,{changeType:Me,customType:s,changeCustomType:Ue,csvType:d,submitCsv:h,type:"edit",feedType:p,feedName:ee,setFeedName:te}),d==="upload"&&t.jsx(Ze,{file:he,connectFormat:g[s],setFile:R,setIsReset:N,handleClickConnect:S,setSubmitCsv:U,isDisableMappingValueMissing:k,setSuccessUrl:M,submitCsv:h,successUrl:C,setShowMapping:j,setListCustomCsv:F,setDataFirstLine:u,delimiter:m}),d==="download"&&t.jsx(et,{customType:s,urlConnect:O,isEdit:!0,setIsReset:N,setShowMapping:j,setFirstLine:u,urlValid:D,setIsTestConnect:_,setUrlConnect:E,setUrlValid:je,delimiter:m}),d==="ftp"&&t.jsx(tt,{user:G,setShowMapping:j,setUser:Z,password:J,directory:W,setIsValidFtp:Se,setDirectory:X,setHost:K,setIsTestConnect:_,setFirstLine:u,host:Y,setPassword:Q,delimiter:m}),t.jsx(st,{delimiter:m,setDelimiter:se,openInitDelimiter:be}),s==="default"&&t.jsx(ue,{isTestConnect:V,urlValid:D,csvType:d,feedButton:"save",successUrl:C,validFtp:q,handleClickConnect:S,handleDownloadUrl:oe,submitCsv:h,isDisableMappingValueMissing:k})]}),s==="custom"&&ve&&t.jsxs(le,{className:o.contentMapping,children:[t.jsx(nt,{isEnterColumnCSV:Fe,setIsEnterColumnCsv:L,listCustomCsv:y,customType:s,setIsReset:N,missingValue:I,isAddFeed:Ie,setMissingValue:P,isTestConnect:V,setCustomType:x,isReset:Te,setListCustomCsv:F,dataFirstLine:xe}
1),s==="custom"&&t.jsx(v,{children:t.jsx(ue,{urlValid:D,csvType:d,handleDownloadUrl:oe,submitCsv:h,feedButton:"save",successUrl:C,isEdit:!0,validFtp:q,isTestConnect:V,handleClickConnect:S,isDisableMappingValueMissing:k})})]})]})}const rt=me(o=>({root:{marginTop:o.spacing(3),paddingBottom:50}}));function bt(){const o=rt(),{feedId:b}=ge(),l=fe(c=>{var p;return(p=c==null?void 0:c.listing)==null?void 0:p.defaultListing});return(l==null?void 0:l.type)!=="file"?t.jsx($e,{to:"/"}):t.jsx(Ke,{className:o.root,title:"Channel Connect",children:t.jsx(qe,{children:t.jsxs(We,{maxWidth:!1,children:[t.jsx(Je,{headerName:`Edit Feed ${b}`}),t.jsxs(v,{display:"flex",alignItems:"center",mb:2,children:[t.jsx(Ge,{fontSize:"small",color:"primary",mb:2}),t.jsx(Ye,{to:"/csv-feeds",children:"Your CSV Feed"})]}),t.jsx(it,{})]})})})}export{bt as default};

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.