PageSourceSearch

https://capetownculinarytours.com/assets/ReferralLanding-BZsK0wh6.js

js capetownculinarytours.com collected 2026-10-03 00:36:53 UTC 1,922 bytes, 1 lines download raw bytes

1import{j as r}from"./ui-wHuRdSZa.js";import{i as u,j as p,e as g,r as f}from"./vendor-DF7Vsqu4.js";import{L as d,K as x,Q as h}from"./index-DIDqu_8B.js";import"./charts-BAVYBguD.js";import"./query-DKV4sgHL.js";import"./supabase-Cgbt6YLr.js";import"./motion-Clpufeat.js";function N(){const{code:o}=u(),[n]=p(),a=g(),[i,l]=f.useState(null);return f.useEffect(()=>{if(!o){a("/tours",{replace:!0});return}(async()=>{try{const{data:e,error:c}=await h.functions.invoke("resolve-referral",{body:{code:o}});if(c||e?.error){l(e?.error||c?.message||"Invalid referral link");return}sessionStorage.setItem("referral_company_id",e.companyId),sessionStorage.setItem("referral_code",e.referralCode),sessionStorage.setItem("referral_company_name",e.companyName),e.allowedProducts?sessionStorage.setItem("referral_allowed_products",JSON.stringify(e.allowedProducts)):sessionStorage.removeItem("referral_allowed_products");const t=n.get("promo"),m=n.get("product");if(t&&sessionStorage.setItem("referral_promo",t),m){const s=new URLSearchParams;s.set("ref",e.referralCode),t&&s.set("promo",t),a(`/book/${m}?${s.toString()}`,{replace:!0})}else{const s=new URLSearchParams;s.set("ref",e.referralCode),t&&s.set("promo",t),a(`/tours?${s.toString()}`,{replace:!0})}}catch{l("Something went wrong. Please try again.")}})()}
1,[o,n,a]),i?r.jsx(d,{children:r.jsxs("div",{className:"flex min-h-[60vh] flex-col items-center justify-center bg-background px-4 text-center",children:[r.jsx("h1",{className:"mb-4 font-display text-3xl font-bold text-foreground",children:"Invalid Referral Link"}),r.jsx("p",{className:"mb-6 text-muted-foreground",children:i}),r.jsx("a",{href:"/tours",className:"text-primary underline",children:"Browse our tours"})]})}):r.jsx(d,{children:r.jsx("div",{className:"flex min-h-[60vh] items-center justify-center bg-primary",children:r.jsx("img",{src:x,alt:"Loading",className:"h-14 animate-pulse"})})})}export{N 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.