1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ab20229-8f5b-49a4-b602-909f573219da",e._sentryDebugIdIdentifier="sentry-dbid-2ab20229-8f5b-49a4-b602-909f573219da")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1914],{30460:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/donations/[id]",function(){return r(69200)}])},69200:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSG:()=>q,default:()=>L});var s=r(14232),n=r(89099),i=r(18125),a=r(95044);let l=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}))}),o=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"}))});var d=r(61902),c=r(22427),u=r(22242),m=r(60241),h=r(31303),x=r(9361),p=r(2380),g=r(32008),f=r(56189),b=r(96370),y=r(17385),v=r(65083),j=r(69174),w=r(67579),_=r(66284),N=r(54587),C=r.n(N);let $=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))}),E=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))});var k=r(75625),S=r(13826);let P="Astaghfirullah! We could not process your request. Please contact support.",O={400:"This recurring donation can't be updated right now. Please review your details, or contact support if the problem continues.",404:"We couldn't find this recurring donation. Please refresh the page and try again."};var F=r(44591),A=r(86400),R=r(91869),D=r(91055),z=r(37876);function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach(function(t){(0,_.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let I=(0,s.forwardRef)(function(e,t){var r,n,i,l,o,c;let{handleOpenClose:h,initialFocusRef:x,isSubmitting:b,handleIsSubmit:y,chargeData:v,cardList:w,mutate:_}=e,{0:N,1:T}=(0,s.useState)("changeCard"),{0:I,1:B}=(0,s.useState)(""),W=(0,d.useStripe)(),q=(0,d.useElements)(),{0:L,1:G}=(0,s.useState)(!0),{0:V,1:U}=(0,s.useState)({cardNumber:null,expiry:null,cvc:null}),K=(null==w||null==(r=w.data)?void 0:r.find(e=>{var t;return e.id===(null==(t=v.subscription_data)?void 0:t.payment_method_id)}))||null,{0:H,1:Z}=(0,s.useState)((null==w||null==(n=w.data)?void 0:n.find(e=>{var t;return e.id===(null==(t=v.subscription_data)?void 0:t.payment_method_id)}))||null),{register:X,handleSubmit:J,errors:Q,formState:ee,watch:et}=(0,k.mN)({mode:"onChange"}),er=et("amount"),es=[{name:"Select a Country",code:"",dial_code:""}].concat(u.Ns),en=async e=>{try{var t,r,s,n,i;y(!0);let a=e.country&&e.address&&e.city&&e.zip,l=(null==H?void 0:H.id)!==(null==K?void 0:K.id);a&&(l=!1);let o=""!==e.amount&&e.amount!==(null==(t=v.subscription_data)?void 0:t.monthly_amount);if(!a&&!l&&!o)return void f.toast.error("Please make a change to update your subscription.");let c={};if(a){if(!W||!q){console.error("stripe or elements not loaded"),f.toast.error(P),y(!1),g.A.error("Error updating subscription - stripe or elements not loaded",{chargeId:v.charge_id});return}c=await W.createPaymentMethod({type:"card",card:q.getElement(d.CardNumberElement),billing_details:{name:null==v?void 0:v.customer_name,address:{line1:e.address,city:e.city,postal_code:e.zip,country:e.country}}}),await (0,S.Ku)(`${m.I}/cards/attach`,{payment_method_id:null==(i=c)||null==(i=i.paymentMethod)?void 0:i.id,customer_id:null==v?void 0:v.customer_id,account:null==v?void 0:v.account},"POST")}let u=`https://donordb.yaqeeninstitute.org/api/v1/subscriptions/${v.subscription_id}`,h=await (0,S.Ku)(u,Y(Y(Y(Y({},a&&{payment_method_id:null==(r=c)||null==(r=r.paymentMethod)?void 0:r.id}),l&&{payment_method_id:null==H?void 0:H.id}),o&&{amount:e.amount}),{},{account:v.account,platform:"stripe"}),"PATCH");if(200!==h.statusCode){let t;y(!1),(0,p.$s)("donor_portal_modify_subscription","failure",`subscription_id: ${v.subscription_id}, amount: ${e.amount}`),g.A.error("Subscription update failed",{subscriptionId:v.subscription_id,statusCode:h.statusCode}),f.toast.error((t=h.statusCode,(null!=t?O[t]:void 0)??P));return}let x=a?null==(s=c)||null==(s=s.paymentMethod)?void 0:s.card:H,b=`Recurring donation updated successfully! You will now be charged ${o?`${e.amount} ${null==(n=v.currency)?void 0:n.toUpperCase()}`:""} ${l||a?`with the card ending in ${x.last4}`:""} for this recurring donation.`;B(b),y(!1),_()}catch(t){y(!1),(0,p.$s)("donor_portal_modify_subscription","failure",`subscription_id: ${v.subscription_id}, amount: ${e.amount}`),console.error("error",t),g.A.error("Error updating subscription",t),f.toast.error(P)}},{title:ei,minAmount:ea,maxAmount:el}=u.$i.find(e=>e.code===v.currency);return(0,z.jsx)("div",{ref:t,className:"relative inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:align-middle sm:max-w-lg sm:w-full p-6",children:""!==I?(0,z.jsx)(e=>{let{message:t}=e;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("p",{className:"pb-4",children:t}),(0,z.jsx)(j.$n,{onPress:()=>h(null),className:"flex w-full items-center justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-carrot-500 text-base font-medium hover:bg-carrot-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-carrot-500 sm:col-start-2 sm:text-sm",children:(0,z.jsx)(j.EY,{c
1olor:"text-white",weight:"font-bold tracking-tight-1",children:"Back to dashboard"})})]})},{message:I}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{children:(0,z.jsxs)("div",{children:[(0,z.jsx)(a.lG.Title,{as:"h3",className:"text-lg leading-6 font-semibold text-grey-900",children:"Modify donation"}),(0,z.jsx)("div",{className:"mt-2",children:(0,z.jsx)(j.EY,{as:"p",color:"text-grey-800",children:"You can adjust your recurring donation below."})})]})}),(0,z.jsxs)("form",{method:"post",onSubmit:J(en),children:[(0,z.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-4 items-center",children:[(0,z.jsx)("div",{id:"left",children:(0,z.jsx)(j.EY,{color:"text-grey-800",children:"Current donation"})}),(0,z.jsx)("div",{id:"right",className:"text-right",children:(null==(i=v.subscription_data)?void 0:i.monthly_amount)&&(0,z.jsx)(D.B,{amount:parseFloat(null==(l=v.subscription_data)?void 0:l.monthly_amount),fontCurrencySize:"text-base",fontAmountSize:"text-base",weight:"font-normal",color:"text-grey-800",currency:v.currency})}),(0,z.jsx)("div",{id:"left",children:(0,z.jsx)(j.EY,{color:"text-grey-800",children:"New donation"})}),(0,z.jsx)("div",{id:"right",className:"text-right",children:(0,z.jsx)("div",{children:(0,z.jsxs)("div",{className:"mt-1 flex items-start",children:[(0,z.jsx)("div",{className:"inline-flex items-center border-t border-b border-l border-gray-300 rounded-tl-md rounded-bl-md px-3 py-2",children:(0,z.jsx)(j.EY,{color:"text-grey-900",children:ei})}),(0,z.jsx)("div",{className:"text-left",children:(0,z.jsx)(j.A_,{type:"text",name:"amount",ref:X({validate:e=>{if(""===e)return!1;if(!/^\d+(\.\d{1,2})?$/.test(e))return"Amount must have maximum 2 decimal places";let t=parseFloat(e);return isNaN(t)?"Please enter a valid number":t<ea?`Amount must be at least ${ea}`:!(t>=el)||`Amount must be less than ${el}`}}),"aria-label":"Enter amount",placeholder:`${ea}`,inputClassName:"appearance-none block w-full text-grey-900 placeholder-grey-700 border border-grey-200 py-2 px-4 leading-tight focus:outline-none focus:bg-white text-lg rounded-none rounded-r-md",validationState:Q.amount?"invalid":"valid",validationMsg:Q.amount?Q.amount.message:null})})]})})})]}),(0,z.jsxs)("div",{id:"payment-method",className:"mt-5 ",children:[(0,z.jsx)(j.EY,{color:"text-grey-800",children:"Payment method"}),"addCard"===N&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"grid xl:grid-cols-2 xl:gap-x-2 grid-cols-1",children:(0,z.jsxs)("div",{children:[(0,z.jsx)("fieldset",{children:(0,z.jsxs)("div",{className:"mt-2 -space-y-px rounded-md bg-white shadow-sm max-w-xs",children:[(0,z.jsx)("div",{children:(0,z.jsx)("div",{className:`rounded-t-md ${R.n}`,children:(0,z.jsx)(d.CardNumberElement,{onChange:e=>{G(e.empty),U(Y(Y({},V),{},{cardNumber:e.empty?"Card number is empty":null})),e.error&&U(Y(Y({},V),{},{cardNumber:e.error.message}))}})})}),(0,z.jsxs)("div",{className:"flex -space-x-px",children:[(0,z.jsxs)("div",{className:"w-1/2 min-w-0 flex-1",children:[(0,z.jsx)("label",{htmlFor:"card-expiration-date",className:"sr-only",children:"Expiration date"}),(0,z.jsx)("div",{className:`rounded-bl-md ${R.n}`,children:(0,z.jsx)(d.CardExpiryElement,{onChange:e=>{G(e.empty),U(Y(Y({},V),{},{expiry:e.empty?"Card expiry is empty":null})),e.error&&U(Y(Y({},V),{},{expiry:e.error.message}))}})})]}),(0,z.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,z.jsx)("label",{htmlFor:"card-cvc",className:"sr-only",children:"CVC"}),(0,z.jsx)("div",{className:`rounded-br-md ${R.n}`,children:(0,z.jsx)(d.CardCvcElement,{onChange:e=>{G(e.empty),U(Y(Y({},V),{},{cvc:e.empty?"Card CVC is empty":null})),e.error&&U(Y(Y({},V),{},{cvc:e.error.message}))}})})]})]})]})}),V.cardNumber&&(0,z.jsx)("div",{className:"mt-2 text-sm text-red-600",id:"card-error",children:V.cardNumber}),V.expiry&&(0,z.jsx)("div",{className:"mt-2 text-sm text-red-600",id:"card-error",children:V.expiry}),V.cvc&&(0,z.jsx)("div",{className:"mt-2 text-sm text-red-600",id:"card-error",children:V.cvc})]})}),(0,z.jsx)("div",{id:"billing-address",children:(0,z.jsxs)("div",{className:"mt-4 -space-y-px rounded-md bg-white shadow-sm",children:[(0,z.jsx)("div",{className:"mt-2",children:(0,z.jsx)("select",{ref:X({required:"Please choose a country"}),defaultValue:"",name:"country",className:"form-select relative block w-full rounded-none rounded-t-md border-0 bg-transparent py-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-500 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-carrot-600 sm:text-sm sm:leading-6",children:es.map(e=>(0,z.jsx)("option",{value:e.code,children:e.name},e.code))})}),(0,z.jsx)("div",{className:"-space-x-px",children:(0,z.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,z.jsx)("label",{htmlFor:"address",className:"sr-only",children:"Address"}),(0,z.jsx)(j.A_,{ref:X({required:"Please enter your Address"}),type:"text",name:"address",id:"address",inputClassName:"relative block w-full rounded-none border-0 bg-transparent py-1.5 px-3 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-500 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-carrot-600 sm:text-sm sm:leading-6",placeholder:"Address"})]})}
1),(0,z.jsxs)("div",{className:"flex -space-x-px",children:[(0,z.jsxs)("div",{className:"w-1/2 min-w-0 flex-1",children:[(0,z.jsx)("label",{htmlFor:"city",className:"sr-only",children:"City"}),(0,z.jsx)(j.A_,{ref:X({required:"Please enter your City"}),type:"text",name:"city",id:"city",inputClassName:"relative block w-full rounded-none rounded-bl-md border-0 bg-transparent px-3 py-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-500 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-carrot-600 sm:text-sm sm:leading-6",placeholder:"City"})]}),(0,z.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,z.jsx)("label",{htmlFor:"zip",className:"sr-only",children:"Zip/Post code"}),(0,z.jsx)(j.A_,{ref:X({required:"Please enter your Zip code"}),type:"text",name:"zip",id:"zip",inputClassName:"relative block w-full rounded-none rounded-br-md border-0 bg-transparent px-3 py-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-500 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-carrot-600 sm:text-sm sm:leading-6",placeholder:"Zip/Post code"})]})]})]})})]}),"changeCard"===N&&Array.isArray(null==w?void 0:w.data)&&(null==w||null==(o=w.data)?void 0:o.length)>0&&(0,z.jsxs)("div",{className:" flex flex-row justify-between",children:[(0,z.jsx)(a.WF,{value:H,onChange:e=>{Z(e)},children:(0,z.jsxs)("div",{className:"relative mt-1 iphonese:w-44 w-64 lg:w-80",children:[(0,z.jsxs)(a.WF.Button,{className:"relative inline-flex items-center w-full cursor-default rounded-lg bg-white appearance-none text-grey-900 placeholder-grey-700 border border-grey-200 py-2 px-4 leading-tight focus:outline-none focus:bg-white text-lg pl-3 text-left focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm",children:[(0,z.jsxs)("div",{className:"inline-flex gap-2 items-center",children:[(null==H?void 0:H.brand)&&(0,z.jsx)("div",{className:"inline-flex",children:(0,z.jsx)(C(),{src:(0,F.M)(null==H?void 0:H.brand),alt:`${(null==H?void 0:H.brand)||"Card"} logo`,loader:A.R2,height:30,width:40,objectFit:"contain"})}),(0,z.jsx)("span",{className:"capitalize text-sm",children:null==H?void 0:H.brand}),"****",(0,z.jsx)("span",{className:"block truncate text-sm",children:null==H?void 0:H.last4})]}),(0,z.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:(0,z.jsx)($,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),(0,z.jsx)(a.eB,{as:s.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,z.jsx)(a.WF.Options,{className:"z-10 absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",children:null==w||null==(c=w.data)?void 0:c.map((e,t)=>(0,z.jsx)(a.WF.Option,{className:e=>{let{active:t}=e;return`relative cursor-default select-none flex flex-col justify-center p-2 ${t?"bg-carrot-100 text-gray-900":"text-gray-900"}`},value:e,children:t=>{let{selected:r}=t;return(0,z.jsxs)("div",{className:"inline-flex gap-2 items-center",children:[(0,z.jsx)("div",{className:"inline-flex",children:(0,z.jsx)(C(),{src:(0,F.M)(e.brand),alt:`${e.brand||"Card"} logo`,loader:A.R2,height:30,width:40,objectFit:"contain"})}),(0,z.jsxs)("span",{className:"capitalize text-sm",children:[e.brand," ****"]}),(0,z.jsx)("span",{className:`block truncate text-sm ${r?"font-medium":"font-normal"}`,children:e.last4}),r?(0,z.jsx)("span",{className:"absolute inset-y-0 right-0 flex items-center pl-3 pr-2 text-amber-600",children:(0,z.jsx)(E,{className:"h-5 w-5","aria-hidden":"true"})}):null]})}},t))})})]})}),(0,z.jsx)(j.$n,{className:"w-auto shrink-0 text-right",onPress:()=>T("addCard"),children:(0,z.jsx)(j.EY,{color:"text-carrot-600",weight:"font-bold",className:"text-right",children:"Add card"})})]})]}),(0,z.jsxs)("div",{id:"actions",className:"flex mt-5 xl:flex-row flex-col gap-3",children:["addCard"===N&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(j.$n,{type:"submit",isDisabled:b||L||V.cardNumber||V.expiry||V.cvc||!ee.isValid,className:"flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-carrot-500 text-base font-medium hover:bg-carrot-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-carrot-500 sm:col-start-2 sm:text-sm",children:[b&&(0,z.jsx)(M,{}
1),(0,z.jsx)(j.EY,{color:"text-white",weight:"font-bold tracking-tight-1",className:"text-center",children:b?"Processing...":"Update payment"})]}),(0,z.jsx)(j.$n,{onPress:()=>{T("changeCard")},className:" rounded-md border border-transparent shadow-sm px-4 py-2 bg-carrot-500 text-base font-medium hover:bg-carrot-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-carrot-500 sm:col-start-2 sm:text-sm",children:(0,z.jsx)(j.EY,{color:"text-white",weight:"font-bold tracking-tight-1",children:"Go back"})})]}),"changeCard"===N&&(0,z.jsxs)(j.$n,{type:"submit",isDisabled:(null==K?void 0:K.id)===(null==H?void 0:H.id)?b||!ee.isValid||!er:b,className:" flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-carrot-500 text-base font-medium hover:bg-carrot-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-carrot-500 sm:col-start-2 sm:text-sm",children:[b&&(0,z.jsx)(M,{}),(0,z.jsx)(j.EY,{color:"text-white",weight:"font-bold tracking-tight-1",children:b?"Processing...":"Confirm change"})]}),(0,z.jsx)(j.$n,{ref:x,isDisabled:b,className:"rounded-md border border-grey-300 shadow-sm px-4 py-2 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-carrot-500",onPress:()=>{(0,p.$s)("donor_portal_modify_subscription","cancel",`subscription_id: ${v.subscription_id}`),h(null)},children:(0,z.jsx)(j.EY,{color:"text-grey-900",weight:"font-bold",children:"Cancel"})})]})]})]})})}),M=()=>(0,z.jsxs)("svg",{className:"animate-spin mr-2 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,z.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,z.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]});var B=r(20355);let W=async(e,t,r)=>{(0,S.Ku)("https://donordb.yaqeeninstitute.org/api/v1/receipts/resend",{charge_id:e.charge_id,account:e.account,platform:e.platform},"POST").then(()=>{(0,p.$s)("donor_portal_resend_receipt","success",`charge_id: ${e.charge_id}`),t(),f.toast.success(`Receipt sent to ${e.email}.`)}).catch(t=>{(0,p.$s)("donor_portal_resend_receipt","failure",`charge_id: ${e.charge_id}`),console.error("error",t),g.A.error("Error resending receipt",t),f.toast.error("Astaghfirullah! We could not process your request. Please contact support.")}).finally(()=>{r(!1)})};var q=!0;let L=()=>{var e;let{0:t,1:r}=(0,s.useState)(null),{0:o,1:f}=(0,s.useState)(!1),_=(0,s.useRef)(null),{0:N,1:C}
1=(0,s.useState)(!1),$=e=>{f(e)},E=e=>{r(e)},{0:k,1:P}=(0,s.useState)(null),{firebaseAuth:O}=(0,v.m9)(),{userInfo:F}=O,A=(0,n.useRouter)(),{query:R}=A;(0,s.useEffect)(()=>{let e=null==R?void 0:R.id;e&&P(e)},[null==R?void 0:R.id]);let{data:D,error:T,mutate:Y}=(0,y.Ay)([null!=F&&null!=(e=F.user)&&e.email&&F.user.emailVerified&&k?`${m.O}/${k}`:null],S.OG),M=D?(0,B.lE)(D):null,{data:q,error:L}=(0,y.Ay)([null!=M&&M.customer_id&&null!=M&&M.account?`${m.I}/cards?customer_id=${M.customer_id}&account=${M.account}`:null],S.OG),V=null!=M&&M.account?b.jt[M.account]:null,U="1"===R.test,K=V?U?u.vw[V].test:u.vw[V].live:null,H=(0,s.useRef)();(0,s.useEffect)(()=>{K&&(0,c.c)(K).then(e=>{H.current=e,g.A.debug("Stripe loaded")})},[K]);let Z=(0,B.hP)(M);return(0,s.useEffect)(()=>{[x.j_.AuthDismissed,x.j_.SignedOut,x.j_.RequireLoginOrSignUp].includes(F.authState)&&Y(null)},[F.authState,A,Y]),(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(d.Elements,{stripe:H.current||null,children:[!M&&!T&&(0,z.jsx)(v.p8,{}),(0,z.jsx)(w.DashboardLayout,{pageTitle:"Donation Detail",className:"bg-grey-10 pb-64",children:(0,z.jsx)("div",{id:"main-content",className:"container mx-auto lg:px-8 px-4 pt-6 flex flex-col min-h-screen",children:M&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{className:"flex justify-between items-center xl:mb-10 mb-8 relative",children:[(0,z.jsx)(j.$n,{onPress:()=>{(0,p.$s)("donor_portal_charge_detail_page","click","item_clicked: back_button"),A.back()},children:(0,z.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,z.jsx)(i.g,{icon:"chevron-left",size:"sm",className:"text-carrot-500"}),(0,z.jsx)(j.EY,{as:"p",weight:"font-bold",color:"text-grey-900",letterSpacing:"tracking-tight-1",children:"Back"})]})}),(0,z.jsx)(a.eB.Root,{show:!!t,as:s.Fragment,children:(0,z.jsx)(a.lG,{as:"div",className:"fixed z-10
1inset-0 overflow-y-auto",initialFocus:_,onClose:()=>{if(o)return null;r(null)},children:(0,z.jsxs)("div",{className:"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,z.jsx)(a.eB.Child,{as:s.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,z.jsx)(a.lG.Overlay,{className:"fixed inset-0 bg-black bg-opacity-75 transition-opacity"})}),(0,z.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"â"}),(0,z.jsx)(a.eB.Child,{as:s.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:t===h.sf.REFUND?(0,z.jsx)(w.RefundModalContent,{handleOpenClose:E,initialFocusRef:_,isSubmitting:o,handleIsSubmit:$,chargeData:M,mutate:Y}):t===h.sf.STOP_SUBSCRIPTION?(0,z.jsx)(G,{handleOpenClose:E,initialFocusRef:_,isSubmitting:o,handleIsSubmit:$,chargeData:M,mutate:Y}):t===h.sf.MODIFY_SUBSCRIPTION?(0,z.jsx)(I,{handleOpenClose:E,initialFocusRef:_,isSubmitting:o,handleIsSubmit:$,chargeData:M,cardList:L?null:q,mutate:Y}):(0,z.jsx)("div",{})})]})})}),Z.length>0&&(0,z.jsx)("div",{className:"flex justify-end items-end",children:(0,z.jsxs)(a.W1,{as:"div",className:"relative inline-block text-left",children:[(0,z.jsx)("div",{children:(0,z.jsxs)(a.W1.Button,{disabled:N,className:"border border-grey-200 inline-flex w-full justify-center rounded-md bg-white px-4 py-2 hover:bg-opacity-30 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75",children:[N&&(0,z.jsx)(w.Spinner,{}),(0,z.jsx)(j.EY,{color:"text-grey-900",weight:"font-bold",fontSize:"text-sm",children:"Manage"}),(0,z.jsx)(l,{className:"ml-2 h-5 w-5 text-violet-200 hover:text-violet-100","aria-hidden":"true"})]})}),(0,z.jsx)(a.eB,{as:s.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,z.jsx)(a.W1.Items,{className:"absolute right-0 mt-2 w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none z-10 py-1",children:Z.map(e=>(0,z.jsx)(a.W1.Item,{children:(0,z.jsx)("button",{onClick:()=>{(0,p.$s)("donor_portal_charge_action","click",`action: ${e}`),e===h.sf.RESEND_RECEIPT?(C(!0),W(M,Y,C)):r(e)},className:"group flex w-full items-center hover:bg-carrot-50 px-4 py-2",children:(0,z.jsx)(j.EY,{fontSize:"text-sm",color:"text-grey-900 group-hover:text-black",children:e})})},e))})})]})})]}),(0,z.jsx)(w.ChargeDetail,{chargeData:M})]})})})]})})},G=(0,s.forwardRef)((e,t)=>{let{handleOpenClose:r,initialFocusRef:s,isSubmitting:n,handleIsSubmit:i,chargeData:l,mutate:d}=e;return(0,z.jsxs)("div",{ref:t,className:"relative inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-md sm:w-full sm:p-6",children:[(0,z.jsxs)("div",{className:"sm:flex sm:items-start",children:[(0,z.jsx)("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:(0,z.jsx)(o,{className:"h-6 w-6 text-red-600","aria-hidden":"true"})}),(0,z.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,z.jsx)(a.lG.Title,{as:"h3",className:"text-lg leading-6 font-medium text-gray-900",children:"Stop recurring donation"}),(0,z.jsx)("div",{className:"mt-2",children:(0,z.jsx)(j.EY,{as:"p",color:"text-grey-800",children:"Are you sure you want to stop this donation? This will take effect immediately and you wonât be billed consequently."})})]})]}),(0,z.jsxs)("div",{className:"mt-5 sm:mt-4 sm:ml-10 sm:pl-4 flex xl:flex-row flex-col xl:space-x-3 xl:space-y-0 space-y-3",children:[(0,z.jsx)(j.$n,{onPress:()=>{(0,p.$s)("donor_portal_cancel_subscription","confirm",`charge_id: ${l.charge_id}, subscription_id: ${l.subscription_id}`),i(!0),(0,S.Ku)("https://donordb.yaqeeninstitute.org/api/v1/subscriptions",{subscription_id:l.subscription_id,account:l.account,platform:l.platform},"DELETE").then(()=>{(0,p.$s)("donor_portal_cancel_subscription","success",`charge_id: ${l.charge_id}, subscription_id: ${l.subscription_id}`),d(),f.toast.success("This donation has been stopped.")}).catch(e=>{(0,p.$s)("donor_portal_cancel_subscription","failure",`charge_id: ${l.charge_id}, subscription_id: ${l.subscription_id}`),console.error("error",e),g.A.error("Error canceling subscription",e),f.toast.error("Astaghfirullah! We could not process your request. Please contact support.")}).finally(()=>{i(!1),r(null)})},isDisabled:n,className:"rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500",children:(0,z.jsx)(j.EY,{c
1olor:"text-white",weight:"font-medium",children:n?"Processing...":"Yes, stop recurring donation"})}),(0,z.jsx)(j.$n,{ref:s,isDisabled:n,className:"rounded-md border border-grey-300 shadow-sm px-4 py-2 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-carrot-500",onPress:()=>{(0,p.$s)("donor_portal_cancel_subscription","cancel",`charge_id: ${l.charge_id}, subscription_id: ${l.subscription_id}`),r(null)},children:(0,z.jsx)(j.EY,{color:"text-grey-900",weight:"font-bold",children:"Cancel"})})]})]})});G.displayName="StopSubscriptionModalContent"}},e=>{e.O(0,[5123,1510,2697,4740,1502,4587,2682,6241,5542,3822,5807,3971,7501,636,6593,8792],()=>e(e.s=30460)),_N_E=e.O()}]);
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.