1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RenameReaderDialog-DdU2a6nG.js","assets/vendor-react-Dw2zQmPu.js","assets/commonjs-helpers-C05_-Ghz.js","assets/vendor-forms-CVvQPlhB.js","assets/dialog-BvmB9skF.js","assets/vendor-radix-guzGw5-0.js","assets/vendor-router-CtopkIuN.js","assets/app-cn-C2LL9ulS.js","assets/vendor-ui-mAy9LocR.js","assets/input-D2ulylI3.js","assets/label-Bk74TkBv.js","assets/button-CFi0D1K4.js","assets/PairReaderDialog-CRIZdVcA.js","assets/app-core-DTTgVEgu.js","assets/vendor-utils-CQ_dDVxl.js","assets/vendor-redux-CqVJnD2r.js","assets/vite-preload-helper-BXl3LOEh.js","assets/PurchaseReaderSection-BXppy8dF.js","assets/vendor-stripe-YDiLy-D2.js","assets/app-shared-QFLrTdTF.js","assets/vendor-lodash-DVjWl2dU.js","assets/vendor-tanstack-Dk5vt_tN.js","assets/app-shared-Bk7LbV6o.css","assets/OnboardingPaymentsSetup-BaLFhqNV.js","assets/app-back-btn-wWeMZhZJ.js","assets/useZocaAppActions-B3KlgEzE.js","assets/skeleton-BJiIkxs-.js"])))=>i.map(i=>d[i]); 2import{_ as R}from"./vite-preload-helper-BXl3LOEh.js";import{r as p,R as E,j as e}from"./vendor-react-Dw2zQmPu.js";import{B as j}from"./button-CFi0D1K4.js";import{T as P}
2from"./TopBar-MjVkmRVM.js";import{O as N}from"./OnboardingPaymentsSetup-BaLFhqNV.js";import{S as A}from"./SectionHighlight-ggUlfiPj.js";import{u as w,b as D,a as y}from"./vendor-tanstack-Dk5vt_tN.js";import{t as n,y as v,an as O,ax as I,cK as B}from"./vendor-ui-mAy9LocR.js";import{c as L,S as u,p as k,u as K,r as M,l as z}from"./stripeTerminalApiTypes-unEo0sWD.js";import{Y as T,g as F,F as Q}from"./app-shared-QFLrTdTF.js";import{N as V,t as q,c as Y}from"./app-core-DTTgVEgu.js";import{P as U}from"./posReaderEvents-uRJiqjqX.js";import{D as W,a as H,b as X,c as C}from"./dropdown-menu-CM3Fw2BS.js";import{B as b}from"./badge-CeMSLKTm.js";import{V as $}from"./vendor-date-fns-D1v0qsob.js";import{E as G}from"./EmptyState-W3H9jAMe.js";import{S as J}from"./SkeletonBlocks-D-0xzD__.js";import{T as Z}from"./TapToPay-ogo3J447.js";import{u as ee}from"./useTapToPayConfig-Crrqp94h.js";import{a as ae}from"./vendor-router-CtopkIuN.js";import"./commonjs-helpers-C05_-Ghz.js";import"./vendor-radix-guzGw5-0.js";import"./app-cn-C2LL9ulS.js";import"./activatable-cWgvSTbQ.js";import"./app-back-btn-wWeMZhZJ.js";import"./useZocaAppActions-B3KlgEzE.js";import"./useFtuxAnchorRect-CoIvPJl_.js";import"./SearchInput-DTaqHUou.js";import"./input-group-DrMNcVmx.js";import"./input-D2ulylI3.js";import"./textarea-BekLdUF0.js";import"./usemobile-BuLrGuzN.js";import"./vendor-stripe-YDiLy-D2.js";import"./skeleton-BJiIkxs-.js";import"./vendor-lodash-DVjWl2dU.js";import"./vendor-utils-CQ_dDVxl.js";import"./vendor-redux-CqVJnD2r.js";import"./card-B8ye2dFa.js";import"./skeletonRows-bFntY3QY.js";import"./useTapToPayCopy-B8CBzLzi.js";function se(){const s=w(),a=V(),[l,t]=p.useState(!1),{isStripeConnected:o}=T(),x=!!"pk_live_51QdCYECS5taN50YW8w34c2dFT9MnJLyn0jnpQo6fPAQXROONEBpxEuK1q5K0mrWqSsxSBia07Oyyzgoalm4eXfBm00Dg7iU7om"?.startsWith("pk_test_"),r=D({queryKey:[u.READERS,a],queryFn:()=>z(a),enabled:!!a&&!!o,staleTime:3e4}),c=()=>s.invalidateQueries({queryKey:[u.READERS,a]}),h=y({mutationKey:[u.READERS,"pair"],mutationFn:k}),d=y({mutationKey:[u.READERS,"rename"],mutationFn:({id:i,label:m})=>M(i,m)}),_=y({mutationKey:[u.READERS,"unpair"],mutationFn:i=>K(i)}),g=y({mutationKey:[u.READERS,"simulate"],mutationFn:L});return{isPairOpen:l,setIsPairOpen:t,isStripeConnected:!!o,isTestPlatform:x,locationEntityId:a,readers:r.data??[],isLoading:r.isLoading,error:r.error,pair:i=>h.mutate(i,{onSuccess:m=>{n.success("Reader paired"),q(U.PAIRED,{location_entity_id:a,reader_id:m?.id,is_test:m?.isTest}),c()},onError:()=>n.error("Could not pair reader. Check the code and try again.")}),isPairing:h.isPending,rename:(i,m)=>d.mutate({id:i,label:m},{onSuccess:()=>{n.success("Renamed"),c()},onError:()=>n.error("Could not rename reader.")}),unpair:i=>_.mutate(i,{onSuccess:()=>{n.success("Reader removed"),c()},onError:()=>n.error("Could not remove reader.")}),simulate:()=>{a&&g.mutate({locationEntityId:a,label:"Simulated reader"},{onSuccess:()=>{n.success("Simulated reader created"),c()},onError:()=>n.error("Could not create simulated reader.")})},isSimulating:g.isPending}}const te=E.lazy(()=>R(()=>import("./RenameReaderDialog-DdU2a6nG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),re=s=>{switch(s){case"active":return"default";case"offline":return"outline";case"inactive":case"unpaired":return"secondary";default:return"secondary"}},ie=({reader:s,onRename:a,onUnpair:l})=>{const[t,o]=p.useState(!1),f=s.lastSeenAt?` · last seen ${$(new Date(s.lastSeenAt))} ago`:"",x=s.serialNumber?` · â¢â¢${s.serialNumber.slice(-4)}`:"";return e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(v,{className:"h-5 w-5 shrink-0"}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate font-medium",children:s.label}),e.jsxs("span",{className:"text-muted-foreground truncate text-xs",children:[s.deviceType,x,f]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.isTest&&e.jsx(b,{variant:"outline",children:"TEST"}),e.jsx(b,{variant:re(s.status),className:"capitalize",children:s.status}),e.jsxs(W,{children:[e.jsx(H,{asChild:!0,children:e.jsx(j,{variant:"ghost",size:"icon","aria-label":"Reader actions",children:e.jsx(O,{className:"h-4 w-4"})})}),e.jsxs(X,{align:"end",children:[e.jsxs(C,{onClick:()=>o(!0),children:[e.jsx(I,{className:"h-4 w-4 mr-2"}),"Rename"]}),e.jsxs(C,{onClick:()=>l(s.id),className:"text-destructive focus:text-destructive",children:[e.jsx(B,{className:"h-4 w-4 mr-2"}),"Remove"]})]})]})]}),e.jsx(p.Suspense,{fallback:null,children:t&&e.jsx(te,{open:t,onClose:()=>o(!1),currentLabel:s.label,onSubmit:r=>{a(s.id,r),o(!1)}})})]})},oe=E.memo(ie),ne=({onPair:s})=>e.jsx(G,{className:"rounded-lg border border-dashed",size:"panel",icon:v,title:"Pair your first reader",description:"Connect a Stripe Terminal smart reader (BBPOS WisePOS E or S700) to accept in-person card payments from this browser.",action:e.jsx(j,{onClick:s,children:"+ Pair reader"})}),le=E.lazy(()=>R(()=>import("./PairReaderDialog-CRIZdVcA.js"),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13,14,15,16]))),ce=E.lazy(()=>R(()=>import("./PurchaseReaderSection-BXppy8dF.js"),__vite__mapDeps([17,1,2,18,8,5,6,19,13,14,15,16,20,21,22,23,11,7,24,25,26]))),S=[{id:"card-readers",label:"Card Readers"},{id:"purchase-reader",label:"Purchase a Reader"},{id:"order-history",label:"Order History"}],de={id:"tap-to-pay",label:"Tap to Pay"},Ge=({embedded:s=!1}
2)=>{const a=se(),{isPairOpen:l,setIsPairOpen:t}=a,{hash:o}=ae(),f=o.replace("#","")||void 0,x=F(Q.CARD_READER_POS,"isPosEnabled"),{isTapToPayAvailable:r}=ee(),{isTapToPayConnected:c}=T(),h=p.useMemo(()=>r?[S[0],de,...S.slice(1)]:S,[r]);return a.isStripeConnected?e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[!s&&e.jsx(P,{title:"Card Readers",showAppBackButton:!0}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 md:px-6 md:py-6 flex flex-col gap-6",children:[e.jsx(A,{sections:h,initialSectionId:f,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{id:"card-readers",className:"bg-white border border-gray-200 rounded-2xl p-4 space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Card Readers"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Pair physical Stripe Terminal readers to accept in-person card payments from this browser."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.isTestPlatform&&Y==="SANDBOX",e.jsx(j,{size:"sm",onClick:()=>t(!0),children:"+ Pair reader"})]}),a.isLoading?e.jsx(J,{rows:2,trailingChip:!0}):a.readers.length===0?e.jsx(ne,{onPair:()=>t(!0)}):e.jsx("ul",{className:"flex flex-col gap-3",children:a.readers.map(d=>e.jsx(oe,{reader:d,onRename:a.rename,onUnpair:a.unpair},d.id))})]}),r&&e.jsx("div",{id:"tap-to-pay",children:e.jsx(Z,{isEnabled:c})}),x&&a.locationEntityId&&e.jsx(p.Suspense,{fallback:null,children:e.jsx(ce,{locationEntityId:a.locationEntityId})})]})}),e.jsx(p.Suspense,{fallback:null,children:l&&a.locationEntityId&&e.jsx(le,{open:l,onClose:()=>t(!1),onSubmit:d=>{a.pair(d),t(!1)},isPending:a.isPairing,defaultLocationEntityId:a.locationEntityId})})]})]}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[!s&&e.jsx(P,{title:"Card Readers",showAppBackButton:!0}),e.jsx("div",{className:"flex-1 overflow-y-auto flex items-center justify-center px-4 py-6",children:e.jsx(N,{source:"PAYOUTS",hideAppBackButton:!s})})]})};export{Ge 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.