PageSourceSearch

https://app.valetseller.com/assets/Products-W-vWL11k.js

js valetseller.com collected 2026-10-05 03:47:12 UTC 27,264 bytes, 1 lines download raw bytes

1import{ab as re,ac as oe,r as c,ad as ie,ae as U,af as z,j as e,ag as G,ah as le,ai as ce,G as L,aj as Ne,ak as He,al as K,am as Ge,E as Q,an as qe,ao as Ee,c as D,R as N,ap as Qe,aq as Ue,ar as we,as as Ke,at as de,au as H,z as _,av as O,q as ae,K as ze,I as Y,J,h as T,N as Ye,aw as Je,ax as Le,m as V,ay as Xe,az as Ze,n as q,A as et,aA as E,aB as X,aC as tt,aD as at,p as Te,$ as Z,o as nt,aE as st,e as rt,t as ot,f as it,aF as lt,aG as ct,C as dt,aH as xe,T as w,w as ve,V as ut,O as _e,aI as pt,l as ht,aJ as fe,aK as F,X as mt,aL as gt,aM as xt,B as ee,aN as vt,b as De,a as ft,aO as te,L as yt,P as jt,W as bt,aP as Ct,a0 as St,aQ as $t,aa as Bt}from"./index-zg1WBDEd.js";import{M as It}from"./MobileActionDropdown-CeJmpRez.js";import{S as Mt}from"./Select-CBicO3P3.js";import{d as ye}from"./Download-BfnWh0Iz.js";import{S as Pt}from"./Snackbar-CLMiOGZt.js";import{d as kt}from"./Save-BbTwdeoB.js";import{B as Rt}from"./BlurImageAvatar-BxbsTVDX.js";import{F as At,A as zt}from"./ApplyFilterContainer-B4Xjt9rj.js";import"./Image-CkWkdnPS.js";function Lt(t){return re("MuiAvatarGroup",t)}const Tt=oe("MuiAvatarGroup",["root","avatar"]),_t=["children","className","component","componentsProps","max","renderSurplus","slotProps","spacing","total","variant"],je={small:-16,medium:null},Dt=t=>{const{classes:a}=t;return ce({root:["root"],avatar:["avatar"]},Lt,a)},Ft=L("div",{name:"MuiAvatarGroup",slot:"Root",overridesResolver:(t,a)=>z({[`& .${Tt.avatar}`]:a.avatar},a.root)})(({theme:t,ownerState:a})=>{const n=a.spacing&&je[a.spacing]!==void 0?je[a.spacing]:-a.spacing;return{[`& .${Ne.root}`]:{border:`2px solid ${(t.vars||t).palette.background.default}`,boxSizing:"content-box",marginLeft:n??-8,"&:last-child":{marginLeft:0}},display:"flex",flexDirection:"row-reverse"}}),Ot=c.forwardRef(function(a,n){var s;const i=ie({props:a,name:"MuiAvatarGroup"}),{children:r,className:l,component:u="div",componentsProps:g={},max:f=5,renderSurplus:x,slotProps:p={},spacing:h="medium",total:v,variant:B="circular"}=i,I=U(i,_t);let y=f<2?2:f;const M=z({},i,{max:f,spacing:h,component:u,variant:B}),m=Dt(M),S=c.Children.toArray(r).filter(j=>c.isValidElement(j)),P=v||S.length;P===y&&(y+=1),y=Math.min(P+1,y);const $=Math.min(S.length,y-1),A=Math.max(P-y,P-$,0),k=x?x(A):`+${A}`,b=(s=p.additionalAvatar)!=null?s:g.additionalAvatar;return e.jsxs(Ft,z({as:u,ownerState:M,className:G(m.root,l),ref:n},I,{children:[A?e.jsx(le,z({variant:B},b,{className:G(m.avatar,b==null?void 0:b.className),children:k})):null,S.slice(0,$).reverse().map(j=>c.cloneElement(j,{className:G(j.props.className,m.avatar),variant:j.props.variant||B}))]}))});function Vt(t){return re("MuiToggleButton",t)}const W=oe("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),Fe=c.createContext({}),Oe=c.createContext(void 0);function Wt(t,a){return a===void 0||t===void 0?!1:Array.isArray(a)?a.indexOf(t)>=0:t===a}const Nt=["value"],Ht=["children","className","color","disabled","disableFocusRipple","fullWidth","onChange","onClick","selected","size","value"],Gt=t=>{const{classes:a,fullWidth:n,selected:s,disabled:i,size:r,color:l}=t,u={root:["root",s&&"selected",i&&"disabled",n&&"fullWidth",`size${K(r)}`,l]};return ce(u,Vt,a)},qt=L(Ge,{name:"MuiToggleButton",slot:"Root",overridesResolver:(t,a)=>{const{ownerState:n}=t;return[a.root,a[`size${K(n.size)}`]]}})(({theme:t,ownerState:a})=>{let n=a.color==="standard"?t.palette.text.primary:t.palette[a.color].main,s;return t.vars&&(n=a.color==="standard"?t.vars.palette.text.primary:t.vars.palette[a.color].main,s=a.color==="standard"?t.vars.palette.text.primaryChannel:t.vars.palette[a.color].mainChannel),z({},t.typography.button,{borderRadius:(t.vars||t).shape.borderRadius,padding:11,border:`1px solid ${(t.vars||t).palette.divider}`,color:(t.vars||t).palette.action.active},a.fullWidth&&{width:"100%"},{[`&.${W.disabled}`]:{color:(t.vars||t).palette.action.disabled,border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:t.vars?`rgba(${t.vars.palette.text.primaryChannel} / ${t.vars.palette.action.hoverOpacity})`:Q(t.palette.text.primary,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${W.selected}`]:{color:n,backgroundColor:t.vars?`rgba(${s} / ${t.vars.palette.action.selectedOpacity})`:Q(n,t.palette.action.selectedOpacity),"&:hover":{backgroundColor:t.vars?`rgba(${s} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.hoverOpacity}))`:Q(n,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?`rgba(${s} / ${t.vars.palette.action.selectedOpacity})`:Q(n,t.palette.action.selectedOpacity)}}}},a.size==="small"&&{padding:7,fontSize:t.typography.pxToRem(13)},a.size==="large"&&{padding:15,fontSize:t.typography.pxToRem(15)})}),be=c.forwardRef(function(a,n){const s=c.useContext(Fe),{value:i}=s,r=U(s,Nt),l=c.useContext(Oe),u=He(z({},r,{selected:Wt(a.value,i)}),a),g=ie({props:u,name:"MuiToggleButton"}),{children:f,className:x,color:p="standard",disabled:h=!1,disableFocusRipple:v=!1,fullWidth:B=!1,onChange:I,onClick:y,selected:M,size:m="medium",value:S}=g,P=U(g,Ht),$=z({},g,{color:p,disabled:h,disableFocusRipple:v,fullWidth:B,size:m}),A=Gt($),k=j=>{y&&(y(j,S),j.defaultPrevented)||I&&I(j,S)},b=l||"";return e.jsx(qt,z({className:G(r.className,A.root,x,b),disabled:h,focusRipple:!v,ref:n,onClick:k,onChange:I,value:S,ownerState:$,"aria-pressed":M},P,{children:f}))});function Et(t){return re("MuiToggleButtonGroup",t)}const C=oe("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),Qt=["children","className","color","disabled","exclusive","fullWidth","onChange","orientation","size","value"],Ut=t=>{const{classes:a,orientation:n,fullWidth:s,disabled:i}=t,r={root:["root",n==="vertical"&&"vertical",s&&"fullWidth"],grouped:["grouped",`grouped${K(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return ce(r,Et,a)},wt=L("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(t,a)=>{const{ownerState:n}=t;return[{[`& .${C.grouped}`]:a.grouped},{[`& .${C.grouped}`]:a[`grouped${K(n.orientation)}`]},{[`& .${C.firstButton}`]:a.firstButton},{[`& .${C.lastButton}`]:a.lastButton},{[`& .${C.middleButton}`]:a.middleButton},a.root,n.orientation==="vertical"&&a.vertical,n.fullWidth&&a.fullWidth]}})(({ownerState:t,theme:a})=>z({display:"inline-flex",borderRadius:(a.vars||a).shape.borderRadius},t.orientation==="vertical"&&{flexDirection:"column"},t.fullWidth&&{width:"100%"},{[`& .${C.grouped}`]:z({},t.orientation==="horizontal"?{[`&.${C.selected} + .${C.grouped}.${C.selected}`]:{borderLeft:0,marginLeft:0}}:{[`&.${C.selected} + .${C.grouped}.${C.selected}`]:{borderTop:0,marginTop:0}})},t.orientation==="horizontal"?{[`& .${C.firstButton},& .${C.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${C.lastButton},& .${C.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0}}:{[`& .${C.firstButton},& .${C.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${C.lastButton},& .${C.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0}},t.orientation==="horizontal"?{[`& .${C.lastButton}.${W.disabled},& .${C.middleButton}.${W.disabled}`]:{borderLeft:"1px solid transparent"}}:{[`& .${C.lastButton}.${W.disabled},& .${C.middleButton}.${W.disabled}`]:{borderTop:"1px solid transparent"}})),Kt=c.forwardRef(function(a,n){const s=ie({props:a,name:"MuiToggleButtonGroup"}),{children:i,className:r,color:l="standard",disabled:u=!1,exclusive:g=!1,fullWidth:f=!1,onChange:x,orientation:p="horizontal",size:h="medium",value:v}=s,B=U(s,Qt),I=z({},s,{disabled:u,fullWidth:f,orientation:p,size:h}),y=Ut(I),M=c.useCallback((k,b)=>{if(!x)return;const j=v&&v.indexOf(b);let o;v&&j>=0?(o=v.slice(),o.splice(j,1)):o=v?v.concat(b):[b],x(k,o)},[x,v]),m=c.useCallback((k,b)=>{x&&x(k,v===b?null:b)},[x,v]),S=c.useMemo(()=>({className:y.grouped,onChange:g?m:M,value:v,size:h,fullWidth:f,color:l,disabled:u}),[y.grouped,g,m,M,v,h,f,l,u]),P=qe(i),$=P.length,A=k=>{const b=k===0,j=k===$-1;return b&&j?"":b?y.firstButton:j?y.lastButton:y.middleButton};return e.jsx(wt,z({role:"group",className:G(y.root,r),ref:n,ownerState:I},B,{children:e.jsx(Fe.Provider,{value:S,children:P.map((k,b)=>e.jsx(Oe.Provider,{value:A(b),children:k},b))})}))}),Ce=Ee(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),Yt=({children:t})=>{const a=D(),n=c.useRef(null),[s,i]=c.useState(!1),r=()=>i(!s);return e.jsxs(c.Fragment,{children:[e.jsx(N,{ref:n,variant:"contained",startIcon:e.jsx(At,{}),onClick:r,color:"success",size:"small",sx:{borderRadius:3},children:"Add Product"}),e.jsx(Qe,{open:s,anchorEl:n.current,transition:!0,disablePortal:!0,placement:"bottom-start",children:({TransitionProps:l})=>e.jsx(Ue,{onClickAway:()=>i(!1),children:e.jsx(we,{...l,timeout:350,children:e.jsx(Ke,{elevation:5,sx:{backgroundColor:a.palette.secondary.main},children:e.jsx(de,{sx:{bgcolor:"primary.main"},children:t})})})})})]})};function Jt(){const t=["parentSku","title","brand","category","inventoryMerchant","inventoryValetSeller","price","retailPrice","sku","cost","prop65","barcode","weight","weightUnit","description","countryOfOrigin","lowStockThreshold","status","expirationDate","itemDimensionLength","itemDimensionWidth","itemDimensionHeight","packageDimensionLength","packageDimensionWidth","packageDimensionHeight"];return e.jsx(c.Fragment,{children:e.jsx(H,{component:_,to:{pathname:"/products/spreadsheet/csv",search:ae.stringify({editFields:t.join(","),source:"csv"})},children:e.jsx(O,{primary:"Import from CSV file"})})})}function Xt(t){return t==null?void 0:t.map(a=>{var n,s,i,r,l,u,g,f,x,p,h,v,B,I;return{hasVariants:a==null?void 0:a.hasVariants,id:a.id,variationsImage:(s=(n=a==null?void 0:a.media)==null?void 0:n[0])==null?void 0:s.media,thumbnailUrlSmall:(r=(i=a==null?void 0:a.media)==null?void 0:i[0])==null?void 0:r.thumbnailUrlSmall,thumbnailUrlMedium:(u=(l=a==null?void 0:a.media)==null?void 0:l[0])==null?void 0:u.thumbnailUrlMedium,thumbnailUrlLarge:(f=(g=a==null?void 0:a.media)==null?void 0:g[0])==null?void 0:f.thumbnailUrlLarge,blurHash:(p=(x=a==null?void 0:a.media)==null?void 0:x[0])==null?void 0:p.blurHash,sku:a!=null&&a.hasVariants?a==null?void 0:a.parentSku:(h=((a==null?void 0:a.variants)||[])[0])==null?void 0:h.sku,title:a.title,inventoryMerchant:(a.variants||[]).reduce((y,M)=>y+M.inventoryMerchant,0),inventoryValetSeller:(a.variants||[]).reduce((y,M)=>y+M.inventoryValetSeller,0),marketplaces:a.marketplaces,status:a.status,price:Zt(a)||0,company:(v=a.company)==null?void 0:v.name,companyId:(B=a.company)==null?void 0:B.id,variants:a==null?void 0:a.variants,isIfsFulfilled:(((I=a.company)==null?void 0:I.orderTags)||[]).includes("12IFS")}})}function Zt(t){var n,s,i,r,l;if(Number((n=t.variants)==null?void 0:n.length)>1){const u=ze.sortBy(t.variants,x=>(x==null?void 0:x.price)||0),g=((s=u[0])==null?void 0:s.price)||0,f=((i=u[u.length-1])==null?void 0:i.price)||0;return g==f?`$${g}`:`$${g} - $${f}`}else return`$${((l=(r=t.variants)==null?void 0:r[0])==null?void 0:l.price)||0}`}var ue={},ea=J;
1Object.defineProperty(ue,"__esModule",{value:!0});var Ve=ue.default=void 0,ta=ea(Y()),aa=e;Ve=ue.default=(0,ta.default)((0,aa.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"OpenInNew");var pe={},na=J;Object.defineProperty(pe,"__esModule",{value:!0});var We=pe.default=void 0,sa=na(Y()),Se=e;We=pe.default=(0,sa.default)([(0,Se.jsx)("path",{d:"M17.59 18 19 16.59 14.42 12 19 7.41 17.59 6l-6 6z"},"0"),(0,Se.jsx)("path",{d:"m11 18 1.41-1.41L7.83 12l4.58-4.59L11 6l-6 6z"},"1")],"KeyboardDoubleArrowLeft");function ra({marketPlaces:t=[]}){var r;const a=D(),[n,s]=c.useState(!1),i=n?t==null?void 0:t.length:3;return e.jsxs(T,{direction:"row",spacing:2,justifyContent:"flex-end",children:[(t==null?void 0:t.length)>3&&e.jsx(Ye,{size:"small",onClick:()=>s(!n),children:n?e.jsx(Je,{}):e.jsx(We,{})}),e.jsx(Ot,{max:i,spacing:0,sx:{"& .MuiAvatar-root":{width:30,height:30,fontSize:15}},children:(r=t||[])==null?void 0:r.map(({marketplaceLink:l,marketplace:u})=>e.jsx(Le,{overlap:"circular",anchorOrigin:{vertical:"top",horizontal:"right"},badgeContent:l?e.jsx(Ve,{sx:{color:a.palette.text.secondary,backgroundColor:a.palette.primary.main,fontSize:15}}):null,children:e.jsx(le,{alt:u.name,src:(u==null?void 0:u.logo)||"",component:l?V:"a",to:l||"#",target:"_blank",rel:"noopener noreferrer"})}))})]})}const oa=L(Ze)(({theme:t})=>({maxWidth:"25vw","&[aria-large-screen=false]":{maxWidth:"100%"},height:43,width:"100%",backgroundColor:t.palette.secondary.light,border:`1px solid ${t.palette.primary.dark}`,borderRadius:t.spacing(2),padding:t.spacing(1,2,1,2),"&:before, &:after":{display:"none"}}));function $e({onSearch:t,searchBy:a,searchQuery:n,onSearchBySelect:s,placeholder:i="Search products",isLargeScreen:r=!0}){return e.jsx(oa,{startAdornment:e.jsx(Mt,{options:[{key:"all",label:"All"},{key:"sku",label:"Find by SKU"},{key:"title",label:"Find by title"},{key:"barcode",label:"Find by barcode"},{key:"merchant",label:"Find by merchant"}],value:a,onChange:s,sx:{mr:2,height:30},size:"small"}),placeholder:i,defaultValue:n,onChange:t,endAdornment:e.jsx(Xe,{}),"aria-large-screen":r})}function Be({products:t}){const[a,n]=c.useState(!1),s=D(),i=q(s.breakpoints.up("lg")),[r,l]=c.useState(!1),u=()=>l(!1),g=()=>l(!0),f=async()=>{var p;n(!0),g();const x=(p=t||[])==null?void 0:p.map(h=>h.id);tt(x).then(h=>at(h,"products.csv")).then(()=>n(!1)).catch(()=>{n(!1)})};return e.jsxs(c.Fragment,{children:[e.jsx(Pt,{open:r,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:6e3,onClose:u,children:e.jsx(et,{onClose:u,severity:"success",variant:"filled",children:"Getting your downloads ready! They'll start in a jiffy once they're prepped. Hang tight! 🚀🔧"})}),i?e.jsx(N,{variant:"outlined",size:"small",color:"success",startIcon:e.jsx(ye,{}),onClick:f,disabled:a,children:a?"Downloading...":"Download"}):e.jsx(E,{component:"div",disablePadding:!0,children:e.jsxs(H,{onClick:f,disabled:a,children:[e.jsx(X,{children:e.jsx(ye,{})}),e.jsx(O,{primary:a?"Downloading...":"Download"})]})})]})}function Ie({selectedProducts:t}){const a=D(),n=Te(),s=q(a.breakpoints.up("lg")),i={pathname:"/products/spreadsheet/edit",search:ae.stringify({...ae.parse(n.search),productIds:t.map(({id:r})=>r).join(","),editFields:["parentSku","title","brand","category","inventoryMerchant","inventoryValetSeller","price","retailPrice","sku"].join(",")})};return e.jsx(c.Fragment,{children:s?e.jsx(N,{startIcon:e.jsx(Ce,{}),component:_,to:i,variant:"outlined",color:"success",children:"Edit Products"}):e.jsx(E,{disablePadding:!0,children:e.jsxs(H,{component:_,to:i,children:[e.jsx(X,{children:e.jsx(Ce,{})}),e.jsx(O,{primary:"Edit Products"})]})})})}var he={},ia=J;Object.defineProperty(he,"__esModule",{value:!0});var ne=he.default=void 0,la=ia(Y()),ca=e;ne=he.default=(0,la.default)((0,ca.jsx)("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-5 12H9v-2h6zm5-7H4V4l16-.02z"}),"Inventory");function Me(){var i;const t=D(),a=q(t.breakpoints.up("lg")),{fetchedUser:n}=Z(r=>r.users),s="/products/update-inventory";return(i=n==null?void 0:n.user)!=null&&i.isAdmin?e.jsx(c.Fragment,{children:a?e.jsx(N,{component:_,to:s,variant:"outlined",size:"small",color:"success",startIcon:e.jsx(ne,{}),children:"Update Inventory"}
1):e.jsx(E,{disablePadding:!0,children:e.jsxs(H,{component:_,to:s,children:[e.jsx(X,{children:e.jsx(ne,{})}),e.jsx(O,{primary:"Update Inventory"})]})})}):null}var me={},da=J;Object.defineProperty(me,"__esModule",{value:!0});var se=me.default=void 0,ua=da(Y()),pa=e;se=me.default=(0,ua.default)((0,pa.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2m-8 6H8v1h3c.55 0 1 .45 1 1v3c0 .55-.45 1-1 1h-1v1H8v-1H6v-2h4v-1H7c-.55 0-1-.45-1-1V9c0-.55.45-1 1-1h1V7h2v1h2zm4 6.25-2-2h4zM14 10l2-2 2 2z"}),"PriceChange");function Pe(){var i;const t=D(),a=q(t.breakpoints.up("lg")),{fetchedUser:n}=Z(r=>r.users),s="/products/update-price";return(i=n==null?void 0:n.user)!=null&&i.isAdmin?e.jsx(c.Fragment,{children:a?e.jsx(N,{component:_,to:s,variant:"outlined",size:"small",color:"success",startIcon:e.jsx(se,{}),children:"Update Price"}):e.jsx(E,{disablePadding:!0,children:e.jsxs(H,{component:_,to:s,children:[e.jsx(X,{children:e.jsx(se,{})}),e.jsx(O,{primary:"Update Price"})]})})}):null}const ke={inventoryMerchant:"Merchant",inventoryValetSeller:"Valet Seller"},ha={inventoryMerchant:ct,inventoryValetSeller:lt};function ma({warehouse:t,productVariation:a,refetch:n}){const[s,i]=c.useState("add"),r=c.useRef(a[t]||0),l=nt({inventoryQuantity:st().gte(0,"Must be at least 0")}),[u,g]=c.useState(null),{control:f,handleSubmit:x,watch:p,reset:h}=rt({mode:"onBlur",defaultValues:{inventoryQuantity:null},resolver:ot(l)}),v=p("inventoryQuantity"),{mutate:B,isPending:I}=it({mutationFn:async m=>await ha[t](m),onSuccess:()=>{r.current=v,h({inventoryQuantity:null}),n()}}),y=Number(r.current),M=m=>{B({...m,note:u,productId:a.productId,id:a.id})};return e.jsx("form",{onSubmit:x(M),children:e.jsx(dt,{control:f,name:"inventoryQuantity",render:({field:m,fieldState:{error:S}})=>e.jsxs(xe,{direction:"row",spacing:2,alignItems:"center",children:[e.jsxs(xe,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(w,{children:ve.format(y)}),v!==null&&e.jsxs(c.Fragment,{children:[e.jsx(ut,{sx:{color:"text.primary"}}),e.jsx(w,{children:ve.format(m.value||0)})]})]}),e.jsxs(Kt,{color:"success",value:s,onChange:(P,$)=>{m.onChange(null),i($)},exclusive:!0,children:[e.jsx(be,{value:"add",size:"small",children:"Add"}),e.jsx(be,{value:"set",size:"small",children:"Set"})]}),e.jsx(_e,{defaultValue:m.value,placeholder:`${ke[t]} Inventory`,label:`${ke[t]} Inventory`,size:"small",type:"number",error:!!(S!=null&&S.message),helperText:e.jsx("small",{children:S==null?void 0:S.message}),InputProps:{startAdornment:e.jsx(pt,{setNote:g,note:u})},onChange:P=>{const $=Number(P.target.value||0),A=s==="add"?$+y:$;m.onChange(P.target.value?A:null)}}),e.jsx(ht,{startIcon:e.jsx(kt,{}),size:"small",variant:"contained",loadingPosition:"start",type:"submit",color:"success",disabled:v===null||I,loading:I,children:"Save"})]})})})}const ga=L(ee)(()=>({overflowY:"auto",maxHeight:"60vh",minHeight:"60vh"})),xa={inventoryMerchant:"Merchant",inventoryValetSeller:"Valet Seller"};function Re({quantity:t,hasVariants:a,warehouse:n,variants:s,title:i,refetch:r,isIfsFulfilled:l}){var M,m,S,P;const[u,g]=c.useState(!1),f=()=>g(!1),x=D(),{fetchedUser:p}=Z($=>$.users),[h]=(p==null?void 0:p.user.companies)||[],v=(h==null?void 0:h.shippingOption)===fe.SHIP_ORDERS_MYSELF||(h==null?void 0:h.shippingOption)===fe.HYBRID_SHIPPING,B=(M=((h==null?void 0:h.Integration)||[]).find($=>$.name==="SHOPIFY"))==null?void 0:M.syncInventoryLevels,I={inventoryMerchant:(m=p==null?void 0:p.user)!=null&&m.isAdmin?!!((S=p==null?void 0:p.user)!=null&&S.isAdmin):!v||!!B,inventoryValetSeller:!((P=p==null?void 0:p.user)!=null&&P.isAdmin)},y=()=>g(!0);return e.jsxs(c.Fragment,{children:[e.jsx(N,{variant:"outlined",size:"small",color:"success",fullWidth:!0,onClick:y,children:e.jsxs(F,{maxWidth:200,children:[`${t} units`,a&&` for ${s==null?void 0:s.length} variants`]})}),e.jsx(mt,{open:u,setOpen:g,header:`Edit ${xa[n]} Inventory`,top:"45%",left:"50%",width:"70%",closeButtonCallback:f,children:e.jsx(ga,{children:e.jsx(de,{sx:{bgcolor:"secondary.main"},dense:!0,children:s.map(({sku:$,optionOne:A,optionTwo:k,optionThree:b,...j})=>{var o;return e.jsxs(E,{divider:!0,secondaryAction:I[n]||l?e.jsxs(w,{children:[j[n]||0," units"]}):e.jsx(ma,{warehouse:n,productVariation:j,refetch:r}),children:[e.jsx(gt,{children:e.jsx(Le,{color:"primary",badgeContent:j[n]||0,children:e.jsx(le,{src:(o=((j==null?void 0:j.media)||[])[0])==null?void 0:o.media,variant:"rounded",sx:{border:`2px solid ${x.palette.success.main}`,height:35,width:35},children:e.jsx(xt,{})})})}),e.jsx(O,{primary:e.jsx(F,{maxWidth:280,children:[A,k,b].filter(
1Boolean).join(" / ")||i}),secondary:e.jsxs(F,{color:"text.secondary",maxWidth:280,children:[e.jsx("b",{children:"SKU: "}),$]})})]},$)})})})})]})}const va=L(ee)(({theme:t})=>({backgroundColor:t.palette.secondary.main})),fa=L(ee)(()=>({overflow:"hidden",overflowX:"auto"})),ya=L(ee)(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(4),padding:t.spacing(2,3)})),Ae={Pending:"warning",Published:"success",Draft:"default"};function ja({scrollPosition:t,importedAt:a}){const[n,s]=c.useState([]),i=D(),r=De(),l=Te(),u=q(i.breakpoints.up("lg")),{searchBy:g="all",limit:f="25",offset:x="0",query:p="",sortBy:h="",sortOrder:v,status:B}=r.queries,[I,y]=c.useState(p),{isLoading:M,data:m,refetch:S,isRefetching:P}=ft({queryKey:["get_product_list",g,f,x,p,h,v,B],queryFn:async({signal:o})=>await Ct({searchBy:g,limit:f,offset:x,query:p,sortBy:h,sortOrder:v,status:B},o),refetchInterval:a&&Date.now()-a<3e4?3e3:!1}),$=c.useMemo(()=>m!=null&&m.data?Xt(m.data):[],[m==null?void 0:m.data]),A=c.useCallback(ze.debounce(o=>{var R;r.push({pathname:r.pathname,queries:{...r.queries,query:(R=o||"")==null?void 0:R.trim(),...o&&{offset:0},offset:"0"}})},500,{leading:!1}),[r.queries]),k=o=>{y(o.target.value),A(o.target.value)},b=()=>{S(),s([])},j=(o,R)=>r.push({pathname:r.pathname,queries:{...r.queries,searchBy:R}});return e.jsxs(va,{children:[e.jsxs(ya,{children:[u&&e.jsx(w,{variant:"h4",fontWeight:700,sx:{whiteSpace:"nowrap"},children:"Products"}),u?e.jsxs(T,{width:"100%",direction:"row",justifyContent:"space-between",children:[e.jsx($e,{onSearch:k,searchBy:g,searchQuery:I,onSearchBySelect:j}),e.jsxs(T,{direction:"row",spacing:2,children:[!!n.length&&e.jsxs(c.Fragment,{children:[e.jsx(Ie,{selectedProducts:n}),e.jsx(te,{productIds:n.map(({id:o})=>o),onDelete:b,variant:"outlined",color:"success"})]}),e.jsx(Be,{products:n}),e.jsx(Me,{}),e.jsx(Pe,{})]})]}):e.jsxs(T,{direction:"row",justifyContent:"flex-end",width:"100%",children:[e.jsx($e,{onSearch:k,searchBy:g,searchQuery:I,onSearchBySelect:j,isLargeScreen:u}),e.jsx(It,{children:e.jsxs(de,{children:[!!n.length&&e.jsxs(c.Fragment,{children:[e.jsx(Ie,{selectedProducts:n}),e.jsx(te,{productIds:n.map(({id:o})=>o),onDelete:b,variant:"outlined",color:"success"})]}),e.jsx(Be,{products:n}),e.jsx(Me,{}),e.jsx(Pe,{})]})})]})]}),e.jsxs(fa,{children:[M||P&&e.jsx(yt,{color:"success"}),e.jsx(jt,{offset:Number(x||0),limit:Number(f||50),selectable:!0,onSelectItems:o=>{s(o)},data:$||[],isQueries:!0,onQueries:o=>{r.push({pathname:r.pathname,queries:{...r.queries,...o}})},totalItems:m==null?void 0:m.totalCount,isLoading:M&&!(m!=null&&m.data),searchHighlight:"",renderRowActions:o=>e.jsx(T,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(te,{productIds:[o==null?void 0:o.id],onDelete:b,isIcon:!0})}),headers:[{key:"variationsImage",label:"",to:({id:o})=>`/products/edit/${o}/vital-info`,renderColumn(o,R,d){return e.jsx(Rt,{blurHash:d.blurHash,thumbnailUrlSmall:d.thumbnailUrlSmall||o,thumbnailUrlMedium:d.thumbnailUrlMedium,thumbnailUrlLarge:d.thumbnailUrlLarge,scrollPosition:t})}},{key:"sku",label:"SKU",sort:!0,sortKey:"parentSku",renderColumn(o,R,d){return e.jsx(V,{to:{pathname:`/products/edit/${d.id}/vital-info`,search:l==null?void 0:l.search},state:{searchBy:g,limit:f,offset:x,query:p,sortBy:h,sortOrder:v,status:B},sx:{color:"text.primary","&:hover":{color:"text.secondary"}},children:e.jsx(F,{maxWidth:200,children:o})})}},{key:"title",label:"Title",sort:!0,renderColumn(o,R,d){return e.jsx(V,{to:{pathname:`/products/edit/${d.id}/vital-info`,search:l==null?void 0:l.search},state:{searchBy:g,limit:f,offset:x,query:p,sortBy:h,sortOrder:v,status:B},sx:{color:"text.primary","&:hover":{color:"text.secondary"}},children:e.jsx(F,{maxWidth:200,children:o})})}},{key:"inventoryMerchant",label:"Merchant Inventory",sort:!0,sortKey:"inventoryQuantity",renderColumn(o,R,d){return e.jsx(Re,{warehouse:"inventoryMerchant",quantity:o,hasVariants:d==null?void 0:d.hasVariants,variants:(d==null?void 0:d.variants)||[],title:d==null?void 0:d.title,refetch:S})}},{key:"inventoryValetSeller",label:"Valet Seller Inventory",sort:!0,sortKey:"inventoryQuantity",renderColumn(o,R,d){return e.jsx(Re,{warehouse:"inventoryValetSeller",quantity:o,hasVariants:d==null?void 0:d.hasVariants,variants:(d==null?void 0:d.variants)||[],title:d==null?void 0:d.title,refetch:S,isIfsFulfilled:d.isIfsFulfilled})}},{key:"price",label:"Price",renderColumn(o,R,d){return e.jsx(V,{to:{pathname:`/products/edit/${d.id}/vital-info`,search:l==null?void 0:l.search},state:{searchBy:g,limit:f,offset:x,query:p,sortBy:h,sortOrder:v,status:B},sx:{color:"text.primary","&:hover":{color:"text.secondary"}},children:e.jsx(F,{maxWidth:150,children:o})})}},{key:"status",label:"Status",sort:!0,renderColumn(o,R,d){const ge=o;return e.jsx(V,{to:{pathname:`/products/edit/${d.id}/vital-info`,search:l==null?void 0:l.search},state:{searchBy:g,limit:f,offset:x,query:p,sortBy:h,sortOrder:v,status:ge},sx:{color:"text.primary","&:hover":{color:"text.secondary"}},children:e.jsx(bt,{label:o,color:Ae[ge]||Ae.Draft,size:"small"})})}},{key:"marketplaces",label:"Marketplace",sort:!0,hideForShopifyClient:!0,renderColumn(o){const R=o;return e.jsx(ra,{marketPlaces:R})}},{key:"company",label:"Merchant",adminColumn:!0,renderColumn(o,R,d){return e.jsx(V,{to:`/brands/${d==null?void 0:d.companyId}/info`,sx:{color:"text.primary","&:hover":{color:"text.secondary"}},children:e.jsx(F,{maxWidth:100,children:o})})}}]})]})]})}const ba=vt.trackWindowScroll(ja);function Ca(){const t=De(),{status:a=""}=t.queries,[n,s]=c.useState(a);return c.useEffect(()=>{t.push({pathname:t.pathname,queries:{...t.queries,status:n||""}})},[n]),e.jsx(zt,{children:e.jsx(T,{spacing:1,p:1,children:e.jsx(St,{options:["Draft","Pending","Published"],autoHighlight:!0,fullWidth:!0,sx:{width:300},value:n,onChange:(i,r)=>s(r),renderInput:i=>e.jsx(_e,{...i,label:"Status filter",size:"small",placeholder:"Status filter"})})})})}const Sa=L(Bt)(({theme:t})=>({backgroundColor:t.palette.secondary.main,padding:0,borderRadius:12}));function La(){var i,r;const{fetchedUser:t}=Z(l=>l.users),[a,n]=c.useState(null),s=(((i=((t==null?void 0:t.user.companies)||[])[0])==null?void 0:i.Integration)||[]).some(({name:l})=>l==="SHOPIFY");return e.jsxs(T,{spacing:3,children:[e.jsx(Sa,{position:"relative",elevation:0,
1children:e.jsxs(T,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsx(Yt,{children:e.jsxs(c.Fragment,{children:[((r=t==null?void 0:t.user)==null?void 0:r.isAdmin)&&e.jsx(Jt,{}),s&&e.jsx($t,{onImportSuccess:()=>n(Date.now())}),e.jsx(H,{component:_,to:"/products/add/vital-info",children:e.jsx(O,{primary:"Manual Product Builder"})})]})}),e.jsx(Ca,{})]})}),e.jsx(ba,{importedAt:a})]})}export{La as Products,La 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.