PageSourceSearch

https://portal.commoninterest.com/assets/manage-account-C-1uHAJ6.js

js commoninterest.com collected 2026-09-24 13:27:57 UTC 31,766 bytes, 1 lines download raw bytes

1import{r as j,j as e,W as se,I as Z,aP as le,Y,Z as G,bf as k,aW as L,k as A,B as C,F as w,cw as ee,M as D,u as re,O as oe,cJ as E,Q as ce,q as K,T as O}from"./elements-DVh2jUIM.js";import{q,T as i,N as de,A as me,X as ue,P as be,aO as S,aP as $,aQ as P,aR as U,Y as B,L as J,aS as ge,aT as xe,_ as he}from"./index-DeQvL4I7.js";import{u as ae,C as M}from"./index.esm-BsOhZrKM.js";import{S as fe}from"./SavedPaymentMethodOptions-D33lqfLB.js";import{R as te}from"./recurringIntervals-CtqK-wqt.js";import{a as ne}from"./store-B67Q7V7g.js";import{u as I}from"./useRedesign-DVyq07A4.js";import{R as V,S as z}from"./SupportLink-Bmmzei6G.js";import{A as ye}from"./authorization-CE7gncHO.js";import"./grids-DXrfAsUA.js";import"./startOfDay-AazlW55I.js";import"./index-BrZWKhU_.js";import"./useAuthorization-D7B2eQha.js";const F=j.forwardRef(({selectedPayment:r,paymentMethods:g},b)=>{const{control:x,handleSubmit:s,formState:{errors:h},setError:a}=ae(),[c,l]=j.useState(r.payFullBalance),m=ne(t=>{var d;return(d=t.account)==null?void 0:d.nextChargeDate}),u=async t=>{const d={};t.paymentMethod&&(d.paymentMethodId=t.paymentMethod.id),await q.updateAutoDraftEnrollment(r.id,d)},p=s(async t=>{if((r==null?void 0:r.type)==="vantacaPayAutoDraft"){await u(t);return}if(!c&&!t.amount){a("amount",{type:"required",message:"Amount is required."});return}if(t.amount&&t.amount<.5){a("amount",{type:"min",message:"Amount must be at least $0.50."});return}const d={};pe(t.interval)&&r.interval!==t.interval&&(d.interval=t.interval),c&&!t.amount?d.amount=0:(r.amount===void 0||r.amount!==t.amount)&&(d.amount=t.amount?Math.round(t.amount*100):void 0),r.nextPaymentDate!==t.nextPaymentDate&&(d.nextPaymentDate=t.nextPaymentDate),r.payFullBalance!==c&&(d.payFullBalance=c),await q.updateRecurringPayment(r.id,d)});j.useImperativeHandle(b,()=>({submit:p}));const f=t=>m&&t.toDateString()===m.toDateString()?{classes:"!font-bold"}:{};return e.jsxs("form",{id:"update-recurring-payment-form",onSubmit:p,children:[r&&r.type==="standard"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"col-span-1",children:e.jsx(se,{id:"pay-full-balance",className:"space-x-2",value:c,name:"payFullBalance",label:i("billing.updateRecurring.payFullBalance").toString(),onChange:l})}),e.jsx(M,{name:"amount",control:x,defaultValue:r.amount?r.amount/100:void 0,render:({field:t})=>{var d;return e.jsx(Z,{className:"col-span-1",label:c?i("billing.updateRecurring.maxAmountInputLabel").toString():i("billing.updateRecurring.amountInputLabel").toString(),id:"amount",type:"number",placeholder:"$0.00",onWheel:n=>n.currentTarget.blur(),error:(d=h.amount)==null?void 0:d.message,...t})}}),e.jsx(M,{name:"interval",control:x,rules:{required:"Payment frequency is required."},defaultValue:r.interval,render:({field:t})=>e.jsx(le,{className:"col-span-1",options:te,qaListAttribute:"frequency",qaListValue:d=>JSON.stringify({interval:d}),qaOptionValue:d=>JSON.stringify({interval:d}),label:i("billing.updateRecurring.intervalInputLabel").toString(),deriveKey:d=>d??"",displaySelected:d=>i(`billing.intervalSchedule.${d}`),displayOption:d=>i(`billing.intervalSchedule.${d}`),...t})}),e.jsx("div",{className:"col-span-1",children:e.jsx(M,{name:"nextPaymentDate",control:x,defaultValue:new Date((r.nextPaymentDate??r.anchorDate).toLocaleString("en-US",{timeZone:"UTC",month:"long",day:"2-digit",year:"numeric"})),render:({field:{value:t,onChange:d,ref:n,...N}})=>e.jsx(Y,{id:"next-payment-date",label:i("billing.updateRecurring.dateInputLabel").toString(),value:t,minDate:G(),useMinDate:!1,beforeShowDay:f,...N,onChange:v=>{v&&d(v)}})})})]}),r&&r.type==="vantacaPayAutoDraft"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-semibold",children:i("billing.updateRecurring.paymentMethodInputLabel")}),e.jsx(M,{name:"paymentMethod",control:x,defaultValue:g.find(t=>{var d;return t.id===((d=r.paymentMethod)==null?void 0:d.id)}),render:({field:{value:t,onChange:d,...n}})=>{var N;return e.jsx(fe,{paymentOption:(N=r.paymentMethod)==null?void 0:N.paymentMethodType,paymentMethodOptions:g.filter(v=>["eCheck"].includes(v==null?void 0:v.paymentMethodType)),selectedPaymentMethod:t,onPaymentMethodSelected:v=>{d(v??null)},label:i("billing.updateRecurring.paymentMethodInputLabel").toString(),includeNewPaymentMethod:!1,...n})}})]})]})});F.displayName="UpdateRecurringPaymentForm";function pe(r){return typeof r=="string"&&te.includes(r)}function ie(r,g){const[b,x]=j.useState(),[s,h]=j.useState(),[a,c]=j.useState(!1),l=j.useRef(null);return{selectedPayment:b,setSelectedPayment:x,confirmDelete:s,setConfirmDelete:h,loading:a,form:l,handleUpdate:async()=>
1{if(l.current){c(!0);try{await l.current.submit(),g(),x(void 0)}finally{c(!1)}}},handleDeleteConfirm:async()=>{if(b){c(!0);try{await r(b),g(),x(void 0),h(!1)}finally{c(!1)}}}}}function W({className:r,paymentMethods:g,recurringPayments:b,refresh:x,onEditAutoDraft:s}){const h=I(),{selectedPayment:a,setSelectedPayment:c,confirmDelete:l,setConfirmDelete:m,loading:u,form:p,handleUpdate:f,handleDeleteConfirm:t}=ie(async n=>{n.type==="vantacaPayAutoDraft"?await q.cancelAutoDraft(n.id):await q.cancelRecurringPayment(n.id)},x),d=n=>{n.type==="autoDraft"?s(n.account.ownerId,n.account.subLedgerId):c(n)};return h?e.jsxs("div",{className:r,children:[e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header",children:i("billing.manageRecurring.title")}),b!=null&&b.length?e.jsx("ul",{className:"space-y-6 mobile:space-y-3","data-qa":"recurring-payment-list",children:b.map(n=>{var N,v;return e.jsxs("li",{className:"flex mobile:items-center justify-between flex-col mobile:flex-row text-neutral-fg gap-4 mobile:gap-0","data-qa":"recurring-pay-list-item",children:[e.jsxs("div",{className:"flex flex-col w-3/4",children:[((N=n.paymentMethod)==null?void 0:N.bankAccount)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({bankName:n.paymentMethod.bankAccount.bankName,last4:k((n.amount??0)/100)}),children:[n.paymentMethod.bankAccount.bankName," XXXX-XXXX-XXXX-",n.paymentMethod.bankAccount.last4]}),((v=n.paymentMethod)==null?void 0:v.card)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({brand:n.paymentMethod.card.brand,last4:n.paymentMethod.card.last4}),children:[i([`billing.cardType.${n.paymentMethod.card.brand}`,"billing.cardType.default"])," ","XXXX-XXXX-XXXX-",n.paymentMethod.card.last4]}),e.jsxs("div",{className:"break-words","data-qa":"property-info",children:[n.account.accountWithSubCode," -"," ",L(n.account.propertyAddress,"half"),"|"," ",n.account.associationName]}),e.jsx("div",{"data-qa":"anchor-date","data-qa-value":JSON.stringify({interval:n.interval,anchorDate:A(n.anchorDate,{format:"full",naive:!0}),amount:k((n.amount??0)/100)}),children:i("billing.manageRecurring.start",{date:A(n.anchorDate,{format:"full",naive:!0}),amount:n.payFullBalance?`Full Balance${n.amount?` Up To ${k(n.amount/100)}`:""}`:n.amount&&k(n.amount/100),interval:i(`billing.intervalSchedule.${n.interval}`)})}),!!n.notes&&e.jsxs("div",{"data-qa":"notes",children:[i("billing.manageRecurring.notePrefix"),": ",n.notes]})]}),e.jsx("div",{children:e.jsx(C,{type:"button",variant:"passive","data-qa":"edit-button",onClick:()=>d(n),className:"w-full flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 w-full justify-center",children:[e.jsx("p",{children:i("billing.manageRecurring.edit")}),e.jsx(w,{icon:ee})]})})})]},n.id)})}):e.jsx("div",{"data-qa":"no-recurring-payments",children:i("billing.manageRecurring.noRecurringPayments")})]}),a&&!l&&e.jsx(D,{title:i(a.type==="standard"?"billing.manageRecurring.modal.title":"billing.manageAutoDraft.modal.title",{accountNumber:a==null?void 0:a.account.accountNumber,address:a==null?void 0:a.account.propertyAddress.address1,associationName:a==null?void 0:a.account.associationName}).toString(),open:a!==void 0,onClose:()=>c(void 0),actions:[{text:i("billing.manageRecurring.modal.submitText").toString(),onClick:f,disabled:u,variant:"primary"},{text:"Cancel",variant:"passiveOutline",disabled:u,onClick:()=>Promise.resolve(c(void 0))},{text:a.type==="standard"?"Remove":"Unenroll",variant:"passive",disabled:u,onClick:()=>Promise.resolve(m(!0))}],children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{children:a.type==="vantacaPayAutoDraft"?i("billing.manageAutoDraft.modal.content"):i("billing.manageRecurring.modal.content")}),e.jsx(F,{paymentMethods:g,selectedPayment:a,ref:p})]})}),l&&a&&e.jsx(D,{title:i(a.type==="vantacaPayAutoDraft"?"billing.manageAutoDraft.confirmDelete.title":"billing.manageRecurring.confirmDelete.title",{accountNumber:a==null?void 0:a.account.accountNumber,address:a==null?void 0:a.account.propertyAddress.address1,associationName:a==null?void 0:a.account.associationName}).toString(),open:l,onClose:()=>{a.type==="vantacaPayAutoDraft"&&c(void 0),m(void 0)},actions:[{text:i("Confirm").toString(),onClick:t,disabled:u,variant:"primary"},{text:i("Cancel").toString(),onClick:()=>Promise.resolve(m(!1)),disabled:u,variant:"passiveOutline"}],children:e.jsx("p",{children:i(a.type==="vantacaPayAutoDraft"?"billing.manageAutoDraft.confirmDelete.content":"billing.manageRecurring.confirmDelete.content")})})]}):e.jsxs("div",{className:r,children:[e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header",children:i("billing.manageRecurring.title")}),b!=null&&b.length?e.jsx("ul",{className:"space-y-4 md:ml-5","data-qa":"recurring-payment-list",children:b.map(n=>{var N,v;return e.jsxs("li",{className:"font-medium flex items-start justify-between flex-col sm:flex-row","data-qa":"recurring-pay-list-item",children:[e.jsxs("div",{className:"flex flex-col",children:[((N=n.paymentMethod)==null?void 0:N.bankAccount)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({bankName:n.paymentMethod.bankAccount.bankName,last4:k((n.amount??0)/100)}),children:[n.paymentMethod.bankAccount.bankName," XXXX-XXXX-XXXX-",n.paymentMethod.bankAccount.last4]}),((v=n.paymentMethod)==null?void 0:v.card)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({brand:n.paymentMethod.card.brand,last4:n.paymentMethod.card.last4}),children:[i([`billing.cardType.${n.paymentMethod.card.brand}`,"billing.cardType.default"])," ","XXXX-XXXX-XXXX-",n.paymentMethod.card.last4]}),e.jsxs("div",{className:"text-base-fg","data-qa":"property-info",children:[n.account.accountWithSubCode," -"," ",L(n.account.propertyAddress,"half"),"|"," ",n.account.associationName]}),e.jsx("div",{className:"text-base-fg","data-qa":"anchor-date","data-qa-value":JSON.stringify({interval:n.interval,anchorDate:A(n.anch
1orDate,{format:"full",naive:!0}),amount:k((n.amount??0)/100)}),children:i("billing.manageRecurring.start",{date:A(n.anchorDate,{format:"full",naive:!0}),amount:n.payFullBalance?`Full Balance${n.amount?` Up To ${k(n.amount/100)}`:""}`:n.amount&&k(n.amount/100),interval:i(`billing.intervalSchedule.${n.interval}`)})}),!!n.notes&&e.jsxs("div",{className:"text-base-fg","data-qa":"notes",children:[i("billing.manageRecurring.notePrefix"),": ",n.notes]})]}),e.jsx("div",{children:e.jsx(C,{type:"button",variant:"primaryLink","data-qa":"edit-button",onClick:()=>d(n),children:i("billing.manageRecurring.edit")})})]},n.id)})}):e.jsx("div",{className:"md:ml-4 text-base-fg","data-qa":"no-recurring-payments",children:i("billing.manageRecurring.noRecurringPayments")})]}),a&&!l&&e.jsx(D,{title:i(a.type==="standard"?"billing.manageRecurring.modal.title":"billing.manageAutoDraft.modal.title",{accountNumber:a==null?void 0:a.account.accountNumber,address:a==null?void 0:a.account.propertyAddress.address1,associationName:a==null?void 0:a.account.associationName}).toString(),open:a!==void 0,onClose:()=>c(void 0),actions:[{text:i("billing.manageRecurring.modal.submitText").toString(),onClick:f,disabled:u,variant:"primary"},{text:"Cancel",variant:"passiveOutline",disabled:u,onClick:()=>Promise.resolve(c(void 0))},{text:a.type==="standard"?"Remove":"Unenroll",variant:"passive",disabled:u,onClick:()=>Promise.resolve(m(!0))}],textAlign:"left",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{children:a.type==="vantacaPayAutoDraft"?i("billing.manageAutoDraft.modal.content"):i("billing.manageRecurring.modal.content")}),e.jsx(F,{paymentMethods:g,selectedPayment:a,ref:p})]})}),l&&a&&e.jsx(D,{title:i(a.type==="vantacaPayAutoDraft"?"billing.manageAutoDraft.confirmDelete.title":"billing.manageRecurring.confirmDelete.title",{accountNumber:a==null?void 0:a.account.accountNumber,address:a==null?void 0:a.account.propertyAddress.address1,associationName:a==null?void 0:a.account.associationName}).toString(),open:l,onClose:()=>{a.type==="vantacaPayAutoDraft"&&c(void 0),m(void 0)},actions:[{text:i("Confirm").toString(),onClick:t,disabled:u,variant:"primary"},{text:i("Cancel").toString(),onClick:()=>Promise.resolve(m(!1)),disabled:u,variant:"passiveOutline"}],textAlign:"left",children:e.jsx("p",{children:i(a.type==="vantacaPayAutoDraft"?"billing.manageAutoDraft.confirmDelete.content":"billing.manageRecurring.confirmDelete.content")})})]})}const Q=j.forwardRef(({selectedPayment:r},g)=>{const{control:b,handleSubmit:x,formState:{errors:s}}=ae(),h=ne(l=>{var m;return(m=l.account)==null?void 0:m.nextChargeDate}),a=x(async l=>{const m={};(r.amount===void 0||r.amount!==l.amount)&&(m.amount=l.amount*100),r.scheduledDate!==l.nextPaymentDate&&(m.scheduledDate=l.nextPaymentDate),await q.updateFuturePayment(r.id,m)});j.useImperativeHandle(g,()=>({submit:a}));const c=l=>h&&l.toDateString()===h.toDateString()?{classes:"!font-bold"}:{};return e.jsxs("form",{id:"update-scheduled-payment-form",onSubmit:a,noValidate:!0,children:[r&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{name:"amount",control:b,rules:{required:"Amount over $0.50 is required.",min:{value:.5,message:"Amount over $0.50 is required."}},defaultValue:(r.amount??0)/100,render:({field:l})=>{var m;return e.jsx(Z,{className:"col-span-1",label:i("billing.updateScheduled.amountInputLabel").toString(),id:"amount",type:"number",placeholder:"$0.00",error:(m=s.amount)==null?void 0:m.message,onWheel:u=>u.currentTarget.blur(),...l})}}),e.jsx("div",{className:"col-span-1",children:e.jsx(M,{name:"nextPaymentDate",control:b,defaultValue:r.scheduledDate,render:({field:{value:l,onChange:m,ref:u,...p}})=>e.jsx(Y,{id:"next-payment-date",label:i("billing.updateScheduled.dateInputLabel").toString(),value:l,minDate:G(),useMinDate:!1,beforeShowDay:c,onChange:f=>{f&&m(f)},...p})})})]}),s.root&&e.jsx("div",{className:"text-error pt-8",children:e.jsx("span",{"data-qa":"error",children:s.root.message})})]})});Q.displayName="UpdateScheduledPaymentForm";function _({className:r="",scheduledPayments:g=[],refresh:b}){const x=I(),{selectedPayment:s,setSelectedPayment:h,confirmDelete:a,setConfirmDelete:c,loading:l,form:m,handleUpdate:u,handleDeleteConfirm:p}=ie(async t=>{await q.cancelFuturePayment(t.id)},b),f=t=>{c(!1),h(t)};return x?e.jsxs("div",{className:r,children:[e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header",children:i("billing.manageOneTime.title")}),g.length?e.jsx("ul",{className:"space-y-6 mobile:space-y-3",children:g.map(t=>{var d,n;return e.jsxs("li",{className:"flex mobile:items-center justify-between flex-col mobile:flex-row text-neutral-fg gap-4 mobile:gap-0",children:[e.jsxs("div",{className:"flex flex-col w-3/4",children:[((d=t.paymentMethod)==null?void 0:d.bankAccount)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({bankName:t.paymentMethod.bankAccount.bankName,last4:t.paymentMethod.bankAccount.last4}),children:[t.paymentMethod.bankAccount.bankName," XXXX-XXXX-XXXX-",t.paymentMethod.bankAccount.last4]}),((n=t.paymentMethod)==null?void 0:n.card)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({brand:t.paymentMethod.card.brand,last4:t.paymentMethod.card.last4}),children:[i([`billing.cardType.${t.paymentMethod.card.brand}`,"billing.cardType.default"])," ","XXXX-XXXX-XXXX-",t.paymentMethod.card.last4]}),e.jsxs("div",{className:"break-words","data-qa":"property-info",children:[L(t.account.propertyAddress,"half")," |"," ",t.account.associationName]}),e.jsxs("div",{"data-qa":"anchor-date","data-qa-value":JSON.stringify({anchorDate:t.scheduledDate.toLocaleDateString()}
1),children:[t.scheduledDate.toLocaleString("en-US",{timeZone:"UTC",month:"long",day:"2-digit",year:"numeric"})," ",e.jsx("div",{children:t.amount>=0&&k(t.amount/100)})]})]}),e.jsx("div",{children:e.jsx(C,{type:"button",variant:"passive","data-qa":"edit-button",onClick:()=>f(t),className:"w-full flex items-center justify-center mobile:max-w-32",children:e.jsxs("div",{className:"flex items-center gap-2 w-full justify-center",children:[e.jsx("p",{children:i("billing.manageOneTime.edit")}),e.jsx(w,{icon:ee})]})})})]},t.id)})}):e.jsx("div",{children:i("billing.manageOneTime.noScheduledPayments")})]}),s&&!a&&e.jsx(D,{title:i("billing.manageOneTime.modal.title",{accountNumber:s==null?void 0:s.account.accountNumber,address:s==null?void 0:s.account.propertyAddress.address1,associationName:s==null?void 0:s.account.associationName}).toString(),open:s!==void 0,onClose:()=>h(void 0),actions:[{text:i("billing.manageOneTime.modal.submitText").toString(),onClick:u,disabled:l,variant:"primary"},{text:"Cancel",variant:"passiveOutline",disabled:l,onClick:()=>Promise.resolve(h(void 0))},{text:"Remove",variant:"passive",disabled:l,onClick:()=>Promise.resolve(c(!0))}],children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{children:i("billing.manageOneTime.modal.content")}),e.jsx(Q,{selectedPayment:s,ref:m})]})}),a&&s&&e.jsx(D,{title:i("billing.manageOneTime.confirmDelete.title",{accountNumber:s==null?void 0:s.account.accountNumber,address:s==null?void 0:s.account.propertyAddress.address1,associationName:s==null?void 0:s.account.associationName}).toString(),open:a,onClose:()=>c(void 0),actions:[{text:i("Confirm").toString(),onClick:p,disabled:l,variant:"primary"},{text:i("Cancel").toString(),onClick:()=>Promise.resolve(c(!1)),disabled:l,variant:"passiveOutline"}],children:e.jsx("p",{children:i("billing.manageOneTime.confirmDelete.content")})})]}):e.jsxs("div",{className:r,children:[e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header",children:i("billing.manageOneTime.title")}),g.length?e.jsx("ul",{className:"space-y-4 md:ml-5",children:g.map(t=>{var d,n;return e.jsxs("li",{className:"font-medium flex items-start justify-between flex-col sm:flex-row",children:[e.jsxs("div",{className:"flex flex-col",children:[((d=t.paymentMethod)==null?void 0:d.bankAccount)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({bankName:t.paymentMethod.bankAccount.bankName,last4:t.paymentMethod.bankAccount.last4}),children:[t.paymentMethod.bankAccount.bankName," XXXX-XXXX-XXXX-",t.paymentMethod.bankAccount.last4]}),((n=t.paymentMethod)==null?void 0:n.card)&&e.jsxs("div",{"data-qa":"payment-data","data-qa-value":JSON.stringify({brand:t.paymentMethod.card.brand,last4:t.paymentMethod.card.last4}),children:[i([`billing.cardType.${t.paymentMethod.card.brand}`,"billing.cardType.default"])," ","XXXX-XXXX-XXXX-",t.paymentMethod.card.last4]}),e.jsxs("div",{className:"text-base-fg","data-qa":"property-info",children:[L(t.account.propertyAddress,"half")," |"," ",t.account.associationName]}),e.jsxs("div",{className:"text-base-fg","data-qa":"anchor-date","data-qa-value":JSON.stringify({anchorDate:t.scheduledDate.toLocaleDateString()}),children:[t.scheduledDate.toLocaleString("en-US",{timeZone:"UTC",month:"long",day:"2-digit",year:"numeric"})," ",e.jsx("div",{className:"text-base-fg",children:t.amount>=0&&k(t.amount/100)})]})]}),e.jsx("div",{children:e.jsx(C,{"data-qa":"edit-btn",type:"button",variant:"primaryLink",onClick:()=>f(t),children:i("billing.manageOneTime.edit")})})]},t.id)})}):e.jsx("div",{className:"md:ml-4 text-base-fg",children:i("billing.manageOneTime.noScheduledPayments")})]}),s&&!a&&e.jsx(D,{title:i("billing.manageOneTime.modal.title",{accountNumber:s==null?void 0:s.account.accountNumber,address:s==null?void 0:s.account.propertyAddress.address1,associationName:s==null?void 0:s.account.associationName}).toString(),open:s!==void 0,onClose:()=>h(void 0),actions:[{text:i("billing.manageOneTime.modal.submitText").toString(),onClick:u,disabled:l,variant:"primary"},{text:"Cancel",variant:"passiveOutline",disabled:l,onClick:()=>Promise.resolve(h(void 0))},{text:"Remove",variant:"passive",disabled:l,onClick:()=>Promise.resolve(c(!0))}],children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{children:i("billing.manageOneTime.modal.content")}),e.jsx(Q,{selectedPayment:s,ref:m})]})}),a&&s&&e.jsx(D,{title:i("billing.manageOneTime.confirmDelete.title",{accountNumber:s==null?void 0:s.account.accountNumber,address:s==null?void 0:s.account.propertyAddress.address1,associationName:s==null?void 0:s.account.associationName}).toString(),open:a,onClose:()=>c(void 0),actions:[{text:i("Confirm").toString(),onClick:p,disabled:l,variant:"primary"},{text:i("Cancel").toString(),onClick:()=>Promise.resolve(c(!1)),disabled:l,variant:"passiveOutline"}],children:e.jsx("p",{children:i("billing.manageOneTime.confirmDelete.content")})})]})}function H({className:r,paymentMethods:g,futurePayments:b=[],recurringPayments:x=[],refresh:s}){const h=I(),{t:a}=re(),[c,l]=j.useState(),[m,u]=j.useState(0),[p,f]=j.useState(0),[t,d]=j.useState([]),[n,N]=j.useState([]),v=async()=>{c&&(await q.deletePaymentMethod(c),s(),l(void 0))},R=o=>{l(o),u(b.filter(y=>{var X;return((X=y.paymentMethod)==null?void 0:X.id)===o}).length),f(x.filter(y=>{var X;return((X=y.paymentMethod)==null?void 0:X.id)===o}).length)};return j.useEffect(()=>{d(g.filter(o=>
1["creditCard","debitCard"].includes(o.paymentMethodType))),N(g.filter(o=>["ach","eCheck"].includes(o.paymentMethodType)))},[g]),h?e.jsxs("div",{className:K("space-y-8",r),children:[e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header",children:a("billing.managePayments.savedPaymentMethods")}),t.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-2 text-base-header",children:a("billing.managePayments.creditCards")}),e.jsx("ul",{className:"space-y-6 mobile:space-y-3","data-qa":"card-list",children:t.sort((o,y)=>o.paymentMethodType.length-y.paymentMethodType.length).map(o=>{var y,X,T;return e.jsxs("li",{className:"flex flex-col mobile:flex-row mobile:items-center justify-between py-4 rounded-lg gap-4 mobile:gap-0",children:[e.jsxs("div",{className:"flex items-center space-x-4 w-3/4",children:[e.jsx("div",{className:"w-12 h-12 bg-base-bg rounded flex items-center justify-center",children:e.jsx(w,{icon:oe,className:"text-xl text-base-fg"})}),e.jsxs("div",{className:"flex flex-col break-words",children:[o.card&&e.jsxs("span",{className:"font-medium text-base-fg","data-qa":"card-info",children:[a([`billing.cardType.${o.card.brand}`,"billing.cardType.default"])," ","XXXX-XXXX-XXXX-",(y=o.card)==null?void 0:y.last4]}),e.jsx("span",{className:"text-sm text-base-fg","data-qa":"card-expiration",children:a("billing.managePayments.expiration",{name:o.billingName?`${o.billingName} -`:"",date:(X=o.card)!=null&&X.expiration?A((T=o.card)==null?void 0:T.expiration,{format:"full",naive:!0}):""})})]})]}),e.jsx("div",{className:"flex items-center justify-center w-full mobile:max-w-32",children:e.jsx(C,{"data-qa":"remove-btn",variant:"dangerOutline",onClick:()=>R(o.id),className:"w-full flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 w-full justify-center",children:[e.jsx("p",{children:a("billing.managePayments.remove")}),e.jsx(w,{icon:E})]})})})]},o.id)})})]}),t.length>0&&n.length>0&&e.jsx("hr",{className:"border-base-border my-4"}),n.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-2 text-base-header","data-qa":"bank-list",children:a("billing.managePayments.accounts")}),e.jsx("ul",{className:"space-y-6 mobile:space-y-3","data-qa":"bank-list",children:n.map(o=>{var y;return e.jsxs("li",{className:"flex flex-col mobile:flex-row mobile:items-center justify-between py-4 rounded-lg gap-4 mobile:gap-0",children:[e.jsxs("div",{className:"flex items-center space-x-4 w-3/4",children:[e.jsx("div",{className:"w-12 h-12 bg-base-bg rounded flex items-center justify-center",children:e.jsx(w,{icon:ce,className:"text-xl text-base-fg"})}),e.jsxs("div",{className:"flex flex-col break-words",children:[o.bankAccount&&e.jsxs("span",{className:"font-medium text-base-fg","data-qa":"bank-info",children:[a(`billing.bankingType.${o.bankAccount.accountType}`)," ","XXXX-XXXX-XXXX-",(y=o.bankAccount)==null?void 0:y.last4]}),e.jsx("span",{className:"text-sm text-base-fg","data-qa":"billing-name",children:`${o.billingName}`})]})]}),e.jsx("div",{className:"flex items-center justify-center w-full mobile:max-w-32",children:e.jsx(C,{"data-qa":"remove-btn",variant:"dangerOutline",onClick:()=>R(o.id),className:"w-full flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 w-full justify-center",children:[e.jsx("p",{children:a("billing.managePayments.remove")}),e.jsx(w,{icon:E})]})})})]},o.id)})})]})]}),c&&e.jsx(D,{title:a("billing.managePayments.modal.title",{context:p>0||m>0?"with-payments":""}).toString(),open:c!==void 0,onClose:()=>l(void 0),actions:[{text:a("billing.managePayments.modal.submitText").toString(),onClick:v,variant:"primary"},{text:"Cancel",onClick:()=>Promise.resolve(l(void 0)),variant:"passiveOutline"}],children:e.jsx("p",{children:a("billing.managePayments.modal.content",{context:p>0||m>0?"with-payments":""})})})]}):e.jsxs("div",{className:K("space-y-8",r),children:[e.jsx(O,{i18nKey:"billing.managePayments.description"}),t.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header",children:a("billing.managePayments.savedCards")}),e.jsx("ul",{className:"space-y-4 md:ml-5","data-qa":"card-list",children:t.sort((o,y)=>o.paymentMethodType.length-y.paymentMethodType.length).map(o=>{var y,X,T;return e.jsxs("li",{className:"font-medium flex items-start justify-between flex-col sm:flex-row",children:[e.jsxs("span",{className:"flex flex-col text-base-fg",children:[o.card&&e.jsxs("span",{"data-qa":"card-info",children:[a([`billing.cardType.${o.card.brand}`,"billing.cardType.default"])," ","XXXX-XXXX-XXXX-",(y=o.card)==null?void 0:y.last4]}),e.jsx("span",{className:"font-normal","data-qa":"card-expiration",children:a("billing.managePayments.expiration",{name:o.billingName?`${o.billingName} -`:"",date:(X=o.card)!=null&&X.expiration?A((T=o.card)==null?void 0:T.expiration,{format:"full",naive:!0}):""})})]}),e.jsx(C,{"data-qa":"remove-btn",variant:"primaryLink",onClick:()=>R(o.id),children:a("billing.managePayments.remove")})]},o.id)})}),e.jsx("hr",{className:"border-base-border mt-6 md:ml-5"})]}),n.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"font-bold mb-3 text-base-header","data-qa":"bank-list",children:a("billing.managePayments.savedBankAccounts")}),e.jsx("ul",{className:"space-y-4 md:ml-5",children:n.map(o=>{var y;return e.jsxs("li",{className:"font-medium flex items-start justify-between flex-col sm:flex-row",children:[e.jsxs("span",{className:"flex flex-col text-base-fg",children:[o.bankAccount&&e.jsxs("span",{"data-qa":"bank-info",children:[a(`billing.bankingType.${o.bankAccount.accountType}`)," ","XXXX-XXXX-XXXX-",(y=o.bankAccount)==null?void 0:y.last4]}),e.jsx("span",{className:"font-normal text-small","data-qa":"billing-name",children:`${o.billingName}`})]}),e.jsx(C,{"data-qa":"remove-btn",variant:"primaryLink",onClick:()=>R(o.id),children:a("billing.managePayments.remove")})]},o.id)})}),e.jsx("hr",{className:"border-base-border mt-6 md:ml-5"})]}),c&&e.jsx(D,{title:a("billing.managePayments.modal.title",{context:p>0||m>0?"with-payments":""}).toString(),open:c!==void 0,onClose:()=>l(void 0),actions:[{text:a("billing.managePayments.modal.submitText").toString(),onClick:v,variant:"primary"},{text:"Cancel",onClick:()=>Promise.resolve(l(void 0)),variant:"passiveOutline"}],children:e.jsx("p",{children:a("billing.managePayments.modal.content",{context:p>0||m>0?"with-payments":""})})})]})}const Re={title:"Manage Account",showPropertySelector:!0,showAi:!1};async function Oe({request:r}){const g=await S.fetchQuery(ge),b=new URL(r.url),x=b.searchParams.get("accountNumber"),s=b.searchParams.get("subLedgerId"),h=g.find(u=>u.accountNumber===x&&u.subLedgerId===Number(s))??g[0],a=S.fetchQuery(xe({ownerId:h.ownerId,subLedgerId:h.subLedgerId})).then(u=>u.member),c=await S.fetchQuery(U).then(u=>u.paymentMethods),l=await S.fetchQuery($),m=await S.fetchQuery(P);return he({accounts:g,payments:a,paymentMethods:c,recurringPayments:l,futurePayments:m})}function Le(){const r=I(),{navigateToUrl:g}=de(),[b]=me(),x=ue(),{payments:s,paymentMethods:h,recurringPayments:a,futurePayments:c}=be(),l=b.get("accountNumber")??void 0,m=b.has("subLedgerId")?Number(b.get("subLedgerId")):void 0,u=new URLSearchParams;l&&u.set("accountNumber",l),typeof m=="number"&&u.set("subLedgerId",String(m));const p=`/billing${u.toString()?`?${u.toString()}`:""}`;return e.jsx(ye,{controller:"Homeowner_v2",action:"Billing",children:r?e.jsxs("div",{className:"flex flex-col tablet:flex-row mb-12 gap-6",children:[e.jsxs("main",{className:"tablet:w-2/3 p-horizontal-layout-sm tablet:p-horizontal-layout space-y-8 bg-base-fill rounded-xl",children:[e.jsx("div",{className:"text-base-header",children:e.jsx(O,{i18nKey:"billing.manageActions.manageYourPaymentsDescription"})}),e.jsx(W,{paymentMethods:h,recurringPayments:a,refresh:()=>{S.invalidateQueries({queryKey:$.queryKey}),x.revalidate()},onEditAutoDraft:()=>
1g("/Homeowner_v2/AutoDraftEnrollment","/billing/auto-draft")}),e.jsx(_,{scheduledPayments:c.filter(f=>f.futurePaymentType==="oneTime"),refresh:()=>{S.invalidateQueries({queryKey:P.queryKey}),x.revalidate()}}),e.jsx(H,{paymentMethods:h,futurePayments:c,recurringPayments:a,refresh:()=>{S.invalidateQueries({queryKey:U.queryKey}),x.revalidate()},"data-qa":"SavedPaymentMethod"})]}),e.jsxs("aside",{className:"p-horizontal-layout-sm tablet:p-horizontal-layout w-full tablet:w-2/5 bg-base-fill rounded-xl self-start tablet ",children:[e.jsx(j.Suspense,{children:e.jsx(B,{resolve:s,children:f=>e.jsx(V,{payments:f})})}),e.jsx("div",{className:"pl-3 pt-3",children:e.jsx(O,{i18nKey:"billing.manageActions.makePayment",components:{Link:e.jsx(J,{"data-qa":"billing-link",className:"text-base-link hover:underline",to:p})}})})]}),e.jsx(z,{accountNumber:l,subLedgerId:m})]}):e.jsxs("div",{className:"flex flex-col md:flex-row mb-12 bg-base-fill rounded-xl",children:[e.jsxs("main",{className:"md:w-2/3 p-horizontal-layout-sm sm:p-horizontal-layout space-y-8",children:[e.jsx(H,{paymentMethods:h,futurePayments:c,recurringPayments:a,refresh:()=>{S.invalidateQueries({queryKey:U.queryKey}),x.revalidate()},"data-qa":"SavedPaymentMethod"}),e.jsx(W,{paymentMethods:h,recurringPayments:a,refresh:()=>{S.invalidateQueries({queryKey:$.queryKey}),x.revalidate()},onEditAutoDraft:()=>
1g("/Homeowner_v2/AutoDraftEnrollment","/billing/auto-draft")}),e.jsx(_,{scheduledPayments:c.filter(f=>f.futurePaymentType==="oneTime"),refresh:()=>{S.invalidateQueries({queryKey:P.queryKey}),x.revalidate()}})]}),e.jsxs("aside",{className:"p-horizontal-layout-sm sm:p-horizontal-layout md:w-2/5",children:[e.jsx(j.Suspense,{children:e.jsx(B,{resolve:s,children:f=>e.jsx(V,{payments:f})})}),e.jsx("div",{className:"float-right pt-3 pr-3",children:e.jsx(O,{i18nKey:"billing.manageActions.makePayment",components:{Link:e.jsx(J,{"data-qa":"billing-link",className:"text-base-link hover:underline",to:p})}})})]}),e.jsx(z,{accountNumber:l,subLedgerId:m})]})})}export{Le as Component,Re as handle,Oe as loader};

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.