PageSourceSearch

https://tallyedge.com/assets/linkedAccounts-DfFO_iN_.js

js tallyedge.com collected 2026-10-08 20:33:50 UTC 29,317 bytes, 1 lines download raw bytes

1import{d as Y,l as ie,j as e,s as t,y as D,D as b,Y as X,u as Z,h as G,c as Q,r as x,B as ee,z as O,S as se,E as ce,e as xe}from"./index-qQgvnTkz.js";import{A as ue}from"./addAccountButton-Cif6IV5K.js";import{L as he}from"./loadingOverlay-CDcBL4yo.js";import{u as B,a as F}from"./userAccessHelpers-C2yjdQ3n.js";import{a as P}from"./accountsAPI-ByeE23UO.js";import{d as Re,e as Ce,f as pe,h as Ae}from"./groupRTAAccounts-B_X8LW66.js";import{P as te}from"./promptModal-CsoiGcDC.js";import{F as le,p as ne}from"./Image-DcppbNa4.js";import{t as v}from"./maskDataHelper-Be0NAG3R.js";/* empty css             *//* empty css              */import{g as de,A as Ne,G as oe,r as q}from"./amcAccountComponent-Ced_Ei_J.js";import{A as re}from"./actionLoader-5rMTHwTo.js";import{S as me}from"./statusPromptModal-KZGX2F7p.js";import{O as $}from"./outlineButton-CQs_NSoE.js";import{r as z}from"./linkedAccount-DAbY9oTb.js";import{K as W}from"./keyValueElem-865nS7_r.js";import"./solidButton-m3zrPC83.js";/* empty css                     */import"./Button-lqCxqtut.js";const fe=({elem:s})=>{const{translate:h}=Y(),{theme:R}=ie();return R!=null&&R.MOBILE?e.jsxs("div",{className:"d-flex flex-column w-100 mt-3 px-3",children:[e.jsxs("div",{className:"flex-row p-1",children:[e.jsxs("label",{className:"fw-light",htmlFor:s.accountReferenceNumber,children:[de(s.fiType),":"]}),e.jsx("label",{className:"ms-1",style:{color:"#222222"},htmlFor:s.accountReferenceNumber,children:v(s.maskedAccountNumber.split("-")[1],16)})]}),e.jsxs("div",{className:"flex-row px-1 pb-1",style:{borderBottom:"0.083rem solid #C4C4C4"},children:[e.jsxs("label",{className:"fw-light",htmlFor:s.accountReferenceNumber,children:[h(t.ACCOUNT_TYPE),":"]}),e.jsx("label",{className:"ms-1",style:{color:"#222222"},htmlFor:s.accountReferenceNumber,children:s.hasOwnProperty("accountType")&&D(s)})]}),e.jsxs("div",{className:"d-flex flex-column align-self-start justify-self-end",children:[e.jsxs("div",{className:"d-flex flex-row px-1 my-1",style:{maxHeight:"2.5rem",overflow:"hidden"},children:[e.jsx("span",{className:"fw-light",children:h(t.LINKED_BY)}),e.jsx("span",{className:"ms-1",style:{color:"#222222",overflowWrap:"anywhere"},children:b(s.linkedBy,30)})]}),e.jsxs("div",{className:"d-flex flex-row px-1 my-1",children:[e.jsxs("div",{className:"fw-light",children:[" ",h(t.LINKED_ON)]}),e.jsx("div",{className:"ms-1",style:{color:"#222222"},children:X(s.linkedAt)})]})]}),e.jsx("div",{style:{borderBottom:"0.083rem solid #a1a1a1",marginLeft:"-1.25rem",marginRight:"-1.25rem"}})]}):e.jsxs("div",{className:"d-flex w-100 mb-2 pb-2",style:{borderBottom:"0.083rem solid #A1A1A1"},children:[e.jsxs("div",{className:"d-flex flex-column px-3",style:{flex:1.5},children:[e.jsxs("div",{className:"flex-row p-1",children:[e.jsxs("label",{className:"fw-light",htmlFor:s.accountReferenceNumber,children:[de(s.fiType),":"]}),e.jsx("label",{className:"ms-1",style:{color:"#222222"},htmlFor:s.accountReferenceNumber,children:v(s.maskedAccountNumber.split("-")[1],16)})]}),e.jsxs("div",{className:"flex-row p-1",children:[e.jsxs("label",{className:"fw-light",htmlFor:s.accountReferenceNumber,children:[h(t.ACCOUNT_TYPE),":"]}),e.jsx("label",{className:"ms-1",style:{color:"#222222"},htmlFor:s.accountReferenceNumber,children:s.hasOwnProperty("accountType")&&D(s)})]})]}),e.jsxs("div",{className:"d-flex flex-column ps-3 align-self-start justify-self-end p-1",style:{borderLeft:"0.0625rem solid #A1A1A1",flex:1},children:[e.jsxs("div",{className:"d-flex flex-row px-1 mb-1",style:{maxHeight:"2.5rem",overflow:"hidden"},children:[e.jsx("span",{className:"fw-light",children:h(t.LINKED_BY)}),e.jsx("span",{className:"ms-1",style:{color:"#222222",overflowWrap:"anywhere"},children:b(s.linkedBy,30)})]}),e.jsxs("div",{className:"d-flex flex-row px-1 mt-1",children:[e.jsxs("div",{className:"fw-light",children:[" ",h(t.LINKED_ON)]}),e.jsx("div",{className:"ms-1",style:{color:"#222222"},children:X(s.linkedAt)})]})]})]})};function _e({closeModal:s,amcName:h,rtaName:R,accountsList:I=[],formRefresh:d,unlink:l=!0}){const a=Z();G();const{sendRequestAndHandleSession:S}
1=Q(),[f,C]=x.useState(I),[u,g]=x.useState([]),[y,A]=x.useState(!1),[c,N]=x.useState({showModal:!1,triggerRequest:!1}),[_,n]=x.useState(!0),{translate:r}=Y(),[E,T]=x.useState({Heading:r(t.UNLINKED_SUCCESSFULLY),body:r(t.UNLINKED_SUCCESSFULLY_BODY),status:"success"}),U=ee();h=b(h,40),R=b(R,40);const k=x.useRef(null),p=x.useRef(!1),M=async o=>{const L=await Promise.all(o),{errors:i,responses:j}=L.reduce((w,m)=>(m.error&&w.errors.push(m.error),m.success&&w.responses.push(m.success),w),{errors:[],responses:[]});return{errors:i,responses:j}},K=()=>p.current?f.map(o=>S({linkReferenceNumber:o.linkReferenceNumber},P.delink,null,null,!0)):[...u].map(o=>S({linkReferenceNumber:o},P.delink,null,null,!0)),H=async()=>{const o=p!=null&&p.current?f==null?void 0:f.length:(u==null?void 0:u.length)??0;A(!0);let{responses:L,errors:i}=await M(K()),j=f;const w=u;if(L&&(L==null||L.forEach(m=>{if(m!=null&&m.error){i.push(m.error);return}let V=f.findIndex(J=>J.linkReferenceNumber===m.linkReferenceNumber);w.includes(m.linkReferenceNumber)&&w.splice(w.indexOf(m.linkReferenceNumber),1),j.splice(V,1)})),i&&(i==null?void 0:i.length)!==0){let m=!0;const V=(i==null?void 0:i.length)===1?O(r(t.ERROR_PARTIAL_UNLINK_BODY_SINGULAR),{"{totalAccounts}":o}):O(r(t.ERROR_PARTIAL_UNLINK_BODY),{"{numAccounts}":i==null?void 0:i.length,"{totalAccounts}":o});for(let J in i)if(i[J].code!==se.ACCOUNT_NOT_FOUND_ERROR){m=!1;break}T((i==null?void 0:i.length)===o?{Heading:r(t.ERROR_UNLINK_FAILED_LABEL),body:r(m?t.ERROR_ACCOUNT_ALREADY_UNLINKED:p.current?t.ERROR_UNLINK_ALL_FAILED_DESCRIPTION:t.ERROR_UNLINK_FAILED_DESCRIPTION),status:"error"}:{Heading:r(t.PARTIAL_UNLINK),body:V,status:"error"})}else T({Heading:r(t.UNLINKED_SUCCESSFULLY),body:r(p.current?t.UNLINKED_ALL_SUCCESSFULLY_BODY:t.UNLINKED_SUCCESSFULLY_BODY),status:"success"});C(m=>[...j]),g(w),n(!1),N(m=>({...m,triggerRequest:!1})),j.length===0&&(k.current=async()=>{await d()}),A(!1)},ae=()=>{H(),N(o=>({...o,triggerRequest:!1}))};return e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-dialog modal-dialog-centered modal-dialog-custom-desktop mobile-small-height-modal-dialog",children:e.jsxs("div",{className:"modal-content mobile-small-height-modal-content",style:{borderRadius:"0.625rem"},children:[e.jsxs("div",{className:"modal-header justify-content-between modal-header-custom",children:[e.jsxs("div",{className:"d-flex flex-row align-self-center justify-items-center align-items-center",children:[e.jsx(le,{imagePath:`fipLogos/${ne(R,U)}`,style:{height:"2rem",width:"2rem"}}),e.jsx("span",{className:"modal-title ms-3 modal-title-custom",children:R})]}),y?null:e.jsx("img",{src:"/graphics/utils/close-icon.svg",alt:"Close Icon",style:{cursor:"pointer"},onClick:async()=>{l&&await d(),s(!0)}})]}),e.jsxs("div",{className:"modal-body overflow-auto align-items-start modal-body-custom",children:[e.jsx("span",{className:"amc-name-text",children:h.toLowerCase()}),e.jsx("div",{className:"mt-3 mb-1 flex-column d-flex align-self-start",style:{width:"90%"},children:e.jsx(Ne,{list:f,DetailsDisplayComponent:fe,checkboxCtx:{id:"linkReferenceNumber",selectedCheckBox:u,visible:l,style:{height:"20px",width:"20px",alignSelf:"center"},conditionalVisibility:()=>!0,onCheckCB:o=>{g(L=>{if(L.includes(o.linkReferenceNumber)){let i=L.indexOf(o.linkReferenceNumber);return L.splice(i,i+1),[...L]}else return[...L,o.linkReferenceNumber]})}}})})]}),e.jsxs("div",{className:`d-flex flex-row justify-content-end w-100 pb-2 align-self-center px-4 gap-5 ${l?"border-top modal-buttons-container":""}`,children:[l&&!y&&e.jsx($,{className:`mt-2 ${(u==null?void 0:u.length)===0?"disabled":""}`,style:{fontSize:"0.875rem"},label:r(t.UNLINK_SELECTED_ACCOUNTS),disabled:!(u!=null&&u.length),onClick:()=>{if(u.length>0){p.current=!1,N(o=>({...o,showModal:!0}));return}a.show(r(t.ERROR_NO_ACCOUNT_SELECTED_TO_UNLINK),a.AlertTypes.ERROR)}}),l&&!y&&e.jsx($,{className:"mt-2",style:{fontSize:"0.875rem"},label:r(t.UNLINK_ALL_ACCOUNTS),onClick:()=>{p.current=!0,N(o=>({...o,showModal:!0}))}}),y&&e.jsx(re,{styleClass:"mt-2",small:!0})]})]})}),c.showModal&&e.jsx(te,{handleModal:N,submitButtonCB:ae,headerText:O(r(t.UNLINK_AMC_ACCOUNT_HEADER),{"{amcName}":h}).toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),bodySubText:r(p!=null&&p.current?t.UNLINK_ALL_AMC_ACCOUNT_BODY:t.UNLINK_AMC_ACCOUNT_BODY),bodyText:r(t.CONFIRM),backButtonText:r(t.BUTTON_NO),submitButtonText:r(t.BUTTON_YES)}),!_&&e.jsx(me,{status:E.status,headerText:E==null?void 0:E.Heading,bodyText:E==null?void 0:E.body,buttonText:r(t.BUTTON_OK),closeModal:n,onButtonClick:k.current,headerStyle:{marginTop:"20px"}})]})}function ye({amcObject:s,setLoader:h,fetchLinkedAccounts:R}){var T;const{sendRequestAndHandleSession:I}=Q(),[d]=G(),l=Z(),[a,S]=x.useState({showModal:!1,triggerRequest:!1}
1),[f,C]=x.useState(!1),[u,g]=x.useState(!0),[y,A]=x.useState(!0),{translate:c}=Y(),N=ee();let _={};B(F.delink,d==null?void 0:d.userData.user.accessCode)||(_={backgroundColor:"#efefef",color:"#909090",borderColor:"#C4C4C4"});const n=()=>B(F.delink,d==null?void 0:d.userData.user.accessCode)?!0:(l.show(c(t.ERROR_ACCESS_DENIED),l.AlertTypes.ERROR),!1),r=async()=>{n()&&(C(!0),A(!0),s.accounts.length>1&&g(!1),S(U=>({...U,showModal:!0})),C(!1))};async function E(){var k,p,M,K,H;C(!0);let U=await I({linkReferenceNumber:s.accounts[0].linkReferenceNumber},P.delink);if(U.hasOwnProperty(z.SUCCESS))if(U.success.hasOwnProperty(z.ERROR)){const ae=(K=oe((k=U==null?void 0:U.success)==null?void 0:k.error,(M=(p=s==null?void 0:s.accounts)==null?void 0:p[0])==null?void 0:M.name,q.UNLINK))==null?void 0:K.message;l.show(ae,l.AlertTypes.ERROR)}else l.show(c(t.DELINK_SUCCESSFUL),l.AlertTypes.SUCCESS),R();else((H=U==null?void 0:U.error)==null?void 0:H.code)===se.ACCOUNT_NOT_FOUND_ERROR?l.show(c(t.ERROR_ACCOUNT_ALREADY_UNLINKED),l.AlertTypes.ERROR):l.show(O(c(t.ERROR_ACCOUNT_ACTION_FAILURE),{"{requestAction}":q.UNLINK}),l.AlertTypes.ERROR);C(!1)}return e.jsxs("div",{className:"d-flex flex-row gap-2 rounded-3 mt-4 w-75 justify-content-start align-self-start linked-account-elem",style:{fontSize:"0.875rem",minWidth:"50rem"},children:[e.jsx("div",{className:"p-3 text-center",style:{minWidth:"10%",fontSize:"1.25rem",backgroundColor:"#E9F9FA"},children:e.jsx(le,{imagePath:`fipLogos/${ne(s.accounts[0].name,N)}`,style:{height:"3.5rem",width:"3.5rem"}})}),e.jsxs("div",{className:"d-flex flex-column px-2 p-2 my-2 text-start gap-2 border-end",style:{minWidth:"45%",width:"45%"},children:[e.jsxs("div",{className:"d-flex flex-row gap-1",children:[e.jsx("span",{className:"fw-bold",children:b(s.accounts[0].name,20)}),"|",e.jsx("span",{className:"fw-bold",style:{textTransform:"capitalize"},children:b(s.amcName,20)})]}),e.jsxs("span",{children:[s.accounts[0].hasOwnProperty("accountType")&&((T=s.accounts[0])==null?void 0:T.accountType)!=="DEFAULT"&&D(s.accounts[0])+" | ",s.accounts[0].hasOwnProperty("fiType")&&D(s.accounts[0])+" | ",e.jsxs("span",{className:"fw-bolder",children:[v(s.accounts[0].maskedAccountNumber.split("-")[1],16),s.accounts.length>1?"...":""]}),s.accounts.length>1&&e.jsx("span",{className:"ms-1 more-accounts",onClick:()=>{A(!1),g(!1)},children:O(c(t.MORE_ACCOUNTS),{"{numAccounts}":s.accounts.length-1})})]})]}),e.jsxs("div",{className:"d-flex flex-column justify-content-center px-2 p-2 mx-1 my-2 w-25 border-end",children:[e.jsx(W,{keyName:`${c(t.LINKED_ON)} `,value:X(s.accounts[0].linkedAt)}),e.jsx(W,{keyName:c(t.LINKED_BY),value:b(s.accounts[0].linkedBy,20),valueStyleClass:"value-text-lc fw-bold"})]}),e.jsxs("div",{className:"d-flex px-2 p-3",style:{minWidth:"15%",width:"15%"},children:[!f&&e.jsx($,{label:c(t.BUTTON_UNLINK_ACCOUNT),className:"align-self-center",onClick:r,style:{minHeight:"2rem",height:"auto",..._}}),f&&e.jsx(re,{})]}),a.showModal&&s.accounts.length===1&&e.jsx(te,{handleModal:S,submitButtonCB:E,headerText:O(c(t.UNLINK_FIP_ACCOUNT_HEADER),{"{fipName}":s.accounts[0].name}),subHeaderText:D(s.accounts[0])+" | "+v(s.accounts[0].maskedAccountNumber.split("-")[1],16),bodySubText:O(c(t.DELINK_ACCOUNT_DESC),{"{FIP}":s.accounts[0].name}),bodyText:c(t.CONFIRM),backButtonText:c(t.BUTTON_NO),submitButtonText:c(t.BUTTON_YES),setLoader:h}),!u&&e.jsx(_e,{amcName:s.amcName,rtaName:s.accounts[0].name,closeModal:g,accountsList:s.accounts,formRefresh:R,unlink:y})]})}function Ee({account:s,setLoader:h,fetchLinkedAccounts:R}){const{sendRequestAndHandleSession:I}=Q(),[d]=G(),l=Z(),{translate:a}=Y(),[S,f]=x.useState({showModal:!1,triggerRequest:!1}),[C,u]=x.useState(!1),g=ee();let y={};B(F.delink,d==null?void 0:d.userData.user.accessCode)||(y={backgroundColor:"#efefef",color:"#909090",borderColor:"#C4C4C4"});const A=()=>{B(F.delink,d==null?void 0:d.userData.user.accessCode)?f(n=>({...n,showModal:!0})):l.show(a(t.ERROR_ACCESS_DENIED),l.AlertTypes.ERROR)};async function c(){var r,E,T;h(!0);let n=await I({linkReferenceNumber:s.linkReferenceNumber},P.delink);if(n.hasOwnProperty(z.SUCCESS))if(n.success.hasOwnProperty(z.ERROR)){const U=(E=oe((r=n==null?void 0:n.success)==null?void 0:r.error,s==null?void 0:s.name,q.UNLINK))==null?void 0:E.message;l.show(U,l.AlertTypes.ERROR)}else l.show(a(t.DELINK_SUCCESSFUL),l.AlertTypes.SUCCESS),R();else((T=n==null?void 0:n.error)==null?void 0:T.code)===se.ACCOUNT_NOT_FOUND_ERROR?(l.show(a(t.ERROR_ACCOUNT_ALREADY_UNLINKED),l.AlertTypes.ERROR),R()):l.show(O(a(t.ERROR_ACCOUNT_ACTION_FAILURE),{"{requestAction}":q.UNLINK}),l.AlertTypes.ERROR);h(!1)}const N=()=>{c(),f(n=>({...n,showModal:!1,triggerRequest:!1}))},_=n=>t[n]?a(t[n]):n;return e.jsxs("div",{className:"d-flex flex-column rounded-3 mt-4 w-100 linked-account-elem",style:{fontSize:"0.875rem"},children:[e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"text-center fip-image-container ",children:e.jsx(le,{imagePath:`fipLogos/${ne(s.name,g)}`,style:{height:"3rem",width:"3rem"}})}),e.jsxs("div",{className:"d-flex flex-column px-3 text-start gap-1 w-100 align-self-center",children:[e.jsx("div",{className:"d-flex flex-row gap-4",children:e.jsxs("span",{className:"title-text",style:{width:"9rem"},children:[" ",b(s.name,30)]})}),e.jsxs("span",{children:[s.hasOwnProperty("accountType")&&(s==null?void 0:s.accountType)!=="DEFAULT"&&D(s)+" | ",s.hasOwnProperty("fiT
1ype")&&_(s.fiType.replace(/-/g,"_"))+" | ",e.jsx("span",{children:v(s.maskedAccountNumber,16)})]})]})]}),e.jsx("div",{className:"d-flex flex-column w-100 mb-3 px-3 py-2 container-boundry",children:e.jsxs("div",{className:"d-flex flex-column gap-1",children:[e.jsx(W,{keyName:a(t.LINKED_BY),value:b(s.linkedBy,20),valueStyleClass:"value-text"}),e.jsx(W,{keyName:`${a(t.LINKED_ON)} `,value:X(s.linkedAt),valueStyleClass:"value-text"})]})}),e.jsxs("div",{className:"d-flex px-3 pb-3 gap-3",children:[!C&&e.jsx($,{label:a(t.BUTTON_UNLINK_ACCOUNT),onClick:A,style:{width:"100%",...y}}),C&&e.jsx(re,{})]}),S.showModal&&e.jsx(te,{handleModal:f,submitButtonCB:N,headerText:a(t.UNLINK_ACCOUNT).split(" ")[0]+" "+s.name+" "+a(t.UNLINK_ACCOUNT).split(" ")[1],subHeaderText:D(s)+" | "+v(s.maskedAccountNumber),bodySubText:O(a(t.DELINK_ACCOUNT_DESC),{"{FIP}":s.name}),bodyText:a(t.CONFIRM),backButtonText:a(t.BUTTON_NO),submitButtonText:a(t.BUTTON_YES),setLoader:h})]})}function ge({account:s,setLoader:h,fetchLinkedAccounts:R}){const{sendRequestAndHandleSession:I}=Q(),[d]=G(),l=Z(),{translate:a}=Y(),[S,f]=x.useState({showModal:!1,triggerRequest:!1}),[C,u]=x.useState(!1),g=ee();let y={};B(F.delink,d==null?void 0:d.userData.user.accessCode)||(y={backgroundColor:"#efefef",color:"#909090",borderColor:"#C4C4C4"});const A=()=>{B(F.delink,d==null?void 0:d.userData.user.accessCode)?f(n=>({...n,showModal:!0})):l.show(a(t.ERROR_ACCESS_DENIED),l.AlertTypes.ERROR)};async function c(){var r,E,T;h(!0);let n=await I({linkReferenceNumber:s.linkReferenceNumber},P.delink);if(n.hasOwnProperty(z.SUCCESS))if(n.success.hasOwnProperty(z.ERROR)){const U=(E=oe((r=n==null?void 0:n.success)==null?void 0:r.error,s==null?void 0:s.name,q.UNLINK))==null?void 0:E.message;l.show(U,l.AlertTypes.ERROR)}else l.show(a(t.DELINK_SUCCESSFUL),l.AlertTypes.SUCCESS),R();else((T=n==null?void 0:n.error)==null?void 0:T.code)===se.ACCOUNT_NOT_FOUND_ERROR?(l.show(a(t.ERROR_ACCOUNT_ALREADY_UNLINKED),l.AlertTypes.ERROR),R()):l.show(O(a(t.ERROR_ACCOUNT_ACTION_FAILURE),{"{requestAction}":q.UNLINK}),l.AlertTypes.ERROR);h(!1)}const N=()=>{c(),f(n=>({...n,showModal:!1,triggerRequest:!1}))},_=n=>t[n]?a(t[n]):n;return e.jsxs("div",{className:"d-flex flex-row gap-2 mt-4 w-75 justify-content-start align-self-start linked-account-elem",style:{fontSize:"0.875rem",minWidth:"50rem"},children:[e.jsx("div",{className:"p-3 text-center",style:{minWidth:"10%",fontSize:"1.25rem",backgroundColor:"#E9F9FA"},children:e.jsx(le,{imagePath:`fipLogos/${ne(s.name,g)}`,style:{height:"3.5rem",width:"3.5rem"}})}),e.jsxs("div",{className:"d-flex flex-column px-2 p-2 my-2 text-start gap-2 border-end",style:{minWidth:"45%",width:"45%"},children:[e.jsx("div",{className:"d-flex flex-row gap-4",children:e.jsxs("span",{className:"fw-bold",style:{width:"9rem"},children:[" ",b(s.name,30)]})}),e.jsxs("span",{children:[s.hasOwnProperty("accountType")&&(s==null?void 0:s.accountType)!=="DEFAULT"&&D(s)+" | ",s.hasOwnProperty("fiType")&&_(s.fiType.replace(/-/g,"_"))+" | ",e.jsx("span",{className:"fw-bolder",children:v(s.maskedAccountNumber,16)})]})]}),e.jsxs("div",{className:"d-flex flex-column justify-content-center px-2 p-2 mx-1 my-2 w-25 border-end",children:[e.jsx(W,{keyName:`${a(t.LINKED_ON)} `,value:X(s.linkedAt)}),e.jsx(W,{keyName:a(t.LINKED_BY),value:b(s.linkedBy,20),valueStyleClass:"value-text-lc fw-bold"})]}),e.jsxs("div",{className:"d-flex align-items-center px-2 p-3",style:{minWidth:"15%",width:"15%"},children:[!C&&e.jsx($,{label:a(t.BUTTON_UNLINK_ACCOUNT),className:"align-self-center",onClick:A,style:{minHeight:"2rem",height:"auto",...y}}),C&&e.jsx(re,{})]}),S.showModal&&e.jsx(te,{handleModal:f,submitButtonCB:N,headerText:a(t.UNLINK_ACCOUNT).split(" ")[0]+" "+s.name+" "+a(t.UNLINK_ACCOUNT).split(" ")[1],subHeaderText:D(s)+" | "+v(s.maskedAccountNumber),bodySubText:O(a(t.DELINK_ACCOUNT_DESC),{"{FIP}":s.name}),bodyText:a(t.CONFIRM),backButtonText:a(t.BUTTON_NO),submitButtonText:a(t.BUTTON_YES),setLoader:h})]})}function Te({closeModal:s,amcName:h,rtaName:R,accountsList:I=[],formRefresh:d,unlink:l=!0}){const a=Z();G();const{sendRequestAndHandleSession:S}
1=Q(),[f,C]=x.useState(I),[u,g]=x.useState([]),[y,A]=x.useState(!1),[c,N]=x.useState({showModal:!1,triggerRequest:!1}),[_,n]=x.useState(!0),{translate:r}=Y(),[E,T]=x.useState({Heading:r(t.UNLINKED_SUCCESSFULLY),body:r(t.UNLINKED_SUCCESSFULLY_BODY),status:"success"}),U=ee();h=b(h,40),R=b(R,40);const k=x.useRef(null),p=x.useRef(!1),M=async o=>{const L=await Promise.all(o),{errors:i,responses:j}=L.reduce((w,m)=>(m.error&&w.errors.push(m.error),m.success&&w.responses.push(m.success),w),{errors:[],responses:[]});return{errors:i,responses:j}},K=()=>p.current?f.map(o=>S({linkReferenceNumber:o.linkReferenceNumber},P.delink,null,null,!0)):[...u].map(o=>S({linkReferenceNumber:o},P.delink,null,null,!0)),H=async()=>{const o=p!=null&&p.current?f==null?void 0:f.length:(u==null?void 0:u.length)??0;A(!0);let{responses:L,errors:i}=await M(K()),j=f;const w=u;if(L&&(L==null||L.forEach(m=>{if(m!=null&&m.error){i.push(m.error);return}let V=f.findIndex(J=>J.linkReferenceNumber===m.linkReferenceNumber);w.includes(m.linkReferenceNumber)&&w.splice(w.indexOf(m.linkReferenceNumber),1),j.splice(V,1)})),i&&(i==null?void 0:i.length)!==0){let m=!0;const V=(i==null?void 0:i.length)===1?O(r(t.ERROR_PARTIAL_UNLINK_BODY_SINGULAR),{"{totalAccounts}":o}):O(r(t.ERROR_PARTIAL_UNLINK_BODY),{"{numAccounts}":i==null?void 0:i.length,"{totalAccounts}":o});for(let J in i)if(i[J].code!==se.ACCOUNT_NOT_FOUND_ERROR){m=!1;break}T((i==null?void 0:i.length)===o?{Heading:r(t.ERROR_UNLINK_FAILED_LABEL),body:r(m?t.ERROR_ACCOUNT_ALREADY_UNLINKED:p.current?t.ERROR_UNLINK_ALL_FAILED_DESCRIPTION:t.ERROR_UNLINK_FAILED_DESCRIPTION),status:"error"}:{Heading:r(t.PARTIAL_UNLINK),body:V,status:"error"})}else T({Heading:r(t.UNLINKED_SUCCESSFULLY),body:r(p.current?t.UNLINKED_ALL_SUCCESSFULLY_BODY:t.UNLINKED_SUCCESSFULLY_BODY),status:"success"});C(m=>[...j]),g(w),n(!1),N(m=>({...m,triggerRequest:!1})),j.length===0&&(k.current=async()=>{await d()}),A(!1)},ae=()=>{H(),N(o=>({...o,triggerRequest:!1}))};return e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-dialog modal-dialog-custom mobile-small-height-modal-dialog",children:e.jsxs("div",{className:"modal-content mobile-small-height-modal-content",style:{borderRadius:"0.625rem"},children:[e.jsxs("div",{className:"modal-header justify-content-between modal-header-custom",children:[e.jsxs("div",{className:"d-flex flex-row align-self-center justify-items-center align-items-center",children:[e.jsx(le,{imagePath:`fipLogos/${ne(R,U)}`,style:{height:"2rem",width:"2rem"}}),e.jsx("span",{className:"modal-title ms-3 modal-title-custom ",children:R})]}),y?null:e.jsx("img",{src:"/graphics/utils/close-icon.svg",alt:"Close Icon",onClick:async()=>{l&&await d(),s(!0)}})]}),e.jsxs("div",{className:"modal-body overflow-auto align-items-start modal-body-custom",children:[e.jsx("span",{className:"amc-name-text",children:h.toLowerCase()}),e.jsx("div",{className:"my-1 flex-column d-flex align-self-start",style:{width:"90%"},children:e.jsx(Ne,{list:f,DetailsDisplayComponent:fe,checkboxCtx:{id:"linkReferenceNumber",selectedCheckBox:u,visible:l,style:{height:"20px",width:"20px",alignSelf:"center"},conditionalVisibility:()=>!0,onCheckCB:o=>{g(L=>{if(L.includes(o.linkReferenceNumber)){let i=L.indexOf(o.linkReferenceNumber);return L.splice(i,i+1),[...L]}else return[...L,o.linkReferenceNumber]})}}})})]}),e.jsxs("div",{className:`d-flex flex-row justify-content-center w-100 pb-2 align-self-center px-2 ${l?"border-top modal-buttons-container":""} `,children:[l&&!y&&e.jsx($,{className:`mt-2 ${(u==null?void 0:u.length)===0?"disabled":""}`,style:{fontSize:"0.875rem"},label:r(t.UNLINK_SELECTED_ACCOUNTS),disabled:!(u!=null&&u.length),onClick:()=>{if(u.length>0){p.current=!1,N(o=>({...o,showModal:!0}));return}a.show(r(t.ERROR_NO_ACCOUNT_SELECTED_TO_UNLINK),a.AlertTypes.ERROR)}}),l&&!y&&e.jsx($,{className:"mt-2 ms-4",style:{fontSize:"0.875rem"},label:r(t.UNLINK_ALL_ACCOUNTS),onClick:()=>{p.current=!0,N(o=>({...o,showModal:!0}))}}),y&&e.jsx(re,{styleClass:"mt-2",small:!0})]})]})}),c.showModal&&e.jsx(te,{handleModal:N,submitButtonCB:ae,headerText:O(r(t.UNLINK_AMC_ACCOUNT_HEADER),{"{amcName}":h}).toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),bodySubText:r(p!=null&&p.current?t.UNLINK_ALL_AMC_ACCOUNT_BODY:t.UNLINK_AMC_ACCOUNT_BODY),bodyText:r(t.CONFIRM),backButtonText:r(t.BUTTON_NO),submitButtonText:r(t.BUTTON_YES)}),!_&&e.jsx(me,{status:E.status,headerText:E==null?void 0:E.Heading,bodyText:E==null?void 0:E.body,buttonText:r(t.BUTTON_OK),closeModal:n,onButtonClick:k.current,headerStyle:{marginTop:"20px"}})]})}function Le({amcObject:s,setLoader:h,fetchLinkedAccounts:R}){var E;const{sendRequestAndHandleSession:I}=Q(),[d]=G(),l=Z(),[a,S]=x.useState({showModal:!1,triggerRequest:!1}
1),[f,C]=x.useState(!1),[u,g]=x.useState(!0),[y,A]=x.useState(!0),{translate:c}=Y(),N=ee();let _={};B(F.delink,d==null?void 0:d.userData.user.accessCode)||(_={backgroundColor:"#efefef",color:"#909090",borderColor:"#C4C4C4"});const n=async()=>{if(C(!0),B(F.delink,d==null?void 0:d.userData.user.accessCode)){if(A(!0),s.accounts.length>1){A(!0),g(!1),C(!1);return}S(T=>({...T,showModal:!0}))}else l.show(c(t.ERROR_ACCESS_DENIED),l.AlertTypes.ERROR);C(!1)};async function r(){var U,k,p,M,K;C(!0);let T=await I({linkReferenceNumber:s.accounts[0].linkReferenceNumber},P.delink);if(T.hasOwnProperty(z.SUCCESS))if(T.success.hasOwnProperty(z.ERROR)){const H=(M=oe((U=T==null?void 0:T.success)==null?void 0:U.error,(p=(k=s==null?void 0:s.accounts)==null?void 0:k[0])==null?void 0:p.name,q.UNLINK))==null?void 0:M.message;l.show(H,l.AlertTypes.ERROR)}else l.show(c(t.DELINK_SUCCESSFUL),l.AlertTypes.SUCCESS),R();else((K=T==null?void 0:T.error)==null?void 0:K.code)===se.ACCOUNT_NOT_FOUND_ERROR?l.show(c(t.ERROR_ACCOUNT_ALREADY_UNLINKED),l.AlertTypes.ERROR):l.show(O(c(t.ERROR_ACCOUNT_ACTION_FAILURE),{"{requestAction}":q.UNLINK}),l.AlertTypes.ERROR);C(!1)}return e.jsxs("div",{className:"d-flex flex-column rounded-3 mt-4 w-100 linked-account-elem",style:{fontSize:"0.875rem"},children:[e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"text-center fip-image-container ",children:e.jsx(le,{imagePath:`fipLogos/${ne(s.accounts[0].name,N)}`,style:{height:"3rem",width:"3rem"}})}),e.jsxs("div",{className:"d-flex flex-column px-3 text-start gap-1 w-100 align-self-center",children:[e.jsxs("div",{className:"d-flex flex-row gap-1",children:[e.jsx("span",{className:"title-text",children:b(s.accounts[0].name,20)}),"|",e.jsx("span",{className:"title-text",style:{textTransform:"capitalize"},children:b(s.amcName,20)})]}),e.jsxs("span",{children:[s.accounts[0].hasOwnProperty("accountType")&&((E=s.accounts[0])==null?void 0:E.accountType)!=="DEFAULT"&&D(s.accounts[0])+" | ",s.accounts[0].hasOwnProperty("fiType")&&D(s.accounts[0])+" | ",e.jsxs("span",{children:[v(s.accounts[0].maskedAccountNumber.split("-")[1],16),s.accounts.length>1?"...":""]}),s.accounts.length>1&&e.jsx("span",{className:"ms-1 more-accounts",onClick:()=>{A(!1),g(!1)},children:O(c(t.MORE_ACCOUNTS),{"{numAccounts}":s.accounts.length-1})})]})]})]}),e.jsx("div",{className:"d-flex flex-column w-100 mb-3 px-3 py-2 container-boundry",children:e.jsxs("div",{className:"d-flex flex-column gap-1",children:[e.jsx(W,{keyName:c(t.LINKED_BY),value:b(s.accounts[0].linkedBy,20),valueStyleClass:"value-text"}),e.jsx(W,{keyName:`${c(t.LINKED_ON)} `,value:X(s.accounts[0].linkedAt),valueStyleClass:"value-text"})]})}),e.jsxs("div",{className:"d-flex px-3 pb-3 gap-3",children:[!f&&e.jsx($,{label:c(t.BUTTON_UNLINK_ACCOUNT),onClick:async()=>{if(s.accounts.length>1){A(!0),g(!1);return}await n()},style:{width:"100%",..._}}),f&&e.jsx(re,{})]}),a.showModal&&s.accounts.length===1&&e.jsx(te,{handleModal:S,submitButtonCB:r,headerText:O(c(t.UNLINK_FIP_ACCOUNT_HEADER),{"{fipName}":s.accounts[0].name}),subHeaderText:D(s.accounts[0])+" | "+v(s.accounts[0].maskedAccountNumber.split("-")[1],16),bodySubText:O(c(t.DELINK_ACCOUNT_DESC),{"{FIP}":s.accounts[0].name}),bodyText:c(t.CONFIRM),backButtonText:c(t.BUTTON_NO),submitButtonText:c(t.BUTTON_YES),setLoader:h}),!u&&e.jsx(Te,{amcName:s.amcName,rtaName:s.accounts[0].name,closeModal:g,accountsList:s.accounts,formRefresh:R,unlink:y})]})}const Se=()=>{const{translate:s}=Y(),{sendRequestAndHandleSession:h}=Q(),[R]=G(),[I,d]=x.useState([]),[l,a]=x.useState(!0),[S,f]=x.useState(!1),{theme:C}=ie(),[u,g]=x.useState(0),y=c=>(g(0),c.map(N=>N!=null&&N.rtaName?Object.values(N.AMC).map(_=>(g(n=>{var r;return n+((r=_==null?void 0:_.accounts)==null?void 0:r.length)}),C!=null&&C.MOBILE?e.jsx(Le,{amcObject:_,setLoader:a,fetchLinkedAccounts:A},N.amcName):e.jsx(ye,{amcObject:_,setLoader:a,fetchLinkedAccounts:A},N.amcName))):(g(_=>_+1),C!=null&&C.MOBILE?e.jsx(Ee,{account:N,setLoader:a,fetchLinkedAccounts:A},N.accountReferenceNumber):e.jsx(ge,{account:N,setLoader:a,fetchLinkedAccounts:A},N.accountReferenceNumber)))),A=async c=>{a(!0);let N=await h({mobile:R==null?void 0:R.userData.customer.mobile},P.link.linkedAccounts);if(N.hasOwnProperty("success"))if(N.success.linkedAccounts.length!==0){let _=Re(N.success.linkedAccounts);_.forEach(n=>
1{n!=null&&n.AMC&&(Ce(n.AMC),n.AMC=pe(n==null?void 0:n.AMC))}),Ae(_),d(y(_)),f(!0)}else d(e.jsxs("div",{className:"d-flex flex-column align-items-center justify-content-center h-100 w-100 gap-3",children:[e.jsx(ce,{error:"accounts_empty",prompt:s(t.NO_ACCOUNTS_LINKED)}),e.jsx(ue,{addAccount:s(t.ADD_ACCOUNT),accessDenied:s(t.ERROR_ACCESS_DENIED),bank:s(t.BANK),buttonStyle:{width:"11rem",...c},align:"align-self-center"})]})),f(!1),g(0);else d(e.jsx(ce,{error:"server_error",prompt:s(t.ERROR_SOMETHING_WENT_WRONG)}));a(!1)};return{AccList:I,isLoading:l,topRightButton:S,fetchLinkedAccounts:A,accountsCount:u}};function Ge({}){var c,N;const{translate:s}=Y(),[h]=G(),[,R,,I,d,l]=xe(),[a]=x.useState(B(F.discover,(N=(c=h==null?void 0:h.userData)==null?void 0:c.user)==null?void 0:N.accessCode)),{theme:S}=ie(),{AccList:f,isLoading:C,topRightButton:u,fetchLinkedAccounts:g,accountsCount:y}=Se();let A={};return a||(A={backgroundColor:"#efefef",color:"#909090",borderColor:"#C4C4C4"}),x.useEffect(()=>{let _=()=>{var n;return y??((n=d==null?void 0:d.linkedAccounts)==null?void 0:n.count)??0};R({title:s(t.ACCOUNTS),subTitle:`${s(t.LINKED_ACCOUNTS)} (${_()})`,navigationRequired:!1}),I(!0),l(n=>({...n,linkedAccounts:{count:y}}))},[f]),x.useEffect(()=>{g(A)},[]),e.jsxs("div",{className:"d-flex flex-column w-100",children:[!C&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"pt-4 px-4 d-flex flex-column",children:[e.jsx("div",{style:S!=null&&S.MOBILE?{minWidth:"100%"}:{minWidth:"50rem",maxWidth:"75%"},children:u&&e.jsx(ue,{addAccount:s(t.ADD_ACCOUNT),accessDenied:s(t.ERROR_ACCESS_DENIED),buttonStyle:{paddingRight:"1rem",paddingLeft:"1rem",...A},bank:s(t.BANK),align:"align-self-end"})}),f]})}),C&&e.jsx(he,{})]})}export{Ge 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.