PageSourceSearch

https://user.flexischools.com.au/assets/AccountCloseScreen-qRzOV2ft.js

js flexischools.com.au collected 2026-09-24 09:57:04 UTC 13,892 bytes, 1 lines download raw bytes

1import{l as ce,r,j as e,bb as Le,bc as Te,bd as Oe,be as ke,bf as Ie,b as Me,t as _e,aC as De,bg as Q,bh as Y,bi as qe,bj as Ve,aM as C,bk as $e,bl as J,aZ as F,bm as Ee,bn as He,bo as Ue,bp as Ke,bq as X,br as ee,bs as We,B as L,L as T,bt as te,bu as se,bv as Ze,aV as O,bw as ze}from"./index-Dk2Wi9m9.js";import{F as b}from"./FieldValidationMessage-BgcxwS35.js";import{P as Qe}from"./PageHeader-Ct2P1bgc.js";import{F as k,a as P}from"./formik.esm-DN0dhIcN.js";import{O as M,S as o}from"./array-FQsuqnpP.js";import{u as ne,a as Ye,c as Je,b as Xe,d as et}from"./AccountQueries-vLSVSBlc.js";import{u as tt}from"./useGetUserProfile-MGykLouO.js";import{T as ae,t as ie}from"./react-toastify-WT8_8w1M.js";import{H as st}from"./Helmet-CGA59xYu.js";import{u as nt,A as at}from"./AppShell-DAcHz3H9.js";import{u as it}from"./useImpersonationData-7-qUPwR3.js";import{u as ct}from"./useQuery-BZaKDSvX.js";import{u as I}from"./useMutation-DJXEYZcB.js";import"./_getTag-BQ3D3QVa.js";import"./OpenInApp-BOhq_Chj.js";import"./faTimes-BnpiXKKO.js";import"./useIsomorphicLayoutEffect-CZhqd-3o.js";const g=n=>{const[p,v]=ce.useState(n.value);r.useEffect(()=>{v(n.value)},[n.value]);const N=d=>{const R=/^[0-9\b]+$/;d.target.value.length<=n.allowedLength&&((d.target.value===""||R.test(d.target.value))&&v(d.target.value),n.onChange(d))};return e.jsx(Le,{onChange:d=>N(d),onBlur:n.onBlur,type:"text",name:n.name,id:n.id,disabled:n.disabled,width:n.width,value:p})},B=n=>e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(ke,{name:n.name,id:n.id,type:"radio",value:n.value,onChange:n.onChange,disabled:n.disabled,checked:n.checked})}),e.jsx(Ie,{htmlFor:n.id,className:n.labelVisible?"":"sr-only",children:e.jsxs(e.Fragment,{children:[n.label,n.labelItalic&&e.jsxs("i",{children:[" ",` ${n.labelItalic}`]})]})})]}),lt=()=>M().shape({bsbPart1:o().required("BSB is required").length(3,"Has to be 3 digits"),bsbPart2:o().required("BSB is required").length(3,"Has to be 3 digits"),accountNumber:o().required("Account Number is required").min(6,"Account Number cannot be less than 6 digits").max(10,"Account Number cannot be more than 10 digits")}),ot=()=>M().shape({radioGroup:o().required("Select an Option")}),rt=()=>M().shape({radioGroup:o().required("Select an Option"),bsbPart1:o().when("radioGroup",{is:n=>n=="refund",then:o().required("BSB is required").length(3,"Has to be 3 digits")}),bsbPart2:o().when("radioGroup",{is:n=>n=="refund",then:o().required("BSB is required").length(3,"Has to be 3 digits")}),accountNumber:o().when("radioGroup",{is:n=>n=="refund",then:o().required("Account Number is required").min(6,"Account Number cannot be less than 6 digits").max(10,"Account Number cannot be more than 10 digits")})}),Pt=()=>{const[n,p]=r.useState(!1),[v,N]=r.useState(!0),[d,R]=r.useState(!0),[le,oe]=r.useState(!1),[re,de]=r.useState(!1),[_,D]=r.useState(""),[q,V]=r.useState(""),[$,E]=r.useState(""),[H,x]=r.useState(""),{brandConfiguration:{name:ue}}=Me(),{isAdmin:me}=nt(),{isImpersonated:be,pending:xe}=it(me),h=be||xe?JSON.parse(sessionStorage.getItem("targetUserKey")):_e.get(De),{data:y}=ne(h),{data:U}=tt(),K=ce.useRef(null),he=async t=>{await new C().show({title:"Donation successful",message:e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:$e.replace("<Amount>",f(t))}),e.jsx("br",{}),e.jsx(e.Fragment,{children:J})]}),okBtnLabel:"Ok",shouldHideCancelBtn:!0})&&F()},fe=async(t,s)=>{await new C().show({title:"Refund successful",message:e.jsx(e.Fragment,{children:t>0?s:"You don't have any balance to refund."}),okBtnLabel:"Ok",shouldHideCancelBtn:!0})&&F()},je=async()=>{await new C().show({title:"Details submitted",message:e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Ee}),e.jsx("br",{}),e.jsx(e.Fragment,{children:J})]}),okBtnLabel:"Ok",shouldHideCancelBtn:!0})&&F()},ge=async()=>{await new C().show({title:"Error",message:e.jsx(e.Fragment,{children:"We are unable to process your request right now. Please try again later."}),okBtnLabel:"Ok",shouldHideCancelBtn:!0})},{startPolling:pe,stopPolling:ve}=ct(Ye,{variables:{userKey:h}}),S=()=>{pe(1e3),setTimeout(()=>{ve()},1e3)},f=t=>t==null?void 0:t.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),ye=t=>e.jsx("div",{className:"h-10 p-5 rounded-xl font-bold text-white text-sm mb-3 flex justify-between items-center",children:t.display}),G=t=>{K.current=ie(e.jsx(ye,{display:t}),{draggable:!1,toastId:10,autoClose:1e4})},Ne=({headerText:t,displayMessage:s})=>e.jsxs("div",{className:"h-auto p-4 rounded-xl text-white text-sm mb-3 flex flex-col justify-start items-start",children:[e.jsx("div",{className:"font-bold py-1",children:t}),s.map(a=>e.jsx("div",{className:"font-normal py-1",children:a},a))]}),Se=(t,s)=>{K.current=ie(e.jsx(Ne,{headerText:t,displayMessage:s}),{draggable:!1,toastId:10,autoClose:!1,closeOnClick:!1})},[we,{loading:m}]=I(Je,{onCompleted:t=>{S(),he(t.closeAccountByDonation)},onError:()=>{G(ze),p(!0)}}),W=async()=>{const t=y.getUserAccount.accountKey,s=(await O()).payload["custom:toca_user_id"];we({variables:{userKey:h,userId:s,accountKey:t}})},[Ae,{loading:w}]=I(Xe,{onCompleted:()=>{S(),je()},onError:()=>{ge()}}),Z=async t=>{const s=(await O()).payload["custom:toca_user_id"],a=y.getUserAccount.accountKey,i=`${U.firstName} ${U.lastName}`;Ae({variables:{userKey:h,userId:s,accountKey:a,accountName:i,accountNumber:t.accountNumber,bsb:t.bsb}})};let j=0,z=0;const[Ce,{loading:A}]=I(et,{onCompleted:t=>{S(),z=t.closeAccountByRefundToSource.amountRefunded,j=t.closeAccountByRefundToSource.amountRefundFailed;const s=t.closeAccountByRefundToSource.refundDetails;let a;s.length>0&&(a=s.map(i=>{if(i.paymentMethodTypeName.match(/Paypal/i))return`$${f(i.amount)} ${Y} account ${i.paymentMethodReference}`.replace("<METHODTYPE>",i.paymentMethodTypeName);{const c=i.paymentMethodReference.substring(i.paymentMethodReference.length-4,i.paymentMethodReference.length);return`$${f(i.amount)} ${Y} ending in ${c}`.replace("<METHODTYPE>","card")}})),j===0||j<0?fe(s==null?void 0:s.length,a):z>0?(x(""),R(!1),oe(!0),Se(`${Ve}`,[...a,`${qe}`.replace("<Amount>",f(j))])):(p(!0),G(Q.replace("<Amount>",f(j))))},onError:()=>{S(),p(!0),G(Q.replace("<Amount>",f(j)))}}),Pe=async()=>{var a;const t=(await O()).payload["custom:toca_user_id"],s=(a=y==null?void 0:y.getUserAccount)==null?void 0:a.accountKey;Ce({variables:{userKey:h,userId:t,accountKey:s}})},Be=()=>{const{data:t}=ne(h);if(t&&t.getUserAccount){const a=parseFloat(t.getUserAccount.availableBalance).toFixed(2);Number(a)!==0?N(!1):(N(!0),x("refund"))}else x("refund");const s=a=>{x(a.currentTarget.value)};return e.jsx("div",{className:"p-2",children:e.jsx(k,{initialValues:{radioGroup:H},validationSchema:ot,onSubmit:(a,i)=>{i.setSubmitting(!0),a.radioGroup==="donate"?W():Pe(),i.setSubmitting(!1)},render:({handleSubmit:a,values:i,errors:c,touched:l,isSubmitting:u})=>e.jsxs("div",{children:[e.jsxs("div",{className:"block w-full",children:[e.jsx("div",{className:"text-md text-neutral-500 py-1",children:v?Ue:He}),e.jsx("div",{className:"text-md text-neutral-500 py-1",children:Ke})]}),e.jsxs("form",{onSubmit:a,children:[!v&&e.jsxs("div",{children:[e.jsx("div",{className:"text-md text-neutral-500 py-1 pb-2",children:X}),e.jsx("div",{className:"py-2",children:e.jsx(P,{component:B,name:"radioGroup",id:"donate",value:"donate",label:ee,labelVisible:!0,disabled:n||m||A,checked:i.radioGroup==="donate",onCh
1ange:s})}),e.jsx("div",{className:"py-2",children:e.jsx(P,{component:B,name:"radioGroup",id:"refund",value:"refund",label:We,labelVisible:!0,disabled:n||m||A,checked:i.radioGroup==="refund",onChange:s})})]}),e.jsx(b,{children:l&&c.radioGroup?c.radioGroup:""}),e.jsx("div",{className:"w-full mt-5 flex justify-center",children:e.jsx(L,{"datatest-id":"closeAccountbutton",size:"medium",type:"submit",disabled:n||m||A,children:"Close account"})}),e.jsx("div",{children:e.jsx(T,{loading:u||m||A})})]})]})})})},Re=()=>e.jsx("div",{children:e.jsx(k,{initialValues:{bsbPart1:"",bsbPart2:"",accountNumber:""},onSubmit:(t,s)=>{s.setSubmitting(!0),D(t.bsbPart1),V(t.bsbPart2),E(t.accountNumber);const a=t.bsbPart1+t.bsbPart2,i=t.accountNumber;Z({bsb:a,accountNumber:i}),s.setSubmitting(!1)},validationSchema:lt,children:t=>{const{errors:s,touched:a,handleChange:i,handleBlur:c,handleSubmit:l,isSubmitting:u}=t;return e.jsxs("div",{children:[e.jsx(ae,{pauseOnHover:!0,autoClose:5e3,closeButton:!1}),e.jsx("form",{onSubmit:l,children:e.jsxs("div",{children:[e.jsx("div",{children:e.jsx("div",{className:"text-md text-neutral-500 py-1",id:"accountCloseText",children:te})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"inline-flex w-full lg:w-[50%] py-3",children:[e.jsx("div",{className:"inline-flex  justify-end text-right items-center",children:e.jsx("label",{className:"text-md font-semibold text-neutral-500",children:"BSB:"})}),e.jsxs("div",{className:"inline-flex lg:w-[35%] ml-2 w-full",children:[e.jsxs("div",{children:[e.jsx(g,{name:"bsbPart1",id:"bsbPart1",value:_,onChange:i,onBlur:c,disabled:!1,width:"100px",allowedLength:3}),e.jsx(b,{children:s.bsbPart1&&a.bsbPart1&&e.jsx("div",{children:s.bsbPart1})})]}),e.jsx("div",{className:"inline-flex w-9 text-center justify-center items-center",children:e.jsx("label",{className:"font-semibold",children:"-"})}),e.jsxs("div",{children:[e.jsx(g,{name:"bsbPart2",id:"bsbPart2",value:q,onChange:i,onBlur:c,disabled:!1,allowedLength:3,width:"100px"}),e.jsx(b,{children:s.bsbPart2&&a.bsbPart2&&e.jsx("div",{children:s.bsbPart2})})]})]})]}),e.jsxs("div",{className:"inline-flex w-full lg:w-[50%] py-1 mb-3",children:[e.jsx("div",{className:"inline-flex items-center",children:e.jsx("label",{className:"text-md font-semibold text-neutral-500",children:"Account number:"})}),e.jsx("div",{className:"inline-flex lg:w-[35%] pl-1",children:e.jsxs("div",{children:[e.jsx(g,{name:"accountNumber",id:"accountNumber",value:$,onChange:i,onBlur:c,disabled:!1,allowedLength:10,width:"200px"}),e.jsx(b,{children:s.accountNumber&&a.accountNumber&&e.jsx("div",{children:s.accountNumber})})]})})]})]}),e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"text-md text-neutral-500 py-1",children:se})}),e.jsx("div",{className:"w-full lg:w-[70%] py-3 flex justify-center",children:e.jsx(L,{size:"large",type:"submit",disabled:u||w,children:"Submit"})}),e.jsx("div",{children:e.jsx(T,{loading:u||w})})]})})]})}})}),Ge=()=>{const t=s=>{x(s.currentTarget.value)};return e.jsx("div",{children:e.jsx(k,{initialValues:{radioGroup:H,bsbPart1:"",bsbPart2:"",accountNumber:""},validationSchema:rt,onSubmit:(s,a)=>{if(a.setSubmitting(!0),s.radioGroup==="refund"&&de(!0),D(s.bsbPart1),V(s.bsbPart2),E(s.accountNumber),x(s.radioGroup),s.radioGroup==="donate")W();else{const i=s.bsbPart1+s.bsbPart2,c=s.accountNumber;Z({bsb:i,accountNumber:c})}a.setSubmitting(!1)},render:({handleSubmit:s,handleChange:a,handleBlur:i,values:c,errors:l,touched:u,isSubmitting:Fe})=>e.jsx("div",{children:e.jsxs("form",{onSubmit:s,children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-md text-neutral-500 py-1",children:X}),e.jsx(P,{component:B,name:"radioGroup",id:"donate",value:"donate",label:ee,labelVisible:!0,disabled:n||m,checked:c.radioGroup==="donate",onChange:t}),e.jsx(P,{component:B,name:"radioGroup",id:"refund",value:"refund",label:Ze,labelVisible:!0,disabled:n||m,checked:c.radioGroup==="refund",onChange:t})]}),e.jsx(b,{children:u.radioGroup&&l.radioGroup?l.radioGroup:""}),(re||c.radioGroup==="refund")&&e.jsxs("div",{children:[e.jsx("div",{children:e.jsx("div",{className:"text-md text-neutral-500 py-1",id:"accountCloseText",children:te})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"inline-flex w-full lg:w-[50%] py-3",children:[e.jsx("div",{className:"inline-flex  justify-end text-right items-center",children:e.jsx("label",{className:"text-md font-semibold text-neutral-500",children:"BSB:"})}),e.jsxs("div",{className:"inline-flex lg:w-[35%] ml-2 w-full",children:[e.jsxs("div",{children:[e.jsx(g,{name:"bsbPart1",id:"bsbPart1",value:_,onCh
1ange:a,onBlur:i,disabled:!1,width:"100px",allowedLength:3}),e.jsx(b,{children:l.bsbPart1&&u.bsbPart1&&e.jsxs("div",{children:[l.bsbPart1," "]})})]}),e.jsx("div",{className:"inline-flex w-9 text-center justify-center items-center",children:e.jsx("label",{className:"font-semibold",children:"-"})}),e.jsxs("div",{children:[e.jsx(g,{name:"bsbPart2",id:"bsbPart2",value:q,onChange:a,onBlur:i,disabled:!1,allowedLength:3,width:"100px"}),e.jsx(b,{children:l.bsbPart2&&u.bsbPart2&&e.jsxs("div",{children:[" ",l.bsbPart2," "]})})]})]})]}),e.jsxs("div",{className:"inline-flex w-full lg:w-[50%] py-1 mb-3",children:[e.jsx("div",{className:"inline-flex items-center",children:e.jsx("label",{className:"text-md font-semibold text-neutral-500",children:"Account number:"})}),e.jsx("div",{className:"inline-flex lg:w-[35%] pl-1",children:e.jsxs("div",{children:[e.jsx(g,{name:"accountNumber",id:"accountNumber",value:$,onChange:a,onBlur:i,disabled:!1,allowedLength:10,width:"200px"}),e.jsx(b,{children:l.accountNumber&&u.accountNumber?e.jsx("div",{children:l.accountNumber}):""})]})})]})]}),e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"text-md text-neutral-500 py-1",children:se})})]}),e.jsx("div",{className:"w-full mt-5 flex justify-center",children:e.jsx(L,{size:"medium",type:"submit",disabled:w||m,children:"Close account"})}),e.jsx("div",{children:e.jsx(T,{loading:Fe||w||m})})]})})})})};return e.jsx(at,{children:e.jsxs(e.Fragment,{children:[e.jsxs(st,{children:[ue," - Close Account"]}),e.jsxs("div",{className:"text-justify p-4",children:[e.jsx(Qe,{children:"Close account"}),e.jsx("div",{className:"flex flex-col flex-wrap w-full",children:e.jsxs("div",{className:"flex flex-col w-full p-2 flex-wrap",children:[d&&e.jsx(Be,{}),n&&e.jsx(Re,{}),le&&e.jsxs("div",{children:[e.jsx(ae,{pauseOnHover:!0,autoClose:!1,closeButton:!1,closeOnClick:!1}),e.jsx(Ge,{})]})]})})]})]})})};export{Pt 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.