PageSourceSearch

https://edgemxtiming.com/assets/SponsorCouponView-CuUOhy7E.js

js edgemxtiming.com collected 2026-10-02 01:30:38 UTC 5,882 bytes, 1 lines download raw bytes

1import{K as P,h as L,r as o,s as R,j as e,d as M,B as j,V as U,u as _}from"./index-Ct8eLu1I.js";import{u as b}from"./useProxiedImageUrl-Bv4V2bP0.js";import{C as D}from"./copy-BLDCcnKG.js";import{E as I}from"./external-link-Jsfrs_aE.js";import{f as O}from"./format-ybceeo2k.js";import"./en-US-CGO0aXMi.js";const $={border_color:"#FF6300",background_color:"#181A1B",title_color:"#FFFFFF",accent_color:"#FF6300",font_family:"Inter",font_weight:"700",logo_url:null};function G(){const{orgSlug:c}=P(),[i]=L(),p=i.get("ref")||i.get("batch")||"",d=i.get("code")||"",[S,m]=o.useState(!0),[f,x]=o.useState(""),[r,N]=o.useState(null),[n,v]=o.useState(null),[w,C]=o.useState(null),[l,k]=o.useState(null),[a,F]=o.useState(null),[g,T]=o.useState(null),[E,u]=o.useState(!1);o.useEffect(()=>{if(!c||!p&&!d){x("Missing coupon reference"),m(!1);return}(async()=>{try{const{data:s,error:y}=await R.functions.invoke("sponsor-coupon-check",{body:{ref:p,code:d,org_slug:c}});if(y)throw y;s!=null&&s.error?x(s.error):(N(s.batch),v(s.sponsor),C(s.template),k(s.organization),F(s.display_code||null),T(s.rider_name||null))}catch(s){x((s==null?void 0:s.message)||"Failed to load coupon")}finally{m(!1)}})()},[c,p,d]);const t=w||$,{url:z}=b(t.logo_url,l==null?void 0:l.id),{url:W}=b(n==null?void 0:n.logo_url,l==null?void 0:l.id),H=async()=>{if(a)try{await navigator.clipboard.writeText(a),u(!0),_.success("Code copied"),setTimeout(()=>u(!1),1500)}catch{_.error("Copy failed")}};if(S)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-black",children:e.jsx(M,{className:"h-10 w-10 animate-spin text-white"})});if(f||!r||!n)return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-black",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-red-400 text-lg font-semibold",children:f||"Coupon not found"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Check the link and try again."})]})});const B=12,h=z||W;return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-black",children:e.jsxs("div",{className:"w-full max-w-md 
1space-y-4",children:[e.jsxs("div",{className:"mx-auto",style:{border:`${B}px solid ${t.border_color}`,backgroundColor:t.background_color,fontFamily:t.font_family},children:[h&&e.jsx("div",{className:"flex items-center justify-center",style:{minHeight:90},children:e.jsx("img",{src:h,alt:n.name,style:{width:"100%",maxHeight:130,objectFit:"contain",display:"block"}})}),r.title&&e.jsx("div",{className:"text-center",style:{padding:"16px 20px 0"},children:e.jsx("p",{style:{color:t.accent_color,fontWeight:800,fontSize:16,textTransform:"uppercase",letterSpacing:"0.12em",margin:0},children:r.title})}),e.jsxs("div",{className:"text-center",style:{padding:r.title?"4px 20px 4px":"16px 20px 4px"},children:[e.jsx("p",{style:{color:t.title_color,fontWeight:Number(t.font_weight),fontSize:22,lineHeight:1.15,textTransform:"uppercase",letterSpacing:"0.03em",margin:0},children:n.name}),r.subtitle&&e.jsx("p",{style:{color:t.title_color,opacity:.8,fontWeight:500,fontSize:13,marginTop:4,lineHeight:1.3},children:r.subtitle})]}),e.jsx("div",{className:"text-center",style:{padding:"8px 0 4px"},children:e.jsx("p",{style:{color:t.title_color,fontWeight:900,fontSize:48,lineHeight:1,textTransform:"uppercase",letterSpacing:"-0.01em",fontStyle:"italic",margin:0},children:r.discount_label})}),r.name&&e.jsx("div",{className:"text-center",style:{padding:"4px 16px 8px"},children:e.jsx("p",{style:{color:t.title_color,fontWeight:Number(t.font_weight),fontSize:14,textTransform:"uppercase",letterSpacing:"0.04em",opacity:.85,margin:0},children:r.name})}),g&&e.jsx("div",{className:"text-center",style:{padding:"4px 16px 12px"},children:e.jsx("p",{style:{color:t.title_color,fontWeight:700,fontSize:18,textTransform:"uppercase",letterSpacing:"0.03em",margin:0},children:g.toUpperCase()})}),a&&e.jsx("div",{className:"text-center",style:{padding:"12px 16px"},children:e.jsxs("div",{style:{border:`2px dashed ${t.accent_color}`,padding:"14px 12px",background:"rgba(255,255,255,0.04)"},children:[e.jsx("p",{style:{fontSize:12,color:t.accent_color,letterSpacing:"0.1em",margin:0,opacity:.85},children:"YOUR CODE"}),e.jsx("p",{style:{fontFamily:"monospace, sans-serif",fontWeight:800,fontSize:30,color:t.title_color,letterSpacing:"0.1em",margin:"4px 0 0",wordBreak:"break-all"},children:a})]})}),r.instructions&&e.jsx("div",{className:"text-center",style:{padding:"0 16px 8px"},children:e.jsx("p",{style:{fontSize:13,color:t.title_color,opacity:.75,margin:0,lineHeight:1.4},children:r.instructions})}),r.expires_at&&e.jsx("div",{className:"text-center",style:{padding:"4px 0 16px"},children:e.jsxs("p",{style:{fontSize:12,color:t.title_color,textTransform:"uppercase",letterSpacing:"0.04em",opacity:.6,margin:0},children:["EXPIRES ",O(new Date(r.expires_at),"MMM d, yyyy").toUpperCase()]})}),r.fine_print&&e.jsx("div",{style:{padding:"0 16px 16px"},children:e.jsx("p",{style:{fontSize:10,color:t.title_color,opacity:.55,margin:0,lineHeight:1.4,whiteSpace:"pre-wrap",textAlign:"center"},children:r.fine_print})})]}),e.jsxs("div",{className:"flex gap-2",children:[a&&e.jsxs(j,{onClick:H,variant:"secondary",className:"flex-1",children:[E?e.jsx(U,{className:"h-4 w-4 mr-1"}):e.jsx(D,{className:"h-4 w-4 mr-1"}),"Copy code"]}),r.redemption_url&&e.jsx(j,{asChild:!0,className:"flex-1",style:{background:t.accent_color,color:t.title_color,borderColor:t.accent_color},children:e.jsxs("a",{href:r.redemption_url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(I,{className:"h-4 w-4 mr-1"})," Redeem"]})})]}),n.redemption_notes&&e.jsx("p",{className:"text-xs text-gray-400 text-center px-4",children:n.redemption_notes}),e.jsxs("p",{className:"text-[11px] text-gray-600 text-center",children:["Powered by ",(l==null?void 0:l.name)||"Beyond Pro"]})]})})}export{G 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.