PageSourceSearch

https://www.income.com.sg/assets/js/widgets/oa-donation/oa-donatio…YZQva_-XchZBQ4NCx-w9I2cHso3-r4EdvC-SQWLlLJU

js income.com.sg collected 2026-09-24 09:16:02 UTC 8,242 bytes, 1 lines download raw bytes

1import{R as me}from"../../../../vendor/react-mount.js";import{r as a,j as e}from"../../../../vendor/react-vendors.js";import{B as S}from"../../../../vendor/button.js";import{F as i}from"../../../../vendor/form-field.js";import{D as s}from"../../../../vendor/dropdown.js";import{s as pe,v as he,i as fe,a as ye}from"../../../../vendor/helper.js";import{I as P}from"../../../../vendor/input-number.js";import{I as ve}from"../../../../vendor/icon.js";import{p as xe}from"../../../../vendor/purify.es.js";import{c as ge}from"../../../../vendor/index.js";import{R as Ne}from"../../../../vendor/recaptcha-wrapper.js";const je=({type:m="general",errorUrl:I,nricFinErrorMessage:W="Please enter a valid NRIC/FIN",emailErrorMessage:Y="Please fill in a valid email",contactNoErrorMessage:H="Please fill in a valid number",footerContent:J,thankYouImage:G="assets/images/widgets/advisor-connect/thank-you-page.svg",baseUrl:K=window.location.origin,token:Q,isReadOnly:X="false",reCaptchaSiteKey:Z})=>{const ee=["Claim tax deduction","Skip tax deduction"],oe=["NRIC","FIN"],ne=["Roundup to nearest $1","Roundup to nearest $5","Roundup to nearest $10","Other donation amount, please specify"],te=["$5","$10","Others"],ae=pe(X,"boolean",!1),R=a.useRef(null),[v,O]=a.useState("Claim tax deduction"),[x,$]=a.useState(""),[g,T]=a.useState(""),[c,F]=a.useState(""),[d,w]=a.useState(""),[u,M]=a.useState(""),[N,E]=a.useState(),[l,A]=a.useState(""),[V,U]=a.useState(""),[L,_]=a.useState(""),[h,j]=a.useState([{policyNumber:"",regularPremium:void 0,roundUp:"",otherDonation:void 0}]),[ie,q]=a.useState(!1),[z,B]=a.useState(!1),k=a.useMemo(()=>he(u),[u]),C=a.useMemo(()=>fe(c),[c]),D=a.useMemo(()=>ye(d),[d]),se=a.useMemo(()=>{const n=m==="life"?h.every(y=>y.policyNumber&&y.regularPremium&&y.roundUp&&(y.roundUp==="Other donation amount, please specify"?y.otherDonation:!0)):l&&(l==="Others"?N:!0);return x&&(!!u&&k)&&(v==="Claim tax deduction"?g&&c&&C:!0)&&(!!d&&D)&&n},[m,x,h,l,N,v,d,D,u,k,c,C]),re=()=>{j(o=>[...o,{policyNumber:"",regularPremium:void 0,roundUp:"",otherDonation:void 0}])},le=o=>{j(n=>n.filter((t,r)=>r!==o))},b=(o,n,t)=>{j(r=>r.map((p,f)=>f===o?{...p,[n]:t}:p))},ce=()=>{O("Claim tax deduction"),$(""),T(""),F(""),w(""),M(""),E(void 0),A(""),U(""),_(""),j([{policyNumber:"",regularPremium:void 0,roundUp:"",otherDonation:void 0}])},de=()=>{const o=[{key:"Name",value:x},{key:"Deduction",value:v},{key:"IDType",value:g},{key:"NRICFIN",value:c},{key:"ContactNo",value:d},{key:"Email",value:u}];if(m==="life"){const n=h.flatMap((t,r)=>[{key:`PolicyNumber${r+1}`,value:t.policyNumber},{key:`RegularPremiumBeforeDonation${r+1}`,value:String(t.regularPremium??"")},{key:`RoundupPremium${r+1}`,value:t.roundUp},{key:`OtherDonationAmountsPleaseSpecify${r+1}`,value:String(t.otherDonation??"")}]);return[...o,...n]}return[...o,{key:"PolicyNumber",value:L},{key:"donation_amount",value:l==="Others"?String(N??""):l.replace("$","")},{key:"staff_agent_code",value:V}]},ue=async o=>{o.preventDefault();const n=m==="life"?"/api/kentico-form/submit?formName=OA_Donation_Life":"/api/kentico-form/submit-oa-donation?formName=oa_donation";try{B(!0);const t=await R.current.executeAsync(),r={requestPayload:de(),recaptcha:t},p=await fetch(`${K}${n}`,{method:"POST",headers:{"Content-Type":"application/json",RequestVerificationToken:Q},body:JSON.stringify(r)});if(!p.ok)throw new Error("Failed to submit feedback");const f=await p.json();if(!f)throw Error;m==="life"?(q(!0),ce(),window.scrollTo({top:0,left:0,behavior:"smooth"})):window.location=f.paymentUrl}catch(t){I&&(window.location=I),console.error("Error:",t)}finally{B(!1)}};return ie?e.jsxs("div",{className:"oa-donation-thank-you",children:[e.jsx("div",{className:"oa-donation-thank-you-image",children:e.jsx("img",{alt:"thankyou-image",src:G})}),e.jsxs("div",{className:"oa-donation-thank-you-content",children:[e.jsx("div",{className:"font-title",children:" Thank you"}),e.jsx("div",{children:"We received your details. "}),e.jsx(S,{onClick:()=>{q(!1)},style:"link",size:"default",children:"Send another donation"})]})]}):e.jsxs("form",{className:ge("oa-donation",{"pointer-events-none":ae}),onSubmit:ue,children:[e.jsx(i,{id:"tax-deduction",infoMessage:"A valid full NRIC is required for auto-inclusion for tax deduction purposes",children:ee.map(o=>e.jsxs("div",{className:"form-check",children:[e.jsx("input",{className:"form-check-input",type:"radio",name:"tax-deduction",checked:v===o,onChange:()=>O(o),id:`tax-deduction-${o}`}),e.jsx("label",{className:"form-check-label font-body",htmlFor:`tax-deduction-${o}`,children:o})]},o))}),e.jsx(i,{label:"Full name as per NRIC",id:"full-name",children:e.jsx("input",{value:x,onChange:o=>$(o.target.value),type:"text",className:"form-control",id:"full-name",placeholder:" "})}),e.jsx(i,{label:"ID Type",id:"id-type",children:e.jsxs(s,{variant:"underline",children:[e.jsx(s.Toggle,{children:g||"Select"}),e.jsx(s.Menu,{children:oe.map(o=>e.jsx(s.Menu.Item,{onClick:()=>T(o),isActive:o===g,children:o},o))})]})}),e.jsx(i,{label:"NRIC/FIN",id:"nric-fin",isError:c&&!C,errorMessage:W,children:e.jsx("input",{value:c,onChange:o=>F(o.target.value),type:"text",className:"form-control",id:"nric-fin",placeholder:" "})}),e.jsx(i,{label:"Contact No.",id:"contact-no",errorMessage:H,isError:d&&!D,children:e.jsx("input",{value:d,onChange:o=>
1w(o.target.value),type:"text",className:"form-control",id:"contact-no",placeholder:" "})}),e.jsx(i,{label:"Email",id:"email",errorMessage:Y,isError:u&&!k,children:e.jsx("input",{value:u,onChange:o=>M(o.target.value),type:"email",className:"form-control",id:"email",placeholder:" "})}),m==="life"?e.jsxs("div",{className:"donation-policies",children:[h.map((o,n)=>e.jsxs("div",{className:"donation-policy-row",children:[e.jsx(i,{label:"Policy Number",id:`policy-number-${n}`,children:e.jsx("input",{value:o.policyNumber,onChange:t=>b(n,"policyNumber",t.target.value),type:"text",className:"form-control",id:`policy-number-${n}`,placeholder:" "})}),e.jsx(i,{label:"Regular Premium before donation",id:`regular-premium-${n}`,children:e.jsx(P,{value:o.regularPremium,onChange:t=>b(n,"regularPremium",t),id:`regular-premium-${n}`,integerOnly:!0})}),e.jsx(i,{label:"Roundup premium",id:`roundup-premium-${n}`,children:e.jsxs(s,{variant:"underline",children:[e.jsx(s.Toggle,{children:o.roundUp||"Select"}),e.jsx(s.Menu,{children:ne.map(t=>e.jsx(s.Menu.Item,{onClick:()=>b(n,"roundUp",t),isActive:t===o.roundUp,children:t},t))})]})}),o.roundUp==="Other donation amount, please specify"&&e.jsx(i,{label:"Other donation amounts",id:`other-donation-${n}`,children:e.jsx(P,{value:o.otherDonation,onChange:t=>b(n,"otherDonation",t),id:`other-donation-${n}`,integerOnly:!0})}),h.length>1&&e.jsx("div",{className:"text-end",children:e.jsx("a",{onClick:()=>le(n),className:"surgery-remove fw-bold text-color-secondary cursor-pointer font-body-sm",children:"Remove"})})]},n)),e.jsxs(S,{onClick:()=>re(),className:"btn btn-sm btn-outline-secondary",style:"link",children:[e.jsx(ve,{iconName:"plus"}),"Add another donation for another policy"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"Policy Number (Optional)",id:"policy-number",children:e.jsx("input",{value:L,onChange:o=>_(o.target.value),type:"text",className:"form-control",id:"policy-number",placeholder:" "})}),e.jsx(i,{label:"Donation amount",id:"donation-amount",children:e.jsxs(s,{variant:"underline",children:[e.jsx(s.Toggle,{children:l||"Select"}),e.jsx(s.Menu,{children:te.map(o=>e.jsx(s.Menu.Item,{onClick:()=>A(o),isActive:o===l,children:o},o))})]})}),l==="Others"&&e.jsx(i,{label:"Other donation amounts",id:"other-donation",children:e.jsx(P,{value:N,onChange:E,id:"other-donation",integerOnly:!0})}),e.jsx(i,{label:"Staff Agent Code (Optional)",id:"staff-agent-code",children:e.jsx("input",{value:V,onChange:o=>U(o.target.value),type:"text",className:"form-control",id:"staff-agent-code",placeholder:" "})})]}),e.jsx("div",{dangerouslySetInnerHTML:{__html:xe.sanitize(J)}}),e.jsx(Ne,{ref:R,sitekey:Z,size:"invisible",className:"d-none"}),e.jsxs(S,{style:"primary",type:"submit",disabled:!se||z,className:"oa-donation-submit-button",children:[z?"Loading...":"Submit"," "]})]})};document.addEventListener("DOMContentLoaded",()=>{me({id:"#oa-donation",Component:je})});

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.