@zeniai/web-app-ui 5.1.75-dev → 5.1.76-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-BwsHnOH8.js +1 -0
- package/dist/assets/AddressScreen-CAtyAvAs.js +9 -0
- package/dist/assets/AiCfoScreen-D-u3zZeh.js +22 -0
- package/dist/assets/BillPayApprovalRoutes-C9pR0_l1.js +1 -0
- package/dist/assets/BillPayRoutes-CmZHJWuj.js +119 -0
- package/dist/assets/BusinessVerificationPageScreen-CBwqYBjF.js +9 -0
- package/dist/assets/ChargeCardRoutes-BapvAll0.js +71 -0
- package/dist/assets/{CompanyPassportScreen-DavSJynu.js → CompanyPassportScreen-Bc_61P8x.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-ChtPjyOS.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-DIF1UKGf.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-CHcuZpK3.js +23 -0
- package/dist/assets/{DashboardRoutes-Brg8B8gk.js → DashboardRoutes-KKfELT68.js} +4 -4
- package/dist/assets/DefaultTenantHome-jBJso_C6.js +1 -0
- package/dist/assets/DomesticWireDetailScreen-BpuUIzPP.js +18 -0
- package/dist/assets/DrawerScreen-iltW1aDR.js +1 -0
- package/dist/assets/EntityDetailRoutes-BKjoJvHi.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-DyYkiLeH.js +25 -0
- package/dist/assets/FeaturePreviewScreen-BZoG5bFs.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-BaRTPuiA.js +1 -0
- package/dist/assets/MagicLinkRoutes-CqR6QAtm.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-DLVoUEmm.js +12 -0
- package/dist/assets/MobileAppDrawer-9x3MntXc.js +1 -0
- package/dist/assets/NotFoundScreen-_z9DP-yZ.js +1 -0
- package/dist/assets/NotificationRoutes-Djfnd3nr.js +1 -0
- package/dist/assets/OAuthConsentScreen-BwhWE0vr.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-CVL93nhx.js +1 -0
- package/dist/assets/PeopleRoutes-D3dMO3Oa.js +22 -0
- package/dist/assets/PerformanceRoutes-OkJlvpcW.js +1 -0
- package/dist/assets/{Preview-DIWTyMQY.js → Preview-C1-82nYG.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DXq_HXCX.js → QBOConnectionScreen-BcBoTeUC.js} +1 -1
- package/dist/assets/{ReferralListScreen-DNdLnut4.js → ReferralListScreen-CAfKHWlD.js} +2 -2
- package/dist/assets/ReimbursementApprovalRoutes-GMPo499D.js +1 -0
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-ilSdM3T_.js +1 -0
- package/dist/assets/{ReimbursementRoutes-Bb9JPi0m.js → ReimbursementRoutes-BCzqaCd0.js} +12 -12
- package/dist/assets/ReportsRoutes-sECeRqYD.js +1 -0
- package/dist/assets/RewardsRoutes-DccykIgv.js +1 -0
- package/dist/assets/ScreenRoutes-CX9dtujm.js +2 -0
- package/dist/assets/SettingsRoutes-DkiGjvE8.js +57 -0
- package/dist/assets/SetupPagesScreen-D5qsyJcA.js +29 -0
- package/dist/assets/SignInScreen-BoIMwzOO.js +1 -0
- package/dist/assets/SignOutScreen-Paf7hNrb.js +9 -0
- package/dist/assets/TaskListScreen-4INm3wUC.js +9 -0
- package/dist/assets/TaskRoutes-BqUtiKFz.js +9 -0
- package/dist/assets/TransactionDetailRoutes-Cbya-6yV.js +1 -0
- package/dist/assets/{TransactionDetailScreen-DB5lxQrk.js → TransactionDetailScreen-DSbk67SD.js} +2 -2
- package/dist/assets/TransactionListRoutes-18Xdo-CX.js +1 -0
- package/dist/assets/TreasuryRoutes-BLFuB0DM.js +37 -0
- package/dist/assets/{VendorsRoutes-CwYVQ8VQ.js → VendorsRoutes-C7cLMHN4.js} +19 -19
- package/dist/assets/WiseConfirmationScreen-CnHMJMAk.js +12 -0
- package/dist/assets/ZeniAccountRoutes-DEFgshzq.js +57 -0
- package/dist/assets/ZeniAccountStatementScreen-CahtqojG.js +9 -0
- package/dist/assets/{accountMappingHelper-s2xO6MjH.js → accountMappingHelper-DB6fTWzq.js} +1 -1
- package/dist/assets/{analytics-Ba6zmRos.js → analytics-CGnNJ1B3.js} +1 -1
- package/dist/assets/{analyticsHelper-Cq2pq-lr.js → analyticsHelper-B3wwzf_V.js} +1 -1
- package/dist/assets/{core-D6ttr5iw.js → core-BQch-SEa.js} +2 -2
- package/dist/assets/{decodeURIComponentSafe-D0vQ4d1Q.js → decodeURIComponentSafe-BlZKyc9K.js} +1 -1
- package/dist/assets/dnd-DtFKtvlf.js +6 -0
- package/dist/assets/{empty-B81gHGCB.js → empty-CnUVdn1j.js} +1 -1
- package/dist/assets/empty-DBOryUxv.js +1 -0
- package/dist/assets/{emptyVideoElement-DNxKi3mL.js → emptyVideoElement-CMOPMd9b.js} +1 -1
- package/dist/assets/epic-Cn810zkq.js +2 -0
- package/dist/assets/{getLocaleForTenant-O3Y2pcaQ.js → getLocaleForTenant-CQkHA1My.js} +1 -1
- package/dist/assets/{index-DL-oj321.js → index-BDydFdLA.js} +1 -1
- package/dist/assets/{index-pFVjg2n3.js → index-BJcfizgW.js} +1 -1
- package/dist/assets/{index-DK3W-xXd.js → index-BKzmRWFJ.js} +2 -2
- package/dist/assets/{index-ilZtTEZn.js → index-C6_U0a3I.js} +40263 -45717
- package/dist/assets/{index-CETE-7wR.js → index-C75IsDSW.js} +1 -1
- package/dist/assets/{index-DyaqeLYa.js → index-CdbMVgUL.js} +1 -1
- package/dist/assets/{empty-0_eSm854.js → index-CjwtZFvv.js} +1 -1
- package/dist/assets/index-DZkdTIsz.js +1 -0
- package/dist/assets/{index-BUmr5maU.css → index-R6GjjTB3.css} +1 -1
- package/dist/assets/{lexical-T2nlwAPk.js → lexical-BBRytn_R.js} +1 -1
- package/dist/assets/{liveblocks-CS0rfBBF.js → liveblocks-Bi6jUyhM.js} +1 -1
- package/dist/assets/{lottie-CZmubsAo.js → lottie-CB8QpQmy.js} +1 -1
- package/dist/assets/{mui-vLo47rlo.js → mui-D4v6d6vq.js} +1 -1
- package/dist/assets/{pathToGoBack-CkJN8BOO.js → pathToGoBack-iBZHU0oy.js} +1 -1
- package/dist/assets/{pdf-CdoB_huE.js → pdf-BNQvW5mJ.js} +3 -3
- package/dist/assets/{pdf-lib-RRzqb1kw.js → pdf-lib-BkMwujYN.js} +1 -1
- package/dist/assets/{plaid-IKw4XOsd.js → plaid-DWupRB-M.js} +1 -1
- package/dist/assets/{pusher-Cj6_igRe.js → pusher-Dkp2Jrxx.js} +1 -1
- package/dist/assets/{react-D95yXzXQ.js → react-4loJCMRC.js} +1 -1
- package/dist/assets/{react-BkKsXl-3.js → react-BnoWjI1_.js} +1 -1
- package/dist/assets/{react-CCfELnN3.js → react-CZ9x9aZs.js} +1 -1
- package/dist/assets/{react-BDJBiih3.js → react-CtfVTLhb.js} +1 -1
- package/dist/assets/{react-BbjDrfEs.js → react-D6_PfBEK.js} +1 -1
- package/dist/assets/{react-CppN-oCz.js → react-DZeesIBx.js} +1 -1
- package/dist/assets/{recharts-BDyAk4nR.js → recharts-6oV2OwTy.js} +3 -3
- package/dist/assets/{routePaths-C1rKvS5o.js → routePaths-CGRC3p-8.js} +1 -1
- package/dist/assets/{sentry-CEfOando.js → sentry-DwScFzsh.js} +1 -1
- package/dist/assets/{url-BQNo9gT5.js → url-CA34r-nZ.js} +1 -1
- package/dist/assets/{url-C9_bAZjF.js → url-uJs8N0Ig.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-Btwm3vJo.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-0ztMF6vl.js +1 -0
- package/dist/assets/{useDeviceId-DISstVTH.js → useDeviceId-B2Yksaa2.js} +1 -1
- package/dist/assets/useInitialThreadRequest-B5cDCn22.js +1 -0
- package/dist/assets/{utils-DKj7mVPA.js → utils-Dwr2wQrV.js} +2 -2
- package/dist/assets/{withTransactionSidePanel-DeW-W6do.js → withTransactionSidePanel-D1jVzWuM.js} +4 -4
- package/dist/assets/zeni-epic-state-DxVQhBoO.js +13 -0
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-BqX5wkCR.js +0 -1
- package/dist/assets/AddressScreen-ScWWmTbP.js +0 -9
- package/dist/assets/AiCfoScreen-quWQqhzX.js +0 -22
- package/dist/assets/BillPayApprovalRoutes-CQmYX8YN.js +0 -1
- package/dist/assets/BillPayRoutes-jZS0wJcj.js +0 -119
- package/dist/assets/BusinessVerificationPageScreen-DFgVqXvI.js +0 -9
- package/dist/assets/CardsAiCfoScreen-BbBCL2AM.js +0 -14
- package/dist/assets/ChargeCardRoutes-BPGek5pB.js +0 -71
- package/dist/assets/ConnectionAuthScreen-BbANlW5J.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-kiJ2IeW7.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-6ipmFo_1.js +0 -30
- package/dist/assets/DefaultTenantHome-B6se2qjz.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-jS6brB2p.js +0 -18
- package/dist/assets/DrawerScreen-D0g6PABS.js +0 -1
- package/dist/assets/EntityDetailRoutes-qim0q068.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-D3rXxAM_.js +0 -25
- package/dist/assets/FeaturePreviewScreen-Y7t6ABdh.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-BUpxwCNc.js +0 -1
- package/dist/assets/MagicLinkRoutes-5wgvqx65.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-CelaLjKf.js +0 -12
- package/dist/assets/MobileAppDrawer-Sx7ydj7A.js +0 -1
- package/dist/assets/NotFoundScreen-BDl5tn8o.js +0 -1
- package/dist/assets/NotificationRoutes-Cdcu8PTz.js +0 -1
- package/dist/assets/OAuthConsentScreen-C5pyboC-.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-DjwWiUAb.js +0 -1
- package/dist/assets/PeopleRoutes-x62_g_WP.js +0 -22
- package/dist/assets/PerformanceRoutes-DQciMsYC.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-BazeprVG.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-CPr7Je_Q.js +0 -1
- package/dist/assets/ReportsRoutes-DB2v4EPm.js +0 -1
- package/dist/assets/RewardsRoutes-ChJyJSHY.js +0 -1
- package/dist/assets/ScreenRoutes-8R8Dd2d9.js +0 -2
- package/dist/assets/SettingsRoutes-oK_kou4I.js +0 -57
- package/dist/assets/SetupPagesScreen-CVKPKeC9.js +0 -29
- package/dist/assets/SignInScreen-C7vB3Bra.js +0 -1
- package/dist/assets/SignOutScreen-CQYa9Dvp.js +0 -9
- package/dist/assets/TaskListScreen-WRcn05lO.js +0 -9
- package/dist/assets/TaskRoutes-DoWinBID.js +0 -9
- package/dist/assets/TransactionDetailRoutes-B4ryZwp2.js +0 -1
- package/dist/assets/TransactionListRoutes-6SM8gNlu.js +0 -1
- package/dist/assets/TreasuryRoutes-DHuVCY9q.js +0 -37
- package/dist/assets/WiseConfirmationScreen-DLnf9dkP.js +0 -12
- package/dist/assets/ZeniAccountRoutes-u96OM2YN.js +0 -73
- package/dist/assets/ZeniAccountStatementScreen-D9UEHLLF.js +0 -9
- package/dist/assets/dnd-C751Xq24.js +0 -6
- package/dist/assets/epic-BpVO28im.js +0 -2
- package/dist/assets/index-lXh6fiHl.js +0 -1
- package/dist/assets/index-xNwL9wH4.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BDn05q_k.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-33WX5dhg.js +0 -1
- package/dist/assets/useCashManagementBanner-CBJfpbK7.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-Cvnaf2Z-.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-BzWsu8a4.js +0 -1
- package/dist/assets/useInitialThreadRequest-Bx57kb_d.js +0 -1
- package/dist/assets/zeni-epic-state-Cl3jFj7z.js +0 -13
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-CS0rfBBF.js";import{u as me,j as i,h as le,g as he,i as Ve,N as oa,s as _t,n as Pe,t as An,o as ts,p as ce}from"./core-D6ttr5iw.js";import{f8 as Pt,RU as ns,fk as wt,bt as Te,RV as rs,RW as ss,eZ as pn,RX as Dn,f6 as _n,RY as Pn,RZ as wn,R_ as vn,R$ as Fn,f7 as Tn,fj as xn,S0 as Bn,S1 as cs,fd as os,fc as is,S2 as ds,C3 as Rn,fm as ia,S3 as ls,S4 as us,e$ as ms,e_ as Cs,fz as Ze,ff as Ln,fe as On,S5 as ps,fg as hs,BA as fs,Bz as gs,BD as Ss,BF as bs,fs as ys,eW as Un,S6 as Is,S7 as ks,fx as jn,S8 as Es,fy as yt,BL as As,BI as Ds,eX as ge,S9 as qa,fC as xe,fD as Be,fE as Re,gx as da,cv as la,Sa as ua,Sb as vt,uR as $a,kG as za,Sc as Za,Cj as ka,fn as Qe,Cl as Ft,kw as Mn,Sd as ma,C7 as _a,Se as _s,Sf as Ps,Ca as Qa,Sg as ws,Qf as Ja,fi as Nn,Cg as Sa,hW as vs,Sh as Vn,f9 as Ca,bo as Fs,Si as Ts,gi as Xa,gh as et,CP as xs,gg as at,PX as Bs,Sj as Hn,co as Gn,cQ as Rs,Qe as wa,Do as $n,Sk as hn,C_ as Pa,Sl as zn,Dp as Ls,QE as Os,Dq as Us,Ev as js,uc as Ms,Ep as Ns,Sm as Vs,Ck as sa,Sn as Hs,So as Gs,Sp as $s,Sq as zs,Sr as Zs,Ss as Tt,St as Ys,CA as Zn,Ct as Ws,Su as Ks,gz as qs,CJ as Yn,CN as Wn,gy as Qs,Sv as Js,Da as Kn,Sw as Xs,Sx as ec,Sy as ac,CL as qn,Cw as Qn,Cd as Jn,CF as Xn,CD as er,CH as tc,Sz as ar,SA as nc,fu as rc,fv as sc,fw as cc,SB as tt,fo as tr,cS as xt,SC as oc,SD as ic,SE as dc,SF as lc,CV as It,Dh as uc,Dd as mc,CR as Cc,Df as pc,D5 as hc,D7 as fc,SG as nr,Dn as Ga,Ke as gc,SH as Sc,SI as bc,SJ as yc,SK as rr,SL as Ic,DK as kc,CZ as sr,CU as Ne,CY as Ec,SM as Ac,SN as Dc,C4 as _c,SO as cr,fh as or,SP as Pc,C6 as wc,C5 as fn,SQ as vc,SR as Fc,SS as Tc,ML as xc,ST as Bt,SU as Bc,xS as ir,le as Rc,hM as Lc,DP as Oc,SV as dr,f3 as Uc,f4 as jc,SW as Mc,dj as Nc,fl as Vc,DF as Hc,Dz as qe,bs as Gc,bJ as $c,cA as zc,bK as Zc,LY as Yc}from"./zeni-epic-state-Cl3jFj7z.js";import{I as Le,cq as lr,r as we,cr as ur,cs as mr,ct as Wc,a as Xe,$ as Rt,cu as Kc,cv as qc,X as Cr,c as pr,_ as hr,s as ye,Q as ue,d as Y,aq as ya,cw as fr,cx as Qc,cy as Jc,z as te,w as va,cf as nt,cz as Xc,cA as eo,cB as ao,Z as Fa,aR as Ye,bs as Lt,cC as to,A as Ta,k as rt,m as Ot,e as X,a8 as st,cD as no,bF as ba,cE as kt,cF as ro,K as Ut,cG as so,at as gr,a3 as Et,cH as co,Y as Sr,g as br,cI as oo,cJ as io,cK as lo,cL as uo,cM as mo,cN as Co,o as Ya,cO as po,cP as ho,cQ as ht,S as fo,cR as go,cS as So,cT as bo,cU as yo,cV as Io,i as ko}from"./index-ilZtTEZn.js";import{n as He,D as yr,S as Eo}from"./mui-vLo47rlo.js";import{a as r}from"./sentry-CEfOando.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-33WX5dhg.js";import{M as Ie}from"./MobileAppDrawer-Sx7ydj7A.js";import{d as jt}from"./recharts-BDyAk4nR.js";import{g as _e,a as Ba,b as Ir,c as Oe,d as Ue,e as Je,f as ea,h as aa,A as Ao,i as Mt,P as Do,j as Nt,s as Ia,k as kr,l as ca,m as Er,n as _o,o as Ar,p as Po,S as gn}from"./SetupPagesScreen-CVKPKeC9.js";import{u as Dr}from"./useInitialThreadRequest-Bx57kb_d.js";import ct from"./NotFoundScreen-BDl5tn8o.js";import{u as Vt}from"./useChargeCardPusherEvents-Cvnaf2Z-.js";import{n as Sn}from"./utils-DKj7mVPA.js";import{t as wo}from"./AddressScreen-ScWWmTbP.js";import"./analytics-Ba6zmRos.js";import"./plaid-IKw4XOsd.js";import"./dnd-C751Xq24.js";import"./stripe-DMRn4zHo.js";import"./lottie-CZmubsAo.js";import"./lexical-T2nlwAPk.js";import"./pdf-CdoB_huE.js";import"./analyticsHelper-Cq2pq-lr.js";import"./routePaths-C1rKvS5o.js";import"./BusinessVerificationPageScreen-DFgVqXvI.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]="de537abb-076d-4e64-a366-c5e6c3d59f19",e._sentryDebugIdIdentifier="sentry-dbid-de537abb-076d-4e64-a366-c5e6c3d59f19")}catch{}})();const vo=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}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Pr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>ns(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:bn}}}=Xe.getLocalizedStrings(),Fo=e=>Ln(e,!1),To=e=>On(e.name,!1);function xo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Te(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(rs()),a(ss()),a(pn())},[a]);const v=i(A=>Dn(A.cardPolicyState)),m=i(A=>_n(A.cardPolicyState)),M=i(A=>Pn(A.cardPolicyState)),B=i(A=>wn(A.cardPolicyState)),R=i(A=>vn(A.cardPolicyState)),p=i(A=>Fn(A.cardPolicyState)),h=i(A=>Tn(A.cardPolicyState)),F=i(A=>Pt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),w=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(xn())},[a,v]),Pr();const E=i(A=>Bn(A.createCardPolicyState)),U=i(A=>cs(A.createCardPolicyState)),y=i(A=>os(A.cardPolicyState)),k=i(A=>is(A.cardPolicyState)),x=i(A=>ds(A.createCardPolicyState)),d=i(A=>Rn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>m.map(Fo),[m]),j=r.useMemo(()=>h.map(To),[h]),H=r.useMemo(()=>d.cards.filter(A=>!lr(A.status.code)).map(_r),[d.cards]),O=v==="Completed"&&d.fetchState==="Completed"&&w==="Completed";r.useEffect(()=>{O&&x==null&&a(ls({cardsMasterList:H,defaultRequireReceiptAmount:l,suggestedAllowMerchants:M,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[w,a,O,x,H,l,M,B,R,p]);const L=r.useMemo(()=>jt(A=>{a(wt(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),$=E.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const A=we(n.state?.pathnameStackToGoBack),K=A.poppedPathname??_;e(K,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(A=>{a(us(A))},[a]),I=r.useCallback(A=>{const K=ur(A);a(ms({templates:[K]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(Cs(A))},[a]),W=r.useCallback(()=>{a(pn())},[a]),J=r.useRef($);r.useEffect(()=>{const A=J.current;J.current=$,$==="Completed"&&A!=="Completed"&&U!=null&&(a(Ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?E.error?.message??bn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:bn.createPageTitle,onBackClick:D,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:T})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Wc,{formDraft:x,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:F==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:y,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:T,onBackClick:D,onCancelClick:G,onClickMenuIcon:u,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:W})]}):c.jsx(oa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Bo}}}=Xe.getLocalizedStrings(),Ro=e=>Ln(e,!1),Lo=e=>On(e.name,!1);function Oo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),b=Le(),g=Te(b?.loggedInUserRoleMap),[S,P]=r.useState(!1),u=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:T,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ps(o)),M=i(o=>Dn(o.cardPolicyState)),B=i(o=>_n(o.cardPolicyState)),R=i(o=>Pn(o.cardPolicyState)),p=i(o=>wn(o.cardPolicyState)),h=i(o=>vn(o.cardPolicyState)),F=i(o=>Fn(o.cardPolicyState)),l=i(o=>Tn(o.cardPolicyState)),w=i(o=>Pt(o.cardPolicyState)),E=i(o=>Rn(o)),U=i(o=>a!=null?hs(o.cardPolicyState,a):void 0),y=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?fs(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(gs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(xn())},[s,M]),Pr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{E.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[E.fetchState,s]);const x=r.useMemo(()=>B.map(Ro),[B]),d=r.useMemo(()=>l.map(Lo),[l]),f=r.useMemo(()=>E.cards.filter(o=>!lr(o.status.code)).map(_r),[E.cards]);Rt({isDataReady:y!=null});const j=r.useMemo(()=>{if(y!=null)return Kc({draft:y,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:F})},[y,f,x,d,k,R,p,h,F]),[H,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||H!=null||j==null||(L.current=!0,O(j))},[H,j]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=m.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),A=o.poppedPathname??G;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const A=ur(o);s(Ss(A)),s(bs(a))},[s,a]),W=r.useRef(D);r.useEffect(()=>{const o=W.current;W.current=D,D==="Completed"&&o!=="Completed"&&(s(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const J=D==="Error"?m.updateFetchState.error?.message??Bo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(oa,{to:"..",replace:!0}):H!=null&&M==="Completed"&&E.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(qc,{templateName:m.template?.name??"",formDraft:H,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:T,onAskAiCfoClick:v,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:T,onAskAiCfoClick:v})]})}function wr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function vr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(ys(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=Xe.getLocalizedStrings(),No=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 Vo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Te(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),u=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:T}=C(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=C(Y.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Is(_)),R=i(_=>Bn(_.createCardPolicyState)),p=i(_=>ks(_.createCardPolicyState)),h=i(_=>p==null?[]:jn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),F=R.fetchState==="In-Progress"?Math.max(h.length,1):0,l=i(_=>Es(_.createCardPolicyState)),w=ya(R.fetchState);r.useEffect(()=>{if(w==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:l,kind:"created_policy"}))});else if(w==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,l,h,w]);const E=B.fetchState.fetchState;r.useEffect(()=>{E!=="Not-Started"&&E!=="Error"||a(As())},[a,E]);const U=B.archiveFetchState.fetchState,y=ya(U);r.useEffect(()=>{y==="In-Progress"&&U==="Completed"&&a(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,y]);const k=r.useMemo(()=>B.templates.map(No),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=k.length>0||F>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:W}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=Cr(),A=pr(),K=hr(),ne=i(oe=>Un(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=vr("card_policy"),ve=r.useMemo(()=>wr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=K&&A&&W!=null&&!J,re=r.useCallback(oe=>{if(W==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${W}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,W]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Fe=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Fe,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Fe,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:b,isFileUploadEnabled:T}),f=v&&d!=null?c.jsx(fr,{...d}):null,j=m&&f==null,H=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(Ds(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Qc,{onBackClick:H,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{policies:k,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:F,onBackClick:H,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:M})]})}function Ho(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),b=Le(),g=Te(b?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const T=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(Y.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(Y.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,F=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),l=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:v,isBookKeepingTenant:R,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:h}),w=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(q=>da(q,s.companyId)),U=la(E.controllers),{creditAccount:y,creditAccountRepayment:k}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!T&&l&&m,f=i(q=>vt(q,n,d,l)),[j,H]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",W=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(u(!0),setTimeout(()=>{t(Za()),W&&t(Ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,W]),r.useEffect(()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(H(!0),t(ka(n,d,!1)))},[j,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(Ft()),x!=="Completed"&&x!=="In-Progress"&&t(Mn())},[y.fetchState,k.fetchState,t,l,m,g,x]);const J=()=>{if(a!=null&&n!=null){t(Za());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Je(l,F,w,m),K=Ba(l,m,g,y,k),ne=Ir(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Xc,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:K,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:y,classListFetchState:x,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Fr="charge-card-transaction-update",Tr="charge-card-transaction-created",xr="charge-card-transaction-declined",Br="charge-card-transaction-updated",Rr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Go="charge-card-department-updated",Lr="charge-card-repayment-completed",Or="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ra],zo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(_s({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Zo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(M=>ge(M)),{useFeatureGate:b}=ue(),{isFeatureEnabled:g}=b(Y.isCardsCommentingEnabled),[S,P]=r.useState(!1),u=i(M=>ma(M)),C=Dr(s.companyId,{clearParams:u.fetchState==="Completed"}),T=r.useCallback(()=>{const M=we(t.state?.pathnameStackToGoBack),B=M.poppedPathname??Yo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(Vt({events:ha(v,$o),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(zo,{onBackClick:T,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(eo,{onBackClick:T})}const Yo=e=>`/${e}/cards`,Wo={containerWidth:new Ta(100,58)},Ko=({appContent:e})=>{const n=Fa(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[T,v]=r.useState(!1),[m,M]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ye.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,F=i(I=>Ps(I,s)),l=F.chargeCard,w=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:E}=ue(),{isFeatureEnabled:U}=E(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:y}=E(Y.isDebitCardFeatureEnabled),k=Re(y,R),x=Oe({isDebitCardFeatureEnabled:y,isBankingOnlyTenant:k}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),j=xe(R),H=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:U,isBookKeepingTenant:H,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&w!=="In-Progress"&&w!=="Completed"&&(t(Qa()),P(!0)),u===!1&&F.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,F.fetchState,S,w]);const $=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(F.fetchState==="Completed"){if(T===!1&&($===!1||$&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(T&&F.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(ws({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}},[F.fetchState,l?.type.code,T,F.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Nn(I.userState,B.userId)),G=()=>{l?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{F.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&T===!1&&(setTimeout(G,3e3),v(!0))},[F.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=I=>{M(I)};if(w!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Jo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(qo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Lt(),chargeCardDetailState:F,signedInUserToken:_,navigate:a,currentTenant:R,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=vs(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const g=Vn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let u=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Fs())||C,showMenuIcon:u,shippingAddress:b,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(xs(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(Ts({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(to),Qo=He.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
width: ${e=>`${Wo.containerWidth.value(e.windowSize)}%`};
|
|
5
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
6
|
-
`,Jo=He.div`
|
|
7
|
-
display: flex;
|
|
8
|
-
min-height: 100%;
|
|
9
|
-
width: 100%;
|
|
10
|
-
flex: 1 1 auto;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
align-items: center;
|
|
13
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,Wa=Xe.getLocalizedStrings().dateFormat,Xo={overlayWidth:new Ta(100,100,58)},Ur=[Lr,ot],ei=new Set(Ur),ai=Pe(function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Os(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Us(e.depositAccountState,e.depositAccountListState)}},function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:b,isCashbackInfoFetchStateCompleted:g,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:P,controllerEmails:u,paymentDetails:C,productInformation:T,cashbackInformation:v,paymentSourceInformation:m,creditAccountInformation:M,debitAccountInformation:B,paymentInitiatedDate:R,sourcePage:p}=n,{tenantEmailDomain:h}=a,F=()=>{e($n(!0));const l=ea(a);l!=null&&l!==""&&e(Pa(l,!0,!0)),e(Qe(!0))};return{onBackNavigation:()=>{if(g&&S&&P&&v!=null&&X.trackCardsPayEarlyFormClick(u,T,v,"Back",C.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:C.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:C.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:C.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:C.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:R?.add(3,"day").format(Wa.visual.MMMDCommaYYYYformat),paymentInitiatedDate:R?.format(Wa.visual.MMMDCommaYYYYformat)},m,M,B),p==="cardPaymentHistory")n.closeDrawerHandler(!0),e(zn());else{const l=aa(h);t(l)}},onUpdatePaymentAccountStatus:(l,w,E)=>{e(Ns(l,w,"bill_pay","bill_pay_detail",E))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:l=>{e(Ms("external_account",l))},onEstablishConnectionClick:l=>{e(js(l,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:l=>{ei.has(l)&&F()},onPusherSubscribed:F}})(st(no)),Zt=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:b,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isDebitCardInfoFetchStateCompleted:u,isCreditCardInfoFetchStateCompleted:C,isCashbackInfoFetchStateCompleted:T,paymentInitiatedDate:v,retryRepayment:m})=>{const M=le(),{useDynamicConfig:B}=ue(),{configValue:R}=B(Ye.zeniAccountsConfig),p=Bs(R),h=i(A=>Hn(A)),{creditAccount:F}=i(A=>ua(A)),l=i(A=>ge(A)),w=Ot(),E=Fa(),U=me(),y=te.getSignedInUser(),k=Le(),[x,d]=r.useState(!1),[f,j]=r.useState(!1),{configValue:H}=B(Ye.zeniCardsConfig),O=H.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??H.default_credit_card_auto_pay_threshold??Ao,L=Gn(k?.loggedInUserRoleMap),z=Rs(k?.loggedInUserRoleMap),$=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,_=i(A=>wa(A,l.companyId)),D=_.companyChargeCardInfo?.primaryFundingAccount,G=_.allFundingAccounts.find(A=>A.id===D?.accountId),Q=i(A=>da(A,l.companyId)),I=la(Q.controllers);r.useEffect(()=>{if(h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&U($n()),h.fetchState==="Completed"&&!f){const A=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,K=h.transferFromAccounts.find(q=>q.id===A);let ne;if(b==="cardPaymentHistory"&&m){const q=m.paymentAccountId!=null?h.transferFromAccounts.find(ke=>ke.id===m.paymentAccountId):void 0;ne={amount:m.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:Sn(),transferFrom:q??K}}else ne={amount:{amount:F.balance.amount+F.hold.amount,currencyCode:F.balance.currencyCode,currencySymbol:F.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:Sn(),transferFrom:K};U(hn(ne)),j(!0)}},[h.fetchState,f,b,m,h.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,F.balance.amount,F.balance.currencyCode,F.balance.currencySymbol,F.hold.amount,U]);const N={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:G?.accType==="depositAccount",creditCardPaymentSourceAccountName:G?.label,creditCardPaymentSourceAccountType:G?.accType,creditCardPaymentSourceLastFourDigits:G?.accountLast4,creditCardPaymentSourceBalance:G?.accountBalance?.available?.amount??0};if(r.useEffect(()=>{_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&U(Pa(l.companyId,!0))},[_.fetchState]),r.useEffect(()=>{h.updateStatus==="Completed"&&P!=null&&T&&C&&u&&X.trackCardsPayEarlyPayNowClick(I,s,P,h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:v?.add(3,"day").format(Wa.visual.MMMDCommaYYYYformat),paymentInitiatedDate:v?.format(Wa.visual.MMMDCommaYYYYformat)},N,g,S)},[h.updateStatus,P,T,C,u,v]),r.useEffect(()=>{h.fetchState==="Completed"&&P!=null&&T&&C&&u&&!x&&e&&f&&P!=null&&(X.trackCardsPayEarlyFormView(I,s,P,t,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,F.balance.amount,N,g,S),d(!0))},[h,T,C,u,x,e,f]),y==null)throw Error("Can't access invite people page without signing in...");const W=()=>{n(!0),U(zn())},J=ea(l),o={events:e?ha(J,Ur):[],eventCallback:(A,K,ne)=>{ne.onEventReceived(A)},onSubscribed:A=>{A.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(yr,{onClose:()=>{W()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Xo.overlayWidth.valuePercentage(E),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:w.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(ti,{onClick:A=>A.stopPropagation(),children:c.jsx(ai,{...o,closeDrawerHandler:n,navigate:M,paymentDetails:h,creditAccountSpentAmount:a,onTransferClick:()=>{T&&C&&u&&P!=null&&X.trackCardsPayEarlyFormClick(I,s,P,"Pay Now",h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},N,g,S),U(Ls({companyId:l.companyId}))},onDismissClick:W,onSaveChangesToLocalStore:A=>{U(hn(A))},currentTenant:l,hasZeniAccountsAdminAccess:L,isZeniAccountsUser:z,isZeniAccountSetupEnabled:$,productInformation:s,sourcePage:b,controllerEmails:I,autoPayThreshold:O,paymentSourceInformation:N,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isCashbackInfoFetchStateCompleted:T,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:u,paymentInitiatedDate:v,maxInsuredAmount:p.maxInsuredAmount})})})})},ti=He(Eo)`
|
|
15
|
-
display: flex;
|
|
16
|
-
min-height: 100%;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
`,Yt=e=>e!=null&&typeof e=="object"?e:null,de=e=>typeof e=="string"?e:void 0,Me=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ka=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!Ka(n.transaction_status)&&!!Ka(n.transaction_type)},Wt=(e,n)=>{const t=e?.card_status;if(!Ka(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},At=[Fr,Tr,xr,Br,Rr,pa,Ht,ot,Gt,$t,zt],jr=[La,Ra],ni=new Set([...At,...jr]),St=Xe.getLocalizedStrings().dateFormat,ri=Pe(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:b}=n,g=te.getSignedInUser(),S=e.tenantState.currentTenantId,P={userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:S??""},u=vt(e,a,t,b),C=Ks(e,a),T=qs(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:C,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:P,isSnackbarOpen:T.isSnackbarOpen,cardsEndPoint:`${gr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:b,cardProviderId:g,includeCreditAccountInfo:S,setIsPaymentOpen:P,controllerEmails:u,productInformation:C,cashbackInformation:T,primaryFundingAccountDetails:v,creditAccountInformation:m,debitAccountInformation:M,isChargeCardFeatureEnabled:B}=n,{tenantEmailDomain:R}=a;return{onEventReceived:(p,h)=>{(({event:F,data:l,cardId:w,dispatch:E,subscribedEvents:U})=>{const y=Yt(l);switch(F){case La:case Ra:return void E(_a(!0));case Fr:{const k=de(y?.card_id);if(k==null||k!==w)return;const x=de(y?.transaction_id),d=y?.transaction_status;return x!=null&&Ka(d)?void E(Ys({transactionId:x,transactionStatus:d})):void E(sa(w,null,null,!0))}case pa:{const k=de(y?.card_id)??w;if(k!==w)return;const x=Wt(y,k);return x!=null?void E(Tt(x)):void E(Sa(w,!0))}case Ht:{const k=de(y?.card_id)??w;if(k!==w)return;const x=de(y?.currency_code),d=de(y?.currency_symbol),f=Me(y?.balance);return x!=null&&d!=null&&f!=null?(E(Zs({cardId:k,currencyCode:x,currencySymbol:d,balance:f,hold:Me(y?.hold),dailyPurchaseSpends:Me(y?.daily_purchase_spends),monthlyPurchaseSpends:Me(y?.monthly_purchase_spends),dailyWithdrawals:Me(y?.daily_withdrawals),monthlyWithdrawals:Me(y?.monthly_withdrawals)})),void E(Qe(!0))):(E(Sa(w,!0)),void E(Qe(!0)))}case ot:{const k=de(y?.currency_code),x=de(y?.currency_symbol),d=Me(y?.available_amount),f=Me(y?.balance_amount);return k!=null&&x!=null&&d!=null&&f!=null?void E(zs({currencyCode:k,currencySymbol:x,available:d,balance:f,hold:Me(y?.hold_amount),cashback:Me(y?.cashback_amount)})):void E(Qe(!0))}case Tr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E($s({cardId:k,transaction:x})):void E(sa(w,null,null,!0))}case xr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E(Gs({cardId:k,declineReason:de(y?.decline_reason),transaction:x})):void E(sa(w,null,null,!0))}case Br:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E(Hs({cardId:k,transaction:x})):void E(sa(w,null,null,!0))}case Rr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=de(y?.transaction_id),d=y?.attachment_file_paths;return x!=null&&Array.isArray(d)&&d.every(f=>typeof f=="string")?void E(Vs({cardId:k,transactionId:x,attachmentFilePaths:d})):void E(sa(w,null,null,!0))}case Gt:case $t:case zt:{const k=de(y?.card_id);if(k==null||k!==w)return;E(Sa(w,!0))}}})({event:p,data:h,cardId:t,dispatch:e,subscribedEvents:ni})},onPusherSubscribed:()=>{e(Sa(t,!0)),e(sa(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,B))},onFetchChargeCardTransactionList:(p,h)=>{e(sa(t,p,h))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{g!=null&&e(at(p,"ChargeCardHolder",t))},onResendOtp:p=>{g!=null&&e(et(p,"ChargeCardHolder",t))},onVerifyOtp:(p,h)=>{g!=null&&e(Xa(p,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:p=>{p!=null&&te.saveZeniOtpTokenForCardHolder(p,t)},onColorCodeChange:p=>{e(tc(t,p))},onLockChargeCard:(p,h)=>{e(er(p,t,h))},onUnlockChargeCard:p=>{e(Xn(p,t))},onCloseChargeCard:p=>{e(Jn(t,p))},onFetchChargeCardsRecurringExpenses:()=>{e(Qn([t]))},updateChargeCardName:(p,h)=>{e(qn(p,t,h))},updateChargeCardTransactionAttachments:(p,h)=>{h!=null&&e(ac({transactionId:p,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,h,F,l)=>{e(ec({chargeCardId:h,transactionId:p,fetchState:F,error:l}))},updateChargeCardTransactionReceiptsShowTick:(p,h,F)=>{e(Xs({chargeCardId:h,transactionId:p,shouldShowTick:F}))},onChargeCardRevokeInviteClick:()=>{e(Kn(t))},updateChargeCardTransactionIsViewReceiptClicked:(p,h,F)=>{e(Js({chargeCardId:h,transactionId:p,isViewReceiptClicked:F}))},onChargeCardTransactionRowClick:(p,h)=>{const F=ye(b.state?.pathnameStackToGoBack,b.pathname);s(`../../transaction/${p}/${h}`,{state:{pathnameStackToGoBack:F}})},onBackClick:()=>{const p=we(b.state?.pathnameStackToGoBack),h=aa(R);s(h,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Qs())},onUpdateDebitCardPinAttempt:p=>{e(Wn(t,p)),p==="success"&&e(Ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,h)=>{p?e(Ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):h!=null&&e(Ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h.message}]}))},updateSpendLimit(p,h,F,l){e(Yn(p,h,F.code,l))},shouldOpenCreditCardPaymentDrawer(p){p&&T!=null&&X.trackCardsPayEarlyClick(u,C,T,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:v?.accType==="depositAccount",creditCardPaymentSourceAccountName:v?.label,creditCardPaymentSourceAccountType:v?.accType,creditCardPaymentSourceLastFourDigits:v?.accountLast4,creditCardPaymentSourceBalance:v?.accountBalance?.available?.amount??0},m,M),P(p)}}})(st(so));function si(){const e=le(),n=me(),t=he(),{cardId:a}=Ve(),[s,b]=r.useState(!1),[g,S]=r.useState(!1),{useDynamicConfig:P}=ue(),u=te.getSignedInUser(),C=i(Z=>ge(Z)),T=i(Z=>qa(Z).firstViewAfterActivation),v=i(Z=>Z.classListState.fetchState),{configValue:m}=P(Ye.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:M}=P(Ye.zeniCardsConfig),B=M.enable_card_controls_for_company_ids,R=M.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(B)&&B.includes(C.companyId),[p,h]=r.useState(!1),[F,l]=r.useState(!1),{useFeatureGate:w}=ue(),{isFeatureEnabled:E}=w(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=w(Y.isDebitCardFeatureEnabled),y=Re(U,C),k=Oe({isDebitCardFeatureEnabled:U,isBankingOnlyTenant:y}),{isFeatureEnabled:x}=w(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=w(Y.isCardsCommentingEnabled),f=Be(C),j=xe(C),H=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:E,isBookKeepingTenant:f,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:H}),L=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,$=!C.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const _=i(Z=>wa(Z,C.companyId)),{creditAccount:D,creditAccountRepayment:G}=i(Z=>ua(Z)),Q=te.getZeniOtpTokenForCardHolder(a),I=i(Z=>vt(Z,a,$,O)),{isAiCfoAccessEnabled:N,onAskAiCfoClick:W}=xa({mobileExploreReferrer:"Card Detail"});Rt({isDataReady:I.fetchState==="Completed"});const J=i(Z=>ma(Z)),o=I.chargeCard,A=Le(),K=Te(A?.loggedInUserRoleMap),ne=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_virtual_debit_card",q=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_physical_credit_card",ke=o?.type.code==="business_virtual_debit_card"||o?.type.code==="business_virtual_credit_card",ve=o?.type.code==="business_virtual_debit_card",fe=Ba(O,z,K,D,G),se=Ir(ne,I),Ee=Mt(K,J),re=Je(O,k,L,z),Ce=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Ae=i(Z=>da(Z,C.companyId)),ee=la(Ae.controllers),Fe=i(Z=>o?.cardCreatedByUser?.userId!=null?$a(Z.userRoleState,o?.cardCreatedByUser?.userId):void 0),De=i(Z=>Fe?.accountingClassIDs[0]!=null?za(Z.classState,{classId:Fe?.accountingClassIDs[0],reportId:"class_list"}):void 0),ae=i(Z=>o?.cardHolderUser?.userId!=null?$a(Z.userRoleState,o?.cardHolderUser?.userId):void 0),oe=i(Z=>ae?.accountingClassIDs[0]!=null?za(Z.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0),fa=C?.userRole,ta=i(Z=>Ca(Z,!1,k,E).revokeCardInvite),Oa=ya(ta.saveStatus.fetchState);if(r.useEffect(()=>{if(Oa==="In-Progress"&&ta.saveStatus.fetchState==="Completed"){const Z=aa(C.tenantEmailDomain);e(Z)}},[Oa,ta.saveStatus.fetchState,e,C.tenantEmailDomain]),r.useEffect(()=>{T&&s===!1&&ke&&(b(!0),setTimeout(()=>{n(Za()),ve&&n(Ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[T,s,ke,ve]),r.useEffect(()=>{p||I.fetchState==="Completed"||I.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,$,O,!1)))},[p,I,a,n]),r.useEffect(()=>{!F&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&ne&&Ce&&K&&(l(!0),n(Zn({depositAccountId:I.chargeCard?.connectedAccountId})))},[F,I,n,Ce,K]),r.useEffect(()=>{J.fetchState!=="Completed"&&J.fetchState!=="In-Progress"&&K&&n(_a()),v!=="Completed"&&v!=="In-Progress"&&n(Mn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&n(Ws({chargeCardId:a})),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&n(Pa(C.companyId,!0))},[J.fetchState,n,K,v,I.transactionStatistics.fetchState,_.fetchState]),r.useEffect(()=>{if(!(I.fetchState!=="Completed"||O&&D.fetchState!=="Completed"||o==null||I.transactionStatistics.fetchState!=="Completed"||ne&&K&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Z=o.type.code.includes("physical"),Se=Z?o.cardActivationAttemptHistory[0]?.timestamp:o.createTime;X.trackCardsCardDetailView(ee,re,{cardId:a,cardName:o.cardName,cardType:o.type.code.includes("credit")?"credit":"debit",cardCategory:Z?"physical":"virtual",cardLimit:ba(o.limit.amount),cardLastFourDigits:o.accountLast4,cardStatus:o.status.code,cardAssignedDate:o.createTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:o.providerCardCreateTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:Se?.format(St.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:o.creditLimitFrequency.name,cardSpentAmount:ba(o.balance.amount),cardAvailableLimit:ba(o.available.amount),cardUtilizationPercent:o.limit.amount>0?Math.round((o.limit.amount-o.available.amount)/o.limit.amount*100):0,cardUtilizationAmount:ba(o.limit.amount-o.available.amount),totalNumberOfDeclinedTransactions:I.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:I.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:I.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:I.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:I.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:I.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:kt(o.cardCreatedByUser,!1),cardIssuedByEmail:o.cardCreatedByUser?.email,cardIssuedByUserId:o.cardCreatedByUser?.userId,cardIssuedByRole:Fe?.userRoles,cardIssuedByDepartment:De?.className},{cardholderName:kt(o.cardHolderUser,!1),cardholderEmail:o.cardHolderUser?.email,cardholderRole:ae?.userRoles,cardholderUserId:o.cardHolderUser?.userId,cardholderDepartment:oe?.className},fe,se)}},[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,D.fetchState,K]),u==null)throw Error("Can't access card detail page without signing in...");const dt=ea(C),Ea=K?[...At,...jr]:At,na={events:ha(dt,Ea),eventCallback:(Z,Se,ie)=>{ie.onEventReceived(Z,Se)},onSubscribed:Z=>{Z.onPusherSubscribed()}},Aa=()=>{if(a!=null&&o!=null){const{ownerName:Z,cardName:Se,utilisation:ie,limit:Ge,frequency:We,cardColor:$e}=bt(o),ze=o.cardHolderUserId===u.userId;X.trackCardsDetailPageViewed(a,Z,Se,ie,Ge,We,$e,ze)}};r.useEffect(()=>{if(I.fetchState==="Completed"){const Z=I.chargeCard;if(Z?.status.code==="inactive"||ne&&Z?.isPinSet===!1||q&&T){const Se=_e(C.tenantEmailDomain,a,u,o,T);e(Se)}}},[I.fetchState]);const lt=(Z,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:We,limit:$e,frequency:ze}=bt(o),ra=o.cardHolderUserId===u.userId;X.trackCardsDetailPageClicked(a,ie,Ge,We,$e,ze,Z,ra,Se)}},ut=(Z,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:We,limit:$e,frequency:ze}=bt(o),ra=o.cardHolderUserId===u.userId;X.trackCardsVerifyPopUpClick(a,ie,Ge,We,$e,ze,Z,ra,Se)}},pe=D.balance.amount+D.hold.amount,Ua=C.companyChargeCardInfo?.info?.primaryFundingAccount,Da=_.allFundingAccounts.find(Z=>Z.id===Ua?.accountId),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||ta.saveStatus.fetchState==="In-Progress"||!Ma&&ne&&K&&I.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(ro,{}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:T}),I.fetchState==="Completed"?c.jsx(Ut,{analytics:X,onLoad:Aa}):null,g===!0?c.jsx(Zt,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:g,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!ne||!K||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||D.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!K||J.fetchState==="Completed",paymentInitiatedDate:G.initiatedRepaymentDate}):null,c.jsx(ri,{...na,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Lt(),signedInUser:u,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:Fe?.userRoles,cardIssuedByDepartmentName:De?.className,cardHolderRoles:ae?.userRoles,cardHolderDepartmentName:oe?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:z,isCardControlsEnabled:R,isEarlyPayEnabled:x,controllerEmails:ee,chargeCardCashbackDetailState:J,productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,classListFetchState:v,primaryFundingAccountDetails:Da,currentTenant:C,cardProviderId:I.chargeCard?.cardProviderID,cardId:a,creditAccount:D,creditAccountRepayment:G,includeCreditAccountInfo:$,signedInUserToken:Q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:m.documentAiReceiptMaxSizeLimitBytes!=null?m.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:W,isCardsCommentingEnabled:d})]}):c.jsx(ct,{})}const bt=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,b=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:b,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ci,subheadline:oi,pageTitle:ii}}}}=Xe.getLocalizedStrings(),Mr=[pa,ot,Or,Ra,La,it,zt,Go,Gt,$t,Ht],di=new Set(Mr),Dt=jt((e,n,t,a)=>{e(ia(n,t,a,!0))},400),li=He.div`
|
|
19
|
-
display: flex;
|
|
20
|
-
width: 100%;
|
|
21
|
-
flex: 1 1 auto;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
align-items: center;
|
|
24
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,ui=Pe(function(e,n){const t=Ca(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:oc(e),bulkActionView:ic(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:g,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:P,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:C,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:v,isDebitCardTOSAccepted:m,isChargeCardTOSAccepted:M,controllerEmails:B,depositAccountListWithDebitCardIssued:R,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:h,productInformation:F,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:E,updatePayNowInfoTooltip:U,isUserHasCardsAdminLevelAccess:y}=n,{tenantEmailDomain:k}=a,{cards:x}=g;return{onChargeCardRowClick:(d,f)=>{const j=Er(x,d);let H;j!=null&&((L=>{const z=L.limit.amount-L.available.amount,$=`${L.cardHolderUser?.firstName.toLowerCase()} ${L.cardHolderUser?.lastName.toLowerCase()}`,_=L.cardName,D=L.department?.className??"",G=L.limit.amount,Q=L.creditLimitFrequency.name;X.trackCardsListRowClicked($,_,D,z,G,Q,b.userId===L.cardHolderUserId)})(j),ca(T,v,R)&&X.trackCardsCardListRowClick(B,F,"Card Row Item","row_clicked",f+1,{cardOwner:kt(j.cardHolderUser,!1),cardName:j.cardName,cardType:j.type.code.includes("credit")?"credit":"debit",cardStatus:j.status.code,cardUtilizationAmount:ba(j.limit.amount-j.available.amount),cardUtilizationPercent:j.limit.amount>0?Math.round((j.limit.amount-j.available.amount)/j.limit.amount*100):0,cardLimit:ba(j.limit.amount)},l,w,E)),H=j?.status.code==="request_on_hold"&&b.userId===j.cardHolderUserId?Ar(k):_e(k,d,b,j);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(H,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:d=>{e(Qn(d))},onFetchDepositAccountLimit:d=>{e(Zn({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(fc(d))},onChargeCardRevokeInviteClick:d=>{e(Kn(d))},onLockChargeCardList:(d,f)=>{e(hc(d,f))},onUnlockChargeCardList:d=>{e(pc(d))},onCloseChargeCardList:(d,f)=>{e(Cc(d,f))},onRevokeChargeCardList:d=>{e(mc(d))},updateChargeCardListSpendLimit(d,f,j){e(uc(d,f,j.code))},onLockChargeCard:(d,f)=>{e(er(y,d,f))},onUnlockChargeCard:d=>{e(Xn(y,d))},onCloseChargeCard:(d,f)=>{e(Jn(d,f))},onUpdateSpendLimit(d,f,j,H){e(Yn(d,f,j.code,H))},updateChargeCardName:(d,f)=>{e(qn(y,d,f))},onClickSetupIcon:()=>{X.trackCardsListPageClicked("settings"),ca(T,v,R)&&l!=null&&X.trackCardsSettingsClick(B,F,l,w,E);const d=_o(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{X.trackCardsListPageClicked("new card"),ca(T,v,R)&&l!=null&&X.trackCardsNewCardClick(B,F,l,"New Button","card_creation_initiated","Card List",w,E);const d=mi(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(d,f)=>{ca(T,v,R)&&l!=null&&X.trackCardsCardListSortClick(B,F,l,"Sort Icon","sort",d,f==="ascending"?"ASC":"DESC","Cards List",w,E),e(It({uiState:{sortKey:d,sortOrder:f}}))},onSearchTextChanged:d=>{e(lc(d))},onReloadCards:()=>{e(ia(S,T&&v,P&&C,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{ca(T,v,R)&&l!=null&&X.trackCardsCashbackOverviewClick(B,F,l,"Cashback Overview","cashback_details_viewed",w,E),t("./cashback")},onClickStatementsIcon:()=>{ca(T,v,R)&&l!=null&&X.trackCardsStatementsClick(B,F,l,w,E),t("./statements")},onCreateNowClick:d=>{ca(T,v,R)&&l!=null&&X.trackCardsNewCardClick(B,F,l,"Promo Banner","card_creation_initiated","Card List",w,E),t(`./new?cardType=${d}`)},onPromoCardClick:d=>{t(d==="debit"&&T&&!m||d==="credit"&&u&&!M?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,f)=>{h==="Completed"&&a.company!=null&&l!=null&&X.trackCardsPayEarlyClick(B,F,l,"Card List",d,f,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},w,E);const j=Ci(k);t(j)},navigateToCreditCardPaymentHistoryPage:()=>{const d=pi(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:U,onSetRowActionCardId:d=>{e(dc(d))},onSetBulkActionCardIds:d=>{e(ar(d))},onEventReceived:d=>{di.has(d)&&Dt(e,S,T&&v,P&&C)},onPusherSubscribed:()=>{Dt(e,S,T&&v,P&&C)}}})(st(oo));function yn({isPaymentDrawerOpen:e}){const n=le(),t=me(),a=he(),s=r.useCallback((V,je)=>{t(ar([])),n(V,je)},[t,n]),[b,g]=r.useState(!1),[S,P]=r.useState(te.getPayNowInfoTooltip()??!1),u=V=>{te.savePayNowInfoTooltip(V),P(V)},[C,T]=r.useState(!1),v=te.getSignedInUser(),m=i(V=>ge(V)),[M,B]=r.useState(!1),[R,p]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Cards"}),l=m.userRole.includes("charge_card_user"),w=!l,E=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:U,useDynamicConfig:y}=ue(),{isFeatureEnabled:k}=U(Y.isCashbackFeatureEnabled),{isFeatureEnabled:x}=U(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=U(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=U(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=U(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:H}=U(Y.isCardsCommentingEnabled),{isFeatureEnabled:O}=U(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:L}=U(Y.isCardPolicyEnabled),{isFeatureEnabled:z}=U(Y.isAiCardCreationEnabled),$=Re(d,m),_=Oe({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:$}),D=xe(m),G=Be(m),Q=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Ue({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G,isDebitCardProductVisible:_,chargeCardsCreditAccountLimit:Q}),N=kr({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G}),{configValue:W}=y(Ye.zeniCardsConfig),J=Le(),o=Te(J?.loggedInUserRoleMap),A=i(V=>da(V,m.companyId)),K=la(A.controllers),ne=W.charge_card_cashback_rate_per_transaction!=null?W.charge_card_cashback_rate_per_transaction:.0175,q=W.credit_card_pay_now_threshold_by_company_id?.[m.companyId]??W.default_credit_card_pay_now_threshold??Do,ke=W.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(W.enable_card_controls_for_company_ids)&&W.enable_card_controls_for_company_ids.includes(m.companyId),ve=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,fe=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,se=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=!!m.company?.companyChargeCardInfo?.isChargeCardEnabled,re=!!m.company?.companyDebitCardInfo?.isDebitCardEnabled,Ce=i(V=>Hn(V)),Ae=ya(Ce.updateStatus),ee=i(V=>Ca(V,w,_&&E,I&&se)),Fe=i(V=>nc(V)),De=i(V=>rc(V)),ae=i(V=>sc(V)),oe=i(V=>cc(V)),fa=i(V=>ae==null?[]:jn(V.aiCfoState,ae).filter(je=>je.kind==="creating_cards"),_t),ta=ya(De.fetchState);r.useEffect(()=>{ta==="In-Progress"&&De.fetchState==="Completed"&&ae!=null&&fa.forEach(V=>{t(yt({chatSessionId:ae,id:V.id,entityIds:oe,kind:"created_cards"}))})},[t,De.fetchState,ae,oe,fa,ta]);const Oa=ee.cards.filter(V=>V.type.code.includes("debit")).map(V=>V.connectedAccountId),dt=[...new Set(Oa)],Ea=i(V=>ma(V)),na=i(V=>tt(V,dt)),Aa=i(V=>wa(V,m.companyId)),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find(V=>V.id===lt?.accountId),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback(()=>o===!0&&L===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(m.tenantEmailDomain??"")!==!0,[o,L,pe,m.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect(()=>{Ma(Da())},[Da]);const Z=()=>{te.saveCardPolicyPopupSeen(m.tenantEmailDomain??"",!0),Ma(!1)},Se=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;co({isDataReady:pe==="Completed",pageContext:Se?"cards_creation":"cards"});const{creditAccountRepayment:ie}=i(V=>ua(V)),Ge=i(V=>qa(V).firstViewAfterActivation),{areTenantIdsInSync:We}=Sr(),$e=Mt(o,Ea),ze=Ba(I,se,o,Ua,ie),ra=Nt(_,E,o,na,ee.debitCardSummary),mt=Je(I,_,E,se),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect(()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<q*ee.creditAccount.limit.amount/100)&&u(!0)},[pe,q,Ct,ee.creditAccount.limit.amount]),r.useEffect(()=>{if(e!=null&&e===!0&&ie.initiatedRepayments.amount===0&&ie.fetchState==="Completed"||Ae==="In-Progress"&&Ce.updateStatus==="Completed")u(!1),g(!0);else if(ie.initiatedRepayments.amount>0&&ie.fetchState==="Completed"){g(!1),document.body.style.overflow="auto";const V=aa(m.tenantEmailDomain);s(V)}},[e,ie.initiatedRepayments.amount,ie.fetchState,Ae,Ce.updateStatus,s,m.tenantEmailDomain]),r.useEffect(()=>{!M&&(se||E)&&(Ee||re)&&We&&(B(!0),t(ia(w,_&&E,I&&se,!1)))},[M,w,t,We,Ee,re]),r.useEffect(()=>{Ge&&C===!1&&(T(!0),setTimeout(()=>{t(Za())},5e3))},[Ge,C]),r.useEffect(()=>()=>{Dt.flush()},[]),r.useEffect(()=>{pe==="Completed"&&l&&ee.cards.length===1&&(ee.cards[0].status.code==="inactive"&&ee.cards[0].type.code==="business_physical_credit_card"?s(`./${ee.cards[0].id}/activate`):ee.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))},[pe,l,a.state,s,ee.cards]),r.useEffect(()=>{if(pe==="Completed"&&l){const V=ee.cards.length,je=ee.cards.filter(Ke=>Ke.cardHolderUserId===v?.userId).filter(Ke=>Ke.status.code==="request_on_hold");je.length>0&&V===je.length&&s("./onboard")}},[pe,ee.cards,l,s,v?.userId]),r.useEffect(()=>{pe!=="Completed"||I&&ie.fetchState!=="Completed"||_&&E&&o&&na.fetchState!=="Completed"||X.trackCardsCardListView(K,mt,$e,ze,ra)},[pe,Ua,ie.fetchState,na.fetchState,o]),v==null)throw Error("Can't access charge card list page without signing in...");const Gr=i(V=>tr(V.userState,V.userRoleState,V.userListViewState,"cardAdmin")),Kt=xt(J?.loggedInUserRoleMap),qt=V=>{p(V)},$r=ee.creditAccount.limit,zr=()=>{g(!1),s("..")},Zr=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:I&&Ee,isTOSAccepted:ve,isSetupEnabled:se,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Kt}),Yr=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:_&&re,isTOSAccepted:fe,isSetupEnabled:E,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Kt}),Wr=Zr||Yr,Qt=function(V){const{isEmptyCardsState:je,isChargeCardAdmin:Ke,isFileUploadEnabled:Xt}=V,en=le(),Na=he(),{tenantEmailDomain:Va}=Ve(),{isAiCfoOpen:Jr,setIsAiCfoOpen:an}=Cr(),Xr=pr(),es=hr(),tn=i(be=>Un(be)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:nn,isResolved:rn}=vr("cards_creation"),sn=r.useMemo(()=>wr(nn,rn,3),[nn,rn]),[Ha,pt]=r.useState(""),cn=es&&Xr&&Va!=null&&!Jr,ga=r.useCallback(be=>{if(Va==null)return;const as=ye(Na.state?.pathnameStackToGoBack,Na.pathname);en(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:as,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})},[Na.pathname,Na.state,en,Va]),on=r.useCallback(be=>{be.trim().length!==0&&(pt(""),ga(be))},[ga]),dn=r.useCallback(()=>{const be=Ha.trim();be.length!==0&&(pt(""),ga(be))},[Ha,ga]),ln=r.useCallback(()=>{},[]),un=r.useCallback(be=>{pt(be)},[]),mn=r.useCallback(()=>{an(!0)},[an]),Cn=r.useCallback(()=>{ga(void 0)},[ga]);return r.useMemo(()=>{if(cn&&je&&Ke)return{aiAgentName:ii,headline:ci,subheadline:oi,promptChips:sn,composer:{currentInput:Ha,isSubmitting:tn,isFileUploadEnabled:Xt,onInputChange:un,onSubmit:dn,onStopSubmit:ln},onPromptClick:on,onOpenSidePanel:mn,onOpenFullView:Cn,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,cn,Ke,je,Xt,tn,un,Cn,mn,on,ln,dn,sn])}({isEmptyCardsState:Se,isChargeCardAdmin:o,isFileUploadEnabled:O}),Jt=z&&Qt!=null?c.jsx(fr,{...Qt}):null,Kr=h&&Jt==null,qr=ea(m),Qr={events:ha(qr,Mr),eventCallback:(V,je,Ke)=>{Ke.onEventReceived(V)},onSubscribed:V=>{V.onPusherSubscribed()}};return se||E?c.jsxs(c.Fragment,{children:[pe==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:X,onLoad:()=>{X.trackPageLoaded(br.Event.cardsListPage),(I&&!se||_&&!E)&&X.trackCardsPromoView(K,{isCreditCardOffered:I,isDebitCardOffered:_,isDebitCardEnabled:E,isCreditCardEnabled:se},"Banner",_&&!E?"Debit Card":I&&!se?"Credit Card":"","Card List")}}),c.jsx(nt,{showConfetti:Ge})]}):null,b===!0?c.jsx(Zt,{closeDrawerHandler:zr,isPaymentDrawerOpen:b,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:ra,cashbackInformation:$e,isDebitCardInfoFetchStateCompleted:!(_&&E&&o)||na.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ie.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!o||Ea.fetchState==="Completed",paymentInitiatedDate:ie.initiatedRepaymentDate}):null,c.jsxs(li,{children:[c.jsx(Ie,{isAppContentDrawerOpen:R,handleDrawerToggle:qt}),c.jsx(ui,{...Qr,isCashbackFeatureEnabled:k,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:S,creditCardPayNowThreshold:q,signedInUser:v,chargeCardListState:ee,location:a,admins:Gr.users,navigateAndClearBulkSelection:s,currentTenant:m,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:m.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:o,includeCreditAccountDebitSummaryAndCashbackInfo:w,onClickMenuIcon:()=>{qt(!0)},creditLimit:$r,isChargeCardSetupEnabled:se,isChargeCardEnabledOnCompany:Ee,isDebitCardSetupEnabled:E,isDebitCardEnabledOnCompany:re,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:ne,controllerEmails:K,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:na,isChargeCardTOSAccepted:ve,isDebitCardTOSAccepted:fe,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:ra,cashbackInformation:$e,isAiCfoAccessEnabled:Kr,onAskAiCfoClick:F,isCardsCommentingEnabled:H,cardsAiCfoHero:Jt,onClickPolicyIcon:o&&L?()=>n(hi(m.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Z,pendingCreationCount:Fe})]})]}):(ve||fe)&&o===!0?c.jsx(oa,{to:"../setup"}):Wr?c.jsx(oa,{to:"../promo"}):c.jsx(va,{fetchState:pe})}const mi=e=>`/${e}/cards/new`,Ci=e=>`/${e}/cards/payment`,pi=e=>`/${e}/cards/payment-history`,hi=e=>`/${e}/cards/policy`,Nr=[Lr,Or],fi=new Set(Nr),gi=Pe(function(e){const n=te.getSignedInUser(),t=ge(e),a=e.tenantState.currentTenantId,s=nr(e),b={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},g=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:gc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:b,companyName:g,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=we(t.state?.pathnameStackToGoBack),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(bc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{fi.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Sc({uiState:{downloadState:s}}))}}})(st(io));function Si(){const e=le(),n=he(),t=me(),{areTenantIdsInSync:a}=Sr(),{useFeatureGate:s}=ue();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const b=i(o=>ge(o)),g=i(o=>nr(o)),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[T,v]=r.useState(!1),[m,M]=r.useState(null),B=!b.userRole.includes("charge_card_user"),R=!!b.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=s(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(Y.isDebitCardFeatureEnabled),F=Re(h,b),l=Oe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:F}),w=xe(b),E=Be(b),U=b.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=Ue({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:p,isBookKeepingTenant:E,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:U}),k=!!b.companyChargeCardInfo?.info?.isChargeCardEnabled,x=Le(),d=Te(x?.loggedInUserRoleMap),f=i(o=>Ca(o,B,l&&R,y&&k)),j=r.useMemo(()=>{const o=f.cards.filter(A=>A.type.code.includes("debit"));return[...new Set(o.map(A=>A.connectedAccountId))]},[f.cards]),H=i(o=>ma(o)),O=i(o=>tt(o,j)),{creditAccountRepayment:L}=i(o=>ua(o)),z=r.useMemo(()=>Mt(d,H),[d,H]),$=r.useMemo(()=>Ba(y,k,d,f.creditAccount,L),[y,k,d,f.creditAccount,L]),_=r.useMemo(()=>Nt(l,R,d,O,f.debitCardSummary),[l,R,d,O,f.debitCardSummary]),D=r.useMemo(()=>Je(y,l,R,k),[y,l,R,k]),G=f.creditAccount.balance.amount+f.creditAccount.hold.amount,Q=r.useMemo(()=>m!=null?g.repaymentHistory.find(o=>o.cardRepaymentId===m):void 0,[m,g.repaymentHistory]),I=r.useCallback(o=>{M(o),t(ia(B,l&&R,y&&k,!1)),v(!0)},[t,B,l,R,y,k]),N=r.useCallback(()=>{v(!1),M(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{S||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(P(!0),t(Ga()))},[S,t,g.fetchState]),r.useEffect(()=>{!u&&(k||R)&&a&&(C(!0),t(ia(B,!1,y&&k,!1)))},[u,k,R,a,t,B,y]);const W=ea(b),J={events:ha(W,Nr),eventCallback:(o,A,K)=>{K.onEventReceived(o)},onSubscribed:o=>{o.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[T?c.jsx(Zt,{closeDrawerHandler:N,isPaymentDrawerOpen:T,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:G,productInformation:D,creditAccountInformation:$,debitAccountInformation:_,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(l&&R&&d)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!y||L.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||H.fetchState==="Completed",paymentInitiatedDate:L.initiatedRepaymentDate,retryRepayment:Q}):null,c.jsx(gi,{...J,location:n,navigate:e,accountInfoByAccountId:g.accountInfoByAccountId,onRetryPaymentClick:I})]})}const In=He.div`
|
|
26
|
-
display: flex;
|
|
27
|
-
height: 100vh;
|
|
28
|
-
width: 100%;
|
|
29
|
-
flex: 1 1 auto;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
overflow: auto;
|
|
32
|
-
align-items: center;
|
|
33
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,kn=Xe.getLocalizedStrings().months;function bi(){const e=le(),n=me(),t=he(),{creditAccount:a,creditAccountRepayment:s}=i(D=>ua(D)),b=`${gr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[g,S]=r.useState(!1),[P,u]=r.useState(!1),C=i(D=>yc(D)),{useFeatureGate:T}=ue(),v=i(D=>ge(D)),{isFeatureEnabled:m}=T(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=T(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:B}=T(Y.isCardsCommentingEnabled),R=Dr(B?v.companyId:void 0,{clearParams:B&&C.fetchState==="Completed"}),p=Re(M,v),h=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),F=xe(v),l=Be(v),w=v.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Ue({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:m,isBookKeepingTenant:l,isDebitCardProductVisible:h,chargeCardsCreditAccountLimit:w}),U=!!v.companyDebitCardInfo?.info?.isDebitCardEnabled,y=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,k=i(D=>da(D,v.companyId)),x=la(k.controllers),d=i(D=>rr(D)),f=d.cards.filter(D=>D.type.code.includes("debit")).map(D=>D.connectedAccountId),j=[...new Set(f)],H=i(D=>tt(D,j)),O=i(D=>Ic(D));r.useEffect(()=>{P||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(S(!0),n(Qe()))},[g,n,a.fetchState]),r.useEffect(()=>{P||a.fetchState!=="Completed"||a.id==null||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(u(!0),n(kc(a.id)))},[P,n,a.fetchState,a.id,C.fetchState]),r.useEffect(()=>{H.fetchState!=="Completed"&&H.fetchState!=="In-Progress"&&h&&U&&n(sr()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&n(Ne()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&h&&U&&n(Ec()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&E&&y&&n(Ft())},[H.fetchState,h,U,d.fetchState,O.fetchState,s.fetchState,E,y]),r.useEffect(()=>{if(C.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&d.fetchState==="Completed"&&(!h||!U||H.fetchState==="Completed"&&O.fetchState==="Completed")){let D="",G="";if(C.statements.length>0){const W=C.statements[C.statements.length-1].period,[J,o]=W.split("-"),A=C.statements[0].period,[K,ne]=A.split("-");D=`${kn[parseInt(o)-1]} ${J}`,G=`${kn[parseInt(ne)-1]} ${K}`}const Q=Je(E,h,U,y),I=Ba(E,y,!0,a,s),N=Nt(h,U,!0,H,O);X.trackCardsCreditCardStatementsView(x,Q,{numberOfStatements:C.statements.length,oldestStatementMonthYear:D,latestStatementMonthYear:G},I,N)}},[C.fetchState,a.fetchState,s.fetchState,H.fetchState,d.fetchState,O.fetchState]);const L=()=>{const D=we(t.state?.pathnameStackToGoBack),G=D.poppedPathname??"..";e(G,{state:{pathnameStackToGoBack:D.newStack}})},z=i(D=>ma(D)),$=te.getSignedInUser(),_={userId:$?.userId??"",sessionId:$?.zeniSessionId??"",tenantId:v.tenantId??""};if($==null)throw Error("Can't access address page without signing in...");if(C.fetchState!=="Completed")return c.jsx(In,{children:c.jsx(lo,{onBackClick:L})});{const D=Je(E,h,U,y);return c.jsx(In,{children:c.jsx(uo,{currentTenantCompanyName:v.companyName,statementListView:C,productInformation:D,onBackClick:L,authParams:_,controllerEmails:x,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:h,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:y,isCardsCommentingEnabled:B,initialOpenThreadRequest:R,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:H,debitCardSummary:O,downloadEndPoint:b})})}}const Vr=[pa,it],yi=new Set(Vr),Ii={containerWidth:new Ta(100,58)},ki=({appContent:e})=>{const n=Fa(),t=me(),a=le(),s=he(),{useDynamicConfig:b}=ue(),[g,S]=r.useState(!1),[P,u]=r.useState(!1),[C,T]=r.useState(!1),[v,m]=r.useState(!1),M=r.useRef(!1),B=r.useRef(null);r.useEffect(()=>()=>{B.current!=null&&(clearTimeout(B.current),B.current=null)},[]);const[R,p]=r.useState(!1),[h,F]=r.useState(!1),l=te.getSignedInUser();if(l==null)throw Error("Can't access onboarding card page without signing in...");const w=i(N=>ge(N)),{configValue:E}=b(Ye.zeniCardsConfig),U=i(N=>Ac(N)),{tenantEmailDomain:y}=w,k=i(N=>N.settingsViewState.profile.fetchState),x=i(N=>N.chargeCardListState.fetchState),d=i(N=>N.settingsViewState.profile.userId),f=i(N=>N.chargeCardConfigState.fetchState);r.useEffect(()=>{g===!1&&k!=="In-Progress"&&k!=="Completed"&&(t(Dc()),S(!0)),P===!1&&f!=="In-Progress"&&f!=="Completed"&&(t(Qa()),u(!0)),C===!1&&x==="Not-Started"&&(T(!0),t(Ne()))},[g,C,x,P,f]),r.useEffect(()=>{k==="Completed"&&R===!1&&d!=null&&x==="Completed"&&U.cards.length>0&&(t(_c({userId:d})),t(cr({cardId:U.cards[U.cards.length-1].id})),p(!0))},[k,R,d,x]),r.useEffect(()=>{if(!v&&U.fetchState==="Completed"&&U.cards.length===0){const N=we(s.state?.pathnameStackToGoBack),W=N.poppedPathname??aa(y);a(W,{state:{pathnameStackToGoBack:N.newStack}})}},[U.fetchState,U.cards,v]);const j=i(N=>qa(N)),H=ya(j.updateStatus.fetchState),O=j.currentDisplayedCardId,{useFeatureGate:L}=ue(),{isFeatureEnabled:z}=L(Y.isChargeCardFeatureEnabled),$=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!w.userRole.includes("charge_card_user")&&z&&$,D=i(N=>O!=null?or(N.chargeCardState,O):null),G=()=>{O!=null&&(M.current=!0,B.current!=null&&clearTimeout(B.current),B.current=setTimeout(()=>{M.current=!1,B.current=null},5e3),t(ka(O,_,!0)),t(Ne(!0)),m(!0))},Q=ea(w);Vt({events:ha(Q,Vr),onSubscribed:()=>{t(Ne(!0))},onEvent:(N,W)=>{if(!yi.has(N))return;const J=Yt(W),o=M.current;if(N===pa){const K=de(J?.card_id)??O;if(K!=null){const ne=Wt(J,K);if(ne!=null)return t(Tt(ne)),void(K!==O||o||G())}}if(N===it)return void t(Ne(!0));const A=de(J?.card_id)??O;(O==null||A===O)&&O!=null?o||G():t(Ne(!0))}}),r.useEffect(()=>{if(v&&O!=null&&D!=null&&D.status.code!=="request_on_hold"){const N=_e(w.tenantEmailDomain,O,l,D),W=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Pc()),D?.type.code==="business_virtual_credit_card"&&t(Ja()),a(N,{state:{pathnameStackToGoBack:W},replace:!0}),M.current=!1,B.current!=null&&(clearTimeout(B.current),B.current=null)}},[v,D?.status.code]),r.useEffect(()=>{H==="In-Progress"&&j.updateStatus.fetchState==="Completed"&&setTimeout(G,3e3)},[H,j.updateStatus.fetchState]);const I=N=>{F(N)};if(k!=="Completed"||U.cards.length===0)return c.jsxs(En,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(mo,{})]});if(d==null)throw Error("Can't access my userId.");return c.jsxs(En,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(Ei,{chargeCardListView:U,cardUserOnboardingView:j,navigate:a,currentTenant:w,myUserId:d,location:s,chargeCardCashbackRatePerTransaction:E.charge_card_cashback_rate_per_transaction!=null?E.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{I(!0)}}),e!=null?c.jsx(Ai,{windowSize:n,children:e}):null]})},Ei=Pe(function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const b=Ca(e,!1,!1,!1);let g=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(g=!0),{cards:a.cards,showMenuIcon:g,companyLegalName:n.companyName,twoFAView:t.twoFAView,cardUserOnboardingLocalData:t.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:t.isDOBPresent,onboardingProgressStatus:t.onboardingProgressStatus}},function(e,n){const{navigate:t,cardUserOnboardingView:a,location:s,currentTenant:b}=n,{tenantEmailDomain:g}=b;return{updateCardUserOnboardingLocalData:S=>{e(fn({localData:S}))},onGetOtp:S=>{if(a.cardUserOnboardingLocalData!=null){const P={...a.cardUserOnboardingLocalData,phone:S};e(fn({localData:P}))}e(at(S,"CardUserOnboarding"))},onResendOtp:S=>{e(et(S,"CardUserOnboarding"))},onVerifyOtp:(S,P)=>{e(Xa(S,P,"CardUserOnboarding"))},onVerifyOtpSuccess:S=>{e(wc()),S!=null&&te.saveZeniOtpToken(S)},setCurrentDisplayedCardId:S=>{e(cr({cardId:S}))},onBackClick:()=>{const S=we(s.state?.pathnameStackToGoBack),P=S.poppedPathname??aa(g);t(P,{state:{pathnameStackToGoBack:S.newStack}})}}})(Co),Ai=He.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
width: ${e=>`${Ii.containerWidth.value(e.windowSize)}%`};
|
|
38
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
39
|
-
`,En=He.div`
|
|
40
|
-
display: flex;
|
|
41
|
-
min-height: 100%;
|
|
42
|
-
width: 100%;
|
|
43
|
-
flex: 1 1 auto;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
align-items: center;
|
|
46
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,Di={containerWidth:new Ta(100,58)},_i=({appContent:e})=>{const n=Fa(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g,useFeatureGate:S}=ue(),[P,u]=r.useState(!1),[C,T]=r.useState(!1),[v,m]=r.useState(!1),[M,B]=r.useState(!1),R=te.getSignedInUser();if(R==null)throw Error("Can't access onboarding card page without signing in...");const p=i(_=>ge(_));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ye.zeniCardsConfig),F=i(_=>vc(_,s)),{isFeatureEnabled:l}=S(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=S(Y.isDebitCardFeatureEnabled),E=Re(w,p),U=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:E}),y=xe(p),k=Be(p),x=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,d=Ue({isCardsOnlyTenant:y,isChargeCardFeatureEnabled:l,isBookKeepingTenant:k,isDebitCardProductVisible:U,chargeCardsCreditAccountLimit:x}),f=F.chargeCard,j=i(_=>_.chargeCardConfigState.fetchState);r.useEffect(()=>{P===!1&&j!=="In-Progress"&&j!=="Completed"&&(t(Qa()),u(!0)),C===!1&&F.fetchState==="Not-Started"&&(T(!0),t(ka(s,!1,d)))},[C,F.fetchState,P,j]);const H=f?.type.code==="business_physical_debit_card"||f?.type.code==="business_virtual_debit_card";r.useEffect(()=>{if(F.fetchState==="Completed"){if(v===!1&&(H===!1||H&&f.status?.code!=="active"||H&&f.status.code==="active"&&f.isPinSet||f.cardHolderUserId!==R.userId)){const _=_e(p.tenantEmailDomain,s,R,f,!0),D=ye(b.state?.pathnameStackToGoBack,b.pathname);a(_,{state:{pathnameStackToGoBack:D}})}else if(v&&F.isRefreshingViewInBackground===!1&&f?.isPinSet===!0){t(Fc({chargeCardId:s}));const _=_e(p.tenantEmailDomain,s,R,f,!0),D=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Ja()),a(_,{state:{pathnameStackToGoBack:D}})}}},[F.fetchState,f?.type.code,v,F.isRefreshingViewInBackground]);const O=te.getZeniOtpTokenForCardHolder(s),L=i(_=>Nn(_.userState,R.userId)),z=()=>{f?.isPinSet!==!0&&t(Sa(s,!0))};r.useEffect(()=>{F.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),m(!0))},[F.updateDebitCardPinAttemptFetchState.fetchState]);const $=_=>{B(_)};if(j!=="Completed"||f==null)return c.jsx(va,{fetchState:"In-Progress"});if(L?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(vi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:M,handleDrawerToggle:$}),c.jsx(Pi,{cardId:s,card:f,phone:L.phone,signedInUser:R,isSandboxEnv:Lt(),debitCardDetailState:F,signedInUserToken:O,navigate:a,currentTenant:p,location:b,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?c.jsx(wi,{windowSize:n,children:e}):null]})},Pi=Pe(function(e,{debitCardDetailState:n,cardId:t}){const a=Vn(e,t),s=n.updateStatus,b=Ca(e,!1,!1,!1);let g=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(g=!0),{showMenuIcon:g,vgsVaultId:rt.cardVaultId,twoFAView:a,setPinWaitStatus:s}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,debitCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:u=>{e(Wn(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onSetPinSuccess:()=>{e(Tc({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("activate")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(po),wi=He.div`
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
width: ${e=>`${Di.containerWidth.value(e.windowSize)}%`};
|
|
51
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
52
|
-
box-shadow: ${e=>`${Ya.sp0} 2px ${Ya.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
53
|
-
`,vi=He.div`
|
|
54
|
-
display: flex;
|
|
55
|
-
min-height: 100%;
|
|
56
|
-
width: 100%;
|
|
57
|
-
flex: 1 1 auto;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
align-items: center;
|
|
60
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
61
|
-
box-shadow: ${e=>`${Ya.sp0} 2px ${Ya.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
62
|
-
`,Fi={overlayWidth:new Ta(ht[12],ht[12],ht[9])},Ti=Pe(function(e,n){const t=Bt(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(ir(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const g=wo(b);e(Rc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:g})),e(Lc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Bc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(ho),xi=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Ot(),s=Fa(),b=()=>{n()},g=i(S=>xc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S))?.newAddressId;return c.jsx(yr,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Fi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,P)=>(P==="backdropClick"||P==="escapeKeyDown")&&b(),children:c.jsx(Ti,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:b,lineId:e,chargeCardTypeOption:t,newCustomAddressId:g})})},Bi=Pe(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S}=n,P=Bt(e,t&&g,a&&S);return{issueChargeCards:P,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S,cardHolderCandidates:P.userList.map(u=>u.user).filter(Boolean),allRoles:P.userList.map(u=>u.userRole),allAccountingClasses:P.allAccountingClasses,userList:P.userList}},function(e,n){return{onIssueCardClick:()=>{e(jc())},onSaveChangesToLocalStore:t=>{e(Uc(t))},onDismissClick:()=>{e(dr()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(ir(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(So);function Ri(){const e=te.getSignedInUser(),n=le(),t=me(),a=fo(),[s]=An(),b=s.get("cardType"),{useFeatureGate:g}=ue(),{isFeatureEnabled:S}=g(Y.isIssuePhysicalCardEnabled),{isFeatureEnabled:P}=g(Y.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:u}=g(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Y.isChargeCardFeatureEnabled),T=i(z=>ge(z)),v=Re(u,T),m=Oe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:v}),M=xe(T),B=Be(T),R=T.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:C,isBookKeepingTenant:B,isDebitCardProductVisible:m,chargeCardsCreditAccountLimit:R}),[h,F]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect(()=>{h||(F(!0),t(Oc(m&&w,p&&l,!1)))},[h,F,t]);const l=!!T.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!T.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(z=>Bt(z,p&&l,m&&w)),U=E.fetchState,y=E.issueCardStatus.fetchState,k=E.lastSelfIssuedDebitCardId,x=i(z=>k!=null?or(z.chargeCardState,k):void 0),[d,f]=r.useState(null),[j,H]=r.useState(null),O=()=>{f(null)},L=(z,$)=>{f(z),H($)};return r.useEffect(()=>{if(y==="Completed"){if(k!=null&&x?.type.code==="business_virtual_debit_card"){let z;z=x?.status.code==="request_on_hold"&&e.userId===x.cardHolderUserId?Ar(T.tenantEmailDomain):_e(T.tenantEmailDomain,k,e,x),n(z)}else n("../");t(dr())}},[y,k]),U==="Completed"?c.jsxs(c.Fragment,{children:[d!==null&&j!==null?c.jsx(xi,{closeDrawerHandler:O,lineId:d,chargeCardTypeOption:j}):null,c.jsx(Bi,{themeState:a,isIssuePhysicalCardEnabled:S,isIssuePhysicalDebitCardEnabled:P,isDebitCardFeatureEnabled:m,isChargeCardFeatureEnabled:p,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:n,fetchState:E.fetchState,openAddAddressDrawerHandler:L,defaultCardType:b==="creditCard"||b==="debitCard"?b:void 0})]}):U==="Error"?c.jsx(ct,{}):c.jsx(go,{})}const Hr=[pa,it],Li=new Set(Hr),Oi=He.div`
|
|
63
|
-
display: flex;
|
|
64
|
-
height: 100vh;
|
|
65
|
-
width: 100%;
|
|
66
|
-
flex: 1 1 auto;
|
|
67
|
-
flex-direction: column;
|
|
68
|
-
overflow: auto;
|
|
69
|
-
align-items: center;
|
|
70
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,Ui=Pe(function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:b,myPendingActivationChargeCardListState:g}=n,{tenantEmailDomain:S}=a,{cards:P}=g;return{onChargeCardRowClick:u=>{const C=Er(P,u),T=_e(S,u,b,C),v=ye(s.state?.pathnameStackToGoBack,s.pathname);t(T,{state:{pathnameStackToGoBack:v}})},onColumnSortConfigChanged:(u,C)=>{e(It({uiState:{sortKey:u,sortOrder:C}}))},onReloadCards:()=>{e(Ne())},onBackClick:()=>{const u=a.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(bo);function ji(){const e=le(),n=me(),t=he(),a=Ot(),[s,b]=r.useState(!1),g=i(L=>Mc(L)),S=i(L=>ge(L)),P=i(L=>da(L,S.companyId)),u=la(P.controllers),{useFeatureGate:C}=ue(),{isFeatureEnabled:T}=C(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=C(Y.isDebitCardFeatureEnabled),m=Re(v,S),M=Oe({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:m}),B=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,R=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,p=Le(),h=xe(S),F=Be(S),l=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Ue({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:T,isBookKeepingTenant:F,isDebitCardProductVisible:M,chargeCardsCreditAccountLimit:l}),E=Te(p?.loggedInUserRoleMap),U=i(L=>ma(L)),{creditAccount:y,creditAccountRepayment:k}=i(L=>ua(L)),x=i(L=>rr(L)).cards.filter(L=>L.type.code.includes("debit")).map(L=>L.connectedAccountId),d=[...new Set(x)],f=i(L=>tt(L,d));r.useEffect(()=>{s||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(b(!0),n(Ne()),n(Qa()))},[s,n,g.fetchState]),r.useEffect(()=>{if(g.fetchState==="Completed"&&g.cards.length===1&&j!=null){const L=_e(S.tenantEmailDomain,g.cards[0].id,j,g.cards[0]);e(L,{state:{message:t.state?.message}})}},[g.fetchState,g.cards]);const j=te.getSignedInUser();r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&w&&R&&E&&n(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&E&&n(Ft()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&M&&B&&E&&n(sr())},[y.fetchState,k.fetchState,n,f.fetchState,M,B,E,w,R]);const H=ea(S);if(Vt({events:ha(H,Hr),onEvent:(L,z)=>{if(!Li.has(L))return;const $=Yt(z);if(L===pa){const _=de($?.card_id);if(_!=null){const D=Wt($,_);if(D!=null)return void n(Tt(D))}}n(Ne(!0))},onSubscribed:()=>{n(Ne(!0))}}),j==null)throw Error("Can't access address page without signing in...");const O=g.cards!=null&&g.cards.length>0;if(g.fetchState==="Completed"||O){const L=Je(w,M,B,R);return c.jsx(Oi,{children:c.jsx(Ui,{navigate:e,currentTenant:S,signedInUser:j,productInformation:L,myPendingActivationChargeCardListState:g,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:M,isDebitCardSetupEnabled:B,isChargeCardSetupEnabled:R,chargeCardCashbackDetailState:U,creditAccount:y,creditAccountRepayment:k,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const Mi=Pe(function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:b,isChargeCardSetupEnabled:g,signedInUser:S,location:P,productInformation:u,isEarlyPayEnabled:C,controllerEmails:T,chargeCardsCreditAccountLimit:v}=n;return{onSetupButtonClick:m=>{if(S!=null&&X.trackCardsPromoPageClicked("enable cards"),s)switch(X.trackCardsEnableCardsClick(T,u,"Cards Promo"),m){case"credit":e(qe(a,!0,"charge_cards",C,!1));break;case"debit":e(qe(a,!0,"debit_cards",C,!1));break;case"debit_and_credit":e(v===0?qe(a,!0,"debit_cards",C,!0):qe(a,!0,"charge_cards__debit_cards",C,!1))}else switch(X.trackCardsSetupCardsClick(T,u,"Cards Promo"),m){case"credit":e(qe(a,!1,"charge_cards",C,!1));break;case"debit":e(qe(a,!1,"debit_cards",C,!1));break;case"debit_and_credit":e(v===0?qe(a,!1,"debit_cards",C,!0):qe(a,!1,"charge_cards__debit_cards",C,!1))}},onBackClick:()=>{const m=we(P.state?.pathnameStackToGoBack);let M=m.poppedPathname;M==null&&(M=b||g?"..":"../.."),t(M,{state:{pathnameStackToGoBack:m.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Ja()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Hc(a))}}})(Io),Ni=()=>{const e=le(),{tenantEmailDomain:n}=Ve(),[t]=An(),a=t.get("cardPromoType"),s=me(),{useDynamicConfig:b,useFeatureGate:g}=ue(),[S,P]=r.useState(!1),{isFeatureEnabled:u}=g(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:T}=g(Y.isChargeCardFeatureEnabled),{configValue:v}=b(Ye.zeniCardsConfig),m=i(ae=>ge(ae)),M=i(ae=>da(ae,m.companyId)),B=la(M.controllers),R=v.charge_card_cashback_rate_per_transaction!=null?v.charge_card_cashback_rate_per_transaction:.0175,p=he(),h=te.getSignedInUserTenant(n)?.companyId??m.companyId,F=i(ae=>wa(ae,h)),l=F.primaryFundingAccount,w=m.companyBillPayInfo?.info,E=xe(m),U=Be(m),y=Re(u,m),k=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:y}),d=Ue({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:T,isBookKeepingTenant:U,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:k}),f=kr({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:T,isBookKeepingTenant:U}),j=x&&d===!1,H=w?.businessVerificationStatus?.code==="verified"&&(j||l?.accType==="depositAccount"||Nc(l?.providerVerificationStatus?.code??"")),O=te.getSignedInUser(),L=!!m.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,$=!!m.company?.companyChargeCardInfo?.isChargeCardEnabled,_=!!m.company?.companyDebitCardInfo?.isDebitCardEnabled,D=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,G=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,Q=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,I=ae=>{P(ae)},N=i(ae=>ae.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const W=Le(),J=Te(W?.loggedInUserRoleMap),o=xt(W?.loggedInUserRoleMap),[A,K]=r.useState(!1),[ne,q]=r.useState(!1),[ke,ve]=r.useState(!1);r.useEffect(()=>{A===!1&&p.state?.message==="activation"&&K(!0)},[p.state]),r.useEffect(()=>{ne||N!=="Not-Started"||h==null||(q(!0),s(Pa(h,!0)))},[ne,N,h,s]);const fe=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:f&&$,isTOSAccepted:z,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:J,isUserHasCardsAccess:o}),se=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:x&&_,isTOSAccepted:Q,isSetupEnabled:G,isUserHasCardsAdminLevelAccess:J,isUserHasCardsAccess:o}),Ee=x&&se&&f&&k>=0&&fe?"debit_and_credit":x&&se?"debit":"credit",re=Po(a,Ee),Ce=F?.chargeCardTermsDetails?.fetchStatus?.fetchState,Ae=r.useRef(null);r.useEffect(()=>{Ce==="In-Progress"?Ae.current=re:Ce!=="Error"&&Ce!=="Not-Started"||(Ae.current=null)},[Ce,re]);const ee=Ce!=="In-Progress"&&Ce!=="Completed"||Ae.current==null?re:Ae.current;r.useEffect(()=>{re==="credit"&&(D||f===!1&&G)||re==="debit"&&G||re==="debit_and_credit"&&G&&D?e("../"):(re==="debit_and_credit"&&z===!0&&Q===!0||re==="credit"&&(z===!0||f===!1&&Q===!0)||re==="debit"&&Q===!0)&&J===!0&&e("../setup")},[H,D,G,re,z,Q]),r.useEffect(()=>{ke||(s(Vc("cardAdmin")),ve(!0))},[ke]);const Fe=i(ae=>tr(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin")),De=Je(f,x,G,D);return(ae=>{switch(ae){case"credit":return $;case"debit":return _;case"debit_and_credit":return $&&_;default:return!1}})(ee)?(fe||se)&&N==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:X,onLoad:()=>{if(X.trackPageLoaded(br.Event.cardsPromoPage),!!f&&!D||!!x&&!G||!!f&&!!x&&!G&&!D){const ae=Vi({isDebitCardSetupEnabled:G,isChargeCardSetupEnabled:D,isCreditCardProductVisibleForExpressInterest:f,isDebitCardProductVisible:x});X.trackCardsPromoView(B,De,"Page",ae,"Promo Page")}}}),c.jsx(nt,{showConfetti:A}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(Mi,{signedInUser:O,location:p,showEnableCardButton:H,isCompanyBusinessVerificationAndPaymentSetUpDone:H,isChargeCardSetupEnabled:D,isDebitCardSetupEnabled:G,companyLegalName:m.companyName,adminList:Fe.users,isCheckingEnabled:L,navigate:e,companyId:h,cardPromoType:ee,controllerEmails:B,productInformation:De,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:u,isEarlyPayEnabled:C,cashbackRate:R,chargeCardsCreditAccountLimit:k,onClickMenuIcon:()=>{I(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(yo,{})]}):c.jsx(oa,{to:"../",replace:!0})},Vi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function Cd(){const e=he(),n=i(W=>ge(W)),{useFeatureGate:t}=ue(),{isFeatureEnabled:a}=t(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:b}=t(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:g}=t(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(Y.isCardPolicyEnabled),P=Re(s,n),u=Oe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:P}),C=ko(n,a,s),T=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,v=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,m=!!n.company?.companyChargeCardInfo?.isChargeCardEnabled,M=!!n.company?.companyDebitCardInfo?.isDebitCardEnabled,B=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,R=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,p=Le(),h=Te(p?.loggedInUserRoleMap),F=xt(p?.loggedInUserRoleMap),{isFeatureEnabled:l}=t(Y.isCashbackFeatureEnabled),w=n.userRole.includes("charge_card_user"),E=!w,U=!w&&B,y=n?.userRole!=null&&Gc(n?.userRole),k=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&$c(p?.loggedInUserRoleMap),x=zc(p?.loggedInUserRoleMap),d=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&Zc(p?.loggedInUserRoleMap),{isFeatureEnabled:f}=t(Y.isDepositAccountsFeatureEnabled),j=f&&!y&&Gn(p?.loggedInUserRoleMap),H=B&&m&&!y,O=R&&M&&!y,L=C&&!y&&Te(p?.loggedInUserRoleMap),z=Yc(p?.loggedInUserRoleMap),$=xe(n),_=Be(n),D=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,G=Ue({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:a,isBookKeepingTenant:_,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:D}),Q=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:G&&m,isTOSAccepted:T,isSetupEnabled:B,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:F}),I=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:u&&M,isTOSAccepted:v,isSetupEnabled:R,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:F}),N=Q||I;return c.jsxs(ts,{children:[h?c.jsx(ce,{path:"setup",element:c.jsx(gn,{isBillPayAdminLevelAccess:k,isReimbursementAdminLevelAccess:d,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:L,isUserHasOnlyCardAccess:z,isUserHasOnlyBillPayAccess:x,productType:"charge_cards",type:"setup"})}):null,h?c.jsx(ce,{path:"verification",element:c.jsx(gn,{isBillPayAdminLevelAccess:k,isUserHasOnlyBillPayAccess:x,isReimbursementAdminLevelAccess:d,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:L,isUserHasOnlyCardAccess:z,productType:"charge_cards",type:"verification"})}):null,h&&S?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"policy",element:c.jsx(Vo,{})}),c.jsx(ce,{path:"policy/new",element:c.jsx(xo,{})}),c.jsx(ce,{path:"policy/:templateId/edit",element:c.jsx(Oo,{})})]}):null,c.jsx(ce,{path:"promo",element:c.jsx(Ni,{})}),H||O?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"/",element:c.jsx(yn,{isPaymentDrawerOpen:!1})}),L&&b?c.jsx(ce,{path:"payment",element:c.jsx(yn,{isPaymentDrawerOpen:!0})}):null,c.jsx(ce,{path:"activate",element:c.jsx(ji,{})}),c.jsx(ce,{path:"onboard",element:c.jsx(ki,{})}),h?c.jsx(ce,{path:"new",element:c.jsx(Ri,{})}):null,l&&E?c.jsx(ce,{path:"cashback",element:c.jsx(Zo,{})}):null,U?c.jsx(ce,{path:"statements",element:c.jsx(bi,{})}):null,L&&g&&B?c.jsx(ce,{path:"payment-history",element:c.jsx(Si,{})}):null,c.jsx(ce,{path:":cardId/activate",element:c.jsx(Ko,{})}),c.jsx(ce,{path:":cardId/setPin",element:c.jsx(_i,{})}),c.jsx(ce,{path:":cardId/addToWallet",element:c.jsx(Ho,{})}),c.jsx(ce,{path:":cardId/*",element:c.jsx(si,{})}),c.jsx(ce,{path:"*",element:c.jsx(ct,{})})]}):(T||v)&&h?c.jsx(ce,{path:"*",element:c.jsx(oa,{to:"../setup"})}):N?c.jsx(ce,{path:"*",element:c.jsx(oa,{to:"../promo",state:e.state})}):c.jsx(ce,{path:"*",element:null})]})}export{Cd as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-CS0rfBBF.js";import{a}from"./sentry-CEfOando.js";import{u as D,g as v,j as m,N as w}from"./core-D6ttr5iw.js";import{LU as A,eX as L,g2 as O,oa as U,gt as h,g1 as _,fA as j,L$ as $}from"./zeni-epic-state-Cl3jFj7z.js";import{u as F,z as p,L as C,a as k,o as H}from"./index-ilZtTEZn.js";import{n as z}from"./mui-vLo47rlo.js";import{t as R}from"./getLocaleForTenant-O3Y2pcaQ.js";import{g as P,Q as G}from"./QBOConnectionScreen-DXq_HXCX.js";import"./recharts-BDyAk4nR.js";import"./analytics-Ba6zmRos.js";import"./plaid-IKw4XOsd.js";import"./dnd-C751Xq24.js";import"./stripe-DMRn4zHo.js";import"./lottie-CZmubsAo.js";import"./lexical-T2nlwAPk.js";import"./pdf-CdoB_huE.js";import"./utils-DKj7mVPA.js";import"./empty-B81gHGCB.js";import"./pdf-lib-RRzqb1kw.js";import"./index-pFVjg2n3.js";import"./url-BQNo9gT5.js";import"./index-lXh6fiHl.js";import"./decodeURIComponentSafe-D0vQ4d1Q.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="dad4a187-9239-434c-933d-12986b03509f",t._sentryDebugIdIdentifier="sentry-dbid-dad4a187-9239-434c-933d-12986b03509f")}catch{}})();const Q=z.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex: 1 1 auto;
|
|
4
|
-
flex-direction: row;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: center;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100vh;
|
|
9
|
-
background-color: ${t=>t.theme.colors.background};
|
|
10
|
-
box-shadow: ${t=>`0px 2px ${H.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
-
`;function ce(){const t=D(),i=v(),{setLoading:d,clearAllLoading:x}=F(),c=a.useRef(!1),f=a.useRef(!1),{code:b,realmId:T,state:y}=P(i.search),N=b!==""&&T!==""&&y!=="",I=m(l=>A(l)),e=m(l=>L(l)),n=m(l=>l.tenantState.fetchState),r=m(l=>l.tenantState.activeTenantFetchState.fetchState),o=p.getSignedInUser(),u=p.getActiveTenantForUser()?.tenantId,s=e?.externalConnections?.fetchState,E=e?.externalConnections?.saveConnectionState,S=e.externalConnections?.accounting[0]?.isValid;return a.useLayoutEffect(()=>{d(C.CONNECTION_AUTH)},[d]),a.useEffect(()=>{c.current||o==null||u==null||(c.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(C.TENANT_FETCHING),t(O(o.userId,u))))},[c,n,d]),a.useEffect(()=>{e.tenantId==null&&!f.current&&o!=null&&(f.current=!0,!(u==null||u!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(U(o.userId)))},[f,n,r]),a.useEffect(()=>{o==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||E!=="Error"||(d(C.CONNECTION_AUTH),t(h(o.userId,e.tenantId)))},[E]),a.useEffect(()=>{n!=="Completed"&&r!=="Completed"||o==null||e?.tenantId==null||(t(_(e.tenantId)),p.saveActiveTenantDomainForUser(e.tenantEmailDomain),j(o?.userId,o?.zeniSessionId,e.tenantId),k.updateAppLocaleID(R($(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||o==null||e==null||t(h(o.userId,e.tenantId)))},[n,r,s]),a.useEffect(()=>{I.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&p.saveSignedInUserTenants(I.tenantsCoreDetailsInOrder)},[I.tenantsCoreDetailsInOrder.length,n]),a.useEffect(()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||s!=="Completed"&&s!=="Error"||x()},[n,r,s]),e==null||n!=="Completed"&&r!=="Completed"||s!=="Completed"?null:N||S===!1?g.jsx(Q,{children:g.jsx(G,{})}):g.jsx(w,{to:"/",replace:!0})}export{ce as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-CS0rfBBF.js";import{z as n}from"./index-ilZtTEZn.js";import{g as d}from"./QBOConnectionScreen-DXq_HXCX.js";import"./sentry-CEfOando.js";import{g as p,N as s}from"./core-D6ttr5iw.js";import"./zeni-epic-state-Cl3jFj7z.js";import"./recharts-BDyAk4nR.js";import"./mui-vLo47rlo.js";import"./analytics-Ba6zmRos.js";import"./plaid-IKw4XOsd.js";import"./dnd-C751Xq24.js";import"./stripe-DMRn4zHo.js";import"./lottie-CZmubsAo.js";import"./lexical-T2nlwAPk.js";import"./pdf-CdoB_huE.js";import"./utils-DKj7mVPA.js";import"./empty-B81gHGCB.js";import"./pdf-lib-RRzqb1kw.js";import"./index-pFVjg2n3.js";import"./url-BQNo9gT5.js";import"./index-lXh6fiHl.js";import"./decodeURIComponentSafe-D0vQ4d1Q.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-CS0rfBBF.js";import{t as yt,A as Ve}from"./AddressScreen-ScWWmTbP.js";import ht from"./NotFoundScreen-BDl5tn8o.js";import{a as d}from"./sentry-CEfOando.js";import{h as be,g as ke,u as oe,i as Ie,j as I,N as B,l as St,n as et,o as Ct,p as Z}from"./core-D6ttr5iw.js";import{z as L,Q as ve,d as R,T as bt,s as z,K as se,e as Q,g as ue,ap as kt,Z as It,S as tt,I as nt,aq as Re,k as Se,ar as vt,o as Le,as as Ne,at as _t,au as Me,av as Et,aw as Tt}from"./index-ilZtTEZn.js";import{eX as X,fW as Ot,fE as _e,fC as Ee,bs as wt,fS as xt,bS as At,o8 as Pt,tn as Dt,tq as jt,MT as Ft,MU as Bt,ka as Ce,kd as at,Mo as Ut,bY as Vt,c6 as pe,tR as Te,tC as Rt,MV as le,tS as ot,Kh as Lt,le as st,MW as Nt,MX as Mt,rk as $t,hr as Gt,Mg as ge,ho as zt,Mh as Qt,x$ as Kt,ro as qt,hg as Ht,hj as $e,MY as it,MZ as Zt,E2 as Wt,M_ as Yt,E6 as Xt,tt as Jt,M$ as en,N0 as tn,k8 as nn,kb as an,u2 as on,tE as rt,tQ as sn,bE as Ge,cy as rn,u1 as ze,rD as cn,rr as dn,l6 as un,gi as ln,gh as pn,gg as mn,N1 as gn,tw as fn,u3 as yn,u6 as hn,u9 as Sn,uf as Cn,cY as bn}from"./zeni-epic-state-Cl3jFj7z.js";import{n as Oe}from"./mui-vLo47rlo.js";import{g as kn,h as In,q as ie}from"./QBOConnectionScreen-DXq_HXCX.js";import{u as vn,a as _n}from"./useEmailConnectResultRefresh-BzWsu8a4.js";import{u as En}from"./useChargeCardPusherEvents-Cvnaf2Z-.js";import"./recharts-BDyAk4nR.js";import"./analytics-Ba6zmRos.js";import"./plaid-IKw4XOsd.js";import"./dnd-C751Xq24.js";import"./stripe-DMRn4zHo.js";import"./lottie-CZmubsAo.js";import"./lexical-T2nlwAPk.js";import"./pdf-CdoB_huE.js";import"./utils-DKj7mVPA.js";import"./empty-B81gHGCB.js";import"./pdf-lib-RRzqb1kw.js";import"./index-pFVjg2n3.js";import"./url-BQNo9gT5.js";import"./index-lXh6fiHl.js";import"./decodeURIComponentSafe-D0vQ4d1Q.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="63f2b9f3-036d-4450-ba15-f063591111c3",t._sentryDebugIdIdentifier="sentry-dbid-63f2b9f3-036d-4450-ba15-f063591111c3")}catch{}})();const Tn=()=>{const t=be(),l=ke(),s=oe(),[o,p]=d.useState(!1),[c,f]=d.useState(!1),{tenantEmailDomain:S}=Ie(),e=L.getSignedInUser(),{useFeatureGate:n}=ve(),{isFeatureEnabled:u}=n(R.isApAgingFeatureEnabled),{isFeatureEnabled:C}=n(R.isArAgingFeatureEnabled),{isFeatureEnabled:h}=n(R.isDepositAccountsFeatureEnabled),{isFeatureEnabled:E}=n(R.isReferralFeatureEnabled),{isFeatureEnabled:i}=n(R.isExpenseAutomationEnabledV2),{isFeatureEnabled:v}=n(R.isDebitCardFeatureEnabled),k=bt(),r=I(y=>X(y)),{isFeatureEnabled:j}=n(R.isTreasuryEnabled),x=r.company!=null&&Ot(r.company),F=j&&x,U=I(y=>y.onboardingCustomerViewState.fetchState),g=r.excludedResources,N=r.companyId??L.getSignedInUserTenant(S)?.companyId;if(e==null)throw Error("Can't access onboarding flow without signing in...");const O=_e(v,r),P=Ee(r),A=[],D=g?.resources?.find(y=>y.resource==="/reports/top_expenses")==null,M=g?.resources?.find(y=>y.resource==="/reports/task_card")==null,W=r?.userRole!=null&&wt(r?.userRole),K=g?.resources?.find(y=>y.resource==="/bills")==null&&!W,J=g?.resources?.find(y=>y.resource==="/reimbursements")==null;D===!1&&A.push("top_expenses"),M===!1&&A.push("task_card"),K===!1&&A.push("bill_pay_card","bill_pay_promo_card"),J===!1&&A.push("reimbursement_card","reimbursement_promo_card"),h===!1&&A.push("zeni_accounts_promo_card"),E===!1&&A.push("rewards_card");const q=I(y=>{const _=[];u===!1&&_.push("accounts_payable_aging"),C===!1&&_.push("accounts_receivable_aging"),h===!1&&_.push("zeni_accounts_promo_card"),E===!1&&_.push("rewards_card"),k===!1&&_.push("expense_automation_card");const ee=xt(y,_,e,i,k,F);return At(ee.reportsInOrder.map(G=>({fetchState:G.fetchState,error:G.error}))).fetchState});d.useEffect(()=>{U!=="Completed"||o||O||P||(p(!0),s(Pt(e.userId,N,r.tenantId,!0,!1,A)))},[o,U,O,P,e,r.tenantId,s]);const $=d.useRef(!1),H=d.useCallback(()=>{const y={pathnameStackToGoBack:z(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};t(O?"../../checking":P?"../../cards":"../../dashboard",{state:y})},[t,l,O,P]),T=d.useCallback(()=>{$.current||($.current=!0,H())},[H]);return d.useEffect(()=>{const y=setTimeout(()=>f(!0),3e3);return()=>clearTimeout(y)},[]),d.useEffect(()=>{const y=setTimeout(T,6e3);return()=>clearTimeout(y)},[T]),d.useEffect(()=>{O||P||!c||q!=="Completed"&&q!=="Error"||T()},[c,q,O,P,T]),U!=="Completed"?a.jsx(B,{to:"../"}):a.jsxs(a.Fragment,{children:[a.jsx(se,{analytics:Q,onLoad:y=>y.trackPageLoaded(ue.Event.onboardingDashboardActivation)}),a.jsx(kt,{show:!0,onComplete:T})]})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Qe=(t,l)=>{const s=new Map(t.map(o=>[o.key,o]));return l.map(o=>{return p=s.get(o)?.status,p==="starting"||p==="building"?p:"idle";var p})},Ke=(t,l)=>{if(t.length===0)return!1;const s=new Map(t.map(o=>[o.key,o]));return l.every(o=>s.get(o)?.status==="ready")},qe=Oe.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
5
|
-
`,He=Oe.div`
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
align-items: center;
|
|
9
|
-
flex: 1;
|
|
10
|
-
min-width: 0;
|
|
11
|
-
|
|
12
|
-
${t=>t.skipLegacyDrawerOffset?`
|
|
13
|
-
width: 100%;
|
|
14
|
-
padding-left: ${Le.sp0};
|
|
15
|
-
`:`
|
|
16
|
-
min-width: calc(100% - ${Ne}px);
|
|
17
|
-
padding-left: ${Ne}px;
|
|
18
|
-
`}
|
|
19
|
-
|
|
20
|
-
${t=>t.theme.breakpoints.down("md")} {
|
|
21
|
-
width: 100%;
|
|
22
|
-
padding-left: ${Le.sp0};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
${t=>t.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
-
`,Ze=et(function(t,l){const{companyId:s,isAdmin:o,currentTenant:p,isOnAddressPage:c}=l,f=L.getSignedInUser(),S=p.tenantId,e={userId:f?.userId??"",sessionId:f?.zeniSessionId??"",tenantId:S??""},n=X(t),u=Te(t,s),C=it(t),h=pe(p?.userRole??[])&&u.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",E=Zt(t.userRoleConfigState);return{onboardingCustomerView:u,analytics:Q,isRefreshingViewInBackground:!1,isDisabled:h,companyTitles:E.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:_t.fileMicroServiceBaseUrl,authParams:e},signedInUser:L.getSignedInUser(),currentTenant:n,isAdmin:o,isOnAddressPage:c,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:C,isCardPaymentPopupOpen:!1,stripeKey:Se.stripeKey}},function(t,l){const{companyId:s,currentTenant:o,themeState:p,navigate:c,location:f}=l,{tenantEmailDomain:S}=o;return{onFetchLinkTokenClick:(e,n)=>{t(Cn(e,n))},onEstablishConnectionClick:(e,n)=>{t(Sn(e,n))},onUpdatePaymentAccountStatus:(e,n,u)=>{t(hn(e,n,u))},onUpdatePaymentAccountLoginStatus:(e,n)=>{t(yn(!1,e,n))},onEstablishConnectionSuccess:()=>{t(fn(s,!0,!1))},handleOnConnectClick:()=>{Q.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:e=>{t(le({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const n=e.map(u=>{const{officerType:C,userId:h,name:E,email:i,ssn:v,nationalityCountryCode:k,dob:r,phone:j,syncToken:x,selectDocument:F,role:U,ownership:g,isSelectedForVerification:N,userVerificationStatus:O,fileIds:P,isPhoneVerified:A}=u;let D;return F.selectDocumentType==="driverLicense"?D="driving_license":F.selectDocumentType==="passport"?D="passport":F.selectDocumentType==="stateId"?D="id_document":F.selectDocumentType==="ssnCard"&&(D="social_security_card"),{officerType:C,userId:h,firstName:E.firstName,lastName:E.lastName,email:i,ssn:v,nationalityCountryCode:k?.selectedOption!=null?Me(k.selectedOption):void 0,phone:j,birthday:r!=null?Ge(r?.toString()):r,syncToken:x,titleAtCompany:U.selectedOption,ownershipInCompany:g,documentTypeSelectedForVerification:D,isSelectedForVerification:N,userVerificationStatus:O,fileIds:P,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:A}});t(ze({officers:n}))},onGetOtp:(e,n)=>{t(mn(e,"CustomerOnboarding")),n!=null&&t(gn({officerType:n,phone:e}))},onResendOtp:e=>{t(pn(e,"CustomerOnboarding"))},onVerifyOtp:(e,n)=>{t(ln(e,n,"CustomerOnboarding"))},updateFilesEntity:e=>{t(un({files:e}))},onDeleteFile:e=>{t(dn(e))},onEditFileName:(e,n)=>{t(cn(e,n.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:n,companyIndustry:u,companyIndustryType:C,companyLegalName:h,companyTaxId:E,companyWebsite:i,companyPhone:v,primaryContactEmail:k,primaryContactName:r,primaryContactUserId:j,primaryContactSyncToken:x,syncToken:F,fileIds:U,typeOfIncorporation:g,stateOfIncorporation:N,incDate:O,companySourceOfFunds:P,companySourceOfFundsDescription:A,companySubIndustry:D,countriesOfOperations:M,purposeOfAccount:W,purposeOfAccountDescription:K,regulatedStatus:J,regulatedStatusDescription:q,transactionVolume:$,transactionVolumeDescription:H,usNexus:T,usNexusTypes:y}=e,_={companyId:s,companyDescription:n,companyIndustry:u.selectedOption,companyIndustryType:C?.selectedOption??"",companyLegalName:h,taxIdOrEIN:E,website:i!=""&&i!=null?rn(i):void 0,phone:v,syncToken:F,fileIds:U,incDate:O!=null?Ge(O?.toString()):O,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",companySourceOfFunds:P?.selectedOption??"",companySourceOfFundsDescription:A,companySubIndustry:D?.selectedOption??"",countriesOfOperations:M?.selectedOptions.map(G=>G.length===2?G:Me(G))??[],purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:K,regulatedStatus:J??"",regulatedStatusDescription:q,transactionVolume:$?.selectedOption??"",transactionVolumeDescription:H,usNexus:T,usNexusTypes:y?.selectedOptions??[]},ee={userId:j,firstName:r.firstName,lastName:r.lastName,email:k,syncToken:x};t(ze({companyDetails:_,primaryContactDetails:ee}))},onAddressClick:(e,n)=>{const u=Ye(S,e,n),C=z(f.state?.pathnameStackToGoBack,f.pathname);c(u,{state:{pathnameStackToGoBack:C}})},onRegisteredAddressClick:(e,n)=>{const u=Ye(S,e,n),C=z(f.state?.pathnameStackToGoBack,f.pathname);c(u,{state:{pathnameStackToGoBack:C}})},onUpdateCustomerView:(e,n,u)=>{t(sn(s,!1,n,u,e))},onAddressEditHandler:e=>{if(e!=null){const n=yt(e);t(st({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const e=z(f.state?.pathnameStackToGoBack,f.pathname);t(rt(s,!1,!1)),c("./activation",{state:{pathnameStackToGoBack:e}})},onUpdateStep:e=>{t(ot({step:e}))},onUpdateSubStep:e=>{t(on({subStep:e}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const e=z(f.state?.pathnameStackToGoBack,f.pathname);c("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{c(`/${S}/rewards`)},handleCreateCardSetupIntent:e=>{t(at(e))},handleConfirmCardSetupIntent:e=>{t(an(e))},updateCardPaymentModalState:e=>{t(le({isCardPaymentPopupOpen:e}))},handleAddCardPaymentSource:(e,n,u)=>{t(nn(e,n,u))},handleFetchPaymentSources:()=>{t(Ce())},resetCardPaymentViewState:()=>{t(tn())},handleResetCardPaymentErrorStatuses:()=>{t(en())},redirectToProductSuitePage:()=>{const e=z(f.state?.pathnameStackToGoBack,f.pathname);c(`/${S}/onboarding/thankyou`,{state:{pathnameStackToGoBack:e,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{s!=null&&t(Jt(s))},onIdentityDocumentUploadedForAutofill:e=>{if(s==null)return;const n=Yt(e.documentType);n!=null&&t(Xt({target:"onboarding",companyId:s,officerType:e.officerType,fileId:e.fileId,documentType:n}))},onCompanyDocumentUploadedForAutofill:e=>{s!=null&&t(Wt({target:"onboarding",companyId:s,fileId:e.fileId,documentType:e.documentType}))}}})(vt),de=({taxCFOCustomer:t=!1,isOnAddressPage:l=!1,appContent:s})=>{const o=be(),p=ke(),c=oe(),f=It(),S=tt(),[e,n]=d.useState(!1),[u,C]=d.useState(!1),[h,E]=d.useState(!1),{tenantEmailDomain:i}=Ie(),v=nt(),{useFeatureGate:k}=ve(),{isFeatureEnabled:r}=k(R.isDebitCardFeatureEnabled),j=St("/:tenantEmailDomain/onboarding")!==null&&p.search?.includes("code"),x=I(m=>m.onboardingCustomerViewState.fetchState),F=I(m=>m.onboardingCustomerViewState.currentStep),U=I(m=>m.onboardingCustomerViewState.uiState),g=I(m=>X(m)),N=I(m=>m.userRoleConfigState.fetchState),O=I(m=>m.cardPaymentViewState),P=Re(O.addCardPaymentSourceStatus.fetchState),A=O.addCardPaymentSourceStatus.fetchState,{code:D,realmId:M,state:W}=kn(p.search),K=g.externalConnections?.accounting[0],J=K?.connectionType,q=K?.connectionName,$=K?.connectionId??"",H=L.getSignedInUser()?.userId??"";d.useEffect(()=>{u||(C(!0),c(Ce()))},[u,c]),d.useEffect(()=>{h||(at(["card"]),E(!0))},[h]),d.useEffect(()=>{P==="In-Progress"&&A==="Completed"&&c(Ce())},[P,A]),d.useEffect(()=>{In(D,M,W,$,H)===!0&&g.externalConnections?.saveConnectionState!=="In-Progress"&&x==="Completed"&&(c(Ut(g.tenantId,{connection_type:J??"accounting",connection_name:q??"quickbooks_online",authorization_code:D,realm_id:M,connection_id:$,user_id:H},Vt(window.location.origin+"/onboarding/auth"))),Q.trackOnboardingSaveQBOConnection(M,$),o(p.pathname))},[D,M,W,p.pathname,x]),d.useEffect(()=>{ie.isInitiated===!1&&x==="Completed"&&ie.init("/onboarding/auth",g.tenantEmailDomain)},[x]);const T=g.companyId??L.getSignedInUserTenant(i)?.companyId,y=pe(g?.userRole??[]),_=I(m=>Te(m,T));d.useEffect(()=>{e||x!=="Not-Started"||T==null||(n(!0),c(Rt(T,!0,!j)))},[e,x,T]),d.useEffect(()=>{g.externalConnections?.saveConnectionState!=="Completed"&&g.externalConnections?.saveConnectionState!=="Error"||!U.isQBOPopupOpen||F!=="connect_ledger"||c(le({isQBOPopupOpen:!1}))},[g.externalConnections?.saveConnectionState]),d.useEffect(()=>{x==="Completed"&&j&&(c(ot({step:"connect_ledger"})),c(le({isQBOPopupOpen:!0})))},[j,x]),d.useEffect(()=>{N==="Not-Started"&&c(Lt(!0))},[N,c]);const ee=Re(_.companyDetailsLocalData?.addressStatus);d.useEffect(()=>{_.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&_.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&ee==null&&c(st({addressType:"company_registered_address",addressToCreate:_.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[_.companyDetailsLocalData?.addressStatus?.addressToCreate,_.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const G=_.isInterimEmailSent,we=L.getSignedInUser();if(we==null)throw Error("Can't access onboarding flow without signing in...");const ct=_e(r,g),dt=Ee(g),xe=g.company?.companyOnboardingInfo.isOnboardingCompleted,Ae=m=>m.trackPageLoaded(ue.Event.onboardingPage),Pe=g.productSettings.isOtherProductsEnabled,ut=g.productSettings.isTreasuryEnabled,De=On({tenantEmailDomain:i??"",signedInUserEmail:we.userEmail??"",companyId:T}),je=(({companyId:m})=>{const V=oe(),re=I(w=>w.onboardingCustomerViewState?.aiAgentsActivation),te=I(w=>X(w).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1),me=d.useCallback(()=>{V(Dt())},[V]);d.useEffect(()=>{me()},[me]);const Fe=d.useCallback(()=>{m==null||m===""||te||V(jt(m))},[m,te,V]),lt=d.useMemo(()=>{if(m==null||m==="")return[];const w=`private-encrypted-${m}`;return[`${w}.ledger-ingestion.counts-updated`,`${w}.ai-agents-activation.phase-changed`]},[m]),pt=d.useCallback((w,ne)=>{if(ne==null||typeof ne!="object")return;const b=ne;if(w!=="ledger-ingestion.counts-updated"){if(w==="ai-agents-activation.phase-changed"){const ce=typeof b.phase_key=="string"?b.phase_key:typeof b.key=="string"?b.key:"",Y=typeof b.status=="string"?b.status:"idle";if(ce==="")return;V(Bt({key:ce,status:Y==="starting"||Y==="building"||Y==="ready"?Y:"idle",startedAt:typeof b.started_at=="string"?b.started_at:void 0,completedAt:typeof b.completed_at=="string"?b.completed_at:void 0}))}}else V(Ft({customerCount:typeof b.customer_count=="number"?b.customer_count:void 0,glAccountCount:typeof b.gl_account_count=="number"?b.gl_account_count:void 0,targetTransactionCount:typeof b.target_transaction_count=="number"?b.target_transaction_count:void 0,transactionCount:typeof b.transaction_count=="number"?b.transaction_count:void 0,vendorCount:typeof b.vendor_count=="number"?b.vendor_count:void 0}))},[V]);return En({events:lt,onEvent:pt,onSubscribed:me}),d.useMemo(()=>{const w=re?.phases??[],ne=Qe(w,fe),b=Qe(w,ye),ce=Ke(w,fe),Y=Ke(w,ye),Be=w.some(ft=>ft.status!=="idle"),ae=!te&&!Be,Ue=te&&!Be,mt=Ue?fe.map(()=>"building"):ne,gt=Ue?ye.map(()=>"building"):b;return{ledgerRowStatuses:ae?void 0:mt,backgroundRowStatuses:ae?void 0:gt,showLedgerReadyInLabel:ae?void 0:ce,showBackgroundReadyInLabel:ae?void 0:Y,forceContinueEnabled:!ae||void 0,counts:re?.counts,onContinueClicked:Fe}},[re?.phases,re?.counts,te,Fe])})({companyId:T});if(xe===!0){if(!Pe)return ut?a.jsx(B,{to:"../../treasury"}):ct?a.jsx(B,{to:"../../checking"}):dt?a.jsx(B,{to:"../../cards"}):a.jsx(B,{to:"../../dashboard"});const m=_.updateStatus.fetchState==="In-Progress";if(Pe&&!m)return t?a.jsxs(qe,{children:[a.jsx(se,{analytics:Q,onLoad:V=>Ae(V)}),a.jsx(Ze,{navigate:o,location:p,companyId:T,currentTenant:g,isAdmin:y,isOnAddressPage:l,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),s!=null?a.jsx(He,{windowSize:f,skipLegacyDrawerOffset:l&&g.productSettings.isOtherProductsEnabled!==!0,children:s}):null]}):a.jsx(B,{to:"../../onboarding/thankyou"})}else if(xe===!1&&v?.loggedInUserRoleMap!=null)return G===!0?a.jsx(B,{to:"../../onboarding/thankyou"}):a.jsxs(qe,{children:[a.jsx(se,{analytics:Q,onLoad:m=>Ae(m)}),a.jsx(Ze,{navigate:o,location:p,companyId:T,currentTenant:g,isAdmin:y,isOnAddressPage:l,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),s!=null?a.jsx(He,{windowSize:f,skipLegacyDrawerOffset:l&&g.productSettings.isOtherProductsEnabled!==!0,children:s}):null]});return null},he="external_integrations",On=({tenantEmailDomain:t,signedInUserEmail:l,companyId:s})=>{const o=oe();vn();const{plaidAccounts:p,onAddPlaidAccount:c}=_n({companyId:s}),f=I(i=>i.plaidAccountViewState.external_account.plaidConnectionDetails),S=I(i=>X(i)),e=I(i=>i.tenantState.fetchState),n=I(i=>Nt(i,s)),u=I(i=>Mt(i,he)),C=d.useMemo(()=>new Set(u.map(i=>i.additionalInfo).filter(i=>i!=null)),[u]),h=S.tenantId,E=pe(S.userRole??[]);return d.useEffect(()=>{o($t(he))},[o]),d.useMemo(()=>({isAdmin:E,integrationsView:n,isLoading:e==="In-Progress",notifyMeRegisteredSlugs:C,saveChargeBeeState:n.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:n.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:n.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:n.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:n.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(n.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map(([i,v])=>[i,v?.message])),deleteConnectionState:n.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:n.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{o($e(h,"gmail",We()))},onConnectOutlook:()=>{o($e(h,"outlook",We()))},onConnectHubSpot:(i,v)=>{const k=n.externalConnections?.revenue?.find(j=>j.connectionName==="hubspot")?.connectionId;if(k==null)return;const r=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:i,client_secret:v,connection_id:k,redirect_uri:r,tenant_id:h})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(i)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(r)}`},onDisconnect:(i,v)=>{o(Ht(h,i,ge(v)))},onNotifyMe:i=>{o(qt(he,i,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",t),ie.handleClick()},onRefreshClick:()=>{n.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Kt())},onSaveChargeBeeCredentials:(i,v)=>{const k=n.externalConnections?.revenue?.find(r=>r.connectionName==="chargebee")?.connectionId;k!=null&&o(zt(h,k,ge("revenue"),Qt("chargebee"),{api_key:i,site:v}))},onSaveConnectorCredentials:i=>{o(Gt(h,ge("payments"),i))},plaidAccounts:p,onAddPlaidAccount:c,plaidConnectionDetails:f}),[E,n,e,C,h,l,t,o,p,c,f])};function We(){const t=new URL(window.location.href);return t.searchParams.set("onboarding_step","connect_data_source"),t.toString()}function Ye(t,l,s){let o=`/${t}/onboarding/address`;return o=s!=null?o.concat(`/edit/${l}/${encodeURIComponent(s)}`):o.concat(`/new/${l}`),o}const Xe=Oe.div`
|
|
27
|
-
display: flex;
|
|
28
|
-
height: 100vh;
|
|
29
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
30
|
-
`,Je=et(function(t,l){const{companyId:s,currentTenant:o}=l,p=Te(t,s),c=it(t);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(c.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:pe(o?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:L.getSignedInUser(),currentTenant:o,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true"}},function(t,l){const{currentTenant:s,themeState:o,navigate:p,location:c}=l,{tenantEmailDomain:f}=s;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const S=z(c.state?.pathnameStackToGoBack,c.pathname);p("/signout",{replace:!0,state:{pathnameStackToGoBack:S,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{p(`/${f}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const S=z(c.state?.pathnameStackToGoBack,c.pathname);p(`/${f}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:S,message:"UpdatePaymentAddressDetail"}})}}})(Tt),wn=()=>{const t=be(),l=oe(),s=ke(),o=tt(),{useFeatureGate:p}=ve(),{isFeatureEnabled:c}=p(R.isDebitCardFeatureEnabled),{tenantEmailDomain:f}=Ie(),S=nt(),[e,n]=d.useState(!1);d.useEffect(()=>{e===!1&&s.state?.message==="OnboardingThankyou"&&n(!0)},[s.state]);const u=I(r=>X(r)),C=u.productSettings.isOtherProductsEnabled;d.useEffect(()=>{l(rt(h,!1,!C))},[]);const h=u.companyId??L.getSignedInUserTenant(f)?.companyId;if(S.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const E=_e(c,u),i=Ee(u),v=I(r=>r.onboardingCustomerViewState.updateStatus.fetchState),k=u.company?.companyOnboardingInfo.isOnboardingCompleted;if(k!==!0||C)return v==="Completed"&&k===!0&&C&&S?.loggedInUserRoleMap!=null?a.jsxs(Xe,{children:[a.jsx(se,{analytics:Q,onLoad:r=>{r.trackPageLoaded(ue.Event.onboardingLandingPage,"Onboarding",bn(u.productSettings))}}),a.jsx(Je,{navigate:t,showUpdatePaymentDetailButton:C,location:s,companyId:h,currentTenant:u,themeState:o,isVisitingFirstTime:e})]}):v==="Completed"&&k===!1&&S?.loggedInUserRoleMap!=null?a.jsxs(Xe,{children:[a.jsx(se,{analytics:Q,onLoad:r=>{r.trackPageLoaded(ue.Event.onboardingInterimPage)}}),a.jsx(Je,{navigate:t,showUpdatePaymentDetailButton:C,location:s,companyId:h,currentTenant:u,themeState:o,isVisitingFirstTime:e})]}):a.jsx(Et,{});{const r={pathnameStackToGoBack:s.state?.pathnameStackToGoBack,message:"activation"};return E?a.jsx(B,{to:"../../checking",state:r,replace:!0}):i?a.jsx(B,{to:"../../cards",state:r,replace:!0}):a.jsx(B,{to:"../../dashboard",state:r,replace:!0})}};function ta(){return a.jsxs(Ct,{children:[a.jsx(Z,{path:"/",element:a.jsx(de,{})}),a.jsx(Z,{path:"/billing/edit",element:a.jsx(de,{taxCFOCustomer:!0})}),a.jsx(Z,{path:"/thankyou",element:a.jsx(wn,{})}),a.jsx(Z,{path:"/activation",element:a.jsx(Tn,{})}),a.jsx(Z,{path:"/address/edit/:addressType/:addressId",element:a.jsx(de,{isOnAddressPage:!0,appContent:a.jsx(Ve,{})})}),a.jsx(Z,{path:"/address/new/:addressType",element:a.jsx(de,{isOnAddressPage:!0,appContent:a.jsx(Ve,{})})}),a.jsx(Z,{path:"*",element:a.jsx(ht,{})})]})}export{ta as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as v}from"./liveblocks-CS0rfBBF.js";import{a as u}from"./sentry-CEfOando.js";import{u as y,j as b,n as w,g as A,N as L}from"./core-D6ttr5iw.js";import{LU as U,eX as _,g2 as N,LV as k,oa as R,LW as z}from"./zeni-epic-state-Cl3jFj7z.js";import{u as j,z as f,L as T,t as I,a as O,b as $}from"./index-ilZtTEZn.js";import"./mui-vLo47rlo.js";import{t as P}from"./getLocaleForTenant-O3Y2pcaQ.js";import"./recharts-BDyAk4nR.js";import"./analytics-Ba6zmRos.js";import"./plaid-IKw4XOsd.js";import"./dnd-C751Xq24.js";import"./stripe-DMRn4zHo.js";import"./lottie-CZmubsAo.js";import"./lexical-T2nlwAPk.js";import"./pdf-CdoB_huE.js";import"./utils-DKj7mVPA.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="d8287f04-58d7-42de-8b3b-f108d052d52f",t._sentryDebugIdIdentifier="sentry-dbid-d8287f04-58d7-42de-8b3b-f108d052d52f")}catch{}})();const Q=w(function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}})(function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map(l=>l.tenantEmailDomain),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce((l,F)=>l||i.split("/").find(D=>D===F)!=null,!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(L,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}});function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b(e=>U(e)),n=b(e=>e.tenantState.fetchState),i=b(e=>e.tenantState.error),a=b(e=>e.tenantState.activeTenantFetchState.fetchState),c=b(e=>_(e)),d=f.getSignedInUser();return u.useLayoutEffect(()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)},[a,n]),u.useEffect(()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(N(d.userId,e))))},[n,a,d,t]),u.useEffect(()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!k(i))&&t(R(e.userId)))},[n,a,i,d,t]),u.useEffect(()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())},[m.tenantsCoreDetailsInOrder,n]),u.useEffect(()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(O.updateAppLocaleID(P(c)),o())},[n,a,c]),v.jsx(Q,{})}const V=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of V)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{j as l}from"./liveblocks-CS0rfBBF.js";import{h as w,g as C,j as h,n as A,i as B}from"./core-D6ttr5iw.js";import{Q1 as k,Q8 as _,gi as W,gh as X,gg as q,jv as J,N9 as K,ru as L,eX as V,Pz as D,jt as T,Q2 as v,Qb as j,jr as F,jO as G}from"./zeni-epic-state-Cl3jFj7z.js";import{bA as M,Z as N,Q as R,z as U,m as O,r as p,d as S,w as Q,bB as Y,o as Z,bC as ee,s as te}from"./index-ilZtTEZn.js";import{n as z}from"./mui-vLo47rlo.js";import"./sentry-CEfOando.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8719a0d9-f060-44cf-b296-a406927b51bb",e._sentryDebugIdIdentifier="sentry-dbid-8719a0d9-f060-44cf-b296-a406927b51bb")}catch{}})();const ne=A(null,function(e,t){return{onSaveVendor:n=>{e(J(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(K("common")),n!=null&&e(L(n))},onGetOtp:n=>{e(q(n,"BillPayVendor"))},onResendOtp:n=>{e(X(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(W(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(_(n,a,o))}}})(M);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h(i=>k(i,e));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=z.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
`,oe=A(function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{navigate:n,location:a,vendorId:o}=t;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{e(F(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(a.state?.pathnameStackToGoBack),i=s.poppedPathname??E();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(v())},onACHDetailsUpdated:s=>{const{bankAccountSection:i}=s;e(j({data:i}))},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??E(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}})}e(v())}}})(Y);function fe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:i}=B(),d=e??s,{useFeatureGate:r}=R(),c=U.getSignedInUser(),b=h(u=>V(u)),g=O(),x=p(a.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h(u=>k(u,d)),{isFeatureEnabled:I}=r(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(S.isDepositAccountsFeatureEnabled);if(c==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Q,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(H,{vendorId:d,billId:i}),l.jsx(oe,{location:a,navigate:n,billId:i,vendorId:d,currentTenant:b,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const E=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},me=(e,t,n)=>{let a=`/${e}/bill/${encodeURIComponent(t)}`;return n=="draft"&&(a+="/edit"),a},he=e=>`/${e}/bills`,ke=(e,t)=>{let n=`/${e}/bill`;return n=t!=null?n.concat(`/${t}/edit`):n.concat("/new"),n},P=(e,t,n,a)=>{let o=`/${e}/bill`;return o+=n!=null?`/${n}/edit/vendor`:"/new/vendor",o+=a!=null?`/${a}/edit/${t}`:`/create/${t}`,o};function ve(e,t,n){return P(e,"ach",t,n)}function Se(e,t,n){return P(e,"domestic",t,n)}function ge(e,t,n){return P(e,"international",t,n)}const se=(e,t,n)=>{let a=`/${e}/bill/`;return a=n!=null?a.concat(`${encodeURIComponent(n)}/${t}/`):a.concat(`new/${t}/`),a},re=z.div`
|
|
10
|
-
display: flex;
|
|
11
|
-
height: 100vh;
|
|
12
|
-
width: 100%;
|
|
13
|
-
flex: 1 1 auto;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: center;
|
|
16
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
17
|
-
box-shadow: ${e=>`0px 2px ${Z.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
18
|
-
`,ie=A(function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:n,navigate:a,location:o,vendorId:s,currentTenant:i}=t,{tenantEmailDomain:d}=i;return{onFetchBankName:r=>{e(G(r))},onSaveHandler:r=>{e(F(t.bankAccountContext,r,"us-domestic",s))},onWireDetailsUpdated:r=>{const{bankAccountSection:c}=r;e(j({data:c}))},onCancel:()=>{(()=>{const r=p(o.state?.pathnameStackToGoBack),c=r.poppedPathname??$();a(c,{state:{pathnameStackToGoBack:r.newStack}})})(),e(v())},onAddressClick:r=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const c=se(d,r,n),b=te(o.state?.pathnameStackToGoBack,o.pathname);a(c,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const r=p(t.location.state?.pathnameStackToGoBack),c=r.poppedPathname??$(0);t.navigate(c,{state:{pathnameStackToGoBack:r.newStack}})}e(v())}}})(ee);function xe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:i}=B(),d=e??s,r=U.getSignedInUser(),{useFeatureGate:c}=R(),b=O(),g=h(u=>V(u)),x=p(a.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h(u=>k(u,d)),{isFeatureEnabled:I}=c(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=c(S.isDepositAccountsFeatureEnabled);if(r==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Q,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${Z.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(re,{windowSize:o,children:[l.jsx(H,{vendorId:d,billId:i}),l.jsx(ie,{location:a,navigate:n,billId:i,vendorId:d,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const $=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{fe as A,xe as D,H as V,me as a,se as b,ke as c,Se as d,he as g,ge as i,ve as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-CS0rfBBF.js";import{Z as c,A as l,m as f}from"./index-ilZtTEZn.js";import{D as p}from"./mui-vLo47rlo.js";import"./sentry-CEfOando.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="6c7fcb16-2846-45a2-9de2-7f28416bec9e",e._sentryDebugIdIdentifier="sentry-dbid-6c7fcb16-2846-45a2-9de2-7f28416bec9e")}catch{}})();const b={drawerLeftMargin:new l(0,0,240)};function m(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:s}=e,n=c(),a=o?.valuePx(n)??b.drawerLeftMargin.valuePx(n),d=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${a})`}},slotProps:{backdrop:{style:{backgroundColor:d.colors.black,opacity:.8,cursor:"pointer"}}},onClose:s,children:t})}export{m as D};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-CS0rfBBF.js";import{a as d}from"./sentry-CEfOando.js";import{h as A,u as B,g as G,i as q,j as l,N as F,n as O,o as K,p as W}from"./core-D6ttr5iw.js";import{Oh as _,eX as M,NF as R,ly as Y,Ka as k,Om as $,N8 as z,ky as L,Kb as S,NK as V,NL as X,Na as H,N9 as J}from"./zeni-epic-state-Cl3jFj7z.js";import{aW as Q,e as U,r as Z,s as tt}from"./index-ilZtTEZn.js";import"./mui-vLo47rlo.js";import{d as b}from"./decodeURIComponentSafe-D0vQ4d1Q.js";import{w as et}from"./withTransactionSidePanel-DeW-W6do.js";import{f as at,c as nt}from"./routePaths-C1rKvS5o.js";import"./recharts-BDyAk4nR.js";import"./analytics-Ba6zmRos.js";import"./plaid-IKw4XOsd.js";import"./dnd-C751Xq24.js";import"./stripe-DMRn4zHo.js";import"./lottie-CZmubsAo.js";import"./lexical-T2nlwAPk.js";import"./pdf-CdoB_huE.js";import"./utils-DKj7mVPA.js";import"./useAskAiCfoHostNavButtonProps-33WX5dhg.js";import"./TransactionDetailScreen-DB5lxQrk.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="97bb22cb-ca01-423d-a889-734442f8f09f",a._sentryDebugIdIdentifier="sentry-dbid-97bb22cb-ca01-423d-a889-734442f8f09f")}catch{}})();const ot=O(function(a,t){const e=t.entity,o=$(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:U,isAccountingClassesEnabled:L(a)}},function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(J("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(V()),a(X()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}})(Q),it=et(function({entityType:a,...t}){const e=A(),o=B(),c=G(),[m,h]=d.useState(!1),[T,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:N}=q(),r=b(x??""),f=b(N??""),p=rt(r,f),j=[r,f].filter(n=>n!=null),i={name:f,id:r,type:a,zeniId:r,qboId:r},g=l(n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter")),v=l(n=>M(n).company?.companyInfo.firstMonthOfFY??1),u=l(n=>R(n.trendWithTransactionsState,i,"EntityDetail"));d.useEffect(()=>{m===!1&&p===!0&&(h(!0),o(Y(i)))},[m,p,i]);const E=l(n=>n.trendState.fetchState),P=u?.selectedPeriod?.timePeriod??g,w=function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y}(u?.selectedPeriod?.timePeriod,g);return d.useEffect(()=>{m===!0&&T===!1&&E==="Completed"&&(D(!0),P!=null&&o(k(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))},[m,T,E]),p?s.jsx(ot,{firstMonthOfFY:v,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:w,resetTrendIsFetchedStates:()=>{h(!1),D(!1)},...t}):s.jsx(F,{to:I(j.length)})}),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function xt({entityType:a}){return s.jsx(K,{children:s.jsx(W,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{xt as EntityDetailRoutes,xt as default};
|