PageSourceSearch

https://doghealthy.netlify.app/_nuxt/B03-yuPs.js

js doghealthy.netlify.app collected 2026-10-03 10:41:10 UTC 8,230 bytes, 1 lines download raw bytes

1import{f as I,r as f,H as F,D as Q,u as O,q as g,h as z,c as n,a,b as K,w as W,j as s,i as h,t as y,A as R,y as j,d as x,e as G,N as J,o as i}from"#entry";import{u as X}from"./Dy9pVEbO.js";import{u as Z,w as k}from"./Z8EQgydt.js";import"./DKLWY9DJ.js";const ee={class:"min-h-screen bg-gray-50"},te={class:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-10"},se={class:"mb-8"},oe={class:"bg-white rounded-2xl shadow-lg p-8"},ae={class:"text-gray-600 mb-4"},re={key:0,class:"text-sm text-amber-800 bg-amber-50 border border-amber-200 rounded-lg px-4 py-3 mb-6"},ne={key:1,class:"text-gray-600 mb-6"},ie={key:2,class:"mb-6 rounded-md bg-blue-50 border border-blue-200 px-4 py-3 text-sm text-blue-900"},le={key:3,class:"mb-4 rounded-md bg-red-50 border border-red-200 px-4 py-3 text-sm text-red-700"},ce={key:4,class:"mb-6 text-gray-600"},ue={class:"grid md:grid-cols-2 gap-6 mb-8"},de={class:"border border-gray-200 rounded-xl p-6 flex flex-col"},pe=["disabled"],ye={class:"border border-blue-200 rounded-xl p-6 bg-blue-50/40 flex flex-col"},be=["disabled"],me={key:0},ge={class:"text-xs text-gray-500"},he={key:0},xe={key:1},Ce=I({__name:"subscribe",setup(fe){X({title:"Subscribe to DogHealthy — Monthly or Yearly Plans",description:"Upgrade to DogHealthy Subscriber for unlimited dogs and health records, plus NFC / QR pet tags with found-dog SMS alerts. Choose monthly (£6.50) or yearly (£70) UK plans.",keywords:"DogHealthy subscription, dog health app pricing UK, NFC dog tag subscription, unlimited dog records, DogHealthy monthly yearly",path:"/billing/subscribe",index:!1});const b=f(!1),d=f(!1),c=f(""),r=f(""),C=F(),l=Q(),S=J(),q=O(),{freeLimit:v,markSubscribed:D,checkSubscription:M,resourceLabel:B,peekPendingAction:P,consumePendingAction:$,saveCheckoutContext:L,readCheckoutContext:T,clearCheckoutContext:U}=Z(),Y=g(()=>({monthly:String(S.public.stripePaymentLinkMonthly||"").trim(),yearly:String(S.public.stripePaymentLinkYearly||"").trim()})),m=g(()=>{const t=l.query.next;return typeof t=="string"&&t.startsWith("/")?t:""}),H=g(()=>m.value||"/dogs"),A=g(()=>m.value?"Back":"Back to My Dogs"),E=g(()=>{const t=l.query.reason;if(!t)return"";if(t==="nfc-tag")return"NFC / QR tags are included with a DogHealthy subscription. Choose a plan below, then we’ll create your tag and QR code.";const e=B(t);return`You've reached the free limit of ${v} ${e}. Subscribe to add more.`}),w=async()=>{const{data:t}=await q.auth.getSession();return t.session?.access_token||null},_=async()=>{D();const t=T(),e=P()||t.pending||null;let o="/dogs";if(e?.action==="createTag"&&e.petId)$(),o=`/dogs/${e.petId}?createTag=1&subscription=success`;else{const p=m.value||t.next||"";p&&(p.includes("createTag=")?o=k(p,{subscription:"success",createTag:"1"}):p.includes("/dogs/new")?o=k(p,{subscription:"success"}):o=k(p,{add:"1",subscription:"success"}))}if(U(),!await w()){typeof window<"u"&&sessionStorage.setItem("doghealthy_post_login_redirect",o),await C.replace({path:"/auth/login",query:{redirect:o}});return}await C.replace(o)},V=async t=>{d.value=!0,c.value="";try{const e=await w(),o={};e&&(o.Authorization=`Bearer ${e}`),await $fetch("/.netlify/functions/confirm-subscription",{method:"POST",headers:o,body:{sessionId:t}}),await _()}catch(e){console.error("confirm subscription:",e),c.value=e?.data?.error||e?.message||"Payment may have succeeded, but we could not activate your subscription. Please refresh or contact support."}finally{d.value=!1}};z(async()=>{try{const e=await $fetch("/.netlify/functions/stripe-mode");r.value=e?.mode||""}catch{r.value=""}if(l.query.subscription==="cancelled"){c.value="Checkout was cancelled. You can choose a plan when you are ready.";return}const t=l.query.session_id;if(l.query.subscription==="success"&&typeof t=="string"&&t.startsWith("cs_")){await V(t);return}if(l.query.subscription==="success"){await _();return}await M()&&await _()});const N=async t=>{try{b.value=!0,c.value="";const e=await w();if(!e)throw new Error("Please sign in again to subscribe.");try{const o=await $fetch("/.netlify/functions/create-subscription-checkout",{method:"POST",headers:{Authorization:`Bearer ${e}`},body:{plan:t,next:m.value||void 0}});if(o?.mode&&(r.value=o.mode),o?.url){L({next:m.value||T().next||"",pending:P(),reason:typeof l.query.reason=="str
1ing"?l.query.reason:void 0}),window.location.href=o.url;return}}catch(o){const u=Y.value[t];if(u&&!u.includes("YOUR_")&&u.includes("test")){window.location.href=u;return}throw o}throw new Error("Could not start Stripe Checkout. Check STRIPE_SECRET_KEY on Netlify.")}catch(e){console.error("Error starting subscription:",e),c.value=e?.data?.error||e?.message||"Unable to start subscription. Please try again.",b.value=!1}};return(t,e)=>{const o=G;return i(),n("div",ee,[a("div",te,[a("div",se,[K(o,{to:s(H),class:"inline-flex items-center text-sm text-gray-600 hover:text-gray-900"},{default:W(()=>[e[2]||(e[2]=a("span",{class:"mr-1"},"←",-1)),x(" "+y(s(A)),1)]),_:1},8,["to"])]),a("div",oe,[e[8]||(e[8]=a("h1",{class:"text-3xl font-bold text-gray-900 mb-4"},"Upgrade to DogHealthy Subscriber",-1)),a("p",ae," Free accounts include up to "+y(s(v))+" dogs and up to "+y(s(v))+" of each record type (medications, vaccinations, appointments, health records, and vets). ",1),s(E)?(i(),n("p",re,y(s(E)),1)):(i(),n("p",ne," Subscribe for unlimited pets and records across your DogHealthy account. ")),s(d)?(i(),n("div",ie," Confirming your payment… ")):h("",!0),s(c)?(i(),n("div",le,y(s(c)),1)):h("",!0),s(b)&&!s(d)?(i(),n("div",ce," Redirecting you to Stripe checkout... ")):h("",!0),a("div",ue,[a("div",de,[e[3]||(e[3]=R('<h2 class="text-xl font-semibold text-gray-900 mb-2">Monthly Plan</h2><p class="text-gray-600 mb-4">Perfect if you want flexibility with monthly billing.</p><div class="text-3xl font-bold text-gray-900 mb-1">£6.50<span class="text-base font-normal text-gray-500"> / month</span></div><p class="text-xs text-gray-500 mb-4">Billed monthly. Cancel anytime.</p><ul class="space-y-2 text-sm text-gray-600 mb-6"><li>✓ Unlimited dogs</li><li>✓ Unlimited health records &amp; vaccinations</li><li>✓ Unlimited medications, appointments &amp; vets</li><li>✓ NFC / QR tags for lost-dog alerts</li></ul>',5)),a("button",{type:"button",class:"mt-auto w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2.5 px-4 rounded-lg transition-colors disabled:opacity-60 disabled:cursor-not-allowed",disabled:s(b)||s(d),onClick:e[0]||(e[0]=u=>N("monthly"))}," Choose Monthly ",8,pe)]),a("div",ye,[e[4]||(e[4]=R('<div class="inline-flex items-center px-3 py-1 rounded-full bg-blue-600 text-white text-xs font-semibold mb-3 w-max"> Best Value </div><h2 class="text-xl font-semibold text-gray-900 mb-2">Yearly Plan</h2><p class="text-gray-600 mb-4">Save more with a yearly subscription.</p><div class="text-3xl font-bold text-gray-900 mb-1">£70<span class="text-base font-normal text-gray-500"> / year</span></div><p class="text-xs text-gray-500 mb-4">Equivalent to less than £5.84 per month.</p><ul class="space-y-2 text-sm text-gray-600 mb-6"><li>✓ Everything in Monthly</li><li>✓ Best value for long‑term use</li><li>✓ Priority for new features</li></ul>',6)),a("button",{type:"button",class:"mt-auto w-full bg-blue-700 hover:bg-blue-800 text-white font-semibold py-2.5 px-4 rounded-lg transition-colors disabled:opacity-60 disabled:cursor-not-allowed",disabled:s(b)||s(d),onClick:e[1]||(e[1]=u=>N("yearly"))}," Choose Yearly ",8,be)])]),s(r)?(i(),n("p",{key:5,class:j(["text-xs mb-3",s(r)==="live"?"text-green-700":"text-amber-700"])},[e[5]||(e[5]=x(" Stripe: ",-1)),a("strong",null,y(s(r)==="live"?"Live payments":s(r)==="test"?"Test mode":s(r)),1),s(r)==="test"?(i(),n("span",me," — sandbox only; set STRIPE_MODE=live and sk_live_… keys for production.")):h("",!0)],2)):h("",!0),a("p",ge,[e[7]||(e[7]=x(" Payments are securely processed by Stripe Checkout. ",-1)),s(r)==="test"?(i(),n("span",he,[...e[6]||(e[6]=[x(" Test card ",-1),a("code",{class:"text-[11px]"},"4242 4242 4242 4242",-1),x(", any future expiry, any CVC. ",-1)])])):(i(),n("span",xe," You’ll be charged the plan amount after completing checkout. Cancel anytime from Stripe’s customer portal or support. "))])])])])}}});export{Ce 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.