PageSourceSearch

https://useclade.com/assets/AdminMarketplace-BeX-fYNy.js

js useclade.com collected 2026-10-07 14:26:57 UTC 26,348 bytes, 12 lines download raw bytes

1import{w as j,o as Re,d as g,e as S,t as y,p as U,l,F as ie,m as ye,f as A,u as o,k as te,i as ke,r as _,n as vt,h as re,ac as ft,j as ne,c as h,v as _t,y as X,B as oe}from"./vendor-vue-ugSA5z41.js";import{_ as gt}from"./ModuleViewLayout-BGuUlP39.js";import{M as ht}from"./ModuleFiltersModal-DpQd5flp.js";import{j as yt,g as kt,l as Oe,f as _e,i as Fe,h as Te,a as St,M as bt,b as ge,d as Ct}from"./MarketplaceSellerOrderStatusBadge-hbLzwVNm.js";import{c as Ae}from"./check-Lvxsvslu.js";import{s as Pt}from"./search-RHthSusW.js";import{I as xt}from"./InlineDropdown-Hm7YtOMq.js";import{_ as Ie,s as Z,h as Mt,ed as Ft}from"./index-BE6tbDiz.js";import{f as Tt}from"./adminStats-Dlo6r46S.js";import{u as At}from"./useModuleTableSortIndicator-M0T9jN3H.js";import{u as Ee}from"./usePagination-Dn78HP-9.js";import{u as Et}from"./useSorting-Dk_Cs2oJ.js";import{f as $t}from"./marketplaceFormat-zvgCn8qS.js";import{a as $e}from"./calendarRouteDate-IvT2p5kP.js";import"./SideNav-BdLJ9e9a.js";import"./useInAppModuleNav-CxnoYwsr.js";import"./InventoryModuleNavigation-IMX2qAuD.js";import"./hybridizing-CAjTpHRU.js";import"./exhibit-BnmrI-1a.js";import"./SearchBar-BtO2Vlx0.js";import"./SearchBarWithSuggestions-DGu_SjAa.js";import"./fuse-Ch1WBRTM.js";import"./varietySearchUtils-B7e2G8Gn.js";import"./PaginationControls-C3Vjky2K.js";import"./BottomPagination-BNIxqtY_.js";import"./EmptyState-BEX1ZhCz.js";import"./ModuleFilters-tAryMYpF.js";import"./FilterAdsColorShadeSelect-B-v50WfY.js";import"./AdsColorShadePicker-CQpc71FD.js";import"./adsColorShadeTokens-DnxEjMYc.js";import"./dahliaColorSwatches-DBTrXar7.js";import"./FilterSelect-BJT--NCe.js";import"./FilterToggleButton-8b8SY7VF.js";import"./vendor-supabase-B6vtjUvU.js";import"./acquisitionSource-DYi5JpCe.js";const Lt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2024.3.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20id='Capa_1'%20x='0px'%20y='0px'%20viewBox='0%200%20512.02%20512.02'%20style='enable-background:new%200%200%20512.02%20512.02;'%20xml:space='preserve'%20width='512'%20height='512'%3e%3cg%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20d='M512.02,259.566c0-36.41-17.636-65.14-51.344-65.14%20c-33.85,0-54.331,28.73-54.331,64.856c0,42.811,24.179,64.429,58.882,64.429c16.925,0,29.726-3.84,39.397-9.245V286.02%20c-9.672,4.836-20.765,7.823-34.846,7.823c-13.796,0-26.028-4.836-27.592-21.619h69.549%20C511.736,270.375,512.02,262.979,512.02,259.566z%20M441.76,246.054c0-16.072,9.814-22.757,18.774-22.757%20c8.676,0,17.921,6.685,17.921,22.757H441.76z'/%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20d='M351.445,194.426c-13.938,0-22.899,6.542-27.877,11.094%20l-1.849-8.818h-31.29v165.838l35.557-7.538l0.142-40.25c5.12,3.698,12.658,8.96,25.174,8.96c25.459,0,48.642-20.481,48.642-65.567%20C399.803,216.898,376.335,194.426,351.445,194.426z%20M342.911,292.421c-8.392,0-13.369-2.987-16.783-6.685l-0.142-52.767%20c3.698-4.125,8.818-6.969,16.925-6.969c12.943,0,21.903,14.507,21.903,33.139C364.815,278.198,355.996,292.421,342.911,292.421z'/%3e%3cpolygon%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20points='241.503,186.034%20277.202,178.354%20277.202,149.482%20241.503,157.02%20'/%3e%3crect%20x='241.503'%20y='196.843'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20width='35.699'%20height='124.449'/%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20d='M203.244,207.368l-2.276-10.525h-30.721v124.449h35.557%20v-84.341c8.391-10.952,22.614-8.96,27.023-7.396v-32.712C228.276,195.137,211.635,192.008,203.244,207.368z'/%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20d='M132.13,165.98l-34.704,7.396L97.284,287.3%20c0,21.05,15.787,36.553,36.837,36.553c11.663,0,20.196-2.134,24.89-4.694v-28.872c-4.551,1.849-27.023,8.391-27.023-12.658v-50.491%20h27.023v-30.294h-27.023L132.13,165.98z'/%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635BFF;'%20d='M35.984,232.969c0-5.547,4.551-7.68,12.089-7.68%20c10.809,0,24.463,3.271,35.273,9.103v-33.424c-11.805-4.693-23.468-6.542-35.273-6.542C19.201,194.426,0,209.502,0,234.676%20c0,39.255,54.047,32.997,54.047,49.922c0,6.543-5.689,8.676-13.654,8.676c-11.805,0-26.881-4.836-38.828-11.378v33.85%20c13.227,5.689,26.597,8.107,38.828,8.107c29.583,0,49.922-14.65,49.922-40.108C90.173,241.361,35.984,248.899,35.984,232.969z'/%3e%3c/g%3e%3c/svg%3e",Rt=864e5*30.4375;function Ot(t,n=Date.now()){const s=Date.parse(String(t??""));return Number.isFinite(s)?Math.floor(Math.max(0,n-s)/Rt):null}function Ne(t,n=Date.now()){const s=t==null?void 0:t.users,u=Ot(s==null?void 0:s.created_at,n);return u==null?"—":`${u}m`}function he(t){const n=t==null?void 0:t.suppliers,s=t==null?void 0:t.users,u=String((n==null?void 0:n.profile_image_url)??"").trim();if(u)return u;const c=String((s==null?void 0:s.profile_picture)??"").trim();return c||null}function De(t){const n=t==null?void 0:t.users;return Tt(n||{})||"—"}function Le(t){return t==null||Number.isNaN(Number(t))?"—":String(Number(t))}function It(t,n){const s=new Map;for(const c of t||[]){const p=String(c.email??"").trim();p&&s.set(p,(s.get(p)||0)+1)}const u=new Map;for(const c of n||[]){const p=String(c.marketplace_seller_id??"").trim();p&&u.set(p,(u.get(p)||0)+1)}return{inventoryByEmail:s,listingsBySellerId:u}}function Nt(t,n){return t.map(s=>{const u=String(s.owner_email??"").trim(),c=String(s.id??"").trim();return{...s,inventory_item_count:n.inventoryByEmail.get(u)??0,marketplace_listing_count:n.listingsBySellerId.get(c)??0}})}function Dt(t,n){const s=String(n||"").trim().toLowerCase();if(!s||!t)return!0;const u=t.suppliers,c=t.users;return[u==null?void 0:u.name,u==null?void 0:u.state,c==null?void 0:c.first_name,c==null?void 0:c.last_name,De(t),t.owner_email,t.ship_from_state,t.tax_setup_status,t.inventory_item_count,t.marketplace_listing_count,Ne(t)].map(b=>
1String(b??"").toLowerCase()).filter(Boolean).some(b=>b.includes(s))}const Bt={key:0,class:"admin-marketplace-sellers-message",role:"status"},wt={key:1,class:"module-table-container"},Ut={class:"module-table module-table--admin-sellers"},qt={class:"admin-sellers-supplier-cell"},Vt={class:"variety-name-cell"},zt=["src","onError"],Kt={class:"variety-name-text admin-sellers-supplier-name"},jt={class:"admin-sellers-text-cell"},Qt={class:"admin-sellers-text-cell"},Gt={class:"admin-sellers-tenure-col"},Yt={class:"admin-sellers-state-cell"},Ht={class:"admin-sellers-count-col"},Wt={class:"admin-sellers-count-col"},Xt={class:"admin-sellers-icon-col"},Zt={class:"admin-sellers-icon-slot"},Jt=["src"],el={class:"admin-sellers-icon-col"},tl=["aria-pressed","aria-label","onClick"],ll=["src"],al=["aria-label","onClick"],sl={key:1,class:"admin-sellers-tax-status-display"},rl={class:"admin-sellers-icon-col"},nl=["aria-pressed","aria-label","onClick"],ol=["src"],il={__name:"AdminMarketplaceSellersPanel",props:{rows:{type:Array,default:()=>[]}},emits:["state"],setup(t,{expose:n,emit:s}){const u=s,c=_([]),p=_(""),b=_(""),M=_(!0),k=_(new Set),T=_(""),E=_(""),B=_(null),O=[{value:"pending",label:"Pending"},{value:"in_progress",label:"In progress"},{value:"ready",label:"Ready"},{value:"blocked",label:"Blocked"}];function q(){u("state",{sellers:c.value,loading:M.value,count:c.value.length})}j([c,M],q,{immediate:!0}),Re(()=>{$()});async function $(){M.value=!0,p.value="";const{data:d,error:m}=await Z.from("marketplace_sellers").select("id, supplier_id, owner_email, ship_from_state, marketplace_approved, selling_enabled, tax_setup_status, charges_enabled, payouts_enabled, connect_onboarding_status, suppliers:supplier_id ( name, state, profile_image_url ), users:owner_email ( first_name, last_name, profile_picture, created_at )").order("updated_at",{ascending:!1}).limit(100);if(m){M.value=!1,p.value=m.message,c.value=[];return}try{c.value=await I(d||[])}catch(i){p.value=i.message||"Could not load seller counts",c.value=d||[]}finally{M.value=!1}}async function I(d){if(!d.length)return[];const m=[...new Set(d.map(R=>R.owner_email).filter(Boolean))],i=d.map(R=>R.id),[P,F]=await Promise.all([Z.from("inventories").select("email").in("email",m).eq("is_archived",!1),Z.from("marketplace_listings").select("marketplace_seller_id").in("marketplace_seller_id",i).neq("publication_state","archived")]),le=[P.error,F.error].filter(
1Boolean);if(le.length)throw new Error(le.map(R=>R.message).join(" "));const ce=It(P.data,F.data);return Nt(d,ce)}async function C(d,m){if(b.value)return;b.value=d.id,p.value="";const{error:i}=await Z.from("marketplace_sellers").update(m).eq("id",d.id);if(b.value="",i){p.value=i.message;return}await $()}function v(d){const m=O.find(i=>i.value===d);return(m==null?void 0:m.label)||d||"—"}function ue(d){b.value||T.value===d.id||(T.value=d.id,E.value=d.tax_setup_status)}function N(){T.value=""}function w(d){E.value=d}async function J(d){const m=E.value;N(),m!==d.tax_setup_status&&await C(d,{tax_setup_status:m})}j(T,async d=>{var m,i;d&&(await vt(),(i=(m=B.value)==null?void 0:m.focus)==null||i.call(m))});function V(d){var P;const m=String(d.ship_from_state||"").trim();return m||String(((P=d.suppliers)==null?void 0:P.state)||"").trim()||"—"}function Q(d){return d.charges_enabled===!0&&d.payouts_enabled===!0}function L(d){var m;return((m=d.suppliers)==null?void 0:m.name)||d.supplier_id}function D(d){k.value=new Set(k.value).add(d)}return n({loadSellers:$}),(d,m)=>(g(),S(ie,null,[p.value?(g(),S("p",Bt,y(p.value),1)):U("",!0),t.rows.length?(g(),S("div",wt,[l("table",Ut,[m[1]||(m[1]=l("thead",null,[l("tr",null,[l("th",{scope:"col"},"Supplier"),l("th",{scope:"col"},"Owner"),l("th",{scope:"col"},"Email"),l("th",{scope:"col",class:"admin-sellers-tenure-col"},"Time on Clade"),l("th",{scope:"col"},"State"),l("th",{scope:"col",class:"admin-sellers-count-col"},"# Inventory"),l("th",{scope:"col",class:"admin-sellers-count-col"},"# Listed"),l("th",{scope:"col",class:"admin-sellers-icon-col"},"Stripe Connect"),l("th",{scope:"col",class:"admin-sellers-icon-col"},"Approved"),l("th",{scope:"col"},"Tax setup status"),l("th",{scope:"col",class:"admin-sellers-icon-col"},"Selling")])],-1)),l("tbody",null,[(g(!0),S(ie,null,ye(t.rows,i=>{var P;return g(),S("tr",{key:i.id,class:A({"admin-sellers-row--saving":b.value===i.id})},[l("td",qt,[l("div",Vt,[l("span",{class:A(["variety-thumb-wrap",{"user-photo":o(he)(i)&&!k.value.has(i.id)}])},[l("img",{src:o(he)(i)&&!k.value.has(i.id)?o(he)(i):o(Pt),alt:"",class:"variety-thumb",loading:"lazy",referrerpolicy:"no-referrer",onError:F=>D(i.id)},null,40,zt)],2),l("span",Kt,y(L(i)),1)])]),l("td",jt,y(o(De)(i)),1),l("td",Qt,y(i.owner_email),1),l("td",Gt,y(o(Ne)(i)),1),l("td",Yt,y(V(i)),1),l("td",Ht,y(o(Le)(i.inventory_item_count)),1),l("td",Wt,y(o(Le)(i.marketplace_listing_count)),1),l("td",Xt,[l("span",Zt,[l("img",{src:o(Lt),alt:"",class:A(["admin-sellers-stripe-logo",{"admin-sellers-stripe-logo--connected":Q(i)}])},null,10,Jt)])]),l("td",el,[l("button",{type:"button",class:"admin-sellers-check-btn admin-sellers-icon-slot","aria-pressed":i.marketplace_approved,"aria-label":`Approved: ${i.marketplace_approved?"yes":"no"}`,onClick:F=>C(i,{marketplace_approved:!i.marketplace_approved})},[l("img",{src:o(Ae),alt:"",class:A(["admin-sellers-check-icon",{inactive:!i.marketplace_approved}])},null,10,ll)],8,tl)]),l("td",{class:"admin-sellers-select-cell editable-cell","aria-label":`Tax setup status for ${((P=i.suppliers)==null?void 0:P.name)||i.supplier_id}: ${v(i.tax_setup_status)}`,onClick:F=>ue(i)},[T.value===i.id?(g(),S("div",{key:0,onClick:m[0]||(m[0]=te(()=>{},["stop"]))},[ke(xt,{ref_for:!0,ref_key:"taxStatusDropdownRef",ref:B,"model-value":E.value,options:O,"onUpdate:modelValue":w,onSelect:F=>J(i),onClose:N},null,8,["model-value","onSelect"])])):(g(),S("span",sl,y(v(i.tax_setup_status)),1))],8,al),l("td",rl,[l("button",{type:"button",class:"admin-sellers-check-btn admin-sellers-icon-slot","aria-pressed":i.selling_enabled,"aria-label":`Selling: ${i.selling_enabled?"yes":"no"}`,onClick:F=>C(i,{selling_enabled:!i.selling_enabled})},[l("img",{src:o(Ae),alt:"",class:A(["admin-sellers-check-icon",{inactive:!i.selling_enabled}])},null,10,ol)],8,nl)])],2)}),128))])])])):U("",!0)],64))}},ul=Ie(il,[["__scopeId","data-v-3c5b3e52"]]),cl=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function K(t){const n=String(t||"").trim();return cl.test(n)}function dl(t,n){var u,c;const s=n||(t==null?void 0:t.marketplace_purchase_groups);return!s||typeof s!="object"?"—":((u=s.buyer_user_email)==null?void 0:u.trim())||((c=s.buyer_email)==null?void 0:c.trim())||"—"}function ml(t,n){const s=String(n||"").trim().toLowerCase();if(!s)return!0;const u=String(t.buyer_email||"").toLowerCase(),c=String(t.seller_name||"").toLowerCase(),p=String(t.seller_order_number??"");return u.includes(s)||c.includes(s)||p.includes(s)}function pl(t,n={}){const s=n.paymentFilter||"";
1if(s&&yt(t)!==s)return!1;const u=n.fulfillmentFilter||"";if(u&&kt(t)!==u)return!1;const c=n.archived??"";if(c==="No"||c==="Yes"){const p=c==="Yes";if(Oe(t)!==p)return!1}return!0}const vl=50,fl=`
2  id,
3  purchase_group_id,
4  seller_order_number,
5  payment_status,
6  fulfillment_status,
7  total_cents,
8  created_at,
9  archived_at,
10  suppliers:supplier_id ( name ),
11  marketplace_purchase_groups ( buyer_email, buyer_user_email, checkout_state )
12`;function _l(t){var s,u;const n=t.suppliers&&typeof t.suppliers=="object"?t.suppliers:null;return{id:t.id,purchase_group_id:t.purchase_group_id,seller_order_number:t.seller_order_number,payment_status:t.payment_status,fulfillment_status:t.fulfillment_status,total_cents:t.total_cents,created_at:t.created_at,archived_at:t.archived_at??null,seller_name:((s=n==null?void 0:n.name)==null?void 0:s.trim())||"—",buyer_email:dl(t),checkout_state:((u=t.marketplace_purchase_groups)==null?void 0:u.checkout_state)??null}}async function gl(t,n={}){var q,$;const s=vl;let u=t.from("marketplace_seller_orders").select(fl).order("created_at",{ascending:!1}).order("id",{ascending:!1}).limit(s+1);const c=(q=n.purchaseGroupId)==null?void 0:q.trim();c&&(u=u.eq("purchase_group_id",c));const p=($=n.cursor)==null?void 0:$.trim();if(p){const[I,C]=p.split("|");I&&C&&(u=u.or(`created_at.lt.${I},and(created_at.eq.${I},id.lt.${C})`))}const{data:b,error:M}=await u;if(M)throw M;const k=b||[],T=k.length>s,E=T?k.slice(0,s):k,B=E[E.length-1],O=T&&B?`${B.created_at}|${B.id}`:null;return{orders:E.map(_l),nextCursor:O}}async function hl(t,n){const s=n==null?void 0:n.trim();if(!s||!K(s))return[];const{data:u,error:c}=await t.from("marketplace_support_cases").select("id, subject, case_status, reporter_email, created_at").eq("purchase_group_id",s).order("created_at",{ascending:!1});if(c)throw c;return u||[]}const f={date:"date",seller:"seller",order:"order",buyer:"buyer",status:"status",total:"total"};function yl(t,n,s,u){const c=u==="asc"?1:-1;if(s==="seller")return String(t.seller_name||"").localeCompare(String(n.seller_name||""),void 0,{sensitivity:"base"})*c;if(s==="buyer")return _e(t,n,"customer",u);if(s==="status"){const p=Fe(t).toLowerCase(),b=Fe(n).toLowerCase();if(p!==b)return p.localeCompare(b)*c;const M=Te(t).toLowerCase(),k=Te(n).toLowerCase();return M.localeCompare(k)*c}return s==="order"||s==="total"||s==="date"?_e(t,n,s,u):_e(t,n,"date",u)}const kl={class:"admin-marketplace-status",role:"status"},Sl={key:0,class:"module-table-container"},bl={class:"module-table module-table--seller-orders"},Cl=["aria-sort"],Pl=["aria-sort"],xl=["aria-sort"],Ml=["aria-sort"],Fl=["aria-sort"],Tl=["aria-sort"],Al=["onClick","onKeydown"],El={key:1},$l={class:"seller-orders-status-cell"},Ll={class:"admin-marketplace-status-badges"},Rl=["onClick","onKeydown"],Ol={key:0,class:"admin-marketplace-load-more"},Il=["disabled"],Nl={key:1,class:"admin-marketplace-support-cases"},Dl={class:"admin-marketplace-support-list"},Bl={key:1,class:"page-container"},wl=25,Ul=25,ql={__name:"AdminMarketplace",setup(t){const n={paymentFilter:"",fulfillmentFilter:"",archived:""},s=[{section:"Filters",type:"select",key:"paymentFilter",label:"Payment",placeholder:"Any payment",optionsRef:"payment"},{section:"Filters",type:"select",key:"fulfillmentFilter",label:"Fulfillment",placeholder:"Any fulfillment",optionsRef:"fulfillment"},{section:"Filters",type:"toggle",key:"archived",label:"Archived",iconSrc:Ft,activeValue:"Yes",inactiveValue:"No"}],u={payment:[{value:"",label:"Any payment"},...bt.map(({id:r,label:e})=>({value:r,label:e}))],fulfillment:[{value:"",label:"Any fulfillment"},...St.map(({id:r,label:e})=>({value:r,label:e}))]},c=_t(),{authChecked:p,initAuth:b,fetchUserProfile:M,isAdmin:k,email:T,userFirstName:E,userProfilePictureUrl:B}=Mt(!0),O=_(!1),q=_(null),$=_({count:0,loading:!0}),I=_([]),C=_(""),v=h(()=>c.name==="admin-marketplace-sellers"?"sellers":"orders"),ue=h(()=>v.value==="sellers"?"Sellers":"Marketplace orders"),N=_([]),w=_(null),J=_(!1),V=_(!1),Q=_(""),L=_(""),D=_({...n}),d=_(!1),m=_([]),i=_(null),{currentPage:P,totalPages:F,previousPage:le,nextPage:ce,resetToFirstPage:R,setTotalCount:Be,itemsPerPage:Se}=Ee(wl),{currentPage:ae,totalPages:se,previousPage:we,nextPage:Ue,resetToFirstPage:be,setTotalCount:qe,itemsPerPage:Ce}=Ee(Ul),{sortColumn:de,sortDirection:me,handleSort:Ve}=Et(f.date,"desc"),{getSortIndicatorClass:G}=At(de,me);function z(r){Ve(r),R()}function Y(r,e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),z(r))}function H(r){return de.value!==r?"none":me.value==="asc"?"ascending":"descending"}const Pe=h(()=>{const r=L.value.trim();let e=N.value;return K(r)||(e=e.filter(a=>ml(a,r))),e.filter(a=>pl(a,D.value))}),xe=h(()=>[...Pe.value].sort((r,e)=>yl(r,e,de.value,me.value))),pe=h(()=>{const r=(P.value-1)*Se.value;return xe.value.slice(r,r+Se.value)}),ve=h(()=>{const r=C.value;return I.value.filter(e=>Dt(e,r))}),Me=h(()=>{const r=(ae.value-1)*Ce.value;return ve.value.slice(r,r+Ce.value)}),ze=h(()=>v.value==="orders"?P.value:ae.value),Ke=h(()=>v.value==="orders"?F.value:se.value),je=h(()=>K(L.value)),Qe=h(()=>v.value==="orders"?pe.value.length:Me.value.length),Ge=h(()=>v.value==="orders"?Pe.value.length:ve.value.length),Ye=h(()=>v.value==="orders"?J.value:$.value.loading),He=h(()=>v.value==="orders"?"No orders match your search":C.value.trim()?"No sellers match your search":"No sellers"),We=h(()=>v.value==="orders"?"Try a different search or load more orders from the server.":C.value.trim()?"Try a different search.":"Marketplace seller rows will appear here once sellers enroll."),Xe=h(()=>!!D.value.paymentFilter||!!D.value.fulfillmentFilter||D.value.archived!==n.archived),Ze=h(()=>v.value==="sellers"?C.value:L.value),Je=h(()=>v.value==="orders"?!!L.value.trim()||Xe.value:!!C.value.trim()),et=h(()=>!k.value||!p.value?!1:v.value==="sellers"?!$.value.loading:!0),tt=h(()=>v.value!=="sellers");Re(async()=>{await b(),T.value&&await M(),k.value&&v.value==="orders"&&await ee(!0)}),j(()=>xe.value.length,r=>{Be(r),P.value>F.value&&F.value>0&&(P.value=F.value)},{immediate:!0}),j(()=>ve.value.length,r=>{qe(r),ae.value>se.value&&se.value>0&&(ae.value=se.value)},{immediate:!0}),j(L,(r,e)=>{R();const a=r.trim(),x=String(e||"").trim();if(K(a)){lt(a);return}K(x)&&!K(a)&&(i.value=null,m.value=[],ee(!0))}),j(C,()=>{be()});let fe=null;function lt(r){fe&&clearTimeout(fe),fe=setTimeout(()=>{ee(!0,r)},300)}j(()=>v.value,r=>{var e,a;r==="sellers"&&k.value?(a=(e=q.value)==null?void 0:e.loadSellers)==null||a.call(e):r==="orders"&&k.value&&!N.value.length&&ee(!0)});async function ee(r=!1,e=null){r&&(N.value=[],w.value=null),J.value=r||!N.value.length,V.value=!r&&!!w.value,Q.value="";try{const a=await gl(Z,{cursor:r?null:w.value,purchaseGroupId:e||null}),x=a.orders||[];N.value=r?x:[...N.value,...x],w.value=a.nextCursor||null,e&&K(e)&&(i.value=e,m.value=await hl(Z,e))}catch(a){Q.value=a.message||"Could not load orders"}finally{J.value=!1,V.value=!1}}function at(){if(!w.value||V.value)return;const r=je.value?L.value.trim():null;ee(!1,r)}function st(r){const e=Ct(r);if(!e)return"—";const a=e.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),x=$e(new Date),pt=$e(e);return x&&pt===x?`Today at ${a}`:`${e.toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"2-digit"})} at ${a}`}async function W(r){try{await navigator.clipboard.writeText(r)}catch{}}function rt(r){v.value==="sellers"?C.value=r:L.value=r}function nt(){if(v.value==="sellers"){C.value="",be();return}L.value="",D.value={...n},R()}function ot(r){D.value={...r},R()}function it(){v.value==="sellers"?we():le()}function ut(){v.value==="sellers"?Ue():ce()}function ct(){O.value=!O.value}function dt(){O.value=!1}function mt(r){I.value=r.sellers??[],$.value={loading:r.loading,count:I.value.length}}return(r,e)=>o(p)&&o(k)?(g(),re(gt,{key:0,"auth-checked":o(p),email:o(T),"user-first-name":o(E),"user-profile-picture-url":o(B),"show-navigation":O.value,"top-navigation":"admin-marketplace","active-module":v.value,title:ue.value,"search-query":Ze.value,"is-loading":Ye.value,"show-loading-spinner":tt.value,"item-count":Qe.value,"total-count":Ge.value,"current-page":ze.value,"total-pages":Ke.value,"item-label-singular":v.value==="orders"?"order":"seller","item-label-plural":v.value==="orders"?"orders":"sellers","empty-title":He.value,"empty-message":We.value,"show-clear-button":Je.value,"show-results-bar":et.value,"view-settings-in-more-menu":"",onMainClick:dt,onToggleNavigation:ct,"onUpdate:searchQuery":rt,onClearSearch:nt,onPreviousPage:it,onNextPage:ut},ft({content:ne(()=>[v.value==="orders"&&pe.value.length?(g(),S("div",Sl,[l("table",bl,[l("thead",null,[l("tr",null,[l("th",{scope:"col","aria-sort":H(o(f).date)},[l("div",{class:"th-content sortable",role:"button",tabindex:"0",onClick:e[1]||(e[1]=a=>z(o(f).date)),onKeydown:e[2]||(e[2]=a=>Y(o(f).date,a))},[e[15]||(e[15]=X(" Date ",-1)),l("i",{class:A(o(G)(o(f).date)),"aria-hidden":"true"},null,2)],32)],8,Cl),l("th",{scope:"col","aria-sort":H(o(f).seller)},[l("div",{class:"th-content sortable",role:"button",tabindex:"0",onClick:e[3]||(e[3]=a=>z(o(f).seller)),onKeydown:e[4]||(e[4]=a=>Y(o(f).seller,a))},[e[16]||(e[16]=X(" Seller ",-1)),l("i",{class:A(o(G)(o(f).seller)),"aria-hidden":"true"},null,2)],32)],8,Pl),l("th",{scope:"col","aria-sort":H(o(f).order)},[l("div",{class:"th-content sortable",role:"button",tabindex:"0",onClick:e[5]||(e[5]=a=>z(o(f).order)),onKeydown:e[6]||(e[6]=a=>Y(o(f).order,a))},[e[17]||(e[17]=X(" Order # ",-1)),l("i",{class:A(o(G)(o(f).order)),"aria-hidden":"true"},null,2)],32)],8,xl),l("th",{scope:"col","aria-sort":H(o(f).buyer)},[l("div",{class:"th-content sortable",role:"button",tabindex:"0",onClick:e[7]||(e[7]=a=>z(o(f).buyer)),onKeydown:e[8]||(e[8]=a=>Y(o(f).buyer,a))},[e[18]||(e[18]=X(" Buyer ",-1)),l("i",{class:A(o(G)(o(f).buyer)),"aria-hidden":"true"},null,2)],32)],8,Ml),l("th",{scope:"col","aria-sort":H(o(f).status)},[l("div",{class:"th-content sortable",role:"button",tabindex:"0",onClick:e[9]||(e[9]=a=>z(o(f).status)),onKeydown:e[10]||(e[10]=a=>Y(o(f).status,a))},[e[19]||(e[19]=X(" Status ",-1)),l("i",{class:A(o(G)(o(f).status)),"aria-hidden":"true"},null,2)],32)],8,Fl),l("th",{scope:"col","aria-sort":H(o(f).total)},[l("div",{class:"th-content sortable",role:"button",tabindex:"0",onClick:e[11]||(e[11]=a=>z(o(f).total)),onKeydown:e[12]||(e[12]=a=>Y(o(f).total,a))},[e[20]||(e[20]=X(" Total ",-1)),l("i",{class:A(o(G)(o(f).total)),"aria-hidden":"true"},null,2)],32)],8,Tl),e[21]||(e[21]=l("th",{scope:"col"},"Actions",-1))])]),l("tbody",null,[(g(!0),S(ie,null,ye(pe.value,a=>(g(),S("tr",{key:a.id},[l("td",null,y(st(a)),1),l("td",null,y(a.seller_name),1),l("td",null,"#"+y(a.seller_order_number),1),l("td",null,[a.buyer_email&&a.buyer_email!=="—"?(g(),S("span",{key:0,role:"button",tabindex:"0",class:"admin-marketplace-copy-link",onClick:x=>W(a.buyer_email),onKeydown:[oe(te(x=>W(a.buyer_email),["prevent"]),["enter"]),oe(te(x=>W(a.buyer_email),["prevent"]),["space"])]},y(a.buyer_email),41,Al)):(g(),S("span",El,"—"))]),l("td",$l,[l("div",Ll,[ke(ge,{kind:"payment",order:a},null,8,["order"]),ke(ge,{kind:"fulfillment",order:a},null,8,["order"]),o(Oe)(a)?(g(),re(ge,{key:0,kind:"archived",order:a},null,8,["order"])):U("",!0)])]),l("td",null,y(o($t)(a.total_cents)),1),l("td",null,[l("span",{role:"button",tabindex:"0",class:"admin-marketplace-copy-link",onClick:x=>W(a.purchase_group_id),onKeydown:[oe(te(x=>W(a.purchase_group_id),["prevent"]),["enter"]),oe(te(x=>W(a.purchase_group_id),["prevent"]),["space"])]}," Copy purchase group ",40,Rl)])]))),128))])]),w.value?(g(),S("div",Ol,[l("button",{type:"button",class:"btn-secondary",disabled:V.value,onClick:at},y(V.value?"Loading…":"Load more from server"),9,Il)])):U("",!0),i.value&&m.value.length?(g(),S("div",Nl,[e[22]||(e[22]=l("h3",{class:"heading-3"},"Support cases",-1)),l("ul",Dl,[(g(!0),S(ie,null,ye(m.value,a=>(g(),S("li",{key:a.id},y(a.case_status)+" — "+y(a.subject)+" ("+y(a.reporter_email)+") ",1))),128))])])):U("",!0)])):v.value==="sellers"?(g(),re(ul,{key:1,ref_key:"sellersPanelRef",ref:q,rows:Me.value,onState:mt},null,8,["rows"])):U("",!0)]),modals:ne(()=>[v.value==="orders"?(g(),re(ht,{key:0,show:d.value,"onUpdate:show":e[13]||(e[13]=a=>d.value=a),filters:D.value,"default-filters":n,"filter-config":s,"options-list":u,"filters-per-row":2,onApply:ot},null,8,["show","filters"])):U("",!0)]),_:2},[v.value==="orders"?{name:"action-buttons",fn:ne(()=>[l("button",{type:"button",class:"action-btn module-filters-btn","aria-label":"Filters",onClick:e[0]||(e[0]=a=>d.value=!0)},[...e[14]||(e[14]=[l("span",{class:"material-icons"},"tune",-1),l("span",{class:"action-btn-text"},"Filters",-1)])])]),key:"0"}:void 0,v.value==="orders"&&Q.value?{name:"filters",fn:ne(()=>[l("p",kl,y(Q.value),1)]),key:"1"}:void 0]),1032,["auth-checked","email","user-first-name","user-profile-picture-url","show-navigation","active-module","title","search-query","is-loading","show-loading-spinner","item-count","total-count","current-page","total-pages","item-label-singular","item-label-plural","empty-title","empty-message","show-clear-button","show-results-bar"])):o(p)&&!o(k)?(g(),S("main",Bl,[...e[23]||(e[23]=[l("p",null,"Admin access required.",-1)])])):U("",!0)}},Pa=Ie(ql,[["__scopeId","data-v-6c783ed1"]]);export{Pa 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.