1import{l as G,g as U,r as n,i as h,j as e,L as J}from"./main-CUb43k5l.js";import{p as Q,f as Y}from"./order-BioBgLAt.js";const K=()=>{const k=G({select:t=>t.location}),F=U(k.pathname)||"us",_=new URLSearchParams(k.search),m=_.get("orderId")||"",b=_.get("email")||"",[f,S]=n.useState(b),[g,C]=n.useState(m),[R,i]=n.useState(!1),[P,O]=n.useState(!1),[E,d]=n.useState(!1),[x,o]=n.useState(""),[r,y]=n.useState(null),[q,A]=n.useState(!1),[l,u]=n.useState(new Map),[L,j]=n.useState(""),[N,z]=n.useState(!1),[I,W]=n.useState([]),w=async(t,a)=>{try{const c=await h.client.fetch("/store/order-lookup?fields=cart.id",{method:"POST",body:{email:t.trim(),display_id:a.trim()}});c.order&&y(c.order)}catch(c){console.error("Error fetching order:",c);const s=c?.message||"An error occurred while searching for your order. Please try again.";throw new Error(s)}},M=async t=>{t.preventDefault(),o(""),y(null),i(!0);try{await w(f,g)}catch(a){o(a.message)}finally{i(!1)}},T=async()=>{if(r){O(!0),o("");try{await w(f,g)}catch(t){o(t.message)}finally{O(!1)}}},v=(t,a)=>new Intl.NumberFormat("en-GB",{style:"currency",currency:a.toUpperCase()}).format(t),$=(t,a)=>{const c=new Map(l);c.has(t)?c.delete(t):c.set(t,{line_item_id:t,product_title:a,quantity:1,reason:I[0]?.id||"",reason_details:"",action:"refund"}),u(c)},p=(t,a)=>{const c=new Map(l),s=c.get(t);s&&(c.set(t,{...s,...a}),u(c))},D=async()=>{if(!r||l.size===0){o("Please select at least one item to return");return}d(!0),o("");try{if(!r.cart?.id){o("Unable to process return: missing cart information. Please contact support."),d(!1);return}const{shipping_options:t}=await h.client.fetch("/store/shipping-options",{method:"GET",query:{cart_id:r.cart.id,is_return:"true"}});if(!t||t.length===0){o("No return shipping options available. Please contact support."),d(!1);return}const a=t[0],c=Array.from(l.values()).map(s=>({id:s.line_item_id,quantity:s.quantity,reason_id:s.reason,note:s.reason_details?`${s.action}: ${s.reason_details}`:s.action}));await h.client.fetch("/store/returns",{method:"POST",body:{order_id:r.id,items:c,return_shipping:{option_id:a.id},note:L||void 0}}),z(!0),u(new Map),j("")}catch(t){console.error("Error submitting return:",t),o(t?.message||"Failed to submit return request. Please try again.")}finally{d(!1)}};return n.useEffect(()=>{h.client.fetch("/store/return-reasons").then(({return_reasons:t})=>W(t)).catch(t=>console.error("Error fetching return reasons:",t))},[]),n.useEffect(()=>{m&&b&&(i(!0),w(b,m).catch(t=>o(t.message)).finally(()=>i(!1)))},[]),e.jsx("div",{className:"min-h-screen bg-cc-cream",children:e.jsx("div",{className:"content-container py-16 lg:py-20",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("h1",{className:"font-display text-4xl lg:text-5xl font-light tracking-wide text-cc-black text-center mb-4",children:"Return & Exchange Form"}),e.jsx("p",{className:"font-body text-sm text-cc-taupe text-center mb-12 leading-relaxed",children:"Please provide us the following information so we can process your return/exchange requests"}),!r&&e.jsxs("form",{onSubmit:M,className:"space-y-6",children:[e.jsx("div",{children:e.jsx("input",{type:"email",value:f,onChange:t=>S(t.target.value),placeholder:"Your email address",required:!0,className:"w-full bg-cc-white border border-cc-sand px-5 py-4 font-body text-sm text-cc-charcoal placeholder:text-cc-taupe/50 focus:outline-none focus:border-cc-stone transition-colors"})}),e.jsx("div",{children:e.jsx("input",{type:"text",value:g,onChange:t=>C(t.target.value),placeholder:"Order number",required:!0,className:"w-full bg-cc-white border border-cc-sand px-5 py-4 font-body text-sm text-cc-charcoal placeholder:text-cc-taupe/50 focus:outline-none focus:border-cc-stone transition-colors"})}),x&&e.jsx("div",{className:"bg-red-50 border border-red-200 px-5 py-4 font-body text-sm text-red-800",children:x}),e.jsx("button",{type:"submit",disabled:R,className:"w-full bg-cc-espresso text-cc-cream px-8 py-4 font-body text-xs tracking-[0.15em] uppercase hover:bg-cc-charcoal transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:R?"Searching...":"Find Order"}),e.jsxs("p",{className:"font-body text-xs text-cc-taupe text-center mt-8",children:["Any more inquiries? Chat to us on"," ",e.jsx("a",{href:"https://wa.me/yourwhatsappnumber",target:"_blank",rel:"noopener noreferrer",className:"text-cc-accent hover:text-cc-charcoal transition-colors underline",children:"WhatsApp"})]})]}),N&&e.jsxs("div",{className:"bg-green-50 border border-green-200 p-8 text-center",children:[e.jsx("h2",{className:"font-display text-2xl font-light tracking-wide text-green-900 mb-3",children:"Thank You"}),e.jsx("p",{className:"font-body text-sm text-green-800 mb-4",children:"Please ensure items are received back with us with full tickets attached and within 30 days of your receipt."}),e.jsx("p",{className:"font-body text-sm text-green-800 mb-4",children:"Please send to Curated Crowd, 170 Walton Street, London SW3 2JL, United Kingdom"}),e.jsx("p",{className:"font-body text-sm text-green-800 mb-6",children:"Please ensure any applicable duties are pre-paid on the return."}),e.jsx(J,{to:"/$countryCode/collections/$handle",params:{countryCode:F,handle:"new-in"},className:"inline-block bg-cc-espresso text-cc-cream px-8 py-4 font-body text-xs tracking-[0.15em] uppercase hover:bg-cc-charcoal transition-colors",children:"See What's New"})]}),r&&!N&&!q&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-cc-white border border-cc-sand p-6 lg:p-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6 pb-4 border-b border-cc-sand",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"font-body text-2xl font-light tracking-wide text-cc-black mb-1",children:["Order #",r.display_id]}),e.jsxs("p",{className:"font-body text-xs text-cc-taupe",children:["Placed on ",new Date(r.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})]})]}),e.jsx("button",{onClick:T,disabled:P,className:"font-body text-xs text-cc-accent hover:text-cc-charcoal transition-colors disabled:opacity-50",children:P?"Refreshing...":"Refresh"})]}),e.jsxs("div",{className:"mb-6 pb-6 border-b border-cc-sand grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-body text-[10px] tracking-[0.3em] uppercase text-cc-taupe mb-2",children:"Payment Status"}),e.jsx("p",{className:"font-body text-sm text-cc-black",children:Q[r.payment_status]??r.payment_status?.replace(/_/g," ")??"â"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-body text-[10px] tracking-[0.3em] uppercase text-cc-taupe mb-2",children:"Fulfillment Status"}),e.jsx("p",{className:"font-body text-sm text-cc-black",children:Y[r.fulfillment_status]??r.fulfillment_status?.replace(/_/g," ")??"â"})]})]}),e.jsxs("div",{className:"mb-6 pb-6 border-b border-cc-sand",children:[e.jsx("p",{className:"font-body text-[10px] tracking-[0.3em] uppercase text-cc-taupe mb-4",children:"Order Items"}),e.jsx("div",{className:"space-y-4",children:r.items.map(t=>e.jsxs("div",{className:"flex gap-4",children:[t.thumbnail&&e.jsx("div",{className:"w-20 h-20 bg-cc-warm flex-shrink-0",children:e.jsx("img",{src:t.thumbnail,alt:t.title,className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 flex justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-body text-sm text-cc-black mb-1",children:t.title}),e.jsxs("p",{className:"font-body text-xs text-cc-taupe",children:["Quantity: ",t.quantity]})]}),e.jsx("p",{className:"font-body text-sm text-cc-charcoal",children:v(t.unit_price,r.currency_code)})]})]},t.id))})]}),r.shipping_address&&e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"font-body text-[10px] tracking-[0.3em] uppercase text-cc-taupe mb-2",children:"Shipping Address"}),e.jsxs("p",{className:"font-body text-sm text-cc-charcoal leading-relaxed",children:[r.shipping_address.first_name?.[0],"*** ",r.shipping_address.last_name?.[0],"***",e.jsx("br",{}),r.shipping_address.address_1?.substring(0,3),"***",r.shipping_address.address_2&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),"***"]}
1),e.jsx("br",{}),r.shipping_address.city?.substring(0,2),"***, ",r.shipping_address.postal_code?.substring(0,2),"***"]})]}),e.jsx("div",{className:"pt-4 border-t border-cc-sand",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{className:"font-body text-sm text-cc-charcoal",children:"Total"}),e.jsx("p",{className:"font-body text-xl text-cc-black",children:v(r.total,r.currency_code)})]})})]}),e.jsx("button",{onClick:()=>A(!0),className:"w-full bg-cc-espresso text-cc-cream px-8 py-4 font-body text-xs tracking-[0.15em] uppercase hover:bg-cc-charcoal transition-colors",children:"Initiate Return"}),e.jsx("button",{onClick:()=>{y(null),S(""),C(""),o("")},className:"w-full border border-cc-sand text-cc-charcoal px-8 py-4 font-body text-xs tracking-[0.15em] uppercase hover:bg-cc-warm transition-colors",children:"Search Another Order"})]}),r&&!N&&q&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"bg-cc-white border border-cc-sand p-6 lg:p-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6 pb-4 border-b border-cc-sand",children:e.jsxs("div",{children:[e.jsxs("h2",{className:"font-display text-2xl font-light tracking-wide text-cc-black mb-1",children:["Return Items â Order #",r.display_id]}),e.jsx("p",{className:"font-body text-xs text-cc-taupe",children:"Select the items you'd like to return or exchange"})]})}),e.jsx("div",{className:"space-y-4 mb-6",children:r.items.map(t=>{const a=l.has(t.id),c=l.get(t.id);return e.jsxs("div",{className:"border border-cc-sand p-4",children:[e.jsxs("div",{className:"flex gap-4 mb-4",children:[e.jsx("div",{className:"flex items-start pt-1",children:e.jsx("input",{type:"checkbox",checked:a,onChange:()=>$(t.id,t.title),className:"w-4 h-4 border-cc-sand text-cc-espresso focus:ring-cc-accent"})}),t.thumbnail&&e.jsx("div",{className:"w-20 h-20 bg-cc-warm flex-shrink-0",children:e.jsx("img",{src:t.thumbnail,alt:t.title,className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 flex justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-body text-sm text-cc-black mb-1",children:t.title}),e.jsxs("p",{className:"font-body text-xs text-cc-taupe",children:["Ordered: ",t.quantity]})]}),e.jsx("p",{className:"font-body text-sm text-cc-charcoal",children:v(t.unit_price,r.currency_code)})]})]}),a&&c&&e.jsxs("div",{className:"ml-8 space-y-4 pt-4 border-t border-cc-sand",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"font-body text-xs text-cc-taupe mb-2 block",children:"Quantity to Return"}),e.jsx("select",{value:c.quantity,onChange:s=>p(t.id,{quantity:parseInt(s.target.value)}),className:"w-full bg-cc-white border border-cc-sand px-3 py-2 font-body text-sm text-cc-charcoal focus:outline-none focus:border-cc-stone",children:Array.from({length:t.quantity},(s,B)=>B+1).map(s=>e.jsx("option",{value:s,children:s},s))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"font-body text-xs text-cc-taupe mb-2 block",children:"Action"}),e.jsxs("select",{value:c.action,onChange:s=>p(t.id,{action:s.target.value}),className:"w-full bg-cc-white border border-cc-sand px-3 py-2 font-body text-sm text-cc-charcoal focus:outline-none focus:border-cc-stone",children:[e.jsx("option",{value:"refund",children:"Refund"}),e.jsx("option",{value:"exchange",children:"Exchange"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"font-body text-xs text-cc-taupe mb-2 block",children:"Reason"}),e.jsx("select",{value:c.reason,onChange:s=>p(t.id,{reason:s.target.value}),className:"w-full bg-cc-white border border-cc-sand px-3 py-2 font-body text-sm text-cc-charcoal focus:outline-none focus:border-cc-stone",children:I.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"font-body text-xs text-cc-taupe mb-2 block",children:"Additional Details (Optional)"}),e.jsx("textarea",{value:c.reason_details,onChange:s=>p(t.id,{reason_details:s.target.value}),rows:2,className:"w-full bg-cc-white border border-cc-sand px-3 py-2 font-body text-sm text-cc-charcoal focus:outline-none focus:border-cc-stone resize-none",placeholder:"Please provide any additional details..."})]})]})]},t.id)})}),l.size>0&&e.jsxs("div",{className:"mb-6 pb-6 border-b border-cc-sand",children:[e.jsx("label",{className:"font-body text-xs text-cc-taupe mb-2 block",children:"Additional Notes (Optional)"}),e.jsx("textarea",{value:L,onChange:t=>j(t.target.value),rows:3,className:"w-full bg-cc-white border border-cc-sand px-3 py-2 font-body text-sm text-cc-charcoal focus:outline-none focus:border-cc-stone resize-none",placeholder:"Any additional information about your return..."})]}),l.size>0&&e.jsxs("div",{className:"font-body text-sm text-cc-charcoal leading-relaxed",children:[e.jsxs("p",{className:"mb-4",children:["To complete the return please send back the item(s) to",e.jsx("br",{}),"Curated Crowd, 170 Walton Street, London SW3 2JL, GB"]}),e.jsx("p",{className:"mb-4",children:"We recommend using a tracked service (or if you are London based you can pop in) our store is open 7 days a week. Please ensure your return arrives at our store within 30 days of your order receipt, we will inspect the item and issue the refund within 24 hours, please allow the payment providers time to process the refund."}),e.jsx("p",{children:"We will send a confirmation email when the refund is processed."})]})]}),x&&e.jsx("div",{className:"bg-red-50 border border-red-200 px-5 py-4 font-body text-sm text-red-800",children:x}),l.size>0&&e.jsx("button",{onClick:D,disabled:E,className:"w-full bg-cc-espresso text-cc-cream px-8 py-4 font-body text-xs tracking-[0.15em] uppercase hover:bg-cc-charcoal transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:E?"Submitting...":`Confirm Return (${l.size} ${l.size===1?"item":"items"})`}),e.jsx("button",{onClick:()=>{A(!1),u(new Map),j(""),o("")},className:"w-full border border-cc-sand text-cc-charcoal px-8 py-4 font-body text-xs tracking-[0.15em] uppercase hover:bg-cc-warm transition-colors",children:"Back to Order Details"})]})]})})})},X=K;export{X as component};
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.