PageSourceSearch

https://rsdmrkt.com/assets/SquareIntegration-CroCd2I_.js

js rsdmrkt.com collected 2026-09-25 04:10:58 UTC 25,776 bytes, 1 lines download raw bytes

1import{r as a,j as e,L as mt}from"./emotion-element-f0de968e.browser.esm-DAcAn3jx.js";import{u as bn,aQ as Cn,h as Sn,aR as vn,aS as wn,aT as In,aU as kn,aV as Ln,aW as qn,aX as En,aY as Fn,aZ as zn,a_ as Rn,a$ as Tn}from"./api-KZNW2Ket.js";import{D as An}from"./DefaultButton-EB8kJvev.js";import{u as Bn,a as Un,b as Wn,c as _n,d as Nn}from"./squareappApi-8Fvjmfzd.js";import{S as Mn,A as u}from"./spa-Bes9Hfn3.js";import{I as On}from"./IntegrationPageBreadcrumbs-DKcuSDGL.js";import{E as ce}from"./ExpandMore-CdwD6sTR.js";import{E as de}from"./ExpandLess-ClHjhs_k.js";import{R as ue}from"./Refresh-CvMXgiuf.js";import{u as Pn,B as w,C as p}from"./Button-KVxmVPcQ.js";import{u as Vn,F as Qn}from"./index-DkVogYJF.js";import{B as c,T as o}from"./Box-CdsPgKjk.js";import{A as yt}from"./AlertTitle-embR2wDM.js";import{F as Hn}from"./TextField-BKbREhBK.js";import{a as Gn,R as he,F as xe}from"./Tooltip-BamK8vw1.js";import{F as j}from"./FormControlLabel-gDZUzoP6.js";import{C as N}from"./Card-QqbP_w_-.js";import{C as M}from"./CardContent-lZ3_nTe8.js";import{S as O}from"./Switch-6hGafiCH.js";import{I as ge}from"./IconButton-C4bln0zo.js";import{C as pe}from"./CustomerWrapper-DjrlGE5P.js";import{C as T}from"./Checkbox-BQKglEA7.js";import{D as Kn}from"./Divider-DJxQQ4t0.js";import"./preload-helper-ckwbz45p.js";import"./hydrationSignal-CiVg0RVs.js";import"./index-B8xgCRSP.js";import"./CartWrapper-C0ybKg8A.js";import"./Snackbar-BLmOveHA.js";import"./imageUtils-Bv75Hoxq.js";import"./ArrowRight-B4QKvvAX.js";import"./Price-CnfREIyP.js";import"./moment-BLMuvzoS.js";import"./Skeleton-DSjqnrBB.js";import"./cssUtils-BDukCBHC.js";import"./AnimatedLink-CaZ5Lp4_.js";import"./Drawer-D9kGXRYg.js";import"./useId-BOtalUON.js";import"./ItemNotFound-ryDCeKGA.js";import"./Favorite-V6xGmSVP.js";import"./LocationOn-DM2UKiY4.js";import"./appPaths-B9EFiJhW.js";import"./Edit-DQtX7EYK.js";import"./DialogTitle-BztL3sGR.js";import"./Chip-BmmJUiHy.js";import"./LocalizationProvider-DSrdV9YK.js";import"./useThemeProps-DVgs-USV.js";import"./getThemeProps-B4ZF914Q.js";import"./index.esm-CUxG0IsZ.js";import"./HomePage-DtOX3-eA.js";import"./CollectionItems-i54bjIho.js";import"./StorePage-DCZRiikn.js";import"./AtlasSearchProvider-DaJ6clz-.js";import"./FilterDrawer-CGoJp7ei.js";import"./PagingControls-DTElKLL1.js";import"./GridView-DBRoP9ri.js";import"./Message-Cfmnl7mY.js";import"./seo-N-rINtPA.js";import"./FindStorePage-CrM7PmLt.js";import"./SearchPage-BOimhKeM.js";import"./CustomSearchBox-CX5K0f_t.js";import"./ColorModeContext-B1mN29UH.js";function Jn(h,b){return bt(h,b,"category_id")}function bt(h,b,I){const l=new Map((b??[]).map(m=>[m[I],m.active===!0]));return h.filter(m=>l.get(m.id)===!0).map(m=>m.id)}function ft(h,b){const I=b instanceof Set?b:new Set(b),l=h.length,m=h.filter(k=>I.has(k.id)).length,y=l>0&&m===l;return{selectedCount:m,total:l,allSelected:y,someSelected:m>0&&!y}}function jt(h,b){return b?[]:h.map(I=>I.id)}const xo=()=>{var Xe,Ze,De,et,tt,nt,st,ot,at,rt,it,lt,ct,dt,ut,ht,xt,gt,pt;const h=Pn(),b=Vn(h.breakpoints.down("tablet")),I=a.useContext(Mn),l=I==null?void 0:I.id,m=bn(Cn),[y,k]=a.useState(null),{data:r}=Sn({storeId:l},{skip:!l});a.useEffect(()=>{var t,n,s,i;((n=(t=r==null?void 0:r.store)==null?void 0:t.integration)==null?void 0:n.integrationType)==="square"&&ye(((i=(s=r==null?void 0:r.store)==null?void 0:s.integration)==null?void 0:i.upcField)||"neither")},[r]);const d=((Ze=(Xe=r==null?void 0:r.store)==null?void 0:Xe.integration)==null?void 0:Ze.integrationType)==="square",me=((et=(De=r==null?void 0:r.store)==null?void 0:De.integration)==null?void 0:et.needs_reauth)===!0,[L,ye]=a.useState(((nt=(tt=r==null?void 0:r.store)==null?void 0:tt.integration)==null?void 0:nt.upcField)||"sku"),[Ct,{data:$n,isLoading:fe}]=Bn(),[St,{isLoading:je}]=Un(),[vt,{data:Yn,isLoading:wt}]=Wn(),[It,{isLoading:be}]=vn(),[kt,{isLoading:Lt}]=wn(),[Ce,Se]=a.useState(null),[qt,{isLoading:Et}]=In(),ve=((at=(ot=(st=r==null?void 0:r.store)==null?void 0:st.integration)==null?void 0:ot.square)==null?void 0:at.inventoryWebhooksEnabled)===!0,[we,P]=a.useState(null),Ft=async t=>{var n;P(null);try{await qt({storeId:l,enabled:t}).unwrap()}catch(s){P(((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to update inventory webhooks toggle")}},[zt,{isLoading:Rt}]=kn(),q=((lt=(it=(rt=r==null?void 0:r.store)==null?void 0:rt.integration)==null?void 0:it.square)==null?void 0:lt.filterByCategory)===!0,[Ie,V]=a.useState(null),Tt=async t=>{var n;V(null);try{await zt({storeId:l,enabled:t}).unwrap()}catch(s){V(((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to update category filter toggle")}},[At,{isLoading:ke}]=Ln(),[Bt,{isLoading:Le}]=qn(),[Xn,{isLoading:Zn}
1]=En(),[Dn,es]=a.useState(null),[ts,ns]=a.useState(null),[ss,os]=a.useState(!1),[Ut,{isLoading:Q}]=Fn(),[Wt,{isLoading:qe}]=zn(),[H,_t]=a.useState([]),[v,G]=a.useState([]),[Ee,K]=a.useState([]),[Fe,F]=a.useState(null),[J,ze]=a.useState(!1),[Nt,$]=a.useState(!1),Re=async()=>{var t;F(null),$(!1);try{const n=await Ut({storeId:l}).unwrap(),s=n.locations||[];_t(s);const i=n.enabledLocations||[],g=i.length?i.filter(f=>f.active).map(f=>f.location_id):(n.enabledLocationIds||[]).filter(f=>f!=="all"),S=s.filter(f=>f.status==="ACTIVE").map(f=>f.id);if(g.length===0)G(S),K([]);else{const f=g.filter(jn=>S.includes(jn));G(f),K(f)}ze(!0)}catch(n){F(((t=n==null?void 0:n.data)==null?void 0:t.message)||"Failed to fetch locations")}},Mt=t=>{G(n=>n.includes(t)?n.filter(s=>s!==t):[...n,t]),$(!1)},Ot=async()=>{var t;if(v.length===0){F("At least one location must be selected");return}F(null);try{const n=await Wt({storeId:l,locationIds:v}).unwrap(),s=(n==null?void 0:n.locations)||[];K(s.length?s.filter(i=>i.active).map(i=>i.location_id):v),$(!0)}catch(n){F(((t=n==null?void 0:n.data)==null?void 0:t.message)||"Failed to save locations")}},Te=JSON.stringify([...v].sort())!==JSON.stringify([...Ee].sort()),[Pt,{isLoading:Y}]=_n(),[x,Vt]=a.useState([]),[z,X]=a.useState([]),[Ae,Be]=a.useState([]),[Z,Ue]=a.useState(!1),[We,A]=a.useState(null),[Qt,B]=a.use
1State(!1),Ht=((dt=(ct=r==null?void 0:r.store)==null?void 0:ct.integration)==null?void 0:dt.includeUncategorized)!==!1,_e=async()=>{var t,n,s;A(null),B(!1);try{const g=(await Pt({storeId:l}).unwrap()).categories||[];Vt(g);const S=Jn(g,(n=(t=r==null?void 0:r.store)==null?void 0:t.integration)==null?void 0:n.categoryWhitelist);X(S),Be(S),Ue(!0)}catch(i){A(((s=i==null?void 0:i.data)==null?void 0:s.message)||"Failed to fetch categories")}},Gt=t=>{X(n=>n.includes(t)?n.filter(s=>s!==t):[...n,t]),B(!1)},D=a.useMemo(()=>new Set(z),[z]),{selectedCount:ee,allSelected:Ne,someSelected:Kt}=a.useMemo(()=>ft(x,D),[x,D]),Jt=()=>{X(jt(x,Ne)),B(!1)},[$t,{isLoading:te}]=Nn(),[Yt,{isLoading:Me}]=Rn(),[Xt,{isLoading:Zt}]=Tn(),[C,Dt]=a.useState([]),[R,ne]=a.useState([]),[Oe,Pe]=a.useState([]),[se,en]=a.useState(null),[oe,Ve]=a.useState(!1),[Qe,U]=a.useState(null),[tn,W]=a.useState(!1),[He,ae]=a.useState(null),E=((xt=(ht=(ut=r==null?void 0:r.store)==null?void 0:ut.integration)==null?void 0:ht.square)==null?void 0:xt.filterByChannel)===!0,Ge=async()=>{var t,n,s;U(null),W(!1);try{const i=await $t({storeId:l}).unwrap(),g=i.channels||[];Dt(g),en(i.hidden??null);const S=bt(g,(n=(t=r==null?void 0:r.store)==null?void 0:t.integration)==null?void 0:n.channelWhitelist,"channel_id");ne(S),Pe(S),Ve(!0)}catch(i){U(((s=i==null?void 0:i.data)==null?void 0:s.message)||"Failed to fetch channels")}},nn=t=>{ne(n=>n.includes(t)?n.filter(s=>s!==t):[...n,t]),W(!1)},_=a.useMemo(()=>new Set(R),[R]),{selectedCount:re,allSelected:Ke,someSelected:sn}=a.useMemo(()=>ft(C,_),[C,_]),on=()=>{ne(jt(C,Ke)),W(!1)},Je=JSON.stringify([...R].sort())!==JSON.stringify([...Oe].sort()),an=C.some(t=>_.has(t.id)&&(t.reference_type==="POINT_OF_SALE"||t.reference_type==="LOCATION")),rn=async()=>{var t;U(null);try{await Yt({storeId:l,activeChannelIds:R}).unwrap(),Pe([...R]),W(!0)}catch(n){U(((t=n==null?void 0:n.data)==null?void 0:t.message)||"Failed to save channel filter")}},ln=async t=>{var n;ae(null);try{await Xt({storeId:l,enabled:t}).unwrap()}catch(s){ae(((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to update channel filter toggle")}},cn=async()=>{var t;A(null);try{await It({storeId:l,activeCategoryIds:z}).unwrap(),Be([...z]),B(!0)}catch(n){A(((t=n==null?void 0:n.data)==null?void 0:t.message)||"Failed to save category filter")}},dn=async t=>{var n;Se(null);try{await kt({storeId:l,enabled:t}).unwrap()}catch(s){Se(((n=s==null?void 0:s.data)==null?void 0:n.message)||"Failed to update setting")}},$e=JSON.stringify([...z].sort())!==JSON.stringify([...Ae].sort()),{categoryChildren:un,rootCategories:hn}=a.useMemo(()=>{const t=new Set(x.map(i=>i.id)),n=new Map;for(const i of x){const g=i.parent_id&&t.has(i.parent_id)?i.parent_id:null;if(g){const S=n.get(g);S?S.push(i):n.set(g,[i])}}const s=x.filter(i=>!(i.parent_id&&t.has(i.parent_id)));return{categoryChildren:n,rootCategories:s}},[x]),ie=(t,n,s)=>{if(s.has(t.id))return null;s.add(t.id);const i=un.get(t.id)??[];return e.jsxs(c,{children:[e.jsx(j,{control:e.jsx(T,{checked:D.has(t.id),onChange:()=>Gt(t.id),color:"warning"}),label:e.jsx(o,{variant:"body1",children:t.name}),sx:{ml:n*3,mb:.5,py:.5,borderBottom:"1px solid",borderColor:"divider"}}),i.map(g=>ie(g,n+1,s))]},t.id)},xn=()=>{const t=new Set,n=hn.map(s=>ie(s,0,t));for(const s of x)t.has(s.id)||n.push(ie(s,0,t));return n};a.useEffect(()=>{d&&l&&Re()},[d,l]),a.useEffect(()=>{d&&l&&q&&_e()},[d,l,q]),a.useEffect(()=>{d&&l&&E&&Ge()},[d,l,E]);const[Ye,le]=a.useState(null),gn=async()=>{var n;le(null);const t=await Ct({storeId:l,upcField:L});(n=t.data)!=null&&n.squareRedirect?window.location.replace(t.data.squareRedirect):le("Unable to start Square connection. Please try again or contact [email protected] if the issue persists.")},pn=async()=>{var n;const t=await St({storeId:l});(n=t.data)!=null&&n.squareRedirect&&window.location.replace(t.data.squareRedirect)},mn=()=>{vt({storeId:l,upcField:L})},yn=async()=>{if(window.confirm("Are you sure you want to disconnect your Square integration? This will remove all Square connection data."))try{await At({storeId:l}).unwrap()}catch(t){console.error("Error disconnecting Square integration:",t)}},fn=async()=>{var t;k(null);try{const n=await Bt({storeId:l}).unwrap();k(n)}catch(n){k({valid:!1,error:"request_failed",message:((t=n==null?void 0:n.data)==null?void 0:t.message)||"Failed to verify connection"})}};return e.jsxs(c,{sx:{width:"100%",p:3,boxSizing:"border-box",pt:b?6:3,color:h.palette.text.primary},children:[e.jsx(On,{integration:"Square"}),d&&me&&e.jsxs(u,{severity:"error",sx:{mb:3},children:[e.jsx(yt,{children:"Authentication Required"}),'Your Square connection has expired or needs to be reauthorized. Please click the "Reconnect to Square" button below to restore your integration and resume automatic inventory syncing.']}
1),e.jsx("img",{src:h.palette.mode==="light"?"https://rsdmrkt-data.s3.amazonaws.com/logos/Square_Full.png":"https://rsdmrkt-data.s3.amazonaws.com/logos/Square_White.webp",alt:"",style:{maxHeight:"100px",marginBottom:"20px"}}),e.jsx(o,{variant:"h1",children:"How to integrate with Square"}),e.jsx(o,{sx:{m:2},children:"Connecting Square to your RSD MRKT inventory is easy! All you need to do is tell us a little bit about your inventory setup and then click the button below to connect to Square."}),e.jsxs(o,{sx:{m:2},children:[e.jsx("strong",{children:"Step One: "}),"Tell us a bit about your data in Square. RSD MRKT uses UPCs to identify products. Tell us which field in Square you use to include UPC in your products' data. If you use both, feel free to select either one."]}),e.jsxs(c,{sx:{m:2,mt:0,display:"flex",flexDirection:"row",alignItems:"flex-end"},children:[e.jsxs(Qn,{children:[e.jsx(Hn,{id:"upc-radio-buttons-group-label",children:"UPC Location"}),e.jsxs(Gn,{row:!0,"aria-labelledby":"upc-radio-buttons-group-label",name:"upc-radio-buttons-group",value:L,onChange:t=>ye(t.target.value),children:[e.jsx(j,{value:"sku",control:e.jsx(he,{color:"warning"}),label:"SKU"}),e.jsx(j,{value:"gtin",control:e.jsx(he,{color:"warning"}),label:"GTIN"}),e.jsx(j,{value:"neither",control:e.jsx(he,{color:"error"}),label:"Neither"})]})]}),d&&e.jsx(An,{sx:{p:0},disabled:L===((pt=(gt=r==null?void 0:r.store)==null?void 0:gt.integration)==null?void 0:pt.upcField)||wt,onClick:mn,children:"Save"})]}),e.jsxs(o,{sx:{m:2},children:[e.jsx("strong",{children:"Step Two: "}),"Click the button below and you'll be redirected to Square's website, where you'll be prompted to log in and authorize RSD MRKT to access your Square account."," ",e.jsx("strong",{children:"Please allow all of the permissions requested on that page."})," ","Once you've done that, you'll be redirected back to this page."]}),e.jsxs(c,{sx:{display:"flex",gap:2,alignItems:"center",flexWrap:"wrap"},children:[d&&me?e.jsxs(w,{variant:"contained",color:"warning",disabled:!l||je,sx:{display:"flex",gap:1},onClick:pn,children:[je?e.jsx(p,{size:20,color:"warning"}):e.jsx("img",{src:"https://rsdmrkt-data.s3.amazonaws.com/logos/Square.png",alt:"",style:{maxHeight:"25px"}})," ","Reconnect to Square"]}):e.jsxs(w,{variant:"contained",color:"warning",disabled:!l||fe||L==="neither"||d,sx:{display:"flex",gap:1},onClick:gn,children:[fe?e.jsx(p,{size:20,color:"warning"}):e.jsx("img",{src:"https://rsdmrkt-data.s3.amazonaws.com/logos/Square.png",alt:"",style:{maxHeight:"25px"}})," ",d?"Connected":"Connect to Square"]}),d&&e.jsxs(w,{variant:"outlined",color:"error",disabled:ke,sx:{display:"flex",gap:1},onClick:yn,children:[ke?e.jsx(p,{size:20,color:"error"}):null,"Disconnect"]}),d&&m&&e.jsxs(w,{variant:"outlined",color:"info",disabled:Le,sx:{display:"flex",gap:1},onClick:fn,children:[Le?e.jsx(p,{size:20,color:"info"}):null,"Verify Connection"]})]}),Ye&&e.jsx(u,{severity:"error",sx:{mt:2},onClose:()=>le(null),children:Ye}),y&&e.jsxs(u,{severity:y.valid?"success":"error",sx:{mt:2},onClose:()=>k(null),children:[e.jsx(yt,{children:y.valid?"Connection Valid":"Connection Invalid"}),y.message,y.valid&&y.merchantId&&e.jsxs(c,{sx:{mt:1,fontSize:"0.875rem"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Merchant ID:"})," ",y.merchantId]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Locations:"})," ",y.activeLocationCount," active /"," ",y.locationCount," total"]})]})]}),d&&e.jsx(N,{sx:{mt:3,mb:2},children:e.jsxs(M,{children:[e.jsxs(c,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(c,{children:[e.jsx(o,{variant:"h6",children:"Enable webhooks (realtime updates)"}),e.jsx(o,{variant:"body2",color:"text.secondary",children:"When enabled, Square inventory changes flow into rsdmrkt within seconds. When disabled, only the hourly sync runs."})]}),e.jsx(j,{control:e.jsx(O,{color:"warning",checked:ve,disabled:Et,onChange:t=>Ft(t.target.checked)}),label:ve?"Enabled":"Disabled",labelPlacement:"start"})]}),we&&e.jsx(u,{severity:"error",sx:{mt:2},onClose:()=>P(null),children:we})]})}),d&&e.jsx(N,{sx:{mt:3,mb:2},children:e.jsxs(M,{children:[e.jsxs(c,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[e.jsxs(c,{children:[e.jsxs(o,{variant:"h6",children:["Sales Channel Filter",E&&C.length>0&&re<C.length&&e.jsxs(o,{component:"span",variant:"caption",sx:{ml:1,px:1,py:.25,bgcolor:"action.selected",borderRadius:1},children:[C.length-re," excluded"]})]}),e.jsx(o,{variant:"body2",color:"text.secondary",children:"When enabled, only items listed on the sales channels you select are imported. Items archived in Square are always skipped."})]}),e.jsx(j,{control:e.jsx(O,{color:"warning",checked:E,disabled:Zt,onChange:t=>ln(t.target.checked)}),label:E?"Enabled":"Disabled",labelPlacement:"start"})]}),He&&e.jsx(u,{severity:"error",sx:{mb:2},onClose:()=>ae(null),children:He}),E&&e.jsxs(e.Fragment,{children:[e.jsxs(c,{sx:{display:"flex",justifyContent:"flex-end",mb:2},children:[e.jsx(w,{variant:"outlined",size:"small",onClick:Ge,disabled:te,startIcon:te?e.jsx(p,{size:16}):e.jsx(ue,{}),children:"Refresh"}),e.jsx(ge,{onClick:()=>Ve(!oe),size:"small",sx:{ml:1},children:oe?e.jsx(de,{}):e.jsx(ce,{})})]}),e.jsx(o,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Check the channels you sell online through — usually your Square O
1nline site. Items that aren't on any checked channel will be skipped on the next sync."}),Qe&&e.jsx(u,{severity:"error",sx:{mb:2},children:Qe}),tn&&e.jsx(u,{severity:"success",sx:{mb:2},children:"Channel filter saved successfully!"}),C.length>0&&Oe.length===0&&e.jsx(u,{severity:"warning",sx:{mb:2},children:"No channels are enabled, so no products will import while this filter is on. Select at least one channel, then click Save."}),an&&e.jsx(u,{severity:"info",sx:{mb:2},children:"You've selected an in-store channel (Point of Sale or a location). Square puts almost every catalog item on Point of Sale, so this filter will likely exclude little or nothing while one is checked."}),e.jsx(pe,{in:oe,children:C.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(xe,{children:[e.jsx(j,{control:e.jsx(T,{checked:Ke,indeterminate:sn,onChange:on,color:"warning",inputProps:{"aria-label":"Select all channels"}}),label:e.jsx(o,{variant:"body1",fontWeight:600,children:"Select all"}),sx:{mb:.5,py:.5,borderBottom:"2px solid",borderColor:"divider"}}),C.map(t=>e.jsx(j,{control:e.jsx(T,{checked:_.has(t.id),onChange:()=>nn(t.id),color:"warning"}),label:e.jsxs(c,{children:[e.jsxs(o,{variant:"body1",children:[t.name,t.status==="INACTIVE"&&e.jsx(o,{component:"span",variant:"caption",color:"error",sx:{ml:1},children:"(inactive)"})]}),t.reference_type&&e.jsx(o,{variant:"caption",color:"text.secondary",children:t.reference_type==="ONLINE_SITE"?"Square Online site":t.reference_type==="POINT_OF_SALE"?"In-store — usually on nearly every item":t.reference_type==="ONLINE_CHECKOUT"?"Payment links":t.reference_type.toLowerCase().replace(/_/g," ")})]}),sx:{alignItems:"flex-start",mb:.5,py:.5,borderBottom:"1px solid",borderColor:"divider"}},t.id))]}),e.jsxs(c,{sx:{display:"flex",gap:2,mt:2,alignItems:"center"},children:[e.jsx(w,{variant:"contained",color:"warning",onClick:rn,disabled:Me||!Je,children:Me?e.jsx(p,{size:20,color:"inherit"}):"Save"}),!Je&&e.jsx(o,{color:"text.secondary",variant:"body2",children:"No changes to save"})]}),e.jsxs(o,{variant:"caption",color:"text.secondary",sx:{mt:2,display:"block"},children:[re," of ",C.length," ","channel(s) enabled",se&&se.count>0&&e.jsxs(e.Fragment,{children:[" — ",se.count," other Square channel(s) hidden (gift cards, connected apps, invoices and the like never carry catalog items)"]})]})]}):e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2,py:2},children:te?e.jsxs(e.Fragment,{children:[e.jsx(p,{size:20}),e.jsx(o,{color:"text.secondary",children:"Loading channels..."})]}):e.jsx(o,{color:"text.secondary",children:"No channels found. Click Refresh to try again."})})})]})]})}),d&&e.jsx(N,{sx:{mt:3,mb:2},children:e.jsxs(M,{children:[e.jsxs(c,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[e.jsx(o,{variant:"h6",children:"Import Locations"}),e.jsxs(c,{sx:{display:"flex",gap:1},children:[e.jsx(w,{variant:"outlined",size:"small",onClick:Re,disabled:Q,startIcon:Q?e.jsx(p,{size:16}):e.jsx(ue,{}),children:"Refresh"}),e.jsx(ge,{onClick:()=>ze(!J),size:"small",children:J?e.jsx(de,{}):e.jsx(ce,{})})]})]}),e.jsx(o,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Select which Square locations should be included when importing inventory. At least one location must be selected."}),Fe&&e.jsx(u,{severity:"error",sx:{mb:2},children:Fe}),Nt&&e.jsx(u,{severity:"success",sx:{mb:2},children:"Locations saved successfully!"}),e.jsx(pe,{in:J,children:H.length>0?e.jsxs(e.Fragment,{children:[Ee.length===0&&v.length>0&&e.jsx(u,{severity:"info",sx:{mb:2},children:"No import locations are saved for this store yet, so inventory is not syncing. Every active location is pre-selected below — adjust if needed, then save."}),e.jsx(xe,{children:H.map(t=>e.jsx(j,{control:e.jsx(T,{checked:v.includes(t.id),onChange:()=>Mt(t.id),color:"warning",disabled:t.status!=="ACTIVE"}),label:e.jsxs(c,{sx:{opacity:t.status!=="ACTIVE"?.5:1},children:[e.jsxs(o,{variant:"body1",children:[t.name,t.status!=="ACTIVE"&&e.jsxs(o,{component:"span",variant:"caption",color:"error",sx:{ml:1},children:["(",t.status,")"]})]}),t.address&&e.jsx(o,{variant:"caption",color:"text.secondary",children:[t.address.addressLine1,t.address.locality,t.address.administrativeDistrictLevel1].filter(
1Boolean).join(", ")}),e.jsxs(o,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:["ID: ",t.id]})]}),sx:{alignItems:"flex-start",mb:1,py:1,borderBottom:"1px solid",borderColor:"divider"}},t.id))}),e.jsxs(c,{sx:{display:"flex",gap:2,mt:2,alignItems:"center"},children:[e.jsx(w,{variant:"contained",color:"warning",onClick:Ot,disabled:qe||v.length===0||!Te,children:qe?e.jsx(p,{size:20,color:"inherit"}):"Save Locations"}),v.length===0&&e.jsx(o,{color:"error",variant:"body2",children:"At least one location must be selected"}),!Te&&v.length>0&&e.jsx(o,{color:"text.secondary",variant:"body2",children:"No changes to save"})]}),e.jsxs(o,{variant:"caption",color:"text.secondary",sx:{mt:2,display:"block"},children:[v.length," of ",H.length," ","location(s) selected"]})]}):e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2,py:2},children:Q?e.jsxs(e.Fragment,{children:[e.jsx(p,{size:20}),e.jsx(o,{color:"text.secondary",children:"Loading locations..."})]}):e.jsx(o,{color:"text.secondary",children:"No locations found. Click Refresh to try again."})})})]})}),d&&e.jsx(N,{sx:{mt:3,mb:2},children:e.jsxs(M,{children:[e.jsxs(c,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[e.jsxs(c,{children:[e.jsxs(o,{variant:"h6",children:["Category Filter",q&&x.length>0&&ee<x.length&&e.jsxs(o,{component:"span",variant:"caption",sx:{ml:1,px:1,py:.25,bgcolor:"action.selected",borderRadius:1},children:[x.length-ee," excluded"]})]}),e.jsx(o,{variant:"body2",color:"text.secondary",children:"When enabled, only items in selected categories are imported."})]}),e.jsx(j,{control:e.jsx(O,{color:"warning",checked:q,disabled:Rt,onChange:t=>Tt(t.target.checked)}),label:q?"Enabled":"Disabled",labelPlacement:"start"})]}),Ie&&e.jsx(u,{severity:"error",sx:{mb:2},onClose:()=>V(null),children:Ie}),q&&e.jsxs(e.Fragment,{children:[e.jsxs(c,{sx:{display:"flex",justifyContent:"flex-end",mb:2},children:[e.jsx(w,{variant:"outlined",size:"small",onClick:_e,disabled:Y,startIcon:Y?e.jsx(p,{size:16}):e.jsx(ue,{}),children:"Refresh"}),e.jsx(ge,{onClick:()=>Ue(!Z),size:"small",sx:{ml:1},children:Z?e.jsx(de,{}):e.jsx(ce,{})})]}),e.jsx(o,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Check the categories you want to import. Items in unchecked categories will be skipped on the next sync."}),e.jsxs(c,{sx:{mb:2,p:1.5,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(j,{control:e.jsx(O,{checked:Ht,onChange:(t,n)=>dn(n),disabled:Lt,color:"warning"}),label:e.jsxs(c,{children:[e.jsx(o,{variant:"body1",children:"Include items with no category"}),e.jsx(o,{variant:"caption",color:"text.secondary",children:"When off, items in Square that aren't assigned to any category are skipped."})]})}),Ce&&e.jsx(u,{severity:"error",sx:{mt:1},children:Ce})]}),We&&e.jsx(u,{severity:"error",sx:{mb:2},children:We}),Qt&&e.jsx(u,{severity:"success",sx:{mb:2},children:"Category filter saved successfully!"}),x.length>0&&Ae.length===0&&e.jsx(u,{severity:"warning",sx:{mb:2},children:"No categories are saved yet — products won't import until you select categories and click Save."}),e.jsx(pe,{in:Z,children:x.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"Categories are shown as they're nested in Square. Enabling a category also imports everything in its sub-categories."}),e.jsxs(xe,{children:[e.jsx(j,{control:e.jsx(T,{checked:Ne,indeterminate:Kt,onChange:Jt,color:"warning",inputProps:{"aria-label":"Select all categories"}}),label:e.jsx(o,{variant:"body1",fontWeight:600,children:"Select all"}),sx:{mb:.5,py:.5,borderBottom:"2px solid",borderColor:"divider"}}),xn()]}),e.jsxs(c,{sx:{display:"flex",gap:2,mt:2,alignItems:"center"},children:[e.jsx(w,{variant:"contained",color:"warning",onClick:cn,disabled:be||!$e,children:be?e.jsx(p,{size:20,color:"inherit"}):"Save"}),!$e&&e.jsx(o,{color:"text.secondary",variant:"body2",children:"No changes to save"})]}),e.jsxs(o,{variant:"caption",color:"text.secondary",sx:{mt:2,display:"block"},children:[ee," of ",x.length," ","category(ies) enabled"]})]}):e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2,py:2},children:Y?e.jsxs(e.Fragment,{children:[e.jsx(p,{size:20}
1),e.jsx(o,{color:"text.secondary",children:"Loading categories..."})]}):e.jsx(o,{color:"text.secondary",children:"No categories found. Click Refresh to try again."})})})]})]})}),L==="neither"&&e.jsxs(o,{color:"error",sx:{mt:1},children:["RSD MRKT can only read your product data if you include your inventory's UPCs in either the SKU or GTIN field in Square. If you don't (or if you don't use Square to track inventory at all), you can still submit your inventory manually"," ",e.jsx(mt,{to:"/admin/inventory/submit",style:{color:h.palette.error.light,fontWeight:"bold"},children:"here"}),"."]}),e.jsxs(o,{sx:{p:2},children:["And that's all! If you have any questions or concerns, please contact us at ",e.jsx("strong",{children:"[email protected]"})]}),e.jsx(Kn,{sx:{width:"100%"}}),e.jsxs(o,{sx:{p:2},children:["Not what you were looking for?"," ",e.jsx(mt,{style:{color:h.palette.warning.main,fontWeight:600,WebkitTextDecoration:"none",textDecoration:"none"},to:"/admin/inventory/integrations",children:"Back to all integrations"})]})]})};export{xo 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.