PageSourceSearch

https://refindi-concierge-web.lovable.app/assets/RetrievalPaymentCancel-uQj0vvkF.js

js refindi-concierge-web.lovable.app collected 2026-10-03 03:43:08 UTC 6,821 bytes, 1 lines download raw bytes

1import{j as e,I as P,$ as f,C as S}from"./vendor-ui-C_-DsJan.js";import{b as C,r as o}from"./vendor-react-Bscl9t8p.js";import{u as Z,b as c,a4 as E,B as g,a as x}from"./index-DJkJoksn.js";import{T as R}from"./textarea-CwzWzFXy.js";import{r as T}from"./refindi-logo-B6PQSHoi.js";import"./vendor-charts-RYmyDf_a.js";const W=(r,l)=>r[l]??r.en,D=[{key:"too_expensive",label:{pl:"Za drogo",en:"Too expensive",de:"Zu teuer"}},{key:"shipping_too_slow",label:{pl:"Dostawa za wolna",en:"Delivery too slow",de:"Lieferung zu langsam"}},{key:"did_not_trust_payment",label:{pl:"Brak zaufania do płatności",en:"Didn't trust the payment",de:"Zahlung nicht vertrauenswürdig"}},{key:"changed_mind",label:{pl:"Zmieniłem zdanie",en:"Changed my mind",de:"Meinung geändert"}},{key:"item_not_worth_it",label:{pl:"Rzecz nie warta ceny",en:"Item not worth the price",de:"Nicht den Preis wert"}},{key:"technical_problem",label:{pl:"Problem techniczny",en:"Technical problem",de:"Technisches Problem"}},{key:"missing_payment_method",label:{pl:"Brak mojej metody płatności",en:"Missing payment method",de:"Zahlungsmethode fehlt"}},{key:"needs_more_time",label:{pl:"Potrzebuję więcej czasu",en:"Need more time",de:"Brauche mehr Zeit"}},{key:"other",label:{pl:"Inny powód",en:"Other",de:"Anderer Grund"}}],L=[{key:"would_pay_less",label:{pl:"Zapłaciłbym mniej",en:"I'd pay less",de:"Würde weniger zahlen"}},{key:"would_not_pay",label:{pl:"Nie zapłaciłbym",en:"Wouldn't pay",de:"Würde nicht zahlen"}},{key:"unsure",label:{pl:"Nie jestem pewien",en:"Not sure",de:"Nicht sicher"}}],a={title:{pl:"Płatność anulowana",en:"Payment cancelled",de:"Zahlung abgebrochen"},subtitle:{pl:"Płatność nie została zrealizowana. Kliknij poniżej, aby spróbować ponownie.",en:"Your payment was not completed. Click below to try again.",de:"Deine Zahlung wurde nicht abgeschlossen. Klicke unten, um es erneut zu versuchen."},feedbackPrompt:{pl:"Pomóż nam się poprawić — dlaczego nie dokończyłeś? (opcjonalnie)",en:"Help us improve — why didn't you finish? (optional)",de:"Hilf uns — warum hast du nicht abgeschlossen? (optional)"},hintPrompt:{pl:"Jaka cena byłaby w porządku?",en:"What price would be OK?",de:"Welcher Preis wäre okay?"},commentPlaceholder:{pl:"Dodatkowy komentarz (opcjonalnie)",en:"Additional comment (optional)",de:"Zusätzlicher Kommentar (optional)"},send:{pl:"Wyślij opinię",en:"Send feedback",de:"Feedback senden"},sending:{pl:"Wysyłanie...",en:"Sending...",de:"Senden..."},sent:{pl:"Dziękujemy za opinię!",en:"Thanks for your feedback!",de:"Danke für dein Feedback!"},retry:{pl:"Spróbuj ponownie",en:"Try again",de:"Erneut versuchen"},generating:{pl:"Generowanie...",en:"Generating...",de:"Wird erstellt..."},retryError:{pl:"Nie udało się wygenerować nowego linku. Skontaktuj się z nami.",en:"Could not generate a new link. Please contact us.",de:"Neuer Link konnte nicht erstellt werden. Bitte kontaktiere uns."},feedbackError:{pl:"Nie udało się wysłać opinii.",en:"Could not send feedback.",de:"Feedback konnte nicht gesendet werden."},questions:{pl:"Masz pytania? Napisz do nas: ",en:"Questions? Contact us: ",de:"Fragen? Kontaktiere uns: "}},H=()=>{const{id:r}=C(),{language:l}=Z(),t=n=>W(n,l),[m,u]=o.useState(!1),[s,k]=o.useState(null),[p,w]=o.useState(null),[h,j]=o.useState(""),[d,y]=o.useState(!1),[N,v]=o.useState(!1),b=o.useRef(!1);o.useEffect(()=>{!r||b.current||(b.current=!0,c.post(`/api/retrieval/${r}/checkout-event`,{event_type:"checkout_cancelled"}).catch(()=>{}))},[r]);const z=async()=>{u(!0);try{const n=await c.post(`/api/retrieval/${r}/recreate-payment`);window.location.href=n.checkout_url}catch{x.error(t(a.retryError)),u(!1)}},_=async()=>{if(!(!s||d)){y(!0);try{await c.post(`/api/retrieval/${r}/abandonment-feedback`,{reason:s,comment:h.trim()||void 0,price_acceptance_hint:s==="too_expensive"?p??void 0:void 0}),v(!0)}catch{x.error(t(a.feedbackError))}finally{y(!1)}}};return e.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-4 relative",children:[e.jsx("div",{className:"absolute top-4 right-4",children:e.jsx(E,{})}),e.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:T,alt:"Refindi",className:"h-8"})}),e.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-muted flex items-center justify-center",children:e.jsx(P,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h1",{className:"font-heading text-2xl font-bold text-foreground",children:t(a.title)}),e.jsx("p",{className:"text-muted-foreground font-body leading-relaxed",children:t(a.subtitle)}),e.jsx(g,{className:"rounded-full font-body font-semibold px-8 h-12 w-full",onClick:z,disabled:m,children:m?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"w-4 h-4 animate-spin"}),t(a.generating)]}):t(a.retry)}),N?e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground font-body pt-2",children:[e.jsx(S,{className:"w-4 h-4 text-primary"}),t(a.sent)]}):e.jsxs("div",{className:"text-left space-y-3 border-t border-border pt-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground font-body",children:t(a.feedbackPrompt)}),e.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(n=>{const i=s===n.key;return e.jsx("button",{type:"button",onClick:()=>k(i?null:n.key),className:`rounded-full px-3 py-1.5 text-sm font-body border transition-colors ${i?"bg-primary text-primary-foreground border-primary":"bg-background text-foreground border-border hover:border-primary"}`,children:t(n.label)},n.key)})}),s==="too_expensive"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground font-body",children:t(a.hintPrompt)}),e.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(n=>{const i=p===n.key;return e.jsx("button",{type:"button",onClick:()=>w(i?null:n.key),className:`rounded-full px-3 py-1.5 text-sm font-body border transition-colors ${i?"bg-primary text-primary-foreground border-primary":"bg-background text-foreground border-border hover:border-primary"}`,children:t(n.label)},n.key)})})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx(R,{value:h,onChange:n=>j(n.target.value.slice(0,500)),placeholder:t(a.commentPlaceholder),className:"font-body",rows:3}),e.jsx(g,{variant:"outline",className:"rounded-full font-body w-full",onClick:_,disabled:d,children:d?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"w-4 h-4 animate-spin"}),t(a.sending)]}):t(a.send)})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground font-body",children:[t(a.questions),e.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]})]})]})};export{H 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.