1!function(){try{var a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new a.Error).stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="00901d72-73cb-48c9-b83d-7b02ba902342",a._sentryDebugIdIdentifier="sentry-dbid-00901d72-73cb-48c9-b83d-7b02ba902342")}catch(t){}}();import{j as a,R as e,B as t,V as s,x as n}from"./@brasshq/ui-kit-C5jh8u1K.js";import{dB as o,k as i,eD as r,_ as c,aJ as l,eE as u,eF as d,eG as _,aC as m,aH as p,N as v,ej as h}from"./App-HYYDePiw.js";import{C as x}from"./Common-BM3-sm7I.js";import{u as j,d as f,g as b,i as y,e as g,f as N,h as M,j as w,k as A,l as D,m as k,M as z,n as C,o as $,p as S,q as B}from"./storage-BHrW_BAl.js";import{X as P}from"./react-feather-B1p3-ou_.js";import{A as E}from"./AccountClosurePendingModal-D46FfM8q.js";import{C as L}from"./ClosureConfirmationModal-CUFMtN2u.js";import"./libphonenumber-js/min-ORpmiCJc.js";import"./date-fns-CpEzoGKw.js";import"./index-Dtj21Ljh.js";import"./@sentry/react-2ugike8y.js";import"./formik-CBscJFpt.js";import"./@reduxjs/toolkit-QiR5TFUJ.js";import"./yup-CN_DNaz9.js";import"./functions-BqdrtWb6.js";import"./Auth-B1-tk0kq.js";import"./Carousel-D_fEt25h.js";import"./react-responsive-carousel-ChaxLSJj.js";import"./TimeoutComponentLayout-BWUUy5gy.js";import"./useSendOtp-CE5jkrz6.js";import"./debounce-BqBDB6-4.js";import"./toNumber-CwMdAyRF.js";import"./functions-CJLtVfoq.js";import"./If-CV2hdnnO.js";import"./Modal-F9mYhuKU.js";import"./AppRouter-b92bcX_J.js";import"./routingConfigComponents-BzOIn0vC.js";import"./index-CzaTVGJO.js";import"./rc-slider-BemcVWfh.js";import"./index-DfUMMVxX.js";import"./index-DfpCnneW.js";import"./RecipientTagSelect-B3Tz2kIt.js";import"./react-draft-wysiwyg-D8cl--sF.js";import"./draft-js-Cg0-vs3B.js";import"./withErrorBoundary-CWU-ZZW1.js";import"./react-error-boundary-D4mCVdMt.js";import"./PrivateRouteGuard-sG1TCTYT.js";const F="_MigrateLayout_9ezb3_4",Y="_MigrateLayout_header_9ezb3_10",R="_MigrateLayout_header_title_box_9ezb3_24",I="_MigrateLayout_header_close_btn_9ezb3_44",T="_MigrateLayout_nav_9ezb3_58",H="_MigrateLayout_nav_list_9ezb3_75",V="_MigrateLayout_nav_item_9ezb3_84",W="_MigrateLayout_nav_item_active_9ezb3_120",G="_MigrateLayout_main_9ezb3_126",q="_MigrateLayout_content_9ezb3_137",O=({title:e,description:t,handleClose:s,steps:n,children:i})=>a.jsxs("main",{className:F,children:[a.jsxs("header",{className:Y,children:[a.jsxs("div",{className:R,children:[a.jsx("h5",{children:e}),a.jsx("p",{children:t})]}),a.jsx("button",{className:I,onClick:s,children:a.jsx(P,{})})]}),a.jsxs("div",{className:G,children:[a.jsx("nav",{className:T,children:a.jsx("ul",{className:H,children:n.map(e=>a.jsx("li",{className:V,children:a.jsx(o,{to:e.path,className:({isActive:a})=>a?W:void 0,children:e.label})},e.path))})}),a.jsx("section",{className:q,children:i})]})]}),J="_AccountDetails_10fzy_4",K="_AccountDetails_content_10fzy_9",U="_AccountDetails_label_10fzy_13",Q="_AccountDetails_description_10fzy_41",X="_AccountDetails_card_10fzy_53",Z="_AccountDetails_row_10fzy_60",aa="_AccountDetails_row_label_10fzy_70",ea="_AccountDetails_row_value_10fzy_79",ta="_AccountDetails_cta_10fzy_109",sa="_AccountDetails_note_10fzy_115",na=()=>{var n,o,r,c;const l=i(),{profile:u}=e.useContext(x),{isPreview:d,search:_}=j(),m=(null==(o=null==(n=null==u?void 0:u.customer)?void 0:n.data)?void 0:o.id)||"",p=e.useMemo(()=>d?f():b(m),[m,d]),v=y(p),h=(null==(r=null==p?void 0:p.sweep_funds_to)?void 0:r.name)||"Name could not be resolved yet",N=(null==p?void 0:p.account_number)||"Not available",M=(null==(c=null==p?void 0:p.sweep_funds_to)?void 0:c.bank_name)||"Paystack MFB";return a.jsx("section",{className:J,children:a.jsxs("div",{className:K,children:[a.jsx("p",{className:U,children:"Step 1"}),a.jsx("h1",{children:"Confirm your migration account details"}),a.jsx("p",{className:Q,children:"These details come from migration provisioning. We resolve the account name before you continue."}),a.jsxs("div",{className:X,children:[a.jsxs("div",{className:Z,children:[a.jsx("span",{className:aa,children:"Account name"}),a.jsx("span",{className:ea,children:h})]}),a.jsxs("div",{className:Z,children:[a.jsx("span",{className:aa,children:"Account number"}),a.jsx("span",{className:ea,children:N})]}),a.jsxs("div",{className:Z,children:[a.jsx("span",{className:aa,children:"Bank"}),a.jsx("span",{className:ea,children:M})]})]}),!v&&!d&&a.jsx("p",{className:sa,children:"You can continue only after account details are resolved successfully."}),a.jsx(t,{type:"button",variant:s.Primary,className:ta,disabled:!(d||p&&v),onClick:()=>
1l(`${g.exportYourData}${_}`),children:"Continue"})]})})},oa="_AccountMigration_svx54_4",ia="_AccountMigration_content_svx54_10",ra="_AccountMigration_label_svx54_19",ca="_AccountMigration_description_svx54_20",la="_AccountMigration_total_svx54_20",ua="_AccountMigration_listHeader_svx54_20",da="_AccountMigration_listHint_svx54_20",_a="_AccountMigration_actions_svx54_20",ma="_AccountMigration_total_label_svx54_73",pa="_AccountMigration_total_value_svx54_82",va="_AccountMigration_listTitle_svx54_100",ha="_AccountMigration_downloadButton_svx54_112",xa="_AccountMigration_listViewport_svx54_141",ja="_AccountMigration_listViewport_scrollable_svx54_150",fa="_AccountMigration_list_svx54_20",ba="_AccountMigration_emptyState_svx54_185",ya="_AccountMigration_account_svx54_195",ga="_AccountMigration_account_identity_svx54_213",Na="_AccountMigration_account_avatar_svx54_224",Ma="_AccountMigration_account_summary_svx54_229",wa="_AccountMigration_account_name_svx54_232",Aa="_AccountMigration_account_number_svx54_245",Da="_AccountMigration_account_meta_svx54_256",ka="_AccountMigration_account_balance_svx54_269",za="_AccountMigration_submitButton_svx54_288",Ca="_AccountMigration_footerNote_svx54_294",$a=a=>{const[e="Business",t="Account"]=a.split(" ");return{firstname:e,lastname:t}},Sa=a=>{var e,t;return{id:a.id,accountName:a.name,balance:a.available_balance.formatted_display||a.available_balance.formatted,balanceRaw:Number(a.available_balance.raw||"0"),currency:a.currency,accountNumber:a.number,bankName:(null==(t=null==(e=a.bank)?void 0:e.data)?void 0:t.name)||"",avatar:$a(a.name)}},Ba=(a,e)=>{var t;const s=a.account_name||a.name,n=a.account_number||a.number,o=a.bank_name||(null==(t=a.bank)?void 0:t.name)||"",i=a.available_balance||a.balance,r=Number((null==i?void 0:i.raw)||"0"),c=a.currency||"NGN";return s&&n?{id:a.id||a.account_id||`${s}-${n}-${e}`,accountName:s,accountNumber:n,bankName:o,balance:(null==i?void 0:i.formatted_display)||(null==i?void 0:i.formatted)||Ea(c,r/Pa),balanceRaw:r,currency:c,avatar:$a(s)}:null},Pa=100,Ea=(a,e)=>`${a} ${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,La={title:"Confirm migration to Paystack MFB",description:"Enter your one-time passcode to authorize moving your funds to Paystack MFB and closing your Brass account.",buttonLabel:"Confirm and close account",buttonVariant:s.Primary,successMessage:""},Fa=()=>{var o,i,c,l,u,d,_,m,p;const{profile:v}=e.useContext(x),{isPreview:h}=j(),y=r(a=>a["module/accounts"].accounts.data),[g,k]=e.useState(!1),[z,C]=e.useState(!1),[$,S]=e.useState(null),[B,P]=e.useState(!1),[F,Y]=e.useState(!1),R=e.useRef(null),I=e.useMemo(()=>{var a,e,t;return[...(null==(t=null==(e=null==(a=null==v?void 0:v.customer)?void 0:a.data)?void 0:e.accounts)?void 0:t.data)||[],...y].filter((a,e,t)=>t.findIndex(e=>e.id===a.id)===e)},[null==(c=null==(i=null==(o=null==v?void 0:v.customer)?void 0:o.data)?void 0:i.accounts)?void 0:c.data,y]),T=e.useMemo(()=>I.map(Sa),[I]),H=e.useMemo(()=>N.map((a,e)=>Ba(a,e)).filter(a=>Boolean(a)),[]),V=e.useMemo(()=>$&&$.length>0?$:T.length>0?T:h?H:[],[h,T,H,$]),W=e.useMemo(()=>{if(V.length<=0)return null;const a=V.reduce((a,e)=>a+e.balanceRaw,0)/Pa;return Ea(V[0].currency,a)},[V]),G=(null==(u=null==(l=null==v?void 0:v.customer)?void 0:l.data)?void 0:u.contact_email)||(null==(_=null==(d=null==v?void 0:v.user)?void 0:d.data)?void 0:_.email)||"",q=(null==(p=null==(m=null==v?void 0:v.customer)?void 0:m.data)?void 0:p.id)||"",O=e.useMemo(()=>h?f():b(q),[q,h]);e.useEffect(()=>{const a=R.current;if(!a)return;const e=()=>{Y(a.scrollHeight>a.clientHeight)};e();const t=new ResizeObserver(e);return t.observe(a),()=>t.disconnect()},[V,B]),e.useEffect(()=>{if(h||!q)return;(async()=>{P(!0);const a=await M(q),e=(null==a?void 0:a.accounts)||(null==a?void 0:a.customer_accounts)||[];if(e.length>0){const a=e.map((a,e)=>Ba(a,e)).filter(a=>Boolean(a));a.length>0&&S(a)}P(!1)})()},[q,h]);const J=e.useMemo(()=>{const a=null==O?void 0:O.sweep_funds_to;return a?{bank:a.bank,account_number:a.account_number,name:a.name}:null},[null==O?void 0:O.sweep_funds_to]);return a.jsxs("section",{className:oa,children:[a.jsxs("div",{className:ia,children:[a.jsx("p",{className:ra,children:"Step 3"}),a.jsx("h1",{children:"Review and confirm migration"}),a.jsx("p",{className:ca,children:"Your Brass balances will be merged into a single new Paystack MFB account. Subaccounts and recurring mandates do not carry over."}),W&&a.jsxs("div",{className:la,children:[a.jsx("span",{className:ma,children:"Total moving to Paystack MFB"}),a.jsx("span",{className:pa,children:W})]}),a.jsxs("div",{className:ua,children:[a.jsx("p",{className:va,children:"Your Brass accounts"}),a.jsx(t,{type:"button",variant:s.Secondary,rounded:!0,className:ha,disabled:B||V.length<=0,onClick:()=>{w(V)},children:"Download snapshot"})]}),a.jsx("p",{className:da,children:"Save a reference of your current setup to recreate subaccounts on Paystack MFB."}),a.jsx("div",{className:`${xa}${F?` ${ja}`:""}`,children:a.jsxs("div",{ref:R,className:fa,children:[V.map(e=>a.jsxs("article",{className:ya,children:[a.jsxs("div",{className:ga,children:[a.jsx(n,{firstname:e.avatar.firstname,lastname:e.avatar.lastname,className:Na}),a.jsxs("div",{className:Ma,children:[a.jsx("p",{className:wa,children:e.accountName}),a.jsxs("p",{className:Aa,children:[e.bankName?`${e.bankName} ⢠`:"",e.accountNumber]})]})]}),a.jsx("div",{className:Da,children:a.jsx("p",{className:ka,children:e.balance})})]},e.id)),!B&&V.length<=0&&a.jsx("p",{className:ba,children:"No accounts were found for this customer yet."})]})}),a.jsxs("div",{className:_a,children:[a.jsx(t,{type:"button",variant:s.Primary,rounded:!0,className:za,disabled:!(h||G&&J),onClick:()=>{!h&&G&&J&&k(!0)},children:"Complete migration"}),a.jsx("p",{className:Ca,children:"Funds move to your Paystack MFB account immediately after you confirm."})]})]}),a.jsx(L,{show:g&&Boolean(J),handleClose:()=>k(!1),refresh:async()=>{await A(G,null==O?void 0:O.migration_id),D(q),k(!1),C(!0)},data:La,transferDetails:J||void 0,closureType:"migration"}),a.jsx(E,{show:z})]})},Ya="_ExportYourData_jzrml_4",Ra="_ExportYourData_content_jzrml_9",Ia="_ExportYourData_label_jzrml_13",Ta="_ExportYourData_notice_jzrml_41",Ha="_ExportYourData_description_jzrml_64",Va="_ExportYourData_note_jzrml_76",Wa="_ExportYourData_cta_jzrml_93",Ga=a=>{const e=Math.ceil(a/1e3);if(e<=60)return`${e}s`;return`${Math.ceil(e/60)}m`},qa=()=>{var n,o,r,m,p,v,h,f;const b=i(),{profile:y}=e.useContext(x),{isPreview:N,search:M}=j(),[w,A]=e.useState(!1),D=(null==(o=null==(n=null==y?void 0:y.customer)?void 0:n.data)?void 0:o.id)||"",B=(null==(m=null==(r=null==y?void 0:y.customer)?void 0:r.data)?void 0:m.contact_email)||(null==(v=null==(p=null==y?void 0:y.user)?void 0:p.data)?void 0:v.email)||"",P=(null==(f=null==(h=null==y?void 0:y.customer)?void 0:h.data)?void 0:f.created_at)||"",[E,L]=e.useState(0),F=E>0,Y=e.useMemo(()=>k(P),[P]),R=Y.fromDateApi,I=Y.fromDateLabel,T=Y.toDateLabel;e.useEffect(()=>{if(!D)return void L(0);const a=()=>L(C(D,6e4));a();const e=window.setInterval(a,1e3);return()=>window.clearInterval(e)},[D]);return a.jsx("section",{className:Ya,children:a.jsxs("div",{className:Ra,children:[a.jsx("p",{className:Ia,children:"Step 2"}),a.jsx("h1",{children:"Export your account history"}),a.jsx("div",{className:Ta,children:a.jsxs("p",{children:["Need your full account history? Download statements for each account on the"," ",a.jsx(c,{to:l,children:"Accounts page"})," before continuing. The migration export below only includes the last ",z," months of data."]})}),a.jsxs("p",{className:Ha,children:["We'll email a copy of your Brass account statements for the last"," ",z," months (",a.jsx("span",{style:{fontWeight:600,whiteSpace:"nowrap"},children:I})," to"," ",a.jsx("span",{style:{fontWeight:600,whiteSpace:"nowrap"},children:T}),") to your registered email address before we begin the migration."]}),a.jsxs("p",{className:Va,children:["If you still need access to your account data after your account closes, reach out to supp
1ort at ",a.jsx("a",{href:`mailto:${u}`,children:u})," or"," ",a.jsx("a",{href:`tel:${d}`,children:d}),", or visit our"," ",a.jsx("a",{href:_,target:"_blank",rel:"noreferrer",children:"help centre"})," ","and we'll help you retrieve it."]}),F&&a.jsxs("p",{className:Ha,children:["Another export was recently requested. Please wait"," ",a.jsx("span",{style:{fontWeight:600},children:Ga(E)})," ","before trying again."]}),a.jsx(t,{type:"button",variant:s.Primary,rounded:!0,className:Wa,loading:w,disabled:!N&&(w||!D||!B||F),onClick:async()=>{if(N)return void b(`${g.accountMigration}${M}`);if(!D||!B||F)return;A(!0);const a=await $(D,{email:B,from_date:R,to_date:Y.toDateApi,format:"pdf"});A(!1),a&&(S(D),b(`${g.accountMigration}${M}`))},children:"Send to my email"})]})})},Oa=[{label:"Account details",path:g.accountDetails},{label:"Export your data",path:g.exportYourData},{label:"Account migration",path:g.accountMigration}],Ja=()=>{var t;const s=i(),{step:n}=m(),{profile:o}=e.useContext(x),{search:r}=j(),c=null==(t=null==o?void 0:o.customer)?void 0:t.data,l=p(c),u=(null==c?void 0:c.id)||"",d=e.useMemo(()=>b(u),[u]),_=B({step:n,canMigrate:l,provision:d,search:r}),f={[g.exportYourDataSlug]:a.jsx(qa,{}),[g.accountDetailsSlug]:a.jsx(na,{}),[g.accountMigrationSlug]:a.jsx(Fa,{})}[n||""];return _?a.jsx(v,{to:`${_}${r}`,replace:!0}):f?a.jsx(O,{title:"Migrate to Paystack MFB",description:"Move your business to Paystack MFB in a few steps.",handleClose:()=>s(`${h}${r}`),steps:Oa.map(a=>({...a,path:`${a.path}${r}`})),children:f}):a.jsx(v,{to:`${g.accountDetails}${r}`,replace:!0})};export{Ja as default}; 2//# sourceMappingURL=index-BEihXxaO.js.map
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.