import{_ as Q}from"./aI4NvhkC.js";import{_ as ne}from"./oP2fzkqx.js";import{_ as se}from"./CEvmN03D.js";import{d as $,f as S,c as B,Y as s,y as l,R as t,u as e,M as h,k as W,Q as _,$ as y,ac as ae,T as x,am as ie,an as re,L as A,S as E,I as Y,X as le,x as N,P as z,a2 as ce,r as de,aj as H}from"./BoWSoj4c.js";import{u as ue,a as pe,m as U}from"./CxpsvcM2.js";import{aR as me,aY as _e,aG as L,aC as ge,ay as q,bJ as G,cB as fe,cj as ye,aE as be}from"./D5Rz2KmZ.js";import{u as P,a as he,b as ve,c as xe,_ as $e}from"./BTFdQ7bd.js";import{_ as ke}from"./DCyA4Sjg.js";import{_ as we}from"./B5gSWGKU.js";import{_ as K}from"./BUO8qaBy.js";import{u as M,a as J}from"./HGLLIpkB.js";import{c as F}from"./4RmFyoJL.js";import{u as T}from"./D6-uZREs.js";import{u as R}from"./Bkix0rp2.js";import{u as Ce,a as Se}from"./C1XwZ01m.js";import{u as De}from"./CHZseQkk.js";import{a as Fe,_ as Ue}from"./DrGKr2KC.js";import{_ as Pe}from"./Bd3li9Nf.js";import{u as Te}from"./BzPY7lG0.js";import"./D_hGXbOv.js";import"./C_VZHTei.js";import"./B3uelOco.js";import"./Dwxp35aF.js";import"./tCf5XJlr.js";import"./Dm8O0bLR.js";import"./CvG_UoF8.js";import"./Bq4-2NHv.js";import"./LEKzWO5M.js";import"./CD-uQ0BS.js";import"./DQir6R2M.js";import"./DV5lwqkg.js";import"./D4OfjQtU.js";import"./C7BerK5r.js";import"./C5vImn2K.js";import"./bqcbekNM.js";import"./pR9PTi6U.js";import"./6YPd8DGQ.js";import"./BtgdZhnv.js";import"./COeRlyFk.js";import"./Cfu1b8qy.js";import"./BSJ09YHY.js";import"./Dix3b8nq.js";import"./BmwgLZbF.js";import"./ByfZxU2r.js";import"./YXM2pwVB.js";(function(){try{var g=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new g.Error().stack;n&&(g._sentryDebugIds=g._sentryDebugIds||{},g._sentryDebugIds[n]="fa9fdd01-fcfc-406f-bdf0-77c66decaa17",g._sentryDebugIdIdentifier="sentry-dbid-fa9fdd01-fcfc-406f-bdf0-77c66decaa17")}catch{}})();const Ie={class:"donor-login"},Be=t("div",{class:"donor-login__title"},[t("h2",{class:"text-2xl font-bold"},"Sign in")],-1),Me={class:"w-full mt-6"},Ve={key:1,class:"rounded-md bg-green-50 p-4"},Ae={class:"flex"},Ee={class:"flex-shrink-0"},Le={class:"ml-3"},ze=t("h3",{class:"text-base font-medium text-green-800"}," Verify your inbox. ",-1),Re=t("div",{class:"mt-2 text-base text-green-700"},[t("p",null,"We just sent you an e-mail with a sign in code.")],-1),Oe={class:"mt-4"},je={class:"-mx-2 -my-1.5 flex"},We={key:3,class:"rounded-md bg-red-100 p-4 mt-4"},He={class:"flex"},Qe={class:"ml-3 flex-1 md:flex md:justify-between"},Ye={class:"text-sm text-slate-800"},Ne=$({__name:"Login",setup(g){const{mutate:n,isPending:d}=ue(),{mutate:o,isPending:c}=pe(),r=S(()=>d.value||c.value),i=B("email"),u=B(""),a=B(""),p=B(""),b=S(()=>i.value==="email"?"Sign in":"Verify"),m=()=>{i.value==="email"?v():k()};function v(){n({email:u.value},{onSuccess(){i.value="token"},onError(C){var w;if(C instanceof me){const f=(w=C.response)==null?void 0:w._data.message;typeof f=="string"&&(p.value=f,f.includes("Code already sent")&&i.value=="email"&&(i.value="token"))}}})}function k(){o({email:u.value,code:a.value},{onError(){p.value="Invalid code"}})}return(C,w)=>{const f=ne,D=Q,V=se;return s(),l("div",Ie,[Be,t("div",Me,[e(i)=="email"?(s(),h(f,{key:0,class:"top-rounded",modelValue:e(u),"onUpdate:modelValue":w[0]||(w[0]=I=>W(u)?u.value=I:null),disabled:e(r),placeholder:"Email Address",icon:"/images/icons/at-symbol.svg"},null,8,["modelValue","disabled"])):_("",!0),e(i)=="token"?(s(),l("div",Ve,[t("div",Ae,[t("div",Ee,[y(D,{class:"h-8 w-8 text-green-700",name:"heroicons-outline:check-badge"})]),t("div",Le,[ze,Re,t("div",Oe,[t("div",je,[y(V,{onClick:v,"is-loading":e(r),class:"bg-white",label:"Re-send code"},null,8,["is-loading"])])])])])])):_("",!0),e(i)=="token"?(s(),h(f,{key:2,class:"top-rounded",modelValue:e(a),"onUpdate:modelValue":w[1]||(w[1]=I=>W(a)?a.value=I:null),disabled:e(r),placeholder:"Verification code",onKeydown:ae(k,["enter"])},null,8,["modelValue","disabled"])):_("",!0),e(p)?(s(),l("div",We,[t("div",He,[t("div",Qe,[t("p",Ye,x(e(p)),1)])])])):_("",!0),y(V,{onClick:m,"is-loading":e(r),class:"w-full mt-4",label:e(b)},null,8,["is-loading","label"])])])}}}),qe=_e("/images/welcoming.svg"),X=g=>(ie("data-v-d96180ca"),g=g(),re(),g),Ge={class:"welcome-section"},Ke=X(()=>t("img",{class:"w-full max-w-[200px] md:max-w-[250px] mx-auto h-auto",src:qe,alt:"Welcome Image"},null,-1)),Je=X(()=>t("div",{class:"text-center flex flex-col gap-1 mt-5"},[t("p",{class:"font-bold text-lg md:text-xl"}," Welcome to your Profile Settings! "),t("p",null," Here you can check all about your billing info, plans and profile details! ")],-1)),Xe=$({__name:"Welcome",setup(g){const n=P();return(d,o)=>(s(),l("div",Ge,[Ke,Je,t("button",{type:"button",class:"w-full text-lg md:text-xl py-2 text-center font-bold bg-brand-blue rounded-lg text-white mt-5 md:mt-8 outline-none",onClick:o[0]||(o[0]=c=>e(n).$patch({isDonorFirstTime:!1}))}," Check now! ")]))}}),Ze=ke(Xe,[["__scopeId","data-v-d96180ca"]]),et={"aria-labelledby":"plan-heading"},tt={class:"sm:overflow-hidden sm:rounded-md"},ot={class:"space-y-2 mb-4 bg-white"},nt=t("div",null,[t("h2",{id:"plan-heading",class:"text-lg font-medium leading-6 text-gray-900"}," Your plan ")],-1),st=t("div",{class:"h-4 w-4 bg-orange-500 rounded-full grid place-content-center"},[t("div",{class:"h-1.5 w-1.5 bg-white rounded-full"})],-1),at={class:"capitalize ml-3 text-gray-900 font-bold text-sm"},it={class:"font-bold m-auto pl-1 text-sm md:pl-0 md:text-center"},rt={class:"text-orange-900"},lt={key:0,class:"font-normal text-xs ml-2"},ct={key:0},dt={key:1},ut={key:2},pt={key:0,class:"flex flex-col gap-2 my-2"},mt=["disabled"],_t=["disabled"],gt={key:0},ft=$({__name:"Subscription",setup(g){const n=P(),d=M(),{data:o}=T({...U.subscription(()=>d.value.id),enabled:R(()=>d.value.id),select:a=>({total:(a.donation+a.tip+a.ddcFee+a.stripeFee)/100,amount:a.donation/100,tip:a.tip/100,stripeFee:a.stripeFee/100,ddcFee:a.ddcFee/100,status:a.status})}),c=S(()=>{if(!o.value)return"none";if(o.value.status==="canceled")return"Canceled";switch(o.value.amount){case 1:return"monthly";case 4:return"weekly";case 30:return"daily";default:return"custom"}}),{mutate:r,isPending:i}=Ce(),u=async()=>{r(d.value.id,{onError:()=>L().error("There was an error canceling your subscription. Please try again.")})};return(a,p)=>{var m;const b=K;return s(),l("section",et,[t("div",null,[t("div",tt,[t("div",ot,[nt,t("div",{class:A(["mb-4 flex items-center w-full border-2 p-4 rounded-md",{"bg-gray-50 border-gray-200":e(o)&&e(o).amount===0,"bg-orange-50 border-orange-200":e(o)&&e(o).amount>0}])},[st,t("div",at,x(e(c)),1),t("div",it,[t("span",rt,x(("currencyFormatter"in a?a.currencyFormatter:e(F))(((m=e(o))==null?void 0:m.total)??0,2))+" / mo ",1),e(o)?(s(),l("span",lt,[E(" ("+x(("currencyFormatter"in a?a.currencyFormatter:e(F))(e(o).amount,2))+" donation ",1),e(o).tip>0?(s(),l("span",ct," + "+x(("currencyFormatter"in a?a.currencyFormatter:e(F))(e(o).tip,2))+" tip",1)):_("",!0),e(o).ddcFee>0?(s(),l("span",dt," + "+x(("currencyFormatter"in a?a.currencyFormatter:e(F))(e(o).ddcFee,2))+" platform fee",1)):_("",!0),e(o).stripeFee>0?(s(),l("span",ut," + "+x(("currencyFormatter"in a?a.currencyFormatter:e(F))(e(o).stripeFee,2))+" transaction fee",1)):_("",!0),E(") ")])):_("",!0)])],2)]),e(o)?(s(),l("div",pt,[e(o)&&e(o).status!=="canceled"?(s(),l("button",{key:0,disabled:e(i),onClick:p[0]||(p[0]=v=>e(n).$patch({currentPage:"updateSubcription"})),class:A(["py-3 border-2 border-gray-800 w-full rounded-md",{"bg-gray-50 text-gray-500 cursor-not-allowed":e(i)}])}," Change plan ",10,mt)):_("",!0),e(o)&&e(o).status!=="canceled"?(s(),l("button",{key:1,disabled:e(i),onClick:u,class:A(["py-3 border-2 border-gray-800 w-full rounded-md",{"bg-gray-50 text-gray-500 cursor-not-allowed":e(i)}])},[e(i)?(s(),h(b,{key:1,size:"20px","background-color":"bg-brand-blue"})):(s(),l("span",gt,"Cancel plan"))],10,_t)):_("",!0)])):_("",!0)])])])}}}),yt={"aria-labelledby":"billing-history-heading"},bt={class:"bg-white pt-6 sm:overflow-hidden sm:rounded-md"},ht=t("div",{class:"px-4 sm:px-6"},[t("h2",{id:"billing-history-heading",class:"text-lg font-medium leading-6 text-gray-900"}," Billing history ")],-1),vt={class:"mt-6 flex flex-col"},xt={class:"-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"},$t={class:"inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"},kt={class:"overflow-hidden border-gray-200"},wt={class:"min-w-full divide-y divide-gray-200 border-gray-200 border"},Ct=t("thead",{class:"bg-gray-50"},[t("tr",null,[t("th",{scope:"col",class:"px-3 py-3 text-left text-sm font-semibold text-gray-900"}," Date "),t("th",{scope:"col",class:"px-3 py-3 text-left text-sm font-semibold text-gray-900"}," Amount "),t("th",{scope:"col",class:"px-3 py-3 text-left text-sm font-semibold text-gray-900"})])],-1),St={class:"divide-y divide-gray-200 bg-white"},Dt={class:"whitespace-nowrap px-3 py-4 text-xs sm:text-sm font-medium text-gray-900"},Ft=["datetime"],Ut={class:"whitespace-nowrap px-3 py-4 text-xs sm:text-sm text-gray-500"},Pt={key:0,class:"whitespace-nowrap px-3 py-4 text-xs sm:text-sm text-gray-500"},Tt=["href"],Z=$({__name:"Table",props:{donations:{}},setup(g){return(n,d)=>(s(),l("section",yt,[t("div",bt,[ht,t("div",vt,[t("div",xt,[t("div",$t,[t("div",kt,[t("table",wt,[Ct,t("tbody",St,[(s(!0),l(Y,null,le(n.donations,o=>(s(),l("tr",{key:o.id},[t("td",Dt,[t("time",{datetime:o.createdAt},x(e(ge)(o.createdAt).format("MMM D[,] YYYY ha")),9,Ft)]),t("td",Ut,x(("currencyFormatter"in n?n.currencyFormatter:e(F))(o.amount/100,2)),1),o.receiptUrl?(s(),l("td",Pt,[t("a",{href:o.receiptUrl,target:"_blank",class:"text-blue-600 hover:text-blue-500 hover:underline"}," Receipt ",8,Tt)])):_("",!0)]))),128))])])])])])])])]))}}),It=$({__name:"DDC",setup(g){const n=M(),{data:d,refetch:o}=T({...U.donations(()=>n.value.id),select:c=>c.map(({id:r,amount:i,receiptId:u,createdAt:a})=>{var p;return{id:r,amount:i,...((p=n.value)==null?void 0:p.isApprovedCharity)&&{receiptUrl:`${q().public.taxReceiptAppUrl}/circle/ddc/${u}`},createdAt:a}})});return N(()=>o()),(c,r)=>{const i=Z;return s(),h(i,{donations:e(d)??[]},null,8,["donations"])}}}),Bt=$({__name:"index",setup(g){const n=M(),{data:d,refetch:o}=T({...U.donations(()=>n.value.id),select:c=>c.map(({id:r,amount:i,receiptId:u,createdAt:a})=>{var p;return{id:r,amount:i,...((p=n.value)==null?void 0:p.isApprovedCharity)&&{receiptUrl:`${q().public.taxReceiptAppUrl}/circle/${u}`},createdAt:a}})});return N(()=>o()),(c,r)=>{const i=Z;return s(),h(i,{donations:e(d)??[]},null,8,["donations"])}}}),Mt={class:"profile"},Vt={class:""},At={class:"text-2xl font-bold"},Et={key:1},Lt={class:"flex justify-center my-10"},zt=$({__name:"Profile",setup(g){const{data:n,refetch:d}=T(G.self()),o=P(),c=De();return(r,i)=>{var v;const u=Ze,a=we,p=ft,b=It,m=Bt;return s(),l("div",Mt,[t("div",Vt,[t("h2",At,"Hi, "+x((v=e(n))==null?void 0:v.name)+" 👏",1)]),y(ce,{appear:"",mode:"out-in","enter-active-class":"duration-300 ease-out","enter-from-class":"opacity-0 transform translate-x-[30px]","enter-to-class":"opacity-100","leave-active-class":"duration-200 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0 transform -translate-x-[30px]"},{default:z(()=>{var k;return[e(o).isDonorFirstTime?(s(),h(u,{key:0})):(s(),l("div",Et,[t("section",Lt,[y(a,{class:"rounded-full h-24 !w-24","upload-path":"/donor/auth/avatar","aspect-ratio":1,"model-value":(k=e(n))==null?void 0:k.avatarUrl,"onUpdate:modelValue":i[0]||(i[0]=C=>e(d)())},null,8,["model-value"])]),y(p),e(c)?(s(),h(b,{key:0})):(s(),h(m,{key:1}))]))]}),_:1})])}}}),Rt={class:"mb-2 relative"},Ot={key:0,class:"text-xl font-bold"},jt={key:1,class:"text-xl font-bold"},Wt={key:0},Ht={key:1},Qt={class:"mt-4 p-2"},Yt=t("p",{class:"font-bold text-lg md:text-xl"},"Tip Dollar Donation Club",-1),Nt=t("p",{class:"text-sm md:text-base mb-4"}," We have a 0% fee on donations, but tips get our flying pig stoked! ",-1),qt={class:"block text-base text-black tex-center whitespace-nowrap"},Gt={key:2},Kt={key:1,class:"flex justify-center my-4"},Jt=$({__name:"UpdateSubscriptionFlow",setup(g){const n=B("plan"),d=J(),o=P(),c=M(),{data:r}=T({...U.subscription(()=>c.value.id),enabled:R(()=>c.value.id)}),{mutate:i,isPending:u}=Se(),a=S(()=>{var f;return((f=r.value)==null?void 0:f.status)==="canceled"}),p=S(()=>r.value?r.value.donation:4),b=S(()=>r.value?r.value.type==="ddcSubscription"?r.value.tip/p.value:r.value.tip/100:0),m=de({amount:p.value,tipPercentage:b.value>15?b.value:15}),v=S(()=>{var f;return((f=d.currentOrganization)==null?void 0:f.businessModel)==="tipping"}),k=f=>{m.amount=f*100,v.value?(console.log("amount",f),n.value="tip"):n.value="summary"},C=async()=>{i({organizationId:c.value.id,donation:m.amount/100,tip:m.amount*(m.tipPercentage/100)/100},{onSuccess:()=>{L().success("Subscription updated"),n.value="plan"},onError:f=>{L().error("Error updating subscription"),console.log("error updating",f)}})},w=()=>{n.value==="tip"?n.value="plan":n.value==="summary"?v.value?n.value="tip":n.value="plan":o.$patch({currentPage:"profile"})};return(f,D)=>{const V=he,I=ve,ee=xe,O=Fe,te=Ue,oe=K;return s(),l("div",null,[t("div",Rt,[y(V,{onClick:w,class:"absolute"}),e(u)?_("",!0):(s(),l("h2",Ot,"Update subscription")),e(u)?(s(),l("h2",jt," Saving your subscription ")):_("",!0)]),e(u)?_("",!0):(s(),l("div",Wt,[e(n)==="plan"?(s(),h(I,{key:0,"button-label":"Continue","initial-amount":Math.round(e(p)/100),onAdvanceCheckout:k},null,8,["initial-amount"])):_("",!0),e(n)==="tip"?(s(),l("div",Ht,[t("div",Qt,[Yt,Nt,y(ee,{class:"mt-2 p-2",modelValue:e(m).tipPercentage,"onUpdate:modelValue":D[0]||(D[0]=j=>e(m).tipPercentage=j),min:0,max:40,step:5,"range-text":["0%","40%"],"show-value":""},{default:z(()=>[t("p",qt,[t("b",null,x((e(m).amount/100*(e(m).tipPercentage/100)).toFixed(2))+"$",1),E(" ("+x(e(m).tipPercentage)+"%) ",1)])]),_:1},8,["modelValue"])]),y(O,{label:"Next",onClick:D[1]||(D[1]=j=>n.value="summary")})])):_("",!0),e(n)==="summary"?(s(),l("div",Gt,[y(te,{class:"mt-8",donation:e(m).amount/100,"tip-percentage":e(m).tipPercentage},null,8,["donation","tip-percentage"]),y(O,{class:"mt-4",label:e(a)?"Next":"Save",onClick:C},null,8,["label"])])):_("",!0)])),e(u)?(s(),l("div",Kt,[y(oe,{"background-color":"bg-brand-blue"})])):_("",!0)])}}}),Xt={key:1},Zt=$({__name:"Template",props:{isOpen:{type:Boolean,default:!0}},setup(g){const{data:n}=T(G.self()),d=P(),o=g;return(c,r)=>{const i=Q,u=Ne,a=zt,p=Jt,b=Pe;return s(),h(b,{onCloseModal:r[1]||(r[1]=m=>c.$emit("close")),"is-open":o.isOpen},{default:z(()=>[t("button",{class:"absolute top-0 right-0 m-2.5",onClick:r[0]||(r[0]=m=>c.$emit("close"))},[y(i,{class:"h-6 w-6 text-gray-500 hover:text-black transition-colors duration-150 ease-in-out",name:"heroicons:x-mark"})]),e(n)?(s(),l("div",Xt,[e(d).currentPage==="profile"?(s(),h(a,{key:0})):_("",!0),e(d).currentPage==="updateSubcription"?(s(),h(p,{key:1})):_("",!0)])):(s(),h(u,{key:0}))]),_:1},8,["is-open"])}}}),Yo=$({__name:"OldCirclePage",async setup(g){let n,d;const o=fe(),c=J(),r=P();if(!([n,d]=H(()=>c.loadFromUrl(o.value)),n=await n,d(),n))throw ye({statusCode:404,statusMessage:"Couldn't find the page"});const u=M(),a=be();R(()=>u.value.id).value&&([n,d]=H(()=>Promise.all([a.prefetchQuery(U.subscription(u.value.id)),a.prefetchQuery(U.donations(u.value.id))])),await n,d());const b=S(()=>c.pageContent.title?c.pageContent.title.replace(/<[^>]*>?/gm,"")+" | Giving Circle":"Giving Circle");return Te({script:[{src:"https://js.stripe.com/v3/",defer:!0}],title:b,meta:[{hid:"og:title",name:"og:title",property:"og:title",content:b.value},...c.pageStyle.ogTags.description?[{hid:"og:description",name:"og:description",property:"og:description",content:c.pageStyle.ogTags.description}]:[],...c.pageStyle.ogTags.image?[{hid:"og:image",name:"og:image",property:"og:image",content:c.pageStyle.ogTags.image}]:[]]}),(m,v)=>{const k=Zt,C=$e;return s(),l(Y,null,[y(k,{onClose:v[0]||(v[0]=()=>e(r).$patch({isOpen:!1})),"is-open":e(r).isOpen},null,8,["is-open"]),y(C)],64)}}});export{Yo as default};
//# sourceMappingURL=CLFFN27_.js.map
