PageSourceSearch

https://aesopsbangkok.com/assets/gift-vouchers-CEjPR9uq.js

js aesopsbangkok.com collected 2026-10-09 01:00:34 UTC 11,491 bytes, 1 lines download raw bytes

1import{c as L,a as R,r as s,q as K,j as e,v as Q}from"./index-Cs13zheQ.js";import{u as F}from"./useServerFn-DTsJbGTF.js";import{F as X}from"./Footer-DsvM7h2w.js";import{u as J}from"./use-mobile-Bd-A0TtP.js";import{t as p}from"./index-DsCfh4DG.js";import"./map-pin-DMa8sSsE.js";import"./phone-Bdq0o5o6.js";const Z=L({method:"POST"}).handler(R("90724af9612914d69178c0467605ca112b1250fe6ad62fbdd40cacef14dcc3dc")),ee=L({method:"POST"}).handler(R("52f29fa8cd31ed0781aaac5dc42d1a0b14983ae760b6cd9f19171752cc50b21b")),te=[2e3,4e3,6e3,8e3],O=4e3;function ce(){const b=s.useRef(null),[g,N]=s.useState(0),h=J(),[l,y]=s.useState(O),[S,k]=s.useState(""),[i,T]=s.useState(""),[n,M]=s.useState(""),[m,V]=s.useState(""),[j,I]=s.useState(""),[P,A]=s.useState(!1),[E,$]=s.useState(!1),G=F(Z),U=F(ee);s.useEffect(()=>{const t=new URLSearchParams(window.location.search);if(t.get("paid")==="1"){$(!0),p.success("Payment received — your voucher is on its way.");const a=t.get("session_id"),r=Number(t.get("amount")||l);K({value:r,currency:"THB",transaction_id:a||void 0}),a&&U({data:{sessionId:a,origin:window.location.origin}}).catch(o=>console.error("Voucher notification failed",o))}else t.get("canceled")==="1"&&p("Payment canceled — nothing was charged.")},[]),s.useEffect(()=>{if(!h)return;const t=b.current;if(!t)return;let a=0,r=0,o=!1;const v=2200,c=d=>{r||(r=d);const w=Math.min(1,(d-r)/v);N(w),w<1&&(a=requestAnimationFrame(c))},x=new IntersectionObserver(d=>{d.some(w=>w.isIntersecting)&&!o&&(o=!0,a=requestAnimationFrame(c),x.disconnect())},{threshold:.2});return x.observe(t),()=>{x.disconnect(),cancelAnimationFrame(a)}},[h]),s.useEffect(()=>{if(h)return;let t=0,a=0,r=0;const o=()=>{if(!b.current)return 0;const x=b.current.getBoundingClientRect(),d=x.height-window.innerHeight;return d<=0?0:Math.min(1,Math.max(0,-x.top/d))},v=()=>{r+=(a-r)*.18,Math.abs(a-r)<5e-4&&(r=a),N(r),t=requestAnimationFrame(v)},c=()=>{a=o()};return a=o(),r=a,t=requestAnimationFrame(v),window.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{cancelAnimationFrame(t),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[h]);const C=t=>t*t*(3-2*t),Y=C(Math.min(1,g/.35)),f=C(Math.min(1,Math.max(0,(g-.25)/.45))),H=Y*180,B=-g*14,q=1-Math.max(0,(g-.85)*4),W=h?70-f*95:110-f*190,_=.85+f*.2,D=f,z=async t=>{if(t.preventDefault(),!l||l<500){p.error("Minimum voucher amount is ฿500");return}if(!i.trim()||!n.trim()||!j.trim()){p.error("Please fill recipient, sender and voucher delivery email");return}A(!0);try{Q({value:l,currency:"THB",content_name:"Gift Voucher"});const{url:a}=await G({data:{amount:l,to:i.trim(),from:n.trim(),email:j.trim(),message:m.trim(),origin:window.location.origin}});window.location.href=a}catch(a){A(!1),p.error(a instanceof Error?a.message:"Payment could not be started. Please try again.")}},u="w-full px-4 py-2.5 rounded-md bg-white/5 border border-white/15 text-white placeholder:text-neutral-500 focus:outline-none focus:border-teal-300";return e.jsxs("div",{className:"min-h-screen bg-black text-white",children:[e.jsxs("section",{className:"pt-24 md:pt-16 pb-8 px-6 md:px-12 text-center border-b border-white/10",children:[e.jsx("p",{className:"mb-3 text-[11px] uppercase tracking-[0.4em] text-teal-300",children:"Aesops · Gift Vouchers"}),e.jsx("h1",{className:"font-display text-4xl leading-[1.05] tracking-wide sm:text-5xl md:text-6xl",children:"GIVE THE GIFT OF AESOP'S"}),e.jsx("p",{className:"mt-2 text-white/80",children:"For birthdays, Christmas, celebrations or just because."})]}),e.jsx("section",{ref:b,className:"relative px-6 md:px-12 py-10 md:py-16 border-b border-white/10",children:e.jsxs("div",{className:"max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-2 gap-12 md:gap-16 items-start",children:[e.jsxs("div",{className:"order-2 md:order-1",children:[!E&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-3xl tracking-wide mb-4 md:text-4xl",children:"CREATE YOUR GIFT VOUCHER"}),e.jsx("p",{className:"text-neutral-400 mb-2",children:"Choose your amount, add a personal message and complete your payment online. Your digital gift voucher will be delivered by email within 24 hours."}),e.jsx("p",{className:"text-neutral-500 italic text-sm mb-8",children:"Valid for 1 year from the date of purchase."})]}),E?e.jsxs("div",{className:"text-center border border-teal-300/40 rounded-xl p-8 bg-teal-300/5",children:[e.jsx("h3",{className:"text-3xl font-light tracking-tight mb-3",children:"THANK YOU"}),e.jsx("p",{className:"text-neutral-400",children:"We'll prepare your personalised voucher and send it to the delivery email provided within 24 hours."})]}):e.jsxs("form",{onSubmit:z,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-neutral-300 mb-2",children:"Gift Amount (THB)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:te.map(t=>e.jsxs("button",{type:"button",onClick:()=>{y(t),k("")},className:`relative px-4 py-2 rounded-full border text-sm transition-colors ${l===t&&!S?"border-teal-300 bg-teal-300/15 text-teal-200":"border-white/20 text-neutral-300 hover:border-white/40"}`,children:[t===O&&e.jsx("span",{className:"absolute -top-2.5 left-1/2 -translate-x-1/2 px-1.5 py-0.5 rounded-full text-[9px] tracking-[0.2em] bg-teal-300 text-black",children:"POPULAR"}
1),"฿",t.toLocaleString()]},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-neutral-400 mb-2",children:"Other amount"}),e.jsx("input",{type:"number",min:500,step:500,value:S,onChange:t=>{k(t.target.value),t.target.value&&y(Number(t.target.value))},placeholder:"Enter custom amount",className:u})]}),e.jsxs("div",{className:"md:hidden",children:[e.jsx("div",{className:"relative w-full rounded-xl overflow-hidden",style:{aspectRatio:"16 / 10",background:"linear-gradient(135deg, rgba(94,234,212,0.35) 0%, rgba(13,148,136,0.55) 50%, rgba(8,51,68,0.7) 100%)",border:"1px solid rgba(94,234,212,0.5)",boxShadow:"0 16px 40px rgba(94,234,212,0.2), inset 0 1px 0 rgba(255,255,255,0.2)"},children:e.jsxs("div",{className:"absolute inset-0 p-4 flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:"label-eyebrow text-[10px] text-white/90",children:"AESOPS"}),e.jsx("div",{className:"text-[10px] text-white/70",children:"GIFT CARD"})]}),e.jsxs("div",{children:[(i||n)&&e.jsxs("div",{className:"text-[11px] text-white/80 mb-1",children:[i?`To ${i}`:"",i&&n?" · ":"",n?`From ${n}`:""]}),m&&e.jsxs("div",{className:"text-[11px] leading-snug text-white/80 mb-1.5 line-clamp-3 italic",children:['"',m,'"']}),e.jsx("div",{className:"text-[10px] text-white/70 tracking-widest",children:"VALUE"}),e.jsxs("div",{className:"text-3xl text-white tracking-tight transition-all duration-200",children:["฿",(l||0).toLocaleString()]})]})]})}),e.jsx("p",{className:"text-xs text-neutral-500 mt-2 text-center",children:"Live preview — updates as you type"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-neutral-300 mb-2",children:"To"}),e.jsx("input",{type:"text",value:i,onChange:t=>T(t.target.value),placeholder:"Recipient Name",maxLength:80,className:u})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-neutral-300 mb-2",children:"From"}),e.jsx("input",{type:"text",value:n,onChange:t=>M(t.target.value),placeholder:"Your Name",maxLength:80,className:u})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-neutral-300 mb-2",children:"Personal Message"}),e.jsx("textarea",{value:m,onChange:t=>V(t.target.value),placeholder:"Write your custom note here...",rows:3,maxLength:500,className:`${u} resize-none`})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-neutral-300 mb-2",children:"Where should we send the voucher?"}),e.jsx("input",{type:"email",value:j,onChange:t=>I(t.target.value),placeholder:"Enter email to receive the voucher",maxLength:255,className:u}),e.jsx("p",{className:"text-xs text-neutral-500 mt-1",children:"We'll send the voucher to you within 24 hours. You can then forward or print it for the recipient."})]}),e.jsx("p",{className:"text-center text-sm text-neutral-400 pt-2",children:"Secure payment — Credit Card / PromptPay QR"}),e.jsx("button",{type:"submit",disabled:P,className:"w-full py-3.5 rounded-md bg-teal-400 text-black tracking-wide hover:bg-teal-300 transition-colors disabled:opacity-60",children:P?"Processing...":`Buy Voucher — ฿${(l||0).toLocaleString()}`}),e.jsxs("p",{className:"text-center text-xs text-neutral-500",children:["Questions about gift vouchers? Chat with us on WhatsApp —"," ",e.jsx("a",{href:"https://wa.me/66625677751",target:"_blank",rel:"noreferrer",className:"text-teal-300 hover:underline",children:"Message us"})," ","or call"," ",e.jsx("a",{href:"tel:+66625677751",className:"text-teal-300 hover:underline",children:"+66 62 567 7751"})]})]})]}),e.jsxs("div",{className:"hidden order-1 md:order-2 md:sticky md:top-24 md:h-[540px] overflow-hidden md:flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(ellipse at center, rgba(13,148,136,0.18), transparent 60%)"}}),e.jsxs("div",{className:"relative w-[190px] h-[275px] md:w-[320px] md:h-[470px]",style:{perspective:"1000px"},children:[e.jsxs("div",{className:"absolute inset-0 rounded-md",style:{transform:`translateY(${B}px)`,opacity:q,willChange:"transform, opacity",background:"linear-gradient(145deg, #1a1a1a 0%, #2a2a2a 50%, #111 100%)",boxShadow:"0 24px 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06)"},children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1/2",style:{clipPath:"pol
1ygon(0 0, 100% 0, 50% 100%)",background:"linear-gradient(180deg, #262626 0%, #1a1a1a 100%)",transformOrigin:"top center",transform:`rotateX(${H}deg)`,transformStyle:"preserve-3d",backfaceVisibility:"hidden",willChange:"transform"}}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center label-eyebrow text-[10px] text-neutral-500",children:"AESOPS · BANGKOK"})]}),e.jsx("div",{className:"absolute left-1/2 top-1/2 w-[180px] h-[110px] md:w-[300px] md:h-[175px] rounded-xl",style:{transform:`translate(-50%, -50%) translateY(${W}px) scale(${_})`,opacity:D,background:"linear-gradient(135deg, rgba(94,234,212,0.35) 0%, rgba(13,148,136,0.55) 50%, rgba(8,51,68,0.7) 100%)",backdropFilter:"blur(14px)",border:"1px solid rgba(94,234,212,0.5)",boxShadow:"0 20px 50px rgba(94,234,212,0.22), inset 0 1px 0 rgba(255,255,255,0.2)"},children:e.jsxs("div",{className:"absolute inset-0 p-4 flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:"label-eyebrow text-[10px] text-white/90",children:"AESOPS"}),e.jsx("div",{className:"text-[10px] text-white/70",children:"GIFT CARD"})]}),e.jsxs("div",{children:[(i||n)&&e.jsxs("div",{className:"text-[11px] text-white/85 mb-1",children:[i?`To ${i}`:"",i&&n?" · ":"",n?`From ${n}`:""]}),m&&e.jsxs("div",{className:"text-[11px] leading-snug text-white/80 mb-1.5 line-clamp-3 italic",children:['"',m,'"']}),e.jsx("div",{className:"text-[10px] text-white/70 tracking-widest",children:"VALUE"}),e.jsxs("div",{className:"text-2xl text-white tracking-tight transition-all duration-200",children:["฿",(l||3e3).toLocaleString()]})]})]})})]})]})]})}),e.jsx(X,{})]})}export{ce 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.