@zeniai/web-app-ui 5.2.14-dev → 5.2.15-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddressRoutes-DKny58NT.js +1 -0
- package/dist/assets/AddressScreen-BVRFr_N1.js +9 -0
- package/dist/assets/{AiCfoScreen-Bq9qNM-U.js → AiCfoScreen-BN4QIEgB.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-Cgsqt2XF.js → BillPayApprovalRoutes-B_4hJ2pr.js} +1 -1
- package/dist/assets/{BillPayRoutes-D8ICOArG.js → BillPayRoutes-BJZymqmE.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-DlMhX3L_.js → BusinessVerificationPageScreen-DrCLmIxZ.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-evFd6UUn.js → CardsAiCfoScreen-Inv396bE.js} +3 -3
- package/dist/assets/{ChargeCardRoutes-czvHDNab.js → ChargeCardRoutes-DGEKzyzO.js} +10 -10
- package/dist/assets/CompanyPassportScreen-BsHZnsQV.js +1 -0
- package/dist/assets/{ConnectionAuthScreen-VR4MFOhW.js → ConnectionAuthScreen-CA8kXAT-.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-DhhSBraP.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CeoeigLq.js → CustomerOnboardingRoutes-Xm_O4AxR.js} +5 -5
- package/dist/assets/{DashboardRoutes-522JIWbO.js → DashboardRoutes-BsVesrb3.js} +1 -1
- package/dist/assets/{DefaultTenantHome-CBA28Llo.js → DefaultTenantHome-CrZNGTHj.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-C-1bKP7r.js → DomesticWireDetailScreen-C7-Ze-bQ.js} +3 -3
- package/dist/assets/{DrawerScreen-DAMt3OKh.js → DrawerScreen-D8laOuUr.js} +1 -1
- package/dist/assets/EntityDetailRoutes-BH66r_ba.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-DcYqfqSi.js → ExpenseAutomationRoutes-NkkbpV7S.js} +1 -1
- package/dist/assets/FeaturePreviewScreen-BKSMrhrm.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-LTrYsA2J.js → HubSpotOAuthCallbackScreen-BpsDDDwu.js} +1 -1
- package/dist/assets/MagicLinkRoutes-pFkPSCAf.js +72 -0
- package/dist/assets/{MagicLinkSignInScreen-CC54CnuQ.js → MagicLinkSignInScreen-DJG_XhkF.js} +1 -1
- package/dist/assets/MobileAppDrawer-D_5ajcgl.js +1 -0
- package/dist/assets/NotFoundScreen-vodaR6J5.js +1 -0
- package/dist/assets/{NotificationRoutes-CLLE6idd.js → NotificationRoutes-b1ATX3hL.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-D4soKi0X.js → OAuthConsentScreen-DTjj0EZW.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-CLOwX80d.js → PandLWithForecastRoutes-BVouxwOp.js} +1 -1
- package/dist/assets/{PeopleRoutes-RKPAQcdN.js → PeopleRoutes-BB0mptER.js} +3 -3
- package/dist/assets/PerformanceRoutes-BSGtqYip.js +1 -0
- package/dist/assets/{Preview-Crb4CpIB.js → Preview-Q7E6grqg.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-Doubr8Lv.js → QBOConnectionScreen-CYvG88ne.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CuXrRY6O.js → ReimbursementApprovalRoutes-CIZnVB8w.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CxT_ZU1Q.js → ReimbursementApprovalRuleDetailScreen-Bj2gRsYN.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-B9v1csuM.js → ReimbursementRoutes-D8GfsHFS.js} +1 -1
- package/dist/assets/{ReportsRoutes-CYYBopNx.js → ReportsRoutes-DYUuIrA9.js} +1 -1
- package/dist/assets/RewardsRoutes-CESh4LSy.js +1 -0
- package/dist/assets/{ScreenRoutes-3ZRh9969.js → ScreenRoutes-DeIZgGFA.js} +2 -2
- package/dist/assets/{SettingsRoutes-CLHJHv6D.js → SettingsRoutes-BS_91kvY.js} +1 -1
- package/dist/assets/{SetupPagesScreen-D-KjoZ4s.js → SetupPagesScreen-Du6z7K4L.js} +5 -5
- package/dist/assets/{SignInScreen-DzUQQLWX.js → SignInScreen-DGJIVFjs.js} +1 -1
- package/dist/assets/SignOutScreen-B4fw6lrq.js +9 -0
- package/dist/assets/{TaskListScreen-D1GJ72DV.js → TaskListScreen-C1GpDMh9.js} +2 -2
- package/dist/assets/TaskRoutes-Bn-Ea5LE.js +9 -0
- package/dist/assets/{TransactionDetailRoutes-NBFzTv3J.js → TransactionDetailRoutes-DM262XtJ.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-BXByY28g.js → TransactionDetailScreen-tCFIjsQZ.js} +2 -2
- package/dist/assets/{TransactionListRoutes-ClVpGZj3.js → TransactionListRoutes-q01ai3C8.js} +1 -1
- package/dist/assets/{TreasuryRoutes-CmxZydJL.js → TreasuryRoutes-C4C9GZ84.js} +4 -4
- package/dist/assets/{VendorsRoutes-caL_MoH5.js → VendorsRoutes-5HmjTAo1.js} +13 -13
- package/dist/assets/WiseConfirmationScreen-Cf2wKH5p.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-3mgFL_9o.js → ZeniAccountRoutes-DjosaDA2.js} +1 -1
- package/dist/assets/ZeniAccountStatementScreen-BBJfP9Ky.js +9 -0
- package/dist/assets/{accountMappingHelper-B0l8lAeR.js → accountMappingHelper-C5WHpsgJ.js} +1 -1
- package/dist/assets/{analytics-CO5gayAE.js → analytics-D_NuuF2U.js} +1 -1
- package/dist/assets/analyticsHelper-C7Ffbo_X.js +1 -0
- package/dist/assets/{core-DrRun-Wp.js → core-Da6TLrNx.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-BqXEXApE.js → decodeURIComponentSafe-B-r3T5bV.js} +1 -1
- package/dist/assets/{dnd-C7lg2kUY.js → dnd-DC_qF3Wr.js} +1 -1
- package/dist/assets/{empty-CcJKsg0A.js → empty-C73kmkO9.js} +1 -1
- package/dist/assets/{empty-BxU8KR-q.js → empty-s0Z9SHTS.js} +1 -1
- package/dist/assets/{emptyVideoElement-Jmh-gus6.js → emptyVideoElement-CUd0nWeJ.js} +1 -1
- package/dist/assets/{epic-CkW-Ur48.js → epic-DAjg0wXj.js} +1 -1
- package/dist/assets/getLocaleForTenant-CnNopwIO.js +1 -0
- package/dist/assets/{index-CdzL9szH.js → index-Bwczg7nO.js} +10593 -10593
- package/dist/assets/{index-T7IByhHr.js → index-COd9LNlP.js} +1 -1
- package/dist/assets/{index-2hIX2kLH.js → index-CWFrIv4j.js} +1 -1
- package/dist/assets/{index-DdvKvtaE.js → index-CsQZjvif.js} +1 -1
- package/dist/assets/{index-cnTKKS-Z.js → index-DAI9X2Zp.js} +2 -2
- package/dist/assets/{index-BJ6_cpY3.js → index-DykhB8j2.js} +1 -1
- package/dist/assets/{index-4Tf9Bt0i.js → index-XC9zB3-f.js} +1 -1
- package/dist/assets/{index-CfbU7SR1.js → index-b_fXiiPC.js} +1 -1
- package/dist/assets/{lexical-Cceo9d8G.js → lexical-CQoPutFC.js} +1 -1
- package/dist/assets/{liveblocks-0jcT8Dx_.js → liveblocks-C8AAaKDR.js} +1 -1
- package/dist/assets/{lottie-C4eBAM7n.js → lottie-B7_cpoe1.js} +1 -1
- package/dist/assets/{mui-BCzMCgwZ.js → mui-CosLSKUu.js} +1 -1
- package/dist/assets/{pathToGoBack-aFGIF63I.js → pathToGoBack-C_jELk-6.js} +1 -1
- package/dist/assets/{pdf-C1ioMmzA.js → pdf-CQB-J2hc.js} +3 -3
- package/dist/assets/{pdf-lib-gor9sGMc.js → pdf-lib-CscVz5ta.js} +1 -1
- package/dist/assets/{plaid-B0k6aBM1.js → plaid-2mv_ck83.js} +1 -1
- package/dist/assets/{pusher-CnlBFFea.js → pusher-DrRS7JyV.js} +1 -1
- package/dist/assets/{react-COTuHHMD.js → react-B42V2lQZ.js} +1 -1
- package/dist/assets/{react-CPmZ-IlI.js → react-B7r6-bpj.js} +1 -1
- package/dist/assets/{react-CeH9yclr.js → react-BmvpxDDj.js} +1 -1
- package/dist/assets/{react-C6dV2Ihe.js → react-C6MFx27g.js} +1 -1
- package/dist/assets/{react-CbFHkYXj.js → react-DJflHsBg.js} +1 -1
- package/dist/assets/{react-5qcvQnQi.js → react-DTDSsBUn.js} +1 -1
- package/dist/assets/{recharts-BJColP3b.js → recharts-9jMEgSjc.js} +1 -1
- package/dist/assets/{routePaths-CHhQNN3M.js → routePaths-Kh8F22Sq.js} +1 -1
- package/dist/assets/{sentry-Cix5j_Oe.js → sentry-DfheywaX.js} +1 -1
- package/dist/assets/{url-C58jRUwt.js → url-C-T2kMoW.js} +1 -1
- package/dist/assets/{url-C5XmMoE_.js → url-HWxh2lX9.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-rxliwAgH.js → useAiCfoDashboardSuggestedQuestionsChips-Dn_pRt3Y.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-vhjzTbBd.js +1 -0
- package/dist/assets/{useCashManagementBanner-BT0je4k3.js → useCashManagementBanner-DwoCHz3u.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-BbwX5V1a.js → useChargeCardPusherEvents-B9JTMflJ.js} +1 -1
- package/dist/assets/{useDeviceId-34Upzybn.js → useDeviceId-COe_GzcU.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BeuZj6XY.js → useEmailConnectResultRefresh-D4OTnNkO.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-E7aaQNIx.js → useInitialThreadRequest-CRJnx1_Z.js} +1 -1
- package/dist/assets/{utils-CvfvTDv6.js → utils-BykfwIo5.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-B_GhVWS9.js → withTransactionSidePanel-ZJmA3F8P.js} +2 -2
- package/dist/assets/{zeni-epic-state-D1OApLJ3.js → zeni-epic-state-BqRlfhza.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-C5ICjwhT.js +0 -1
- package/dist/assets/AddressScreen-DqXE5RDJ.js +0 -9
- package/dist/assets/CompanyPassportScreen-CzLA5zCy.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-B7Anpyxh.js +0 -1
- package/dist/assets/EntityDetailRoutes-CGG59Jmf.js +0 -1
- package/dist/assets/FeaturePreviewScreen-IYXzvJjG.js +0 -1
- package/dist/assets/MagicLinkRoutes-DzdDjge4.js +0 -72
- package/dist/assets/MobileAppDrawer-7KFASJmR.js +0 -1
- package/dist/assets/NotFoundScreen-1FWTFg5q.js +0 -1
- package/dist/assets/PerformanceRoutes-BL-ag8V3.js +0 -1
- package/dist/assets/RewardsRoutes-DQ-aEUje.js +0 -1
- package/dist/assets/SignOutScreen-CrFXavCN.js +0 -9
- package/dist/assets/TaskRoutes-BShsttwI.js +0 -9
- package/dist/assets/WiseConfirmationScreen-C_2P8pKj.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-B27kJkJn.js +0 -9
- package/dist/assets/analyticsHelper-BaOtwD25.js +0 -1
- package/dist/assets/getLocaleForTenant-C5iVY_JU.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-fe0P1a5j.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-0jcT8Dx_.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Je,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-DrRun-Wp.js";import{fa as Pt,Sc as os,fm as wt,bt as Fe,Sd as is,Se as ds,e$ as fn,Sf as Pn,f8 as wn,Sg as Tn,Sh as vn,Si as Fn,Sj as xn,f9 as Bn,fl as Ln,Sk as Rn,Sl as ls,ff as us,fe as ms,Sm as Cs,Cq as On,fo as ia,Sn as ps,So as hs,f1 as fs,f0 as gs,fB as Ye,fh as Un,fg as jn,Sp as Ss,fi as bs,BX as ys,BW as Is,B_ as ks,C0 as Es,fu as As,eY as Mn,Sq as Ds,Sr as _s,fz as Nn,Ss as Ps,fA as yt,C6 as ws,C3 as Ts,eZ as ge,St as qa,fE as xe,fF as Be,fG as Le,gA as da,cx as la,Su as ua,Sv as Tt,vc as $a,kO as za,Sw as Ya,CG as ka,fp as Qe,CI as vt,kE as Vn,Sx as ma,Cu as _a,Sy as vs,Sz as Fs,Cx as Qa,SA as xs,QA as Ja,fk as Hn,CD as Sa,hZ as Bs,SB as Gn,fb as Ca,bo as Ls,SC as Rs,gl as Xa,gk as et,Da as Os,gj as at,Qg as Us,SD as $n,cq as zn,cS as js,Qz as wa,DL as Yn,SE as gn,Dl as Pa,SF as Zn,DM as Ms,QY as Ns,DN as Vs,ES as Hs,uw as Gs,EM as $s,SG as zs,CH as ca,SH as Ys,SI as Zs,SJ as Ks,SK as Ws,SL as qs,SM as Ft,SN as Qs,CX as Kn,CQ as Js,SO as Xs,gC as ec,D4 as Wn,D8 as qn,gB as ac,SP as tc,Dx as Qn,SQ as nc,SR as rc,SS as sc,D6 as Jn,CT as Xn,CA as er,D0 as ar,C_ as tr,D2 as cc,ST as nr,SU as oc,fw as ic,fx as dc,fy as lc,SV as tt,fq as rr,cU as xt,SW as uc,SX as mc,SY as Cc,SZ as pc,Dg as It,DE as hc,DA as fc,Dc as gc,DC as Sc,Ds as bc,Du as yc,S_ as sr,DK as Ga,KB as Ic,S$ as kc,T0 as Ec,T1 as Ac,T2 as cr,T3 as Dc,E5 as _c,Dk as or,Df as Ne,Dj as Pc,T4 as wc,T5 as Tc,Cr as vc,T6 as ir,fj as dr,T7 as Fc,Ct as xc,Cs as Sn,T8 as Bc,T9 as Lc,Ta as Rc,N6 as Oc,Tb as Bt,Tc as Uc,yd as lr,lm as jc,hP as Mc,Ea as Nc,Td as ur,f5 as Vc,f6 as Hc,Te as Gc,dj as $c,fn as zc,E0 as Yc,DW as qe,bs as Zc,bJ as Kc,cC as Wc,bK as qc,Mj as Qc}from"./zeni-epic-state-D1OApLJ3.js";import{f as Re,cp as mr,s as we,cq as Cr,cr as pr,cs as Jc,O as ea,a0 as Lt,ct as Xc,cu as eo,Z as hr,a as fr,$ as gr,w as ye,A as ue,c as Z,ar as ya,cv as Sr,cw as ao,cx as to,z as te,C as Ta,ce as nt,cy as no,cz as ro,cA as so,J as va,aS as Ze,br as Rt,cB as co,H as Fa,p as rt,y as Ot,g as X,a9 as st,cC as oo,bE as ba,cD as kt,cE as io,E as Ut,cF as lo,au as br,a4 as Et,cG as uo,_ as yr,e as Ir,j as kr,cH as mo,cI as Co,cJ as po,cK as ho,cL as fo,cM as go,cN as So,o as Za,cO as bo,cP as yo,cQ as ht,S as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,d as Po}from"./index-CdzL9szH.js";import{n as He,D as Er,S as wo}from"./mui-BCzMCgwZ.js";import{a as r}from"./sentry-Cix5j_Oe.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-fe0P1a5j.js";import{M as Ie}from"./MobileAppDrawer-7KFASJmR.js";import{d as jt}from"./recharts-BJColP3b.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Xe,f as aa,h as ta,A as To,i as Mt,P as vo,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as bn}from"./SetupPagesScreen-D-KjoZ4s.js";import{u as wr}from"./useInitialThreadRequest-E7aaQNIx.js";import ct from"./NotFoundScreen-1FWTFg5q.js";import{u as Vt}from"./useChargeCardPusherEvents-BbwX5V1a.js";import{n as yn}from"./utils-CvfvTDv6.js";import{t as Bo}from"./AddressScreen-DqXE5RDJ.js";import"./analytics-CO5gayAE.js";import"./plaid-B0k6aBM1.js";import"./dnd-C7lg2kUY.js";import"./stripe-cKAAJElX.js";import"./lottie-C4eBAM7n.js";import"./lexical-Cceo9d8G.js";import"./pdf-C1ioMmzA.js";import"./analyticsHelper-BaOtwD25.js";import"./routePaths-CHhQNN3M.js";import"./BusinessVerificationPageScreen-DlMhX3L_.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2d9d0d72-6fec-4e62-9300-fc4bdf5aecd6",e._sentryDebugIdIdentifier="sentry-dbid-2d9d0d72-6fec-4e62-9300-fc4bdf5aecd6")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=me(),n=i((a=>Pt(a.cardPolicyState))),t=i((a=>os(a.cardPolicyState)));r.useEffect((()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())}),[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((E=>{S(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>Tn(E.cardPolicyState))),B=i((E=>vn(E.cardPolicyState))),L=i((E=>Fn(E.cardPolicyState))),p=i((E=>xn(E.cardPolicyState))),h=i((E=>Bn(E.cardPolicyState))),v=i((E=>Pt(E.cardPolicyState))),u=i((E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount)),T=i((E=>E.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())}),[a,w]),vr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),b=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(Tr)),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect((()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))}),[T,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),W=E.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:E.newStack}})}),[n.state,e,_]),G=r.useCallback((()=>{e(_)}),[e,_]),Q=r.useCallback((E=>{a(hs(E))}),[a]),I=r.useCallback((E=>{const W=Cr(E);a(fs({templates:[W]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),K=r.useCallback((()=>{a(fn())}),[a]),J=r.useRef($);r.useEffect((()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:b,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:K})]}):c.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>Ss(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>Tn(o.cardPolicyState))),p=i((o=>vn(o.cardPolicyState))),h=i((o=>Fn(o.cardPolicyState))),v=i((o=>xn(o.cardPolicyState))),u=i((o=>Bn(o.cardPolicyState))),T=i((o=>Pt(o.cardPolicyState))),k=i((o=>On(o))),U=i((o=>a!=null?bs(o.cardPolicyState,a):void 0)),A=r.useMemo((()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0),[l.templateId,l.formDraft,U,a]);r.useEffect((()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))}),[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect((()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())}),[s,j]),vr();const b=i((o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const x=r.useMemo((()=>B.map(Mo)),[B]),d=r.useMemo((()=>u.map(No)),[u]),f=r.useMemo((()=>k.cards.filter((o=>!mr(o.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:v})}),[A,f,x,d,b,L,p,h,v]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),K=r.useRef(D);r.useEffect((()=>{const o=K.current;K.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((_=>{S(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),v=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),T=ya(L.fetchState);r.useEffect((()=>{if(T==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(T==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,T]);const k=B.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||a(ws())}),[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect((()=>{A==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const b=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||v>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:K}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),W=gr(),ne=i((oe=>Mn(oe))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),Te=r.useMemo((()=>Fr(q,ke,3)),[q,ke]),[fe,se]=r.useState(""),Ee=W&&E&&K!=null&&!J,re=r.useCallback((oe=>{if(K==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${K}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})}),[N.pathname,N.state,I,K]),Ce=r.useCallback((oe=>{oe.trim().length!==0&&(se(""),re(oe))}),[re]),Ae=r.useCallback((()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))}),[fe,re]),ee=r.useCallback((()=>{}),[]),ve=r.useCallback((oe=>{se(oe)}),[]),De=r.useCallback((()=>{o(!0)}),[o]),ae=r.useCallback((()=>{re(void 0)}),[re]);return r.useMemo((()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:Te,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:ve,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[fe,D,Ee,G,Q,ne,ve,ae,De,Ce,ee,Ae,Te])})({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(Sr,{...d}):null,M=l&&f==null,V=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})}),[n.state,e]),O=r.useCallback((()=>{t!=null&&e(`/${t}/cards/policy/new`)}),[e,t]),R=r.useCallback((_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)}),[e,t]),z=r.useCallback((_=>{a(Ts(_))}),[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:b,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Zo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i((q=>ge(q))),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(Z.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(Z.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((q=>da(q,s.companyId))),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:b}=i((q=>ua(q))),x=i((q=>q.classListState.fetchState)),d=!F&&u&&l,f=i((q=>Tt(q,n,d,u))),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",K=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Ya()),K&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,K]),r.useEffect((()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))}),[M,f,n,t]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}}),[f.fetchState,C,N]),r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&u&&l&&g&&t(vt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())}),[A.fetchState,b.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,v,T,l),W=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(Ta,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Ko="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Wo=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(vs({uiState:{sortKey:n,sortOrder:t}}))}}}))(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i((j=>ge(j))),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(Z.isCardsCommentingEnabled),[S,P]=r.useState(!1),m=i((j=>ma(j))),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback((()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Jo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Wo),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Jo=e=>`/${e}/cards`,Xo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i((I=>ge(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,v=i((I=>Fs(I,s))),u=v.chargeCard,T=i((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Z.isDebitCardFeatureEnabled),b=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),P(!0)),m===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[m,v.fetchState,S,T]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&v.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}}),[v.fetchState,u?.type.code,F,v.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i((I=>Hn(I.userState,B.userId))),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect((()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(G,3e3),w(!0))}),[v.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(T!=="Completed"||u==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:v,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
1
|
+
import{j as c}from"./liveblocks-C8AAaKDR.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Je,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-Da6TLrNx.js";import{fa as Pt,Sc as os,fm as wt,bt as Fe,Sd as is,Se as ds,e$ as fn,Sf as Pn,f8 as wn,Sg as Tn,Sh as vn,Si as Fn,Sj as xn,f9 as Bn,fl as Ln,Sk as Rn,Sl as ls,ff as us,fe as ms,Sm as Cs,Cq as On,fo as ia,Sn as ps,So as hs,f1 as fs,f0 as gs,fB as Ze,fh as Un,fg as jn,Sp as Ss,fi as bs,BX as ys,BW as Is,B_ as ks,C0 as Es,fu as As,eY as Mn,Sq as Ds,Sr as _s,fz as Nn,Ss as Ps,fA as yt,C6 as ws,C3 as Ts,eZ as ge,St as qa,fE as xe,fF as Be,fG as Le,gA as da,cx as la,Su as ua,Sv as Tt,vc as $a,kO as za,Sw as Za,CG as ka,fp as Qe,CI as vt,kE as Vn,Sx as ma,Cu as _a,Sy as vs,Sz as Fs,Cx as Qa,SA as xs,QA as Ja,fk as Hn,CD as Sa,hZ as Bs,SB as Gn,fb as Ca,bo as Ls,SC as Rs,gl as Xa,gk as et,Da as Os,gj as at,Qg as Us,SD as $n,cq as zn,cS as js,Qz as wa,DL as Zn,SE as gn,Dl as Pa,SF as Yn,DM as Ms,QY as Ns,DN as Vs,ES as Hs,uw as Gs,EM as $s,SG as zs,CH as ca,SH as Zs,SI as Ys,SJ as Ks,SK as Ws,SL as qs,SM as Ft,SN as Qs,CX as Kn,CQ as Js,SO as Xs,gC as ec,D4 as Wn,D8 as qn,gB as ac,SP as tc,Dx as Qn,SQ as nc,SR as rc,SS as sc,D6 as Jn,CT as Xn,CA as er,D0 as ar,C_ as tr,D2 as cc,ST as nr,SU as oc,fw as ic,fx as dc,fy as lc,SV as tt,fq as rr,cU as xt,SW as uc,SX as mc,SY as Cc,SZ as pc,Dg as It,DE as hc,DA as fc,Dc as gc,DC as Sc,Ds as bc,Du as yc,S_ as sr,DK as Ga,KB as Ic,S$ as kc,T0 as Ec,T1 as Ac,T2 as cr,T3 as Dc,E5 as _c,Dk as or,Df as Ne,Dj as Pc,T4 as wc,T5 as Tc,Cr as vc,T6 as ir,fj as dr,T7 as Fc,Ct as xc,Cs as Sn,T8 as Bc,T9 as Lc,Ta as Rc,N6 as Oc,Tb as Bt,Tc as Uc,yd as lr,lm as jc,hP as Mc,Ea as Nc,Td as ur,f5 as Vc,f6 as Hc,Te as Gc,dj as $c,fn as zc,E0 as Zc,DW as qe,bs as Yc,bJ as Kc,cC as Wc,bK as qc,Mj as Qc}from"./zeni-epic-state-BqRlfhza.js";import{d as Re,cp as mr,r as we,cq as Cr,cr as pr,cs as Jc,O as ea,a0 as Lt,ct as Xc,cu as eo,Y as hr,a as fr,_ as gr,v as ye,A as ue,c as Y,ar as ya,cv as Sr,cw as ao,cx as to,z as te,D as Ta,ce as nt,cy as no,cz as ro,cA as so,J as va,aS as Ye,br as Rt,cB as co,H as Fa,k as rt,y as Ot,e as X,a9 as st,cC as oo,bE as ba,cD as kt,cE as io,E as Ut,cF as lo,au as br,a4 as Et,cG as uo,Z as yr,w as Ir,g as kr,cH as mo,cI as Co,cJ as po,cK as ho,cL as fo,cM as go,cN as So,o as Ya,cO as bo,cP as yo,cQ as ht,$ as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,i as Po}from"./index-Bwczg7nO.js";import{n as He,D as Er,S as wo}from"./mui-CosLSKUu.js";import{a as r}from"./sentry-DfheywaX.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-vhjzTbBd.js";import{M as Ie}from"./MobileAppDrawer-D_5ajcgl.js";import{d as jt}from"./recharts-9jMEgSjc.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Xe,f as aa,h as ta,A as To,i as Mt,P as vo,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as bn}from"./SetupPagesScreen-Du6z7K4L.js";import{u as wr}from"./useInitialThreadRequest-CRJnx1_Z.js";import ct from"./NotFoundScreen-vodaR6J5.js";import{u as Vt}from"./useChargeCardPusherEvents-B9JTMflJ.js";import{n as yn}from"./utils-BykfwIo5.js";import{t as Bo}from"./AddressScreen-BVRFr_N1.js";import"./analytics-D_NuuF2U.js";import"./plaid-2mv_ck83.js";import"./dnd-DC_qF3Wr.js";import"./stripe-cKAAJElX.js";import"./lottie-B7_cpoe1.js";import"./lexical-CQoPutFC.js";import"./pdf-CQB-J2hc.js";import"./analyticsHelper-C7Ffbo_X.js";import"./routePaths-Kh8F22Sq.js";import"./BusinessVerificationPageScreen-DrCLmIxZ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fccc5416-b8b0-4020-a9de-0c89a3d8cfd7",e._sentryDebugIdIdentifier="sentry-dbid-fccc5416-b8b0-4020-a9de-0c89a3d8cfd7")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=me(),n=i((a=>Pt(a.cardPolicyState))),t=i((a=>os(a.cardPolicyState)));r.useEffect((()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())}),[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((E=>{S(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>Tn(E.cardPolicyState))),B=i((E=>vn(E.cardPolicyState))),L=i((E=>Fn(E.cardPolicyState))),p=i((E=>xn(E.cardPolicyState))),h=i((E=>Bn(E.cardPolicyState))),v=i((E=>Pt(E.cardPolicyState))),u=i((E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount)),T=i((E=>E.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())}),[a,w]),vr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),b=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(Tr)),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect((()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))}),[T,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),W=E.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:E.newStack}})}),[n.state,e,_]),G=r.useCallback((()=>{e(_)}),[e,_]),Q=r.useCallback((E=>{a(hs(E))}),[a]),I=r.useCallback((E=>{const W=Cr(E);a(fs({templates:[W]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),K=r.useCallback((()=>{a(fn())}),[a]),J=r.useRef($);r.useEffect((()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:b,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:K})]}):c.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>Ss(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>Tn(o.cardPolicyState))),p=i((o=>vn(o.cardPolicyState))),h=i((o=>Fn(o.cardPolicyState))),v=i((o=>xn(o.cardPolicyState))),u=i((o=>Bn(o.cardPolicyState))),T=i((o=>Pt(o.cardPolicyState))),k=i((o=>On(o))),U=i((o=>a!=null?bs(o.cardPolicyState,a):void 0)),A=r.useMemo((()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0),[l.templateId,l.formDraft,U,a]);r.useEffect((()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))}),[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect((()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())}),[s,j]),vr();const b=i((o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const x=r.useMemo((()=>B.map(Mo)),[B]),d=r.useMemo((()=>u.map(No)),[u]),f=r.useMemo((()=>k.cards.filter((o=>!mr(o.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:v})}),[A,f,x,d,b,L,p,h,v]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),K=r.useRef(D);r.useEffect((()=>{const o=K.current;K.current=D,D==="Completed"&&o!=="Completed"&&(s(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Zo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((_=>{S(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(Y.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),v=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),T=ya(L.fetchState);r.useEffect((()=>{if(T==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(T==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,T]);const k=B.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||a(ws())}),[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect((()=>{A==="In-Progress"&&U==="Completed"&&a(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const b=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||v>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:K}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),W=gr(),ne=i((oe=>Mn(oe))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),Te=r.useMemo((()=>Fr(q,ke,3)),[q,ke]),[fe,se]=r.useState(""),Ee=W&&E&&K!=null&&!J,re=r.useCallback((oe=>{if(K==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${K}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})}),[N.pathname,N.state,I,K]),Ce=r.useCallback((oe=>{oe.trim().length!==0&&(se(""),re(oe))}),[re]),Ae=r.useCallback((()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))}),[fe,re]),ee=r.useCallback((()=>{}),[]),ve=r.useCallback((oe=>{se(oe)}),[]),De=r.useCallback((()=>{o(!0)}),[o]),ae=r.useCallback((()=>{re(void 0)}),[re]);return r.useMemo((()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:Te,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:ve,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[fe,D,Ee,G,Q,ne,ve,ae,De,Ce,ee,Ae,Te])})({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(Sr,{...d}):null,M=l&&f==null,V=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})}),[n.state,e]),O=r.useCallback((()=>{t!=null&&e(`/${t}/cards/policy/new`)}),[e,t]),R=r.useCallback((_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)}),[e,t]),z=r.useCallback((_=>{a(Ts(_))}),[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:b,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Yo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i((q=>ge(q))),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(Y.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(Y.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((q=>da(q,s.companyId))),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:b}=i((q=>ua(q))),x=i((q=>q.classListState.fetchState)),d=!F&&u&&l,f=i((q=>Tt(q,n,d,u))),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",K=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Za()),K&&t(Ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,K]),r.useEffect((()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))}),[M,f,n,t]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}}),[f.fetchState,C,N]),r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&u&&l&&g&&t(vt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())}),[A.fetchState,b.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Za());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,v,T,l),W=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(Ta,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Ko="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Wo=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(vs({uiState:{sortKey:n,sortOrder:t}}))}}}))(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i((j=>ge(j))),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(Y.isCardsCommentingEnabled),[S,P]=r.useState(!1),m=i((j=>ma(j))),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback((()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Jo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Wo),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Jo=e=>`/${e}/cards`,Xo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i((I=>ge(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ye.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,v=i((I=>Fs(I,s))),u=v.chargeCard,T=i((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Y.isDebitCardFeatureEnabled),b=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),P(!0)),m===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[m,v.fetchState,S,T]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&v.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}}),[v.fetchState,u?.type.code,F,v.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i((I=>Hn(I.userState,B.userId))),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect((()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(G,3e3),w(!0))}),[v.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(T!=="Completed"||u==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:v,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Xo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -11,18 +11,18 @@ import{j as c}from"./liveblocks-0jcT8Dx_.js";import{u as me,j as i,h as le,g as
|
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
align-items: center;
|
|
13
13
|
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,Ka=ea.getLocalizedStrings().dateFormat,ri={overlayWidth:new Fa(100,100,58)},Nr=[jr,ot],si=new Set(Nr),ci=Pe((function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Ns(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Vs(e.depositAccountState,e.depositAccountListState)}}),(function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:y,isCashbackInfoFetchStateCompleted:g,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:P,controllerEmails:m,paymentDetails:C,productInformation:F,cashbackInformation:w,paymentSourceInformation:l,creditAccountInformation:j,debitAccountInformation:B,paymentInitiatedDate:L,sourcePage:p}=n,{tenantEmailDomain:h}=a,v=()=>{e(
|
|
14
|
+
`,Ka=ea.getLocalizedStrings().dateFormat,ri={overlayWidth:new Fa(100,100,58)},Nr=[jr,ot],si=new Set(Nr),ci=Pe((function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Ns(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Vs(e.depositAccountState,e.depositAccountListState)}}),(function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:y,isCashbackInfoFetchStateCompleted:g,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:P,controllerEmails:m,paymentDetails:C,productInformation:F,cashbackInformation:w,paymentSourceInformation:l,creditAccountInformation:j,debitAccountInformation:B,paymentInitiatedDate:L,sourcePage:p}=n,{tenantEmailDomain:h}=a,v=()=>{e(Zn(!0));const u=aa(a);u!=null&&u!==""&&e(Pa(u,!0,!0)),e(Qe(!0))};return{onBackNavigation:()=>{if(g&&S&&P&&w!=null&&X.trackCardsPayEarlyFormClick(m,F,w,"Back",C.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:C.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:C.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:C.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:C.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:L?.add(3,"day").format(Ka.visual.MMMDCommaYYYYformat),paymentInitiatedDate:L?.format(Ka.visual.MMMDCommaYYYYformat)},l,j,B),p==="cardPaymentHistory")n.closeDrawerHandler(!0),e(Yn());else{const u=ta(h);t(u)}},onUpdatePaymentAccountStatus:(u,T,k)=>{e($s(u,T,"bill_pay","bill_pay_detail",k))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:u=>{e(Gs("external_account",u))},onEstablishConnectionClick:u=>{e(Hs(u,a.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{s?window.open(`/${h}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{y?window.open(`/${h}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onEventReceived:u=>{si.has(u)&&v()},onPusherSubscribed:v}}))(st(oo)),Zt=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:y,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isDebitCardInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:C,isCashbackInfoFetchStateCompleted:F,paymentInitiatedDate:w,retryRepayment:l})=>{const j=le(),{useDynamicConfig:B}=ue(),{configValue:L}=B(Ye.zeniAccountsConfig),p=Us(L),h=i((E=>$n(E))),{creditAccount:v}=i((E=>ua(E))),u=i((E=>ge(E))),T=Ot(),k=va(),U=me(),A=te.getSignedInUser(),b=Re(),[x,d]=r.useState(!1),[f,M]=r.useState(!1),{configValue:V}=B(Ye.zeniCardsConfig),O=V.credit_card_auto_pay_threshold_by_company_id?.[u.companyId]??V.default_credit_card_auto_pay_threshold??To,R=zn(b?.loggedInUserRoleMap),z=js(b?.loggedInUserRoleMap),$=!!u.companyZeniAccountInfo?.info?.isZeniAccountEnabled,_=i((E=>wa(E,u.companyId))),D=_.companyChargeCardInfo?.primaryFundingAccount,G=_.allFundingAccounts.find((E=>E.id===D?.accountId)),Q=i((E=>da(E,u.companyId))),I=la(Q.controllers);r.useEffect((()=>{if(h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&U(Zn()),h.fetchState==="Completed"&&!f){const E=u.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,W=h.transferFromAccounts.find((q=>q.id===E));let ne;if(y==="cardPaymentHistory"&&l){const q=l.paymentAccountId!=null?h.transferFromAccounts.find((ke=>ke.id===l.paymentAccountId)):void 0;ne={amount:l.amount,isAutoRepayment:u.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:yn(),transferFrom:q??W}}else ne={amount:{amount:v.balance.amount+v.hold.amount,currencyCode:v.balance.currencyCode,currencySymbol:v.balance.currencySymbol},isAutoRepayment:u.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:yn(),transferFrom:W};U(gn(ne)),M(!0)}}),[h.fetchState,f,y,l,h.transferFromAccounts,u.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,u.companyChargeCardInfo?.info?.isAutoPayEnabled,v.balance.amount,v.balance.currencyCode,v.balance.currencySymbol,v.hold.amount,U]);const N={isZeniCheckingEnabled:u.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:G?.accType==="depositAccount",creditCardPaymentSourceAccountName:G?.label,creditCardPaymentSourceAccountType:G?.accType,creditCardPaymentSourceLastFourDigits:G?.accountLast4,creditCardPaymentSourceBalance:G?.accountBalance?.available?.amount??0};if(r.useEffect((()=>{_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&U(Pa(u.companyId,!0))}),[_.fetchState]),r.useEffect((()=>{h.updateStatus==="Completed"&&P!=null&&F&&C&&m&&X.trackCardsPayEarlyPayNowClick(I,s,P,h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:w?.add(3,"day").format(Ka.visual.MMMDCommaYYYYformat),paymentInitiatedDate:w?.format(Ka.visual.MMMDCommaYYYYformat)},N,g,S)}),[h.updateStatus,P,F,C,m,w]),r.useEffect((()=>{h.fetchState==="Completed"&&P!=null&&F&&C&&m&&!x&&e&&f&&P!=null&&(X.trackCardsPayEarlyFormView(I,s,P,t,u.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,v.balance.amount,N,g,S),d(!0))}),[h,F,C,m,x,e,f]),A==null)throw Error("Can't access invite people page without signing in...");const K=()=>{n(!0),U(Yn())},J=aa(u),o={events:e?ha(J,Nr):[],eventCallback:(E,W,ne)=>{ne.onEventReceived(E)},onSubscribed:E=>{E.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(Er,{onClose:()=>{K()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:ri.overlayWidth.valuePercentage(k),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:T.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(oi,{onClick:E=>E.stopPropagation(),children:c.jsx(ci,{...o,closeDrawerHandler:n,navigate:j,paymentDetails:h,creditAccountSpentAmount:a,onTransferClick:()=>{F&&C&&m&&P!=null&&X.trackCardsPayEarlyFormClick(I,s,P,"Pay Now",h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},N,g,S),U(Ms({companyId:u.companyId}))},onDismissClick:K,onSaveChangesToLocalStore:E=>{U(gn(E))},currentTenant:u,hasZeniAccountsAdminAccess:R,isZeniAccountsUser:z,isZeniAccountSetupEnabled:$,productInformation:s,sourcePage:y,controllerEmails:I,autoPayThreshold:O,paymentSourceInformation:N,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isCashbackInfoFetchStateCompleted:F,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:m,paymentInitiatedDate:w,maxInsuredAmount:p.maxInsuredAmount})})})})},oi=He(wo)`
|
|
15
15
|
display: flex;
|
|
16
16
|
min-height: 100%;
|
|
17
17
|
flex-direction: column;
|
|
18
|
-
`,Zt=e=>e!=null&&typeof e=="object"?e:null,de=e=>typeof e=="string"?e:void 0,Me=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Wa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!Wa(n.transaction_status)&&!!Wa(n.transaction_type)},Kt=(e,n)=>{const t=e?.card_status;if(!Wa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},At=[Br,Lr,Rr,Or,Ur,pa,Ht,ot,Gt,$t,zt],Vr=[Ra,La],ii=new Set([...At,...Vr]),St=ea.getLocalizedStrings().dateFormat,di=Pe((function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:y}=n,g=te.getSignedInUser(),S=e.tenantState.currentTenantId,P={userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:S??""},m=Tt(e,a,t,y),C=Xs(e,a),F=ec(e);return{chargeCardDetailView:m,chargeCardsRecurringExpensesState:C,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:P,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${br.cardMicroServiceBaseUrl}`,signedInUserToken:m.twoFAView.token??s}}),(function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:y,cardProviderId:g,includeCreditAccountInfo:S,setIsPaymentOpen:P,controllerEmails:m,productInformation:C,cashbackInformation:F,primaryFundingAccountDetails:w,creditAccountInformation:l,debitAccountInformation:j,isChargeCardFeatureEnabled:B}=n,{tenantEmailDomain:L}=a;return{onEventReceived:(p,h)=>{(({event:v,data:u,cardId:T,dispatch:k,subscribedEvents:U})=>{const A=Zt(u);switch(v){case Ra:case La:return void k(_a(!0));case Br:{const b=de(A?.card_id);if(b==null||b!==T)return;const x=de(A?.transaction_id),d=A?.transaction_status;return x!=null&&Wa(d)?void k(Qs({transactionId:x,transactionStatus:d})):void k(ca(T,null,null,!0))}case pa:{const b=de(A?.card_id)??T;if(b!==T)return;const x=Kt(A,b);return x!=null?void k(Ft(x)):void k(Sa(T,!0))}case Ht:{const b=de(A?.card_id)??T;if(b!==T)return;const x=de(A?.currency_code),d=de(A?.currency_symbol),f=Me(A?.balance);return x!=null&&d!=null&&f!=null?(k(qs({cardId:b,currencyCode:x,currencySymbol:d,balance:f,hold:Me(A?.hold),dailyPurchaseSpends:Me(A?.daily_purchase_spends),monthlyPurchaseSpends:Me(A?.monthly_purchase_spends),dailyWithdrawals:Me(A?.daily_withdrawals),monthlyWithdrawals:Me(A?.monthly_withdrawals)})),void k(Qe(!0))):(k(Sa(T,!0)),void k(Qe(!0)))}case ot:{const b=de(A?.currency_code),x=de(A?.currency_symbol),d=Me(A?.available_amount),f=Me(A?.balance_amount);return b!=null&&x!=null&&d!=null&&f!=null?void k(Ws({currencyCode:b,currencySymbol:x,available:d,balance:f,hold:Me(A?.hold_amount),cashback:Me(A?.cashback_amount)})):void k(Qe(!0))}case Lr:{const b=de(A?.card_id)??T;if(b!==T)return;const x=A?.transaction;return gt(x)?void k(Ks({cardId:b,transaction:x})):void k(ca(T,null,null,!0))}case Rr:{const b=de(A?.card_id)??T;if(b!==T)return;const x=A?.transaction;return gt(x)?void k(Zs({cardId:b,declineReason:de(A?.decline_reason),transaction:x})):void k(ca(T,null,null,!0))}case Or:{const b=de(A?.card_id)??T;if(b!==T)return;const x=A?.transaction;return gt(x)?void k(Ys({cardId:b,transaction:x})):void k(ca(T,null,null,!0))}case Ur:{const b=de(A?.card_id)??T;if(b!==T)return;const x=de(A?.transaction_id),d=A?.attachment_file_paths;return x!=null&&Array.isArray(d)&&d.every((f=>typeof f=="string"))?void k(zs({cardId:b,transactionId:x,attachmentFilePaths:d})):void k(ca(T,null,null,!0))}case Gt:case $t:case zt:{const b=de(A?.card_id);if(b==null||b!==T)return;k(Sa(T,!0))}}})({event:p,data:h,cardId:t,dispatch:e,subscribedEvents:ii})},onPusherSubscribed:()=>{e(Sa(t,!0)),e(ca(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,B))},onFetchChargeCardTransactionList:(p,h)=>{e(ca(t,p,h))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{g!=null&&e(at(p,"ChargeCardHolder",t))},onResendOtp:p=>{g!=null&&e(et(p,"ChargeCardHolder",t))},onVerifyOtp:(p,h)=>{g!=null&&e(Xa(p,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:p=>{p!=null&&te.saveZeniOtpTokenForCardHolder(p,t)},onColorCodeChange:p=>{e(cc(t,p))},onLockChargeCard:(p,h)=>{e(tr(p,t,h))},onUnlockChargeCard:p=>{e(ar(p,t))},onCloseChargeCard:p=>{e(er(t,p))},onFetchChargeCardsRecurringExpenses:()=>{e(Xn([t]))},updateChargeCardName:(p,h)=>{e(Jn(p,t,h))},updateChargeCardTransactionAttachments:(p,h)=>{h!=null&&e(sc({transactionId:p,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,h,v,u)=>{e(rc({chargeCardId:h,transactionId:p,fetchState:v,error:u}))},updateChargeCardTransactionReceiptsShowTick:(p,h,v)=>{e(nc({chargeCardId:h,transactionId:p,shouldShowTick:v}))},onChargeCardRevokeInviteClick:()=>{e(Qn(t))},updateChargeCardTransactionIsViewReceiptClicked:(p,h,v)=>{e(tc({chargeCardId:h,transactionId:p,isViewReceiptClicked:v}))},onChargeCardTransactionRowClick:(p,h)=>{const v=ye(y.state?.pathnameStackToGoBack,y.pathname);s(`../../transaction/${p}/${h}`,{state:{pathnameStackToGoBack:v}})},onBackClick:()=>{const p=we(y.state?.pathnameStackToGoBack),h=ta(L);s(h,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(ac())},onUpdateDebitCardPinAttempt:p=>{e(qn(t,p)),p==="success"&&e(Ye({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,h)=>{p?e(Ye({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):h!=null&&e(Ye({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h.message}]}))},updateSpendLimit(p,h,v,u){e(Wn(p,h,v.code,u))},shouldOpenCreditCardPaymentDrawer(p){p&&F!=null&&X.trackCardsPayEarlyClick(m,C,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},l,j),P(p)}}}))(st(lo));function li(){const e=le(),n=me(),t=he(),{cardId:a}=Ve(),[s,y]=r.useState(!1),[g,S]=r.useState(!1),{useDynamicConfig:P}=ue(),m=te.getSignedInUser(),C=i((Y=>ge(Y))),F=i((Y=>qa(Y).firstViewAfterActivation)),w=i((Y=>Y.classListState.fetchState)),{configValue:l}=P(Ze.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:j}=P(Ze.zeniCardsConfig),B=j.enable_card_controls_for_company_ids,L=j.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(B)&&B.includes(C.companyId),[p,h]=r.useState(!1),[v,u]=r.useState(!1),{useFeatureGate:T}=ue(),{isFeatureEnabled:k}=T(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=T(Z.isDebitCardFeatureEnabled),A=Le(U,C),b=Oe({isDebitCardFeatureEnabled:U,isBankingOnlyTenant:A}),{isFeatureEnabled:x}=T(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=T(Z.isCardsCommentingEnabled),f=Be(C),M=xe(C),V=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:k,isBookKeepingTenant:f,isDebitCardProductVisible:b,chargeCardsCreditAccountLimit:V}),R=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,$=!C.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const _=i((Y=>wa(Y,C.companyId))),{creditAccount:D,creditAccountRepayment:G}=i((Y=>ua(Y))),Q=te.getZeniOtpTokenForCardHolder(a),I=i((Y=>Tt(Y,a,$,O))),{isAiCfoAccessEnabled:N,onAskAiCfoClick:K}=xa({mobileExploreReferrer:"Card Detail"});Lt({isDataReady:I.fetchState==="Completed"});const J=i((Y=>ma(Y))),o=I.chargeCard,E=Re(),W=Fe(E?.loggedInUserRoleMap),ne=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_virtual_debit_card",q=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_physical_credit_card",ke=o?.type.code==="business_virtual_debit_card"||o?.type.code==="business_virtual_credit_card",Te=o?.type.code==="business_virtual_debit_card",fe=Ba(O,z,W,D,G),se=Ar(ne,I),Ee=Mt(W,J),re=Xe(O,b,R,z),Ce=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Ae=i((Y=>da(Y,C.companyId))),ee=la(Ae.controllers),ve=i((Y=>o?.cardCreatedByUser?.userId!=null?$a(Y.userRoleState,o?.cardCreatedByUser?.userId):void 0)),De=i((Y=>ve?.accountingClassIDs[0]!=null?za(Y.classState,{classId:ve?.accountingClassIDs[0],reportId:"class_list"}):void 0)),ae=i((Y=>o?.cardHolderUser?.userId!=null?$a(Y.userRoleState,o?.cardHolderUser?.userId):void 0)),oe=i((Y=>ae?.accountingClassIDs[0]!=null?za(Y.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0)),fa=C?.userRole,na=i((Y=>Ca(Y,!1,b,k).revokeCardInvite)),Oa=ya(na.saveStatus.fetchState);if(r.useEffect((()=>{if(Oa==="In-Progress"&&na.saveStatus.fetchState==="Completed"){const Y=ta(C.tenantEmailDomain);e(Y)}}),[Oa,na.saveStatus.fetchState,e,C.tenantEmailDomain]),r.useEffect((()=>{F&&s===!1&&ke&&(y(!0),setTimeout((()=>{n(Ya()),Te&&n(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[F,s,ke,Te]),r.useEffect((()=>{p||I.fetchState==="Completed"||I.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,$,O,!1)))}),[p,I,a,n]),r.useEffect((()=>{!v&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&ne&&Ce&&W&&(u(!0),n(Kn({depositAccountId:I.chargeCard?.connectedAccountId})))}),[v,I,n,Ce,W]),r.useEffect((()=>{J.fetchState!=="Completed"&&J.fetchState!=="In-Progress"&&W&&n(_a()),w!=="Completed"&&w!=="In-Progress"&&n(Vn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&n(Js({chargeCardId:a})),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&n(Pa(C.companyId,!0))}),[J.fetchState,n,W,w,I.transactionStatistics.fetchState,_.fetchState]),r.useEffect((()=>{if(!(I.fetchState!=="Completed"||O&&D.fetchState!=="Completed"||o==null||I.transactionStatistics.fetchState!=="Completed"||ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Y=o.type.code.includes("physical"),Se=Y?o.cardActivationAttemptHistory[0]?.timestamp:o.createTime;X.trackCardsCardDetailView(ee,re,{cardId:a,cardName:o.cardName,cardType:o.type.code.includes("credit")?"credit":"debit",cardCategory:Y?"physical":"virtual",cardLimit:ba(o.limit.amount),cardLastFourDigits:o.accountLast4,cardStatus:o.status.code,cardAssignedDate:o.createTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:o.providerCardCreateTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:Se?.format(St.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:o.creditLimitFrequency.name,cardSpentAmount:ba(o.balance.amount),cardAvailableLimit:ba(o.available.amount),cardUtilizationPercent:o.limit.amount>0?Math.round((o.limit.amount-o.available.amount)/o.limit.amount*100):0,cardUtilizationAmount:ba(o.limit.amount-o.available.amount),totalNumberOfDeclinedTransactions:I.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:I.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:I.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:I.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:I.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:I.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:kt(o.cardCreatedByUser,!1),cardIssuedByEmail:o.cardCreatedByUser?.email,cardIssuedByUserId:o.cardCreatedByUser?.userId,cardIssuedByRole:ve?.userRoles,cardIssuedByDepartment:De?.className},{cardholderName:kt(o.cardHolderUser,!1),cardholderEmail:o.cardHolderUser?.email,cardholderRole:ae?.userRoles,cardholderUserId:o.cardHolderUser?.userId,cardholderDepartment:oe?.className},fe,se)}}),[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,D.fetchState,W]),m==null)throw Error("Can't access card detail page without signing in...");const dt=aa(C),Ea=W?[...At,...Vr]:At,ra={events:ha(dt,Ea),eventCallback:(Y,Se,ie)=>{ie.onEventReceived(Y,Se)},onSubscribed:Y=>{Y.onPusherSubscribed()}},Aa=()=>{if(a!=null&&o!=null){const{ownerName:Y,cardName:Se,utilisation:ie,limit:Ge,frequency:Ke,cardColor:$e}=bt(o),ze=o.cardHolderUserId===m.userId;X.trackCardsDetailPageViewed(a,Y,Se,ie,Ge,Ke,$e,ze)}};r.useEffect((()=>{if(I.fetchState==="Completed"){const Y=I.chargeCard;if(Y?.status.code==="inactive"||ne&&Y?.isPinSet===!1||q&&F){const Se=_e(C.tenantEmailDomain,a,m,o,F);e(Se)}}}),[I.fetchState]);const lt=(Y,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ke,limit:$e,frequency:ze}=bt(o),sa=o.cardHolderUserId===m.userId;X.trackCardsDetailPageClicked(a,ie,Ge,Ke,$e,ze,Y,sa,Se)}},ut=(Y,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ke,limit:$e,frequency:ze}=bt(o),sa=o.cardHolderUserId===m.userId;X.trackCardsVerifyPopUpClick(a,ie,Ge,Ke,$e,ze,Y,sa,Se)}},pe=D.balance.amount+D.hold.amount,Ua=C.companyChargeCardInfo?.info?.primaryFundingAccount,Da=_.allFundingAccounts.find((Y=>Y.id===Ua?.accountId)),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||na.saveStatus.fetchState==="In-Progress"||!Ma&&ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(io,{}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?c.jsx(Ut,{analytics:X,onLoad:Aa}):null,g===!0?c.jsx(Yt,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:g,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!ne||!W||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||D.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!W||J.fetchState==="Completed",paymentInitiatedDate:G.initiatedRepaymentDate}):null,c.jsx(di,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Rt(),signedInUser:m,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:ve?.userRoles,cardIssuedByDepartmentName:De?.className,cardHolderRoles:ae?.userRoles,cardHolderDepartmentName:oe?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:R,isChargeCardSetupEnabled:z,isCardControlsEnabled:L,isEarlyPayEnabled:x,controllerEmails:ee,chargeCardCashbackDetailState:J,productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,classListFetchState:w,primaryFundingAccountDetails:Da,currentTenant:C,cardProviderId:I.chargeCard?.cardProviderID,cardId:a,creditAccount:D,creditAccountRepayment:G,includeCreditAccountInfo:$,signedInUserToken:Q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:l.documentAiReceiptMaxSizeLimitBytes!=null?l.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:K,isCardsCommentingEnabled:d})]}):c.jsx(ct,{})}const bt=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,y=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:y,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ui,subheadline:mi,pageTitle:Ci}}}}=ea.getLocalizedStrings(),Hr=[pa,ot,Mr,La,Ra,it,zt,Ko,Gt,$t,Ht],pi=new Set(Hr),Dt=jt(((e,n,t,a)=>{e(ia(n,t,a,!0))}),400),hi=He.div`
|
|
18
|
+
`,Yt=e=>e!=null&&typeof e=="object"?e:null,de=e=>typeof e=="string"?e:void 0,Me=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Wa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!Wa(n.transaction_status)&&!!Wa(n.transaction_type)},Kt=(e,n)=>{const t=e?.card_status;if(!Wa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},At=[Br,Lr,Rr,Or,Ur,pa,Ht,ot,Gt,$t,zt],Vr=[Ra,La],ii=new Set([...At,...Vr]),St=ea.getLocalizedStrings().dateFormat,di=Pe((function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:y}=n,g=te.getSignedInUser(),S=e.tenantState.currentTenantId,P={userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:S??""},m=Tt(e,a,t,y),C=Xs(e,a),F=ec(e);return{chargeCardDetailView:m,chargeCardsRecurringExpensesState:C,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:P,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${br.cardMicroServiceBaseUrl}`,signedInUserToken:m.twoFAView.token??s}}),(function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:y,cardProviderId:g,includeCreditAccountInfo:S,setIsPaymentOpen:P,controllerEmails:m,productInformation:C,cashbackInformation:F,primaryFundingAccountDetails:w,creditAccountInformation:l,debitAccountInformation:j,isChargeCardFeatureEnabled:B}=n,{tenantEmailDomain:L}=a;return{onEventReceived:(p,h)=>{(({event:v,data:u,cardId:T,dispatch:k,subscribedEvents:U})=>{const A=Yt(u);switch(v){case Ra:case La:return void k(_a(!0));case Br:{const b=de(A?.card_id);if(b==null||b!==T)return;const x=de(A?.transaction_id),d=A?.transaction_status;return x!=null&&Wa(d)?void k(Qs({transactionId:x,transactionStatus:d})):void k(ca(T,null,null,!0))}case pa:{const b=de(A?.card_id)??T;if(b!==T)return;const x=Kt(A,b);return x!=null?void k(Ft(x)):void k(Sa(T,!0))}case Ht:{const b=de(A?.card_id)??T;if(b!==T)return;const x=de(A?.currency_code),d=de(A?.currency_symbol),f=Me(A?.balance);return x!=null&&d!=null&&f!=null?(k(qs({cardId:b,currencyCode:x,currencySymbol:d,balance:f,hold:Me(A?.hold),dailyPurchaseSpends:Me(A?.daily_purchase_spends),monthlyPurchaseSpends:Me(A?.monthly_purchase_spends),dailyWithdrawals:Me(A?.daily_withdrawals),monthlyWithdrawals:Me(A?.monthly_withdrawals)})),void k(Qe(!0))):(k(Sa(T,!0)),void k(Qe(!0)))}case ot:{const b=de(A?.currency_code),x=de(A?.currency_symbol),d=Me(A?.available_amount),f=Me(A?.balance_amount);return b!=null&&x!=null&&d!=null&&f!=null?void k(Ws({currencyCode:b,currencySymbol:x,available:d,balance:f,hold:Me(A?.hold_amount),cashback:Me(A?.cashback_amount)})):void k(Qe(!0))}case Lr:{const b=de(A?.card_id)??T;if(b!==T)return;const x=A?.transaction;return gt(x)?void k(Ks({cardId:b,transaction:x})):void k(ca(T,null,null,!0))}case Rr:{const b=de(A?.card_id)??T;if(b!==T)return;const x=A?.transaction;return gt(x)?void k(Ys({cardId:b,declineReason:de(A?.decline_reason),transaction:x})):void k(ca(T,null,null,!0))}case Or:{const b=de(A?.card_id)??T;if(b!==T)return;const x=A?.transaction;return gt(x)?void k(Zs({cardId:b,transaction:x})):void k(ca(T,null,null,!0))}case Ur:{const b=de(A?.card_id)??T;if(b!==T)return;const x=de(A?.transaction_id),d=A?.attachment_file_paths;return x!=null&&Array.isArray(d)&&d.every((f=>typeof f=="string"))?void k(zs({cardId:b,transactionId:x,attachmentFilePaths:d})):void k(ca(T,null,null,!0))}case Gt:case $t:case zt:{const b=de(A?.card_id);if(b==null||b!==T)return;k(Sa(T,!0))}}})({event:p,data:h,cardId:t,dispatch:e,subscribedEvents:ii})},onPusherSubscribed:()=>{e(Sa(t,!0)),e(ca(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,B))},onFetchChargeCardTransactionList:(p,h)=>{e(ca(t,p,h))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{g!=null&&e(at(p,"ChargeCardHolder",t))},onResendOtp:p=>{g!=null&&e(et(p,"ChargeCardHolder",t))},onVerifyOtp:(p,h)=>{g!=null&&e(Xa(p,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:p=>{p!=null&&te.saveZeniOtpTokenForCardHolder(p,t)},onColorCodeChange:p=>{e(cc(t,p))},onLockChargeCard:(p,h)=>{e(tr(p,t,h))},onUnlockChargeCard:p=>{e(ar(p,t))},onCloseChargeCard:p=>{e(er(t,p))},onFetchChargeCardsRecurringExpenses:()=>{e(Xn([t]))},updateChargeCardName:(p,h)=>{e(Jn(p,t,h))},updateChargeCardTransactionAttachments:(p,h)=>{h!=null&&e(sc({transactionId:p,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,h,v,u)=>{e(rc({chargeCardId:h,transactionId:p,fetchState:v,error:u}))},updateChargeCardTransactionReceiptsShowTick:(p,h,v)=>{e(nc({chargeCardId:h,transactionId:p,shouldShowTick:v}))},onChargeCardRevokeInviteClick:()=>{e(Qn(t))},updateChargeCardTransactionIsViewReceiptClicked:(p,h,v)=>{e(tc({chargeCardId:h,transactionId:p,isViewReceiptClicked:v}))},onChargeCardTransactionRowClick:(p,h)=>{const v=ye(y.state?.pathnameStackToGoBack,y.pathname);s(`../../transaction/${p}/${h}`,{state:{pathnameStackToGoBack:v}})},onBackClick:()=>{const p=we(y.state?.pathnameStackToGoBack),h=ta(L);s(h,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(ac())},onUpdateDebitCardPinAttempt:p=>{e(qn(t,p)),p==="success"&&e(Ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,h)=>{p?e(Ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):h!=null&&e(Ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h.message}]}))},updateSpendLimit(p,h,v,u){e(Wn(p,h,v.code,u))},shouldOpenCreditCardPaymentDrawer(p){p&&F!=null&&X.trackCardsPayEarlyClick(m,C,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},l,j),P(p)}}}))(st(lo));function li(){const e=le(),n=me(),t=he(),{cardId:a}=Ve(),[s,y]=r.useState(!1),[g,S]=r.useState(!1),{useDynamicConfig:P}=ue(),m=te.getSignedInUser(),C=i((Z=>ge(Z))),F=i((Z=>qa(Z).firstViewAfterActivation)),w=i((Z=>Z.classListState.fetchState)),{configValue:l}=P(Ye.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:j}=P(Ye.zeniCardsConfig),B=j.enable_card_controls_for_company_ids,L=j.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(B)&&B.includes(C.companyId),[p,h]=r.useState(!1),[v,u]=r.useState(!1),{useFeatureGate:T}=ue(),{isFeatureEnabled:k}=T(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=T(Y.isDebitCardFeatureEnabled),A=Le(U,C),b=Oe({isDebitCardFeatureEnabled:U,isBankingOnlyTenant:A}),{isFeatureEnabled:x}=T(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=T(Y.isCardsCommentingEnabled),f=Be(C),M=xe(C),V=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:k,isBookKeepingTenant:f,isDebitCardProductVisible:b,chargeCardsCreditAccountLimit:V}),R=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,$=!C.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const _=i((Z=>wa(Z,C.companyId))),{creditAccount:D,creditAccountRepayment:G}=i((Z=>ua(Z))),Q=te.getZeniOtpTokenForCardHolder(a),I=i((Z=>Tt(Z,a,$,O))),{isAiCfoAccessEnabled:N,onAskAiCfoClick:K}=xa({mobileExploreReferrer:"Card Detail"});Lt({isDataReady:I.fetchState==="Completed"});const J=i((Z=>ma(Z))),o=I.chargeCard,E=Re(),W=Fe(E?.loggedInUserRoleMap),ne=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_virtual_debit_card",q=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_physical_credit_card",ke=o?.type.code==="business_virtual_debit_card"||o?.type.code==="business_virtual_credit_card",Te=o?.type.code==="business_virtual_debit_card",fe=Ba(O,z,W,D,G),se=Ar(ne,I),Ee=Mt(W,J),re=Xe(O,b,R,z),Ce=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Ae=i((Z=>da(Z,C.companyId))),ee=la(Ae.controllers),ve=i((Z=>o?.cardCreatedByUser?.userId!=null?$a(Z.userRoleState,o?.cardCreatedByUser?.userId):void 0)),De=i((Z=>ve?.accountingClassIDs[0]!=null?za(Z.classState,{classId:ve?.accountingClassIDs[0],reportId:"class_list"}):void 0)),ae=i((Z=>o?.cardHolderUser?.userId!=null?$a(Z.userRoleState,o?.cardHolderUser?.userId):void 0)),oe=i((Z=>ae?.accountingClassIDs[0]!=null?za(Z.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0)),fa=C?.userRole,na=i((Z=>Ca(Z,!1,b,k).revokeCardInvite)),Oa=ya(na.saveStatus.fetchState);if(r.useEffect((()=>{if(Oa==="In-Progress"&&na.saveStatus.fetchState==="Completed"){const Z=ta(C.tenantEmailDomain);e(Z)}}),[Oa,na.saveStatus.fetchState,e,C.tenantEmailDomain]),r.useEffect((()=>{F&&s===!1&&ke&&(y(!0),setTimeout((()=>{n(Za()),Te&&n(Ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[F,s,ke,Te]),r.useEffect((()=>{p||I.fetchState==="Completed"||I.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,$,O,!1)))}),[p,I,a,n]),r.useEffect((()=>{!v&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&ne&&Ce&&W&&(u(!0),n(Kn({depositAccountId:I.chargeCard?.connectedAccountId})))}),[v,I,n,Ce,W]),r.useEffect((()=>{J.fetchState!=="Completed"&&J.fetchState!=="In-Progress"&&W&&n(_a()),w!=="Completed"&&w!=="In-Progress"&&n(Vn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&n(Js({chargeCardId:a})),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&n(Pa(C.companyId,!0))}),[J.fetchState,n,W,w,I.transactionStatistics.fetchState,_.fetchState]),r.useEffect((()=>{if(!(I.fetchState!=="Completed"||O&&D.fetchState!=="Completed"||o==null||I.transactionStatistics.fetchState!=="Completed"||ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Z=o.type.code.includes("physical"),Se=Z?o.cardActivationAttemptHistory[0]?.timestamp:o.createTime;X.trackCardsCardDetailView(ee,re,{cardId:a,cardName:o.cardName,cardType:o.type.code.includes("credit")?"credit":"debit",cardCategory:Z?"physical":"virtual",cardLimit:ba(o.limit.amount),cardLastFourDigits:o.accountLast4,cardStatus:o.status.code,cardAssignedDate:o.createTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:o.providerCardCreateTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:Se?.format(St.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:o.creditLimitFrequency.name,cardSpentAmount:ba(o.balance.amount),cardAvailableLimit:ba(o.available.amount),cardUtilizationPercent:o.limit.amount>0?Math.round((o.limit.amount-o.available.amount)/o.limit.amount*100):0,cardUtilizationAmount:ba(o.limit.amount-o.available.amount),totalNumberOfDeclinedTransactions:I.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:I.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:I.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:I.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:I.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:I.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:kt(o.cardCreatedByUser,!1),cardIssuedByEmail:o.cardCreatedByUser?.email,cardIssuedByUserId:o.cardCreatedByUser?.userId,cardIssuedByRole:ve?.userRoles,cardIssuedByDepartment:De?.className},{cardholderName:kt(o.cardHolderUser,!1),cardholderEmail:o.cardHolderUser?.email,cardholderRole:ae?.userRoles,cardholderUserId:o.cardHolderUser?.userId,cardholderDepartment:oe?.className},fe,se)}}),[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,D.fetchState,W]),m==null)throw Error("Can't access card detail page without signing in...");const dt=aa(C),Ea=W?[...At,...Vr]:At,ra={events:ha(dt,Ea),eventCallback:(Z,Se,ie)=>{ie.onEventReceived(Z,Se)},onSubscribed:Z=>{Z.onPusherSubscribed()}},Aa=()=>{if(a!=null&&o!=null){const{ownerName:Z,cardName:Se,utilisation:ie,limit:Ge,frequency:Ke,cardColor:$e}=bt(o),ze=o.cardHolderUserId===m.userId;X.trackCardsDetailPageViewed(a,Z,Se,ie,Ge,Ke,$e,ze)}};r.useEffect((()=>{if(I.fetchState==="Completed"){const Z=I.chargeCard;if(Z?.status.code==="inactive"||ne&&Z?.isPinSet===!1||q&&F){const Se=_e(C.tenantEmailDomain,a,m,o,F);e(Se)}}}),[I.fetchState]);const lt=(Z,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ke,limit:$e,frequency:ze}=bt(o),sa=o.cardHolderUserId===m.userId;X.trackCardsDetailPageClicked(a,ie,Ge,Ke,$e,ze,Z,sa,Se)}},ut=(Z,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ke,limit:$e,frequency:ze}=bt(o),sa=o.cardHolderUserId===m.userId;X.trackCardsVerifyPopUpClick(a,ie,Ge,Ke,$e,ze,Z,sa,Se)}},pe=D.balance.amount+D.hold.amount,Ua=C.companyChargeCardInfo?.info?.primaryFundingAccount,Da=_.allFundingAccounts.find((Z=>Z.id===Ua?.accountId)),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||na.saveStatus.fetchState==="In-Progress"||!Ma&&ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(io,{}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?c.jsx(Ut,{analytics:X,onLoad:Aa}):null,g===!0?c.jsx(Zt,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:g,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!ne||!W||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||D.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!W||J.fetchState==="Completed",paymentInitiatedDate:G.initiatedRepaymentDate}):null,c.jsx(di,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Rt(),signedInUser:m,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:ve?.userRoles,cardIssuedByDepartmentName:De?.className,cardHolderRoles:ae?.userRoles,cardHolderDepartmentName:oe?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:R,isChargeCardSetupEnabled:z,isCardControlsEnabled:L,isEarlyPayEnabled:x,controllerEmails:ee,chargeCardCashbackDetailState:J,productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,classListFetchState:w,primaryFundingAccountDetails:Da,currentTenant:C,cardProviderId:I.chargeCard?.cardProviderID,cardId:a,creditAccount:D,creditAccountRepayment:G,includeCreditAccountInfo:$,signedInUserToken:Q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:l.documentAiReceiptMaxSizeLimitBytes!=null?l.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:K,isCardsCommentingEnabled:d})]}):c.jsx(ct,{})}const bt=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,y=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:y,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ui,subheadline:mi,pageTitle:Ci}}}}=ea.getLocalizedStrings(),Hr=[pa,ot,Mr,La,Ra,it,zt,Ko,Gt,$t,Ht],pi=new Set(Hr),Dt=jt(((e,n,t,a)=>{e(ia(n,t,a,!0))}),400),hi=He.div`
|
|
19
19
|
display: flex;
|
|
20
20
|
width: 100%;
|
|
21
21
|
flex: 1 1 auto;
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
align-items: center;
|
|
24
24
|
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,fi=Pe((function(e,n){const t=Ca(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:uc(e),bulkActionView:mc(e),companyLegalName:n.currentTenant.companyName,admins:n.admins,searchText:t.searchText,uiState:t.uiState,signedInUser:n.signedInUser}}),(function(e,n){const{navigateAndClearBulkSelection:t,currentTenant:a,location:s,signedInUser:y,chargeCardListState:g,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:P,isCreditCardProductVisibleForExpressInterest:m,isChargeCardSetupEnabled:C,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:l,isChargeCardTOSAccepted:j,controllerEmails:B,depositAccountListWithDebitCardIssued:L,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:h,productInformation:v,cashbackInformation:u,creditAccountInformation:T,debitAccountInformation:k,updatePayNowInfoTooltip:U,isUserHasCardsAdminLevelAccess:A}=n,{tenantEmailDomain:b}=a,{cards:x}=g;return{onChargeCardRowClick:(d,f)=>{const M=_r(x,d);let V;M!=null&&((R=>{const z=R.limit.amount-R.available.amount,$=`${R.cardHolderUser?.firstName.toLowerCase()} ${R.cardHolderUser?.lastName.toLowerCase()}`,_=R.cardName,D=R.department?.className??"",G=R.limit.amount,Q=R.creditLimitFrequency.name;X.trackCardsListRowClicked($,_,D,z,G,Q,y.userId===R.cardHolderUserId)})(M),oa(F,w,L)&&X.trackCardsCardListRowClick(B,v,"Card Row Item","row_clicked",f+1,{cardOwner:kt(M.cardHolderUser,!1),cardName:M.cardName,cardType:M.type.code.includes("credit")?"credit":"debit",cardStatus:M.status.code,cardUtilizationAmount:ba(M.limit.amount-M.available.amount),cardUtilizationPercent:M.limit.amount>0?Math.round((M.limit.amount-M.available.amount)/M.limit.amount*100):0,cardLimit:ba(M.limit.amount)},u,T,k)),V=M?.status.code==="request_on_hold"&&y.userId===M.cardHolderUserId?Pr(b):_e(b,d,y,M);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(V,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:d=>{e(Xn(d))},onFetchDepositAccountLimit:d=>{e(Kn({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(yc(d))},onChargeCardRevokeInviteClick:d=>{e(Qn(d))},onLockChargeCardList:(d,f)=>{e(bc(d,f))},onUnlockChargeCardList:d=>{e(Sc(d))},onCloseChargeCardList:(d,f)=>{e(gc(d,f))},onRevokeChargeCardList:d=>{e(fc(d))},updateChargeCardListSpendLimit(d,f,M){e(hc(d,f,M.code))},onLockChargeCard:(d,f)=>{e(tr(A,d,f))},onUnlockChargeCard:d=>{e(ar(A,d))},onCloseChargeCard:(d,f)=>{e(er(d,f))},onUpdateSpendLimit(d,f,M,V){e(Wn(d,f,M.code,V))},updateChargeCardName:(d,f)=>{e(Jn(A,d,f))},onClickSetupIcon:()=>{X.trackCardsListPageClicked("settings"),oa(F,w,L)&&u!=null&&X.trackCardsSettingsClick(B,v,u,T,k);const d=Fo(b),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{X.trackCardsListPageClicked("new card"),oa(F,w,L)&&u!=null&&X.trackCardsNewCardClick(B,v,u,"New Button","card_creation_initiated","Card List",T,k);const d=gi(b),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(d,f)=>{oa(F,w,L)&&u!=null&&X.trackCardsCardListSortClick(B,v,u,"Sort Icon","sort",d,f==="ascending"?"ASC":"DESC","Cards List",T,k),e(It({uiState:{sortKey:d,sortOrder:f}}))},onSearchTextChanged:d=>{e(pc(d))},onReloadCards:()=>{e(ia(S,F&&w,P&&C,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{oa(F,w,L)&&u!=null&&X.trackCardsCashbackOverviewClick(B,v,u,"Cashback Overview","cashback_details_viewed",T,k),t("./cashback")},onClickStatementsIcon:()=>{oa(F,w,L)&&u!=null&&X.trackCardsStatementsClick(B,v,u,T,k),t("./statements")},onCreateNowClick:d=>{oa(F,w,L)&&u!=null&&X.trackCardsNewCardClick(B,v,u,"Promo Banner","card_creation_initiated","Card List",T,k),t(`./new?cardType=${d}`)},onPromoCardClick:d=>{t(d==="debit"&&F&&!l||d==="credit"&&m&&!j?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,f)=>{h==="Completed"&&a.company!=null&&u!=null&&X.trackCardsPayEarlyClick(B,v,u,"Card List",d,f,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},T,k);const M=Si(b);t(M)},navigateToCreditCardPaymentHistoryPage:()=>{const d=bi(b),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:U,onSetRowActionCardId:d=>{e(Cc(d))},onSetBulkActionCardIds:d=>{e(nr(d))},onEventReceived:d=>{pi.has(d)&&Dt(e,S,F&&w,P&&C)},onPusherSubscribed:()=>{Dt(e,S,F&&w,P&&C)}}}))(st(Co));function kn({isPaymentDrawerOpen:e}){const n=le(),t=me(),a=he(),s=r.useCallback(((H,je)=>{t(nr([])),n(H,je)}),[t,n]),[y,g]=r.useState(!1),[S,P]=r.useState(te.getPayNowInfoTooltip()??!1),m=H=>{te.savePayNowInfoTooltip(H),P(H)},[C,F]=r.useState(!1),w=te.getSignedInUser(),l=i((H=>ge(H))),[j,B]=r.useState(!1),[L,p]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Cards"}),u=l.userRole.includes("charge_card_user"),T=!u,k=!!l.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:U,useDynamicConfig:A}=ue(),{isFeatureEnabled:b}=U(Z.isCashbackFeatureEnabled),{isFeatureEnabled:x}=U(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=U(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=U(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:M}=U(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:V}=U(Z.isCardsCommentingEnabled),{isFeatureEnabled:O}=U(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:R}=U(Z.isCardPolicyEnabled),{isFeatureEnabled:z}=U(Z.isAiCardCreationEnabled),$=Le(d,l),_=Oe({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:$}),D=xe(l),G=Be(l),Q=l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Ue({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G,isDebitCardProductVisible:_,chargeCardsCreditAccountLimit:Q}),N=Dr({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G}),{configValue:K}=A(Ze.zeniCardsConfig),J=Re(),o=Fe(J?.loggedInUserRoleMap),E=i((H=>da(H,l.companyId))),W=la(E.controllers),ne=K.charge_card_cashback_rate_per_transaction!=null?K.charge_card_cashback_rate_per_transaction:.0175,q=K.credit_card_pay_now_threshold_by_company_id?.[l.companyId]??K.default_credit_card_pay_now_threshold??vo,ke=K.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(K.enable_card_controls_for_company_ids)&&K.enable_card_controls_for_company_ids.includes(l.companyId),Te=!!l.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,fe=!!l.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,se=!!l.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=!!l.company?.companyChargeCardInfo?.isChargeCardEnabled,re=!!l.company?.companyDebitCardInfo?.isDebitCardEnabled,Ce=i((H=>$n(H))),Ae=ya(Ce.updateStatus),ee=i((H=>Ca(H,T,_&&k,I&&se))),ve=i((H=>oc(H))),De=i((H=>ic(H))),ae=i((H=>dc(H))),oe=i((H=>lc(H))),fa=i((H=>ae==null?[]:Nn(H.aiCfoState,ae).filter((je=>je.kind==="creating_cards"))),_t),na=ya(De.fetchState);r.useEffect((()=>{na==="In-Progress"&&De.fetchState==="Completed"&&ae!=null&&fa.forEach((H=>{t(yt({chatSessionId:ae,id:H.id,entityIds:oe,kind:"created_cards"}))}))}),[t,De.fetchState,ae,oe,fa,na]);const Oa=ee.cards.filter((H=>H.type.code.includes("debit"))).map((H=>H.connectedAccountId)),dt=[...new Set(Oa)],Ea=i((H=>ma(H))),ra=i((H=>tt(H,dt))),Aa=i((H=>wa(H,l.companyId))),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find((H=>H.id===lt?.accountId)),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback((()=>o===!0&&R===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(l.tenantEmailDomain??"")!==!0),[o,R,pe,l.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect((()=>{Ma(Da())}),[Da]);const Y=()=>{te.saveCardPolicyPopupSeen(l.tenantEmailDomain??"",!0),Ma(!1)},Se=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;uo({isDataReady:pe==="Completed",pageContext:Se?"cards_creation":"cards"});const{creditAccountRepayment:ie}=i((H=>ua(H))),Ge=i((H=>qa(H).firstViewAfterActivation)),{areTenantIdsInSync:Ke}=yr(),$e=Mt(o,Ea),ze=Ba(I,se,o,Ua,ie),sa=Nt(_,k,o,ra,ee.debitCardSummary),mt=Xe(I,_,k,se),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect((()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<q*ee.creditAccount.limit.amount/100)&&m(!0)}),[pe,q,Ct,ee.creditAccount.limit.amount]),r.useEffect((()=>{if(e!=null&&e===!0&&ie.initiatedRepayments.amount===0&&ie.fetchState==="Completed"||Ae==="In-Progress"&&Ce.updateStatus==="Completed")m(!1),g(!0);else if(ie.initiatedRepayments.amount>0&&ie.fetchState==="Completed"){g(!1),document.body.style.overflow="auto";const H=ta(l.tenantEmailDomain);s(H)}}),[e,ie.initiatedRepayments.amount,ie.fetchState,Ae,Ce.updateStatus,s,l.tenantEmailDomain]),r.useEffect((()=>{!j&&(se||k)&&(Ee||re)&&Ke&&(B(!0),t(ia(T,_&&k,I&&se,!1)))}),[j,T,t,Ke,Ee,re]),r.useEffect((()=>{Ge&&C===!1&&(F(!0),setTimeout((()=>{t(Ya())}),5e3))}),[Ge,C]),r.useEffect((()=>()=>{Dt.flush()}),[]),r.useEffect((()=>{pe==="Completed"&&u&&ee.cards.length===1&&(ee.cards[0].status.code==="inactive"&&ee.cards[0].type.code==="business_physical_credit_card"?s(`./${ee.cards[0].id}/activate`):ee.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))}),[pe,u,a.state,s,ee.cards]),r.useEffect((()=>{if(pe==="Completed"&&u){const H=ee.cards.length,je=ee.cards.filter((We=>We.cardHolderUserId===w?.userId)).filter((We=>We.status.code==="request_on_hold"));je.length>0&&H===je.length&&s("./onboard")}}),[pe,ee.cards,u,s,w?.userId]),r.useEffect((()=>{pe!=="Completed"||I&&ie.fetchState!=="Completed"||_&&k&&o&&ra.fetchState!=="Completed"||X.trackCardsCardListView(W,mt,$e,ze,sa)}),[pe,Ua,ie.fetchState,ra.fetchState,o]),w==null)throw Error("Can't access charge card list page without signing in...");const Yr=i((H=>rr(H.userState,H.userRoleState,H.userListViewState,"cardAdmin"))),Wt=xt(J?.loggedInUserRoleMap),qt=H=>{p(H)},Zr=ee.creditAccount.limit,Kr=()=>{g(!1),s("..")},Wr=l.companyChargeCardInfo?.info!=null&&Ia({cardInfo:l.companyChargeCardInfo.info,isProductVisible:I&&Ee,isTOSAccepted:Te,isSetupEnabled:se,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),qr=l.companyDebitCardInfo?.info!=null&&Ia({cardInfo:l.companyDebitCardInfo.info,isProductVisible:_&&re,isTOSAccepted:fe,isSetupEnabled:k,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Qr=Wr||qr,Qt=(function(H){const{isEmptyCardsState:je,isChargeCardAdmin:We,isFileUploadEnabled:an}=H,tn=le(),Na=he(),{tenantEmailDomain:Va}=Ve(),{isAiCfoOpen:ts,setIsAiCfoOpen:nn}=hr(),ns=fr(),rs=gr(),rn=i((be=>Mn(be))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:sn,isResolved:cn}=xr("cards_creation"),on=r.useMemo((()=>Fr(sn,cn,3)),[sn,cn]),[Ha,pt]=r.useState(""),dn=rs&&ns&&Va!=null&&!ts,ga=r.useCallback((be=>{if(Va==null)return;const ss=ye(Na.state?.pathnameStackToGoBack,Na.pathname);tn(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:ss,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})}),[Na.pathname,Na.state,tn,Va]),ln=r.useCallback((be=>{be.trim().length!==0&&(pt(""),ga(be))}),[ga]),un=r.useCallback((()=>{const be=Ha.trim();be.length!==0&&(pt(""),ga(be))}),[Ha,ga]),mn=r.useCallback((()=>{}),[]),Cn=r.useCallback((be=>{pt(be)}),[]),pn=r.useCallback((()=>{nn(!0)}),[nn]),hn=r.useCallback((()=>{ga(void 0)}),[ga]);return r.useMemo((()=>{if(dn&&je&&We)return{aiAgentName:Ci,headline:ui,subheadline:mi,promptChips:on,composer:{currentInput:Ha,isSubmitting:rn,isFileUploadEnabled:an,onInputChange:Cn,onSubmit:un,onStopSubmit:mn},onPromptClick:ln,onOpenSidePanel:pn,onOpenFullView:hn,dataTestIdPrefix:"cards-ai-cfo-hero"}}),[Ha,dn,We,je,an,rn,Cn,hn,pn,ln,mn,un,on])})({isEmptyCardsState:Se,isChargeCardAdmin:o,isFileUploadEnabled:O}),Jt=z&&Qt!=null?c.jsx(Sr,{...Qt}):null,{isCardsShuttingDown:Xt,shutdownContent:en}=Ir(l.tenantId,l.company?.managementInfo?.receiverEmails),Jr=Xt===!0&&en!=null?c.jsx(mo,{shutdownContent:en}):null,Xr=h&&Jt==null,es=aa(l),as={events:ha(es,Hr),eventCallback:(H,je,We)=>{We.onEventReceived(H)},onSubscribed:H=>{H.onPusherSubscribed()}};return se||k?c.jsxs(c.Fragment,{children:[pe==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:X,onLoad:()=>{X.trackPageLoaded(kr.Event.cardsListPage),(I&&!se||_&&!k)&&X.trackCardsPromoView(W,{isCreditCardOffered:I,isDebitCardOffered:_,isDebitCardEnabled:k,isCreditCardEnabled:se},"Banner",_&&!k?"Debit Card":I&&!se?"Credit Card":"","Card List")}}),c.jsx(nt,{showConfetti:Ge})]}):null,y===!0?c.jsx(Yt,{closeDrawerHandler:Kr,isPaymentDrawerOpen:y,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:sa,cashbackInformation:$e,isDebitCardInfoFetchStateCompleted:!(_&&k&&o)||ra.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ie.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!o||Ea.fetchState==="Completed",paymentInitiatedDate:ie.initiatedRepaymentDate}):null,c.jsxs(hi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:L,handleDrawerToggle:qt}),c.jsx(fi,{...as,isCashbackFeatureEnabled:b,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:m,showPayNowInfoTooltip:S,creditCardPayNowThreshold:q,signedInUser:w,chargeCardListState:ee,location:a,admins:Yr.users,navigateAndClearBulkSelection:s,currentTenant:l,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:l.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:o,includeCreditAccountDebitSummaryAndCashbackInfo:T,onClickMenuIcon:()=>{qt(!0)},creditLimit:Zr,isChargeCardSetupEnabled:se,isChargeCardEnabledOnCompany:Ee,isDebitCardSetupEnabled:k,isDebitCardEnabledOnCompany:re,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:M,cashbackRate:ne,controllerEmails:W,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:ra,isChargeCardTOSAccepted:Te,isDebitCardTOSAccepted:fe,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:sa,cashbackInformation:$e,isAiCfoAccessEnabled:Xr,onAskAiCfoClick:v,isCardsCommentingEnabled:V,cardsAiCfoHero:Jt,cardsShutdownBanner:Jr,isCardsShuttingDown:Xt,onClickPolicyIcon:o&&R?()=>n(yi(l.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Y,pendingCreationCount:ve})]})]}):(Te||fe)&&o===!0?c.jsx(Je,{to:"../setup"}):Qr?c.jsx(Je,{to:"../promo"}):c.jsx(Ta,{fetchState:pe})}const gi=e=>`/${e}/cards/new`,Si=e=>`/${e}/cards/payment`,bi=e=>`/${e}/cards/payment-history`,yi=e=>`/${e}/cards/policy`,Gr=[jr,Mr],Ii=new Set(Gr),ki=Pe((function(e){const n=te.getSignedInUser(),t=ge(e),a=e.tenantState.currentTenantId,s=sr(e),y={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},g=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:Ic(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:y,companyName:g,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}}),(function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=we(t.state?.pathnameStackToGoBack),y=s.poppedPathname??"..";a(y,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,y)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:y}}})},onFiltersChange:s=>{e(Ec({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{Ii.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(kc({uiState:{downloadState:s}}))}}}))(st(po));function Ei(){const e=le(),n=he(),t=me(),{areTenantIdsInSync:a}=yr(),{useFeatureGate:s}=ue();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const y=i((o=>ge(o))),g=i((o=>sr(o))),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(null),B=!y.userRole.includes("charge_card_user"),L=!!y.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=s(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(Z.isDebitCardFeatureEnabled),v=Le(h,y),u=Oe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:v}),T=xe(y),k=Be(y),U=y.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Ue({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:p,isBookKeepingTenant:k,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:U}),b=!!y.companyChargeCardInfo?.info?.isChargeCardEnabled,x=Re(),d=Fe(x?.loggedInUserRoleMap),f=i((o=>Ca(o,B,u&&L,A&&b))),M=r.useMemo((()=>{const o=f.cards.filter((E=>E.type.code.includes("debit")));return[...new Set(o.map((E=>E.connectedAccountId)))]}),[f.cards]),V=i((o=>ma(o))),O=i((o=>tt(o,M))),{creditAccountRepayment:R}=i((o=>ua(o))),z=r.useMemo((()=>Mt(d,V)),[d,V]),$=r.useMemo((()=>Ba(A,b,d,f.creditAccount,R)),[A,b,d,f.creditAccount,R]),_=r.useMemo((()=>Nt(u,L,d,O,f.debitCardSummary)),[u,L,d,O,f.debitCardSummary]),D=r.useMemo((()=>Xe(A,u,L,b)),[A,u,L,b]),G=f.creditAccount.balance.amount+f.creditAccount.hold.amount,Q=r.useMemo((()=>l!=null?g.repaymentHistory.find((o=>o.cardRepaymentId===l)):void 0),[l,g.repaymentHistory]),I=r.useCallback((o=>{j(o),t(ia(B,u&&L,A&&b,!1)),w(!0)}),[t,B,u,L,A,b]),N=r.useCallback((()=>{w(!1),j(null),document.body.style.overflow="auto"}),[]);r.useEffect((()=>{S||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(P(!0),t(Ga()))}),[S,t,g.fetchState]),r.useEffect((()=>{!m&&(b||L)&&a&&(C(!0),t(ia(B,!1,A&&b,!1)))}),[m,b,L,a,t,B,A]);const K=aa(y),J={events:ha(K,Gr),eventCallback:(o,E,W)=>{W.onEventReceived(o)},onSubscribed:o=>{o.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[F?c.jsx(Yt,{closeDrawerHandler:N,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:G,productInformation:D,creditAccountInformation:$,debitAccountInformation:_,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(u&&L&&d)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||R.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||V.fetchState==="Completed",paymentInitiatedDate:R.initiatedRepaymentDate,retryRepayment:Q}):null,c.jsx(ki,{...J,location:n,navigate:e,accountInfoByAccountId:g.accountInfoByAccountId,onRetryPaymentClick:I})]})}const En=He.div`
|
|
25
|
+
`,fi=Pe((function(e,n){const t=Ca(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:uc(e),bulkActionView:mc(e),companyLegalName:n.currentTenant.companyName,admins:n.admins,searchText:t.searchText,uiState:t.uiState,signedInUser:n.signedInUser}}),(function(e,n){const{navigateAndClearBulkSelection:t,currentTenant:a,location:s,signedInUser:y,chargeCardListState:g,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:P,isCreditCardProductVisibleForExpressInterest:m,isChargeCardSetupEnabled:C,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:l,isChargeCardTOSAccepted:j,controllerEmails:B,depositAccountListWithDebitCardIssued:L,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:h,productInformation:v,cashbackInformation:u,creditAccountInformation:T,debitAccountInformation:k,updatePayNowInfoTooltip:U,isUserHasCardsAdminLevelAccess:A}=n,{tenantEmailDomain:b}=a,{cards:x}=g;return{onChargeCardRowClick:(d,f)=>{const M=_r(x,d);let V;M!=null&&((R=>{const z=R.limit.amount-R.available.amount,$=`${R.cardHolderUser?.firstName.toLowerCase()} ${R.cardHolderUser?.lastName.toLowerCase()}`,_=R.cardName,D=R.department?.className??"",G=R.limit.amount,Q=R.creditLimitFrequency.name;X.trackCardsListRowClicked($,_,D,z,G,Q,y.userId===R.cardHolderUserId)})(M),oa(F,w,L)&&X.trackCardsCardListRowClick(B,v,"Card Row Item","row_clicked",f+1,{cardOwner:kt(M.cardHolderUser,!1),cardName:M.cardName,cardType:M.type.code.includes("credit")?"credit":"debit",cardStatus:M.status.code,cardUtilizationAmount:ba(M.limit.amount-M.available.amount),cardUtilizationPercent:M.limit.amount>0?Math.round((M.limit.amount-M.available.amount)/M.limit.amount*100):0,cardLimit:ba(M.limit.amount)},u,T,k)),V=M?.status.code==="request_on_hold"&&y.userId===M.cardHolderUserId?Pr(b):_e(b,d,y,M);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(V,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:d=>{e(Xn(d))},onFetchDepositAccountLimit:d=>{e(Kn({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(yc(d))},onChargeCardRevokeInviteClick:d=>{e(Qn(d))},onLockChargeCardList:(d,f)=>{e(bc(d,f))},onUnlockChargeCardList:d=>{e(Sc(d))},onCloseChargeCardList:(d,f)=>{e(gc(d,f))},onRevokeChargeCardList:d=>{e(fc(d))},updateChargeCardListSpendLimit(d,f,M){e(hc(d,f,M.code))},onLockChargeCard:(d,f)=>{e(tr(A,d,f))},onUnlockChargeCard:d=>{e(ar(A,d))},onCloseChargeCard:(d,f)=>{e(er(d,f))},onUpdateSpendLimit(d,f,M,V){e(Wn(d,f,M.code,V))},updateChargeCardName:(d,f)=>{e(Jn(A,d,f))},onClickSetupIcon:()=>{X.trackCardsListPageClicked("settings"),oa(F,w,L)&&u!=null&&X.trackCardsSettingsClick(B,v,u,T,k);const d=Fo(b),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{X.trackCardsListPageClicked("new card"),oa(F,w,L)&&u!=null&&X.trackCardsNewCardClick(B,v,u,"New Button","card_creation_initiated","Card List",T,k);const d=gi(b),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(d,f)=>{oa(F,w,L)&&u!=null&&X.trackCardsCardListSortClick(B,v,u,"Sort Icon","sort",d,f==="ascending"?"ASC":"DESC","Cards List",T,k),e(It({uiState:{sortKey:d,sortOrder:f}}))},onSearchTextChanged:d=>{e(pc(d))},onReloadCards:()=>{e(ia(S,F&&w,P&&C,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{oa(F,w,L)&&u!=null&&X.trackCardsCashbackOverviewClick(B,v,u,"Cashback Overview","cashback_details_viewed",T,k),t("./cashback")},onClickStatementsIcon:()=>{oa(F,w,L)&&u!=null&&X.trackCardsStatementsClick(B,v,u,T,k),t("./statements")},onCreateNowClick:d=>{oa(F,w,L)&&u!=null&&X.trackCardsNewCardClick(B,v,u,"Promo Banner","card_creation_initiated","Card List",T,k),t(`./new?cardType=${d}`)},onPromoCardClick:d=>{t(d==="debit"&&F&&!l||d==="credit"&&m&&!j?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,f)=>{h==="Completed"&&a.company!=null&&u!=null&&X.trackCardsPayEarlyClick(B,v,u,"Card List",d,f,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},T,k);const M=Si(b);t(M)},navigateToCreditCardPaymentHistoryPage:()=>{const d=bi(b),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:U,onSetRowActionCardId:d=>{e(Cc(d))},onSetBulkActionCardIds:d=>{e(nr(d))},onEventReceived:d=>{pi.has(d)&&Dt(e,S,F&&w,P&&C)},onPusherSubscribed:()=>{Dt(e,S,F&&w,P&&C)}}}))(st(Co));function kn({isPaymentDrawerOpen:e}){const n=le(),t=me(),a=he(),s=r.useCallback(((H,je)=>{t(nr([])),n(H,je)}),[t,n]),[y,g]=r.useState(!1),[S,P]=r.useState(te.getPayNowInfoTooltip()??!1),m=H=>{te.savePayNowInfoTooltip(H),P(H)},[C,F]=r.useState(!1),w=te.getSignedInUser(),l=i((H=>ge(H))),[j,B]=r.useState(!1),[L,p]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Cards"}),u=l.userRole.includes("charge_card_user"),T=!u,k=!!l.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:U,useDynamicConfig:A}=ue(),{isFeatureEnabled:b}=U(Y.isCashbackFeatureEnabled),{isFeatureEnabled:x}=U(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=U(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=U(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:M}=U(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:V}=U(Y.isCardsCommentingEnabled),{isFeatureEnabled:O}=U(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:R}=U(Y.isCardPolicyEnabled),{isFeatureEnabled:z}=U(Y.isAiCardCreationEnabled),$=Le(d,l),_=Oe({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:$}),D=xe(l),G=Be(l),Q=l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Ue({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G,isDebitCardProductVisible:_,chargeCardsCreditAccountLimit:Q}),N=Dr({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G}),{configValue:K}=A(Ye.zeniCardsConfig),J=Re(),o=Fe(J?.loggedInUserRoleMap),E=i((H=>da(H,l.companyId))),W=la(E.controllers),ne=K.charge_card_cashback_rate_per_transaction!=null?K.charge_card_cashback_rate_per_transaction:.0175,q=K.credit_card_pay_now_threshold_by_company_id?.[l.companyId]??K.default_credit_card_pay_now_threshold??vo,ke=K.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(K.enable_card_controls_for_company_ids)&&K.enable_card_controls_for_company_ids.includes(l.companyId),Te=!!l.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,fe=!!l.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,se=!!l.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=!!l.company?.companyChargeCardInfo?.isChargeCardEnabled,re=!!l.company?.companyDebitCardInfo?.isDebitCardEnabled,Ce=i((H=>$n(H))),Ae=ya(Ce.updateStatus),ee=i((H=>Ca(H,T,_&&k,I&&se))),ve=i((H=>oc(H))),De=i((H=>ic(H))),ae=i((H=>dc(H))),oe=i((H=>lc(H))),fa=i((H=>ae==null?[]:Nn(H.aiCfoState,ae).filter((je=>je.kind==="creating_cards"))),_t),na=ya(De.fetchState);r.useEffect((()=>{na==="In-Progress"&&De.fetchState==="Completed"&&ae!=null&&fa.forEach((H=>{t(yt({chatSessionId:ae,id:H.id,entityIds:oe,kind:"created_cards"}))}))}),[t,De.fetchState,ae,oe,fa,na]);const Oa=ee.cards.filter((H=>H.type.code.includes("debit"))).map((H=>H.connectedAccountId)),dt=[...new Set(Oa)],Ea=i((H=>ma(H))),ra=i((H=>tt(H,dt))),Aa=i((H=>wa(H,l.companyId))),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find((H=>H.id===lt?.accountId)),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback((()=>o===!0&&R===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(l.tenantEmailDomain??"")!==!0),[o,R,pe,l.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect((()=>{Ma(Da())}),[Da]);const Z=()=>{te.saveCardPolicyPopupSeen(l.tenantEmailDomain??"",!0),Ma(!1)},Se=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;uo({isDataReady:pe==="Completed",pageContext:Se?"cards_creation":"cards"});const{creditAccountRepayment:ie}=i((H=>ua(H))),Ge=i((H=>qa(H).firstViewAfterActivation)),{areTenantIdsInSync:Ke}=yr(),$e=Mt(o,Ea),ze=Ba(I,se,o,Ua,ie),sa=Nt(_,k,o,ra,ee.debitCardSummary),mt=Xe(I,_,k,se),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect((()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<q*ee.creditAccount.limit.amount/100)&&m(!0)}),[pe,q,Ct,ee.creditAccount.limit.amount]),r.useEffect((()=>{if(e!=null&&e===!0&&ie.initiatedRepayments.amount===0&&ie.fetchState==="Completed"||Ae==="In-Progress"&&Ce.updateStatus==="Completed")m(!1),g(!0);else if(ie.initiatedRepayments.amount>0&&ie.fetchState==="Completed"){g(!1),document.body.style.overflow="auto";const H=ta(l.tenantEmailDomain);s(H)}}),[e,ie.initiatedRepayments.amount,ie.fetchState,Ae,Ce.updateStatus,s,l.tenantEmailDomain]),r.useEffect((()=>{!j&&(se||k)&&(Ee||re)&&Ke&&(B(!0),t(ia(T,_&&k,I&&se,!1)))}),[j,T,t,Ke,Ee,re]),r.useEffect((()=>{Ge&&C===!1&&(F(!0),setTimeout((()=>{t(Za())}),5e3))}),[Ge,C]),r.useEffect((()=>()=>{Dt.flush()}),[]),r.useEffect((()=>{pe==="Completed"&&u&&ee.cards.length===1&&(ee.cards[0].status.code==="inactive"&&ee.cards[0].type.code==="business_physical_credit_card"?s(`./${ee.cards[0].id}/activate`):ee.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))}),[pe,u,a.state,s,ee.cards]),r.useEffect((()=>{if(pe==="Completed"&&u){const H=ee.cards.length,je=ee.cards.filter((We=>We.cardHolderUserId===w?.userId)).filter((We=>We.status.code==="request_on_hold"));je.length>0&&H===je.length&&s("./onboard")}}),[pe,ee.cards,u,s,w?.userId]),r.useEffect((()=>{pe!=="Completed"||I&&ie.fetchState!=="Completed"||_&&k&&o&&ra.fetchState!=="Completed"||X.trackCardsCardListView(W,mt,$e,ze,sa)}),[pe,Ua,ie.fetchState,ra.fetchState,o]),w==null)throw Error("Can't access charge card list page without signing in...");const Zr=i((H=>rr(H.userState,H.userRoleState,H.userListViewState,"cardAdmin"))),Wt=xt(J?.loggedInUserRoleMap),qt=H=>{p(H)},Yr=ee.creditAccount.limit,Kr=()=>{g(!1),s("..")},Wr=l.companyChargeCardInfo?.info!=null&&Ia({cardInfo:l.companyChargeCardInfo.info,isProductVisible:I&&Ee,isTOSAccepted:Te,isSetupEnabled:se,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),qr=l.companyDebitCardInfo?.info!=null&&Ia({cardInfo:l.companyDebitCardInfo.info,isProductVisible:_&&re,isTOSAccepted:fe,isSetupEnabled:k,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Qr=Wr||qr,Qt=(function(H){const{isEmptyCardsState:je,isChargeCardAdmin:We,isFileUploadEnabled:an}=H,tn=le(),Na=he(),{tenantEmailDomain:Va}=Ve(),{isAiCfoOpen:ts,setIsAiCfoOpen:nn}=hr(),ns=fr(),rs=gr(),rn=i((be=>Mn(be))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:sn,isResolved:cn}=xr("cards_creation"),on=r.useMemo((()=>Fr(sn,cn,3)),[sn,cn]),[Ha,pt]=r.useState(""),dn=rs&&ns&&Va!=null&&!ts,ga=r.useCallback((be=>{if(Va==null)return;const ss=ye(Na.state?.pathnameStackToGoBack,Na.pathname);tn(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:ss,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})}),[Na.pathname,Na.state,tn,Va]),ln=r.useCallback((be=>{be.trim().length!==0&&(pt(""),ga(be))}),[ga]),un=r.useCallback((()=>{const be=Ha.trim();be.length!==0&&(pt(""),ga(be))}),[Ha,ga]),mn=r.useCallback((()=>{}),[]),Cn=r.useCallback((be=>{pt(be)}),[]),pn=r.useCallback((()=>{nn(!0)}),[nn]),hn=r.useCallback((()=>{ga(void 0)}),[ga]);return r.useMemo((()=>{if(dn&&je&&We)return{aiAgentName:Ci,headline:ui,subheadline:mi,promptChips:on,composer:{currentInput:Ha,isSubmitting:rn,isFileUploadEnabled:an,onInputChange:Cn,onSubmit:un,onStopSubmit:mn},onPromptClick:ln,onOpenSidePanel:pn,onOpenFullView:hn,dataTestIdPrefix:"cards-ai-cfo-hero"}}),[Ha,dn,We,je,an,rn,Cn,hn,pn,ln,mn,un,on])})({isEmptyCardsState:Se,isChargeCardAdmin:o,isFileUploadEnabled:O}),Jt=z&&Qt!=null?c.jsx(Sr,{...Qt}):null,{isCardsShuttingDown:Xt,shutdownContent:en}=Ir(l.tenantId,l.company?.managementInfo?.receiverEmails),Jr=Xt===!0&&en!=null?c.jsx(mo,{shutdownContent:en}):null,Xr=h&&Jt==null,es=aa(l),as={events:ha(es,Hr),eventCallback:(H,je,We)=>{We.onEventReceived(H)},onSubscribed:H=>{H.onPusherSubscribed()}};return se||k?c.jsxs(c.Fragment,{children:[pe==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:X,onLoad:()=>{X.trackPageLoaded(kr.Event.cardsListPage),(I&&!se||_&&!k)&&X.trackCardsPromoView(W,{isCreditCardOffered:I,isDebitCardOffered:_,isDebitCardEnabled:k,isCreditCardEnabled:se},"Banner",_&&!k?"Debit Card":I&&!se?"Credit Card":"","Card List")}}),c.jsx(nt,{showConfetti:Ge})]}):null,y===!0?c.jsx(Zt,{closeDrawerHandler:Kr,isPaymentDrawerOpen:y,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:sa,cashbackInformation:$e,isDebitCardInfoFetchStateCompleted:!(_&&k&&o)||ra.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ie.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!o||Ea.fetchState==="Completed",paymentInitiatedDate:ie.initiatedRepaymentDate}):null,c.jsxs(hi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:L,handleDrawerToggle:qt}),c.jsx(fi,{...as,isCashbackFeatureEnabled:b,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:m,showPayNowInfoTooltip:S,creditCardPayNowThreshold:q,signedInUser:w,chargeCardListState:ee,location:a,admins:Zr.users,navigateAndClearBulkSelection:s,currentTenant:l,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:l.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:o,includeCreditAccountDebitSummaryAndCashbackInfo:T,onClickMenuIcon:()=>{qt(!0)},creditLimit:Yr,isChargeCardSetupEnabled:se,isChargeCardEnabledOnCompany:Ee,isDebitCardSetupEnabled:k,isDebitCardEnabledOnCompany:re,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:M,cashbackRate:ne,controllerEmails:W,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:ra,isChargeCardTOSAccepted:Te,isDebitCardTOSAccepted:fe,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:sa,cashbackInformation:$e,isAiCfoAccessEnabled:Xr,onAskAiCfoClick:v,isCardsCommentingEnabled:V,cardsAiCfoHero:Jt,cardsShutdownBanner:Jr,isCardsShuttingDown:Xt,onClickPolicyIcon:o&&R?()=>n(yi(l.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Z,pendingCreationCount:ve})]})]}):(Te||fe)&&o===!0?c.jsx(Je,{to:"../setup"}):Qr?c.jsx(Je,{to:"../promo"}):c.jsx(Ta,{fetchState:pe})}const gi=e=>`/${e}/cards/new`,Si=e=>`/${e}/cards/payment`,bi=e=>`/${e}/cards/payment-history`,yi=e=>`/${e}/cards/policy`,Gr=[jr,Mr],Ii=new Set(Gr),ki=Pe((function(e){const n=te.getSignedInUser(),t=ge(e),a=e.tenantState.currentTenantId,s=sr(e),y={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},g=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:Ic(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:y,companyName:g,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}}),(function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=we(t.state?.pathnameStackToGoBack),y=s.poppedPathname??"..";a(y,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,y)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:y}}})},onFiltersChange:s=>{e(Ec({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{Ii.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(kc({uiState:{downloadState:s}}))}}}))(st(po));function Ei(){const e=le(),n=he(),t=me(),{areTenantIdsInSync:a}=yr(),{useFeatureGate:s}=ue();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const y=i((o=>ge(o))),g=i((o=>sr(o))),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(null),B=!y.userRole.includes("charge_card_user"),L=!!y.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=s(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(Y.isDebitCardFeatureEnabled),v=Le(h,y),u=Oe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:v}),T=xe(y),k=Be(y),U=y.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Ue({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:p,isBookKeepingTenant:k,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:U}),b=!!y.companyChargeCardInfo?.info?.isChargeCardEnabled,x=Re(),d=Fe(x?.loggedInUserRoleMap),f=i((o=>Ca(o,B,u&&L,A&&b))),M=r.useMemo((()=>{const o=f.cards.filter((E=>E.type.code.includes("debit")));return[...new Set(o.map((E=>E.connectedAccountId)))]}),[f.cards]),V=i((o=>ma(o))),O=i((o=>tt(o,M))),{creditAccountRepayment:R}=i((o=>ua(o))),z=r.useMemo((()=>Mt(d,V)),[d,V]),$=r.useMemo((()=>Ba(A,b,d,f.creditAccount,R)),[A,b,d,f.creditAccount,R]),_=r.useMemo((()=>Nt(u,L,d,O,f.debitCardSummary)),[u,L,d,O,f.debitCardSummary]),D=r.useMemo((()=>Xe(A,u,L,b)),[A,u,L,b]),G=f.creditAccount.balance.amount+f.creditAccount.hold.amount,Q=r.useMemo((()=>l!=null?g.repaymentHistory.find((o=>o.cardRepaymentId===l)):void 0),[l,g.repaymentHistory]),I=r.useCallback((o=>{j(o),t(ia(B,u&&L,A&&b,!1)),w(!0)}),[t,B,u,L,A,b]),N=r.useCallback((()=>{w(!1),j(null),document.body.style.overflow="auto"}),[]);r.useEffect((()=>{S||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(P(!0),t(Ga()))}),[S,t,g.fetchState]),r.useEffect((()=>{!m&&(b||L)&&a&&(C(!0),t(ia(B,!1,A&&b,!1)))}),[m,b,L,a,t,B,A]);const K=aa(y),J={events:ha(K,Gr),eventCallback:(o,E,W)=>{W.onEventReceived(o)},onSubscribed:o=>{o.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[F?c.jsx(Zt,{closeDrawerHandler:N,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:G,productInformation:D,creditAccountInformation:$,debitAccountInformation:_,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(u&&L&&d)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||R.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||V.fetchState==="Completed",paymentInitiatedDate:R.initiatedRepaymentDate,retryRepayment:Q}):null,c.jsx(ki,{...J,location:n,navigate:e,accountInfoByAccountId:g.accountInfoByAccountId,onRetryPaymentClick:I})]})}const En=He.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
height: 100vh;
|
|
28
28
|
width: 100%;
|
|
@@ -31,7 +31,7 @@ import{j as c}from"./liveblocks-0jcT8Dx_.js";import{u as me,j as i,h as le,g as
|
|
|
31
31
|
overflow: auto;
|
|
32
32
|
align-items: center;
|
|
33
33
|
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,An=ea.getLocalizedStrings().months;function Ai(){const e=le(),n=me(),t=he(),{creditAccount:a,creditAccountRepayment:s}=i((D=>ua(D))),y=`${br.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[g,S]=r.useState(!1),[P,m]=r.useState(!1),C=i((D=>Ac(D))),{useFeatureGate:F}=ue(),w=i((D=>ge(D))),{isFeatureEnabled:l}=F(
|
|
34
|
+
`,An=ea.getLocalizedStrings().months;function Ai(){const e=le(),n=me(),t=he(),{creditAccount:a,creditAccountRepayment:s}=i((D=>ua(D))),y=`${br.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[g,S]=r.useState(!1),[P,m]=r.useState(!1),C=i((D=>Ac(D))),{useFeatureGate:F}=ue(),w=i((D=>ge(D))),{isFeatureEnabled:l}=F(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=F(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:B}=F(Y.isCardsCommentingEnabled),L=wr(B?w.companyId:void 0,{clearParams:B&&C.fetchState==="Completed"}),p=Le(j,w),h=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),v=xe(w),u=Be(w),T=w.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,k=Ue({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:l,isBookKeepingTenant:u,isDebitCardProductVisible:h,chargeCardsCreditAccountLimit:T}),U=!!w.companyDebitCardInfo?.info?.isDebitCardEnabled,A=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,b=i((D=>da(D,w.companyId))),x=la(b.controllers),d=i((D=>cr(D))),f=d.cards.filter((D=>D.type.code.includes("debit"))).map((D=>D.connectedAccountId)),M=[...new Set(f)],V=i((D=>tt(D,M))),O=i((D=>Dc(D)));r.useEffect((()=>{P||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(S(!0),n(Qe()))}),[g,n,a.fetchState]),r.useEffect((()=>{P||a.fetchState!=="Completed"||a.id==null||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(m(!0),n(_c(a.id)))}),[P,n,a.fetchState,a.id,C.fetchState]),r.useEffect((()=>{V.fetchState!=="Completed"&&V.fetchState!=="In-Progress"&&h&&U&&n(or()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&n(Ne()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&h&&U&&n(Pc()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&k&&A&&n(vt())}),[V.fetchState,h,U,d.fetchState,O.fetchState,s.fetchState,k,A]),r.useEffect((()=>{if(C.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&d.fetchState==="Completed"&&(!h||!U||V.fetchState==="Completed"&&O.fetchState==="Completed")){let D="",G="";if(C.statements.length>0){const K=C.statements[C.statements.length-1].period,[J,o]=K.split("-"),E=C.statements[0].period,[W,ne]=E.split("-");D=`${An[parseInt(o)-1]} ${J}`,G=`${An[parseInt(ne)-1]} ${W}`}const Q=Xe(k,h,U,A),I=Ba(k,A,!0,a,s),N=Nt(h,U,!0,V,O);X.trackCardsCreditCardStatementsView(x,Q,{numberOfStatements:C.statements.length,oldestStatementMonthYear:D,latestStatementMonthYear:G},I,N)}}),[C.fetchState,a.fetchState,s.fetchState,V.fetchState,d.fetchState,O.fetchState]);const R=()=>{const D=we(t.state?.pathnameStackToGoBack),G=D.poppedPathname??"..";e(G,{state:{pathnameStackToGoBack:D.newStack}})},z=i((D=>ma(D))),$=te.getSignedInUser(),_={userId:$?.userId??"",sessionId:$?.zeniSessionId??"",tenantId:w.tenantId??""};if($==null)throw Error("Can't access address page without signing in...");if(C.fetchState!=="Completed")return c.jsx(En,{children:c.jsx(ho,{onBackClick:R})});{const D=Xe(k,h,U,A);return c.jsx(En,{children:c.jsx(fo,{currentTenantCompanyName:w.companyName,statementListView:C,productInformation:D,onBackClick:R,authParams:_,controllerEmails:x,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:h,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:A,isCardsCommentingEnabled:B,initialOpenThreadRequest:L,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:V,debitCardSummary:O,downloadEndPoint:y})})}}const $r=[pa,it],Di=new Set($r),_i={containerWidth:new Fa(100,58)},Pi=({appContent:e})=>{const n=va(),t=me(),a=le(),s=he(),{useDynamicConfig:y}=ue(),[g,S]=r.useState(!1),[P,m]=r.useState(!1),[C,F]=r.useState(!1),[w,l]=r.useState(!1),j=r.useRef(!1),B=r.useRef(null);r.useEffect((()=>()=>{B.current!=null&&(clearTimeout(B.current),B.current=null)}),[]);const[L,p]=r.useState(!1),[h,v]=r.useState(!1),u=te.getSignedInUser();if(u==null)throw Error("Can't access onboarding card page without signing in...");const T=i((N=>ge(N))),{configValue:k}=y(Ye.zeniCardsConfig),U=i((N=>wc(N))),{tenantEmailDomain:A}=T,b=i((N=>N.settingsViewState.profile.fetchState)),x=i((N=>N.chargeCardListState.fetchState)),d=i((N=>N.settingsViewState.profile.userId)),f=i((N=>N.chargeCardConfigState.fetchState));r.useEffect((()=>{g===!1&&b!=="In-Progress"&&b!=="Completed"&&(t(Tc()),S(!0)),P===!1&&f!=="In-Progress"&&f!=="Completed"&&(t(Qa()),m(!0)),C===!1&&x==="Not-Started"&&(F(!0),t(Ne()))}),[g,C,x,P,f]),r.useEffect((()=>{b==="Completed"&&L===!1&&d!=null&&x==="Completed"&&U.cards.length>0&&(t(vc({userId:d})),t(ir({cardId:U.cards[U.cards.length-1].id})),p(!0))}),[b,L,d,x]),r.useEffect((()=>{if(!w&&U.fetchState==="Completed"&&U.cards.length===0){const N=we(s.state?.pathnameStackToGoBack),K=N.poppedPathname??ta(A);a(K,{state:{pathnameStackToGoBack:N.newStack}})}}),[U.fetchState,U.cards,w]);const M=i((N=>qa(N))),V=ya(M.updateStatus.fetchState),O=M.currentDisplayedCardId,{useFeatureGate:R}=ue(),{isFeatureEnabled:z}=R(Y.isChargeCardFeatureEnabled),$=!!T.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!T.userRole.includes("charge_card_user")&&z&&$,D=i((N=>O!=null?dr(N.chargeCardState,O):null)),G=()=>{O!=null&&(j.current=!0,B.current!=null&&clearTimeout(B.current),B.current=setTimeout((()=>{j.current=!1,B.current=null}),5e3),t(ka(O,_,!0)),t(Ne(!0)),l(!0))},Q=aa(T);Vt({events:ha(Q,$r),onSubscribed:()=>{t(Ne(!0))},onEvent:(N,K)=>{if(!Di.has(N))return;const J=Yt(K),o=j.current;if(N===pa){const W=de(J?.card_id)??O;if(W!=null){const ne=Kt(J,W);if(ne!=null)return t(Ft(ne)),void(W!==O||o||G())}}if(N===it)return void t(Ne(!0));const E=de(J?.card_id)??O;(O==null||E===O)&&O!=null?o||G():t(Ne(!0))}}),r.useEffect((()=>{if(w&&O!=null&&D!=null&&D.status.code!=="request_on_hold"){const N=_e(T.tenantEmailDomain,O,u,D),K=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Fc()),D?.type.code==="business_virtual_credit_card"&&t(Ja()),a(N,{state:{pathnameStackToGoBack:K},replace:!0}),j.current=!1,B.current!=null&&(clearTimeout(B.current),B.current=null)}}),[w,D?.status.code]),r.useEffect((()=>{V==="In-Progress"&&M.updateStatus.fetchState==="Completed"&&setTimeout(G,3e3)}),[V,M.updateStatus.fetchState]);const I=N=>{v(N)};if(b!=="Completed"||U.cards.length===0)return c.jsxs(Dn,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(go,{})]});if(d==null)throw Error("Can't access my userId.");return c.jsxs(Dn,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(wi,{chargeCardListView:U,cardUserOnboardingView:M,navigate:a,currentTenant:T,myUserId:d,location:s,chargeCardCashbackRatePerTransaction:k.charge_card_cashback_rate_per_transaction!=null?k.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{I(!0)}}),e!=null?c.jsx(Ti,{windowSize:n,children:e}):null]})},wi=Pe((function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const y=Ca(e,!1,!1,!1);let g=!1;return y.fetchState==="Completed"&&y.cards.length<=1&&(g=!0),{cards:a.cards,showMenuIcon:g,companyLegalName:n.companyName,twoFAView:t.twoFAView,cardUserOnboardingLocalData:t.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:t.isDOBPresent,onboardingProgressStatus:t.onboardingProgressStatus}}),(function(e,n){const{navigate:t,cardUserOnboardingView:a,location:s,currentTenant:y}=n,{tenantEmailDomain:g}=y;return{updateCardUserOnboardingLocalData:S=>{e(Sn({localData:S}))},onGetOtp:S=>{if(a.cardUserOnboardingLocalData!=null){const P={...a.cardUserOnboardingLocalData,phone:S};e(Sn({localData:P}))}e(at(S,"CardUserOnboarding"))},onResendOtp:S=>{e(et(S,"CardUserOnboarding"))},onVerifyOtp:(S,P)=>{e(Xa(S,P,"CardUserOnboarding"))},onVerifyOtpSuccess:S=>{e(xc()),S!=null&&te.saveZeniOtpToken(S)},setCurrentDisplayedCardId:S=>{e(ir({cardId:S}))},onBackClick:()=>{const S=we(s.state?.pathnameStackToGoBack),P=S.poppedPathname??ta(g);t(P,{state:{pathnameStackToGoBack:S.newStack}})}}}))(So),Ti=He.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
width: ${e=>`${_i.containerWidth.value(e.windowSize)}%`};
|
|
@@ -44,12 +44,12 @@ import{j as c}from"./liveblocks-0jcT8Dx_.js";import{u as me,j as i,h as le,g as
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
align-items: center;
|
|
46
46
|
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,vi={containerWidth:new Fa(100,58)},Fi=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g,useFeatureGate:S}=ue(),[P,m]=r.useState(!1),[C,F]=r.useState(!1),[w,l]=r.useState(!1),[j,B]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const p=i((_=>ge(_)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(
|
|
47
|
+
`,vi={containerWidth:new Fa(100,58)},Fi=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g,useFeatureGate:S}=ue(),[P,m]=r.useState(!1),[C,F]=r.useState(!1),[w,l]=r.useState(!1),[j,B]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const p=i((_=>ge(_)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ye.zeniCardsConfig),v=i((_=>Bc(_,s))),{isFeatureEnabled:u}=S(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=S(Y.isDebitCardFeatureEnabled),k=Le(T,p),U=Oe({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:k}),A=xe(p),b=Be(p),x=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,d=Ue({isCardsOnlyTenant:A,isChargeCardFeatureEnabled:u,isBookKeepingTenant:b,isDebitCardProductVisible:U,chargeCardsCreditAccountLimit:x}),f=v.chargeCard,M=i((_=>_.chargeCardConfigState.fetchState));r.useEffect((()=>{P===!1&&M!=="In-Progress"&&M!=="Completed"&&(t(Qa()),m(!0)),C===!1&&v.fetchState==="Not-Started"&&(F(!0),t(ka(s,!1,d)))}),[C,v.fetchState,P,M]);const V=f?.type.code==="business_physical_debit_card"||f?.type.code==="business_virtual_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(w===!1&&(V===!1||V&&f.status?.code!=="active"||V&&f.status.code==="active"&&f.isPinSet||f.cardHolderUserId!==L.userId)){const _=_e(p.tenantEmailDomain,s,L,f,!0),D=ye(y.state?.pathnameStackToGoBack,y.pathname);a(_,{state:{pathnameStackToGoBack:D}})}else if(w&&v.isRefreshingViewInBackground===!1&&f?.isPinSet===!0){t(Lc({chargeCardId:s}));const _=_e(p.tenantEmailDomain,s,L,f,!0),D=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(_,{state:{pathnameStackToGoBack:D}})}}}),[v.fetchState,f?.type.code,w,v.isRefreshingViewInBackground]);const O=te.getZeniOtpTokenForCardHolder(s),R=i((_=>Hn(_.userState,L.userId))),z=()=>{f?.isPinSet!==!0&&t(Sa(s,!0))};r.useEffect((()=>{v.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),l(!0))}),[v.updateDebitCardPinAttemptFetchState.fetchState]);const $=_=>{B(_)};if(M!=="Completed"||f==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(R?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Li,{children:[c.jsx(Ie,{isAppContentDrawerOpen:j,handleDrawerToggle:$}),c.jsx(xi,{cardId:s,card:f,phone:R.phone,signedInUser:L,isSandboxEnv:Rt(),debitCardDetailState:v,signedInUserToken:O,navigate:a,currentTenant:p,location:y,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?c.jsx(Bi,{windowSize:n,children:e}):null]})},xi=Pe((function(e,{debitCardDetailState:n,cardId:t}){const a=Gn(e,t),s=n.updateStatus,y=Ca(e,!1,!1,!1);let g=!1;return y.fetchState==="Completed"&&y.cards.length<=1&&(g=!0),{showMenuIcon:g,vgsVaultId:rt.cardVaultId,twoFAView:a,setPinWaitStatus:s}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,debitCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:m=>{e(qn(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onSetPinSuccess:()=>{e(Rc({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("activate")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(bo),Bi=He.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
width: ${e=>`${vi.containerWidth.value(e.windowSize)}%`};
|
|
51
51
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
52
|
-
box-shadow: ${e=>`${
|
|
52
|
+
box-shadow: ${e=>`${Ya.sp0} 2px ${Ya.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
53
53
|
`,Li=He.div`
|
|
54
54
|
display: flex;
|
|
55
55
|
min-height: 100%;
|
|
@@ -58,8 +58,8 @@ import{j as c}from"./liveblocks-0jcT8Dx_.js";import{u as me,j as i,h as le,g as
|
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
align-items: center;
|
|
60
60
|
background-color: ${e=>e.theme.colors.grey4};
|
|
61
|
-
box-shadow: ${e=>`${
|
|
62
|
-
`,Ri={overlayWidth:new Fa(ht[12],ht[12],ht[9])},Oi=Pe((function(e,n){const t=Bt(e,!1,!1),a=n.lineId,s=t.customAddress[a],y=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:y,lineId:a}}),(function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:y=>{t!=null&&e(lr(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const g=Bo(y);e(jc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:g})),e(Mc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Uc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}}))(yo),Ui=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Ot(),s=va(),y=()=>{n()},g=i((S=>Oc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S)))?.newAddressId;return c.jsx(Er,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Ri.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,P)=>(P==="backdropClick"||P==="escapeKeyDown")&&y(),children:c.jsx(Oi,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:y,lineId:e,chargeCardTypeOption:t,newCustomAddressId:g})})},ji=Pe((function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S}=n,P=Bt(e,t&&g,a&&S);return{issueChargeCards:P,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S,cardHolderCandidates:P.userList.map((m=>m.user)).filter(Boolean),allRoles:P.userList.map((m=>m.userRole)),allAccountingClasses:P.allAccountingClasses,userList:P.userList}}),(function(e,n){return{onIssueCardClick:()=>{e(Hc())},onSaveChangesToLocalStore:t=>{e(Vc(t))},onDismissClick:()=>{e(ur()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(lr(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}}))(Eo);function Mi(){const e=te.getSignedInUser(),n=le(),t=me(),a=Io(),[s]=_n(),y=s.get("cardType"),{useFeatureGate:g}=ue(),{isFeatureEnabled:S}=g(
|
|
61
|
+
box-shadow: ${e=>`${Ya.sp0} 2px ${Ya.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
62
|
+
`,Ri={overlayWidth:new Fa(ht[12],ht[12],ht[9])},Oi=Pe((function(e,n){const t=Bt(e,!1,!1),a=n.lineId,s=t.customAddress[a],y=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:y,lineId:a}}),(function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:y=>{t!=null&&e(lr(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const g=Bo(y);e(jc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:g})),e(Mc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Uc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}}))(yo),Ui=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Ot(),s=va(),y=()=>{n()},g=i((S=>Oc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S)))?.newAddressId;return c.jsx(Er,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Ri.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,P)=>(P==="backdropClick"||P==="escapeKeyDown")&&y(),children:c.jsx(Oi,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:y,lineId:e,chargeCardTypeOption:t,newCustomAddressId:g})})},ji=Pe((function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S}=n,P=Bt(e,t&&g,a&&S);return{issueChargeCards:P,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S,cardHolderCandidates:P.userList.map((m=>m.user)).filter(Boolean),allRoles:P.userList.map((m=>m.userRole)),allAccountingClasses:P.allAccountingClasses,userList:P.userList}}),(function(e,n){return{onIssueCardClick:()=>{e(Hc())},onSaveChangesToLocalStore:t=>{e(Vc(t))},onDismissClick:()=>{e(ur()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(lr(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}}))(Eo);function Mi(){const e=te.getSignedInUser(),n=le(),t=me(),a=Io(),[s]=_n(),y=s.get("cardType"),{useFeatureGate:g}=ue(),{isFeatureEnabled:S}=g(Y.isIssuePhysicalCardEnabled),{isFeatureEnabled:P}=g(Y.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:m}=g(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Y.isChargeCardFeatureEnabled),F=i((z=>ge(z))),w=Le(m,F),l=Oe({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:w}),j=xe(F),B=Be(F),L=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:C,isBookKeepingTenant:B,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:L}),[h,v]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect((()=>{h||(v(!0),t(Nc(l&&T,p&&u,!1)))}),[h,v,t]);const u=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,T=!!F.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((z=>Bt(z,p&&u,l&&T))),U=k.fetchState,A=k.issueCardStatus.fetchState,b=k.lastSelfIssuedDebitCardId,x=i((z=>b!=null?dr(z.chargeCardState,b):void 0)),[d,f]=r.useState(null),[M,V]=r.useState(null),O=()=>{f(null)},R=(z,$)=>{f(z),V($)};return r.useEffect((()=>{if(A==="Completed"){if(b!=null&&x?.type.code==="business_virtual_debit_card"){let z;z=x?.status.code==="request_on_hold"&&e.userId===x.cardHolderUserId?Pr(F.tenantEmailDomain):_e(F.tenantEmailDomain,b,e,x),n(z)}else n("../");t(ur())}}),[A,b]),U==="Completed"?c.jsxs(c.Fragment,{children:[d!==null&&M!==null?c.jsx(Ui,{closeDrawerHandler:O,lineId:d,chargeCardTypeOption:M}):null,c.jsx(ji,{themeState:a,isIssuePhysicalCardEnabled:S,isIssuePhysicalDebitCardEnabled:P,isDebitCardFeatureEnabled:l,isChargeCardFeatureEnabled:p,isChargeCardSetupEnabled:u,isDebitCardSetupEnabled:T,navigate:n,fetchState:k.fetchState,openAddAddressDrawerHandler:R,defaultCardType:y==="creditCard"||y==="debitCard"?y:void 0})]}):U==="Error"?c.jsx(ct,{}):c.jsx(ko,{})}const zr=[pa,it],Ni=new Set(zr),Vi=He.div`
|
|
63
63
|
display: flex;
|
|
64
64
|
height: 100vh;
|
|
65
65
|
width: 100%;
|
|
@@ -68,4 +68,4 @@ import{j as c}from"./liveblocks-0jcT8Dx_.js";import{u as me,j as i,h as le,g as
|
|
|
68
68
|
overflow: auto;
|
|
69
69
|
align-items: center;
|
|
70
70
|
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,Hi=Pe((function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}}),(function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:y,myPendingActivationChargeCardListState:g}=n,{tenantEmailDomain:S}=a,{cards:P}=g;return{onChargeCardRowClick:m=>{const C=_r(P,m),F=_e(S,m,y,C),w=ye(s.state?.pathnameStackToGoBack,s.pathname);t(F,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(m,C)=>{e(It({uiState:{sortKey:m,sortOrder:C}}))},onReloadCards:()=>{e(Ne())},onBackClick:()=>{const m=a.userRole.includes("charge_card_user");e(It({uiState:{sortKey:m?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}}))(Ao);function Gi(){const e=le(),n=me(),t=he(),a=Ot(),[s,y]=r.useState(!1),g=i((R=>Gc(R))),S=i((R=>ge(R))),P=i((R=>da(R,S.companyId))),m=la(P.controllers),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Z.isDebitCardFeatureEnabled),l=Le(w,S),j=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:l}),B=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,L=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,p=Re(),h=xe(S),v=Be(S),u=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Ue({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:F,isBookKeepingTenant:v,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:u}),k=Fe(p?.loggedInUserRoleMap),U=i((R=>ma(R))),{creditAccount:A,creditAccountRepayment:b}=i((R=>ua(R))),x=i((R=>cr(R))).cards.filter((R=>R.type.code.includes("debit"))).map((R=>R.connectedAccountId)),d=[...new Set(x)],f=i((R=>tt(R,d)));r.useEffect((()=>{s||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(y(!0),n(Ne()),n(Qa()))}),[s,n,g.fetchState]),r.useEffect((()=>{if(g.fetchState==="Completed"&&g.cards.length===1&&M!=null){const R=_e(S.tenantEmailDomain,g.cards[0].id,M,g.cards[0]);e(R,{state:{message:t.state?.message}})}}),[g.fetchState,g.cards]);const M=te.getSignedInUser();r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&T&&L&&k&&n(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&k&&n(vt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&j&&B&&k&&n(or())}),[A.fetchState,b.fetchState,n,f.fetchState,j,B,k,T,L]);const V=aa(S);if(Vt({events:ha(V,zr),onEvent:(R,z)=>{if(!Ni.has(R))return;const $=Zt(z);if(R===pa){const _=de($?.card_id);if(_!=null){const D=Kt($,_);if(D!=null)return void n(Ft(D))}}n(Ne(!0))},onSubscribed:()=>{n(Ne(!0))}}),M==null)throw Error("Can't access address page without signing in...");const O=g.cards!=null&&g.cards.length>0;if(g.fetchState==="Completed"||O){const R=Xe(T,j,B,L);return c.jsx(Vi,{children:c.jsx(Hi,{navigate:e,currentTenant:S,signedInUser:M,productInformation:R,myPendingActivationChargeCardListState:g,isChargeCardFeatureEnabled:T,isDebitCardFeatureEnabled:j,isDebitCardSetupEnabled:B,isChargeCardSetupEnabled:L,chargeCardCashbackDetailState:U,creditAccount:A,creditAccountRepayment:b,depositAccountListWithDebitCardIssued:f,controllerEmails:m,location:t})})}return c.jsx(Ta,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const $i=Pe((function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}}),(function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:g,signedInUser:S,location:P,productInformation:m,isEarlyPayEnabled:C,controllerEmails:F,chargeCardsCreditAccountLimit:w}=n;return{onSetupButtonClick:l=>{if(S!=null&&X.trackCardsPromoPageClicked("enable cards"),s)switch(X.trackCardsEnableCardsClick(F,m,"Cards Promo"),l){case"credit":e(qe(a,!0,"charge_cards",C,!1));break;case"debit":e(qe(a,!0,"debit_cards",C,!1));break;case"debit_and_credit":e(w===0?qe(a,!0,"debit_cards",C,!0):qe(a,!0,"charge_cards__debit_cards",C,!1))}else switch(X.trackCardsSetupCardsClick(F,m,"Cards Promo"),l){case"credit":e(qe(a,!1,"charge_cards",C,!1));break;case"debit":e(qe(a,!1,"debit_cards",C,!1));break;case"debit_and_credit":e(w===0?qe(a,!1,"debit_cards",C,!0):qe(a,!1,"charge_cards__debit_cards",C,!1))}},onBackClick:()=>{const l=we(P.state?.pathnameStackToGoBack);let j=l.poppedPathname;j==null&&(j=y||g?"..":"../.."),t(j,{state:{pathnameStackToGoBack:l.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Ja()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Yc(a))}}}))(_o),zi=()=>{const e=le(),{tenantEmailDomain:n}=Ve(),[t]=_n(),a=t.get("cardPromoType"),s=me(),{useDynamicConfig:y,useFeatureGate:g}=ue(),[S,P]=r.useState(!1),{isFeatureEnabled:m}=g(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:F}=g(Z.isChargeCardFeatureEnabled),{configValue:w}=y(Ze.zeniCardsConfig),l=i((ae=>ge(ae))),j=i((ae=>da(ae,l.companyId))),B=la(j.controllers),L=w.charge_card_cashback_rate_per_transaction!=null?w.charge_card_cashback_rate_per_transaction:.0175,p=he(),h=te.getSignedInUserTenant(n)?.companyId??l.companyId,v=i((ae=>wa(ae,h))),u=v.primaryFundingAccount,T=l.companyBillPayInfo?.info,k=xe(l),U=Be(l),A=Le(m,l),b=l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:A}),d=Ue({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:b}),f=Dr({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U}),M=x&&d===!1,V=T?.businessVerificationStatus?.code==="verified"&&(M||u?.accType==="depositAccount"||$c(u?.providerVerificationStatus?.code??"")),O=te.getSignedInUser(),R=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!l.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,$=!!l.company?.companyChargeCardInfo?.isChargeCardEnabled,_=!!l.company?.companyDebitCardInfo?.isDebitCardEnabled,D=!!l.companyChargeCardInfo?.info?.isChargeCardEnabled,G=!!l.companyDebitCardInfo?.info?.isDebitCardEnabled,Q=!!l.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,I=ae=>{P(ae)},N=i((ae=>ae.chargeCardSetupViewState.fetchState));if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const K=Re(),J=Fe(K?.loggedInUserRoleMap),o=xt(K?.loggedInUserRoleMap),[E,W]=r.useState(!1),[ne,q]=r.useState(!1),[ke,Te]=r.useState(!1);r.useEffect((()=>{E===!1&&p.state?.message==="activation"&&W(!0)}),[p.state]),r.useEffect((()=>{ne||N!=="Not-Started"||h==null||(q(!0),s(Pa(h,!0)))}),[ne,N,h,s]);const fe=l.companyChargeCardInfo?.info!=null&&Ia({cardInfo:l.companyChargeCardInfo.info,isProductVisible:f&&$,isTOSAccepted:z,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:J,isUserHasCardsAccess:o}),se=l.companyDebitCardInfo?.info!=null&&Ia({cardInfo:l.companyDebitCardInfo.info,isProductVisible:x&&_,isTOSAccepted:Q,isSetupEnabled:G,isUserHasCardsAdminLevelAccess:J,isUserHasCardsAccess:o}),Ee=x&&se&&f&&b>=0&&fe?"debit_and_credit":x&&se?"debit":"credit",re=xo(a,Ee),Ce=v?.chargeCardTermsDetails?.fetchStatus?.fetchState,Ae=r.useRef(null);r.useEffect((()=>{Ce==="In-Progress"?Ae.current=re:Ce!=="Error"&&Ce!=="Not-Started"||(Ae.current=null)}),[Ce,re]);const ee=Ce!=="In-Progress"&&Ce!=="Completed"||Ae.current==null?re:Ae.current;r.useEffect((()=>{re==="credit"&&(D||f===!1&&G)||re==="debit"&&G||re==="debit_and_credit"&&G&&D?e("../"):(re==="debit_and_credit"&&z===!0&&Q===!0||re==="credit"&&(z===!0||f===!1&&Q===!0)||re==="debit"&&Q===!0)&&J===!0&&e("../setup")}),[V,D,G,re,z,Q]),r.useEffect((()=>{ke||(s(zc("cardAdmin")),Te(!0))}),[ke]);const ve=i((ae=>rr(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin"))),De=Xe(f,x,G,D);return(ae=>{switch(ae){case"credit":return $;case"debit":return _;case"debit_and_credit":return $&&_;default:return!1}})(ee)?(fe||se)&&N==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:X,onLoad:()=>{if(X.trackPageLoaded(kr.Event.cardsPromoPage),!!f&&!D||!!x&&!G||!!f&&!!x&&!G&&!D){const ae=Yi({isDebitCardSetupEnabled:G,isChargeCardSetupEnabled:D,isCreditCardProductVisibleForExpressInterest:f,isDebitCardProductVisible:x});X.trackCardsPromoView(B,De,"Page",ae,"Promo Page")}}}),c.jsx(nt,{showConfetti:E}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx($i,{signedInUser:O,location:p,showEnableCardButton:V,isCompanyBusinessVerificationAndPaymentSetUpDone:V,isChargeCardSetupEnabled:D,isDebitCardSetupEnabled:G,companyLegalName:l.companyName,adminList:ve.users,isCheckingEnabled:R,navigate:e,companyId:h,cardPromoType:ee,controllerEmails:B,productInformation:De,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:m,isEarlyPayEnabled:C,cashbackRate:L,chargeCardsCreditAccountLimit:b,onClickMenuIcon:()=>{I(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(Do,{})]}):c.jsx(Je,{to:"../",replace:!0})},Yi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function Sd(){const e=he(),n=i((J=>ge(J))),{useFeatureGate:t}=ue(),{isFeatureEnabled:a}=t(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:y}=t(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:g}=t(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(Z.isCardPolicyEnabled),P=Le(s,n),m=Oe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:P}),C=Po(n,a,s),F=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,l=!!n.company?.companyChargeCardInfo?.isChargeCardEnabled,j=!!n.company?.companyDebitCardInfo?.isDebitCardEnabled,B=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,L=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,p=Re(),h=Fe(p?.loggedInUserRoleMap),{isCardsShuttingDown:v}=Ir(n.tenantId,n.company?.managementInfo?.receiverEmails),u=xt(p?.loggedInUserRoleMap),{isFeatureEnabled:T}=t(Z.isCashbackFeatureEnabled),k=n.userRole.includes("charge_card_user"),U=!k,A=!k&&B,b=n?.userRole!=null&&Zc(n?.userRole),x=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!b)&&Kc(p?.loggedInUserRoleMap),d=Wc(p?.loggedInUserRoleMap),f=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!b)&&qc(p?.loggedInUserRoleMap),{isFeatureEnabled:M}=t(Z.isDepositAccountsFeatureEnabled),V=M&&!b&&zn(p?.loggedInUserRoleMap),O=B&&l&&!b,R=L&&j&&!b,z=C&&!b&&Fe(p?.loggedInUserRoleMap),$=Qc(p?.loggedInUserRoleMap),_=xe(n),D=Be(n),G=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Q=Ue({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:a,isBookKeepingTenant:D,isDebitCardProductVisible:m,chargeCardsCreditAccountLimit:G}),I=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:Q&&l,isTOSAccepted:F,isSetupEnabled:B,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:u}),N=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:m&&j,isTOSAccepted:w,isSetupEnabled:L,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:u}),K=I||N;return c.jsxs(cs,{children:[h?c.jsx(ce,{path:"setup",element:c.jsx(bn,{isBillPayAdminLevelAccess:x,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:V,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:$,isUserHasOnlyBillPayAccess:d,productType:"charge_cards",type:"setup"})}):null,h?c.jsx(ce,{path:"verification",element:c.jsx(bn,{isBillPayAdminLevelAccess:x,isUserHasOnlyBillPayAccess:d,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:V,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:$,productType:"charge_cards",type:"verification"})}):null,h&&S?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"policy",element:c.jsx(Yo,{})}),c.jsx(ce,{path:"policy/new",element:c.jsx(Uo,{})}),c.jsx(ce,{path:"policy/:templateId/edit",element:c.jsx(Vo,{})})]}):null,c.jsx(ce,{path:"promo",element:c.jsx(zi,{})}),O||R?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"/",element:c.jsx(kn,{isPaymentDrawerOpen:!1})}),z&&y?c.jsx(ce,{path:"payment",element:c.jsx(kn,{isPaymentDrawerOpen:!0})}):null,c.jsx(ce,{path:"activate",element:c.jsx(Gi,{})}),c.jsx(ce,{path:"onboard",element:c.jsx(Pi,{})}),h&&v!==!0?c.jsx(ce,{path:"new",element:c.jsx(Mi,{})}):h?c.jsx(ce,{path:"new",element:c.jsx(Je,{to:"..",replace:!0})}):null,T&&U?c.jsx(ce,{path:"cashback",element:c.jsx(Qo,{})}):null,A?c.jsx(ce,{path:"statements",element:c.jsx(Ai,{})}):null,z&&g&&B?c.jsx(ce,{path:"payment-history",element:c.jsx(Ei,{})}):null,c.jsx(ce,{path:":cardId/activate",element:c.jsx(ei,{})}),c.jsx(ce,{path:":cardId/setPin",element:c.jsx(Fi,{})}),c.jsx(ce,{path:":cardId/addToWallet",element:c.jsx(Zo,{})}),c.jsx(ce,{path:":cardId/*",element:c.jsx(li,{})}),c.jsx(ce,{path:"*",element:c.jsx(ct,{})})]}):(F||w)&&h?c.jsx(ce,{path:"*",element:c.jsx(Je,{to:"../setup"})}):K?c.jsx(ce,{path:"*",element:c.jsx(Je,{to:"../promo",state:e.state})}):c.jsx(ce,{path:"*",element:null})]})}export{Sd as default};
|
|
71
|
+
`,Hi=Pe((function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}}),(function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:y,myPendingActivationChargeCardListState:g}=n,{tenantEmailDomain:S}=a,{cards:P}=g;return{onChargeCardRowClick:m=>{const C=_r(P,m),F=_e(S,m,y,C),w=ye(s.state?.pathnameStackToGoBack,s.pathname);t(F,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(m,C)=>{e(It({uiState:{sortKey:m,sortOrder:C}}))},onReloadCards:()=>{e(Ne())},onBackClick:()=>{const m=a.userRole.includes("charge_card_user");e(It({uiState:{sortKey:m?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}}))(Ao);function Gi(){const e=le(),n=me(),t=he(),a=Ot(),[s,y]=r.useState(!1),g=i((R=>Gc(R))),S=i((R=>ge(R))),P=i((R=>da(R,S.companyId))),m=la(P.controllers),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Y.isDebitCardFeatureEnabled),l=Le(w,S),j=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:l}),B=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,L=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,p=Re(),h=xe(S),v=Be(S),u=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Ue({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:F,isBookKeepingTenant:v,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:u}),k=Fe(p?.loggedInUserRoleMap),U=i((R=>ma(R))),{creditAccount:A,creditAccountRepayment:b}=i((R=>ua(R))),x=i((R=>cr(R))).cards.filter((R=>R.type.code.includes("debit"))).map((R=>R.connectedAccountId)),d=[...new Set(x)],f=i((R=>tt(R,d)));r.useEffect((()=>{s||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(y(!0),n(Ne()),n(Qa()))}),[s,n,g.fetchState]),r.useEffect((()=>{if(g.fetchState==="Completed"&&g.cards.length===1&&M!=null){const R=_e(S.tenantEmailDomain,g.cards[0].id,M,g.cards[0]);e(R,{state:{message:t.state?.message}})}}),[g.fetchState,g.cards]);const M=te.getSignedInUser();r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&T&&L&&k&&n(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&k&&n(vt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&j&&B&&k&&n(or())}),[A.fetchState,b.fetchState,n,f.fetchState,j,B,k,T,L]);const V=aa(S);if(Vt({events:ha(V,zr),onEvent:(R,z)=>{if(!Ni.has(R))return;const $=Yt(z);if(R===pa){const _=de($?.card_id);if(_!=null){const D=Kt($,_);if(D!=null)return void n(Ft(D))}}n(Ne(!0))},onSubscribed:()=>{n(Ne(!0))}}),M==null)throw Error("Can't access address page without signing in...");const O=g.cards!=null&&g.cards.length>0;if(g.fetchState==="Completed"||O){const R=Xe(T,j,B,L);return c.jsx(Vi,{children:c.jsx(Hi,{navigate:e,currentTenant:S,signedInUser:M,productInformation:R,myPendingActivationChargeCardListState:g,isChargeCardFeatureEnabled:T,isDebitCardFeatureEnabled:j,isDebitCardSetupEnabled:B,isChargeCardSetupEnabled:L,chargeCardCashbackDetailState:U,creditAccount:A,creditAccountRepayment:b,depositAccountListWithDebitCardIssued:f,controllerEmails:m,location:t})})}return c.jsx(Ta,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const $i=Pe((function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}}),(function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:g,signedInUser:S,location:P,productInformation:m,isEarlyPayEnabled:C,controllerEmails:F,chargeCardsCreditAccountLimit:w}=n;return{onSetupButtonClick:l=>{if(S!=null&&X.trackCardsPromoPageClicked("enable cards"),s)switch(X.trackCardsEnableCardsClick(F,m,"Cards Promo"),l){case"credit":e(qe(a,!0,"charge_cards",C,!1));break;case"debit":e(qe(a,!0,"debit_cards",C,!1));break;case"debit_and_credit":e(w===0?qe(a,!0,"debit_cards",C,!0):qe(a,!0,"charge_cards__debit_cards",C,!1))}else switch(X.trackCardsSetupCardsClick(F,m,"Cards Promo"),l){case"credit":e(qe(a,!1,"charge_cards",C,!1));break;case"debit":e(qe(a,!1,"debit_cards",C,!1));break;case"debit_and_credit":e(w===0?qe(a,!1,"debit_cards",C,!0):qe(a,!1,"charge_cards__debit_cards",C,!1))}},onBackClick:()=>{const l=we(P.state?.pathnameStackToGoBack);let j=l.poppedPathname;j==null&&(j=y||g?"..":"../.."),t(j,{state:{pathnameStackToGoBack:l.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Ja()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Zc(a))}}}))(_o),zi=()=>{const e=le(),{tenantEmailDomain:n}=Ve(),[t]=_n(),a=t.get("cardPromoType"),s=me(),{useDynamicConfig:y,useFeatureGate:g}=ue(),[S,P]=r.useState(!1),{isFeatureEnabled:m}=g(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:F}=g(Y.isChargeCardFeatureEnabled),{configValue:w}=y(Ye.zeniCardsConfig),l=i((ae=>ge(ae))),j=i((ae=>da(ae,l.companyId))),B=la(j.controllers),L=w.charge_card_cashback_rate_per_transaction!=null?w.charge_card_cashback_rate_per_transaction:.0175,p=he(),h=te.getSignedInUserTenant(n)?.companyId??l.companyId,v=i((ae=>wa(ae,h))),u=v.primaryFundingAccount,T=l.companyBillPayInfo?.info,k=xe(l),U=Be(l),A=Le(m,l),b=l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:A}),d=Ue({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:b}),f=Dr({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U}),M=x&&d===!1,V=T?.businessVerificationStatus?.code==="verified"&&(M||u?.accType==="depositAccount"||$c(u?.providerVerificationStatus?.code??"")),O=te.getSignedInUser(),R=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!l.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,$=!!l.company?.companyChargeCardInfo?.isChargeCardEnabled,_=!!l.company?.companyDebitCardInfo?.isDebitCardEnabled,D=!!l.companyChargeCardInfo?.info?.isChargeCardEnabled,G=!!l.companyDebitCardInfo?.info?.isDebitCardEnabled,Q=!!l.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,I=ae=>{P(ae)},N=i((ae=>ae.chargeCardSetupViewState.fetchState));if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const K=Re(),J=Fe(K?.loggedInUserRoleMap),o=xt(K?.loggedInUserRoleMap),[E,W]=r.useState(!1),[ne,q]=r.useState(!1),[ke,Te]=r.useState(!1);r.useEffect((()=>{E===!1&&p.state?.message==="activation"&&W(!0)}),[p.state]),r.useEffect((()=>{ne||N!=="Not-Started"||h==null||(q(!0),s(Pa(h,!0)))}),[ne,N,h,s]);const fe=l.companyChargeCardInfo?.info!=null&&Ia({cardInfo:l.companyChargeCardInfo.info,isProductVisible:f&&$,isTOSAccepted:z,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:J,isUserHasCardsAccess:o}),se=l.companyDebitCardInfo?.info!=null&&Ia({cardInfo:l.companyDebitCardInfo.info,isProductVisible:x&&_,isTOSAccepted:Q,isSetupEnabled:G,isUserHasCardsAdminLevelAccess:J,isUserHasCardsAccess:o}),Ee=x&&se&&f&&b>=0&&fe?"debit_and_credit":x&&se?"debit":"credit",re=xo(a,Ee),Ce=v?.chargeCardTermsDetails?.fetchStatus?.fetchState,Ae=r.useRef(null);r.useEffect((()=>{Ce==="In-Progress"?Ae.current=re:Ce!=="Error"&&Ce!=="Not-Started"||(Ae.current=null)}),[Ce,re]);const ee=Ce!=="In-Progress"&&Ce!=="Completed"||Ae.current==null?re:Ae.current;r.useEffect((()=>{re==="credit"&&(D||f===!1&&G)||re==="debit"&&G||re==="debit_and_credit"&&G&&D?e("../"):(re==="debit_and_credit"&&z===!0&&Q===!0||re==="credit"&&(z===!0||f===!1&&Q===!0)||re==="debit"&&Q===!0)&&J===!0&&e("../setup")}),[V,D,G,re,z,Q]),r.useEffect((()=>{ke||(s(zc("cardAdmin")),Te(!0))}),[ke]);const ve=i((ae=>rr(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin"))),De=Xe(f,x,G,D);return(ae=>{switch(ae){case"credit":return $;case"debit":return _;case"debit_and_credit":return $&&_;default:return!1}})(ee)?(fe||se)&&N==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:X,onLoad:()=>{if(X.trackPageLoaded(kr.Event.cardsPromoPage),!!f&&!D||!!x&&!G||!!f&&!!x&&!G&&!D){const ae=Zi({isDebitCardSetupEnabled:G,isChargeCardSetupEnabled:D,isCreditCardProductVisibleForExpressInterest:f,isDebitCardProductVisible:x});X.trackCardsPromoView(B,De,"Page",ae,"Promo Page")}}}),c.jsx(nt,{showConfetti:E}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx($i,{signedInUser:O,location:p,showEnableCardButton:V,isCompanyBusinessVerificationAndPaymentSetUpDone:V,isChargeCardSetupEnabled:D,isDebitCardSetupEnabled:G,companyLegalName:l.companyName,adminList:ve.users,isCheckingEnabled:R,navigate:e,companyId:h,cardPromoType:ee,controllerEmails:B,productInformation:De,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:m,isEarlyPayEnabled:C,cashbackRate:L,chargeCardsCreditAccountLimit:b,onClickMenuIcon:()=>{I(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(Do,{})]}):c.jsx(Je,{to:"../",replace:!0})},Zi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function Sd(){const e=he(),n=i((J=>ge(J))),{useFeatureGate:t}=ue(),{isFeatureEnabled:a}=t(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:y}=t(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:g}=t(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(Y.isCardPolicyEnabled),P=Le(s,n),m=Oe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:P}),C=Po(n,a,s),F=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,l=!!n.company?.companyChargeCardInfo?.isChargeCardEnabled,j=!!n.company?.companyDebitCardInfo?.isDebitCardEnabled,B=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,L=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,p=Re(),h=Fe(p?.loggedInUserRoleMap),{isCardsShuttingDown:v}=Ir(n.tenantId,n.company?.managementInfo?.receiverEmails),u=xt(p?.loggedInUserRoleMap),{isFeatureEnabled:T}=t(Y.isCashbackFeatureEnabled),k=n.userRole.includes("charge_card_user"),U=!k,A=!k&&B,b=n?.userRole!=null&&Yc(n?.userRole),x=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!b)&&Kc(p?.loggedInUserRoleMap),d=Wc(p?.loggedInUserRoleMap),f=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!b)&&qc(p?.loggedInUserRoleMap),{isFeatureEnabled:M}=t(Y.isDepositAccountsFeatureEnabled),V=M&&!b&&zn(p?.loggedInUserRoleMap),O=B&&l&&!b,R=L&&j&&!b,z=C&&!b&&Fe(p?.loggedInUserRoleMap),$=Qc(p?.loggedInUserRoleMap),_=xe(n),D=Be(n),G=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Q=Ue({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:a,isBookKeepingTenant:D,isDebitCardProductVisible:m,chargeCardsCreditAccountLimit:G}),I=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:Q&&l,isTOSAccepted:F,isSetupEnabled:B,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:u}),N=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:m&&j,isTOSAccepted:w,isSetupEnabled:L,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:u}),K=I||N;return c.jsxs(cs,{children:[h?c.jsx(ce,{path:"setup",element:c.jsx(bn,{isBillPayAdminLevelAccess:x,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:V,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:$,isUserHasOnlyBillPayAccess:d,productType:"charge_cards",type:"setup"})}):null,h?c.jsx(ce,{path:"verification",element:c.jsx(bn,{isBillPayAdminLevelAccess:x,isUserHasOnlyBillPayAccess:d,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:V,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:$,productType:"charge_cards",type:"verification"})}):null,h&&S?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"policy",element:c.jsx(Zo,{})}),c.jsx(ce,{path:"policy/new",element:c.jsx(Uo,{})}),c.jsx(ce,{path:"policy/:templateId/edit",element:c.jsx(Vo,{})})]}):null,c.jsx(ce,{path:"promo",element:c.jsx(zi,{})}),O||R?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"/",element:c.jsx(kn,{isPaymentDrawerOpen:!1})}),z&&y?c.jsx(ce,{path:"payment",element:c.jsx(kn,{isPaymentDrawerOpen:!0})}):null,c.jsx(ce,{path:"activate",element:c.jsx(Gi,{})}),c.jsx(ce,{path:"onboard",element:c.jsx(Pi,{})}),h&&v!==!0?c.jsx(ce,{path:"new",element:c.jsx(Mi,{})}):h?c.jsx(ce,{path:"new",element:c.jsx(Je,{to:"..",replace:!0})}):null,T&&U?c.jsx(ce,{path:"cashback",element:c.jsx(Qo,{})}):null,A?c.jsx(ce,{path:"statements",element:c.jsx(Ai,{})}):null,z&&g&&B?c.jsx(ce,{path:"payment-history",element:c.jsx(Ei,{})}):null,c.jsx(ce,{path:":cardId/activate",element:c.jsx(ei,{})}),c.jsx(ce,{path:":cardId/setPin",element:c.jsx(Fi,{})}),c.jsx(ce,{path:":cardId/addToWallet",element:c.jsx(Yo,{})}),c.jsx(ce,{path:":cardId/*",element:c.jsx(li,{})}),c.jsx(ce,{path:"*",element:c.jsx(ct,{})})]}):(F||w)&&h?c.jsx(ce,{path:"*",element:c.jsx(Je,{to:"../setup"})}):K?c.jsx(ce,{path:"*",element:c.jsx(Je,{to:"../promo",state:e.state})}):c.jsx(ce,{path:"*",element:null})]})}export{Sd as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-C8AAaKDR.js";import{a as g}from"./sentry-DfheywaX.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-Da6TLrNx.js";import{z as C,be as P,E as F,e as V,g as A,ag as b,bf as j,au as L,av as M,v as U}from"./index-Bwczg7nO.js";import{eZ as D,gn as B,tX as _,gi as R,c7 as z,PI as G,bn as Y,rY as Z,rM as H,le as J,mP as S,PJ as X,bE as $,cA as N,mZ as q,n0 as K}from"./zeni-epic-state-BqRlfhza.js";import"./mui-CosLSKUu.js";import{d as Q}from"./routePaths-Kh8F22Sq.js";import{M as W}from"./MobileAppDrawer-D_5ajcgl.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="149c35bd-4fb6-4adb-a734-780174a53f94",a._sentryDebugIdIdentifier="sentry-dbid-149c35bd-4fb6-4adb-a734-780174a53f94")}catch{}})();const ee=E((function(a){const t=R(a),i=C.getSignedInUser(),l=D(a),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(a.companyConfigState),n=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}}),(function(a,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const n=Q(f,e),o=U(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(q({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:M(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(X(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(J({files:e}))},onDeleteFile:e=>{a(H(e))},onEditFileName:(e,n)=>{a(Z(e,n.split(".")[0]))}}}))(j);function de(){const a=w(),t=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(p(!0),t(B(d)))}),[c,n,d,t]),g.useEffect((()=>{o==="Not-Started"&&t(_())}),[o,t]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(A.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-
|
|
1
|
+
import{j as C}from"./liveblocks-C8AAaKDR.js";import{a}from"./sentry-DfheywaX.js";import{u as w,g as D,j as u,N as v}from"./core-Da6TLrNx.js";import{Mf as O,eZ as A,g3 as _,oi as j,gw as h,g2 as U,fC as L,Mm as F}from"./zeni-epic-state-BqRlfhza.js";import{u as $,z as f,L as g,O as k,o as H}from"./index-Bwczg7nO.js";import{n as z}from"./mui-CosLSKUu.js";import{t as R}from"./getLocaleForTenant-CnNopwIO.js";import{g as M,Q as P}from"./QBOConnectionScreen-CYvG88ne.js";import"./recharts-9jMEgSjc.js";import"./analytics-D_NuuF2U.js";import"./plaid-2mv_ck83.js";import"./dnd-DC_qF3Wr.js";import"./stripe-cKAAJElX.js";import"./lottie-B7_cpoe1.js";import"./lexical-CQoPutFC.js";import"./pdf-CQB-J2hc.js";import"./utils-BykfwIo5.js";import"./empty-s0Z9SHTS.js";import"./pdf-lib-CscVz5ta.js";import"./index-DykhB8j2.js";import"./url-C-T2kMoW.js";import"./index-CWFrIv4j.js";import"./decodeURIComponentSafe-B-r3T5bV.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="fadee79e-30e1-406a-9d57-386f12edb84a",t._sentryDebugIdIdentifier="sentry-dbid-fadee79e-30e1-406a-9d57-386f12edb84a")}catch{}})();const G=z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|