1import{af as D,S as b,Q as u,ag as k,f as A,r as p,j as t,O as j,L as v,R}from"./index-CL_TZ6iC.js";import{b as d}from"./content-BRzuuHXF.js";const C=d.value,E="Scholarships Cafe",T="scholarshipscafe.com",L={stripe:"Card (Stripe)",payaza:"Payaza",paystack:"Paystack"};function i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(e){const s=new Date(e);return Number.isNaN(s.getTime())?"â":s.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"})}function z(e,s){const c=(s??"").trim();if((c===""?Number.NaN:Number(c))===0)return"No payment required (promotion code)";const a=(e??"").trim();return L[a.toLowerCase()]??a}const M=` 2 /* The page box is zeroed and the DOCUMENT owns its gutters, for the reason printDoc.ts spells 3 out at length: Safari ignores @page margins outright and Chrome lets the print dialog's own 4 Margins control win, so a receipt relying on @page alone ships flush to the paper edge for 5 anyone whose dialog remembers "None". Body padding needs no engine's cooperation. (printDoc's 6 repeating thead/tfoot gutter trick is NOT copied â a receipt is one page, where body padding 7 is exactly the right tool.) */ 8 @page { size: A4; margin: 0; } 9 * { box-sizing: border-box; } 10 body { 11 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif; 12 font-size: 11pt; 13 line-height: 1.5; 14 color: #000000; 15 background: #ffffff; 16 margin: 0; 17 padding: 18mm; 18 } 19 .rc-head { 20 display: flex; 21 justify-content: space-between; 22 align-items: flex-end; 23 border-bottom: 2px solid #000000; 24 padding-bottom: 8px; 25 margin-bottom: 20px; 26 } 27 .rc-biz { font-size: 14pt; font-weight: 700; margin: 0; } 28 h1 { font-size: 16pt; font-weight: 700; margin: 0; letter-spacing: 1px; } 29 table { border-collapse: collapse; width: 100%; } 30 .rc-meta { margin-bottom: 20px; } 31 .rc-meta th { 32 width: 32%; 33 text-align: left; 34 font-weight: 400; 35 color: #444444; 36 padding: 3px 0; 37 vertical-align: top; 38 } 39 .rc-meta td { padding: 3px 0; vertical-align: top; } 40 .rc-no { font-size: 13pt; font-weight: 700; letter-spacing: 0.5px; } 41 .rc-items { margin-bottom: 20px; } 42 .rc-items th { 43 text-align: left; 44 font-size: 9pt; 45 text-transform: uppercase; 46 letter-spacing: 0.6px; 47 color: #444444; 48 border-bottom: 1px solid #000000; 49 padding: 0 8px 5px 0; 50 } 51 .rc-items td { padding: 10px 8px 10px 0; vertical-align: top; } 52 .rc-items th:last-child, .rc-items td:last-child { padding-right: 0; } 53 .rc-num { text-align: right; white-space: nowrap; } 54 /* The .rc-items th rule above sets text-align: left for the whole header row, which beat 55 .rc-num's own alignment (same specificity, declared later) and left "AMOUNT PAID" sitting 56 over the left edge of a right-aligned column of figures. 57 (No backticks anywhere in this sheet â it lives in a template literal.) */ 58 .rc-items th.rc-num { text-align: right; } 59 .rc-total { font-weight: 700; } 60 .rc-paid { font-weight: 700; letter-spacing: 1px; } 61 .rc-ref { font-size: 8.5pt; color: #444444; margin: 24px 0 0; word-break: break-all; } 62 .rc-foot { 63 font-size: 9pt; 64 color: #444444; 65 border-top: 1px solid #cccccc; 66 margin-top: 10px; 67 padding-top: 10px; 68 } 69`;function I(e,s={}){const c=s.supportEmail??C,o=s.businessName??E,a=s.site??T,n=b(e),h=n?`<th class="rc-num">Discount${e.promoCode?` (${i(e.promoCode)})`:""}</th>`:"",l=n?`<td class="rc-num">â${i(u(e.discountAmount,e.currency))}</td>`:"",m=`<div class="rc-head"><p class="rc-biz">${i(o)}</p><h1>Receipt</h1></div><table class="rc-meta"><tbody><tr><th>Receipt No.</th><td class="rc-no">${i(e.receiptNo)||"â"}</td></tr><tr><th>Date paid</th><td>${i(O(e.paidAt))}</td></tr><tr><th>Billed to</th><td>${i(e.email??"")||"â"}</td></tr></tbody></table><table class="rc-items"><thead><tr><th>Description</th><th class="rc-num">List price</th>`+h+`<th class="rc-num">Amount paid</th></tr></thead><tbody><tr><td>${i(e.productName)}</td><td class="rc-num">
69${i(u(e.listAmount,e.currency))}</td>`+l+`<td class="rc-num rc-total">${i(u(e.amount,e.currency))}</td></tr></tbody></table><table class="rc-meta"><tbody><tr><th>Payment method</th><td>${i(z(e.provider,e.amount))||"â"}</td></tr><tr><th>Status</th><td class="rc-paid">PAID</td></tr></tbody></table><p class="rc-ref">Reference: ${i(e.reference)}</p><p class="rc-foot">Questions about this receipt? Email ${i(c)} and quote the receipt number above. · ${i(a)}</p>`;return`<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${i(U(e))}</title><style>${M}</style></head><body>${m}</body></html>`}function U(e){return`Receipt-${e.receiptNo||e.reference}`}function P(e,s={}){D(I(e,s))}const F=["status","provider","reference","providerRef"],_=2e3;function q(){const e=new URLSearchParams(window.location.search);if(e.get("status")!=="success")return null;const s=e.get("provider")??"",c=e.get("reference")??"";return!s||!c?null:{provider:s,reference:c,providerRef:e.get("providerRef")||void 0}}function B(){const e=new URL(window.location.href);for(const c of F)e.searchParams.delete(c);const s=e.searchParams.toString();window.history.replaceState({},"",e.pathname+(s?`?${s}`:"")+e.hash)}const Y=e=>new Promise(s=>window.setTimeout(s,e));function K(){const{items:e,loading:s,error:c,refresh:o}=k(),{verify:a}=A(),[n,h]=p.useState(null),l=p.useRef(o);l.current=o;const m=p.useRef(a);m.current=a;const y=p.useRef(!1),w=p.useRef(null),g=p.useCallback(async r=>{h({phase:"confirming"});let x=!1;try{const f=await m.current(r.provider,r.reference,r.providerRef);x=f.status==="paid"||f.status==="already_processed"}catch{x=!1}if(!x){h({phase:"pending",reference:r.reference}),await l.current();return}B(),(f=>f.some($=>$.reference===r.reference))(await l.current())||(await Y(_),await l.current()),h({phase:"paid",reference:r.reference})},[]);p.useEffect(()=>{if(y.current)return;y.current=!0;const r=q();if(w.current=r,!r){l.current();return}g(r)},[g]);const S=()=>{const r=w.current;r&&g(r)},N=(n==null?void 0:n.phase)==="paid"?e.find(r=>r.reference===n.reference)??null:null;return t.jsxs("div",{className:"page",id:"page-purchases",children:[t.jsx("h1",{className:"greet",children:"Your purchases"}),t.jsx("p",{className:"greetsub",children:"Receipts for the services and consultations you've bought."}),t.jsxs("p",{className:"pur-help",children:["Any questions or issues? Please email support at"," ",t.jsx("a",{href:`mailto:${d.value}`,children:d.value})," and include your receipt number. We'll get back to you within 1â2 business days."]}),(n==null?void 0:n.phase)==="confirming"?t.jsx("p",{className:"capnote",role:"status",children:"â³ Confirming your paymentâ¦"}):null,(n==null?void 0:n.phase)==="pending"?t.jsxs("div",{className:"pur-note pur-note-wait",role:"status",children:[t.jsx("p",{children:"Your payment is still being confirmed. If it went through, your receipt will appear here shortly â no need to pay again. You can safely reload this page."}),t.jsxs("p",{children:["Still not showing after a few minutes? Email"," ",t.jsx("a",{href:`mailto:${d.value}`,children:d.value})," and quote this reference: ",t.jsx("span",{className:"pur-rno-val",children:n.reference})]}),t.jsx("button",{type:"button",className:"btn btn-out",onClick:S,children:"Check again"})]}):null,(n==null?void 0:n.phase)==="paid"?N?t.jsx(H,{order:N}):t.jsxs("div",{className:"pur-note",role:"status",children:[t.jsx("h2",{className:"pur-note-head",children:"Payment received"}),t.jsx("p",{children:"Your payment went through. The receipt is a moment behind â reload this page shortly and it will be here, with its receipt number."})]}):null,(n==null?void 0:n.phase)==="paid"?t.jsx("h2",{className:"pur-list-head",children:"All receipts"}):null,t.jsx(W,{items:e,loading:s,error:c,hint:(n==null?void 0:n.phase)!=="paid"})]})}function H({order:e}){const s=b(e);return t.jsxs("div",{className:"pur-note pur-note-paid",role:"status",children:[t.jsx("h2",{className:"pur-note-head",children:"Payment received"}),t.jsxs("p",{className:"pur-rno",children:["Receipt number: ",t.jsx("span",{className:"pur-rno-val",children:e.receiptNo})]}),t.jsxs("dl",{className:"pur-lines",children:[t.jsx("dt",{children:"Item"}),t.jsx("dd",{children:e.productName}),s?t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:"List price"}
69),t.jsx("dd",{children:u(e.listAmount,e.currency)}),t.jsxs("dt",{children:["Discount",e.promoCode?` (${e.promoCode})`:""]}),t.jsxs("dd",{children:["â",u(e.discountAmount,e.currency)]})]}):null,t.jsx("dt",{children:"Amount paid"}),t.jsx("dd",{className:"pur-strong",children:u(e.amount,e.currency)}),t.jsx("dt",{children:"Date"}),t.jsx("dd",{children:j(e.paidAt)})]}),e.kind==="service"?t.jsxs("p",{className:"pur-next",children:["Our team will contact you at ",e.email??"your account email"," to get started. Please download your receipt and keep the receipt number â quote it in any message to us."]}):t.jsxs("p",{className:"pur-next",children:["Your booking link is on the ",t.jsx(v,{to:R.advisor,children:"Speak with an Advisor"})," page."]}),t.jsxs("div",{className:"pur-actions",children:[t.jsx("button",{type:"button",className:"profsave",onClick:()=>P(e),children:"Download receipt (PDF)"}),e.kind==="service"?t.jsx("a",{className:"pur-mail",href:Q(e),children:"Email us your documents"}):null]}),t.jsx("p",{className:"pur-hint",children:"Opens your print window â choose âSave as PDFâ."})]})}function Q(e){const s=`Receipt ${e.receiptNo} â ${e.productName}`;return`mailto:${d.value}?subject=${encodeURIComponent(s)}`}function W({items:e,loading:s,error:c,hint:o}){return s&&e.length===0?t.jsx("p",{className:"capnote",children:"â³ Loading your purchasesâ¦"}):c&&e.length===0?t.jsx("p",{className:"capnote",children:"We could not load your purchases. Please reload."}):e.length===0?t.jsxs("p",{className:"capnote",children:["You haven't bought anything yet."," ",t.jsx(v,{to:R.services,children:"Browse our services â"})]}):t.jsxs(t.Fragment,{children:[o?t.jsx("p",{className:"pur-hint",children:"Opens your print window â choose âSave as PDFâ."}):null,t.jsx("ul",{className:"pur-list",children:e.map(a=>t.jsxs("li",{className:"pur-row",children:[t.jsxs("div",{className:"pur-row-main",children:[t.jsx("p",{className:"pur-row-date",children:j(a.paidAt)}),t.jsx("p",{className:"pur-row-name",children:a.productName}),t.jsxs("p",{className:"pur-row-meta",children:["Receipt ",t.jsx("span",{className:"pur-rno-val",children:a.receiptNo})]})]}),t.jsxs("div",{className:"pur-row-side",children:[t.jsx("p",{className:"pur-row-amount",children:u(a.amount,a.currency)}),b(a)?t.jsx("p",{className:"pur-row-disc",children:"discount applied"}):null,t.jsx("button",{type:"button",className:"btn btn-out","aria-label":`Download receipt (PDF) ${a.receiptNo}`,onClick:()=>P(a),children:"Download receipt (PDF)"})]})]},a.reference))})]})}export{K 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.