@zeniai/web-app-ui 5.1.55-qa → 5.1.56-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-DOG6BtAE.js +1 -0
- package/dist/assets/{AddressScreen-CvPxhYFs.js → AddressScreen-w3BS5T__.js} +2 -2
- package/dist/assets/{AiCfoScreen-DTTgGSqT.js → AiCfoScreen-C4K6FzbI.js} +2 -2
- package/dist/assets/{BillPayApprovalRoutes-2y_Smb3L.js → BillPayApprovalRoutes-D2l3MfyU.js} +1 -1
- package/dist/assets/{BillPayRoutes-D1KmPs-P.js → BillPayRoutes-puCF7hIb.js} +9 -9
- package/dist/assets/BusinessVerificationPageScreen-BCOKpvnp.js +9 -0
- package/dist/assets/CardsAiCfoScreen-DkQHJJyD.js +14 -0
- package/dist/assets/{ChargeCardRoutes-YoDH7ylN.js → ChargeCardRoutes-Ch4Au-Rk.js} +12 -12
- package/dist/assets/{CompanyPassportScreen-CfrYFFuL.js → CompanyPassportScreen-CLNMvqEv.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-yTkCaoK1.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-DSnDsx1L.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-BAxjCtaH.js → CustomerOnboardingRoutes-_QxL9WL8.js} +4 -4
- package/dist/assets/{DashboardRoutes-Cnv2Os-7.js → DashboardRoutes-BKcrEPsw.js} +3 -3
- package/dist/assets/{DefaultTenantHome-D1mjvDxR.js → DefaultTenantHome-DWIyuza_.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-CG8HU9uQ.js +18 -0
- package/dist/assets/DrawerScreen-BkOQSI_V.js +1 -0
- package/dist/assets/EntityDetailRoutes-QX_SVg1Y.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-UMX9R2ZB.js → ExpenseAutomationRoutes-BoyNxPcQ.js} +4 -4
- package/dist/assets/FeaturePreviewScreen-DVS7yzIQ.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-Dsb1nJdq.js +1 -0
- package/dist/assets/MagicLinkRoutes-C4TLmrqp.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-Cp5Vo4Py.js +12 -0
- package/dist/assets/MobileAppDrawer-BzjU__HS.js +1 -0
- package/dist/assets/NotFoundScreen-uCKl6Wx4.js +1 -0
- package/dist/assets/NotificationRoutes-CC398QC1.js +1 -0
- package/dist/assets/OAuthConsentScreen-DNPJKfDX.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-C3ftWleu.js +1 -0
- package/dist/assets/{PeopleRoutes-DwtjCeU9.js → PeopleRoutes-DAFt_Bcx.js} +3 -3
- package/dist/assets/PerformanceRoutes-DbR-tZSr.js +1 -0
- package/dist/assets/{Preview-JiizEL_C.js → Preview-f2ns8xny.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BD3gRv9C.js → QBOConnectionScreen-BEi0Zm8x.js} +1 -1
- package/dist/assets/{ReferralListScreen-DPPvxoTI.js → ReferralListScreen-DUY0_-v6.js} +2 -2
- package/dist/assets/ReimbursementApprovalRoutes-Chh2ITQV.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CcTmDK2L.js → ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-DHjMtvfB.js → ReimbursementRoutes-COtGoxgk.js} +7 -7
- package/dist/assets/{ReportsRoutes-B4rkl99K.js → ReportsRoutes-BcPE2nyn.js} +1 -1
- package/dist/assets/RewardsRoutes-Dok3xTzo.js +1 -0
- package/dist/assets/ScreenRoutes-C6QOgyjY.js +2 -0
- package/dist/assets/{SettingsRoutes-Bvbg8LVY.js → SettingsRoutes-NVzDxtS7.js} +7 -7
- package/dist/assets/{SetupPagesScreen-N7NZbMog.js → SetupPagesScreen-Df4FCfYh.js} +5 -5
- package/dist/assets/SignInScreen-DroHIon2.js +1 -0
- package/dist/assets/SignOutScreen-DoPJci6D.js +9 -0
- package/dist/assets/{TaskListScreen-DNjQxRsg.js → TaskListScreen-NFjvdEWw.js} +2 -2
- package/dist/assets/TaskRoutes-8aOjIEkV.js +9 -0
- package/dist/assets/{TransactionDetailRoutes-9wsPGvQA.js → TransactionDetailRoutes-D3MSXmNL.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-DdyjxpNe.js → TransactionDetailScreen-CSArdLSZ.js} +2 -2
- package/dist/assets/{TransactionListRoutes-Y3HUjCX4.js → TransactionListRoutes-UucRW17G.js} +1 -1
- package/dist/assets/{TreasuryRoutes-Po66nW-G.js → TreasuryRoutes-DwgadYGN.js} +5 -5
- package/dist/assets/{VendorsRoutes-Bhe46MLu.js → VendorsRoutes-Im4S2wjo.js} +14 -14
- package/dist/assets/WiseConfirmationScreen-C6UoDkmK.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-BVrcLxAX.js → ZeniAccountRoutes-Dczw62ti.js} +13 -13
- package/dist/assets/ZeniAccountStatementScreen-prmZg4t5.js +9 -0
- package/dist/assets/{accountMappingHelper-BfrLGhoG.js → accountMappingHelper-DS9ya8eF.js} +1 -1
- package/dist/assets/{analytics-CQmVOD4d.js → analytics-BLbM2ksu.js} +1 -1
- package/dist/assets/{analyticsHelper-Bvqx3iRr.js → analyticsHelper-B_k9Kjrd.js} +1 -1
- package/dist/assets/{core-CbpoBsNm.js → core-OMb8nkC1.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-9Mzf3G8U.js → decodeURIComponentSafe-CrZYJ6cg.js} +1 -1
- package/dist/assets/{dnd-CX5suNP6.js → dnd-DVcQZAG5.js} +1 -1
- package/dist/assets/{empty-DhAifQ6-.js → empty-BACf_dXg.js} +1 -1
- package/dist/assets/{empty-BijKctOw.js → empty-CyDTyMxd.js} +1 -1
- package/dist/assets/{emptyVideoElement-D-mIIbkx.js → emptyVideoElement-wUn7k4Wi.js} +1 -1
- package/dist/assets/{epic-D_RLnD_Y.js → epic-C0I2MvV5.js} +1 -1
- package/dist/assets/getLocaleForTenant-CDmBpg_y.js +1 -0
- package/dist/assets/{index-B781xFYL.js → index-5gq8gNHx.js} +2 -2
- package/dist/assets/{index-Mdt1gUpR.js → index-BNIZfLgU.js} +1 -1
- package/dist/assets/{index-Bg6fgf4p.js → index-BQIzm-tN.js} +1 -1
- package/dist/assets/{index-D-GsKzyX.js → index-CPre97x9.js} +1 -1
- package/dist/assets/{index-CR_Xz42r.js → index-CVJX5WNC.js} +1 -1
- package/dist/assets/{index-aZImxzjX.js → index-DLAYU8mN.js} +7454 -7454
- package/dist/assets/{index-CTRa-Eva.js → index-DmsNrKhC.js} +1 -1
- package/dist/assets/{index-cXBO33fb.js → index-SfOqAjbR.js} +1 -1
- package/dist/assets/{lexical-BS7d_1CV.js → lexical-CNfNgAkp.js} +1 -1
- package/dist/assets/{liveblocks-BLlSTcoD.js → liveblocks-BUQfB0Zp.js} +1 -1
- package/dist/assets/{lottie-BY8e0Ufw.js → lottie-DDI83OWz.js} +1 -1
- package/dist/assets/{mui-DcNGd9L2.js → mui-JZY-3hhJ.js} +1 -1
- package/dist/assets/{pathToGoBack-C2QnAeVh.js → pathToGoBack-iJW8VSI1.js} +1 -1
- package/dist/assets/{pdf-BslZhgI8.js → pdf-6FZlivdz.js} +4 -4
- package/dist/assets/{pdf-lib-BxiXr152.js → pdf-lib-CtBKoWQc.js} +1 -1
- package/dist/assets/{plaid-B62punae.js → plaid-B_OuebQv.js} +1 -1
- package/dist/assets/{pusher-yI34WBaU.js → pusher-BqrLLY7v.js} +1 -1
- package/dist/assets/{react-bALoVfnT.js → react-BVW_zt6p.js} +1 -1
- package/dist/assets/{react-BhNVTcBK.js → react-Crq75Q-S.js} +1 -1
- package/dist/assets/{react-D4d29E8H.js → react-D-VI0x0-.js} +1 -1
- package/dist/assets/{react-Bxt57-xI.js → react-PG_EpTGq.js} +1 -1
- package/dist/assets/{react-CcJOgdcP.js → react-axoushfz.js} +1 -1
- package/dist/assets/{react-DP_wuGKo.js → react-uplfhPO2.js} +1 -1
- package/dist/assets/{recharts-C0aThBg3.js → recharts-DAM4r1-u.js} +1 -1
- package/dist/assets/{routePaths-DyIc-n3M.js → routePaths-CLQbotzs.js} +1 -1
- package/dist/assets/{sentry-D_xp3E3Q.js → sentry-BLIwU6uZ.js} +1 -1
- package/dist/assets/{url-Cn_1-HsX.js → url-BMb7_G4N.js} +1 -1
- package/dist/assets/{url-DZdoYQOC.js → url-CbGZb3kM.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-ClwyrxTK.js → useAiCfoDashboardSuggestedQuestionsChips-Dtkjagus.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-BZImc5qT.js → useAskAiCfoHostNavButtonProps-Cw5yceVN.js} +1 -1
- package/dist/assets/useCashManagementBanner-COC9VygZ.js +1 -0
- package/dist/assets/{useDeviceId-BX67JldO.js → useDeviceId-l9JfwAte.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-DVxzaQcg.js → useInitialThreadRequest-CgLG7-4I.js} +1 -1
- package/dist/assets/{utils-BQO84dIV.js → utils-Bia5qc4p.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-MinVWpma.js → withTransactionSidePanel-Dtr8LlVa.js} +4 -4
- package/dist/assets/{zeni-epic-state-CkeDRiud.js → zeni-epic-state-BZ6N8nVI.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-ENVkkepY.js +0 -1
- package/dist/assets/BusinessVerificationPageScreen-D2N5zUvV.js +0 -9
- package/dist/assets/CardsAiCfoScreen-bhVF9e_F.js +0 -14
- package/dist/assets/ConnectionAuthScreen-B6tGghLx.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-CpXzEPeL.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-DEZpmV1y.js +0 -18
- package/dist/assets/DrawerScreen-CfPgZFbu.js +0 -1
- package/dist/assets/EntityDetailRoutes-ByNAOdBV.js +0 -1
- package/dist/assets/FeaturePreviewScreen-Bbo-4gXG.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-Cngdo8vI.js +0 -1
- package/dist/assets/MagicLinkRoutes-CP3FxH4t.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-DfMGZywc.js +0 -12
- package/dist/assets/MobileAppDrawer-CWBhYKqW.js +0 -1
- package/dist/assets/NotFoundScreen-Bnx2UPHv.js +0 -1
- package/dist/assets/NotificationRoutes-Qy8HYHkb.js +0 -1
- package/dist/assets/OAuthConsentScreen-DffRqRWT.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-DzMNbzsJ.js +0 -1
- package/dist/assets/PerformanceRoutes-DJjg_nmN.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-BwiPly2p.js +0 -1
- package/dist/assets/RewardsRoutes-CmWH02Nb.js +0 -1
- package/dist/assets/ScreenRoutes-BVhH5D33.js +0 -2
- package/dist/assets/SignInScreen-DqCXO7t5.js +0 -1
- package/dist/assets/SignOutScreen-PgaK8hUe.js +0 -9
- package/dist/assets/TaskRoutes-DddYQsp2.js +0 -9
- package/dist/assets/WiseConfirmationScreen-gcw35kRr.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-NjdxQEux.js +0 -9
- package/dist/assets/getLocaleForTenant-9euvow3p.js +0 -1
- package/dist/assets/useCashManagementBanner-BWjfwjGa.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BLlSTcoD.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as Dt,n as De,t as In,o as es,p as se}from"./core-CbpoBsNm.js";import{bs as Pe,Rq as as,Rr as ts,eY as un,Rs as kn,f5 as En,Rt as An,Ru as Dn,Rv as _n,Rw as Pn,f6 as wn,f7 as vn,Rx as Tn,fh as Fn,fi as $a,Ry as xn,Rz as ns,fb as rs,fa as ss,RA as cs,BP as Rn,fk as ca,RB as os,RC as is,e_ as ds,eZ as ls,fw as ze,fd as Bn,fc as Ln,RD as us,fe as ms,Bk as Cs,Bj as ps,Bn as hs,Bp as fs,fp as gs,eV as On,RE as bs,RF as Ss,fu as Un,RG as ys,fv as St,Bv as Is,Bs as ks,eW as fe,RH as Qa,fz as we,fA as ve,fB as Te,gu as oa,cw as ia,RI as da,RJ as _t,uC as za,kz as Za,RK as Wa,C3 as ka,C5 as Qe,C6 as Pt,kp as jn,RL as la,BT as _a,RM as Es,RN as As,BW as Ja,RO as Ds,PL as Xa,fg as Mn,C0 as ga,hP as _s,RP as Nn,RQ as ua,bq as Ps,RR as ws,gf as et,ge as at,CA as vs,gd as tt,Pr as Ts,RS as Vn,cp as Hn,cR as Fs,PK as wa,D9 as Gn,RT as mn,CL as Pa,RU as $n,Da as xs,Qa as Rs,Db as Bs,E7 as Ls,tZ as Os,E1 as Us,RV as js,C4 as ra,RW as Ms,RX as Ns,RY as Vs,RZ as Hs,R_ as Gs,R$ as wt,S0 as $s,Cl as zn,Ce as zs,S1 as Zs,gw as Ws,Cu as Zn,Cy as Wn,gv as Ks,S2 as Ys,CX as Kn,S3 as qs,S4 as Qs,S5 as Js,Cw as Yn,Ch as qn,BZ as Qn,Cq as Jn,Co as Xn,Cs as Xs,S6 as er,S7 as ec,fr as ac,fs as tc,ft as nc,S8 as nt,fl as ar,cS as vt,S9 as rc,Sa as sc,Sb as cc,Sc as oc,CG as yt,D2 as ic,C_ as dc,CC as lc,D0 as uc,CS as mc,CU as Cc,Sd as tr,D8 as Ga,JS as pc,Se as hc,Sf as fc,Sg as gc,Sh as nr,Si as bc,Dv as Sc,CK as rr,CF as je,CJ as yc,Sj as Ic,Sk as kc,BQ as Ec,Sl as sr,ff as cr,Sm as Ac,BS as Dc,BR as Cn,Sn as _c,So as Pc,Sp as wc,Mn as vc,Sq as Tt,Sr as Tc,xC as or,l7 as Fc,hF as xc,DA as Rc,Ss as ir,f2 as Bc,f3 as Lc,St as Oc,di as Uc,fj as jc,Dq as Mc,Dk as qe,bt as Nc,bJ as Vc,cB as Hc,bK as Gc,LA as $c}from"./zeni-epic-state-CkeDRiud.js";import{j as Fe,cm as dr,p as _e,cn as lr,co as ur,cp as zc,D as Xe,_ as Ft,cq as Zc,cr as Wc,W as mr,a as Cr,Z as pr,s as ye,F as le,x as K,aq as ya,cs as hr,ct as Kc,cu as Yc,z as re,B as va,cb as rt,cv as qc,cw as Qc,cx as Jc,cy as Xc,cz as eo,K as Ta,aN as Ze,bo as xt,cA as ao,G as Fa,h as st,m as Rt,d as J,a7 as ct,cB as to,bB as ba,cC as It,cD as no,A as Bt,cE as ro,at as fr,a2 as kt,cF as so,X as gr,f as br,cG as co,cH as oo,cI as io,cJ as lo,cK as uo,cL as mo,o as Ka,cM as Co,cN as po,cO as pt,w as ho,cP as fo,cQ as go,cR as bo,cS as So,cT as yo,a9 as Io}from"./index-aZImxzjX.js";import{n as Ne,D as Sr,S as ko}from"./mui-DcNGd9L2.js";import{a as r}from"./sentry-D_xp3E3Q.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BZImc5qT.js";import{M as Ie}from"./MobileAppDrawer-CWBhYKqW.js";import{d as Lt}from"./recharts-C0aThBg3.js";import{g as Ae,a as Ra,b as yr,c as xe,d as Re,e as Je,f as ea,h as aa,A as Eo,i as Ot,P as Ao,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Do,o as Er,p as _o,S as pn}from"./SetupPagesScreen-N7NZbMog.js";import{u as Ar}from"./useInitialThreadRequest-DVxzaQcg.js";import ot from"./NotFoundScreen-Bnx2UPHv.js";import{n as hn}from"./utils-BQO84dIV.js";import{t as Po}from"./AddressScreen-CvPxhYFs.js";import"./analytics-CQmVOD4d.js";import"./plaid-B62punae.js";import"./dnd-CX5suNP6.js";import"./stripe-DMRn4zHo.js";import"./lottie-BY8e0Ufw.js";import"./lexical-BS7d_1CV.js";import"./pdf-BslZhgI8.js";import"./analyticsHelper-Bvqx3iRr.js";import"./routePaths-DyIc-n3M.js";import"./BusinessVerificationPageScreen-D2N5zUvV.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]="be86d683-7e2e-4df6-98b9-db99bc3c52a5",e._sentryDebugIdIdentifier="sentry-dbid-be86d683-7e2e-4df6-98b9-db99bc3c52a5")}catch{}})();const wo=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}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:wo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),vo=e=>Bn(e,!1),To=e=>Ln(e.name,!1);function Fo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(T=>{g(T)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const D=o(T=>kn(T.cardPolicyState)),d=o(T=>En(T.cardPolicyState)),j=o(T=>An(T.cardPolicyState)),P=o(T=>Dn(T.cardPolicyState)),F=o(T=>_n(T.cardPolicyState)),C=o(T=>Pn(T.cardPolicyState)),h=o(T=>wn(T.cardPolicyState)),w=o(T=>vn(T.cardPolicyState)),u=o(T=>Tn(T.cardPolicyState)),v=o(T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(T=>T.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Fn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(T=>xn(T.createCardPolicyState)),A=o(T=>ns(T.createCardPolicyState)),I=o(T=>rs(T.cardPolicyState)),L=o(T=>ss(T.cardPolicyState)),l=o(T=>cs(T.createCardPolicyState)),p=o(T=>Rn(T));r.useEffect(()=>{p.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[p.fetchState,a]);const N=r.useMemo(()=>d.map(vo),[d]),G=r.useMemo(()=>h.map(To),[h]),O=r.useMemo(()=>p.cards.filter(T=>!dr(T.status.code)).map(Dr),[p.cards]),U=D==="Completed"&&p.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:v,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:F,suggestedBlockCategories:C}))},[k,a,U,l,O,v,j,P,F,C]);const z=r.useMemo(()=>Lt(T=>{a($a(T))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(T=>{z(T)},[z]),y=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",W=r.useCallback(()=>{const T=_e(n.state?.pathnameStackToGoBack),ee=T.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:T.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(T=>{a(is(T))},[a]),V=r.useCallback(T=>{const ee=lr(T);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(T=>{T.length!==0&&a(ls(T))},[a]),X=r.useCallback(()=>{a(un())},[a]),S=r.useRef(y);r.useEffect(()=>{const T=S.current;S.current=y,y==="Completed"&&T!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,y,A,e,x]);const R=y==="Error"?M.error?.message??fn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:W,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:y,submitErrorMessage:R,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:B,onBackClick:W,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=Xe.getLocalizedStrings(),Ro=e=>Bn(e,!1),Bo=e=>Ln(e.name,!1);function Lo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(R=>{_(R)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Card Policy"}),d=o(R=>us(R)),j=o(R=>kn(R.cardPolicyState)),P=o(R=>En(R.cardPolicyState)),F=o(R=>An(R.cardPolicyState)),C=o(R=>Dn(R.cardPolicyState)),h=o(R=>_n(R.cardPolicyState)),w=o(R=>Pn(R.cardPolicyState)),u=o(R=>wn(R.cardPolicyState)),v=o(R=>vn(R.cardPolicyState)),k=o(R=>Tn(R.cardPolicyState)),M=o(R=>Rn(R)),A=o(R=>a!=null?ms(R.cardPolicyState,a):void 0),I=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?Cs(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const R=d.detailFetchState.fetchState;d.templateId===a&&(R==="Completed"||R==="In-Progress")||A!=null||s(ps(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Fn())},[s,j]),r.useEffect(()=>{v==="Completed"&&k===""||v==="In-Progress"||s($a())},[s,v,k]);const L=o(R=>R.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Ro),[P]),p=r.useMemo(()=>u.map(Bo),[u]),N=r.useMemo(()=>M.cards.filter(R=>!dr(R.status.code)).map(Dr),[M.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Zc({draft:I,cardRows:N,categorySearchOptions:l,vendorSearchOptions:p,defaultRequireReceiptAmount:L,suggestedAllowMerchants:F,suggestedBlockMerchants:C,suggestedAllowCategories:h,suggestedBlockCategories:w})},[I,N,l,p,L,F,C,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(R=>{U(R)},[]),y=r.useMemo(()=>Lt(R=>{s($a(R))},250),[s]);r.useEffect(()=>()=>{y.cancel()},[y]);const x=r.useCallback(R=>{y(R)},[y]),W=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const R=_e(n.state?.pathnameStackToGoBack),T=R.poppedPathname??q;e(T,{state:{pathnameStackToGoBack:R.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(R=>{if(a==null)return;const T=lr(R);s(hs(T)),s(fs(a))},[s,a]),X=r.useRef(W);r.useEffect(()=>{const R=X.current;X.current=W,W==="Completed"&&R!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,W,e,q]);const S=W==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Wc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:p,categorySearchOptions:l,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:x,submitState:W,submitErrorMessage:S,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Oo,subheadline:Uo,pageTitle:jo}}}}=Xe.getLocalizedStrings(),Mo=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 No(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(y=>{g(y)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),P=o(y=>bs(y)),F=o(y=>xn(y.createCardPolicyState)),C=o(y=>Ss(y.createCardPolicyState)),h=o(y=>C==null?[]:Un(y.aiCfoState,C).filter(x=>x.kind==="creating_policy"),Dt),w=F.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(y=>ys(y.createCardPolicyState)),v=ya(F.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&F.fetchState==="Completed"&&C!=null)h.forEach(y=>{a(St({chatSessionId:C,id:y.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&F.fetchState==="Error"&&C!=null){h.forEach(x=>{a(St({chatSessionId:C,id:x.id,kind:"errored_policy"}))});const y=F.error?.message!=null&&F.error.message.length>0?F.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:y}]}))}},[F.error?.message,F.fetchState,a,C,u,h,v]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const I=r.useMemo(()=>P.templates.map(Mo),[P.templates]);Ft({isDataReady:P.fetchState.fetchState==="Completed"});const L=I.length>0||w>0,l=function(y){const{hasAnyPolicies:x,isChargeCardAdmin:W,isFileUploadEnabled:q}=y,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=mr(),R=Cr(),T=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:Y,isResolved:ke}=Pr("card_policy"),be=r.useMemo(()=>_r(Y,ke,3),[Y,ke]),[ge,ae]=r.useState(""),ue=T&&R&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),We=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ke=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&W)return{aiAgentName:jo,headline:Oo,subheadline:Uo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:We,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ke,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,W,q,ee,ne,Be,Ke,te,Ee,We,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:B}),p=D&&l!=null?c.jsx(hr,{...l}):null,N=d&&p==null,G=r.useCallback(()=>{const y=_e(n.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(y=>{t!=null&&e(`/${t}/cards/policy/${y}/edit`)},[e,t]),z=r.useCallback(y=>{a(ks(y))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Yc,{policies:I,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:p,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Vo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(Y=>fe(Y)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(Y=>Qa(Y).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),F=ve(s),C=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),u=Re({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:F,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(Y=>oa(Y,s.companyId)),M=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(Y=>da(Y)),L=o(Y=>Y.classListState.fetchState),l=!B&&u&&d,p=o(Y=>_t(Y,n,l,u)),[N,G]=r.useState(!1),O=p.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(Y=>U!=null?za(Y.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],y=o(Y=>Z!=null?Za(Y.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,W=o(Y=>x!=null?za(Y.userRoleState,x):void 0),q=W?.accountingClassIDs[0],E=o(Y=>q!=null?Za(Y.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Wa()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const Y=Ae(s.tenantEmailDomain,n,a,O,m);e(Y)}},[p.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&u&&d&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Wa());const Y=Ae(s.tenantEmailDomain,n,a);e(Y)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",R=Je(u,w,v,d),T=Ra(u,d,f,A,I),ee=yr(S,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:d,productInformation:R,creditAccountInformation:T,debitAccountInformation:ee,chargeCardDetailView:p,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:y?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:E?.className})]})}const jt=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Qc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,B=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Jc(D);if(j==="")return;const P=s.channel(d),F=h=>{b.current(j,h)};let C;if(P?.subscribed===!0)C=P,C.bind(j,F),m.has(d)||(m.add(d),B()),i.push(()=>{P.unbind(j,F)});else{if(C=P??s.subscribe(d),C.bind(j,F),!m.has(d)){m.add(d);const h=()=>{B()};C.bind("pusher:subscription_succeeded",h),i.push(()=>{C.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{C.unbind(j,F)})}}),()=>{i.forEach(D=>D())}},[s,_])},wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",Ho="charge-card-department-updated",Rr="charge-card-repayment-completed",Br="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Go=[La,Ba],$o=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(eo);function zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>la(j)),m=Ar(s.companyId,{clearParams:i.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Zo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=ea(s);if(jt({events:Ca(D,Go),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx($o,{onBackClick:B,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Xc,{onBackClick:B})}const Zo=e=>`/${e}/cards`,Wo={containerWidth:new Fa(100,58)},Ko=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const F=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=f(Ze.zeniCardsConfig),h=C.max_charge_card_activation_attempts_by_card_id,w=o(E=>As(E,s)),u=w.chargeCard,v=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),I=Te(A,F),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,p=F.userRole.includes("charge_card_user"),N=we(F),G=ve(F),O=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!p&&U&&l;r.useEffect(()=>{g===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,v]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(B===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(B&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,B,w.isRefreshingViewInBackground]);const y=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Mn(E.userState,P.userId)),W=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(W,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(Yo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:xt(),chargeCardDetailState:w,signedInUserToken:y,navigate:a,currentTenant:F,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:C.default_max_charge_card_activation_attempts!=null?C.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(qo,{windowSize:n,children:e}):null]})},Yo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=_s(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),g=n.updateStatus,_=ua(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(vs(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(ao),qo=Ne.div`
|
|
1
|
+
import{j as c}from"./liveblocks-BUQfB0Zp.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as Dt,n as De,t as In,o as es,p as se}from"./core-OMb8nkC1.js";import{bt as Pe,Rp as as,Rq as ts,eX as un,Rr as kn,f4 as En,Rs as An,Rt as Dn,Ru as _n,Rv as Pn,f5 as wn,f6 as vn,Rw as Tn,fg as Fn,fh as $a,Rx as xn,Ry as ns,fa as rs,f9 as ss,Rz as cs,BO as Rn,fj as ca,RA as os,RB as is,eZ as ds,eY as ls,fv as ze,fc as Bn,fb as Ln,RC as us,fd as ms,Bj as Cs,Bi as ps,Bm as hs,Bo as fs,fo as gs,eU as On,RD as bs,RE as Ss,ft as Un,RF as ys,fu as St,Bu as Is,Br as ks,eV as fe,RG as Ja,fy as we,fz as ve,fA as Te,gt as oa,cv as ia,RH as da,RI as _t,uB as za,ky as Za,RJ as Ya,C2 as ka,C4 as Je,C5 as Pt,ko as jn,RK as la,BS as _a,RL as Es,RM as As,BV as Qa,RN as Ds,PK as Xa,ff as Mn,B$ as ga,hO as _s,RO as Nn,RP as ua,bo as Ps,RQ as ws,ge as et,gd as at,Cz as vs,gc as tt,Pq as Ts,RR as Vn,co as Hn,cQ as Fs,PJ as wa,D8 as Gn,RS as mn,CK as Pa,RT as $n,D9 as xs,Q9 as Rs,Da as Bs,E6 as Ls,tY as Os,E0 as Us,RU as js,C3 as ra,RV as Ms,RW as Ns,RX as Vs,RY as Hs,RZ as Gs,R_ as wt,R$ as $s,Ck as zn,Cd as zs,S0 as Zs,gv as Ys,Ct as Zn,Cx as Yn,gu as Ws,S1 as Ks,CW as Wn,S2 as qs,S3 as Js,S4 as Qs,Cv as Kn,Cg as qn,BY as Jn,Cp as Qn,Cn as Xn,Cr as Xs,S5 as er,S6 as ec,fq as ac,fr as tc,fs as nc,S7 as nt,fk as ar,cR as vt,S8 as rc,S9 as sc,Sa as cc,Sb as oc,CF as yt,D1 as ic,CZ as dc,CB as lc,C$ as uc,CR as mc,CT as Cc,Sc as tr,D7 as Ga,JR as pc,Sd as hc,Se as fc,Sf as gc,Sg as nr,Sh as bc,Du as Sc,CJ as rr,CE as je,CI as yc,Si as Ic,Sj as kc,BP as Ec,Sk as sr,fe as cr,Sl as Ac,BR as Dc,BQ as Cn,Sm as _c,Sn as Pc,So as wc,Mm as vc,Sp as Tt,Sq as Tc,xB as or,l6 as Fc,hE as xc,Dz as Rc,Sr as ir,f1 as Bc,f2 as Lc,Ss as Oc,dh as Uc,fi as jc,Dp as Mc,Dj as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,Lz as $c}from"./zeni-epic-state-BZ6N8nVI.js";import{j as Fe,cm as dr,q as _e,cn as lr,co as ur,cp as zc,D as Xe,_ as Ft,cq as Zc,cr as Yc,V as mr,c as Cr,X as pr,s as ye,a as le,F as W,aq as ya,cs as hr,ct as Wc,cu as Kc,z as re,B as va,cb as rt,cv as qc,cw as Jc,cx as Qc,cy as Xc,cz as eo,J as Ta,aN as Ze,bo as xt,cA as ao,A as Fa,k as st,m as Rt,d as Q,a7 as ct,cB as to,bB as ba,cC as It,cD as no,E as Bt,cE as ro,at as fr,a2 as kt,cF as so,W as gr,f as br,cG as co,cH as oo,cI as io,cJ as lo,cK as uo,cL as mo,o as Wa,cM as Co,cN as po,cO as pt,Z as ho,cP as fo,cQ as go,cR as bo,cS as So,cT as yo,a9 as Io}from"./index-DLAYU8mN.js";import{n as Ne,D as Sr,S as ko}from"./mui-JZY-3hhJ.js";import{a as r}from"./sentry-BLIwU6uZ.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Cw5yceVN.js";import{M as Ie}from"./MobileAppDrawer-BzjU__HS.js";import{d as Lt}from"./recharts-DAM4r1-u.js";import{g as Ae,a as Ra,b as yr,c as xe,d as Re,e as Qe,f as ea,h as aa,A as Eo,i as Ot,P as Ao,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Do,o as Er,p as _o,S as pn}from"./SetupPagesScreen-Df4FCfYh.js";import{u as Ar}from"./useInitialThreadRequest-CgLG7-4I.js";import ot from"./NotFoundScreen-uCKl6Wx4.js";import{n as hn}from"./utils-Bia5qc4p.js";import{t as Po}from"./AddressScreen-w3BS5T__.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./analyticsHelper-B_k9Kjrd.js";import"./routePaths-CLQbotzs.js";import"./BusinessVerificationPageScreen-BCOKpvnp.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]="3369e947-ff58-4869-9f3f-d528b4bfbdac",e._sentryDebugIdIdentifier="sentry-dbid-3369e947-ff58-4869-9f3f-d528b4bfbdac")}catch{}})();const wo=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}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:wo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),vo=e=>Bn(e,!1),To=e=>Ln(e.name,!1);function Fo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(T=>{g(T)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const D=o(T=>kn(T.cardPolicyState)),d=o(T=>En(T.cardPolicyState)),j=o(T=>An(T.cardPolicyState)),P=o(T=>Dn(T.cardPolicyState)),F=o(T=>_n(T.cardPolicyState)),C=o(T=>Pn(T.cardPolicyState)),h=o(T=>wn(T.cardPolicyState)),w=o(T=>vn(T.cardPolicyState)),u=o(T=>Tn(T.cardPolicyState)),v=o(T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(T=>T.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Fn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(T=>xn(T.createCardPolicyState)),A=o(T=>ns(T.createCardPolicyState)),I=o(T=>rs(T.cardPolicyState)),L=o(T=>ss(T.cardPolicyState)),l=o(T=>cs(T.createCardPolicyState)),p=o(T=>Rn(T));r.useEffect(()=>{p.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[p.fetchState,a]);const N=r.useMemo(()=>d.map(vo),[d]),G=r.useMemo(()=>h.map(To),[h]),O=r.useMemo(()=>p.cards.filter(T=>!dr(T.status.code)).map(Dr),[p.cards]),U=D==="Completed"&&p.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:v,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:F,suggestedBlockCategories:C}))},[k,a,U,l,O,v,j,P,F,C]);const z=r.useMemo(()=>Lt(T=>{a($a(T))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(T=>{z(T)},[z]),y=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const T=_e(n.state?.pathnameStackToGoBack),ee=T.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:T.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(T=>{a(is(T))},[a]),V=r.useCallback(T=>{const ee=lr(T);a(ds({templates:[ee]}))},[a]),J=r.useCallback(T=>{T.length!==0&&a(ls(T))},[a]),X=r.useCallback(()=>{a(un())},[a]),S=r.useRef(y);r.useEffect(()=>{const T=S.current;S.current=y,y==="Completed"&&T!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,y,A,e,x]);const R=y==="Error"?M.error?.message??fn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:y,submitErrorMessage:R,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:B,onBackClick:Y,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:J,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=Xe.getLocalizedStrings(),Ro=e=>Bn(e,!1),Bo=e=>Ln(e.name,!1);function Lo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(R=>{_(R)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Card Policy"}),d=o(R=>us(R)),j=o(R=>kn(R.cardPolicyState)),P=o(R=>En(R.cardPolicyState)),F=o(R=>An(R.cardPolicyState)),C=o(R=>Dn(R.cardPolicyState)),h=o(R=>_n(R.cardPolicyState)),w=o(R=>Pn(R.cardPolicyState)),u=o(R=>wn(R.cardPolicyState)),v=o(R=>vn(R.cardPolicyState)),k=o(R=>Tn(R.cardPolicyState)),M=o(R=>Rn(R)),A=o(R=>a!=null?ms(R.cardPolicyState,a):void 0),I=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?Cs(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const R=d.detailFetchState.fetchState;d.templateId===a&&(R==="Completed"||R==="In-Progress")||A!=null||s(ps(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Fn())},[s,j]),r.useEffect(()=>{v==="Completed"&&k===""||v==="In-Progress"||s($a())},[s,v,k]);const L=o(R=>R.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Ro),[P]),p=r.useMemo(()=>u.map(Bo),[u]),N=r.useMemo(()=>M.cards.filter(R=>!dr(R.status.code)).map(Dr),[M.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Zc({draft:I,cardRows:N,categorySearchOptions:l,vendorSearchOptions:p,defaultRequireReceiptAmount:L,suggestedAllowMerchants:F,suggestedBlockMerchants:C,suggestedAllowCategories:h,suggestedBlockCategories:w})},[I,N,l,p,L,F,C,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(R=>{U(R)},[]),y=r.useMemo(()=>Lt(R=>{s($a(R))},250),[s]);r.useEffect(()=>()=>{y.cancel()},[y]);const x=r.useCallback(R=>{y(R)},[y]),Y=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const R=_e(n.state?.pathnameStackToGoBack),T=R.poppedPathname??q;e(T,{state:{pathnameStackToGoBack:R.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),J=r.useCallback(R=>{if(a==null)return;const T=lr(R);s(hs(T)),s(fs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const R=X.current;X.current=Y,Y==="Completed"&&R!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Yc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:p,categorySearchOptions:l,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:J})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Oo,subheadline:Uo,pageTitle:jo}}}}=Xe.getLocalizedStrings(),Mo=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 No(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(y=>{g(y)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),P=o(y=>bs(y)),F=o(y=>xn(y.createCardPolicyState)),C=o(y=>Ss(y.createCardPolicyState)),h=o(y=>C==null?[]:Un(y.aiCfoState,C).filter(x=>x.kind==="creating_policy"),Dt),w=F.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(y=>ys(y.createCardPolicyState)),v=ya(F.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&F.fetchState==="Completed"&&C!=null)h.forEach(y=>{a(St({chatSessionId:C,id:y.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&F.fetchState==="Error"&&C!=null){h.forEach(x=>{a(St({chatSessionId:C,id:x.id,kind:"errored_policy"}))});const y=F.error?.message!=null&&F.error.message.length>0?F.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:y}]}))}},[F.error?.message,F.fetchState,a,C,u,h,v]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const I=r.useMemo(()=>P.templates.map(Mo),[P.templates]);Ft({isDataReady:P.fetchState.fetchState==="Completed"});const L=I.length>0||w>0,l=function(y){const{hasAnyPolicies:x,isChargeCardAdmin:Y,isFileUploadEnabled:q}=y,E=de(),V=Ce(),{tenantEmailDomain:J}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=mr(),R=Cr(),T=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:K,isResolved:ke}=Pr("card_policy"),be=r.useMemo(()=>_r(K,ke,3),[K,ke]),[ge,ae]=r.useState(""),ue=T&&R&&J!=null&&!X,oe=r.useCallback(ce=>{if(J==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${J}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,J]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),We=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:jo,headline:Oo,subheadline:Uo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:We,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,We,te,Ee,Ye,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:B}),p=D&&l!=null?c.jsx(hr,{...l}):null,N=d&&p==null,G=r.useCallback(()=>{const y=_e(n.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(y=>{t!=null&&e(`/${t}/cards/policy/${y}/edit`)},[e,t]),z=r.useCallback(y=>{a(ks(y))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Kc,{policies:I,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:p,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Vo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(K=>fe(K)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(K=>Ja(K).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(W.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(W.isDebitCardFeatureEnabled),P=we(s),F=ve(s),C=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),u=Re({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:F,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(K=>oa(K,s.companyId)),M=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(K=>da(K)),L=o(K=>K.classListState.fetchState),l=!B&&u&&d,p=o(K=>_t(K,n,l,u)),[N,G]=r.useState(!1),O=p.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(K=>U!=null?za(K.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],y=o(K=>Z!=null?Za(K.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(K=>x!=null?za(K.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(K=>q!=null?Za(K.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",J=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Ya()),J&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,J]),r.useEffect(()=>{N||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const K=Ae(s.tenantEmailDomain,n,a,O,m);e(K)}},[p.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(Je()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&u&&d&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const K=Ae(s.tenantEmailDomain,n,a);e(K)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",R=Qe(u,w,v,d),T=Ra(u,d,f,A,I),ee=yr(S,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:d,productInformation:R,creditAccountInformation:T,debitAccountInformation:ee,chargeCardDetailView:p,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:y?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const jt=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Jc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,B=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Qc(D);if(j==="")return;const P=s.channel(d),F=h=>{b.current(j,h)};let C;if(P?.subscribed===!0)C=P,C.bind(j,F),m.has(d)||(m.add(d),B()),i.push(()=>{P.unbind(j,F)});else{if(C=P??s.subscribe(d),C.bind(j,F),!m.has(d)){m.add(d);const h=()=>{B()};C.bind("pusher:subscription_succeeded",h),i.push(()=>{C.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{C.unbind(j,F)})}}),()=>{i.forEach(D=>D())}},[s,_])},wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",Ho="charge-card-department-updated",Rr="charge-card-repayment-completed",Br="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Go=[La,Ba],$o=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(eo);function zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(W.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>la(j)),m=Ar(s.companyId,{clearParams:i.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Zo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=ea(s);if(jt({events:Ca(D,Go),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx($o,{onBackClick:B,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Xc,{onBackClick:B})}const Zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const F=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=f(Ze.zeniCardsConfig),h=C.max_charge_card_activation_attempts_by_card_id,w=o(E=>As(E,s)),u=w.chargeCard,v=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),I=Te(A,F),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,p=F.userRole.includes("charge_card_user"),N=we(F),G=ve(F),O=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!p&&U&&l;r.useEffect(()=>{g===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,v]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(B===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(B&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,B,w.isRefreshingViewInBackground]);const y=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Mn(E.userState,P.userId)),Y=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Jo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(Ko,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:xt(),chargeCardDetailState:w,signedInUserToken:y,navigate:a,currentTenant:F,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:C.default_max_charge_card_activation_attempts!=null?C.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(qo,{windowSize:n,children:e}):null]})},Ko=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=_s(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),g=n.updateStatus,_=ua(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(vs(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(ao),qo=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
width: ${e=>`${
|
|
4
|
+
width: ${e=>`${Yo.containerWidth.value(e.windowSize)}%`};
|
|
5
5
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
6
|
-
`,
|
|
6
|
+
`,Jo=Ne.div`
|
|
7
7
|
display: flex;
|
|
8
8
|
min-height: 100%;
|
|
9
9
|
width: 100%;
|
|
@@ -11,18 +11,18 @@ import{j as c}from"./liveblocks-BLlSTcoD.js";import{h as de,g as Ce,i as Me,u as
|
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
align-items: center;
|
|
13
13
|
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,
|
|
14
|
+
`,Ka=Xe.getLocalizedStrings().dateFormat,Qo={overlayWidth:new Fa(100,100,58)},Lr=[Rr,it],Xo=new Set(Lr),ei=De(function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Rs(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Bs(e.depositAccountState,e.depositAccountListState)}},function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:b,isCashbackInfoFetchStateCompleted:f,isCreditCardInfoFetchStateCompleted:g,isDebitCardInfoFetchStateCompleted:_,controllerEmails:i,paymentDetails:m,productInformation:B,cashbackInformation:D,paymentSourceInformation:d,creditAccountInformation:j,debitAccountInformation:P,paymentInitiatedDate:F,sourcePage:C}=n,{tenantEmailDomain:h}=a,w=()=>{e(Gn(!0));const u=ea(a);u!=null&&u!==""&&e(Pa(u,!0,!0)),e(Je(!0))};return{onBackNavigation:()=>{if(f&&g&&_&&D!=null&&Q.trackCardsPayEarlyFormClick(i,B,D,"Back",m.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:m.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:m.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:m.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:m.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:F?.add(3,"day").format(Ka.visual.MMMDCommaYYYYformat),paymentInitiatedDate:F?.format(Ka.visual.MMMDCommaYYYYformat)},d,j,P),C==="cardPaymentHistory")n.closeDrawerHandler(!0),e($n());else{const u=aa(h);t(u)}},onUpdatePaymentAccountStatus:(u,v,k)=>{e(Us(u,v,"bill_pay","bill_pay_detail",k))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:u=>{e(Os("external_account",u))},onEstablishConnectionClick:u=>{e(Ls(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:()=>{b?window.open(`/${h}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onEventReceived:u=>{Xo.has(u)&&w()},onPusherSubscribed:w}})(ct(to)),Gt=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:b,creditAccountInformation:f,debitAccountInformation:g,cashbackInformation:_,isDebitCardInfoFetchStateCompleted:i,isCreditCardInfoFetchStateCompleted:m,isCashbackInfoFetchStateCompleted:B,paymentInitiatedDate:D,retryRepayment:d})=>{const j=de(),{useDynamicConfig:P}=le(),{configValue:F}=P(Ze.zeniAccountsConfig),C=Ts(F),h=o(R=>Vn(R)),{creditAccount:w}=o(R=>da(R)),u=o(R=>fe(R)),v=Rt(),k=Ta(),M=pe(),A=re.getSignedInUser(),I=Fe(),[L,l]=r.useState(!1),[p,N]=r.useState(!1),{configValue:G}=P(Ze.zeniCardsConfig),O=G.credit_card_auto_pay_threshold_by_company_id?.[u.companyId]??G.default_credit_card_auto_pay_threshold??Eo,U=Hn(I?.loggedInUserRoleMap),z=Fs(I?.loggedInUserRoleMap),Z=!!u.companyZeniAccountInfo?.info?.isZeniAccountEnabled,y=o(R=>wa(R,u.companyId)),x=y.companyChargeCardInfo?.primaryFundingAccount,Y=y.allFundingAccounts.find(R=>R.id===x?.accountId),q=o(R=>oa(R,u.companyId)),E=ia(q.controllers);r.useEffect(()=>{if(h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&M(Gn()),h.fetchState==="Completed"&&!p){const R=u.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,T=h.transferFromAccounts.find(K=>K.id===R);let ee;if(b==="cardPaymentHistory"&&d){const K=d.paymentAccountId!=null?h.transferFromAccounts.find(ke=>ke.id===d.paymentAccountId):void 0;ee={amount:d.amount,isAutoRepayment:u.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:hn(),transferFrom:K??T}}else ee={amount:{amount:w.balance.amount+w.hold.amount,currencyCode:w.balance.currencyCode,currencySymbol:w.balance.currencySymbol},isAutoRepayment:u.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:hn(),transferFrom:T};M(mn(ee)),N(!0)}},[h.fetchState,p,b,d,h.transferFromAccounts,u.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,u.companyChargeCardInfo?.info?.isAutoPayEnabled,w.balance.amount,w.balance.currencyCode,w.balance.currencySymbol,w.hold.amount,M]);const V={isZeniCheckingEnabled:u.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:Y?.accType==="depositAccount",creditCardPaymentSourceAccountName:Y?.label,creditCardPaymentSourceAccountType:Y?.accType,creditCardPaymentSourceLastFourDigits:Y?.accountLast4,creditCardPaymentSourceBalance:Y?.accountBalance?.available?.amount??0};if(r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&M(Pa(u.companyId,!0))},[y.fetchState]),r.useEffect(()=>{h.updateStatus==="Completed"&&_!=null&&B&&m&&i&&Q.trackCardsPayEarlyPayNowClick(E,s,_,h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:D?.add(3,"day").format(Ka.visual.MMMDCommaYYYYformat),paymentInitiatedDate:D?.format(Ka.visual.MMMDCommaYYYYformat)},V,f,g)},[h.updateStatus,_,B,m,i,D]),r.useEffect(()=>{h.fetchState==="Completed"&&_!=null&&B&&m&&i&&!L&&e&&p&&_!=null&&(Q.trackCardsPayEarlyFormView(E,s,_,t,u.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,w.balance.amount,V,f,g),l(!0))},[h,B,m,i,L,e,p]),A==null)throw Error("Can't access invite people page without signing in...");const J=()=>{n(!0),M($n())},X=ea(u),S={events:e?Ca(X,Lr):[],eventCallback:(R,T,ee)=>{ee.onEventReceived(R)},onSubscribed:R=>{R.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(Sr,{onClose:()=>{J()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Qo.overlayWidth.valuePercentage(k),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:v.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(ai,{onClick:R=>R.stopPropagation(),children:c.jsx(ei,{...S,closeDrawerHandler:n,navigate:j,paymentDetails:h,creditAccountSpentAmount:a,onTransferClick:()=>{B&&m&&i&&_!=null&&Q.trackCardsPayEarlyFormClick(E,s,_,"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},V,f,g),M(xs({companyId:u.companyId}))},onDismissClick:J,onSaveChangesToLocalStore:R=>{M(mn(R))},currentTenant:u,hasZeniAccountsAdminAccess:U,isZeniAccountsUser:z,isZeniAccountSetupEnabled:Z,productInformation:s,sourcePage:b,controllerEmails:E,autoPayThreshold:O,paymentSourceInformation:V,creditAccountInformation:f,debitAccountInformation:g,cashbackInformation:_,isCashbackInfoFetchStateCompleted:B,isCreditCardInfoFetchStateCompleted:m,isDebitCardInfoFetchStateCompleted:i,paymentInitiatedDate:D,maxInsuredAmount:C.maxInsuredAmount})})})})},ai=Ne(ko)`
|
|
15
15
|
display: flex;
|
|
16
16
|
min-height: 100%;
|
|
17
17
|
flex-direction: column;
|
|
18
|
-
`,$t=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,Ue=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,qa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",ft=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"&&!!qa(n.transaction_status)&&!!qa(n.transaction_type)},zt=(e,n)=>{const t=e?.card_status;if(!qa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},Et=[wr,vr,Tr,Fr,xr,ma,Mt,it,Nt,Vt,Ht],Or=[La,Ba],ti=new Set([...Et,...Or]),gt=Xe.getLocalizedStrings().dateFormat,ni=De(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:b}=n,f=re.getSignedInUser(),g=e.tenantState.currentTenantId,_={userId:f?.userId??"",sessionId:f?.zeniSessionId??"",tenantId:g??""},i=_t(e,a,t,b),m=Zs(e,a),B=Ws(e);return{chargeCardDetailView:i,chargeCardsRecurringExpensesState:m,vgsVaultId:st.cardVaultId,transactionAttachmentsEndpointToFetch:`${kt}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${kt}/card_transaction_attachment`,authParams:_,isSnackbarOpen:B.isSnackbarOpen,cardsEndPoint:`${fr.cardMicroServiceBaseUrl}`,signedInUserToken:i.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:b,cardProviderId:f,includeCreditAccountInfo:g,setIsPaymentOpen:_,controllerEmails:i,productInformation:m,cashbackInformation:B,primaryFundingAccountDetails:D,creditAccountInformation:d,debitAccountInformation:j,isChargeCardFeatureEnabled:P}=n,{tenantEmailDomain:F}=a;return{onEventReceived:(C,h)=>{(({event:w,data:u,cardId:v,dispatch:k,subscribedEvents:M})=>{const A=$t(u);switch(w){case La:case Ba:return void k(_a(!0));case wr:{const I=ie(A?.card_id);if(I==null||I!==v)return;const L=ie(A?.transaction_id),l=A?.transaction_status;return L!=null&&qa(l)?void k($s({transactionId:L,transactionStatus:l})):void k(ra(v,null,null,!0))}case ma:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=zt(A,I);return L!=null?void k(wt(L)):void k(ga(v,!0))}case Mt:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=ie(A?.currency_code),l=ie(A?.currency_symbol),p=Ue(A?.balance);return L!=null&&l!=null&&p!=null?(k(Gs({cardId:I,currencyCode:L,currencySymbol:l,balance:p,hold:Ue(A?.hold),dailyPurchaseSpends:Ue(A?.daily_purchase_spends),monthlyPurchaseSpends:Ue(A?.monthly_purchase_spends),dailyWithdrawals:Ue(A?.daily_withdrawals),monthlyWithdrawals:Ue(A?.monthly_withdrawals)})),void k(Qe(!0))):(k(ga(v,!0)),void k(Qe(!0)))}case it:{const I=ie(A?.currency_code),L=ie(A?.currency_symbol),l=Ue(A?.available_amount),p=Ue(A?.balance_amount);return I!=null&&L!=null&&l!=null&&p!=null?void k(Hs({currencyCode:I,currencySymbol:L,available:l,balance:p,hold:Ue(A?.hold_amount),cashback:Ue(A?.cashback_amount)})):void k(Qe(!0))}case vr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=A?.transaction;return ft(L)?void k(Vs({cardId:I,transaction:L})):void k(ra(v,null,null,!0))}case Tr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=A?.transaction;return ft(L)?void k(Ns({cardId:I,declineReason:ie(A?.decline_reason),transaction:L})):void k(ra(v,null,null,!0))}case Fr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=A?.transaction;return ft(L)?void k(Ms({cardId:I,transaction:L})):void k(ra(v,null,null,!0))}case xr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=ie(A?.transaction_id),l=A?.attachment_file_paths;return L!=null&&Array.isArray(l)&&l.every(p=>typeof p=="string")?void k(js({cardId:I,transactionId:L,attachmentFilePaths:l})):void k(ra(v,null,null,!0))}case Nt:case Vt:case Ht:{const I=ie(A?.card_id);if(I==null||I!==v)return;k(ga(v,!0))}}})({event:C,data:h,cardId:t,dispatch:e,subscribedEvents:ti})},onPusherSubscribed:()=>{e(ga(t,!0)),e(ra(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,g,P))},onFetchChargeCardTransactionList:(C,h)=>{e(ra(t,C,h))},onUpdateScrollYOffset:C=>{},onGetOtp:C=>{f!=null&&e(tt(C,"ChargeCardHolder",t))},onResendOtp:C=>{f!=null&&e(at(C,"ChargeCardHolder",t))},onVerifyOtp:(C,h)=>{f!=null&&e(et(C,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:C=>{C!=null&&re.saveZeniOtpTokenForCardHolder(C,t)},onColorCodeChange:C=>{e(Xs(t,C))},onLockChargeCard:(C,h)=>{e(Xn(C,t,h))},onUnlockChargeCard:C=>{e(Jn(C,t))},onCloseChargeCard:C=>{e(Qn(t,C))},onFetchChargeCardsRecurringExpenses:()=>{e(qn([t]))},updateChargeCardName:(C,h)=>{e(Yn(C,t,h))},updateChargeCardTransactionAttachments:(C,h)=>{h!=null&&e(Js({transactionId:C,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(C,h,w,u)=>{e(Qs({chargeCardId:h,transactionId:C,fetchState:w,error:u}))},updateChargeCardTransactionReceiptsShowTick:(C,h,w)=>{e(qs({chargeCardId:h,transactionId:C,shouldShowTick:w}))},onChargeCardRevokeInviteClick:()=>{e(Kn(t))},updateChargeCardTransactionIsViewReceiptClicked:(C,h,w)=>{e(Ys({chargeCardId:h,transactionId:C,isViewReceiptClicked:w}))},onChargeCardTransactionRowClick:(C,h)=>{const w=ye(b.state?.pathnameStackToGoBack,b.pathname);s(`../../transaction/${C}/${h}`,{state:{pathnameStackToGoBack:w}})},onBackClick:()=>{const C=_e(b.state?.pathnameStackToGoBack),h=aa(F);s(h,{state:{pathnameStackToGoBack:C.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Ks())},onUpdateDebitCardPinAttempt:C=>{e(Wn(t,C)),C==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(C,h)=>{C?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(C,h,w,u){e(Zn(C,h,w.code,u))},shouldOpenCreditCardPaymentDrawer(C){C&&B!=null&&J.trackCardsPayEarlyClick(i,m,B,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:D?.accType==="depositAccount",creditCardPaymentSourceAccountName:D?.label,creditCardPaymentSourceAccountType:D?.accType,creditCardPaymentSourceLastFourDigits:D?.accountLast4,creditCardPaymentSourceBalance:D?.accountBalance?.available?.amount??0},d,j),_(C)}}})(ct(ro));function ri(){const e=de(),n=pe(),t=Ce(),{cardId:a}=Me(),[s,b]=r.useState(!1),[f,g]=r.useState(!1),{useDynamicConfig:_}=le(),i=re.getSignedInUser(),m=o(H=>fe(H)),B=o(H=>Qa(H).firstViewAfterActivation),D=o(H=>H.classListState.fetchState),{configValue:d}=_(Ze.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:j}=_(Ze.zeniCardsConfig),P=j.enable_card_controls_for_company_ids,F=j.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(P)&&P.includes(m.companyId),[C,h]=r.useState(!1),[w,u]=r.useState(!1),{useFeatureGate:v}=le(),{isFeatureEnabled:k}=v(K.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=v(K.isDebitCardFeatureEnabled),A=Te(M,m),I=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:A}),{isFeatureEnabled:L}=v(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:l}=v(K.isCardsCommentingEnabled),p=ve(m),N=we(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:k,isBookKeepingTenant:p,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:G}),U=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,Z=!m.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const y=o(H=>wa(H,m.companyId)),{creditAccount:x,creditAccountRepayment:W}=o(H=>da(H)),q=re.getZeniOtpTokenForCardHolder(a),E=o(H=>_t(H,a,Z,O)),{isAiCfoAccessEnabled:V,onAskAiCfoClick:Q}=xa({mobileExploreReferrer:"Card Detail"});Ft({isDataReady:E.fetchState==="Completed"});const X=o(H=>la(H)),S=E.chargeCard,R=Fe(),T=Pe(R?.loggedInUserRoleMap),ee=S?.type.code==="business_physical_debit_card"||S?.type.code==="business_virtual_debit_card",Y=S?.type.code==="business_physical_debit_card"||S?.type.code==="business_physical_credit_card",ke=S?.type.code==="business_virtual_debit_card"||S?.type.code==="business_virtual_credit_card",be=S?.type.code==="business_virtual_debit_card",ge=Ra(O,z,T,x,W),ae=yr(ee,E),ue=Ot(T,X),oe=Je(O,I,U,z),te=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",We=o(H=>oa(H,m.companyId)),Ee=ia(We.controllers),ne=o(H=>S?.cardCreatedByUser?.userId!=null?za(H.userRoleState,S?.cardCreatedByUser?.userId):void 0),Ke=o(H=>ne?.accountingClassIDs[0]!=null?Za(H.classState,{classId:ne?.accountingClassIDs[0],reportId:"class_list"}):void 0),Be=o(H=>S?.cardHolderUser?.userId!=null?za(H.userRoleState,S?.cardHolderUser?.userId):void 0),ce=o(H=>Be?.accountingClassIDs[0]!=null?Za(H.classState,{classId:Be?.accountingClassIDs[0],reportId:"class_list"}):void 0),Ea=m?.userRole,pa=o(H=>ua(H,!1,I,k).revokeCardInvite),ha=ya(pa.saveStatus.fetchState);if(r.useEffect(()=>{if(ha==="In-Progress"&&pa.saveStatus.fetchState==="Completed"){const H=aa(m.tenantEmailDomain);e(H)}},[ha,pa.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect(()=>{B&&s===!1&&ke&&(b(!0),setTimeout(()=>{n(Wa()),be&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[B,s,ke,be]),r.useEffect(()=>{C||E.fetchState==="Completed"||E.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,Z,O,!1)))},[C,E,a,n]),r.useEffect(()=>{!w&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&ee&&te&&T&&(u(!0),n(zn({depositAccountId:E.chargeCard?.connectedAccountId})))},[w,E,n,te,T]),r.useEffect(()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&T&&n(_a()),D!=="Completed"&&D!=="In-Progress"&&n(jn()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&n(zs({chargeCardId:a})),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&n(Pa(m.companyId,!0))},[X.fetchState,n,T,D,E.transactionStatistics.fetchState,y.fetchState]),r.useEffect(()=>{if(!(E.fetchState!=="Completed"||O&&x.fetchState!=="Completed"||S==null||E.transactionStatistics.fetchState!=="Completed"||ee&&T&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const H=S.type.code.includes("physical"),he=H?S.cardActivationAttemptHistory[0]?.timestamp:S.createTime;J.trackCardsCardDetailView(Ee,oe,{cardId:a,cardName:S.cardName,cardType:S.type.code.includes("credit")?"credit":"debit",cardCategory:H?"physical":"virtual",cardLimit:ba(S.limit.amount),cardLastFourDigits:S.accountLast4,cardStatus:S.status.code,cardAssignedDate:S.createTime?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:S.providerCardCreateTime?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:S.creditLimitFrequency.name,cardSpentAmount:ba(S.balance.amount),cardAvailableLimit:ba(S.available.amount),cardUtilizationPercent:S.limit.amount>0?Math.round((S.limit.amount-S.available.amount)/S.limit.amount*100):0,cardUtilizationAmount:ba(S.limit.amount-S.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:It(S.cardCreatedByUser,!1),cardIssuedByEmail:S.cardCreatedByUser?.email,cardIssuedByUserId:S.cardCreatedByUser?.userId,cardIssuedByRole:ne?.userRoles,cardIssuedByDepartment:Ke?.className},{cardholderName:It(S.cardHolderUser,!1),cardholderEmail:S.cardHolderUser?.email,cardholderRole:Be?.userRoles,cardholderUserId:S.cardHolderUser?.userId,cardholderDepartment:ce?.className},ge,ae)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,x.fetchState,T]),i==null)throw Error("Can't access card detail page without signing in...");const ta=ea(m),Aa=T?[...Et,...Or]:Et,lt={events:Ca(ta,Aa),eventCallback:(H,he,Le)=>{Le.onEventReceived(H,he)},onSubscribed:H=>{H.onPusherSubscribed()}},ut=()=>{if(a!=null&&S!=null){const{ownerName:H,cardName:he,utilisation:Le,limit:Ve,frequency:He,cardColor:Ge}=bt(S),$e=S.cardHolderUserId===i.userId;J.trackCardsDetailPageViewed(a,H,he,Le,Ve,He,Ge,$e)}};r.useEffect(()=>{if(E.fetchState==="Completed"){const H=E.chargeCard;if(H?.status.code==="inactive"||ee&&H?.isPinSet===!1||Y&&B){const he=Ae(m.tenantEmailDomain,a,i,S,B);e(he)}}},[E.fetchState]);const me=(H,he)=>{if(a!=null&&S!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=bt(S),na=S.cardHolderUserId===i.userId;J.trackCardsDetailPageClicked(a,Le,Ve,He,Ge,$e,H,na,he)}},Oa=(H,he)=>{if(a!=null&&S!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=bt(S),na=S.cardHolderUserId===i.userId;J.trackCardsVerifyPopUpClick(a,Le,Ve,He,Ge,$e,H,na,he)}},Da=x.balance.amount+x.hold.amount,mt=m.companyChargeCardInfo?.info?.primaryFundingAccount,Ua=y.allFundingAccounts.find(H=>H.id===mt?.accountId),ja=E.chargeCard!=null,Ma=E.depositAccountLimit!=null;return E.fetchState!=="Error"||ja?!ja&&(E.fetchState==="In-Progress"||E.fetchState==="Not-Started")||pa.saveStatus.fetchState==="In-Progress"||!Ma&&ee&&T&&E.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(no,{}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:B}),E.fetchState==="Completed"?c.jsx(Bt,{analytics:J,onLoad:ut}):null,f===!0?c.jsx(Gt,{closeDrawerHandler:()=>g(!1),isPaymentDrawerOpen:f,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ae,cashbackInformation:ue,creditAccountSpentAmount:Da,isDebitCardInfoFetchStateCompleted:!ee||!T||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||x.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!T||X.fetchState==="Completed",paymentInitiatedDate:W.initiatedRepaymentDate}):null,c.jsx(ni,{...lt,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:Oa,onFireOnClickAnalytics:me,isSandboxEnv:xt(),signedInUser:i,location:t,navigate:e,setIsPaymentOpen:g,cardIssuedByRoles:ne?.userRoles,cardIssuedByDepartmentName:Ke?.className,cardHolderRoles:Be?.userRoles,cardHolderDepartmentName:ce?.className,loggedInUserRole:Ea,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:I,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:z,isCardControlsEnabled:F,isEarlyPayEnabled:L,controllerEmails:Ee,chargeCardCashbackDetailState:X,productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ae,cashbackInformation:ue,classListFetchState:D,primaryFundingAccountDetails:Ua,currentTenant:m,cardProviderId:E.chargeCard?.cardProviderID,cardId:a,creditAccount:x,creditAccountRepayment:W,includeCreditAccountInfo:Z,signedInUserToken:q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:d.documentAiReceiptMaxSizeLimitBytes!=null?d.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:V,onAskAiCfoClick:Q,isCardsCommentingEnabled:l})]}):c.jsx(ot,{})}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,b=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:b,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:si,subheadline:ci,pageTitle:oi}}}}=Xe.getLocalizedStrings(),Ur=[ma,it,Br,Ba,La,dt,Ht,Ho,Nt,Vt,Mt],ii=new Set(Ur),At=Lt((e,n,t,a)=>{e(ca(n,t,a,!0))},400),di=Ne.div`
|
|
18
|
+
`,$t=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,Ue=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,qa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",ft=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"&&!!qa(n.transaction_status)&&!!qa(n.transaction_type)},zt=(e,n)=>{const t=e?.card_status;if(!qa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},Et=[wr,vr,Tr,Fr,xr,ma,Mt,it,Nt,Vt,Ht],Or=[La,Ba],ti=new Set([...Et,...Or]),gt=Xe.getLocalizedStrings().dateFormat,ni=De(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:b}=n,f=re.getSignedInUser(),g=e.tenantState.currentTenantId,_={userId:f?.userId??"",sessionId:f?.zeniSessionId??"",tenantId:g??""},i=_t(e,a,t,b),m=Zs(e,a),B=Ys(e);return{chargeCardDetailView:i,chargeCardsRecurringExpensesState:m,vgsVaultId:st.cardVaultId,transactionAttachmentsEndpointToFetch:`${kt}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${kt}/card_transaction_attachment`,authParams:_,isSnackbarOpen:B.isSnackbarOpen,cardsEndPoint:`${fr.cardMicroServiceBaseUrl}`,signedInUserToken:i.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:b,cardProviderId:f,includeCreditAccountInfo:g,setIsPaymentOpen:_,controllerEmails:i,productInformation:m,cashbackInformation:B,primaryFundingAccountDetails:D,creditAccountInformation:d,debitAccountInformation:j,isChargeCardFeatureEnabled:P}=n,{tenantEmailDomain:F}=a;return{onEventReceived:(C,h)=>{(({event:w,data:u,cardId:v,dispatch:k,subscribedEvents:M})=>{const A=$t(u);switch(w){case La:case Ba:return void k(_a(!0));case wr:{const I=ie(A?.card_id);if(I==null||I!==v)return;const L=ie(A?.transaction_id),l=A?.transaction_status;return L!=null&&qa(l)?void k($s({transactionId:L,transactionStatus:l})):void k(ra(v,null,null,!0))}case ma:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=zt(A,I);return L!=null?void k(wt(L)):void k(ga(v,!0))}case Mt:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=ie(A?.currency_code),l=ie(A?.currency_symbol),p=Ue(A?.balance);return L!=null&&l!=null&&p!=null?(k(Gs({cardId:I,currencyCode:L,currencySymbol:l,balance:p,hold:Ue(A?.hold),dailyPurchaseSpends:Ue(A?.daily_purchase_spends),monthlyPurchaseSpends:Ue(A?.monthly_purchase_spends),dailyWithdrawals:Ue(A?.daily_withdrawals),monthlyWithdrawals:Ue(A?.monthly_withdrawals)})),void k(Je(!0))):(k(ga(v,!0)),void k(Je(!0)))}case it:{const I=ie(A?.currency_code),L=ie(A?.currency_symbol),l=Ue(A?.available_amount),p=Ue(A?.balance_amount);return I!=null&&L!=null&&l!=null&&p!=null?void k(Hs({currencyCode:I,currencySymbol:L,available:l,balance:p,hold:Ue(A?.hold_amount),cashback:Ue(A?.cashback_amount)})):void k(Je(!0))}case vr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=A?.transaction;return ft(L)?void k(Vs({cardId:I,transaction:L})):void k(ra(v,null,null,!0))}case Tr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=A?.transaction;return ft(L)?void k(Ns({cardId:I,declineReason:ie(A?.decline_reason),transaction:L})):void k(ra(v,null,null,!0))}case Fr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=A?.transaction;return ft(L)?void k(Ms({cardId:I,transaction:L})):void k(ra(v,null,null,!0))}case xr:{const I=ie(A?.card_id)??v;if(I!==v)return;const L=ie(A?.transaction_id),l=A?.attachment_file_paths;return L!=null&&Array.isArray(l)&&l.every(p=>typeof p=="string")?void k(js({cardId:I,transactionId:L,attachmentFilePaths:l})):void k(ra(v,null,null,!0))}case Nt:case Vt:case Ht:{const I=ie(A?.card_id);if(I==null||I!==v)return;k(ga(v,!0))}}})({event:C,data:h,cardId:t,dispatch:e,subscribedEvents:ti})},onPusherSubscribed:()=>{e(ga(t,!0)),e(ra(t,null,null,!0)),e(Je(!0))},onReloadTransactions:()=>{e(ka(t,g,P))},onFetchChargeCardTransactionList:(C,h)=>{e(ra(t,C,h))},onUpdateScrollYOffset:C=>{},onGetOtp:C=>{f!=null&&e(tt(C,"ChargeCardHolder",t))},onResendOtp:C=>{f!=null&&e(at(C,"ChargeCardHolder",t))},onVerifyOtp:(C,h)=>{f!=null&&e(et(C,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:C=>{C!=null&&re.saveZeniOtpTokenForCardHolder(C,t)},onColorCodeChange:C=>{e(Xs(t,C))},onLockChargeCard:(C,h)=>{e(Xn(C,t,h))},onUnlockChargeCard:C=>{e(Qn(C,t))},onCloseChargeCard:C=>{e(Jn(t,C))},onFetchChargeCardsRecurringExpenses:()=>{e(qn([t]))},updateChargeCardName:(C,h)=>{e(Kn(C,t,h))},updateChargeCardTransactionAttachments:(C,h)=>{h!=null&&e(Qs({transactionId:C,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(C,h,w,u)=>{e(Js({chargeCardId:h,transactionId:C,fetchState:w,error:u}))},updateChargeCardTransactionReceiptsShowTick:(C,h,w)=>{e(qs({chargeCardId:h,transactionId:C,shouldShowTick:w}))},onChargeCardRevokeInviteClick:()=>{e(Wn(t))},updateChargeCardTransactionIsViewReceiptClicked:(C,h,w)=>{e(Ks({chargeCardId:h,transactionId:C,isViewReceiptClicked:w}))},onChargeCardTransactionRowClick:(C,h)=>{const w=ye(b.state?.pathnameStackToGoBack,b.pathname);s(`../../transaction/${C}/${h}`,{state:{pathnameStackToGoBack:w}})},onBackClick:()=>{const C=_e(b.state?.pathnameStackToGoBack),h=aa(F);s(h,{state:{pathnameStackToGoBack:C.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Ws())},onUpdateDebitCardPinAttempt:C=>{e(Yn(t,C)),C==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(C,h)=>{C?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(C,h,w,u){e(Zn(C,h,w.code,u))},shouldOpenCreditCardPaymentDrawer(C){C&&B!=null&&Q.trackCardsPayEarlyClick(i,m,B,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:D?.accType==="depositAccount",creditCardPaymentSourceAccountName:D?.label,creditCardPaymentSourceAccountType:D?.accType,creditCardPaymentSourceLastFourDigits:D?.accountLast4,creditCardPaymentSourceBalance:D?.accountBalance?.available?.amount??0},d,j),_(C)}}})(ct(ro));function ri(){const e=de(),n=pe(),t=Ce(),{cardId:a}=Me(),[s,b]=r.useState(!1),[f,g]=r.useState(!1),{useDynamicConfig:_}=le(),i=re.getSignedInUser(),m=o(H=>fe(H)),B=o(H=>Ja(H).firstViewAfterActivation),D=o(H=>H.classListState.fetchState),{configValue:d}=_(Ze.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:j}=_(Ze.zeniCardsConfig),P=j.enable_card_controls_for_company_ids,F=j.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(P)&&P.includes(m.companyId),[C,h]=r.useState(!1),[w,u]=r.useState(!1),{useFeatureGate:v}=le(),{isFeatureEnabled:k}=v(W.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=v(W.isDebitCardFeatureEnabled),A=Te(M,m),I=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:A}),{isFeatureEnabled:L}=v(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:l}=v(W.isCardsCommentingEnabled),p=ve(m),N=we(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:k,isBookKeepingTenant:p,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:G}),U=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,Z=!m.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const y=o(H=>wa(H,m.companyId)),{creditAccount:x,creditAccountRepayment:Y}=o(H=>da(H)),q=re.getZeniOtpTokenForCardHolder(a),E=o(H=>_t(H,a,Z,O)),{isAiCfoAccessEnabled:V,onAskAiCfoClick:J}=xa({mobileExploreReferrer:"Card Detail"});Ft({isDataReady:E.fetchState==="Completed"});const X=o(H=>la(H)),S=E.chargeCard,R=Fe(),T=Pe(R?.loggedInUserRoleMap),ee=S?.type.code==="business_physical_debit_card"||S?.type.code==="business_virtual_debit_card",K=S?.type.code==="business_physical_debit_card"||S?.type.code==="business_physical_credit_card",ke=S?.type.code==="business_virtual_debit_card"||S?.type.code==="business_virtual_credit_card",be=S?.type.code==="business_virtual_debit_card",ge=Ra(O,z,T,x,Y),ae=yr(ee,E),ue=Ot(T,X),oe=Qe(O,I,U,z),te=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",Ye=o(H=>oa(H,m.companyId)),Ee=ia(Ye.controllers),ne=o(H=>S?.cardCreatedByUser?.userId!=null?za(H.userRoleState,S?.cardCreatedByUser?.userId):void 0),We=o(H=>ne?.accountingClassIDs[0]!=null?Za(H.classState,{classId:ne?.accountingClassIDs[0],reportId:"class_list"}):void 0),Be=o(H=>S?.cardHolderUser?.userId!=null?za(H.userRoleState,S?.cardHolderUser?.userId):void 0),ce=o(H=>Be?.accountingClassIDs[0]!=null?Za(H.classState,{classId:Be?.accountingClassIDs[0],reportId:"class_list"}):void 0),Ea=m?.userRole,pa=o(H=>ua(H,!1,I,k).revokeCardInvite),ha=ya(pa.saveStatus.fetchState);if(r.useEffect(()=>{if(ha==="In-Progress"&&pa.saveStatus.fetchState==="Completed"){const H=aa(m.tenantEmailDomain);e(H)}},[ha,pa.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect(()=>{B&&s===!1&&ke&&(b(!0),setTimeout(()=>{n(Ya()),be&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[B,s,ke,be]),r.useEffect(()=>{C||E.fetchState==="Completed"||E.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,Z,O,!1)))},[C,E,a,n]),r.useEffect(()=>{!w&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&ee&&te&&T&&(u(!0),n(zn({depositAccountId:E.chargeCard?.connectedAccountId})))},[w,E,n,te,T]),r.useEffect(()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&T&&n(_a()),D!=="Completed"&&D!=="In-Progress"&&n(jn()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&n(zs({chargeCardId:a})),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&n(Pa(m.companyId,!0))},[X.fetchState,n,T,D,E.transactionStatistics.fetchState,y.fetchState]),r.useEffect(()=>{if(!(E.fetchState!=="Completed"||O&&x.fetchState!=="Completed"||S==null||E.transactionStatistics.fetchState!=="Completed"||ee&&T&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const H=S.type.code.includes("physical"),he=H?S.cardActivationAttemptHistory[0]?.timestamp:S.createTime;Q.trackCardsCardDetailView(Ee,oe,{cardId:a,cardName:S.cardName,cardType:S.type.code.includes("credit")?"credit":"debit",cardCategory:H?"physical":"virtual",cardLimit:ba(S.limit.amount),cardLastFourDigits:S.accountLast4,cardStatus:S.status.code,cardAssignedDate:S.createTime?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:S.providerCardCreateTime?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:S.creditLimitFrequency.name,cardSpentAmount:ba(S.balance.amount),cardAvailableLimit:ba(S.available.amount),cardUtilizationPercent:S.limit.amount>0?Math.round((S.limit.amount-S.available.amount)/S.limit.amount*100):0,cardUtilizationAmount:ba(S.limit.amount-S.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:It(S.cardCreatedByUser,!1),cardIssuedByEmail:S.cardCreatedByUser?.email,cardIssuedByUserId:S.cardCreatedByUser?.userId,cardIssuedByRole:ne?.userRoles,cardIssuedByDepartment:We?.className},{cardholderName:It(S.cardHolderUser,!1),cardholderEmail:S.cardHolderUser?.email,cardholderRole:Be?.userRoles,cardholderUserId:S.cardHolderUser?.userId,cardholderDepartment:ce?.className},ge,ae)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,x.fetchState,T]),i==null)throw Error("Can't access card detail page without signing in...");const ta=ea(m),Aa=T?[...Et,...Or]:Et,lt={events:Ca(ta,Aa),eventCallback:(H,he,Le)=>{Le.onEventReceived(H,he)},onSubscribed:H=>{H.onPusherSubscribed()}},ut=()=>{if(a!=null&&S!=null){const{ownerName:H,cardName:he,utilisation:Le,limit:Ve,frequency:He,cardColor:Ge}=bt(S),$e=S.cardHolderUserId===i.userId;Q.trackCardsDetailPageViewed(a,H,he,Le,Ve,He,Ge,$e)}};r.useEffect(()=>{if(E.fetchState==="Completed"){const H=E.chargeCard;if(H?.status.code==="inactive"||ee&&H?.isPinSet===!1||K&&B){const he=Ae(m.tenantEmailDomain,a,i,S,B);e(he)}}},[E.fetchState]);const me=(H,he)=>{if(a!=null&&S!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=bt(S),na=S.cardHolderUserId===i.userId;Q.trackCardsDetailPageClicked(a,Le,Ve,He,Ge,$e,H,na,he)}},Oa=(H,he)=>{if(a!=null&&S!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=bt(S),na=S.cardHolderUserId===i.userId;Q.trackCardsVerifyPopUpClick(a,Le,Ve,He,Ge,$e,H,na,he)}},Da=x.balance.amount+x.hold.amount,mt=m.companyChargeCardInfo?.info?.primaryFundingAccount,Ua=y.allFundingAccounts.find(H=>H.id===mt?.accountId),ja=E.chargeCard!=null,Ma=E.depositAccountLimit!=null;return E.fetchState!=="Error"||ja?!ja&&(E.fetchState==="In-Progress"||E.fetchState==="Not-Started")||pa.saveStatus.fetchState==="In-Progress"||!Ma&&ee&&T&&E.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(no,{}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:B}),E.fetchState==="Completed"?c.jsx(Bt,{analytics:Q,onLoad:ut}):null,f===!0?c.jsx(Gt,{closeDrawerHandler:()=>g(!1),isPaymentDrawerOpen:f,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ae,cashbackInformation:ue,creditAccountSpentAmount:Da,isDebitCardInfoFetchStateCompleted:!ee||!T||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||x.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!T||X.fetchState==="Completed",paymentInitiatedDate:Y.initiatedRepaymentDate}):null,c.jsx(ni,{...lt,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:Oa,onFireOnClickAnalytics:me,isSandboxEnv:xt(),signedInUser:i,location:t,navigate:e,setIsPaymentOpen:g,cardIssuedByRoles:ne?.userRoles,cardIssuedByDepartmentName:We?.className,cardHolderRoles:Be?.userRoles,cardHolderDepartmentName:ce?.className,loggedInUserRole:Ea,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:I,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:z,isCardControlsEnabled:F,isEarlyPayEnabled:L,controllerEmails:Ee,chargeCardCashbackDetailState:X,productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ae,cashbackInformation:ue,classListFetchState:D,primaryFundingAccountDetails:Ua,currentTenant:m,cardProviderId:E.chargeCard?.cardProviderID,cardId:a,creditAccount:x,creditAccountRepayment:Y,includeCreditAccountInfo:Z,signedInUserToken:q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:d.documentAiReceiptMaxSizeLimitBytes!=null?d.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:V,onAskAiCfoClick:J,isCardsCommentingEnabled:l})]}):c.jsx(ot,{})}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,b=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:b,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:si,subheadline:ci,pageTitle:oi}}}}=Xe.getLocalizedStrings(),Ur=[ma,it,Br,Ba,La,dt,Ht,Ho,Nt,Vt,Mt],ii=new Set(Ur),At=Lt((e,n,t,a)=>{e(ca(n,t,a,!0))},400),di=Ne.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
|
-
`,li=De(function(e,n){const t=ua(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:rc(e),bulkActionView:sc(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:b,chargeCardListState:f,includeCreditAccountDebitSummaryAndCashbackInfo:g,isChargeCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:i,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:D,isDebitCardTOSAccepted:d,isChargeCardTOSAccepted:j,controllerEmails:P,depositAccountListWithDebitCardIssued:F,primaryFundingAccountDetails:C,chargeCardSetUpViewFetchState:h,productInformation:w,cashbackInformation:u,creditAccountInformation:v,debitAccountInformation:k,updatePayNowInfoTooltip:M,isUserHasCardsAdminLevelAccess:A}=n,{tenantEmailDomain:I}=a,{cards:L}=f;return{onChargeCardRowClick:(l,p)=>{const N=kr(L,l);let G;N!=null&&((U=>{const z=U.limit.amount-U.available.amount,Z=`${U.cardHolderUser?.firstName.toLowerCase()} ${U.cardHolderUser?.lastName.toLowerCase()}`,y=U.cardName,x=U.department?.className??"",W=U.limit.amount,q=U.creditLimitFrequency.name;J.trackCardsListRowClicked(Z,y,x,z,W,q,b.userId===U.cardHolderUserId)})(N),sa(B,D,F)&&J.trackCardsCardListRowClick(P,w,"Card Row Item","row_clicked",p+1,{cardOwner:It(N.cardHolderUser,!1),cardName:N.cardName,cardType:N.type.code.includes("credit")?"credit":"debit",cardStatus:N.status.code,cardUtilizationAmount:ba(N.limit.amount-N.available.amount),cardUtilizationPercent:N.limit.amount>0?Math.round((N.limit.amount-N.available.amount)/N.limit.amount*100):0,cardLimit:ba(N.limit.amount)},u,v,k)),G=N?.status.code==="request_on_hold"&&b.userId===N.cardHolderUserId?Er(I):Ae(I,l,b,N);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(G,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:l=>{e(qn(l))},onFetchDepositAccountLimit:l=>{e(zn({depositAccountId:l}))},onChargeCardResendInviteClick:l=>{e(Cc(l))},onChargeCardRevokeInviteClick:l=>{e(Kn(l))},onLockChargeCardList:(l,p)=>{e(mc(l,p))},onUnlockChargeCardList:l=>{e(uc(l))},onCloseChargeCardList:(l,p)=>{e(lc(l,p))},onRevokeChargeCardList:l=>{e(dc(l))},updateChargeCardListSpendLimit(l,p,N){e(ic(l,p,N.code))},onLockChargeCard:(l,p)=>{e(Xn(A,l,p))},onUnlockChargeCard:l=>{e(Jn(A,l))},onCloseChargeCard:(l,p)=>{e(Qn(l,p))},onUpdateSpendLimit(l,p,N,G){e(Zn(l,p,N.code,G))},updateChargeCardName:(l,p)=>{e(Yn(A,l,p))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),sa(B,D,F)&&u!=null&&J.trackCardsSettingsClick(P,w,u,v,k);const l=Do(I),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(l,{state:{pathnameStackToGoBack:p}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),sa(B,D,F)&&u!=null&&J.trackCardsNewCardClick(P,w,u,"New Button","card_creation_initiated","Card List",v,k);const l=ui(I),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(l,{state:{pathnameStackToGoBack:p}})},onColumnSortConfigChanged:(l,p)=>{sa(B,D,F)&&u!=null&&J.trackCardsCardListSortClick(P,w,u,"Sort Icon","sort",l,p==="ascending"?"ASC":"DESC","Cards List",v,k),e(yt({uiState:{sortKey:l,sortOrder:p}}))},onSearchTextChanged:l=>{e(oc(l))},onReloadCards:()=>{e(ca(g,B&&D,_&&m,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{sa(B,D,F)&&u!=null&&J.trackCardsCashbackOverviewClick(P,w,u,"Cashback Overview","cashback_details_viewed",v,k),t("./cashback")},onClickStatementsIcon:()=>{sa(B,D,F)&&u!=null&&J.trackCardsStatementsClick(P,w,u,v,k),t("./statements")},onCreateNowClick:l=>{sa(B,D,F)&&u!=null&&J.trackCardsNewCardClick(P,w,u,"Promo Banner","card_creation_initiated","Card List",v,k),t(`./new?cardType=${l}`)},onPromoCardClick:l=>{t(l==="debit"&&B&&!d||l==="credit"&&i&&!j?`../promo?cardPromoType=${l}`:"./setup")},navigateToCreditCardPaymentPage:(l,p)=>{h==="Completed"&&a.company!=null&&u!=null&&J.trackCardsPayEarlyClick(P,w,u,"Card List",l,p,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:C?.accType==="depositAccount",creditCardPaymentSourceAccountName:C?.label,creditCardPaymentSourceAccountType:C?.accType,creditCardPaymentSourceLastFourDigits:C?.accountLast4,creditCardPaymentSourceBalance:C?.accountBalance?.available?.amount??0},v,k);const N=mi(I);t(N)},navigateToCreditCardPaymentHistoryPage:()=>{const l=Ci(I),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(l,{state:{pathnameStackToGoBack:p}})},shouldShowPayNowInfoTooltip:M,onSetRowActionCardId:l=>{e(cc(l))},onSetBulkActionCardIds:l=>{e(er(l))},onEventReceived:l=>{ii.has(l)&&At(e,g,B&&D,_&&m)},onPusherSubscribed:()=>{At(e,g,B&&D,_&&m)}}})(ct(co));function gn({isPaymentDrawerOpen:e}){const n=de(),t=pe(),a=Ce(),s=r.useCallback(($,Oe)=>{t(er([])),n($,Oe)},[t,n]),[b,f]=r.useState(!1),[g,_]=r.useState(re.getPayNowInfoTooltip()??!1),i=$=>{re.savePayNowInfoTooltip($),_($)},[m,B]=r.useState(!1),D=re.getSignedInUser(),d=o($=>fe($)),[j,P]=r.useState(!1),[F,C]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Cards"}),u=d.userRole.includes("charge_card_user"),v=!u,k=!!d.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:M,useDynamicConfig:A}=le(),{isFeatureEnabled:I}=M(K.isCashbackFeatureEnabled),{isFeatureEnabled:L}=M(K.isChargeCardFeatureEnabled),{isFeatureEnabled:l}=M(K.isDebitCardFeatureEnabled),{isFeatureEnabled:p}=M(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:N}=M(K.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=M(K.isCardsCommentingEnabled),{isFeatureEnabled:O}=M(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:U}=M(K.isCardPolicyEnabled),{isFeatureEnabled:z}=M(K.isAiCardCreationEnabled),Z=Te(l,d),y=xe({isDebitCardFeatureEnabled:l,isBankingOnlyTenant:Z}),x=we(d),W=ve(d),q=d.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Re({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:L,isBookKeepingTenant:W,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:q}),V=Ir({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:L,isBookKeepingTenant:W}),{configValue:Q}=A(Ze.zeniCardsConfig),X=Fe(),S=Pe(X?.loggedInUserRoleMap),R=o($=>oa($,d.companyId)),T=ia(R.controllers),ee=Q.charge_card_cashback_rate_per_transaction!=null?Q.charge_card_cashback_rate_per_transaction:.0175,Y=Q.credit_card_pay_now_threshold_by_company_id?.[d.companyId]??Q.default_credit_card_pay_now_threshold??Ao,ke=Q.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(Q.enable_card_controls_for_company_ids)&&Q.enable_card_controls_for_company_ids.includes(d.companyId),be=!!d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,ae=!!d.companyChargeCardInfo?.info?.isChargeCardEnabled,ue=o($=>Vn($)),oe=ya(ue.updateStatus),te=o($=>ua($,v,y&&k,E&&ae)),We=o($=>ec($)),Ee=o($=>ac($)),ne=o($=>tc($)),Ke=o($=>nc($)),Be=o($=>ne==null?[]:Un($.aiCfoState,ne).filter(Oe=>Oe.kind==="creating_cards"),Dt),ce=ya(Ee.fetchState);r.useEffect(()=>{ce==="In-Progress"&&Ee.fetchState==="Completed"&&ne!=null&&Be.forEach($=>{t(St({chatSessionId:ne,id:$.id,entityIds:Ke,kind:"created_cards"}))})},[t,Ee.fetchState,ne,Ke,Be,ce]);const Ea=te.cards.filter($=>$.type.code.includes("debit")).map($=>$.connectedAccountId),pa=[...new Set(Ea)],ha=o($=>la($)),ta=o($=>nt($,pa)),Aa=o($=>wa($,d.companyId)),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find($=>$.id===lt?.accountId),me=te.fetchState,Oa=te.creditAccount,Da=r.useCallback(()=>S===!0&&U===!0&&me==="Completed"&&re.getCardPolicyPopupSeen(d.tenantEmailDomain??"")!==!0,[S,U,me,d.tenantEmailDomain]),[mt,Ua]=r.useState(Da);r.useEffect(()=>{Ua(Da())},[Da]);const ja=()=>{re.saveCardPolicyPopupSeen(d.tenantEmailDomain??"",!0),Ua(!1)},Ma=me==="Completed"&&!te.hasCreditCard&&!te.hasDebitCard;so({isDataReady:me==="Completed",pageContext:Ma?"cards_creation":"cards"});const{creditAccountRepayment:H}=o($=>da($)),he=o($=>Qa($).firstViewAfterActivation),{areTenantIdsInSync:Le}=gr(),Ve=Ot(S,ha),He=Ra(E,ae,S,Oa,H),Ge=Ut(y,k,S,ta,te.debitCardSummary),$e=Je(E,y,k,ae),na=te.creditAccount.balance.amount+te.creditAccount.hold.amount;if(r.useEffect(()=>{me==="Completed"&&(re.getPayNowInfoTooltip()==null||na<Y*te.creditAccount.limit.amount/100)&&i(!0)},[me,Y,na,te.creditAccount.limit.amount]),r.useEffect(()=>{if(e!=null&&e===!0&&H.initiatedRepayments.amount===0&&H.fetchState==="Completed"||oe==="In-Progress"&&ue.updateStatus==="Completed")i(!1),f(!0);else if(H.initiatedRepayments.amount>0&&H.fetchState==="Completed"){f(!1),document.body.style.overflow="auto";const $=aa(d.tenantEmailDomain);s($)}},[e,H.initiatedRepayments.amount,H.fetchState,oe,ue.updateStatus,s,d.tenantEmailDomain]),r.useEffect(()=>{!j&&(ae||k)&&Le&&(P(!0),t(ca(v,y&&k,E&&ae,!1)))},[j,v,t,Le]),r.useEffect(()=>{he&&m===!1&&(B(!0),setTimeout(()=>{t(Wa())},5e3))},[he,m]),r.useEffect(()=>()=>{At.flush()},[]),r.useEffect(()=>{me==="Completed"&&u&&te.cards.length===1&&(te.cards[0].status.code==="inactive"&&te.cards[0].type.code==="business_physical_credit_card"?s(`./${te.cards[0].id}/activate`):te.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${te.cards[0].id}`)))},[me,u,a.state,s,te.cards]),r.useEffect(()=>{if(me==="Completed"&&u){const $=te.cards.length,Oe=te.cards.filter(Ye=>Ye.cardHolderUserId===D?.userId).filter(Ye=>Ye.status.code==="request_on_hold");Oe.length>0&&$===Oe.length&&s("./onboard")}},[me,te.cards,u,s,D?.userId]),r.useEffect(()=>{me!=="Completed"||E&&H.fetchState!=="Completed"||y&&k&&S&&ta.fetchState!=="Completed"||J.trackCardsCardListView(T,$e,Ve,He,Ge)},[me,Oa,H.fetchState,ta.fetchState,S]),D==null)throw Error("Can't access charge card list page without signing in...");const Vr=o($=>ar($.userState,$.userRoleState,$.userListViewState,"cardAdmin")),Zt=vt(X?.loggedInUserRoleMap),Wt=$=>{C($)},Hr=te.creditAccount.limit,Gr=()=>{f(!1),s("..")},$r=d.companyChargeCardInfo?.info!=null&&Ia({cardInfo:d.companyChargeCardInfo.info,isProductVisible:E,isTOSAccepted:be,isSetupEnabled:ae,isUserHasCardsAdminLevelAccess:S,isUserHasCardsAccess:Zt}),zr=d.companyDebitCardInfo?.info!=null&&Ia({cardInfo:d.companyDebitCardInfo.info,isProductVisible:y,isTOSAccepted:ge,isSetupEnabled:k,isUserHasCardsAdminLevelAccess:S,isUserHasCardsAccess:Zt}),Zr=$r||zr,Kt=function($){const{isEmptyCardsState:Oe,isChargeCardAdmin:Ye,isFileUploadEnabled:qt}=$,Qt=de(),Na=Ce(),{tenantEmailDomain:Va}=Me(),{isAiCfoOpen:qr,setIsAiCfoOpen:Jt}=mr(),Qr=Cr(),Jr=pr(),Xt=o(Se=>On(Se)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:en,isResolved:an}=Pr("cards_creation"),tn=r.useMemo(()=>_r(en,an,3),[en,an]),[Ha,Ct]=r.useState(""),nn=Jr&&Qr&&Va!=null&&!qr,fa=r.useCallback(Se=>{if(Va==null)return;const Xr=ye(Na.state?.pathnameStackToGoBack,Na.pathname);Qt(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Xr,referrer:"cards_hero",aiCfoInitialQuestion:Se,aiCfoShouldSubmit:Se!=null&&Se.trim().length>0}})},[Na.pathname,Na.state,Qt,Va]),rn=r.useCallback(Se=>{Se.trim().length!==0&&(Ct(""),fa(Se))},[fa]),sn=r.useCallback(()=>{const Se=Ha.trim();Se.length!==0&&(Ct(""),fa(Se))},[Ha,fa]),cn=r.useCallback(()=>{},[]),on=r.useCallback(Se=>{Ct(Se)},[]),dn=r.useCallback(()=>{Jt(!0)},[Jt]),ln=r.useCallback(()=>{fa(void 0)},[fa]);return r.useMemo(()=>{if(nn&&Oe&&Ye)return{aiAgentName:oi,headline:si,subheadline:ci,promptChips:tn,composer:{currentInput:Ha,isSubmitting:Xt,isFileUploadEnabled:qt,onInputChange:on,onSubmit:sn,onStopSubmit:cn},onPromptClick:rn,onOpenSidePanel:dn,onOpenFullView:ln,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,nn,Ye,Oe,qt,Xt,on,ln,dn,rn,cn,sn,tn])}({isEmptyCardsState:Ma,isChargeCardAdmin:S,isFileUploadEnabled:O}),Yt=z&&Kt!=null?c.jsx(hr,{...Kt}):null,Wr=h&&Yt==null,Kr=ea(d),Yr={events:Ca(Kr,Ur),eventCallback:($,Oe,Ye)=>{Ye.onEventReceived($)},onSubscribed:$=>{$.onPusherSubscribed()}};return ae||k?c.jsxs(c.Fragment,{children:[me==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Bt,{analytics:J,onLoad:()=>{J.trackPageLoaded(br.Event.cardsListPage),(E&&!ae||y&&!k)&&J.trackCardsPromoView(T,{isCreditCardOffered:E,isDebitCardOffered:y,isDebitCardEnabled:k,isCreditCardEnabled:ae},"Banner",y&&!k?"Debit Card":E&&!ae?"Credit Card":"","Card List")}}),c.jsx(rt,{showConfetti:he})]}):null,b===!0?c.jsx(Gt,{closeDrawerHandler:Gr,isPaymentDrawerOpen:b,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:na,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isDebitCardInfoFetchStateCompleted:!(y&&k&&S)||ta.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||H.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!S||ha.fetchState==="Completed",paymentInitiatedDate:H.initiatedRepaymentDate}):null,c.jsxs(di,{children:[c.jsx(Ie,{isAppContentDrawerOpen:F,handleDrawerToggle:Wt}),c.jsx(li,{...Yr,isCashbackFeatureEnabled:I,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:V,updatePayNowInfoTooltip:i,showPayNowInfoTooltip:g,creditCardPayNowThreshold:Y,signedInUser:D,chargeCardListState:te,location:a,admins:Vr.users,navigateAndClearBulkSelection:s,currentTenant:d,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:d.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:d.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:S,includeCreditAccountDebitSummaryAndCashbackInfo:v,onClickMenuIcon:()=>{Wt(!0)},creditLimit:Hr,isChargeCardSetupEnabled:ae,isDebitCardSetupEnabled:k,isEarlyPayEnabled:p,isChargeCardPaymentHistoryFeatureEnabled:N,cashbackRate:ee,controllerEmails:T,chargeCardCashbackDetailState:ha,depositAccountListWithDebitCardIssued:ta,isChargeCardTOSAccepted:be,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isAiCfoAccessEnabled:Wr,onAskAiCfoClick:w,isCardsCommentingEnabled:G,cardsAiCfoHero:Yt,onClickPolicyIcon:S&&U?()=>n(pi(d.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:mt,onPolicyIntroTooltipClose:ja,pendingCreationCount:We})]})]}):(be||ge)&&S===!0?c.jsx(Sa,{to:"../setup"}):Zr?c.jsx(Sa,{to:"../promo"}):c.jsx(va,{fetchState:me})}const ui=e=>`/${e}/cards/new`,mi=e=>`/${e}/cards/payment`,Ci=e=>`/${e}/cards/payment-history`,pi=e=>`/${e}/cards/policy`,jr=[Rr,Br],hi=new Set(jr),fi=De(function(e){const n=re.getSignedInUser(),t=fe(e),a=e.tenantState.currentTenantId,s=tr(e),b={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},f=t?.companyName??"",g=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:pc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:b,companyName:f,spendManagementEndPoint:`${kt}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:g}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=_e(t.state?.pathnameStackToGoBack),b=s.poppedPathname??"..";a(b,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,b)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:b}}})},onFiltersChange:s=>{e(fc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{hi.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(hc({uiState:{downloadState:s}}))}}})(ct(oo));function gi(){const e=de(),n=Ce(),t=pe(),{areTenantIdsInSync:a}=gr(),{useFeatureGate:s}=le();if(re.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const b=o(S=>fe(S)),f=o(S=>tr(S)),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(null),P=!b.userRole.includes("charge_card_user"),F=!!b.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:C}=s(K.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(K.isDebitCardFeatureEnabled),w=Te(h,b),u=xe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:w}),v=we(b),k=ve(b),M=b.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Re({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:C,isBookKeepingTenant:k,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:M}),I=!!b.companyChargeCardInfo?.info?.isChargeCardEnabled,L=Fe(),l=Pe(L?.loggedInUserRoleMap),p=o(S=>ua(S,P,u&&F,A&&I)),N=r.useMemo(()=>{const S=p.cards.filter(R=>R.type.code.includes("debit"));return[...new Set(S.map(R=>R.connectedAccountId))]},[p.cards]),G=o(S=>la(S)),O=o(S=>nt(S,N)),{creditAccountRepayment:U}=o(S=>da(S)),z=r.useMemo(()=>Ot(l,G),[l,G]),Z=r.useMemo(()=>Ra(A,I,l,p.creditAccount,U),[A,I,l,p.creditAccount,U]),y=r.useMemo(()=>Ut(u,F,l,O,p.debitCardSummary),[u,F,l,O,p.debitCardSummary]),x=r.useMemo(()=>Je(A,u,F,I),[A,u,F,I]),W=p.creditAccount.balance.amount+p.creditAccount.hold.amount,q=r.useMemo(()=>d!=null?f.repaymentHistory.find(S=>S.cardRepaymentId===d):void 0,[d,f.repaymentHistory]),E=r.useCallback(S=>{j(S),t(ca(P,u&&F,A&&I,!1)),D(!0)},[t,P,u,F,A,I]),V=r.useCallback(()=>{D(!1),j(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{g||f.fetchState==="Completed"||f.fetchState==="In-Progress"||(_(!0),t(Ga()))},[g,t,f.fetchState]),r.useEffect(()=>{!i&&(I||F)&&a&&(m(!0),t(ca(P,!1,A&&I,!1)))},[i,I,F,a,t,P,A]);const Q=ea(b),X={events:Ca(Q,jr),eventCallback:(S,R,T)=>{T.onEventReceived(S)},onSubscribed:S=>{S.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[B?c.jsx(Gt,{closeDrawerHandler:V,isPaymentDrawerOpen:B,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:W,productInformation:x,creditAccountInformation:Z,debitAccountInformation:y,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(u&&F&&l)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||U.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!l||G.fetchState==="Completed",paymentInitiatedDate:U.initiatedRepaymentDate,retryRepayment:q}):null,c.jsx(fi,{...X,location:n,navigate:e,accountInfoByAccountId:f.accountInfoByAccountId,onRetryPaymentClick:E})]})}const bn=Ne.div`
|
|
25
|
+
`,li=De(function(e,n){const t=ua(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:rc(e),bulkActionView:sc(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:b,chargeCardListState:f,includeCreditAccountDebitSummaryAndCashbackInfo:g,isChargeCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:i,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:D,isDebitCardTOSAccepted:d,isChargeCardTOSAccepted:j,controllerEmails:P,depositAccountListWithDebitCardIssued:F,primaryFundingAccountDetails:C,chargeCardSetUpViewFetchState:h,productInformation:w,cashbackInformation:u,creditAccountInformation:v,debitAccountInformation:k,updatePayNowInfoTooltip:M,isUserHasCardsAdminLevelAccess:A}=n,{tenantEmailDomain:I}=a,{cards:L}=f;return{onChargeCardRowClick:(l,p)=>{const N=kr(L,l);let G;N!=null&&((U=>{const z=U.limit.amount-U.available.amount,Z=`${U.cardHolderUser?.firstName.toLowerCase()} ${U.cardHolderUser?.lastName.toLowerCase()}`,y=U.cardName,x=U.department?.className??"",Y=U.limit.amount,q=U.creditLimitFrequency.name;Q.trackCardsListRowClicked(Z,y,x,z,Y,q,b.userId===U.cardHolderUserId)})(N),sa(B,D,F)&&Q.trackCardsCardListRowClick(P,w,"Card Row Item","row_clicked",p+1,{cardOwner:It(N.cardHolderUser,!1),cardName:N.cardName,cardType:N.type.code.includes("credit")?"credit":"debit",cardStatus:N.status.code,cardUtilizationAmount:ba(N.limit.amount-N.available.amount),cardUtilizationPercent:N.limit.amount>0?Math.round((N.limit.amount-N.available.amount)/N.limit.amount*100):0,cardLimit:ba(N.limit.amount)},u,v,k)),G=N?.status.code==="request_on_hold"&&b.userId===N.cardHolderUserId?Er(I):Ae(I,l,b,N);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(G,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:l=>{e(qn(l))},onFetchDepositAccountLimit:l=>{e(zn({depositAccountId:l}))},onChargeCardResendInviteClick:l=>{e(Cc(l))},onChargeCardRevokeInviteClick:l=>{e(Wn(l))},onLockChargeCardList:(l,p)=>{e(mc(l,p))},onUnlockChargeCardList:l=>{e(uc(l))},onCloseChargeCardList:(l,p)=>{e(lc(l,p))},onRevokeChargeCardList:l=>{e(dc(l))},updateChargeCardListSpendLimit(l,p,N){e(ic(l,p,N.code))},onLockChargeCard:(l,p)=>{e(Xn(A,l,p))},onUnlockChargeCard:l=>{e(Qn(A,l))},onCloseChargeCard:(l,p)=>{e(Jn(l,p))},onUpdateSpendLimit(l,p,N,G){e(Zn(l,p,N.code,G))},updateChargeCardName:(l,p)=>{e(Kn(A,l,p))},onClickSetupIcon:()=>{Q.trackCardsListPageClicked("settings"),sa(B,D,F)&&u!=null&&Q.trackCardsSettingsClick(P,w,u,v,k);const l=Do(I),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(l,{state:{pathnameStackToGoBack:p}})},onIssueCardClick:()=>{Q.trackCardsListPageClicked("new card"),sa(B,D,F)&&u!=null&&Q.trackCardsNewCardClick(P,w,u,"New Button","card_creation_initiated","Card List",v,k);const l=ui(I),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(l,{state:{pathnameStackToGoBack:p}})},onColumnSortConfigChanged:(l,p)=>{sa(B,D,F)&&u!=null&&Q.trackCardsCardListSortClick(P,w,u,"Sort Icon","sort",l,p==="ascending"?"ASC":"DESC","Cards List",v,k),e(yt({uiState:{sortKey:l,sortOrder:p}}))},onSearchTextChanged:l=>{e(oc(l))},onReloadCards:()=>{e(ca(g,B&&D,_&&m,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{sa(B,D,F)&&u!=null&&Q.trackCardsCashbackOverviewClick(P,w,u,"Cashback Overview","cashback_details_viewed",v,k),t("./cashback")},onClickStatementsIcon:()=>{sa(B,D,F)&&u!=null&&Q.trackCardsStatementsClick(P,w,u,v,k),t("./statements")},onCreateNowClick:l=>{sa(B,D,F)&&u!=null&&Q.trackCardsNewCardClick(P,w,u,"Promo Banner","card_creation_initiated","Card List",v,k),t(`./new?cardType=${l}`)},onPromoCardClick:l=>{t(l==="debit"&&B&&!d||l==="credit"&&i&&!j?`../promo?cardPromoType=${l}`:"./setup")},navigateToCreditCardPaymentPage:(l,p)=>{h==="Completed"&&a.company!=null&&u!=null&&Q.trackCardsPayEarlyClick(P,w,u,"Card List",l,p,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:C?.accType==="depositAccount",creditCardPaymentSourceAccountName:C?.label,creditCardPaymentSourceAccountType:C?.accType,creditCardPaymentSourceLastFourDigits:C?.accountLast4,creditCardPaymentSourceBalance:C?.accountBalance?.available?.amount??0},v,k);const N=mi(I);t(N)},navigateToCreditCardPaymentHistoryPage:()=>{const l=Ci(I),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(l,{state:{pathnameStackToGoBack:p}})},shouldShowPayNowInfoTooltip:M,onSetRowActionCardId:l=>{e(cc(l))},onSetBulkActionCardIds:l=>{e(er(l))},onEventReceived:l=>{ii.has(l)&&At(e,g,B&&D,_&&m)},onPusherSubscribed:()=>{At(e,g,B&&D,_&&m)}}})(ct(co));function gn({isPaymentDrawerOpen:e}){const n=de(),t=pe(),a=Ce(),s=r.useCallback(($,Oe)=>{t(er([])),n($,Oe)},[t,n]),[b,f]=r.useState(!1),[g,_]=r.useState(re.getPayNowInfoTooltip()??!1),i=$=>{re.savePayNowInfoTooltip($),_($)},[m,B]=r.useState(!1),D=re.getSignedInUser(),d=o($=>fe($)),[j,P]=r.useState(!1),[F,C]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Cards"}),u=d.userRole.includes("charge_card_user"),v=!u,k=!!d.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:M,useDynamicConfig:A}=le(),{isFeatureEnabled:I}=M(W.isCashbackFeatureEnabled),{isFeatureEnabled:L}=M(W.isChargeCardFeatureEnabled),{isFeatureEnabled:l}=M(W.isDebitCardFeatureEnabled),{isFeatureEnabled:p}=M(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:N}=M(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=M(W.isCardsCommentingEnabled),{isFeatureEnabled:O}=M(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:U}=M(W.isCardPolicyEnabled),{isFeatureEnabled:z}=M(W.isAiCardCreationEnabled),Z=Te(l,d),y=xe({isDebitCardFeatureEnabled:l,isBankingOnlyTenant:Z}),x=we(d),Y=ve(d),q=d.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Re({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:L,isBookKeepingTenant:Y,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:q}),V=Ir({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:L,isBookKeepingTenant:Y}),{configValue:J}=A(Ze.zeniCardsConfig),X=Fe(),S=Pe(X?.loggedInUserRoleMap),R=o($=>oa($,d.companyId)),T=ia(R.controllers),ee=J.charge_card_cashback_rate_per_transaction!=null?J.charge_card_cashback_rate_per_transaction:.0175,K=J.credit_card_pay_now_threshold_by_company_id?.[d.companyId]??J.default_credit_card_pay_now_threshold??Ao,ke=J.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(J.enable_card_controls_for_company_ids)&&J.enable_card_controls_for_company_ids.includes(d.companyId),be=!!d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,ae=!!d.companyChargeCardInfo?.info?.isChargeCardEnabled,ue=o($=>Vn($)),oe=ya(ue.updateStatus),te=o($=>ua($,v,y&&k,E&&ae)),Ye=o($=>ec($)),Ee=o($=>ac($)),ne=o($=>tc($)),We=o($=>nc($)),Be=o($=>ne==null?[]:Un($.aiCfoState,ne).filter(Oe=>Oe.kind==="creating_cards"),Dt),ce=ya(Ee.fetchState);r.useEffect(()=>{ce==="In-Progress"&&Ee.fetchState==="Completed"&&ne!=null&&Be.forEach($=>{t(St({chatSessionId:ne,id:$.id,entityIds:We,kind:"created_cards"}))})},[t,Ee.fetchState,ne,We,Be,ce]);const Ea=te.cards.filter($=>$.type.code.includes("debit")).map($=>$.connectedAccountId),pa=[...new Set(Ea)],ha=o($=>la($)),ta=o($=>nt($,pa)),Aa=o($=>wa($,d.companyId)),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find($=>$.id===lt?.accountId),me=te.fetchState,Oa=te.creditAccount,Da=r.useCallback(()=>S===!0&&U===!0&&me==="Completed"&&re.getCardPolicyPopupSeen(d.tenantEmailDomain??"")!==!0,[S,U,me,d.tenantEmailDomain]),[mt,Ua]=r.useState(Da);r.useEffect(()=>{Ua(Da())},[Da]);const ja=()=>{re.saveCardPolicyPopupSeen(d.tenantEmailDomain??"",!0),Ua(!1)},Ma=me==="Completed"&&!te.hasCreditCard&&!te.hasDebitCard;so({isDataReady:me==="Completed",pageContext:Ma?"cards_creation":"cards"});const{creditAccountRepayment:H}=o($=>da($)),he=o($=>Ja($).firstViewAfterActivation),{areTenantIdsInSync:Le}=gr(),Ve=Ot(S,ha),He=Ra(E,ae,S,Oa,H),Ge=Ut(y,k,S,ta,te.debitCardSummary),$e=Qe(E,y,k,ae),na=te.creditAccount.balance.amount+te.creditAccount.hold.amount;if(r.useEffect(()=>{me==="Completed"&&(re.getPayNowInfoTooltip()==null||na<K*te.creditAccount.limit.amount/100)&&i(!0)},[me,K,na,te.creditAccount.limit.amount]),r.useEffect(()=>{if(e!=null&&e===!0&&H.initiatedRepayments.amount===0&&H.fetchState==="Completed"||oe==="In-Progress"&&ue.updateStatus==="Completed")i(!1),f(!0);else if(H.initiatedRepayments.amount>0&&H.fetchState==="Completed"){f(!1),document.body.style.overflow="auto";const $=aa(d.tenantEmailDomain);s($)}},[e,H.initiatedRepayments.amount,H.fetchState,oe,ue.updateStatus,s,d.tenantEmailDomain]),r.useEffect(()=>{!j&&(ae||k)&&Le&&(P(!0),t(ca(v,y&&k,E&&ae,!1)))},[j,v,t,Le]),r.useEffect(()=>{he&&m===!1&&(B(!0),setTimeout(()=>{t(Ya())},5e3))},[he,m]),r.useEffect(()=>()=>{At.flush()},[]),r.useEffect(()=>{me==="Completed"&&u&&te.cards.length===1&&(te.cards[0].status.code==="inactive"&&te.cards[0].type.code==="business_physical_credit_card"?s(`./${te.cards[0].id}/activate`):te.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${te.cards[0].id}`)))},[me,u,a.state,s,te.cards]),r.useEffect(()=>{if(me==="Completed"&&u){const $=te.cards.length,Oe=te.cards.filter(Ke=>Ke.cardHolderUserId===D?.userId).filter(Ke=>Ke.status.code==="request_on_hold");Oe.length>0&&$===Oe.length&&s("./onboard")}},[me,te.cards,u,s,D?.userId]),r.useEffect(()=>{me!=="Completed"||E&&H.fetchState!=="Completed"||y&&k&&S&&ta.fetchState!=="Completed"||Q.trackCardsCardListView(T,$e,Ve,He,Ge)},[me,Oa,H.fetchState,ta.fetchState,S]),D==null)throw Error("Can't access charge card list page without signing in...");const Vr=o($=>ar($.userState,$.userRoleState,$.userListViewState,"cardAdmin")),Zt=vt(X?.loggedInUserRoleMap),Yt=$=>{C($)},Hr=te.creditAccount.limit,Gr=()=>{f(!1),s("..")},$r=d.companyChargeCardInfo?.info!=null&&Ia({cardInfo:d.companyChargeCardInfo.info,isProductVisible:E,isTOSAccepted:be,isSetupEnabled:ae,isUserHasCardsAdminLevelAccess:S,isUserHasCardsAccess:Zt}),zr=d.companyDebitCardInfo?.info!=null&&Ia({cardInfo:d.companyDebitCardInfo.info,isProductVisible:y,isTOSAccepted:ge,isSetupEnabled:k,isUserHasCardsAdminLevelAccess:S,isUserHasCardsAccess:Zt}),Zr=$r||zr,Wt=function($){const{isEmptyCardsState:Oe,isChargeCardAdmin:Ke,isFileUploadEnabled:qt}=$,Jt=de(),Na=Ce(),{tenantEmailDomain:Va}=Me(),{isAiCfoOpen:qr,setIsAiCfoOpen:Qt}=mr(),Jr=Cr(),Qr=pr(),Xt=o(Se=>On(Se)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:en,isResolved:an}=Pr("cards_creation"),tn=r.useMemo(()=>_r(en,an,3),[en,an]),[Ha,Ct]=r.useState(""),nn=Qr&&Jr&&Va!=null&&!qr,fa=r.useCallback(Se=>{if(Va==null)return;const Xr=ye(Na.state?.pathnameStackToGoBack,Na.pathname);Jt(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Xr,referrer:"cards_hero",aiCfoInitialQuestion:Se,aiCfoShouldSubmit:Se!=null&&Se.trim().length>0}})},[Na.pathname,Na.state,Jt,Va]),rn=r.useCallback(Se=>{Se.trim().length!==0&&(Ct(""),fa(Se))},[fa]),sn=r.useCallback(()=>{const Se=Ha.trim();Se.length!==0&&(Ct(""),fa(Se))},[Ha,fa]),cn=r.useCallback(()=>{},[]),on=r.useCallback(Se=>{Ct(Se)},[]),dn=r.useCallback(()=>{Qt(!0)},[Qt]),ln=r.useCallback(()=>{fa(void 0)},[fa]);return r.useMemo(()=>{if(nn&&Oe&&Ke)return{aiAgentName:oi,headline:si,subheadline:ci,promptChips:tn,composer:{currentInput:Ha,isSubmitting:Xt,isFileUploadEnabled:qt,onInputChange:on,onSubmit:sn,onStopSubmit:cn},onPromptClick:rn,onOpenSidePanel:dn,onOpenFullView:ln,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,nn,Ke,Oe,qt,Xt,on,ln,dn,rn,cn,sn,tn])}({isEmptyCardsState:Ma,isChargeCardAdmin:S,isFileUploadEnabled:O}),Kt=z&&Wt!=null?c.jsx(hr,{...Wt}):null,Yr=h&&Kt==null,Wr=ea(d),Kr={events:Ca(Wr,Ur),eventCallback:($,Oe,Ke)=>{Ke.onEventReceived($)},onSubscribed:$=>{$.onPusherSubscribed()}};return ae||k?c.jsxs(c.Fragment,{children:[me==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Bt,{analytics:Q,onLoad:()=>{Q.trackPageLoaded(br.Event.cardsListPage),(E&&!ae||y&&!k)&&Q.trackCardsPromoView(T,{isCreditCardOffered:E,isDebitCardOffered:y,isDebitCardEnabled:k,isCreditCardEnabled:ae},"Banner",y&&!k?"Debit Card":E&&!ae?"Credit Card":"","Card List")}}),c.jsx(rt,{showConfetti:he})]}):null,b===!0?c.jsx(Gt,{closeDrawerHandler:Gr,isPaymentDrawerOpen:b,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:na,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isDebitCardInfoFetchStateCompleted:!(y&&k&&S)||ta.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||H.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!S||ha.fetchState==="Completed",paymentInitiatedDate:H.initiatedRepaymentDate}):null,c.jsxs(di,{children:[c.jsx(Ie,{isAppContentDrawerOpen:F,handleDrawerToggle:Yt}),c.jsx(li,{...Kr,isCashbackFeatureEnabled:I,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:V,updatePayNowInfoTooltip:i,showPayNowInfoTooltip:g,creditCardPayNowThreshold:K,signedInUser:D,chargeCardListState:te,location:a,admins:Vr.users,navigateAndClearBulkSelection:s,currentTenant:d,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:d.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:d.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:S,includeCreditAccountDebitSummaryAndCashbackInfo:v,onClickMenuIcon:()=>{Yt(!0)},creditLimit:Hr,isChargeCardSetupEnabled:ae,isDebitCardSetupEnabled:k,isEarlyPayEnabled:p,isChargeCardPaymentHistoryFeatureEnabled:N,cashbackRate:ee,controllerEmails:T,chargeCardCashbackDetailState:ha,depositAccountListWithDebitCardIssued:ta,isChargeCardTOSAccepted:be,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isAiCfoAccessEnabled:Yr,onAskAiCfoClick:w,isCardsCommentingEnabled:G,cardsAiCfoHero:Kt,onClickPolicyIcon:S&&U?()=>n(pi(d.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:mt,onPolicyIntroTooltipClose:ja,pendingCreationCount:Ye})]})]}):(be||ge)&&S===!0?c.jsx(Sa,{to:"../setup"}):Zr?c.jsx(Sa,{to:"../promo"}):c.jsx(va,{fetchState:me})}const ui=e=>`/${e}/cards/new`,mi=e=>`/${e}/cards/payment`,Ci=e=>`/${e}/cards/payment-history`,pi=e=>`/${e}/cards/policy`,jr=[Rr,Br],hi=new Set(jr),fi=De(function(e){const n=re.getSignedInUser(),t=fe(e),a=e.tenantState.currentTenantId,s=tr(e),b={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},f=t?.companyName??"",g=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:pc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:b,companyName:f,spendManagementEndPoint:`${kt}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:g}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=_e(t.state?.pathnameStackToGoBack),b=s.poppedPathname??"..";a(b,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,b)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:b}}})},onFiltersChange:s=>{e(fc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{hi.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(hc({uiState:{downloadState:s}}))}}})(ct(oo));function gi(){const e=de(),n=Ce(),t=pe(),{areTenantIdsInSync:a}=gr(),{useFeatureGate:s}=le();if(re.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const b=o(S=>fe(S)),f=o(S=>tr(S)),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(null),P=!b.userRole.includes("charge_card_user"),F=!!b.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:C}=s(W.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(W.isDebitCardFeatureEnabled),w=Te(h,b),u=xe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:w}),v=we(b),k=ve(b),M=b.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Re({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:C,isBookKeepingTenant:k,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:M}),I=!!b.companyChargeCardInfo?.info?.isChargeCardEnabled,L=Fe(),l=Pe(L?.loggedInUserRoleMap),p=o(S=>ua(S,P,u&&F,A&&I)),N=r.useMemo(()=>{const S=p.cards.filter(R=>R.type.code.includes("debit"));return[...new Set(S.map(R=>R.connectedAccountId))]},[p.cards]),G=o(S=>la(S)),O=o(S=>nt(S,N)),{creditAccountRepayment:U}=o(S=>da(S)),z=r.useMemo(()=>Ot(l,G),[l,G]),Z=r.useMemo(()=>Ra(A,I,l,p.creditAccount,U),[A,I,l,p.creditAccount,U]),y=r.useMemo(()=>Ut(u,F,l,O,p.debitCardSummary),[u,F,l,O,p.debitCardSummary]),x=r.useMemo(()=>Qe(A,u,F,I),[A,u,F,I]),Y=p.creditAccount.balance.amount+p.creditAccount.hold.amount,q=r.useMemo(()=>d!=null?f.repaymentHistory.find(S=>S.cardRepaymentId===d):void 0,[d,f.repaymentHistory]),E=r.useCallback(S=>{j(S),t(ca(P,u&&F,A&&I,!1)),D(!0)},[t,P,u,F,A,I]),V=r.useCallback(()=>{D(!1),j(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{g||f.fetchState==="Completed"||f.fetchState==="In-Progress"||(_(!0),t(Ga()))},[g,t,f.fetchState]),r.useEffect(()=>{!i&&(I||F)&&a&&(m(!0),t(ca(P,!1,A&&I,!1)))},[i,I,F,a,t,P,A]);const J=ea(b),X={events:Ca(J,jr),eventCallback:(S,R,T)=>{T.onEventReceived(S)},onSubscribed:S=>{S.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[B?c.jsx(Gt,{closeDrawerHandler:V,isPaymentDrawerOpen:B,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:Y,productInformation:x,creditAccountInformation:Z,debitAccountInformation:y,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(u&&F&&l)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||U.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!l||G.fetchState==="Completed",paymentInitiatedDate:U.initiatedRepaymentDate,retryRepayment:q}):null,c.jsx(fi,{...X,location:n,navigate:e,accountInfoByAccountId:f.accountInfoByAccountId,onRetryPaymentClick:E})]})}const bn=Ne.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
height: 100vh;
|
|
28
28
|
width: 100%;
|
|
@@ -31,7 +31,7 @@ import{j as c}from"./liveblocks-BLlSTcoD.js";import{h as de,g as Ce,i as Me,u as
|
|
|
31
31
|
overflow: auto;
|
|
32
32
|
align-items: center;
|
|
33
33
|
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,Sn=Xe.getLocalizedStrings().months;function bi(){const e=de(),n=pe(),t=Ce(),{creditAccount:a,creditAccountRepayment:s}=o(x=>da(x)),b=`${fr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[f,g]=r.useState(!1),[_,i]=r.useState(!1),m=o(x=>gc(x)),{useFeatureGate:B}=le(),D=o(x=>fe(x)),{isFeatureEnabled:d}=B(
|
|
34
|
+
`,Sn=Xe.getLocalizedStrings().months;function bi(){const e=de(),n=pe(),t=Ce(),{creditAccount:a,creditAccountRepayment:s}=o(x=>da(x)),b=`${fr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[f,g]=r.useState(!1),[_,i]=r.useState(!1),m=o(x=>gc(x)),{useFeatureGate:B}=le(),D=o(x=>fe(x)),{isFeatureEnabled:d}=B(W.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=B(W.isDebitCardFeatureEnabled),{isFeatureEnabled:P}=B(W.isCardsCommentingEnabled),F=Ar(P?D.companyId:void 0,{clearParams:P&&m.fetchState==="Completed"}),C=Te(j,D),h=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),w=we(D),u=ve(D),v=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,k=Re({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:d,isBookKeepingTenant:u,isDebitCardProductVisible:h,chargeCardsCreditAccountLimit:v}),M=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,A=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,I=o(x=>oa(x,D.companyId)),L=ia(I.controllers),l=o(x=>nr(x)),p=l.cards.filter(x=>x.type.code.includes("debit")).map(x=>x.connectedAccountId),N=[...new Set(p)],G=o(x=>nt(x,N)),O=o(x=>bc(x));r.useEffect(()=>{_||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(g(!0),n(Je()))},[f,n,a.fetchState]),r.useEffect(()=>{_||a.fetchState!=="Completed"||a.id==null||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(i(!0),n(Sc(a.id)))},[_,n,a.fetchState,a.id,m.fetchState]),r.useEffect(()=>{G.fetchState!=="Completed"&&G.fetchState!=="In-Progress"&&h&&M&&n(rr()),l.fetchState!=="Completed"&&l.fetchState!=="In-Progress"&&n(je()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&h&&M&&n(yc()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&k&&A&&n(Pt())},[G.fetchState,h,M,l.fetchState,O.fetchState,s.fetchState,k,A]),r.useEffect(()=>{if(m.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&l.fetchState==="Completed"&&(!h||!M||G.fetchState==="Completed"&&O.fetchState==="Completed")){let x="",Y="";if(m.statements.length>0){const J=m.statements[m.statements.length-1].period,[X,S]=J.split("-"),R=m.statements[0].period,[T,ee]=R.split("-");x=`${Sn[parseInt(S)-1]} ${X}`,Y=`${Sn[parseInt(ee)-1]} ${T}`}const q=Qe(k,h,M,A),E=Ra(k,A,!0,a,s),V=Ut(h,M,!0,G,O);Q.trackCardsCreditCardStatementsView(L,q,{numberOfStatements:m.statements.length,oldestStatementMonthYear:x,latestStatementMonthYear:Y},E,V)}},[m.fetchState,a.fetchState,s.fetchState,G.fetchState,l.fetchState,O.fetchState]);const U=()=>{const x=_e(t.state?.pathnameStackToGoBack),Y=x.poppedPathname??"..";e(Y,{state:{pathnameStackToGoBack:x.newStack}})},z=o(x=>la(x)),Z=re.getSignedInUser(),y={userId:Z?.userId??"",sessionId:Z?.zeniSessionId??"",tenantId:D.tenantId??""};if(Z==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return c.jsx(bn,{children:c.jsx(io,{onBackClick:U})});{const x=Qe(k,h,M,A);return c.jsx(bn,{children:c.jsx(lo,{currentTenantCompanyName:D.companyName,statementListView:m,productInformation:x,onBackClick:U,authParams:y,controllerEmails:L,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:h,isDebitCardSetupEnabled:M,isChargeCardSetupEnabled:A,isCardsCommentingEnabled:P,initialOpenThreadRequest:F,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:G,debitCardSummary:O,downloadEndPoint:b})})}}const Mr=[ma,dt],Si=new Set(Mr),yi={containerWidth:new Fa(100,58)},Ii=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),s=Ce(),{useDynamicConfig:b}=le(),[f,g]=r.useState(!1),[_,i]=r.useState(!1),[m,B]=r.useState(!1),[D,d]=r.useState(!1),j=r.useRef(!1),P=r.useRef(null);r.useEffect(()=>()=>{P.current!=null&&(clearTimeout(P.current),P.current=null)},[]);const[F,C]=r.useState(!1),[h,w]=r.useState(!1),u=re.getSignedInUser();if(u==null)throw Error("Can't access onboarding card page without signing in...");const v=o(V=>fe(V)),{configValue:k}=b(Ze.zeniCardsConfig),M=o(V=>Ic(V)),{tenantEmailDomain:A}=v,I=o(V=>V.settingsViewState.profile.fetchState),L=o(V=>V.chargeCardListState.fetchState),l=o(V=>V.settingsViewState.profile.userId),p=o(V=>V.chargeCardConfigState.fetchState);r.useEffect(()=>{f===!1&&I!=="In-Progress"&&I!=="Completed"&&(t(kc()),g(!0)),_===!1&&p!=="In-Progress"&&p!=="Completed"&&(t(Qa()),i(!0)),m===!1&&L==="Not-Started"&&(B(!0),t(je()))},[f,m,L,_,p]),r.useEffect(()=>{I==="Completed"&&F===!1&&l!=null&&L==="Completed"&&M.cards.length>0&&(t(Ec({userId:l})),t(sr({cardId:M.cards[M.cards.length-1].id})),C(!0))},[I,F,l,L]),r.useEffect(()=>{if(!D&&M.fetchState==="Completed"&&M.cards.length===0){const V=_e(s.state?.pathnameStackToGoBack),J=V.poppedPathname??aa(A);a(J,{state:{pathnameStackToGoBack:V.newStack}})}},[M.fetchState,M.cards,D]);const N=o(V=>Ja(V)),G=ya(N.updateStatus.fetchState),O=N.currentDisplayedCardId,{useFeatureGate:U}=le(),{isFeatureEnabled:z}=U(W.isChargeCardFeatureEnabled),Z=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,y=!v.userRole.includes("charge_card_user")&&z&&Z,x=o(V=>O!=null?cr(V.chargeCardState,O):null),Y=()=>{O!=null&&(j.current=!0,P.current!=null&&clearTimeout(P.current),P.current=setTimeout(()=>{j.current=!1,P.current=null},5e3),t(ka(O,y,!0)),t(je(!0)),d(!0))},q=ea(v);jt({events:Ca(q,Mr),onSubscribed:()=>{t(je(!0))},onEvent:(V,J)=>{if(!Si.has(V))return;const X=$t(J),S=j.current;if(V===ma){const T=ie(X?.card_id)??O;if(T!=null){const ee=zt(X,T);if(ee!=null)return t(wt(ee)),void(T!==O||S||Y())}}if(V===dt)return void t(je(!0));const R=ie(X?.card_id)??O;(O==null||R===O)&&O!=null?S||Y():t(je(!0))}}),r.useEffect(()=>{if(D&&O!=null&&x!=null&&x.status.code!=="request_on_hold"){const V=Ae(v.tenantEmailDomain,O,u,x),J=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Ac()),x?.type.code==="business_virtual_credit_card"&&t(Xa()),a(V,{state:{pathnameStackToGoBack:J},replace:!0}),j.current=!1,P.current!=null&&(clearTimeout(P.current),P.current=null)}},[D,x?.status.code]),r.useEffect(()=>{G==="In-Progress"&&N.updateStatus.fetchState==="Completed"&&setTimeout(Y,3e3)},[G,N.updateStatus.fetchState]);const E=V=>{w(V)};if(I!=="Completed"||M.cards.length===0)return c.jsxs(yn,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:E}),c.jsx(uo,{})]});if(l==null)throw Error("Can't access my userId.");return c.jsxs(yn,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:E}),c.jsx(ki,{chargeCardListView:M,cardUserOnboardingView:N,navigate:a,currentTenant:v,myUserId:l,location:s,chargeCardCashbackRatePerTransaction:k.charge_card_cashback_rate_per_transaction!=null?k.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{E(!0)}}),e!=null?c.jsx(Ei,{windowSize:n,children:e}):null]})},ki=De(function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const b=ua(e,!1,!1,!1);let f=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(f=!0),{cards:a.cards,showMenuIcon:f,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:b}=n,{tenantEmailDomain:f}=b;return{updateCardUserOnboardingLocalData:g=>{e(Cn({localData:g}))},onGetOtp:g=>{if(a.cardUserOnboardingLocalData!=null){const _={...a.cardUserOnboardingLocalData,phone:g};e(Cn({localData:_}))}e(tt(g,"CardUserOnboarding"))},onResendOtp:g=>{e(at(g,"CardUserOnboarding"))},onVerifyOtp:(g,_)=>{e(et(g,_,"CardUserOnboarding"))},onVerifyOtpSuccess:g=>{e(Dc()),g!=null&&re.saveZeniOtpToken(g)},setCurrentDisplayedCardId:g=>{e(sr({cardId:g}))},onBackClick:()=>{const g=_e(s.state?.pathnameStackToGoBack),_=g.poppedPathname??aa(f);t(_,{state:{pathnameStackToGoBack:g.newStack}})}}})(mo),Ei=Ne.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
width: ${e=>`${yi.containerWidth.value(e.windowSize)}%`};
|
|
@@ -44,12 +44,12 @@ import{j as c}from"./liveblocks-BLlSTcoD.js";import{h as de,g as Ce,i as Me,u as
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
align-items: center;
|
|
46
46
|
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,Ai={containerWidth:new Fa(100,58)},Di=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f,useFeatureGate:g}=le(),[_,i]=r.useState(!1),[m,B]=r.useState(!1),[D,d]=r.useState(!1),[j,P]=r.useState(!1),F=re.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const C=o(y=>fe(y));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=f(Ze.zeniCardsConfig),w=o(y=>_c(y,s)),{isFeatureEnabled:u}=g(
|
|
47
|
+
`,Ai={containerWidth:new Fa(100,58)},Di=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f,useFeatureGate:g}=le(),[_,i]=r.useState(!1),[m,B]=r.useState(!1),[D,d]=r.useState(!1),[j,P]=r.useState(!1),F=re.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const C=o(y=>fe(y));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=f(Ze.zeniCardsConfig),w=o(y=>_c(y,s)),{isFeatureEnabled:u}=g(W.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=g(W.isDebitCardFeatureEnabled),k=Te(v,C),M=xe({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:k}),A=we(C),I=ve(C),L=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=Re({isCardsOnlyTenant:A,isChargeCardFeatureEnabled:u,isBookKeepingTenant:I,isDebitCardProductVisible:M,chargeCardsCreditAccountLimit:L}),p=w.chargeCard,N=o(y=>y.chargeCardConfigState.fetchState);r.useEffect(()=>{_===!1&&N!=="In-Progress"&&N!=="Completed"&&(t(Qa()),i(!0)),m===!1&&w.fetchState==="Not-Started"&&(B(!0),t(ka(s,!1,l)))},[m,w.fetchState,_,N]);const G=p?.type.code==="business_physical_debit_card"||p?.type.code==="business_virtual_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(D===!1&&(G===!1||G&&p.status?.code!=="active"||G&&p.status.code==="active"&&p.isPinSet||p.cardHolderUserId!==F.userId)){const y=Ae(C.tenantEmailDomain,s,F,p,!0),x=ye(b.state?.pathnameStackToGoBack,b.pathname);a(y,{state:{pathnameStackToGoBack:x}})}else if(D&&w.isRefreshingViewInBackground===!1&&p?.isPinSet===!0){t(Pc({chargeCardId:s}));const y=Ae(C.tenantEmailDomain,s,F,p,!0),x=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(y,{state:{pathnameStackToGoBack:x}})}}},[w.fetchState,p?.type.code,D,w.isRefreshingViewInBackground]);const O=re.getZeniOtpTokenForCardHolder(s),U=o(y=>Mn(y.userState,F.userId)),z=()=>{p?.isPinSet!==!0&&t(ga(s,!0))};r.useEffect(()=>{w.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),d(!0))},[w.updateDebitCardPinAttemptFetchState.fetchState]);const Z=y=>{P(y)};if(N!=="Completed"||p==null)return c.jsx(va,{fetchState:"In-Progress"});if(U?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(wi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:j,handleDrawerToggle:Z}),c.jsx(_i,{cardId:s,card:p,phone:U.phone,signedInUser:F,isSandboxEnv:xt(),debitCardDetailState:w,signedInUserToken:O,navigate:a,currentTenant:C,location:b,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?c.jsx(Pi,{windowSize:n,children:e}):null]})},_i=De(function(e,{debitCardDetailState:n,cardId:t}){const a=Nn(e,t),s=n.updateStatus,b=ua(e,!1,!1,!1);let f=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(f=!0),{showMenuIcon:f,vgsVaultId:st.cardVaultId,twoFAView:a,setPinWaitStatus:s}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,debitCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:i=>{e(Yn(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onSetPinSuccess:()=>{e(wc({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("activate")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(Co),Pi=Ne.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
width: ${e=>`${Ai.containerWidth.value(e.windowSize)}%`};
|
|
51
51
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
52
|
-
box-shadow: ${e=>`${
|
|
52
|
+
box-shadow: ${e=>`${Wa.sp0} 2px ${Wa.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
53
53
|
`,wi=Ne.div`
|
|
54
54
|
display: flex;
|
|
55
55
|
min-height: 100%;
|
|
@@ -58,8 +58,8 @@ import{j as c}from"./liveblocks-BLlSTcoD.js";import{h as de,g as Ce,i as Me,u 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
|
-
`,vi={overlayWidth:new Fa(pt[12],pt[12],pt[9])},Ti=De(function(e,n){const t=Tt(e,!1,!1),a=n.lineId,s=t.customAddress[a],b=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:b,lineId:a}},function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:b=>{t!=null&&e(or(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const f=Po(b);e(Fc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:f})),e(xc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Tc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(po),Fi=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Rt(),s=Ta(),b=()=>{n()},f=o(g=>vc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,g))?.newAddressId;return c.jsx(Sr,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:vi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(g,_)=>(_==="backdropClick"||_==="escapeKeyDown")&&b(),children:c.jsx(Ti,{googleAPIKey:st.googleMapsAPIKey,onDismissClick:b,lineId:e,chargeCardTypeOption:t,newCustomAddressId:f})})},xi=De(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isChargeCardSetupEnabled:f,isDebitCardSetupEnabled:g}=n,_=Tt(e,t&&f,a&&g);return{issueChargeCards:_,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:f,isDebitCardSetupEnabled:g,cardHolderCandidates:_.userList.map(i=>i.user).filter(Boolean),allRoles:_.userList.map(i=>i.userRole),allAccountingClasses:_.allAccountingClasses,userList:_.userList}},function(e,n){return{onIssueCardClick:()=>{e(Lc())},onSaveChangesToLocalStore:t=>{e(Bc(t))},onDismissClick:()=>{e(ir()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(or(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(go);function Ri(){const e=re.getSignedInUser(),n=de(),t=pe(),a=ho(),[s]=In(),b=s.get("cardType"),{useFeatureGate:f}=le(),{isFeatureEnabled:g}=f(
|
|
61
|
+
box-shadow: ${e=>`${Wa.sp0} 2px ${Wa.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
62
|
+
`,vi={overlayWidth:new Fa(pt[12],pt[12],pt[9])},Ti=De(function(e,n){const t=Tt(e,!1,!1),a=n.lineId,s=t.customAddress[a],b=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:b,lineId:a}},function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:b=>{t!=null&&e(or(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const f=Po(b);e(Fc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:f})),e(xc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Tc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(po),Fi=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Rt(),s=Ta(),b=()=>{n()},f=o(g=>vc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,g))?.newAddressId;return c.jsx(Sr,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:vi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(g,_)=>(_==="backdropClick"||_==="escapeKeyDown")&&b(),children:c.jsx(Ti,{googleAPIKey:st.googleMapsAPIKey,onDismissClick:b,lineId:e,chargeCardTypeOption:t,newCustomAddressId:f})})},xi=De(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isChargeCardSetupEnabled:f,isDebitCardSetupEnabled:g}=n,_=Tt(e,t&&f,a&&g);return{issueChargeCards:_,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:f,isDebitCardSetupEnabled:g,cardHolderCandidates:_.userList.map(i=>i.user).filter(Boolean),allRoles:_.userList.map(i=>i.userRole),allAccountingClasses:_.allAccountingClasses,userList:_.userList}},function(e,n){return{onIssueCardClick:()=>{e(Lc())},onSaveChangesToLocalStore:t=>{e(Bc(t))},onDismissClick:()=>{e(ir()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(or(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(go);function Ri(){const e=re.getSignedInUser(),n=de(),t=pe(),a=ho(),[s]=In(),b=s.get("cardType"),{useFeatureGate:f}=le(),{isFeatureEnabled:g}=f(W.isIssuePhysicalCardEnabled),{isFeatureEnabled:_}=f(W.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:i}=f(W.isDebitCardFeatureEnabled),{isFeatureEnabled:m}=f(W.isChargeCardFeatureEnabled),B=o(z=>fe(z)),D=Te(i,B),d=xe({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:D}),j=we(B),P=ve(B),F=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,C=Re({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:m,isBookKeepingTenant:P,isDebitCardProductVisible:d,chargeCardsCreditAccountLimit:F}),[h,w]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect(()=>{h||(w(!0),t(Rc(d&&v,C&&u,!1)))},[h,w,t]);const u=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,v=!!B.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(z=>Tt(z,C&&u,d&&v)),M=k.fetchState,A=k.issueCardStatus.fetchState,I=k.lastSelfIssuedDebitCardId,L=o(z=>I!=null?cr(z.chargeCardState,I):void 0),[l,p]=r.useState(null),[N,G]=r.useState(null),O=()=>{p(null)},U=(z,Z)=>{p(z),G(Z)};return r.useEffect(()=>{if(A==="Completed"){if(I!=null&&L?.type.code==="business_virtual_debit_card"){let z;z=L?.status.code==="request_on_hold"&&e.userId===L.cardHolderUserId?Er(B.tenantEmailDomain):Ae(B.tenantEmailDomain,I,e,L),n(z)}else n("../");t(ir())}},[A,I]),M==="Completed"?c.jsxs(c.Fragment,{children:[l!==null&&N!==null?c.jsx(Fi,{closeDrawerHandler:O,lineId:l,chargeCardTypeOption:N}):null,c.jsx(xi,{themeState:a,isIssuePhysicalCardEnabled:g,isIssuePhysicalDebitCardEnabled:_,isDebitCardFeatureEnabled:d,isChargeCardFeatureEnabled:C,isChargeCardSetupEnabled:u,isDebitCardSetupEnabled:v,navigate:n,fetchState:k.fetchState,openAddAddressDrawerHandler:U,defaultCardType:b==="creditCard"||b==="debitCard"?b:void 0})]}):M==="Error"?c.jsx(ot,{}):c.jsx(fo,{})}const Nr=[ma,dt],Bi=new Set(Nr),Li=Ne.div`
|
|
63
63
|
display: flex;
|
|
64
64
|
height: 100vh;
|
|
65
65
|
width: 100%;
|
|
@@ -68,4 +68,4 @@ import{j as c}from"./liveblocks-BLlSTcoD.js";import{h as de,g as Ce,i as Me,u as
|
|
|
68
68
|
overflow: auto;
|
|
69
69
|
align-items: center;
|
|
70
70
|
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,Oi=De(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:b,myPendingActivationChargeCardListState:f}=n,{tenantEmailDomain:g}=a,{cards:_}=f;return{onChargeCardRowClick:i=>{const m=kr(_,i),B=Ae(g,i,b,m),D=ye(s.state?.pathnameStackToGoBack,s.pathname);t(B,{state:{pathnameStackToGoBack:D}})},onColumnSortConfigChanged:(i,m)=>{e(yt({uiState:{sortKey:i,sortOrder:m}}))},onReloadCards:()=>{e(je())},onBackClick:()=>{const i=a.userRole.includes("charge_card_user");e(yt({uiState:{sortKey:i?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(bo);function Ui(){const e=de(),n=pe(),t=Ce(),a=Rt(),[s,b]=r.useState(!1),f=o(U=>Oc(U)),g=o(U=>fe(U)),_=o(U=>oa(U,g.companyId)),i=ia(_.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(K.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=m(K.isDebitCardFeatureEnabled),d=Te(D,g),j=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:d}),P=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,F=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,C=Fe(),h=we(g),w=ve(g),u=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Re({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:B,isBookKeepingTenant:w,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:u}),k=Pe(C?.loggedInUserRoleMap),M=o(U=>la(U)),{creditAccount:A,creditAccountRepayment:I}=o(U=>da(U)),L=o(U=>nr(U)).cards.filter(U=>U.type.code.includes("debit")).map(U=>U.connectedAccountId),l=[...new Set(L)],p=o(U=>nt(U,l));r.useEffect(()=>{s||f.fetchState==="Completed"||f.fetchState==="In-Progress"||(b(!0),n(je()),n(Ja()))},[s,n,f.fetchState]),r.useEffect(()=>{if(f.fetchState==="Completed"&&f.cards.length===1&&N!=null){const U=Ae(g.tenantEmailDomain,f.cards[0].id,N,f.cards[0]);e(U,{state:{message:t.state?.message}})}},[f.fetchState,f.cards]);const N=re.getSignedInUser();r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&v&&F&&k&&n(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&k&&n(Pt()),p.fetchState!=="Completed"&&p.fetchState!=="In-Progress"&&j&&P&&k&&n(rr())},[A.fetchState,I.fetchState,n,p.fetchState,j,P,k,v,F]);const G=ea(g);if(jt({events:Ca(G,Nr),onEvent:(U,z)=>{if(!Bi.has(U))return;const Z=$t(z);if(U===ma){const y=ie(Z?.card_id);if(y!=null){const x=zt(Z,y);if(x!=null)return void n(wt(x))}}n(je(!0))},onSubscribed:()=>{n(je(!0))}}),N==null)throw Error("Can't access address page without signing in...");const O=f.cards!=null&&f.cards.length>0;if(f.fetchState==="Completed"||O){const U=Je(v,j,P,F);return c.jsx(Li,{children:c.jsx(Oi,{navigate:e,currentTenant:g,signedInUser:N,productInformation:U,myPendingActivationChargeCardListState:f,isChargeCardFeatureEnabled:v,isDebitCardFeatureEnabled:j,isDebitCardSetupEnabled:P,isChargeCardSetupEnabled:F,chargeCardCashbackDetailState:M,creditAccount:A,creditAccountRepayment:I,depositAccountListWithDebitCardIssued:p,controllerEmails:i,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const ji=De(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:b,isChargeCardSetupEnabled:f,signedInUser:g,location:_,productInformation:i,isEarlyPayEnabled:m,controllerEmails:B,chargeCardsCreditAccountLimit:D}=n;return{onSetupButtonClick:d=>{if(g!=null&&J.trackCardsPromoPageClicked("enable cards"),s)switch(J.trackCardsEnableCardsClick(B,i,"Cards Promo"),d){case"credit":e(qe(a,!0,"charge_cards",m,!1));break;case"debit":e(qe(a,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(D===0?qe(a,!0,"debit_cards",m,!0):qe(a,!0,"charge_cards__debit_cards",m,!1))}else switch(J.trackCardsSetupCardsClick(B,i,"Cards Promo"),d){case"credit":e(qe(a,!1,"charge_cards",m,!1));break;case"debit":e(qe(a,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(D===0?qe(a,!1,"debit_cards",m,!0):qe(a,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const d=_e(_.state?.pathnameStackToGoBack);let j=d.poppedPathname;j==null&&(j=b||f?"..":"../.."),t(j,{state:{pathnameStackToGoBack:d.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Xa()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Mc(a))}}})(yo),Mi=()=>{const e=de(),{tenantEmailDomain:n}=Me(),[t]=In(),a=t.get("cardPromoType"),s=pe(),{useDynamicConfig:b,useFeatureGate:f}=le(),[g,_]=r.useState(!1),{isFeatureEnabled:i}=f(K.isDebitCardFeatureEnabled),{isFeatureEnabled:m}=f(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:B}=f(K.isChargeCardFeatureEnabled),{configValue:D}=b(Ze.zeniCardsConfig),d=o(ne=>fe(ne)),j=o(ne=>oa(ne,d.companyId)),P=ia(j.controllers),F=D.charge_card_cashback_rate_per_transaction!=null?D.charge_card_cashback_rate_per_transaction:.0175,C=Ce(),h=re.getSignedInUserTenant(n)?.companyId??d.companyId,w=o(ne=>wa(ne,h)),u=w.primaryFundingAccount,v=d.companyBillPayInfo?.info,k=we(d),M=ve(d),A=Te(i,d),I=d.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=xe({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:A}),l=Re({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:B,isBookKeepingTenant:M,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:I}),p=Ir({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:B,isBookKeepingTenant:M}),N=L&&l===!1,G=v?.businessVerificationStatus?.code==="verified"&&(N||u?.accType==="depositAccount"||Uc(u?.providerVerificationStatus?.code??"")),O=re.getSignedInUser(),U=!!d.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,Z=!!d.company?.companyChargeCardInfo.isChargeCardEnabled,y=!!d.company?.companyDebitCardInfo.isDebitCardEnabled,x=!!d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,W=ne=>{_(ne)},q=o(ne=>ne.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Fe(),V=Pe(E?.loggedInUserRoleMap),Q=vt(E?.loggedInUserRoleMap),[X,S]=r.useState(!1),[R,T]=r.useState(!1),[ee,Y]=r.useState(!1);r.useEffect(()=>{X===!1&&C.state?.message==="activation"&&S(!0)},[C.state]),r.useEffect(()=>{R||q!=="Not-Started"||h==null||(T(!0),s(Pa(h,!0)))},[R,q,h,s]);const ke=d.companyChargeCardInfo?.info!=null&&Ia({cardInfo:d.companyChargeCardInfo.info,isProductVisible:p,isTOSAccepted:z,isSetupEnabled:Z,isUserHasCardsAdminLevelAccess:V,isUserHasCardsAccess:Q}),be=d.companyDebitCardInfo?.info!=null&&Ia({cardInfo:d.companyDebitCardInfo.info,isProductVisible:L,isTOSAccepted:x,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:V,isUserHasCardsAccess:Q}),ge=L&&be&&p&&I>=0&&ke?"debit_and_credit":L&&be?"debit":"credit",ae=_o(a,ge),ue=w?.chargeCardTermsDetails?.fetchStatus?.fetchState,oe=r.useRef(null);r.useEffect(()=>{ue==="In-Progress"?oe.current=ae:ue!=="Error"&&ue!=="Not-Started"||(oe.current=null)},[ue,ae]);const te=ue!=="In-Progress"&&ue!=="Completed"||oe.current==null?ae:oe.current;r.useEffect(()=>{ae==="credit"&&(Z||p===!1&&y)||ae==="debit"&&y||ae==="debit_and_credit"&&y&&Z?e("../"):(ae==="debit_and_credit"&&z===!0&&x===!0||ae==="credit"&&(z===!0||p===!1&&x===!0)||ae==="debit"&&x===!0)&&V===!0&&e("../setup")},[G,Z,y,ae,z,x]),r.useEffect(()=>{ee||(s(jc("cardAdmin")),Y(!0))},[ee]);const We=o(ne=>ar(ne.userState,ne.userRoleState,ne.userListViewState,"cardAdmin")),Ee=Je(p,L,y,Z);return(ke||be)&&q==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Bt,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(br.Event.cardsPromoPage),!!p&&!Z||!!L&&!y||!!p&&!!L&&!y&&!Z){const ne=Ni({isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:Z,isCreditCardProductVisibleForExpressInterest:p,isDebitCardProductVisible:L});J.trackCardsPromoView(P,Ee,"Page",ne,"Promo Page")}}}),c.jsx(rt,{showConfetti:X}),c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:W}),c.jsx(ji,{signedInUser:O,location:C,showEnableCardButton:G,isCompanyBusinessVerificationAndPaymentSetUpDone:G,isChargeCardSetupEnabled:Z,isDebitCardSetupEnabled:y,companyLegalName:d.companyName,adminList:We.users,isCheckingEnabled:U,navigate:e,companyId:h,cardPromoType:te,controllerEmails:P,productInformation:Ee,isCreditCardProductVisible:l,isDebitCardFeatureEnabled:i,isEarlyPayEnabled:m,cashbackRate:F,chargeCardsCreditAccountLimit:I,onClickMenuIcon:()=>{W(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:W}),c.jsx(So,{})]})},Ni=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function ud(){const e=Ce(),n=o(E=>fe(E)),{useFeatureGate:t}=le(),{isFeatureEnabled:a}=t(K.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(K.isDebitCardFeatureEnabled),{isFeatureEnabled:b}=t(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:f}=t(K.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:g}=t(K.isCardPolicyEnabled),_=Te(s,n),i=xe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:_}),m=Io(n,a,s),B=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,d=!!n.company?.companyChargeCardInfo.isChargeCardEnabled,j=!!n.company?.companyDebitCardInfo.isDebitCardEnabled,P=Fe(),F=Pe(P?.loggedInUserRoleMap),C=vt(P?.loggedInUserRoleMap),{isFeatureEnabled:h}=t(K.isCashbackFeatureEnabled),w=n.userRole.includes("charge_card_user"),u=!w,v=!w&&d,k=n?.userRole!=null&&Nc(n?.userRole),M=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!k)&&Vc(P?.loggedInUserRoleMap),A=Hc(P?.loggedInUserRoleMap),I=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!k)&&Gc(P?.loggedInUserRoleMap),{isFeatureEnabled:L}=t(K.isDepositAccountsFeatureEnabled),l=L&&!k&&Hn(P?.loggedInUserRoleMap),p=d&&!k,N=j&&!k,G=m&&!k&&Pe(P?.loggedInUserRoleMap),O=$c(P?.loggedInUserRoleMap),U=we(n),z=ve(n),Z=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=Re({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:a,isBookKeepingTenant:z,isDebitCardProductVisible:i,chargeCardsCreditAccountLimit:Z}),x=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:y,isTOSAccepted:B,isSetupEnabled:d,isUserHasCardsAdminLevelAccess:F,isUserHasCardsAccess:C}),W=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:i,isTOSAccepted:D,isSetupEnabled:j,isUserHasCardsAdminLevelAccess:F,isUserHasCardsAccess:C}),q=x||W;return c.jsxs(es,{children:[F?c.jsx(se,{path:"setup",element:c.jsx(pn,{isBillPayAdminLevelAccess:M,isReimbursementAdminLevelAccess:I,isZeniAccountAdminLevelAccess:l,isChargeCardAdminLevelAccess:G,isUserHasOnlyCardAccess:O,isUserHasOnlyBillPayAccess:A,productType:"charge_cards",type:"setup"})}):null,F?c.jsx(se,{path:"verification",element:c.jsx(pn,{isBillPayAdminLevelAccess:M,isUserHasOnlyBillPayAccess:A,isReimbursementAdminLevelAccess:I,isZeniAccountAdminLevelAccess:l,isChargeCardAdminLevelAccess:G,isUserHasOnlyCardAccess:O,productType:"charge_cards",type:"verification"})}):null,F&&g?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"policy",element:c.jsx(No,{})}),c.jsx(se,{path:"policy/new",element:c.jsx(Fo,{})}),c.jsx(se,{path:"policy/:templateId/edit",element:c.jsx(Lo,{})})]}):null,c.jsx(se,{path:"promo",element:c.jsx(Mi,{})}),p||N?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"/",element:c.jsx(gn,{isPaymentDrawerOpen:!1})}),G&&b?c.jsx(se,{path:"payment",element:c.jsx(gn,{isPaymentDrawerOpen:!0})}):null,c.jsx(se,{path:"activate",element:c.jsx(Ui,{})}),c.jsx(se,{path:"onboard",element:c.jsx(Ii,{})}),F?c.jsx(se,{path:"new",element:c.jsx(Ri,{})}):null,h&&u?c.jsx(se,{path:"cashback",element:c.jsx(zo,{})}):null,v?c.jsx(se,{path:"statements",element:c.jsx(bi,{})}):null,G&&f&&d?c.jsx(se,{path:"payment-history",element:c.jsx(gi,{})}):null,c.jsx(se,{path:":cardId/activate",element:c.jsx(Ko,{})}),c.jsx(se,{path:":cardId/setPin",element:c.jsx(Di,{})}),c.jsx(se,{path:":cardId/addToWallet",element:c.jsx(Vo,{})}),c.jsx(se,{path:":cardId/*",element:c.jsx(ri,{})}),c.jsx(se,{path:"*",element:c.jsx(ot,{})})]}):(B||D)&&F?c.jsx(se,{path:"*",element:c.jsx(Sa,{to:"../setup"})}):q?c.jsx(se,{path:"*",element:c.jsx(Sa,{to:"../promo",state:e.state})}):c.jsx(se,{path:"*",element:null})]})}export{ud as default};
|
|
71
|
+
`,Oi=De(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:b,myPendingActivationChargeCardListState:f}=n,{tenantEmailDomain:g}=a,{cards:_}=f;return{onChargeCardRowClick:i=>{const m=kr(_,i),B=Ae(g,i,b,m),D=ye(s.state?.pathnameStackToGoBack,s.pathname);t(B,{state:{pathnameStackToGoBack:D}})},onColumnSortConfigChanged:(i,m)=>{e(yt({uiState:{sortKey:i,sortOrder:m}}))},onReloadCards:()=>{e(je())},onBackClick:()=>{const i=a.userRole.includes("charge_card_user");e(yt({uiState:{sortKey:i?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(bo);function Ui(){const e=de(),n=pe(),t=Ce(),a=Rt(),[s,b]=r.useState(!1),f=o(U=>Oc(U)),g=o(U=>fe(U)),_=o(U=>oa(U,g.companyId)),i=ia(_.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(W.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=m(W.isDebitCardFeatureEnabled),d=Te(D,g),j=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:d}),P=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,F=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,C=Fe(),h=we(g),w=ve(g),u=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Re({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:B,isBookKeepingTenant:w,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:u}),k=Pe(C?.loggedInUserRoleMap),M=o(U=>la(U)),{creditAccount:A,creditAccountRepayment:I}=o(U=>da(U)),L=o(U=>nr(U)).cards.filter(U=>U.type.code.includes("debit")).map(U=>U.connectedAccountId),l=[...new Set(L)],p=o(U=>nt(U,l));r.useEffect(()=>{s||f.fetchState==="Completed"||f.fetchState==="In-Progress"||(b(!0),n(je()),n(Qa()))},[s,n,f.fetchState]),r.useEffect(()=>{if(f.fetchState==="Completed"&&f.cards.length===1&&N!=null){const U=Ae(g.tenantEmailDomain,f.cards[0].id,N,f.cards[0]);e(U,{state:{message:t.state?.message}})}},[f.fetchState,f.cards]);const N=re.getSignedInUser();r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&v&&F&&k&&n(Je()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&k&&n(Pt()),p.fetchState!=="Completed"&&p.fetchState!=="In-Progress"&&j&&P&&k&&n(rr())},[A.fetchState,I.fetchState,n,p.fetchState,j,P,k,v,F]);const G=ea(g);if(jt({events:Ca(G,Nr),onEvent:(U,z)=>{if(!Bi.has(U))return;const Z=$t(z);if(U===ma){const y=ie(Z?.card_id);if(y!=null){const x=zt(Z,y);if(x!=null)return void n(wt(x))}}n(je(!0))},onSubscribed:()=>{n(je(!0))}}),N==null)throw Error("Can't access address page without signing in...");const O=f.cards!=null&&f.cards.length>0;if(f.fetchState==="Completed"||O){const U=Qe(v,j,P,F);return c.jsx(Li,{children:c.jsx(Oi,{navigate:e,currentTenant:g,signedInUser:N,productInformation:U,myPendingActivationChargeCardListState:f,isChargeCardFeatureEnabled:v,isDebitCardFeatureEnabled:j,isDebitCardSetupEnabled:P,isChargeCardSetupEnabled:F,chargeCardCashbackDetailState:M,creditAccount:A,creditAccountRepayment:I,depositAccountListWithDebitCardIssued:p,controllerEmails:i,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const ji=De(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:b,isChargeCardSetupEnabled:f,signedInUser:g,location:_,productInformation:i,isEarlyPayEnabled:m,controllerEmails:B,chargeCardsCreditAccountLimit:D}=n;return{onSetupButtonClick:d=>{if(g!=null&&Q.trackCardsPromoPageClicked("enable cards"),s)switch(Q.trackCardsEnableCardsClick(B,i,"Cards Promo"),d){case"credit":e(qe(a,!0,"charge_cards",m,!1));break;case"debit":e(qe(a,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(D===0?qe(a,!0,"debit_cards",m,!0):qe(a,!0,"charge_cards__debit_cards",m,!1))}else switch(Q.trackCardsSetupCardsClick(B,i,"Cards Promo"),d){case"credit":e(qe(a,!1,"charge_cards",m,!1));break;case"debit":e(qe(a,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(D===0?qe(a,!1,"debit_cards",m,!0):qe(a,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const d=_e(_.state?.pathnameStackToGoBack);let j=d.poppedPathname;j==null&&(j=b||f?"..":"../.."),t(j,{state:{pathnameStackToGoBack:d.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Xa()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Mc(a))}}})(yo),Mi=()=>{const e=de(),{tenantEmailDomain:n}=Me(),[t]=In(),a=t.get("cardPromoType"),s=pe(),{useDynamicConfig:b,useFeatureGate:f}=le(),[g,_]=r.useState(!1),{isFeatureEnabled:i}=f(W.isDebitCardFeatureEnabled),{isFeatureEnabled:m}=f(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:B}=f(W.isChargeCardFeatureEnabled),{configValue:D}=b(Ze.zeniCardsConfig),d=o(ne=>fe(ne)),j=o(ne=>oa(ne,d.companyId)),P=ia(j.controllers),F=D.charge_card_cashback_rate_per_transaction!=null?D.charge_card_cashback_rate_per_transaction:.0175,C=Ce(),h=re.getSignedInUserTenant(n)?.companyId??d.companyId,w=o(ne=>wa(ne,h)),u=w.primaryFundingAccount,v=d.companyBillPayInfo?.info,k=we(d),M=ve(d),A=Te(i,d),I=d.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=xe({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:A}),l=Re({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:B,isBookKeepingTenant:M,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:I}),p=Ir({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:B,isBookKeepingTenant:M}),N=L&&l===!1,G=v?.businessVerificationStatus?.code==="verified"&&(N||u?.accType==="depositAccount"||Uc(u?.providerVerificationStatus?.code??"")),O=re.getSignedInUser(),U=!!d.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,Z=!!d.company?.companyChargeCardInfo.isChargeCardEnabled,y=!!d.company?.companyDebitCardInfo.isDebitCardEnabled,x=!!d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,Y=ne=>{_(ne)},q=o(ne=>ne.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Fe(),V=Pe(E?.loggedInUserRoleMap),J=vt(E?.loggedInUserRoleMap),[X,S]=r.useState(!1),[R,T]=r.useState(!1),[ee,K]=r.useState(!1);r.useEffect(()=>{X===!1&&C.state?.message==="activation"&&S(!0)},[C.state]),r.useEffect(()=>{R||q!=="Not-Started"||h==null||(T(!0),s(Pa(h,!0)))},[R,q,h,s]);const ke=d.companyChargeCardInfo?.info!=null&&Ia({cardInfo:d.companyChargeCardInfo.info,isProductVisible:p,isTOSAccepted:z,isSetupEnabled:Z,isUserHasCardsAdminLevelAccess:V,isUserHasCardsAccess:J}),be=d.companyDebitCardInfo?.info!=null&&Ia({cardInfo:d.companyDebitCardInfo.info,isProductVisible:L,isTOSAccepted:x,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:V,isUserHasCardsAccess:J}),ge=L&&be&&p&&I>=0&&ke?"debit_and_credit":L&&be?"debit":"credit",ae=_o(a,ge),ue=w?.chargeCardTermsDetails?.fetchStatus?.fetchState,oe=r.useRef(null);r.useEffect(()=>{ue==="In-Progress"?oe.current=ae:ue!=="Error"&&ue!=="Not-Started"||(oe.current=null)},[ue,ae]);const te=ue!=="In-Progress"&&ue!=="Completed"||oe.current==null?ae:oe.current;r.useEffect(()=>{ae==="credit"&&(Z||p===!1&&y)||ae==="debit"&&y||ae==="debit_and_credit"&&y&&Z?e("../"):(ae==="debit_and_credit"&&z===!0&&x===!0||ae==="credit"&&(z===!0||p===!1&&x===!0)||ae==="debit"&&x===!0)&&V===!0&&e("../setup")},[G,Z,y,ae,z,x]),r.useEffect(()=>{ee||(s(jc("cardAdmin")),K(!0))},[ee]);const Ye=o(ne=>ar(ne.userState,ne.userRoleState,ne.userListViewState,"cardAdmin")),Ee=Qe(p,L,y,Z);return(ke||be)&&q==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Bt,{analytics:Q,onLoad:()=>{if(Q.trackPageLoaded(br.Event.cardsPromoPage),!!p&&!Z||!!L&&!y||!!p&&!!L&&!y&&!Z){const ne=Ni({isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:Z,isCreditCardProductVisibleForExpressInterest:p,isDebitCardProductVisible:L});Q.trackCardsPromoView(P,Ee,"Page",ne,"Promo Page")}}}),c.jsx(rt,{showConfetti:X}),c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:Y}),c.jsx(ji,{signedInUser:O,location:C,showEnableCardButton:G,isCompanyBusinessVerificationAndPaymentSetUpDone:G,isChargeCardSetupEnabled:Z,isDebitCardSetupEnabled:y,companyLegalName:d.companyName,adminList:Ye.users,isCheckingEnabled:U,navigate:e,companyId:h,cardPromoType:te,controllerEmails:P,productInformation:Ee,isCreditCardProductVisible:l,isDebitCardFeatureEnabled:i,isEarlyPayEnabled:m,cashbackRate:F,chargeCardsCreditAccountLimit:I,onClickMenuIcon:()=>{Y(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:Y}),c.jsx(So,{})]})},Ni=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function ud(){const e=Ce(),n=o(E=>fe(E)),{useFeatureGate:t}=le(),{isFeatureEnabled:a}=t(W.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(W.isDebitCardFeatureEnabled),{isFeatureEnabled:b}=t(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:f}=t(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:g}=t(W.isCardPolicyEnabled),_=Te(s,n),i=xe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:_}),m=Io(n,a,s),B=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,d=!!n.company?.companyChargeCardInfo.isChargeCardEnabled,j=!!n.company?.companyDebitCardInfo.isDebitCardEnabled,P=Fe(),F=Pe(P?.loggedInUserRoleMap),C=vt(P?.loggedInUserRoleMap),{isFeatureEnabled:h}=t(W.isCashbackFeatureEnabled),w=n.userRole.includes("charge_card_user"),u=!w,v=!w&&d,k=n?.userRole!=null&&Nc(n?.userRole),M=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!k)&&Vc(P?.loggedInUserRoleMap),A=Hc(P?.loggedInUserRoleMap),I=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!k)&&Gc(P?.loggedInUserRoleMap),{isFeatureEnabled:L}=t(W.isDepositAccountsFeatureEnabled),l=L&&!k&&Hn(P?.loggedInUserRoleMap),p=d&&!k,N=j&&!k,G=m&&!k&&Pe(P?.loggedInUserRoleMap),O=$c(P?.loggedInUserRoleMap),U=we(n),z=ve(n),Z=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=Re({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:a,isBookKeepingTenant:z,isDebitCardProductVisible:i,chargeCardsCreditAccountLimit:Z}),x=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:y,isTOSAccepted:B,isSetupEnabled:d,isUserHasCardsAdminLevelAccess:F,isUserHasCardsAccess:C}),Y=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:i,isTOSAccepted:D,isSetupEnabled:j,isUserHasCardsAdminLevelAccess:F,isUserHasCardsAccess:C}),q=x||Y;return c.jsxs(es,{children:[F?c.jsx(se,{path:"setup",element:c.jsx(pn,{isBillPayAdminLevelAccess:M,isReimbursementAdminLevelAccess:I,isZeniAccountAdminLevelAccess:l,isChargeCardAdminLevelAccess:G,isUserHasOnlyCardAccess:O,isUserHasOnlyBillPayAccess:A,productType:"charge_cards",type:"setup"})}):null,F?c.jsx(se,{path:"verification",element:c.jsx(pn,{isBillPayAdminLevelAccess:M,isUserHasOnlyBillPayAccess:A,isReimbursementAdminLevelAccess:I,isZeniAccountAdminLevelAccess:l,isChargeCardAdminLevelAccess:G,isUserHasOnlyCardAccess:O,productType:"charge_cards",type:"verification"})}):null,F&&g?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"policy",element:c.jsx(No,{})}),c.jsx(se,{path:"policy/new",element:c.jsx(Fo,{})}),c.jsx(se,{path:"policy/:templateId/edit",element:c.jsx(Lo,{})})]}):null,c.jsx(se,{path:"promo",element:c.jsx(Mi,{})}),p||N?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"/",element:c.jsx(gn,{isPaymentDrawerOpen:!1})}),G&&b?c.jsx(se,{path:"payment",element:c.jsx(gn,{isPaymentDrawerOpen:!0})}):null,c.jsx(se,{path:"activate",element:c.jsx(Ui,{})}),c.jsx(se,{path:"onboard",element:c.jsx(Ii,{})}),F?c.jsx(se,{path:"new",element:c.jsx(Ri,{})}):null,h&&u?c.jsx(se,{path:"cashback",element:c.jsx(zo,{})}):null,v?c.jsx(se,{path:"statements",element:c.jsx(bi,{})}):null,G&&f&&d?c.jsx(se,{path:"payment-history",element:c.jsx(gi,{})}):null,c.jsx(se,{path:":cardId/activate",element:c.jsx(Wo,{})}),c.jsx(se,{path:":cardId/setPin",element:c.jsx(Di,{})}),c.jsx(se,{path:":cardId/addToWallet",element:c.jsx(Vo,{})}),c.jsx(se,{path:":cardId/*",element:c.jsx(ri,{})}),c.jsx(se,{path:"*",element:c.jsx(ot,{})})]}):(B||D)&&F?c.jsx(se,{path:"*",element:c.jsx(Sa,{to:"../setup"})}):q?c.jsx(se,{path:"*",element:c.jsx(Sa,{to:"../promo",state:e.state})}):c.jsx(se,{path:"*",element:null})]})}export{ud as default};
|