@zeniai/web-app-ui 5.3.56-dev → 5.3.57-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/{AccountMappingScreen-BJKuQUQK.js → AccountMappingScreen-jr8NYSf0.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-CkH9aaHO.js → ActualMatchingMatchDetailScreen-D7uo3hon.js} +1 -1
- package/dist/assets/AddressRoutes-B7MK1TKw.js +1 -0
- package/dist/assets/AddressScreen-CzeehWEB.js +9 -0
- package/dist/assets/AiCfoScreen-B6Qm6OGC.js +22 -0
- package/dist/assets/{AppDrawer-DFw9ygHT.js → AppDrawer-CWthlF8n.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-CrSvpjTF.js → BillPayApprovalRoutes-BmUgGtKM.js} +1 -1
- package/dist/assets/{BillPayRoutes-D25IkCRG.js → BillPayRoutes-CP47fxd2.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-C3i585S_.js → BusinessVerificationPageScreen-tFrQ8x6S.js} +2 -2
- package/dist/assets/CardsAiCfoScreen-CrGCfJAL.js +14 -0
- package/dist/assets/{ChargeCardRoutes-Be1yd7vs.js → ChargeCardRoutes-HEtZ4-6z.js} +10 -10
- package/dist/assets/CompanyPassportScreen-BntoeEDx.js +1 -0
- package/dist/assets/ConnectionAuthScreen-Dat6_wbT.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-yyUnJxkm.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-DZPhXsuR.js → CustomerOnboardingRoutes-D7AR6_5E.js} +2 -2
- package/dist/assets/{DashboardRoutes-BNQ_G2Ja.js → DashboardRoutes-xYm5IqDw.js} +3 -3
- package/dist/assets/{DefaultTenantHome-CQb3BNY_.js → DefaultTenantHome-COzEbzIO.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DNQyCQC6.js +18 -0
- package/dist/assets/{DrawerScreen-BjVCvYOx.js → DrawerScreen-B_TpDjbP.js} +1 -1
- package/dist/assets/EntityDetailRoutes-ZwAM0SZG.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-Beqj_B98.js → ExpenseAutomationRoutes-07jYvY-X.js} +1 -1
- package/dist/assets/FeaturePreviewScreen-Bxq-5yf4.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-uMS-Wn41.js → HubSpotOAuthCallbackScreen-BRU2IAyD.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-0KkUrcUF.js → InboxNotificationsProvider-XqYApNHe.js} +1 -1
- package/dist/assets/{InvoicingRoutes-B7hVOPnd.js → InvoicingRoutes-r0fcBRFQ.js} +2 -2
- package/dist/assets/{MagicLinkRoutes-0XNlBf8h.js → MagicLinkRoutes-CCEHT5BA.js} +2 -2
- package/dist/assets/MagicLinkSignInScreen-B_zN3L0m.js +12 -0
- package/dist/assets/{MobileAppDrawer-C4BbqfYY.js → MobileAppDrawer-BQafCiIm.js} +1 -1
- package/dist/assets/NotFoundScreen-BG7wRKZX.js +1 -0
- package/dist/assets/{NotificationRoutes-ui3la9Pl.js → NotificationRoutes-D_uvLz5W.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BxSGmmYb.js → OAuthConsentScreen-BoC0mDLZ.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-CQxitPGl.js → PandLWithForecastRoutes-eFW0kX5c.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-DZFH9-Dr.js → PaymentLinkScreen-C1EeaAzl.js} +9 -9
- package/dist/assets/{PeopleRoutes-CTbqr9KR.js → PeopleRoutes-DvSn9Sjn.js} +5 -5
- package/dist/assets/{PerformanceRoutes-DqqsTiLL.js → PerformanceRoutes-DdN4A-Qw.js} +1 -1
- package/dist/assets/{Preview-CUqbKJrc.js → Preview-u3wRUzMg.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-83wGiY1-.js → QBOConnectionScreen-DphcQ8vo.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CefdRKJA.js → ReimbursementApprovalRoutes-CZw_F1Nq.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DVIQ0iGz.js → ReimbursementApprovalRuleDetailScreen-BVnDjDhK.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-CYSobdK2.js → ReimbursementRoutes-BOqV_hzz.js} +4 -4
- package/dist/assets/{ReportsRoutes-C0_U8cPe.js → ReportsRoutes-DyLPjuj4.js} +1 -1
- package/dist/assets/RewardsRoutes-AUfiOtCj.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BQ_Jeykv.js → ScheduleDetailsPrepaidExpensesScreen-DhoHikDf.js} +5 -5
- package/dist/assets/ScreenRoutes-CfEzduwn.js +2 -0
- package/dist/assets/{SettingsRoutes-tupY8NX6.js → SettingsRoutes-DTOWMWw9.js} +6 -6
- package/dist/assets/{SetupPagesScreen-IP9GnMvD.js → SetupPagesScreen-gianurSV.js} +1 -1
- package/dist/assets/SignInScreen-DE6DoKmD.js +1 -0
- package/dist/assets/SignOutScreen-D9LIjKFn.js +9 -0
- package/dist/assets/{TaskListScreen-BLrDzaze.js → TaskListScreen-BmcgOAIm.js} +2 -2
- package/dist/assets/{TaskRoutes-D1AnOebo.js → TaskRoutes-DkM_Zzie.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-BYam8_IE.js +1 -0
- package/dist/assets/{TransactionDetailScreen-DVTW16A1.js → TransactionDetailScreen-Ce-oRpAr.js} +2 -2
- package/dist/assets/{TransactionListRoutes-7PO54jHW.js → TransactionListRoutes-CylRSxMs.js} +1 -1
- package/dist/assets/{TreasuryRoutes-BLoMlu93.js → TreasuryRoutes-B6L2qWvE.js} +5 -5
- package/dist/assets/{VendorsRoutes-u3UbdNbB.js → VendorsRoutes-ByRbQjm3.js} +10 -10
- package/dist/assets/{WiseConfirmationScreen-BwqpmX8S.js → WiseConfirmationScreen-BnAAqPup.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-CDbRnTrg.js → ZeniAccountRoutes-B_VmtdQ_.js} +9 -9
- package/dist/assets/{ZeniAccountStatementScreen-lhzrOeGm.js → ZeniAccountStatementScreen-D3B6toGi.js} +1 -1
- package/dist/assets/{accountMappingHelper-DAAt9xyM.js → accountMappingHelper-C05BGWXi.js} +1 -1
- package/dist/assets/{analytics-B3pE_Rhv.js → analytics-CdlFAR7_.js} +1 -1
- package/dist/assets/analyticsHelper-Ck5nyZDK.js +1 -0
- package/dist/assets/{core-BtMsWhj9.js → core-BxGWoVcT.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-roe2OgG2.js → decodeURIComponentSafe-COWOoCD-.js} +1 -1
- package/dist/assets/{dnd-NbF88ub7.js → dnd-4QLQvWVu.js} +1 -1
- package/dist/assets/{empty-Cx0IX9BK.js → empty-CKa69gT2.js} +1 -1
- package/dist/assets/{empty-CaVGMRjr.js → empty-DTpu2BE3.js} +1 -1
- package/dist/assets/{emptyVideoElement-BixupcUv.js → emptyVideoElement-CE_3f_HJ.js} +1 -1
- package/dist/assets/{epic-CvUAcLT0.js → epic-DoarAhcY.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-oTNGiYVa.js → expenseAutomationHelper-CY9qPhLr.js} +1 -1
- package/dist/assets/{getLocaleForTenant-omtGYMrM.js → getLocaleForTenant-BqjAu1V6.js} +1 -1
- package/dist/assets/{index-D4z6ymU4.js → index-BGEGJOhz.js} +1 -1
- package/dist/assets/{index-Dh_E8szn.js → index-ByUkyI1p.js} +2 -2
- package/dist/assets/{index-CscHaeoB.js → index-CQNQucIy.js} +1 -1
- package/dist/assets/{index-DH8aYJll.js → index-ClrEdm3Z.js} +1 -1
- package/dist/assets/{index-BdE3bEFg.js → index-DKWZmEZ6.js} +16402 -16402
- package/dist/assets/{index-Dpw9AdmE.js → index-Dp8eQc1C.js} +1 -1
- package/dist/assets/{index-De8Bm1rc.js → index-I0RC_WxM.js} +1 -1
- package/dist/assets/{index-CgkBXLPm.js → index-iq3MsRX8.js} +1 -1
- package/dist/assets/{lexical-OFbGuPVJ.js → lexical-DXD9Kn-N.js} +1 -1
- package/dist/assets/{liveblocks-CVtnm86a.js → liveblocks-SKYC1C2A.js} +1 -1
- package/dist/assets/{lottie-DX_KUXtr.js → lottie-B7wq19x9.js} +1 -1
- package/dist/assets/{mui-DdZ2UeI1.js → mui-KBl5-FbY.js} +1 -1
- package/dist/assets/{pathToGoBack-DUa0cp7d.js → pathToGoBack-YHA3dWdG.js} +1 -1
- package/dist/assets/{pdf-Ck6JVYdq.js → pdf-B0ceY1o5.js} +3 -3
- package/dist/assets/{pdf-lib-BXXBaukU.js → pdf-lib-CWPynulQ.js} +1 -1
- package/dist/assets/{plaid-nsaMWH8B.js → plaid-YTuVWNGR.js} +1 -1
- package/dist/assets/{pusher-D5GzcojU.js → pusher-CKqdMamV.js} +1 -1
- package/dist/assets/{react-DXmkD3ns.js → react-C6vdSbOp.js} +1 -1
- package/dist/assets/{react-BgVq8Vpa.js → react-CXCp6-Q4.js} +1 -1
- package/dist/assets/{react-DhgbPzuh.js → react-Chh3O9yq.js} +1 -1
- package/dist/assets/{react-CWdFYh5J.js → react-CsK9fFr3.js} +1 -1
- package/dist/assets/{react-0n9ZpUxt.js → react-DAKIElX4.js} +1 -1
- package/dist/assets/{react-C-0cdt-e.js → react-DuVFeEpk.js} +1 -1
- package/dist/assets/{recharts-DhwkC6iY.js → recharts-CflkB2e4.js} +1 -1
- package/dist/assets/{routePaths-znAFGC3M.js → routePaths-Z5dkQJU8.js} +1 -1
- package/dist/assets/{sentry-BzkfMVrG.js → sentry-DZfHa7Ie.js} +1 -1
- package/dist/assets/{stripSplatSuffix-BORWr7jN.js → stripSplatSuffix-pcOF7B7F.js} +1 -1
- package/dist/assets/{url-DLwy6QED.js → url-98Mp7WPJ.js} +1 -1
- package/dist/assets/{url-B1VibTls.js → url-HFE8hMjk.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-BATx-hw7.js → useActualMatchingMatchDetail-B1LonM7y.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-RBwji9iv.js → useAiCfoDashboardSuggestedQuestionsChips-C0DuY81W.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BIY8jQkA.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-D6w93u1p.js → useChargeCardPusherEvents-3n5HIVFd.js} +1 -1
- package/dist/assets/{useDeviceId-Cvm1S2SE.js → useDeviceId-6zQhAsQ2.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BuXXdg7d.js → useEmailConnectResultRefresh-CDKbf6Wa.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-CRJTlzEQ.js → useInitialThreadRequest-DEcIGuME.js} +1 -1
- package/dist/assets/useTaskManagerAccess-BnFoXekz.js +1 -0
- package/dist/assets/{useTaskManagerPusherEvents-BsdLgh09.js → useTaskManagerPusherEvents-VcaHPnA5.js} +1 -1
- package/dist/assets/{utils-BrzWPNCR.js → utils-BqbdeqC-.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-BrwXnQ2x.js → withTransactionSidePanel-F0u06ceZ.js} +2 -2
- package/dist/assets/{zeni-epic-state-xhG_euwn.js → zeni-epic-state-C7XRcjyb.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-CHBmN4QX.js +0 -1
- package/dist/assets/AddressScreen-DVcm6rtP.js +0 -9
- package/dist/assets/AiCfoScreen-DLhxVK3m.js +0 -22
- package/dist/assets/CardsAiCfoScreen-CGVXrGo3.js +0 -14
- package/dist/assets/CompanyPassportScreen-BbxvKQ4h.js +0 -1
- package/dist/assets/ConnectionAuthScreen-DW_RpnUG.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-B9oqAEpw.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-B1WqjoYC.js +0 -18
- package/dist/assets/EntityDetailRoutes-DPPxLcP3.js +0 -1
- package/dist/assets/FeaturePreviewScreen-DrZBk8z9.js +0 -1
- package/dist/assets/MagicLinkSignInScreen-CmEuq8yZ.js +0 -12
- package/dist/assets/NotFoundScreen-BudPMncf.js +0 -1
- package/dist/assets/RewardsRoutes-Cuv6zmgH.js +0 -1
- package/dist/assets/ScreenRoutes-CWs8sPE7.js +0 -2
- package/dist/assets/SignInScreen-C_QB0DLT.js +0 -1
- package/dist/assets/SignOutScreen-Dlg2jHAz.js +0 -9
- package/dist/assets/TransactionDetailRoutes-aJqQLpSX.js +0 -1
- package/dist/assets/analyticsHelper-DvdruwkE.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-yiVAQfVL.js +0 -1
- package/dist/assets/useTaskManagerAccess-CtzHb9vx.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-CVtnm86a.js";import{u as me,j as d,h as de,g as he,i as Ne,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-BtMsWhj9.js";import{fS as Pt,$U as is,g2 as wt,bt as Te,$V as ds,$W as ls,fH as fn,$X as Pn,fQ as wn,$Y as vn,$Z as Tn,$_ as Fn,$$ as xn,fR as Bn,g1 as Ln,a00 as Rn,a01 as us,fX as ms,fW as Cs,a02 as ps,K6 as On,g4 as ia,a03 as hs,a04 as fs,fJ as gs,fI as bs,gh as ze,fZ as Un,fY as jn,a05 as Ss,f_ as ys,JE as Is,JD as ks,JH as Es,JJ as As,ga as Ds,fE as Mn,a06 as _s,a07 as Ps,gf as Nn,a08 as ws,gg as yt,JP as vs,JM as Ts,fF as fe,a09 as qa,dZ as Fe,di as xe,d_ as Be,g_ as da,cB as la,a0a as ua,a0b as vt,CZ as Ga,m7 as Ka,a0c as za,Km as ka,g5 as qe,Ko as Tt,lZ as Vn,a0d as ma,Ka as _a,a0e as Fs,a0f as xs,Kd as Ja,a0g as Bs,Z5 as Qa,g0 as Hn,Kj as ba,iq as Ls,a0h as $n,fT as Ca,br as Rs,a0i as Os,gG as Xa,gF as et,KS as Us,gE as at,a0j as Gn,cu as Kn,da as js,Z4 as wa,Lr as zn,a0k as gn,L1 as Pa,a0l as Zn,Ls as Ms,Zu as Ns,Lt as Vs,My as Hs,Cd as $s,Ms as Gs,a0m as Ks,Kn as oa,a0n as zs,a0o as Zs,a0p as Ys,a0q as Ws,a0r as qs,a0s as Ft,a0t as Js,KD as Yn,Kw as Qs,a0u as Xs,h0 as eo,a0v as Wn,KM as qn,KQ as Jn,g$ as ao,a0w as to,Ld as Qn,a0x as no,a0y as ro,a0z as so,KO as Xn,Kz as er,Kg as ar,KI as tr,KG as nr,KK as oo,a0A as rr,a0B as co,gc as io,gd as lo,ge as uo,a0C as tt,g6 as sr,dc as xt,a0D as mo,a0E as Co,a0F as po,a0G as ho,KY as It,Lk as fo,Lg as go,KU as bo,Li as So,L8 as yo,La as Io,a0H as or,Lq as $a,Sh as ko,a0I as Eo,a0J as Ao,a0K as Do,a0L as cr,a0M as _o,LN as Po,L0 as ir,KX as Me,K$ as wo,a0N as vo,a0O as To,K7 as Fo,a0P as dr,f$ as lr,a0Q as xo,K9 as Bo,K8 as bn,a0R as Lo,a0S as Ro,a0T as Oo,Vp as Uo,a0U as Bt,a0V as jo,xj as ur,mH as Mo,ie as No,LS as Vo,a0W as mr,fN as Ho,fO as $o,a0X as Go,dO as Ko,g3 as zo,LI as Zo,LC as We,bq as Yo,bJ as Wo,cG as qo,bK as Jo,Ug as Qo}from"./zeni-epic-state-xhG_euwn.js";import{Q as Le,df as Cr,a5 as we,dg as pr,dh as hr,di as Xo,G as ea,at as Lt,dj as ec,dk as ac,a as fr,e as gr,as as br,p as ke,c as le,v as Y,h as ya,dl as Sr,dm as tc,dn as nc,z as te,a8 as va,d4 as nt,dp as rc,dq as sc,dr as oc,a2 as Ta,bj as Qe,bG as Rt,ds as cc,ac as Fa,Z as rt,E as Ot,j as ae,w as st,dt as ic,bS as Sa,du as kt,dv as dc,a9 as Ut,dw as lc,af as yr,aw as Et,dx as uc,ar as Ir,K as kr,T as Er,bo as mc,dy as Cc,dz as pc,dA as hc,dB as fc,dC as gc,dD as bc,H as Za,dE as Sc,dF as yc,m as ht,U as Ic,dG as kc,dH as Ec,dI as Ac,aj as Dc,dJ as _c,dK as Pc,g as wc}from"./index-BdE3bEFg.js";import{n as Ve,D as Ar,S as vc}from"./mui-DdZ2UeI1.js";import{a as r}from"./sentry-BzkfMVrG.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-yiVAQfVL.js";import{M as Ee}from"./MobileAppDrawer-C4BbqfYY.js";import{d as jt}from"./recharts-DhwkC6iY.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as Tc,i as Mt,P as Fc,j as Nt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-IP9GnMvD.js";import{u as vr}from"./useInitialThreadRequest-CRJTlzEQ.js";import ot from"./NotFoundScreen-BudPMncf.js";import{u as Vt}from"./useChargeCardPusherEvents-D6w93u1p.js";import{n as yn}from"./utils-BrzWPNCR.js";import{t as Lc}from"./AddressScreen-DVcm6rtP.js";import"./analytics-B3pE_Rhv.js";import"./plaid-nsaMWH8B.js";import"./dnd-NbF88ub7.js";import"./stripe-cKAAJElX.js";import"./lottie-DX_KUXtr.js";import"./lexical-OFbGuPVJ.js";import"./pdf-Ck6JVYdq.js";import"./InboxNotificationsProvider-0KkUrcUF.js";import"./useTaskManagerAccess-CtzHb9vx.js";import"./BusinessVerificationPageScreen-C3i585S_.js";import"./routePaths-znAFGC3M.js";import"./analyticsHelper-DvdruwkE.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="4fe29aea-05b8-481c-b4fe-e994f8609e4d",e._sentryDebugIdIdentifier="sentry-dbid-4fe29aea-05b8-481c-b4fe-e994f8609e4d")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Le(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),T=d((O=>vn(O.cardPolicyState))),L=d((O=>Tn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),M=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(Tr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:T,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,T,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),H=D.fetchState,v=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??v;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,v]),K=r.useCallback((()=>{e(v)}),[e,v]),W=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),N=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),V=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(H);r.useEffect((()=>{const O=Q.current;Q.current=H,H==="Completed"&&O!=="Completed"&&M!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(v))}),[t,H,M,e,v]);const c=H==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:W,onSubmit:I,onUploadDocument:N,onRemoveDocument:V})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Mc}}}=ea.getLocalizedStrings(),Nc=e=>Un(e,!1),Vc=e=>jn(e.name,!1);function Hc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Ne(),s=me(),g=Le(),b=Te(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),T=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>vn(c.cardPolicyState))),l=d((c=>Tn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),M=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:M!=null?Is(M):void 0),[p.templateId,p.formDraft,M,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||M!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,M]),r.useEffect((()=>{T!=="Completed"&&T!=="In-Progress"&&s(Ln())}),[s,T]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Nc)),[L]),i=r.useMemo((()=>k.map(Vc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(Tr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),H=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{H.cancel()}),[H]);const v=r.useCallback((c=>{H(c)}),[H]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",W=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),N=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),V=r.useRef(P);r.useEffect((()=>{const c=V.current;V.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??Mc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&T==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:v,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:W,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:W,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:$c,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=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:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Zc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Le(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((v=>{h(v)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(Y.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Card Policy"}),L=d((v=>_s(v))),S=d((v=>Rn(v.createCardPolicyState))),l=d((v=>Ps(v.createCardPolicyState))),C=d((v=>l==null?[]:Nn(v.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((v=>ws(v.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((v=>{t(yt({chatSessionId:l,id:v.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const v=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:v}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(vs())}),[t,D]);const M=L.archiveFetchState.fetchState,E=ya(M);r.useEffect((()=>{E==="In-Progress"&&M==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[M,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(v){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:W}=v,I=de(),N=he(),{tenantEmailDomain:V}=Ne(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>Mn(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:He}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,He,3)),[X,He]),[ge,re]=r.useState(""),be=q&&O&&V!=null&&!Q,ue=r.useCallback((J=>{if(V==null)return;const fa=ke(N.state?.pathnameStackToGoBack,N.pathname);I(`/${V}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,I,V]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),ve=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:$c,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:W,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:ve,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,W,se,De,Ce,ve,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((v=>{n!=null&&e(`/${n}/cards/policy/${v}/edit`)}),[e,n]),z=r.useCallback((v=>{t(Ts(v))}),[t]),H=L.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:T})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:T})]})}function Yc(){const e=de(),{cardId:a}=Ne(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=Te(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(Y.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:T}=h(Y.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(T,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),M=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>vt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),H=z?.accountingClassIDs[0],v=d((X=>H!=null?Ka(X.classState,{classId:H,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),W=K?.accountingClassIDs[0],I=d((X=>W!=null?Ka(X.classState,{classId:W,reportId:"class_list"}):void 0)),N=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",V=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&N&&(u(!0),setTimeout((()=>{n(za()),V&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,N,V]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,N]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(Tt()),R!=="Completed"&&R!=="In-Progress"&&n(Vn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(va,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:v?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",$t="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Wc="charge-card-department-updated",Mr="charge-card-repayment-completed",Nr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((T=>fe(T))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(Y.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((T=>ma(T))),m=vr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const T=we(n.state?.pathnameStackToGoBack),L=T.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:T.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,qc),onEvent:T=>{switch(T){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=Ta(),n=me(),t=de(),{cardId:s}=Ne(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,T]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:M}=D(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(Y.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const H=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(H===!1||H&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:N}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:N}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const v=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Hn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const W=I=>{T(I)};if(_!=="Completed"||k==null)return o.jsx(va,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:W}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:v,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{W(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=$n(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ve.div`
|
|
1
|
+
import{j as o}from"./liveblocks-SKYC1C2A.js";import{u as me,j as d,h as de,g as he,i as Ne,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-BxGWoVcT.js";import{fS as Pt,$U as is,g2 as wt,bt as Te,$V as ds,$W as ls,fH as fn,$X as Pn,fQ as wn,$Y as vn,$Z as Tn,$_ as Fn,$$ as xn,fR as Bn,g1 as Ln,a00 as Rn,a01 as us,fX as ms,fW as Cs,a02 as ps,K6 as On,g4 as ia,a03 as hs,a04 as fs,fJ as gs,fI as bs,gh as ze,fZ as Un,fY as jn,a05 as Ss,f_ as ys,JE as Is,JD as ks,JH as Es,JJ as As,ga as Ds,fE as Mn,a06 as _s,a07 as Ps,gf as Nn,a08 as ws,gg as yt,JP as vs,JM as Ts,fF as fe,a09 as qa,dZ as Fe,di as xe,d_ as Be,g_ as da,cB as la,a0a as ua,a0b as vt,CZ as Ga,m7 as Ka,a0c as za,Km as ka,g5 as qe,Ko as Tt,lZ as Vn,a0d as ma,Ka as _a,a0e as Fs,a0f as xs,Kd as Ja,a0g as Bs,Z5 as Qa,g0 as Hn,Kj as ba,iq as Ls,a0h as $n,fT as Ca,br as Rs,a0i as Os,gG as Xa,gF as et,KS as Us,gE as at,a0j as Gn,cu as Kn,da as js,Z4 as wa,Lr as zn,a0k as gn,L1 as Pa,a0l as Yn,Ls as Ms,Zu as Ns,Lt as Vs,My as Hs,Cd as $s,Ms as Gs,a0m as Ks,Kn as oa,a0n as zs,a0o as Ys,a0p as Zs,a0q as Ws,a0r as qs,a0s as Ft,a0t as Js,KD as Zn,Kw as Qs,a0u as Xs,h0 as eo,a0v as Wn,KM as qn,KQ as Jn,g$ as ao,a0w as to,Ld as Qn,a0x as no,a0y as ro,a0z as so,KO as Xn,Kz as er,Kg as ar,KI as tr,KG as nr,KK as oo,a0A as rr,a0B as co,gc as io,gd as lo,ge as uo,a0C as tt,g6 as sr,dc as xt,a0D as mo,a0E as Co,a0F as po,a0G as ho,KY as It,Lk as fo,Lg as go,KU as bo,Li as So,L8 as yo,La as Io,a0H as or,Lq as $a,Sh as ko,a0I as Eo,a0J as Ao,a0K as Do,a0L as cr,a0M as _o,LN as Po,L0 as ir,KX as Me,K$ as wo,a0N as vo,a0O as To,K7 as Fo,a0P as dr,f$ as lr,a0Q as xo,K9 as Bo,K8 as bn,a0R as Lo,a0S as Ro,a0T as Oo,Vp as Uo,a0U as Bt,a0V as jo,xj as ur,mH as Mo,ie as No,LS as Vo,a0W as mr,fN as Ho,fO as $o,a0X as Go,dO as Ko,g3 as zo,LI as Yo,LC as We,bq as Zo,bJ as Wo,cG as qo,bK as Jo,Ug as Qo}from"./zeni-epic-state-C7XRcjyb.js";import{Q as Le,df as Cr,a5 as we,dg as pr,dh as hr,di as Xo,G as ea,at as Lt,dj as ec,dk as ac,a as fr,d as gr,as as br,p as ke,o as le,S as Z,h as ya,dl as Sr,dm as tc,dn as nc,z as te,a8 as va,d4 as nt,dp as rc,dq as sc,dr as oc,a2 as Ta,bj as Qe,bG as Rt,ds as cc,ac as Fa,_ as rt,E as Ot,l as ae,w as st,dt as ic,bS as Sa,du as kt,dv as dc,a9 as Ut,dw as lc,af as yr,aw as Et,dx as uc,ar as Ir,M as kr,V as Er,bo as mc,dy as Cc,dz as pc,dA as hc,dB as fc,dC as gc,dD as bc,J as Ya,dE as Sc,dF as yc,m as ht,O as Ic,dG as kc,dH as Ec,dI as Ac,aj as Dc,dJ as _c,dK as Pc,g as wc}from"./index-DKWZmEZ6.js";import{n as Ve,D as Ar,S as vc}from"./mui-KBl5-FbY.js";import{a as r}from"./sentry-DZfHa7Ie.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BIY8jQkA.js";import{M as Ee}from"./MobileAppDrawer-BQafCiIm.js";import{d as jt}from"./recharts-CflkB2e4.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as Tc,i as Mt,P as Fc,j as Nt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-gianurSV.js";import{u as vr}from"./useInitialThreadRequest-DEcIGuME.js";import ot from"./NotFoundScreen-BG7wRKZX.js";import{u as Vt}from"./useChargeCardPusherEvents-3n5HIVFd.js";import{n as yn}from"./utils-BqbdeqC-.js";import{t as Lc}from"./AddressScreen-CzeehWEB.js";import"./analytics-CdlFAR7_.js";import"./plaid-YTuVWNGR.js";import"./dnd-4QLQvWVu.js";import"./stripe-cKAAJElX.js";import"./lottie-B7wq19x9.js";import"./lexical-DXD9Kn-N.js";import"./pdf-B0ceY1o5.js";import"./InboxNotificationsProvider-XqYApNHe.js";import"./useTaskManagerAccess-BnFoXekz.js";import"./BusinessVerificationPageScreen-tFrQ8x6S.js";import"./routePaths-Z5dkQJU8.js";import"./analyticsHelper-Ck5nyZDK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="26fc8026-faa8-4a29-a754-b972e3f6045b",e._sentryDebugIdIdentifier="sentry-dbid-26fc8026-faa8-4a29-a754-b972e3f6045b")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Le(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),T=d((O=>vn(O.cardPolicyState))),L=d((O=>Tn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),M=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(Tr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:T,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,T,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),H=D.fetchState,v=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??v;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,v]),K=r.useCallback((()=>{e(v)}),[e,v]),W=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),N=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),V=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(H);r.useEffect((()=>{const O=Q.current;Q.current=H,H==="Completed"&&O!=="Completed"&&M!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(v))}),[t,H,M,e,v]);const c=H==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:W,onSubmit:I,onUploadDocument:N,onRemoveDocument:V})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Mc}}}=ea.getLocalizedStrings(),Nc=e=>Un(e,!1),Vc=e=>jn(e.name,!1);function Hc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Ne(),s=me(),g=Le(),b=Te(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),T=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>vn(c.cardPolicyState))),l=d((c=>Tn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),M=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:M!=null?Is(M):void 0),[p.templateId,p.formDraft,M,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||M!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,M]),r.useEffect((()=>{T!=="Completed"&&T!=="In-Progress"&&s(Ln())}),[s,T]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Nc)),[L]),i=r.useMemo((()=>k.map(Vc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(Tr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),H=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{H.cancel()}),[H]);const v=r.useCallback((c=>{H(c)}),[H]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",W=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),N=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),V=r.useRef(P);r.useEffect((()=>{const c=V.current;V.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??Mc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&T==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:v,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:W,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:W,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:$c,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=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:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Le(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((v=>{h(v)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Card Policy"}),L=d((v=>_s(v))),S=d((v=>Rn(v.createCardPolicyState))),l=d((v=>Ps(v.createCardPolicyState))),C=d((v=>l==null?[]:Nn(v.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((v=>ws(v.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((v=>{t(yt({chatSessionId:l,id:v.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const v=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:v}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(vs())}),[t,D]);const M=L.archiveFetchState.fetchState,E=ya(M);r.useEffect((()=>{E==="In-Progress"&&M==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[M,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(v){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:W}=v,I=de(),N=he(),{tenantEmailDomain:V}=Ne(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>Mn(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:He}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,He,3)),[X,He]),[ge,re]=r.useState(""),be=q&&O&&V!=null&&!Q,ue=r.useCallback((J=>{if(V==null)return;const fa=ke(N.state?.pathnameStackToGoBack,N.pathname);I(`/${V}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,I,V]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),ve=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:$c,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:W,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:ve,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,W,se,De,Ce,ve,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((v=>{n!=null&&e(`/${n}/cards/policy/${v}/edit`)}),[e,n]),z=r.useCallback((v=>{t(Ts(v))}),[t]),H=L.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:T})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:T})]})}function Zc(){const e=de(),{cardId:a}=Ne(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=Te(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(Z.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:T}=h(Z.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(T,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),M=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>vt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),H=z?.accountingClassIDs[0],v=d((X=>H!=null?Ka(X.classState,{classId:H,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),W=K?.accountingClassIDs[0],I=d((X=>W!=null?Ka(X.classState,{classId:W,reportId:"class_list"}):void 0)),N=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",V=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&N&&(u(!0),setTimeout((()=>{n(za()),V&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,N,V]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,N]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(Tt()),R!=="Completed"&&R!=="In-Progress"&&n(Vn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(va,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:v?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",$t="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Wc="charge-card-department-updated",Mr="charge-card-repayment-completed",Nr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((T=>fe(T))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(Z.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((T=>ma(T))),m=vr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const T=we(n.state?.pathnameStackToGoBack),L=T.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:T.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,qc),onEvent:T=>{switch(T){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=Ta(),n=me(),t=de(),{cardId:s}=Ne(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,T]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:M}=D(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(Z.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const H=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(H===!1||H&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:N}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:N}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const v=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Hn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const W=I=>{T(I)};if(_!=="Completed"||k==null)return o.jsx(va,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:W}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:v,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{W(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=$n(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ve.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
|
|
@@ -11,18 +11,18 @@ import{j as o}from"./liveblocks-CVtnm86a.js";import{u as me,j as d,h as de,g as
|
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
align-items: center;
|
|
13
13
|
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,
|
|
14
|
+
`,Za=ea.getLocalizedStrings().dateFormat,si={overlayWidth:new Fa(100,100,58)},Vr=[Mr,ct],oi=new Set(Vr),ci=Pe((function(e,a){const n=a.currentTenant?.companyId;return{plaidConnectionDetails:Ns(e,n,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Vs(e.depositAccountState,e.depositAccountListState)}}),(function(e,a){const{navigate:n,currentTenant:t,isCashbackInfoFetchStateCompleted:s,isCreditCardInfoFetchStateCompleted:g,isDebitCardInfoFetchStateCompleted:b,controllerEmails:h,paymentDetails:A,productInformation:u,cashbackInformation:m,paymentSourceInformation:F,creditAccountInformation:w,debitAccountInformation:p,paymentInitiatedDate:T,sourcePage:L}=a,{tenantEmailDomain:S}=t,l=()=>{e(zn(!0));const C=aa(t);C!=null&&C!==""&&e(Pa(C,!0,!0)),e(qe(!0))};return{onBackNavigation:()=>{if(s&&g&&b&&m!=null&&ae.trackCardsPayEarlyFormClick(h,u,m,"Back",A.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:A.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:A.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:A.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:A.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:T?.add(3,"day").format(Za.visual.MMMDCommaYYYYformat),paymentInitiatedDate:T?.format(Za.visual.MMMDCommaYYYYformat)},F,w,p),L==="cardPaymentHistory")a.closeDrawerHandler(!0),e(Yn());else{const C=ta(S);n(C)}},onUpdatePaymentAccountStatus:(C,B,k)=>{e(Gs(C,B,"bill_pay","bill_pay_detail",k))},onEstablishConnectionSuccess:()=>{e(Pa(t.companyId,!0))},onFetchLinkTokenClick:C=>{e($s("external_account",C))},onEstablishConnectionClick:C=>{e(Hs(C,t.companyId,"charge_card_payment","charge_cards"))},onEventReceived:C=>{oi.has(C)&&l()},onPusherSubscribed:l}}))(st(ic)),zt=({isPaymentDrawerOpen:e,closeDrawerHandler:a,pageName:n,creditAccountSpentAmount:t,productInformation:s,sourcePage:g,creditAccountInformation:b,debitAccountInformation:h,cashbackInformation:A,isDebitCardInfoFetchStateCompleted:u,isCreditCardInfoFetchStateCompleted:m,isCashbackInfoFetchStateCompleted:F,paymentInitiatedDate:w,retryRepayment:p})=>{const T=de(),{useDynamicConfig:L}=le(),S=d((V=>Gn(V))),{creditAccount:l}=d((V=>ua(V))),C=d((V=>fe(V))),B=Ot(),k=Ta(),_=me(),D=te.getSignedInUser(),M=Le(),[E,y]=r.useState(!1),[R,i]=r.useState(!1),{configValue:f}=L(Qe.zeniCardsConfig),j=f.credit_card_auto_pay_threshold_by_company_id?.[C.companyId]??f.default_credit_card_auto_pay_threshold??Tc,G=Kn(M?.loggedInUserRoleMap),U=js(M?.loggedInUserRoleMap),x=d((V=>wa(V,C.companyId))),z=x.companyChargeCardInfo?.primaryFundingAccount,H=x.allFundingAccounts.find((V=>V.id===z?.accountId)),v=d((V=>da(V,C.companyId))),P=la(v.controllers);r.useEffect((()=>{if(S.fetchState!=="Completed"&&S.fetchState!=="In-Progress"&&_(zn()),S.fetchState==="Completed"&&!R){const V=C.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Q=S.transferFromAccounts.find((O=>O.id===V));let c;if(g==="cardPaymentHistory"&&p){const O=p.paymentAccountId!=null?S.transferFromAccounts.find((q=>q.id===p.paymentAccountId)):void 0;c={amount:p.amount,isAutoRepayment:C.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:yn(),transferFrom:O??Q}}else c={amount:{amount:l.balance.amount+l.hold.amount,currencyCode:l.balance.currencyCode,currencySymbol:l.balance.currencySymbol},isAutoRepayment:C.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:yn(),transferFrom:Q};_(gn(c)),i(!0)}}),[S.fetchState,R,g,p,S.transferFromAccounts,C.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,C.companyChargeCardInfo?.info?.isAutoPayEnabled,l.balance.amount,l.balance.currencyCode,l.balance.currencySymbol,l.hold.amount,_]);const K={isZeniCheckingEnabled:C.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:H?.accType==="depositAccount",creditCardPaymentSourceAccountName:H?.label,creditCardPaymentSourceAccountType:H?.accType,creditCardPaymentSourceLastFourDigits:H?.accountLast4,creditCardPaymentSourceBalance:H?.accountBalance?.available?.amount??0};if(r.useEffect((()=>{x.fetchState!=="Completed"&&x.fetchState!=="In-Progress"&&_(Pa(C.companyId,!0))}),[x.fetchState]),r.useEffect((()=>{S.updateStatus==="Completed"&&A!=null&&F&&m&&u&&ae.trackCardsPayEarlyPayNowClick(P,s,A,S.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:S.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:S.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:S.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:S.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:w?.add(3,"day").format(Za.visual.MMMDCommaYYYYformat),paymentInitiatedDate:w?.format(Za.visual.MMMDCommaYYYYformat)},K,b,h)}),[S.updateStatus,A,F,m,u,w]),r.useEffect((()=>{S.fetchState==="Completed"&&A!=null&&F&&m&&u&&!E&&e&&R&&A!=null&&(ae.trackCardsPayEarlyFormView(P,s,A,n,C.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,l.balance.amount,K,b,h),y(!0))}),[S,F,m,u,E,e,R]),D==null)throw Error("Can't access invite people page without signing in...");const W=()=>{a(!0),_(Yn())},I=aa(C),N={events:e?ha(I,Vr):[],eventCallback:(V,Q,c)=>{c.onEventReceived(V)},onSubscribed:V=>{V.onPusherSubscribed()}};return o.jsx(o.Fragment,{children:o.jsx(Ar,{onClose:()=>{W()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:si.overlayWidth.valuePercentage(k),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:B.colors.black,opacity:.75,cursor:"pointer"}}},children:o.jsx(ii,{onClick:V=>V.stopPropagation(),children:o.jsx(ci,{...N,closeDrawerHandler:a,navigate:T,paymentDetails:S,creditAccountSpentAmount:t,onTransferClick:()=>{F&&m&&u&&A!=null&&ae.trackCardsPayEarlyFormClick(P,s,A,"Pay Now",S.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:S.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:S.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:S.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:S.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},K,b,h),_(Ms({companyId:C.companyId}))},onDismissClick:W,onSaveChangesToLocalStore:V=>{_(gn(V))},currentTenant:C,hasZeniAccountsAdminAccess:G,isZeniAccountsUser:U,productInformation:s,sourcePage:g,controllerEmails:P,autoPayThreshold:j,paymentSourceInformation:K,creditAccountInformation:b,debitAccountInformation:h,cashbackInformation:A,isCashbackInfoFetchStateCompleted:F,isCreditCardInfoFetchStateCompleted:m,isDebitCardInfoFetchStateCompleted:u,paymentInitiatedDate:w})})})})},ii=Ve(vc)`
|
|
15
15
|
display: flex;
|
|
16
16
|
min-height: 100%;
|
|
17
17
|
flex-direction: column;
|
|
18
|
-
`,Zt=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,je=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Wa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const a=e;return typeof a.transaction_id=="string"&&typeof a.amount=="number"&&typeof a.currency_code=="string"&&typeof a.currency_symbol=="string"&&typeof a.direction=="string"&&!!Wa(a.transaction_status)&&!!Wa(a.transaction_type)},Yt=(e,a)=>{const n=e?.card_status;if(!Wa(n))return null;const t=e?.is_locked_by_admin;return{cardId:a,cardStatus:n,isLockedByAdmin:typeof t=="boolean"?t:void 0}},At=[Lr,Rr,Or,Ur,jr,pa,Ht,ct,$t,Gt,Kt],Hr=[Ra,La],di=new Set([...At,...Hr]),bt=ea.getLocalizedStrings().dateFormat,li=Pe((function(e,a){const{includeCreditAccountInfo:n,cardId:t,signedInUserToken:s,isChargeCardFeatureEnabled:g}=a,b=te.getSignedInUser(),h=e.tenantState.currentTenantId,A={userId:b?.userId??"",sessionId:b?.zeniSessionId??"",tenantId:h??""},u=vt(e,t,n,g),m=Xs(e,t),F=eo(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:m,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:A,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${yr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s,receiptsEmail:Wn(e.tenantState,h)}}),(function(e,a){const{cardId:n,currentTenant:t,navigate:s,location:g,cardProviderId:b,includeCreditAccountInfo:h,setIsPaymentOpen:A,controllerEmails:u,productInformation:m,cashbackInformation:F,primaryFundingAccountDetails:w,creditAccountInformation:p,debitAccountInformation:T,isChargeCardFeatureEnabled:L}=a,{tenantEmailDomain:S}=t;return{onEventReceived:(l,C)=>{(({event:B,data:k,cardId:_,dispatch:D,subscribedEvents:M})=>{const E=Zt(k);switch(B){case Ra:case La:return void D(_a(!0));case Lr:{const y=ie(E?.card_id);if(y==null||y!==_)return;const R=ie(E?.transaction_id),i=E?.transaction_status;return R!=null&&Wa(i)?void D(Js({transactionId:R,transactionStatus:i})):void D(oa(_,null,null,!0))}case pa:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=Yt(E,y);return R!=null?void D(Ft(R)):void D(ba(_,!0))}case Ht:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.currency_code),i=ie(E?.currency_symbol),f=je(E?.balance);return R!=null&&i!=null&&f!=null?(D(qs({cardId:y,currencyCode:R,currencySymbol:i,balance:f,hold:je(E?.hold),dailyPurchaseSpends:je(E?.daily_purchase_spends),monthlyPurchaseSpends:je(E?.monthly_purchase_spends),dailyWithdrawals:je(E?.daily_withdrawals),monthlyWithdrawals:je(E?.monthly_withdrawals)})),void D(qe(!0))):(D(ba(_,!0)),void D(qe(!0)))}case ct:{const y=ie(E?.currency_code),R=ie(E?.currency_symbol),i=je(E?.available_amount),f=je(E?.balance_amount);return y!=null&&R!=null&&i!=null&&f!=null?void D(Ws({currencyCode:y,currencySymbol:R,available:i,balance:f,hold:je(E?.hold_amount),cashback:je(E?.cashback_amount)})):void D(qe(!0))}case Rr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Ys({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case Or:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Zs({cardId:y,declineReason:ie(E?.decline_reason),transaction:R})):void D(oa(_,null,null,!0))}case Ur:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(zs({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case jr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.transaction_id),i=E?.attachment_file_paths;return R!=null&&Array.isArray(i)&&i.every((f=>typeof f=="string"))?void D(Ks({cardId:y,transactionId:R,attachmentFilePaths:i})):void D(oa(_,null,null,!0))}case $t:case Gt:case Kt:{const y=ie(E?.card_id);if(y==null||y!==_)return;D(ba(_,!0))}}})({event:l,data:C,cardId:n,dispatch:e,subscribedEvents:di})},onPusherSubscribed:()=>{e(ba(n,!0)),e(oa(n,null,null,!0)),e(qe(!0))},onReloadTransactions:()=>{e(ka(n,h,L))},onFetchChargeCardTransactionList:(l,C)=>{e(oa(n,l,C))},onUpdateScrollYOffset:l=>{},onGetOtp:l=>{b!=null&&e(at(l,"ChargeCardHolder",n))},onResendOtp:l=>{b!=null&&e(et(l,"ChargeCardHolder",n))},onVerifyOtp:(l,C)=>{b!=null&&e(Xa(l,C,"ChargeCardHolder",n))},onVerifyOtpSuccess:l=>{l!=null&&te.saveZeniOtpTokenForCardHolder(l,n)},onColorCodeChange:l=>{e(oo(n,l))},onLockChargeCard:(l,C)=>{e(nr(l,n,C))},onUnlockChargeCard:l=>{e(tr(l,n))},onCloseChargeCard:l=>{e(ar(n,l))},onFetchChargeCardsRecurringExpenses:()=>{e(er([n]))},updateChargeCardName:(l,C)=>{e(Xn(l,n,C))},updateChargeCardTransactionAttachments:(l,C)=>{C!=null&&e(so({transactionId:l,data:C}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(l,C,B,k)=>{e(ro({chargeCardId:C,transactionId:l,fetchState:B,error:k}))},updateChargeCardTransactionReceiptsShowTick:(l,C,B)=>{e(no({chargeCardId:C,transactionId:l,shouldShowTick:B}))},onChargeCardRevokeInviteClick:()=>{e(Qn(n))},updateChargeCardTransactionIsViewReceiptClicked:(l,C,B)=>{e(to({chargeCardId:C,transactionId:l,isViewReceiptClicked:B}))},onChargeCardTransactionRowClick:(l,C)=>{const B=ke(g.state?.pathnameStackToGoBack,g.pathname);s(`../../transaction/${l}/${C}`,{state:{pathnameStackToGoBack:B}})},onBackClick:()=>{const l=we(g.state?.pathnameStackToGoBack),C=ta(S);s(C,{state:{pathnameStackToGoBack:l.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(ao())},onUpdateDebitCardPinAttempt:l=>{e(Jn(n,l)),l==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(l,C)=>{l?e(ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):C!=null&&e(ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:C.message}]}))},updateSpendLimit(l,C,B,k){e(qn(l,C,B.code,k))},shouldOpenCreditCardPaymentDrawer(l){l&&F!=null&&ae.trackCardsPayEarlyClick(u,m,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:t.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},p,T),A(l)}}}))(st(lc));function ui(){const e=de(),a=me(),n=he(),{cardId:t}=Ne(),[s,g]=r.useState(!1),[b,h]=r.useState(!1),{useDynamicConfig:A}=le(),u=te.getSignedInUser(),m=d((Z=>fe(Z))),F=d((Z=>qa(Z).firstViewAfterActivation)),w=d((Z=>Z.classListState.fetchState)),{configValue:p}=A(Qe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:T}=A(Qe.zeniCardsConfig),L=T.enable_card_controls_for_company_ids,S=T.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(L)&&L.includes(m.companyId),[l,C]=r.useState(!1),[B,k]=r.useState(!1),{useFeatureGate:_}=le(),{isFeatureEnabled:D}=_(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=_(Y.isDebitCardFeatureEnabled),E=Be(M,m),y=Re({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:E}),{isFeatureEnabled:R}=_(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:i}=_(Y.isCardsCommentingEnabled),f=xe(m),j=Fe(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:D,isBookKeepingTenant:f,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:G}),x=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,H=!m.userRole.includes("charge_card_user")&&U&&z;if(t==null)throw Error("Empty card id is not valid...");const v=d((Z=>wa(Z,m.companyId))),{creditAccount:P,creditAccountRepayment:K}=d((Z=>ua(Z))),W=te.getZeniOtpTokenForCardHolder(t),I=d((Z=>vt(Z,t,H,U))),{isAiCfoAccessEnabled:N,onAskAiCfoClick:V}=xa({mobileExploreReferrer:"Card Detail"});Lt({isDataReady:I.fetchState==="Completed"});const Q=d((Z=>ma(Z))),c=I.chargeCard,O=Le(),q=Te(O?.loggedInUserRoleMap),se=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_virtual_debit_card",X=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_physical_credit_card",He=c?.type.code==="business_virtual_debit_card"||c?.type.code==="business_virtual_credit_card",Ae=c?.type.code==="business_virtual_debit_card",ge=Ba(U,z,q,P,K),re=Dr(se,I),be=Mt(q,Q),ue=Xe(U,y,x,z),oe=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Se=d((Z=>da(Z,m.companyId))),ee=la(Se.controllers),De=d((Z=>c?.cardCreatedByUser?.userId!=null?Ga(Z.userRoleState,c?.cardCreatedByUser?.userId):void 0)),ve=d((Z=>De?.accountingClassIDs[0]!=null?Ka(Z.classState,{classId:De?.accountingClassIDs[0],reportId:"class_list"}):void 0)),Ce=d((Z=>c?.cardHolderUser?.userId!=null?Ga(Z.userRoleState,c?.cardHolderUser?.userId):void 0)),J=d((Z=>Ce?.accountingClassIDs[0]!=null?Ka(Z.classState,{classId:Ce?.accountingClassIDs[0],reportId:"class_list"}):void 0)),fa=m?.userRole,na=d((Z=>Ca(Z,!1,y,D).revokeCardInvite)),Oa=ya(na.saveStatus.fetchState);if(r.useEffect((()=>{if(Oa==="In-Progress"&&na.saveStatus.fetchState==="Completed"){const Z=ta(m.tenantEmailDomain);e(Z)}}),[Oa,na.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect((()=>{F&&s===!1&&He&&(g(!0),setTimeout((()=>{a(za()),Ae&&a(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[F,s,He,Ae]),r.useEffect((()=>{l||I.fetchState==="Completed"||I.fetchState==="In-Progress"||t==null||(C(!0),a(ka(t,H,U,!1)))}),[l,I,t,a]),r.useEffect((()=>{!B&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&se&&oe&&q&&(k(!0),a(Yn({depositAccountId:I.chargeCard?.connectedAccountId})))}),[B,I,a,oe,q]),r.useEffect((()=>{Q.fetchState!=="Completed"&&Q.fetchState!=="In-Progress"&&q&&a(_a()),w!=="Completed"&&w!=="In-Progress"&&a(Vn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&a(Qs({chargeCardId:t})),v.fetchState!=="Completed"&&v.fetchState!=="In-Progress"&&a(Pa(m.companyId,!0))}),[Q.fetchState,a,q,w,I.transactionStatistics.fetchState,v.fetchState]),r.useEffect((()=>{if(!(I.fetchState!=="Completed"||U&&P.fetchState!=="Completed"||c==null||I.transactionStatistics.fetchState!=="Completed"||se&&q&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Z=c.type.code.includes("physical"),ye=Z?c.cardActivationAttemptHistory[0]?.timestamp:c.createTime;ae.trackCardsCardDetailView(ee,ue,{cardId:t,cardName:c.cardName,cardType:c.type.code.includes("credit")?"credit":"debit",cardCategory:Z?"physical":"virtual",cardLimit:Sa(c.limit.amount),cardLastFourDigits:c.accountLast4,cardStatus:c.status.code,cardAssignedDate:c.createTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:c.providerCardCreateTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:ye?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:c.creditLimitFrequency.name,cardSpentAmount:Sa(c.balance.amount),cardAvailableLimit:Sa(c.available.amount),cardUtilizationPercent:c.limit.amount>0?Math.round((c.limit.amount-c.available.amount)/c.limit.amount*100):0,cardUtilizationAmount:Sa(c.limit.amount-c.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(c.cardCreatedByUser,!1),cardIssuedByEmail:c.cardCreatedByUser?.email,cardIssuedByUserId:c.cardCreatedByUser?.userId,cardIssuedByRole:De?.userRoles,cardIssuedByDepartment:ve?.className},{cardholderName:kt(c.cardHolderUser,!1),cardholderEmail:c.cardHolderUser?.email,cardholderRole:Ce?.userRoles,cardholderUserId:c.cardHolderUser?.userId,cardholderDepartment:J?.className},ge,re)}}),[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,P.fetchState,q]),u==null)throw Error("Can't access card detail page without signing in...");const dt=aa(m),Ea=q?[...At,...Hr]:At,ra={events:ha(dt,Ea),eventCallback:(Z,ye,ce)=>{ce.onEventReceived(Z,ye)},onSubscribed:Z=>{Z.onPusherSubscribed()}},Aa=()=>{if(t!=null&&c!=null){const{ownerName:Z,cardName:ye,utilisation:ce,limit:$e,frequency:Ze,cardColor:Ge}=St(c),Ke=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageViewed(t,Z,ye,ce,$e,Ze,Ge,Ke)}};r.useEffect((()=>{if(I.fetchState==="Completed"){const Z=I.chargeCard;if(Z?.status.code==="inactive"||se&&Z?.isPinSet===!1||X&&F){const ye=_e(m.tenantEmailDomain,t,u,c,F);e(ye)}}}),[I.fetchState]);const lt=(Z,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:$e,utilisation:Ze,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageClicked(t,ce,$e,Ze,Ge,Ke,Z,sa,ye)}},ut=(Z,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:$e,utilisation:Ze,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsVerifyPopUpClick(t,ce,$e,Ze,Ge,Ke,Z,sa,ye)}},pe=P.balance.amount+P.hold.amount,Ua=m.companyChargeCardInfo?.info?.primaryFundingAccount,Da=v.allFundingAccounts.find((Z=>Z.id===Ua?.accountId)),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||na.saveStatus.fetchState==="In-Progress"||!Ma&&se&&q&&I.depositAccountLimitFetchState.fetchState!=="Completed"?o.jsx(dc,{}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?o.jsx(Ut,{analytics:ae,onLoad:Aa}):null,b===!0?o.jsx(zt,{closeDrawerHandler:()=>h(!1),isPaymentDrawerOpen:b,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!se||!q||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||P.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!q||Q.fetchState==="Completed",paymentInitiatedDate:K.initiatedRepaymentDate}):null,o.jsx(li,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Rt(),signedInUser:u,location:n,navigate:e,setIsPaymentOpen:h,cardIssuedByRoles:De?.userRoles,cardIssuedByDepartmentName:ve?.className,cardHolderRoles:Ce?.userRoles,cardHolderDepartmentName:J?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:y,isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:z,isCardControlsEnabled:S,isEarlyPayEnabled:R,controllerEmails:ee,chargeCardCashbackDetailState:Q,productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,classListFetchState:w,primaryFundingAccountDetails:Da,currentTenant:m,cardProviderId:I.chargeCard?.cardProviderID,cardId:t,creditAccount:P,creditAccountRepayment:K,includeCreditAccountInfo:H,signedInUserToken:W,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:p.documentAiReceiptMaxSizeLimitBytes!=null?p.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:V,isCardsCommentingEnabled:i})]}):o.jsx(ot,{})}const St=e=>{const a=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,n=e.cardName,t=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,g=e.creditLimitFrequency.name;return{ownerName:a,cardName:n,utilisation:t,cardColor:e.cardColorCode??"",frequency:g,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:mi,subheadline:Ci,pageTitle:pi}}}}=ea.getLocalizedStrings(),$r=[pa,ct,Nr,La,Ra,it,Kt,Wc,$t,Gt,Ht],hi=new Set($r),Dt=jt(((e,a,n,t)=>{e(ia(a,n,t,!0))}),400),fi=Ve.div`
|
|
18
|
+
`,Yt=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,je=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Wa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const a=e;return typeof a.transaction_id=="string"&&typeof a.amount=="number"&&typeof a.currency_code=="string"&&typeof a.currency_symbol=="string"&&typeof a.direction=="string"&&!!Wa(a.transaction_status)&&!!Wa(a.transaction_type)},Zt=(e,a)=>{const n=e?.card_status;if(!Wa(n))return null;const t=e?.is_locked_by_admin;return{cardId:a,cardStatus:n,isLockedByAdmin:typeof t=="boolean"?t:void 0}},At=[Lr,Rr,Or,Ur,jr,pa,Ht,ct,$t,Gt,Kt],Hr=[Ra,La],di=new Set([...At,...Hr]),bt=ea.getLocalizedStrings().dateFormat,li=Pe((function(e,a){const{includeCreditAccountInfo:n,cardId:t,signedInUserToken:s,isChargeCardFeatureEnabled:g}=a,b=te.getSignedInUser(),h=e.tenantState.currentTenantId,A={userId:b?.userId??"",sessionId:b?.zeniSessionId??"",tenantId:h??""},u=vt(e,t,n,g),m=Xs(e,t),F=eo(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:m,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:A,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${yr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s,receiptsEmail:Wn(e.tenantState,h)}}),(function(e,a){const{cardId:n,currentTenant:t,navigate:s,location:g,cardProviderId:b,includeCreditAccountInfo:h,setIsPaymentOpen:A,controllerEmails:u,productInformation:m,cashbackInformation:F,primaryFundingAccountDetails:w,creditAccountInformation:p,debitAccountInformation:T,isChargeCardFeatureEnabled:L}=a,{tenantEmailDomain:S}=t;return{onEventReceived:(l,C)=>{(({event:B,data:k,cardId:_,dispatch:D,subscribedEvents:M})=>{const E=Yt(k);switch(B){case Ra:case La:return void D(_a(!0));case Lr:{const y=ie(E?.card_id);if(y==null||y!==_)return;const R=ie(E?.transaction_id),i=E?.transaction_status;return R!=null&&Wa(i)?void D(Js({transactionId:R,transactionStatus:i})):void D(oa(_,null,null,!0))}case pa:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=Zt(E,y);return R!=null?void D(Ft(R)):void D(ba(_,!0))}case Ht:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.currency_code),i=ie(E?.currency_symbol),f=je(E?.balance);return R!=null&&i!=null&&f!=null?(D(qs({cardId:y,currencyCode:R,currencySymbol:i,balance:f,hold:je(E?.hold),dailyPurchaseSpends:je(E?.daily_purchase_spends),monthlyPurchaseSpends:je(E?.monthly_purchase_spends),dailyWithdrawals:je(E?.daily_withdrawals),monthlyWithdrawals:je(E?.monthly_withdrawals)})),void D(qe(!0))):(D(ba(_,!0)),void D(qe(!0)))}case ct:{const y=ie(E?.currency_code),R=ie(E?.currency_symbol),i=je(E?.available_amount),f=je(E?.balance_amount);return y!=null&&R!=null&&i!=null&&f!=null?void D(Ws({currencyCode:y,currencySymbol:R,available:i,balance:f,hold:je(E?.hold_amount),cashback:je(E?.cashback_amount)})):void D(qe(!0))}case Rr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Zs({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case Or:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Ys({cardId:y,declineReason:ie(E?.decline_reason),transaction:R})):void D(oa(_,null,null,!0))}case Ur:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(zs({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case jr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.transaction_id),i=E?.attachment_file_paths;return R!=null&&Array.isArray(i)&&i.every((f=>typeof f=="string"))?void D(Ks({cardId:y,transactionId:R,attachmentFilePaths:i})):void D(oa(_,null,null,!0))}case $t:case Gt:case Kt:{const y=ie(E?.card_id);if(y==null||y!==_)return;D(ba(_,!0))}}})({event:l,data:C,cardId:n,dispatch:e,subscribedEvents:di})},onPusherSubscribed:()=>{e(ba(n,!0)),e(oa(n,null,null,!0)),e(qe(!0))},onReloadTransactions:()=>{e(ka(n,h,L))},onFetchChargeCardTransactionList:(l,C)=>{e(oa(n,l,C))},onUpdateScrollYOffset:l=>{},onGetOtp:l=>{b!=null&&e(at(l,"ChargeCardHolder",n))},onResendOtp:l=>{b!=null&&e(et(l,"ChargeCardHolder",n))},onVerifyOtp:(l,C)=>{b!=null&&e(Xa(l,C,"ChargeCardHolder",n))},onVerifyOtpSuccess:l=>{l!=null&&te.saveZeniOtpTokenForCardHolder(l,n)},onColorCodeChange:l=>{e(oo(n,l))},onLockChargeCard:(l,C)=>{e(nr(l,n,C))},onUnlockChargeCard:l=>{e(tr(l,n))},onCloseChargeCard:l=>{e(ar(n,l))},onFetchChargeCardsRecurringExpenses:()=>{e(er([n]))},updateChargeCardName:(l,C)=>{e(Xn(l,n,C))},updateChargeCardTransactionAttachments:(l,C)=>{C!=null&&e(so({transactionId:l,data:C}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(l,C,B,k)=>{e(ro({chargeCardId:C,transactionId:l,fetchState:B,error:k}))},updateChargeCardTransactionReceiptsShowTick:(l,C,B)=>{e(no({chargeCardId:C,transactionId:l,shouldShowTick:B}))},onChargeCardRevokeInviteClick:()=>{e(Qn(n))},updateChargeCardTransactionIsViewReceiptClicked:(l,C,B)=>{e(to({chargeCardId:C,transactionId:l,isViewReceiptClicked:B}))},onChargeCardTransactionRowClick:(l,C)=>{const B=ke(g.state?.pathnameStackToGoBack,g.pathname);s(`../../transaction/${l}/${C}`,{state:{pathnameStackToGoBack:B}})},onBackClick:()=>{const l=we(g.state?.pathnameStackToGoBack),C=ta(S);s(C,{state:{pathnameStackToGoBack:l.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(ao())},onUpdateDebitCardPinAttempt:l=>{e(Jn(n,l)),l==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(l,C)=>{l?e(ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):C!=null&&e(ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:C.message}]}))},updateSpendLimit(l,C,B,k){e(qn(l,C,B.code,k))},shouldOpenCreditCardPaymentDrawer(l){l&&F!=null&&ae.trackCardsPayEarlyClick(u,m,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:t.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},p,T),A(l)}}}))(st(lc));function ui(){const e=de(),a=me(),n=he(),{cardId:t}=Ne(),[s,g]=r.useState(!1),[b,h]=r.useState(!1),{useDynamicConfig:A}=le(),u=te.getSignedInUser(),m=d((Y=>fe(Y))),F=d((Y=>qa(Y).firstViewAfterActivation)),w=d((Y=>Y.classListState.fetchState)),{configValue:p}=A(Qe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:T}=A(Qe.zeniCardsConfig),L=T.enable_card_controls_for_company_ids,S=T.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(L)&&L.includes(m.companyId),[l,C]=r.useState(!1),[B,k]=r.useState(!1),{useFeatureGate:_}=le(),{isFeatureEnabled:D}=_(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=_(Z.isDebitCardFeatureEnabled),E=Be(M,m),y=Re({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:E}),{isFeatureEnabled:R}=_(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:i}=_(Z.isCardsCommentingEnabled),f=xe(m),j=Fe(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:D,isBookKeepingTenant:f,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:G}),x=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,H=!m.userRole.includes("charge_card_user")&&U&&z;if(t==null)throw Error("Empty card id is not valid...");const v=d((Y=>wa(Y,m.companyId))),{creditAccount:P,creditAccountRepayment:K}=d((Y=>ua(Y))),W=te.getZeniOtpTokenForCardHolder(t),I=d((Y=>vt(Y,t,H,U))),{isAiCfoAccessEnabled:N,onAskAiCfoClick:V}=xa({mobileExploreReferrer:"Card Detail"});Lt({isDataReady:I.fetchState==="Completed"});const Q=d((Y=>ma(Y))),c=I.chargeCard,O=Le(),q=Te(O?.loggedInUserRoleMap),se=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_virtual_debit_card",X=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_physical_credit_card",He=c?.type.code==="business_virtual_debit_card"||c?.type.code==="business_virtual_credit_card",Ae=c?.type.code==="business_virtual_debit_card",ge=Ba(U,z,q,P,K),re=Dr(se,I),be=Mt(q,Q),ue=Xe(U,y,x,z),oe=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Se=d((Y=>da(Y,m.companyId))),ee=la(Se.controllers),De=d((Y=>c?.cardCreatedByUser?.userId!=null?Ga(Y.userRoleState,c?.cardCreatedByUser?.userId):void 0)),ve=d((Y=>De?.accountingClassIDs[0]!=null?Ka(Y.classState,{classId:De?.accountingClassIDs[0],reportId:"class_list"}):void 0)),Ce=d((Y=>c?.cardHolderUser?.userId!=null?Ga(Y.userRoleState,c?.cardHolderUser?.userId):void 0)),J=d((Y=>Ce?.accountingClassIDs[0]!=null?Ka(Y.classState,{classId:Ce?.accountingClassIDs[0],reportId:"class_list"}):void 0)),fa=m?.userRole,na=d((Y=>Ca(Y,!1,y,D).revokeCardInvite)),Oa=ya(na.saveStatus.fetchState);if(r.useEffect((()=>{if(Oa==="In-Progress"&&na.saveStatus.fetchState==="Completed"){const Y=ta(m.tenantEmailDomain);e(Y)}}),[Oa,na.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect((()=>{F&&s===!1&&He&&(g(!0),setTimeout((()=>{a(za()),Ae&&a(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[F,s,He,Ae]),r.useEffect((()=>{l||I.fetchState==="Completed"||I.fetchState==="In-Progress"||t==null||(C(!0),a(ka(t,H,U,!1)))}),[l,I,t,a]),r.useEffect((()=>{!B&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&se&&oe&&q&&(k(!0),a(Zn({depositAccountId:I.chargeCard?.connectedAccountId})))}),[B,I,a,oe,q]),r.useEffect((()=>{Q.fetchState!=="Completed"&&Q.fetchState!=="In-Progress"&&q&&a(_a()),w!=="Completed"&&w!=="In-Progress"&&a(Vn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&a(Qs({chargeCardId:t})),v.fetchState!=="Completed"&&v.fetchState!=="In-Progress"&&a(Pa(m.companyId,!0))}),[Q.fetchState,a,q,w,I.transactionStatistics.fetchState,v.fetchState]),r.useEffect((()=>{if(!(I.fetchState!=="Completed"||U&&P.fetchState!=="Completed"||c==null||I.transactionStatistics.fetchState!=="Completed"||se&&q&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Y=c.type.code.includes("physical"),ye=Y?c.cardActivationAttemptHistory[0]?.timestamp:c.createTime;ae.trackCardsCardDetailView(ee,ue,{cardId:t,cardName:c.cardName,cardType:c.type.code.includes("credit")?"credit":"debit",cardCategory:Y?"physical":"virtual",cardLimit:Sa(c.limit.amount),cardLastFourDigits:c.accountLast4,cardStatus:c.status.code,cardAssignedDate:c.createTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:c.providerCardCreateTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:ye?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:c.creditLimitFrequency.name,cardSpentAmount:Sa(c.balance.amount),cardAvailableLimit:Sa(c.available.amount),cardUtilizationPercent:c.limit.amount>0?Math.round((c.limit.amount-c.available.amount)/c.limit.amount*100):0,cardUtilizationAmount:Sa(c.limit.amount-c.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(c.cardCreatedByUser,!1),cardIssuedByEmail:c.cardCreatedByUser?.email,cardIssuedByUserId:c.cardCreatedByUser?.userId,cardIssuedByRole:De?.userRoles,cardIssuedByDepartment:ve?.className},{cardholderName:kt(c.cardHolderUser,!1),cardholderEmail:c.cardHolderUser?.email,cardholderRole:Ce?.userRoles,cardholderUserId:c.cardHolderUser?.userId,cardholderDepartment:J?.className},ge,re)}}),[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,P.fetchState,q]),u==null)throw Error("Can't access card detail page without signing in...");const dt=aa(m),Ea=q?[...At,...Hr]:At,ra={events:ha(dt,Ea),eventCallback:(Y,ye,ce)=>{ce.onEventReceived(Y,ye)},onSubscribed:Y=>{Y.onPusherSubscribed()}},Aa=()=>{if(t!=null&&c!=null){const{ownerName:Y,cardName:ye,utilisation:ce,limit:$e,frequency:Ye,cardColor:Ge}=St(c),Ke=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageViewed(t,Y,ye,ce,$e,Ye,Ge,Ke)}};r.useEffect((()=>{if(I.fetchState==="Completed"){const Y=I.chargeCard;if(Y?.status.code==="inactive"||se&&Y?.isPinSet===!1||X&&F){const ye=_e(m.tenantEmailDomain,t,u,c,F);e(ye)}}}),[I.fetchState]);const lt=(Y,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:$e,utilisation:Ye,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageClicked(t,ce,$e,Ye,Ge,Ke,Y,sa,ye)}},ut=(Y,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:$e,utilisation:Ye,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsVerifyPopUpClick(t,ce,$e,Ye,Ge,Ke,Y,sa,ye)}},pe=P.balance.amount+P.hold.amount,Ua=m.companyChargeCardInfo?.info?.primaryFundingAccount,Da=v.allFundingAccounts.find((Y=>Y.id===Ua?.accountId)),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||na.saveStatus.fetchState==="In-Progress"||!Ma&&se&&q&&I.depositAccountLimitFetchState.fetchState!=="Completed"?o.jsx(dc,{}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?o.jsx(Ut,{analytics:ae,onLoad:Aa}):null,b===!0?o.jsx(zt,{closeDrawerHandler:()=>h(!1),isPaymentDrawerOpen:b,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!se||!q||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||P.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!q||Q.fetchState==="Completed",paymentInitiatedDate:K.initiatedRepaymentDate}):null,o.jsx(li,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Rt(),signedInUser:u,location:n,navigate:e,setIsPaymentOpen:h,cardIssuedByRoles:De?.userRoles,cardIssuedByDepartmentName:ve?.className,cardHolderRoles:Ce?.userRoles,cardHolderDepartmentName:J?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:y,isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:z,isCardControlsEnabled:S,isEarlyPayEnabled:R,controllerEmails:ee,chargeCardCashbackDetailState:Q,productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,classListFetchState:w,primaryFundingAccountDetails:Da,currentTenant:m,cardProviderId:I.chargeCard?.cardProviderID,cardId:t,creditAccount:P,creditAccountRepayment:K,includeCreditAccountInfo:H,signedInUserToken:W,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:p.documentAiReceiptMaxSizeLimitBytes!=null?p.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:V,isCardsCommentingEnabled:i})]}):o.jsx(ot,{})}const St=e=>{const a=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,n=e.cardName,t=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,g=e.creditLimitFrequency.name;return{ownerName:a,cardName:n,utilisation:t,cardColor:e.cardColorCode??"",frequency:g,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:mi,subheadline:Ci,pageTitle:pi}}}}=ea.getLocalizedStrings(),$r=[pa,ct,Nr,La,Ra,it,Kt,Wc,$t,Gt,Ht],hi=new Set($r),Dt=jt(((e,a,n,t)=>{e(ia(a,n,t,!0))}),400),fi=Ve.div`
|
|
19
19
|
display: flex;
|
|
20
20
|
width: 100%;
|
|
21
21
|
flex: 1 1 auto;
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
align-items: center;
|
|
24
24
|
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,gi=Pe((function(e,a){const n=Ca(e,a.includeCreditAccountDebitSummaryAndCashbackInfo,a.isDebitCardFeatureEnabled&&a.isDebitCardSetupEnabled,a.isChargeCardFeatureEnabled&&a.isChargeCardSetupEnabled);return{chargeCardListView:n,rowActionView:mo(e),bulkActionView:Co(e),companyLegalName:a.currentTenant.companyName,admins:a.admins,searchText:n.searchText,uiState:n.uiState,signedInUser:a.signedInUser,receiptsEmail:Wn(e.tenantState,a.currentTenant.tenantId)}}),(function(e,a){const{navigateAndClearBulkSelection:n,currentTenant:t,location:s,signedInUser:g,chargeCardListState:b,includeCreditAccountDebitSummaryAndCashbackInfo:h,isChargeCardFeatureEnabled:A,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:p,isChargeCardTOSAccepted:T,controllerEmails:L,depositAccountListWithDebitCardIssued:S,primaryFundingAccountDetails:l,chargeCardSetUpViewFetchState:C,productInformation:B,cashbackInformation:k,creditAccountInformation:_,debitAccountInformation:D,updatePayNowInfoTooltip:M,isUserHasCardsAdminLevelAccess:E}=a,{tenantEmailDomain:y}=t,{cards:R}=b;return{onChargeCardRowClick:(i,f)=>{const j=Pr(R,i);let G;j!=null&&((x=>{const z=x.limit.amount-x.available.amount,H=`${x.cardHolderUser?.firstName.toLowerCase()} ${x.cardHolderUser?.lastName.toLowerCase()}`,v=x.cardName,P=x.department?.className??"",K=x.limit.amount,W=x.creditLimitFrequency.name;ae.trackCardsListRowClicked(H,v,P,z,K,W,g.userId===x.cardHolderUserId)})(j),ca(F,w,S)&&ae.trackCardsCardListRowClick(L,B,"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:Sa(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:Sa(j.limit.amount)},k,_,D)),G=j?.status.code==="request_on_hold"&&g.userId===j.cardHolderUserId?wr(y):_e(y,i,g,j);const U=ke(s.state?.pathnameStackToGoBack,s.pathname);n(G,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:i=>{e(er(i))},onFetchDepositAccountLimit:i=>{e(Yn({depositAccountId:i}))},onChargeCardResendInviteClick:i=>{e(Io(i))},onChargeCardRevokeInviteClick:i=>{e(Qn(i))},onLockChargeCardList:(i,f)=>{e(yo(i,f))},onUnlockChargeCardList:i=>{e(So(i))},onCloseChargeCardList:(i,f)=>{e(bo(i,f))},onRevokeChargeCardList:i=>{e(go(i))},updateChargeCardListSpendLimit(i,f,j){e(fo(i,f,j.code))},onLockChargeCard:(i,f)=>{e(nr(E,i,f))},onUnlockChargeCard:i=>{e(tr(E,i))},onCloseChargeCard:(i,f)=>{e(ar(i,f))},onUpdateSpendLimit(i,f,j,G){e(qn(i,f,j.code,G))},updateChargeCardName:(i,f)=>{e(Xn(E,i,f))},onClickSetupIcon:()=>{ae.trackCardsListPageClicked("settings"),ca(F,w,S)&&k!=null&&ae.trackCardsSettingsClick(L,B,k,_,D);const i=xc(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{ae.trackCardsListPageClicked("new card"),ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"New Button","card_creation_initiated","Card List",_,D);const i=bi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(i,f)=>{ca(F,w,S)&&k!=null&&ae.trackCardsCardListSortClick(L,B,k,"Sort Icon","sort",i,f==="ascending"?"ASC":"DESC","Cards List",_,D),e(It({uiState:{sortKey:i,sortOrder:f}}))},onSearchTextChanged:i=>{e(ho(i))},onReloadCards:()=>{e(ia(h,F&&w,A&&m,!0))},onLetsGoClick:()=>{n("./onboard")},onBackClick:()=>{n("../../")},onTotalCashbackClick:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsCashbackOverviewClick(L,B,k,"Cashback Overview","cashback_details_viewed",_,D),n("./cashback")},onClickStatementsIcon:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsStatementsClick(L,B,k,_,D),n("./statements")},onCreateNowClick:i=>{ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"Promo Banner","card_creation_initiated","Card List",_,D),n(`./new?cardType=${i}`)},onPromoCardClick:i=>{n(i==="debit"&&F&&!p||i==="credit"&&u&&!T?`../promo?cardPromoType=${i}`:"./setup")},navigateToCreditCardPaymentPage:(i,f)=>{C==="Completed"&&t.company!=null&&k!=null&&ae.trackCardsPayEarlyClick(L,B,k,"Card List",i,f,{isZeniCheckingEnabled:t.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:l?.accType==="depositAccount",creditCardPaymentSourceAccountName:l?.label,creditCardPaymentSourceAccountType:l?.accType,creditCardPaymentSourceLastFourDigits:l?.accountLast4,creditCardPaymentSourceBalance:l?.accountBalance?.available?.amount??0},_,D);const j=Si(y);n(j)},navigateToCreditCardPaymentHistoryPage:()=>{const i=yi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:M,onSetRowActionCardId:i=>{e(po(i))},onSetBulkActionCardIds:i=>{e(rr(i))},onEventReceived:i=>{hi.has(i)&&Dt(e,h,F&&w,A&&m)},onPusherSubscribed:()=>{Dt(e,h,F&&w,A&&m)}}}))(st(Cc));function kn({isPaymentDrawerOpen:e}){const a=de(),n=me(),t=he(),s=r.useCallback((($,Ue)=>{n(rr([])),a($,Ue)}),[n,a]),[g,b]=r.useState(!1),[h,A]=r.useState(te.getPayNowInfoTooltip()??!1),u=$=>{te.savePayNowInfoTooltip($),A($)},[m,F]=r.useState(!1),w=te.getSignedInUser(),p=d(($=>fe($))),[T,L]=r.useState(!1),[S,l]=r.useState(!1),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Cards"}),k=p.userRole.includes("charge_card_user"),_=!k,D=!!p.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:M,useDynamicConfig:E}=le(),{isFeatureEnabled:y}=M(Y.isCashbackFeatureEnabled),{isFeatureEnabled:R}=M(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:i}=M(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=M(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=M(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=M(Y.isCardsCommentingEnabled),{isFeatureEnabled:U}=M(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:x}=M(Y.isCardPolicyEnabled),{isFeatureEnabled:z}=M(Y.isAiCardCreationEnabled),H=Be(i,p),v=Re({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:H}),P=Fe(p),K=xe(p),W=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Oe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:W}),N=_r({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K}),{configValue:V}=E(Qe.zeniCardsConfig),Q=Le(),c=Te(Q?.loggedInUserRoleMap),O=d(($=>da($,p.companyId))),q=la(O.controllers),se=V.charge_card_cashback_rate_per_transaction!=null?V.charge_card_cashback_rate_per_transaction:.0175,X=V.credit_card_pay_now_threshold_by_company_id?.[p.companyId]??V.default_credit_card_pay_now_threshold??Fc,He=V.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(V.enable_card_controls_for_company_ids)&&V.enable_card_controls_for_company_ids.includes(p.companyId),Ae=!!p.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!p.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!p.companyChargeCardInfo?.info?.isChargeCardEnabled,be=!!p.company?.companyChargeCardInfo?.isChargeCardEnabled,ue=!!p.company?.companyDebitCardInfo?.isDebitCardEnabled,oe=d(($=>Gn($))),Se=ya(oe.updateStatus),ee=d(($=>Ca($,_,v&&D,I&&re))),De=d(($=>co($))),ve=d(($=>io($))),Ce=d(($=>lo($))),J=d(($=>uo($))),fa=d(($=>Ce==null?[]:Nn($.aiCfoState,Ce).filter((Ue=>Ue.kind==="creating_cards"))),_t),na=ya(ve.fetchState);r.useEffect((()=>{na==="In-Progress"&&ve.fetchState==="Completed"&&Ce!=null&&fa.forEach(($=>{n(yt({chatSessionId:Ce,id:$.id,entityIds:J,kind:"created_cards"}))}))}),[n,ve.fetchState,Ce,J,fa,na]);const Oa=ee.cards.filter(($=>$.type.code.includes("debit"))).map(($=>$.connectedAccountId)),dt=[...new Set(Oa)],Ea=d(($=>ma($))),ra=d(($=>tt($,dt))),Aa=d(($=>wa($,p.companyId))),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find(($=>$.id===lt?.accountId)),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback((()=>c===!0&&x===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(p.tenantEmailDomain??"")!==!0),[c,x,pe,p.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect((()=>{Ma(Da())}),[Da]);const Z=()=>{te.saveCardPolicyPopupSeen(p.tenantEmailDomain??"",!0),Ma(!1)},ye=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;uc({isDataReady:pe==="Completed",pageContext:ye?"cards_creation":"cards"});const{creditAccountRepayment:ce}=d(($=>ua($))),$e=d(($=>qa($).firstViewAfterActivation)),{areTenantIdsInSync:Ze}=Ir(),Ge=Mt(c,Ea),Ke=Ba(I,re,c,Ua,ce),sa=Nt(v,D,c,ra,ee.debitCardSummary),mt=Xe(I,v,D,re),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect((()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<X*ee.creditAccount.limit.amount/100)&&u(!0)}),[pe,X,Ct,ee.creditAccount.limit.amount]),r.useEffect((()=>{if(e!=null&&e===!0&&ce.initiatedRepayments.amount===0&&ce.fetchState==="Completed"||Se==="In-Progress"&&oe.updateStatus==="Completed")u(!1),b(!0);else if(ce.initiatedRepayments.amount>0&&ce.fetchState==="Completed"){b(!1),document.body.style.overflow="auto";const $=ta(p.tenantEmailDomain);s($)}}),[e,ce.initiatedRepayments.amount,ce.fetchState,Se,oe.updateStatus,s,p.tenantEmailDomain]),r.useEffect((()=>{!T&&(re||D)&&(be||ue)&&Ze&&(L(!0),n(ia(_,v&&D,I&&re,!1)))}),[T,_,n,Ze,be,ue]),r.useEffect((()=>{$e&&m===!1&&(F(!0),setTimeout((()=>{n(za())}),5e3))}),[$e,m]),r.useEffect((()=>()=>{Dt.flush()}),[]),r.useEffect((()=>{pe==="Completed"&&k&&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"&&(t.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))}),[pe,k,t.state,s,ee.cards]),r.useEffect((()=>{if(pe==="Completed"&&k){const $=ee.cards.length,Ue=ee.cards.filter((Ye=>Ye.cardHolderUserId===w?.userId)).filter((Ye=>Ye.status.code==="request_on_hold"));Ue.length>0&&$===Ue.length&&s("./onboard")}}),[pe,ee.cards,k,s,w?.userId]),r.useEffect((()=>{pe!=="Completed"||I&&ce.fetchState!=="Completed"||v&&D&&c&&ra.fetchState!=="Completed"||ae.trackCardsCardListView(q,mt,Ge,Ke,sa)}),[pe,Ua,ce.fetchState,ra.fetchState,c]),w==null)throw Error("Can't access charge card list page without signing in...");const Zr=d(($=>sr($.userState,$.userRoleState,$.userListViewState,"cardAdmin"))),Wt=xt(Q?.loggedInUserRoleMap),qt=$=>{l($)},Yr=ee.creditAccount.limit,Wr=()=>{b(!1),s("..")},qr=p.companyChargeCardInfo?.info!=null&&Ia({cardInfo:p.companyChargeCardInfo.info,isProductVisible:I&&be,isTOSAccepted:Ae,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Wt}),Jr=p.companyDebitCardInfo?.info!=null&&Ia({cardInfo:p.companyDebitCardInfo.info,isProductVisible:v&&ue,isTOSAccepted:ge,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Wt}),Qr=qr||Jr,Jt=(function($){const{isEmptyCardsState:Ue,isChargeCardAdmin:Ye,isFileUploadEnabled:an}=$,tn=de(),Na=he(),{tenantEmailDomain:Va}=Ne(),{isAiCfoOpen:ns,setIsAiCfoOpen:nn}=fr(),rs=gr(),ss=br(),rn=d((Ie=>Mn(Ie))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:sn,isResolved:on}=Br("cards_creation"),cn=r.useMemo((()=>xr(sn,on,3)),[sn,on]),[Ha,pt]=r.useState(""),dn=ss&&rs&&Va!=null&&!ns,ga=r.useCallback((Ie=>{if(Va==null)return;const os=ke(Na.state?.pathnameStackToGoBack,Na.pathname);tn(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:os,referrer:"cards_hero",aiCfoInitialQuestion:Ie,aiCfoShouldSubmit:Ie!=null&&Ie.trim().length>0}})}),[Na.pathname,Na.state,tn,Va]),ln=r.useCallback((Ie=>{Ie.trim().length!==0&&(pt(""),ga(Ie))}),[ga]),un=r.useCallback((()=>{const Ie=Ha.trim();Ie.length!==0&&(pt(""),ga(Ie))}),[Ha,ga]),mn=r.useCallback((()=>{}),[]),Cn=r.useCallback((Ie=>{pt(Ie)}),[]),pn=r.useCallback((()=>{nn(!0)}),[nn]),hn=r.useCallback((()=>{ga(void 0)}),[ga]);return r.useMemo((()=>{if(dn&&Ue&&Ye)return{aiAgentName:pi,headline:mi,subheadline:Ci,promptChips:cn,composer:{currentInput:Ha,isSubmitting:rn,isFileUploadEnabled:an,onInputChange:Cn,onSubmit:un,onStopSubmit:mn},onPromptClick:ln,onOpenSidePanel:pn,onOpenFullView:hn,dataTestIdPrefix:"cards-ai-cfo-hero"}}),[Ha,dn,Ye,Ue,an,rn,Cn,hn,pn,ln,mn,un,cn])})({isEmptyCardsState:ye,isChargeCardAdmin:c,isFileUploadEnabled:U}),Qt=z&&Jt!=null?o.jsx(Sr,{...Jt}):null,{isCardsShuttingDown:Xt,shutdownContent:en}=kr(p.tenantId,p.company?.managementInfo?.receiverEmails),Xr=Xt===!0&&en!=null?o.jsx(mc,{shutdownContent:en}):null,es=C&&Qt==null,as=aa(p),ts={events:ha(as,$r),eventCallback:($,Ue,Ye)=>{Ye.onEventReceived($)},onSubscribed:$=>{$.onPusherSubscribed()}};return re||D?o.jsxs(o.Fragment,{children:[pe==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{ae.trackPageLoaded(Er.Event.cardsListPage),(I&&!re||v&&!D)&&ae.trackCardsPromoView(q,{isCreditCardOffered:I,isDebitCardOffered:v,isDebitCardEnabled:D,isCreditCardEnabled:re},"Banner",v&&!D?"Debit Card":I&&!re?"Credit Card":"","Card List")}}),o.jsx(nt,{showConfetti:$e})]}):null,g===!0?o.jsx(zt,{closeDrawerHandler:Wr,isPaymentDrawerOpen:g,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isDebitCardInfoFetchStateCompleted:!(v&&D&&c)||ra.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ce.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!c||Ea.fetchState==="Completed",paymentInitiatedDate:ce.initiatedRepaymentDate}):null,o.jsxs(fi,{children:[o.jsx(Ee,{isAppContentDrawerOpen:S,handleDrawerToggle:qt}),o.jsx(gi,{...ts,isCashbackFeatureEnabled:y,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:v,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:h,creditCardPayNowThreshold:X,signedInUser:w,chargeCardListState:ee,location:t,admins:Zr.users,navigateAndClearBulkSelection:s,currentTenant:p,isCardControlsEnabled:He,companyChargeCardInfoCreditAccountLimit:p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:p.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:c,includeCreditAccountDebitSummaryAndCashbackInfo:_,onClickMenuIcon:()=>{qt(!0)},creditLimit:Yr,isChargeCardSetupEnabled:re,isChargeCardEnabledOnCompany:be,isDebitCardSetupEnabled:D,isDebitCardEnabledOnCompany:ue,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:se,controllerEmails:q,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:ra,isChargeCardTOSAccepted:Ae,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isAiCfoAccessEnabled:es,onAskAiCfoClick:B,isCardsCommentingEnabled:G,cardsAiCfoHero:Qt,cardsShutdownBanner:Xr,isCardsShuttingDown:Xt,onClickPolicyIcon:c&&x?()=>a(Ii(p.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Z,pendingCreationCount:De})]})]}):(Ae||ge)&&c===!0?o.jsx(Je,{to:"../setup"}):Qr?o.jsx(Je,{to:"../promo"}):o.jsx(va,{fetchState:pe})}const bi=e=>`/${e}/cards/new`,Si=e=>`/${e}/cards/payment`,yi=e=>`/${e}/cards/payment-history`,Ii=e=>`/${e}/cards/policy`,Gr=[Mr,Nr],ki=new Set(Gr),Ei=Pe((function(e){const a=te.getSignedInUser(),n=fe(e),t=e.tenantState.currentTenantId,s=or(e),g={userId:a?.userId??"",sessionId:a?.zeniSessionId??"",tenantId:t??""},b=n?.companyName??"",h=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:ko(n),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:g,companyName:b,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:h}}),(function(e,a){const{location:n,navigate:t}=a;return{onBackClick:()=>{const s=we(n.state?.pathnameStackToGoBack),g=s.poppedPathname??"..";t(g,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,g)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:g}}})},onFiltersChange:s=>{e(Ao({filters:s}))},onReloadPayments:()=>{e($a(!0))},onEventReceived:s=>{ki.has(s)&&e($a(!0))},onPusherSubscribed:()=>{e($a(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Eo({uiState:{downloadState:s}}))}}}))(st(pc));function Ai(){const e=de(),a=he(),n=me(),{areTenantIdsInSync:t}=Ir(),{useFeatureGate:s}=le();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const g=d((c=>fe(c))),b=d((c=>or(c))),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,T]=r.useState(null),L=!g.userRole.includes("charge_card_user"),S=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:l}=s(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:C}=s(Y.isDebitCardFeatureEnabled),B=Be(C,g),k=Re({isDebitCardFeatureEnabled:C,isBankingOnlyTenant:B}),_=Fe(g),D=xe(g),M=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Oe({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:l,isBookKeepingTenant:D,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:M}),y=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,R=Le(),i=Te(R?.loggedInUserRoleMap),f=d((c=>Ca(c,L,k&&S,E&&y))),j=r.useMemo((()=>{const c=f.cards.filter((O=>O.type.code.includes("debit")));return[...new Set(c.map((O=>O.connectedAccountId)))]}),[f.cards]),G=d((c=>ma(c))),U=d((c=>tt(c,j))),{creditAccountRepayment:x}=d((c=>ua(c))),z=r.useMemo((()=>Mt(i,G)),[i,G]),H=r.useMemo((()=>Ba(E,y,i,f.creditAccount,x)),[E,y,i,f.creditAccount,x]),v=r.useMemo((()=>Nt(k,S,i,U,f.debitCardSummary)),[k,S,i,U,f.debitCardSummary]),P=r.useMemo((()=>Xe(E,k,S,y)),[E,k,S,y]),K=f.creditAccount.balance.amount+f.creditAccount.hold.amount,W=r.useMemo((()=>p!=null?b.repaymentHistory.find((c=>c.cardRepaymentId===p)):void 0),[p,b.repaymentHistory]),I=r.useCallback((c=>{T(c),n(ia(L,k&&S,E&&y,!1)),w(!0)}),[n,L,k,S,E,y]),N=r.useCallback((()=>{w(!1),T(null),document.body.style.overflow="auto"}),[]);r.useEffect((()=>{h||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(A(!0),n($a()))}),[h,n,b.fetchState]),r.useEffect((()=>{!u&&(y||S)&&t&&(m(!0),n(ia(L,!1,E&&y,!1)))}),[u,y,S,t,n,L,E]);const V=aa(g),Q={events:ha(V,Gr),eventCallback:(c,O,q)=>{q.onEventReceived(c)},onSubscribed:c=>{c.onPusherSubscribed()}};return o.jsxs(o.Fragment,{children:[F?o.jsx(zt,{closeDrawerHandler:N,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:K,productInformation:P,creditAccountInformation:H,debitAccountInformation:v,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(k&&S&&i)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||x.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!i||G.fetchState==="Completed",paymentInitiatedDate:x.initiatedRepaymentDate,retryRepayment:W}):null,o.jsx(Ei,{...Q,location:a,navigate:e,accountInfoByAccountId:b.accountInfoByAccountId,onRetryPaymentClick:I})]})}const En=Ve.div`
|
|
25
|
+
`,gi=Pe((function(e,a){const n=Ca(e,a.includeCreditAccountDebitSummaryAndCashbackInfo,a.isDebitCardFeatureEnabled&&a.isDebitCardSetupEnabled,a.isChargeCardFeatureEnabled&&a.isChargeCardSetupEnabled);return{chargeCardListView:n,rowActionView:mo(e),bulkActionView:Co(e),companyLegalName:a.currentTenant.companyName,admins:a.admins,searchText:n.searchText,uiState:n.uiState,signedInUser:a.signedInUser,receiptsEmail:Wn(e.tenantState,a.currentTenant.tenantId)}}),(function(e,a){const{navigateAndClearBulkSelection:n,currentTenant:t,location:s,signedInUser:g,chargeCardListState:b,includeCreditAccountDebitSummaryAndCashbackInfo:h,isChargeCardFeatureEnabled:A,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:p,isChargeCardTOSAccepted:T,controllerEmails:L,depositAccountListWithDebitCardIssued:S,primaryFundingAccountDetails:l,chargeCardSetUpViewFetchState:C,productInformation:B,cashbackInformation:k,creditAccountInformation:_,debitAccountInformation:D,updatePayNowInfoTooltip:M,isUserHasCardsAdminLevelAccess:E}=a,{tenantEmailDomain:y}=t,{cards:R}=b;return{onChargeCardRowClick:(i,f)=>{const j=Pr(R,i);let G;j!=null&&((x=>{const z=x.limit.amount-x.available.amount,H=`${x.cardHolderUser?.firstName.toLowerCase()} ${x.cardHolderUser?.lastName.toLowerCase()}`,v=x.cardName,P=x.department?.className??"",K=x.limit.amount,W=x.creditLimitFrequency.name;ae.trackCardsListRowClicked(H,v,P,z,K,W,g.userId===x.cardHolderUserId)})(j),ca(F,w,S)&&ae.trackCardsCardListRowClick(L,B,"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:Sa(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:Sa(j.limit.amount)},k,_,D)),G=j?.status.code==="request_on_hold"&&g.userId===j.cardHolderUserId?wr(y):_e(y,i,g,j);const U=ke(s.state?.pathnameStackToGoBack,s.pathname);n(G,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:i=>{e(er(i))},onFetchDepositAccountLimit:i=>{e(Zn({depositAccountId:i}))},onChargeCardResendInviteClick:i=>{e(Io(i))},onChargeCardRevokeInviteClick:i=>{e(Qn(i))},onLockChargeCardList:(i,f)=>{e(yo(i,f))},onUnlockChargeCardList:i=>{e(So(i))},onCloseChargeCardList:(i,f)=>{e(bo(i,f))},onRevokeChargeCardList:i=>{e(go(i))},updateChargeCardListSpendLimit(i,f,j){e(fo(i,f,j.code))},onLockChargeCard:(i,f)=>{e(nr(E,i,f))},onUnlockChargeCard:i=>{e(tr(E,i))},onCloseChargeCard:(i,f)=>{e(ar(i,f))},onUpdateSpendLimit(i,f,j,G){e(qn(i,f,j.code,G))},updateChargeCardName:(i,f)=>{e(Xn(E,i,f))},onClickSetupIcon:()=>{ae.trackCardsListPageClicked("settings"),ca(F,w,S)&&k!=null&&ae.trackCardsSettingsClick(L,B,k,_,D);const i=xc(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{ae.trackCardsListPageClicked("new card"),ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"New Button","card_creation_initiated","Card List",_,D);const i=bi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(i,f)=>{ca(F,w,S)&&k!=null&&ae.trackCardsCardListSortClick(L,B,k,"Sort Icon","sort",i,f==="ascending"?"ASC":"DESC","Cards List",_,D),e(It({uiState:{sortKey:i,sortOrder:f}}))},onSearchTextChanged:i=>{e(ho(i))},onReloadCards:()=>{e(ia(h,F&&w,A&&m,!0))},onLetsGoClick:()=>{n("./onboard")},onBackClick:()=>{n("../../")},onTotalCashbackClick:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsCashbackOverviewClick(L,B,k,"Cashback Overview","cashback_details_viewed",_,D),n("./cashback")},onClickStatementsIcon:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsStatementsClick(L,B,k,_,D),n("./statements")},onCreateNowClick:i=>{ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"Promo Banner","card_creation_initiated","Card List",_,D),n(`./new?cardType=${i}`)},onPromoCardClick:i=>{n(i==="debit"&&F&&!p||i==="credit"&&u&&!T?`../promo?cardPromoType=${i}`:"./setup")},navigateToCreditCardPaymentPage:(i,f)=>{C==="Completed"&&t.company!=null&&k!=null&&ae.trackCardsPayEarlyClick(L,B,k,"Card List",i,f,{isZeniCheckingEnabled:t.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:l?.accType==="depositAccount",creditCardPaymentSourceAccountName:l?.label,creditCardPaymentSourceAccountType:l?.accType,creditCardPaymentSourceLastFourDigits:l?.accountLast4,creditCardPaymentSourceBalance:l?.accountBalance?.available?.amount??0},_,D);const j=Si(y);n(j)},navigateToCreditCardPaymentHistoryPage:()=>{const i=yi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:M,onSetRowActionCardId:i=>{e(po(i))},onSetBulkActionCardIds:i=>{e(rr(i))},onEventReceived:i=>{hi.has(i)&&Dt(e,h,F&&w,A&&m)},onPusherSubscribed:()=>{Dt(e,h,F&&w,A&&m)}}}))(st(Cc));function kn({isPaymentDrawerOpen:e}){const a=de(),n=me(),t=he(),s=r.useCallback((($,Ue)=>{n(rr([])),a($,Ue)}),[n,a]),[g,b]=r.useState(!1),[h,A]=r.useState(te.getPayNowInfoTooltip()??!1),u=$=>{te.savePayNowInfoTooltip($),A($)},[m,F]=r.useState(!1),w=te.getSignedInUser(),p=d(($=>fe($))),[T,L]=r.useState(!1),[S,l]=r.useState(!1),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Cards"}),k=p.userRole.includes("charge_card_user"),_=!k,D=!!p.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:M,useDynamicConfig:E}=le(),{isFeatureEnabled:y}=M(Z.isCashbackFeatureEnabled),{isFeatureEnabled:R}=M(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:i}=M(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=M(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=M(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=M(Z.isCardsCommentingEnabled),{isFeatureEnabled:U}=M(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:x}=M(Z.isCardPolicyEnabled),{isFeatureEnabled:z}=M(Z.isAiCardCreationEnabled),H=Be(i,p),v=Re({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:H}),P=Fe(p),K=xe(p),W=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Oe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:W}),N=_r({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K}),{configValue:V}=E(Qe.zeniCardsConfig),Q=Le(),c=Te(Q?.loggedInUserRoleMap),O=d(($=>da($,p.companyId))),q=la(O.controllers),se=V.charge_card_cashback_rate_per_transaction!=null?V.charge_card_cashback_rate_per_transaction:.0175,X=V.credit_card_pay_now_threshold_by_company_id?.[p.companyId]??V.default_credit_card_pay_now_threshold??Fc,He=V.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(V.enable_card_controls_for_company_ids)&&V.enable_card_controls_for_company_ids.includes(p.companyId),Ae=!!p.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!p.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!p.companyChargeCardInfo?.info?.isChargeCardEnabled,be=!!p.company?.companyChargeCardInfo?.isChargeCardEnabled,ue=!!p.company?.companyDebitCardInfo?.isDebitCardEnabled,oe=d(($=>Gn($))),Se=ya(oe.updateStatus),ee=d(($=>Ca($,_,v&&D,I&&re))),De=d(($=>co($))),ve=d(($=>io($))),Ce=d(($=>lo($))),J=d(($=>uo($))),fa=d(($=>Ce==null?[]:Nn($.aiCfoState,Ce).filter((Ue=>Ue.kind==="creating_cards"))),_t),na=ya(ve.fetchState);r.useEffect((()=>{na==="In-Progress"&&ve.fetchState==="Completed"&&Ce!=null&&fa.forEach(($=>{n(yt({chatSessionId:Ce,id:$.id,entityIds:J,kind:"created_cards"}))}))}),[n,ve.fetchState,Ce,J,fa,na]);const Oa=ee.cards.filter(($=>$.type.code.includes("debit"))).map(($=>$.connectedAccountId)),dt=[...new Set(Oa)],Ea=d(($=>ma($))),ra=d(($=>tt($,dt))),Aa=d(($=>wa($,p.companyId))),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find(($=>$.id===lt?.accountId)),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback((()=>c===!0&&x===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(p.tenantEmailDomain??"")!==!0),[c,x,pe,p.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect((()=>{Ma(Da())}),[Da]);const Y=()=>{te.saveCardPolicyPopupSeen(p.tenantEmailDomain??"",!0),Ma(!1)},ye=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;uc({isDataReady:pe==="Completed",pageContext:ye?"cards_creation":"cards"});const{creditAccountRepayment:ce}=d(($=>ua($))),$e=d(($=>qa($).firstViewAfterActivation)),{areTenantIdsInSync:Ye}=Ir(),Ge=Mt(c,Ea),Ke=Ba(I,re,c,Ua,ce),sa=Nt(v,D,c,ra,ee.debitCardSummary),mt=Xe(I,v,D,re),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect((()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<X*ee.creditAccount.limit.amount/100)&&u(!0)}),[pe,X,Ct,ee.creditAccount.limit.amount]),r.useEffect((()=>{if(e!=null&&e===!0&&ce.initiatedRepayments.amount===0&&ce.fetchState==="Completed"||Se==="In-Progress"&&oe.updateStatus==="Completed")u(!1),b(!0);else if(ce.initiatedRepayments.amount>0&&ce.fetchState==="Completed"){b(!1),document.body.style.overflow="auto";const $=ta(p.tenantEmailDomain);s($)}}),[e,ce.initiatedRepayments.amount,ce.fetchState,Se,oe.updateStatus,s,p.tenantEmailDomain]),r.useEffect((()=>{!T&&(re||D)&&(be||ue)&&Ye&&(L(!0),n(ia(_,v&&D,I&&re,!1)))}),[T,_,n,Ye,be,ue]),r.useEffect((()=>{$e&&m===!1&&(F(!0),setTimeout((()=>{n(za())}),5e3))}),[$e,m]),r.useEffect((()=>()=>{Dt.flush()}),[]),r.useEffect((()=>{pe==="Completed"&&k&&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"&&(t.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))}),[pe,k,t.state,s,ee.cards]),r.useEffect((()=>{if(pe==="Completed"&&k){const $=ee.cards.length,Ue=ee.cards.filter((Ze=>Ze.cardHolderUserId===w?.userId)).filter((Ze=>Ze.status.code==="request_on_hold"));Ue.length>0&&$===Ue.length&&s("./onboard")}}),[pe,ee.cards,k,s,w?.userId]),r.useEffect((()=>{pe!=="Completed"||I&&ce.fetchState!=="Completed"||v&&D&&c&&ra.fetchState!=="Completed"||ae.trackCardsCardListView(q,mt,Ge,Ke,sa)}),[pe,Ua,ce.fetchState,ra.fetchState,c]),w==null)throw Error("Can't access charge card list page without signing in...");const Yr=d(($=>sr($.userState,$.userRoleState,$.userListViewState,"cardAdmin"))),Wt=xt(Q?.loggedInUserRoleMap),qt=$=>{l($)},Zr=ee.creditAccount.limit,Wr=()=>{b(!1),s("..")},qr=p.companyChargeCardInfo?.info!=null&&Ia({cardInfo:p.companyChargeCardInfo.info,isProductVisible:I&&be,isTOSAccepted:Ae,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Wt}),Jr=p.companyDebitCardInfo?.info!=null&&Ia({cardInfo:p.companyDebitCardInfo.info,isProductVisible:v&&ue,isTOSAccepted:ge,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Wt}),Qr=qr||Jr,Jt=(function($){const{isEmptyCardsState:Ue,isChargeCardAdmin:Ze,isFileUploadEnabled:an}=$,tn=de(),Na=he(),{tenantEmailDomain:Va}=Ne(),{isAiCfoOpen:ns,setIsAiCfoOpen:nn}=fr(),rs=gr(),ss=br(),rn=d((Ie=>Mn(Ie))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:sn,isResolved:on}=Br("cards_creation"),cn=r.useMemo((()=>xr(sn,on,3)),[sn,on]),[Ha,pt]=r.useState(""),dn=ss&&rs&&Va!=null&&!ns,ga=r.useCallback((Ie=>{if(Va==null)return;const os=ke(Na.state?.pathnameStackToGoBack,Na.pathname);tn(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:os,referrer:"cards_hero",aiCfoInitialQuestion:Ie,aiCfoShouldSubmit:Ie!=null&&Ie.trim().length>0}})}),[Na.pathname,Na.state,tn,Va]),ln=r.useCallback((Ie=>{Ie.trim().length!==0&&(pt(""),ga(Ie))}),[ga]),un=r.useCallback((()=>{const Ie=Ha.trim();Ie.length!==0&&(pt(""),ga(Ie))}),[Ha,ga]),mn=r.useCallback((()=>{}),[]),Cn=r.useCallback((Ie=>{pt(Ie)}),[]),pn=r.useCallback((()=>{nn(!0)}),[nn]),hn=r.useCallback((()=>{ga(void 0)}),[ga]);return r.useMemo((()=>{if(dn&&Ue&&Ze)return{aiAgentName:pi,headline:mi,subheadline:Ci,promptChips:cn,composer:{currentInput:Ha,isSubmitting:rn,isFileUploadEnabled:an,onInputChange:Cn,onSubmit:un,onStopSubmit:mn},onPromptClick:ln,onOpenSidePanel:pn,onOpenFullView:hn,dataTestIdPrefix:"cards-ai-cfo-hero"}}),[Ha,dn,Ze,Ue,an,rn,Cn,hn,pn,ln,mn,un,cn])})({isEmptyCardsState:ye,isChargeCardAdmin:c,isFileUploadEnabled:U}),Qt=z&&Jt!=null?o.jsx(Sr,{...Jt}):null,{isCardsShuttingDown:Xt,shutdownContent:en}=kr(p.tenantId,p.company?.managementInfo?.receiverEmails),Xr=Xt===!0&&en!=null?o.jsx(mc,{shutdownContent:en}):null,es=C&&Qt==null,as=aa(p),ts={events:ha(as,$r),eventCallback:($,Ue,Ze)=>{Ze.onEventReceived($)},onSubscribed:$=>{$.onPusherSubscribed()}};return re||D?o.jsxs(o.Fragment,{children:[pe==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{ae.trackPageLoaded(Er.Event.cardsListPage),(I&&!re||v&&!D)&&ae.trackCardsPromoView(q,{isCreditCardOffered:I,isDebitCardOffered:v,isDebitCardEnabled:D,isCreditCardEnabled:re},"Banner",v&&!D?"Debit Card":I&&!re?"Credit Card":"","Card List")}}),o.jsx(nt,{showConfetti:$e})]}):null,g===!0?o.jsx(zt,{closeDrawerHandler:Wr,isPaymentDrawerOpen:g,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isDebitCardInfoFetchStateCompleted:!(v&&D&&c)||ra.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ce.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!c||Ea.fetchState==="Completed",paymentInitiatedDate:ce.initiatedRepaymentDate}):null,o.jsxs(fi,{children:[o.jsx(Ee,{isAppContentDrawerOpen:S,handleDrawerToggle:qt}),o.jsx(gi,{...ts,isCashbackFeatureEnabled:y,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:v,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:h,creditCardPayNowThreshold:X,signedInUser:w,chargeCardListState:ee,location:t,admins:Yr.users,navigateAndClearBulkSelection:s,currentTenant:p,isCardControlsEnabled:He,companyChargeCardInfoCreditAccountLimit:p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:p.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:c,includeCreditAccountDebitSummaryAndCashbackInfo:_,onClickMenuIcon:()=>{qt(!0)},creditLimit:Zr,isChargeCardSetupEnabled:re,isChargeCardEnabledOnCompany:be,isDebitCardSetupEnabled:D,isDebitCardEnabledOnCompany:ue,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:se,controllerEmails:q,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:ra,isChargeCardTOSAccepted:Ae,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isAiCfoAccessEnabled:es,onAskAiCfoClick:B,isCardsCommentingEnabled:G,cardsAiCfoHero:Qt,cardsShutdownBanner:Xr,isCardsShuttingDown:Xt,onClickPolicyIcon:c&&x?()=>a(Ii(p.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Y,pendingCreationCount:De})]})]}):(Ae||ge)&&c===!0?o.jsx(Je,{to:"../setup"}):Qr?o.jsx(Je,{to:"../promo"}):o.jsx(va,{fetchState:pe})}const bi=e=>`/${e}/cards/new`,Si=e=>`/${e}/cards/payment`,yi=e=>`/${e}/cards/payment-history`,Ii=e=>`/${e}/cards/policy`,Gr=[Mr,Nr],ki=new Set(Gr),Ei=Pe((function(e){const a=te.getSignedInUser(),n=fe(e),t=e.tenantState.currentTenantId,s=or(e),g={userId:a?.userId??"",sessionId:a?.zeniSessionId??"",tenantId:t??""},b=n?.companyName??"",h=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:ko(n),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:g,companyName:b,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:h}}),(function(e,a){const{location:n,navigate:t}=a;return{onBackClick:()=>{const s=we(n.state?.pathnameStackToGoBack),g=s.poppedPathname??"..";t(g,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,g)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:g}}})},onFiltersChange:s=>{e(Ao({filters:s}))},onReloadPayments:()=>{e($a(!0))},onEventReceived:s=>{ki.has(s)&&e($a(!0))},onPusherSubscribed:()=>{e($a(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Eo({uiState:{downloadState:s}}))}}}))(st(pc));function Ai(){const e=de(),a=he(),n=me(),{areTenantIdsInSync:t}=Ir(),{useFeatureGate:s}=le();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const g=d((c=>fe(c))),b=d((c=>or(c))),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,T]=r.useState(null),L=!g.userRole.includes("charge_card_user"),S=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:l}=s(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:C}=s(Z.isDebitCardFeatureEnabled),B=Be(C,g),k=Re({isDebitCardFeatureEnabled:C,isBankingOnlyTenant:B}),_=Fe(g),D=xe(g),M=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Oe({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:l,isBookKeepingTenant:D,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:M}),y=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,R=Le(),i=Te(R?.loggedInUserRoleMap),f=d((c=>Ca(c,L,k&&S,E&&y))),j=r.useMemo((()=>{const c=f.cards.filter((O=>O.type.code.includes("debit")));return[...new Set(c.map((O=>O.connectedAccountId)))]}),[f.cards]),G=d((c=>ma(c))),U=d((c=>tt(c,j))),{creditAccountRepayment:x}=d((c=>ua(c))),z=r.useMemo((()=>Mt(i,G)),[i,G]),H=r.useMemo((()=>Ba(E,y,i,f.creditAccount,x)),[E,y,i,f.creditAccount,x]),v=r.useMemo((()=>Nt(k,S,i,U,f.debitCardSummary)),[k,S,i,U,f.debitCardSummary]),P=r.useMemo((()=>Xe(E,k,S,y)),[E,k,S,y]),K=f.creditAccount.balance.amount+f.creditAccount.hold.amount,W=r.useMemo((()=>p!=null?b.repaymentHistory.find((c=>c.cardRepaymentId===p)):void 0),[p,b.repaymentHistory]),I=r.useCallback((c=>{T(c),n(ia(L,k&&S,E&&y,!1)),w(!0)}),[n,L,k,S,E,y]),N=r.useCallback((()=>{w(!1),T(null),document.body.style.overflow="auto"}),[]);r.useEffect((()=>{h||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(A(!0),n($a()))}),[h,n,b.fetchState]),r.useEffect((()=>{!u&&(y||S)&&t&&(m(!0),n(ia(L,!1,E&&y,!1)))}),[u,y,S,t,n,L,E]);const V=aa(g),Q={events:ha(V,Gr),eventCallback:(c,O,q)=>{q.onEventReceived(c)},onSubscribed:c=>{c.onPusherSubscribed()}};return o.jsxs(o.Fragment,{children:[F?o.jsx(zt,{closeDrawerHandler:N,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:K,productInformation:P,creditAccountInformation:H,debitAccountInformation:v,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(k&&S&&i)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||x.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!i||G.fetchState==="Completed",paymentInitiatedDate:x.initiatedRepaymentDate,retryRepayment:W}):null,o.jsx(Ei,{...Q,location:a,navigate:e,accountInfoByAccountId:b.accountInfoByAccountId,onRetryPaymentClick:I})]})}const En=Ve.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
height: 100vh;
|
|
28
28
|
width: 100%;
|
|
@@ -31,7 +31,7 @@ import{j as o}from"./liveblocks-CVtnm86a.js";import{u as me,j as d,h as de,g as
|
|
|
31
31
|
overflow: auto;
|
|
32
32
|
align-items: center;
|
|
33
33
|
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,An=ea.getLocalizedStrings().months;function Di(){const e=de(),a=me(),n=he(),{creditAccount:t,creditAccountRepayment:s}=d((P=>ua(P))),g=`${yr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${t.id}`,[b,h]=r.useState(!1),[A,u]=r.useState(!1),m=d((P=>Do(P))),{useFeatureGate:F}=le(),w=d((P=>fe(P))),{isFeatureEnabled:p}=F(
|
|
34
|
+
`,An=ea.getLocalizedStrings().months;function Di(){const e=de(),a=me(),n=he(),{creditAccount:t,creditAccountRepayment:s}=d((P=>ua(P))),g=`${yr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${t.id}`,[b,h]=r.useState(!1),[A,u]=r.useState(!1),m=d((P=>Do(P))),{useFeatureGate:F}=le(),w=d((P=>fe(P))),{isFeatureEnabled:p}=F(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=F(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:L}=F(Z.isCardsCommentingEnabled),S=vr(L?w.companyId:void 0,{clearParams:L&&m.fetchState==="Completed"}),l=Be(T,w),C=Re({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:l}),B=Fe(w),k=xe(w),_=w.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=Oe({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:p,isBookKeepingTenant:k,isDebitCardProductVisible:C,chargeCardsCreditAccountLimit:_}),M=!!w.companyDebitCardInfo?.info?.isDebitCardEnabled,E=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,y=d((P=>da(P,w.companyId))),R=la(y.controllers),i=d((P=>cr(P))),f=i.cards.filter((P=>P.type.code.includes("debit"))).map((P=>P.connectedAccountId)),j=[...new Set(f)],G=d((P=>tt(P,j))),U=d((P=>_o(P)));r.useEffect((()=>{A||t.fetchState==="Completed"||t.fetchState==="In-Progress"||(h(!0),a(qe()))}),[b,a,t.fetchState]),r.useEffect((()=>{A||t.fetchState!=="Completed"||t.id==null||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(u(!0),a(Po(t.id)))}),[A,a,t.fetchState,t.id,m.fetchState]),r.useEffect((()=>{G.fetchState!=="Completed"&&G.fetchState!=="In-Progress"&&C&&M&&a(ir()),i.fetchState!=="Completed"&&i.fetchState!=="In-Progress"&&a(Me()),U.fetchState!=="Completed"&&U.fetchState!=="In-Progress"&&C&&M&&a(wo()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&D&&E&&a(Tt())}),[G.fetchState,C,M,i.fetchState,U.fetchState,s.fetchState,D,E]),r.useEffect((()=>{if(m.fetchState==="Completed"&&t.fetchState==="Completed"&&s.fetchState==="Completed"&&i.fetchState==="Completed"&&(!C||!M||G.fetchState==="Completed"&&U.fetchState==="Completed")){let P="",K="";if(m.statements.length>0){const V=m.statements[m.statements.length-1].period,[Q,c]=V.split("-"),O=m.statements[0].period,[q,se]=O.split("-");P=`${An[parseInt(c)-1]} ${Q}`,K=`${An[parseInt(se)-1]} ${q}`}const W=Xe(D,C,M,E),I=Ba(D,E,!0,t,s),N=Nt(C,M,!0,G,U);ae.trackCardsCreditCardStatementsView(R,W,{numberOfStatements:m.statements.length,oldestStatementMonthYear:P,latestStatementMonthYear:K},I,N)}}),[m.fetchState,t.fetchState,s.fetchState,G.fetchState,i.fetchState,U.fetchState]);const x=()=>{const P=we(n.state?.pathnameStackToGoBack),K=P.poppedPathname??"..";e(K,{state:{pathnameStackToGoBack:P.newStack}})},z=d((P=>ma(P))),H=te.getSignedInUser(),v={userId:H?.userId??"",sessionId:H?.zeniSessionId??"",tenantId:w.tenantId??""};if(H==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return o.jsx(En,{children:o.jsx(hc,{onBackClick:x})});{const P=Xe(D,C,M,E);return o.jsx(En,{children:o.jsx(fc,{currentTenantCompanyName:w.companyName,statementListView:m,productInformation:P,onBackClick:x,authParams:v,controllerEmails:R,isChargeCardFeatureEnabled:D,isDebitCardFeatureEnabled:C,isDebitCardSetupEnabled:M,isChargeCardSetupEnabled:E,isCardsCommentingEnabled:L,initialOpenThreadRequest:S,chargeCardCashbackDetailState:z,creditAccount:t,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:G,debitCardSummary:U,downloadEndPoint:g})})}}const Kr=[pa,it],_i=new Set(Kr),Pi={containerWidth:new Fa(100,58)},wi=({appContent:e})=>{const a=Ta(),n=me(),t=de(),s=he(),{useDynamicConfig:g}=le(),[b,h]=r.useState(!1),[A,u]=r.useState(!1),[m,F]=r.useState(!1),[w,p]=r.useState(!1),T=r.useRef(!1),L=r.useRef(null);r.useEffect((()=>()=>{L.current!=null&&(clearTimeout(L.current),L.current=null)}),[]);const[S,l]=r.useState(!1),[C,B]=r.useState(!1),k=te.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const _=d((N=>fe(N))),{configValue:D}=g(Qe.zeniCardsConfig),M=d((N=>vo(N))),{tenantEmailDomain:E}=_,y=d((N=>N.settingsViewState.profile.fetchState)),R=d((N=>N.chargeCardListState.fetchState)),i=d((N=>N.settingsViewState.profile.userId)),f=d((N=>N.chargeCardConfigState.fetchState));r.useEffect((()=>{b===!1&&y!=="In-Progress"&&y!=="Completed"&&(n(To()),h(!0)),A===!1&&f!=="In-Progress"&&f!=="Completed"&&(n(Ja()),u(!0)),m===!1&&R==="Not-Started"&&(F(!0),n(Me()))}),[b,m,R,A,f]),r.useEffect((()=>{y==="Completed"&&S===!1&&i!=null&&R==="Completed"&&M.cards.length>0&&(n(Fo({userId:i})),n(dr({cardId:M.cards[M.cards.length-1].id})),l(!0))}),[y,S,i,R]),r.useEffect((()=>{if(!w&&M.fetchState==="Completed"&&M.cards.length===0){const N=we(s.state?.pathnameStackToGoBack),V=N.poppedPathname??ta(E);t(V,{state:{pathnameStackToGoBack:N.newStack}})}}),[M.fetchState,M.cards,w]);const j=d((N=>qa(N))),G=ya(j.updateStatus.fetchState),U=j.currentDisplayedCardId,{useFeatureGate:x}=le(),{isFeatureEnabled:z}=x(Z.isChargeCardFeatureEnabled),H=!!_.companyChargeCardInfo?.info?.isChargeCardEnabled,v=!_.userRole.includes("charge_card_user")&&z&&H,P=d((N=>U!=null?lr(N.chargeCardState,U):null)),K=()=>{U!=null&&(T.current=!0,L.current!=null&&clearTimeout(L.current),L.current=setTimeout((()=>{T.current=!1,L.current=null}),5e3),n(ka(U,v,!0)),n(Me(!0)),p(!0))},W=aa(_);Vt({events:ha(W,Kr),onSubscribed:()=>{n(Me(!0))},onEvent:(N,V)=>{if(!_i.has(N))return;const Q=Yt(V),c=T.current;if(N===pa){const q=ie(Q?.card_id)??U;if(q!=null){const se=Zt(Q,q);if(se!=null)return n(Ft(se)),void(q!==U||c||K())}}if(N===it)return void n(Me(!0));const O=ie(Q?.card_id)??U;(U==null||O===U)&&U!=null?c||K():n(Me(!0))}}),r.useEffect((()=>{if(w&&U!=null&&P!=null&&P.status.code!=="request_on_hold"){const N=_e(_.tenantEmailDomain,U,k,P),V=ke(s.state?.pathnameStackToGoBack,s.pathname);n(xo()),P?.type.code==="business_virtual_credit_card"&&n(Qa()),t(N,{state:{pathnameStackToGoBack:V},replace:!0}),T.current=!1,L.current!=null&&(clearTimeout(L.current),L.current=null)}}),[w,P?.status.code]),r.useEffect((()=>{G==="In-Progress"&&j.updateStatus.fetchState==="Completed"&&setTimeout(K,3e3)}),[G,j.updateStatus.fetchState]);const I=N=>{B(N)};if(y!=="Completed"||M.cards.length===0)return o.jsxs(Dn,{children:[o.jsx(Ee,{isAppContentDrawerOpen:C,handleDrawerToggle:I}),o.jsx(gc,{})]});if(i==null)throw Error("Can't access my userId.");return o.jsxs(Dn,{children:[o.jsx(Ee,{isAppContentDrawerOpen:C,handleDrawerToggle:I}),o.jsx(vi,{chargeCardListView:M,cardUserOnboardingView:j,navigate:t,currentTenant:_,myUserId:i,location:s,chargeCardCashbackRatePerTransaction:D.charge_card_cashback_rate_per_transaction!=null?D.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{I(!0)}}),e!=null?o.jsx(Ti,{windowSize:a,children:e}):null]})},vi=Pe((function(e,{currentTenant:a,cardUserOnboardingView:n,chargeCardListView:t,myUserId:s}){const g=Ca(e,!1,!1,!1);let b=!1;return g.fetchState==="Completed"&&g.cards.length<=1&&(b=!0),{cards:t.cards,showMenuIcon:b,companyLegalName:a.companyName,twoFAView:n.twoFAView,cardUserOnboardingLocalData:n.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:n.isDOBPresent,onboardingProgressStatus:n.onboardingProgressStatus}}),(function(e,a){const{navigate:n,cardUserOnboardingView:t,location:s,currentTenant:g}=a,{tenantEmailDomain:b}=g;return{updateCardUserOnboardingLocalData:h=>{e(bn({localData:h}))},onGetOtp:h=>{if(t.cardUserOnboardingLocalData!=null){const A={...t.cardUserOnboardingLocalData,phone:h};e(bn({localData:A}))}e(at(h,"CardUserOnboarding"))},onResendOtp:h=>{e(et(h,"CardUserOnboarding"))},onVerifyOtp:(h,A)=>{e(Xa(h,A,"CardUserOnboarding"))},onVerifyOtpSuccess:h=>{e(Bo()),h!=null&&te.saveZeniOtpToken(h)},setCurrentDisplayedCardId:h=>{e(dr({cardId:h}))},onBackClick:()=>{const h=we(s.state?.pathnameStackToGoBack),A=h.poppedPathname??ta(b);n(A,{state:{pathnameStackToGoBack:h.newStack}})}}}))(bc),Ti=Ve.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
width: ${e=>`${Pi.containerWidth.value(e.windowSize)}%`};
|
|
@@ -44,12 +44,12 @@ import{j as o}from"./liveblocks-CVtnm86a.js";import{u as me,j as d,h as de,g as
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
align-items: center;
|
|
46
46
|
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,Fi={containerWidth:new Fa(100,58)},xi=({appContent:e})=>{const a=Ta(),n=me(),t=de(),{cardId:s}=Ne(),g=he(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),[m,F]=r.useState(!1),[w,p]=r.useState(!1),[T,L]=r.useState(!1),S=te.getSignedInUser();if(S==null)throw Error("Can't access onboarding card page without signing in...");const l=d((v=>fe(v)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=b(Qe.zeniCardsConfig),B=d((v=>Lo(v,s))),{isFeatureEnabled:k}=h(
|
|
47
|
+
`,Fi={containerWidth:new Fa(100,58)},xi=({appContent:e})=>{const a=Ta(),n=me(),t=de(),{cardId:s}=Ne(),g=he(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),[m,F]=r.useState(!1),[w,p]=r.useState(!1),[T,L]=r.useState(!1),S=te.getSignedInUser();if(S==null)throw Error("Can't access onboarding card page without signing in...");const l=d((v=>fe(v)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=b(Qe.zeniCardsConfig),B=d((v=>Lo(v,s))),{isFeatureEnabled:k}=h(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=h(Z.isDebitCardFeatureEnabled),D=Be(_,l),M=Re({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:D}),E=Fe(l),y=xe(l),R=l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Oe({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:k,isBookKeepingTenant:y,isDebitCardProductVisible:M,chargeCardsCreditAccountLimit:R}),f=B.chargeCard,j=d((v=>v.chargeCardConfigState.fetchState));r.useEffect((()=>{A===!1&&j!=="In-Progress"&&j!=="Completed"&&(n(Ja()),u(!0)),m===!1&&B.fetchState==="Not-Started"&&(F(!0),n(ka(s,!1,i)))}),[m,B.fetchState,A,j]);const G=f?.type.code==="business_physical_debit_card"||f?.type.code==="business_virtual_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(w===!1&&(G===!1||G&&f.status?.code!=="active"||G&&f.status.code==="active"&&f.isPinSet||f.cardHolderUserId!==S.userId)){const v=_e(l.tenantEmailDomain,s,S,f,!0),P=ke(g.state?.pathnameStackToGoBack,g.pathname);t(v,{state:{pathnameStackToGoBack:P}})}else if(w&&B.isRefreshingViewInBackground===!1&&f?.isPinSet===!0){n(Ro({chargeCardId:s}));const v=_e(l.tenantEmailDomain,s,S,f,!0),P=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(v,{state:{pathnameStackToGoBack:P}})}}}),[B.fetchState,f?.type.code,w,B.isRefreshingViewInBackground]);const U=te.getZeniOtpTokenForCardHolder(s),x=d((v=>Hn(v.userState,S.userId))),z=()=>{f?.isPinSet!==!0&&n(ba(s,!0))};r.useEffect((()=>{B.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),p(!0))}),[B.updateDebitCardPinAttemptFetchState.fetchState]);const H=v=>{L(v)};if(j!=="Completed"||f==null)return o.jsx(va,{fetchState:"In-Progress"});if(x?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(Ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:T,handleDrawerToggle:H}),o.jsx(Bi,{cardId:s,card:f,phone:x.phone,signedInUser:S,isSandboxEnv:Rt(),debitCardDetailState:B,signedInUserToken:U,navigate:t,currentTenant:l,location:g,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{H(!0)}}),e!=null?o.jsx(Li,{windowSize:a,children:e}):null]})},Bi=Pe((function(e,{debitCardDetailState:a,cardId:n}){const t=$n(e,n),s=a.updateStatus,g=Ca(e,!1,!1,!1);let b=!1;return g.fetchState==="Completed"&&g.cards.length<=1&&(b=!0),{showMenuIcon:b,vgsVaultId:rt.cardVaultId,twoFAView:t,setPinWaitStatus:s}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,debitCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdateDebitCardPinAttempt:u=>{e(Jn(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onSetPinSuccess:()=>{e(Oo({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("activate")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(Sc),Li=Ve.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
width: ${e=>`${Fi.containerWidth.value(e.windowSize)}%`};
|
|
51
51
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
52
|
-
box-shadow: ${e=>`${
|
|
52
|
+
box-shadow: ${e=>`${Ya.sp0} 2px ${Ya.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
53
53
|
`,Ri=Ve.div`
|
|
54
54
|
display: flex;
|
|
55
55
|
min-height: 100%;
|
|
@@ -58,8 +58,8 @@ import{j as o}from"./liveblocks-CVtnm86a.js";import{u as me,j as d,h as de,g as
|
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
align-items: center;
|
|
60
60
|
background-color: ${e=>e.theme.colors.grey4};
|
|
61
|
-
box-shadow: ${e=>`${
|
|
62
|
-
`,Oi={overlayWidth:new Fa(ht[12],ht[12],ht[9])},Ui=Pe((function(e,a){const n=Bt(e,!1,!1),t=a.lineId,s=n.customAddress[t],g=n.customAddressStatus[t]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:a.googleAPIKey,customAddress:s,customAddressStatus:g,lineId:t}}),(function(e,a){const{newCustomAddressId:n,lineId:t,chargeCardTypeOption:s}=a;return{onSubmitHandler:g=>{n!=null&&e(ur(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`));const b=Lc(g);e(Mo({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`,addressToCreate:b})),e(No(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},onDismissClick:()=>{a.onDismissClick(),n!=null&&e(jo({addressId:n,cardLineId:t,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}}))(yc),ji=({lineId:e,closeDrawerHandler:a,chargeCardTypeOption:n})=>{const t=Ot(),s=Ta(),g=()=>{a()},b=d((h=>Uo(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,h)))?.newAddressId;return o.jsx(Ar,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Oi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:t.colors.black,cursor:"pointer"}}},onClose:(h,A)=>(A==="backdropClick"||A==="escapeKeyDown")&&g(),children:o.jsx(Ui,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:g,lineId:e,chargeCardTypeOption:n,newCustomAddressId:b})})},Mi=Pe((function(e,a){const{isChargeCardFeatureEnabled:n,isDebitCardFeatureEnabled:t,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:g,isChargeCardSetupEnabled:b,isDebitCardSetupEnabled:h}=a,A=Bt(e,n&&b,t&&h);return{issueChargeCards:A,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:g,isDebitCardFeatureEnabled:t,isChargeCardFeatureEnabled:n,isChargeCardSetupEnabled:b,isDebitCardSetupEnabled:h,cardHolderCandidates:A.userList.map((u=>u.user)).filter(Boolean),allRoles:A.userList.map((u=>u.userRole)),allAccountingClasses:A.allAccountingClasses,userList:A.userList}}),(function(e,a){return{onIssueCardClick:()=>{e($o())},onSaveChangesToLocalStore:n=>{e(Ho(n))},onDismissClick:()=>{e(mr()),a.navigate("../")},resetCustomAddressByLineID:(n,t)=>{e(ur(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${n}_address`))},openAddAddressDrawerHandler:a.openAddAddressDrawerHandler}}))(Ec);function Ni(){const e=te.getSignedInUser(),a=de(),n=me(),t=Ic(),[s]=_n(),g=s.get("cardType"),{useFeatureGate:b}=le(),{isFeatureEnabled:h}=b(
|
|
61
|
+
box-shadow: ${e=>`${Ya.sp0} 2px ${Ya.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
62
|
+
`,Oi={overlayWidth:new Fa(ht[12],ht[12],ht[9])},Ui=Pe((function(e,a){const n=Bt(e,!1,!1),t=a.lineId,s=n.customAddress[t],g=n.customAddressStatus[t]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:a.googleAPIKey,customAddress:s,customAddressStatus:g,lineId:t}}),(function(e,a){const{newCustomAddressId:n,lineId:t,chargeCardTypeOption:s}=a;return{onSubmitHandler:g=>{n!=null&&e(ur(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`));const b=Lc(g);e(Mo({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`,addressToCreate:b})),e(No(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},onDismissClick:()=>{a.onDismissClick(),n!=null&&e(jo({addressId:n,cardLineId:t,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}}))(yc),ji=({lineId:e,closeDrawerHandler:a,chargeCardTypeOption:n})=>{const t=Ot(),s=Ta(),g=()=>{a()},b=d((h=>Uo(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,h)))?.newAddressId;return o.jsx(Ar,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Oi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:t.colors.black,cursor:"pointer"}}},onClose:(h,A)=>(A==="backdropClick"||A==="escapeKeyDown")&&g(),children:o.jsx(Ui,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:g,lineId:e,chargeCardTypeOption:n,newCustomAddressId:b})})},Mi=Pe((function(e,a){const{isChargeCardFeatureEnabled:n,isDebitCardFeatureEnabled:t,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:g,isChargeCardSetupEnabled:b,isDebitCardSetupEnabled:h}=a,A=Bt(e,n&&b,t&&h);return{issueChargeCards:A,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:g,isDebitCardFeatureEnabled:t,isChargeCardFeatureEnabled:n,isChargeCardSetupEnabled:b,isDebitCardSetupEnabled:h,cardHolderCandidates:A.userList.map((u=>u.user)).filter(Boolean),allRoles:A.userList.map((u=>u.userRole)),allAccountingClasses:A.allAccountingClasses,userList:A.userList}}),(function(e,a){return{onIssueCardClick:()=>{e($o())},onSaveChangesToLocalStore:n=>{e(Ho(n))},onDismissClick:()=>{e(mr()),a.navigate("../")},resetCustomAddressByLineID:(n,t)=>{e(ur(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${n}_address`))},openAddAddressDrawerHandler:a.openAddAddressDrawerHandler}}))(Ec);function Ni(){const e=te.getSignedInUser(),a=de(),n=me(),t=Ic(),[s]=_n(),g=s.get("cardType"),{useFeatureGate:b}=le(),{isFeatureEnabled:h}=b(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:A}=b(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:u}=b(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:m}=b(Z.isChargeCardFeatureEnabled),F=d((z=>fe(z))),w=Be(u,F),p=Re({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:w}),T=Fe(F),L=xe(F),S=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=Oe({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:m,isBookKeepingTenant:L,isDebitCardProductVisible:p,chargeCardsCreditAccountLimit:S}),[C,B]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect((()=>{C||(B(!0),n(Vo(p&&_,l&&k,!1)))}),[C,B,n]);const k=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!!F.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((z=>Bt(z,l&&k,p&&_))),M=D.fetchState,E=D.issueCardStatus.fetchState,y=D.lastSelfIssuedDebitCardId,R=d((z=>y!=null?lr(z.chargeCardState,y):void 0)),[i,f]=r.useState(null),[j,G]=r.useState(null),U=()=>{f(null)},x=(z,H)=>{f(z),G(H)};return r.useEffect((()=>{if(E==="Completed"){if(y!=null&&R?.type.code==="business_virtual_debit_card"){let z;z=R?.status.code==="request_on_hold"&&e.userId===R.cardHolderUserId?wr(F.tenantEmailDomain):_e(F.tenantEmailDomain,y,e,R),a(z)}else a("../");n(mr())}}),[E,y]),M==="Completed"?o.jsxs(o.Fragment,{children:[i!==null&&j!==null?o.jsx(ji,{closeDrawerHandler:U,lineId:i,chargeCardTypeOption:j}):null,o.jsx(Mi,{themeState:t,isIssuePhysicalCardEnabled:h,isIssuePhysicalDebitCardEnabled:A,isDebitCardFeatureEnabled:p,isChargeCardFeatureEnabled:l,isChargeCardSetupEnabled:k,isDebitCardSetupEnabled:_,navigate:a,fetchState:D.fetchState,openAddAddressDrawerHandler:x,defaultCardType:g==="creditCard"||g==="debitCard"?g:void 0})]}):M==="Error"?o.jsx(ot,{}):o.jsx(kc,{})}const zr=[pa,it],Vi=new Set(zr),Hi=Ve.div`
|
|
63
63
|
display: flex;
|
|
64
64
|
height: 100vh;
|
|
65
65
|
width: 100%;
|
|
@@ -68,4 +68,4 @@ import{j as o}from"./liveblocks-CVtnm86a.js";import{u as me,j as d,h as de,g as
|
|
|
68
68
|
overflow: auto;
|
|
69
69
|
align-items: center;
|
|
70
70
|
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,$i=Pe((function(e,a){const{myPendingActivationChargeCardListState:n}=a;return{myPendingActivationChargeCardListView:n,uiState:n.uiState,signedInUser:a.signedInUser}}),(function(e,a){const{navigate:n,currentTenant:t,location:s,signedInUser:g,myPendingActivationChargeCardListState:b}=a,{tenantEmailDomain:h}=t,{cards:A}=b;return{onChargeCardRowClick:u=>{const m=Pr(A,u),F=_e(h,u,g,m),w=ke(s.state?.pathnameStackToGoBack,s.pathname);n(F,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(u,m)=>{e(It({uiState:{sortKey:u,sortOrder:m}}))},onReloadCards:()=>{e(Me())},onBackClick:()=>{const u=t.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),n("../")}}}))(Ac);function Gi(){const e=de(),a=me(),n=he(),t=Ot(),[s,g]=r.useState(!1),b=d((x=>Go(x))),h=d((x=>fe(x))),A=d((x=>da(x,h.companyId))),u=la(A.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=m(Y.isDebitCardFeatureEnabled),p=Be(w,h),T=Re({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:p}),L=!!h.companyDebitCardInfo?.info?.isDebitCardEnabled,S=!!h.companyChargeCardInfo?.info?.isChargeCardEnabled,l=Le(),C=Fe(h),B=xe(h),k=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,_=Oe({isCardsOnlyTenant:C,isChargeCardFeatureEnabled:F,isBookKeepingTenant:B,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:k}),D=Te(l?.loggedInUserRoleMap),M=d((x=>ma(x))),{creditAccount:E,creditAccountRepayment:y}=d((x=>ua(x))),R=d((x=>cr(x))).cards.filter((x=>x.type.code.includes("debit"))).map((x=>x.connectedAccountId)),i=[...new Set(R)],f=d((x=>tt(x,i)));r.useEffect((()=>{s||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(g(!0),a(Me()),a(Ja()))}),[s,a,b.fetchState]),r.useEffect((()=>{if(b.fetchState==="Completed"&&b.cards.length===1&&j!=null){const x=_e(h.tenantEmailDomain,b.cards[0].id,j,b.cards[0]);e(x,{state:{message:n.state?.message}})}}),[b.fetchState,b.cards]);const j=te.getSignedInUser();r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&_&&S&&D&&a(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&D&&a(Tt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&T&&L&&D&&a(ir())}),[E.fetchState,y.fetchState,a,f.fetchState,T,L,D,_,S]);const G=aa(h);if(Vt({events:ha(G,zr),onEvent:(x,z)=>{if(!Vi.has(x))return;const H=Zt(z);if(x===pa){const v=ie(H?.card_id);if(v!=null){const P=Yt(H,v);if(P!=null)return void a(Ft(P))}}a(Me(!0))},onSubscribed:()=>{a(Me(!0))}}),j==null)throw Error("Can't access address page without signing in...");const U=b.cards!=null&&b.cards.length>0;if(b.fetchState==="Completed"||U){const x=Xe(_,T,L,S);return o.jsx(Hi,{children:o.jsx($i,{navigate:e,currentTenant:h,signedInUser:j,productInformation:x,myPendingActivationChargeCardListState:b,isChargeCardFeatureEnabled:_,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:S,chargeCardCashbackDetailState:M,creditAccount:E,creditAccountRepayment:y,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:n})})}return o.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:t.colors.grey5}})}const Ki=Pe((function(e,a){const{companyId:n,companyLegalName:t}=a;return{chargeCardSetupView:wa(e,n),admins:a.adminList,companyLegalName:t}}),(function(e,a){const{navigate:n,companyId:t,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:g,isChargeCardSetupEnabled:b,signedInUser:h,location:A,productInformation:u,isEarlyPayEnabled:m,controllerEmails:F,chargeCardsCreditAccountLimit:w}=a;return{onSetupButtonClick:p=>{if(h!=null&&ae.trackCardsPromoPageClicked("enable cards"),s)switch(ae.trackCardsEnableCardsClick(F,u,"Cards Promo"),p){case"credit":e(We(t,!0,"charge_cards",m,!1));break;case"debit":e(We(t,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?We(t,!0,"debit_cards",m,!0):We(t,!0,"charge_cards__debit_cards",m,!1))}else switch(ae.trackCardsSetupCardsClick(F,u,"Cards Promo"),p){case"credit":e(We(t,!1,"charge_cards",m,!1));break;case"debit":e(We(t,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?We(t,!1,"debit_cards",m,!0):We(t,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const p=we(A.state?.pathnameStackToGoBack);let T=p.poppedPathname;T==null&&(T=g||b?"..":"../.."),n(T,{state:{pathnameStackToGoBack:p.newStack}})},onLetsGoClick:()=>{n("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Qa()),n("../",{relative:"path"})):n("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Zo(t))}}}))(Pc),zi=()=>{const e=Dc(),a=de(),{tenantEmailDomain:n}=Ne(),[t]=_n(),s=t.get("cardPromoType"),g=me(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),{isFeatureEnabled:m}=h(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=h(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:w}=h(Y.isChargeCardFeatureEnabled),{configValue:p}=b(Qe.zeniCardsConfig),T=d((J=>fe(J))),L=d((J=>da(J,T.companyId))),S=la(L.controllers),l=p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,C=he(),B=te.getSignedInUserTenant(n)?.companyId??T.companyId,k=d((J=>wa(J,B))),_=k.primaryFundingAccount,D=T.companyBillPayInfo?.info,M=Fe(T),E=xe(T),y=Be(m,T),R=T.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Re({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:y}),f=Oe({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E,isDebitCardProductVisible:i,chargeCardsCreditAccountLimit:R}),j=_r({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E}),G=i&&f===!1,U=D?.businessVerificationStatus?.code==="verified"&&(G||_?.accType==="depositAccount"||Ko(_?.providerVerificationStatus?.code??"")),x=te.getSignedInUser(),z=!!T.companyZeniAccountInfo?.info?.isZeniAccountEnabled,H=!!T.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,v=!!T.company?.companyChargeCardInfo?.isChargeCardEnabled,P=!!T.company?.companyDebitCardInfo?.isDebitCardEnabled,K=!!T.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!!T.companyDebitCardInfo?.info?.isDebitCardEnabled,I=!!T.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,N=J=>{u(J)},V=d((J=>J.chargeCardSetupViewState.fetchState));if(x==null)throw Error("Can't access Charge Card promo page without signing in...");const Q=Le(),c=Te(Q?.loggedInUserRoleMap),O=xt(Q?.loggedInUserRoleMap),[q,se]=r.useState(!1),[X,He]=r.useState(!1),[Ae,ge]=r.useState(!1);r.useEffect((()=>{q===!1&&C.state?.message==="activation"&&se(!0)}),[C.state]),r.useEffect((()=>{X||V!=="Not-Started"||B==null||(He(!0),g(Pa(B,!0)))}),[X,V,B,g]);const re=T.companyChargeCardInfo?.info!=null&&Ia({cardInfo:T.companyChargeCardInfo.info,isProductVisible:j&&v,isTOSAccepted:H,isSetupEnabled:K,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),be=T.companyDebitCardInfo?.info!=null&&Ia({cardInfo:T.companyDebitCardInfo.info,isProductVisible:i&&P,isTOSAccepted:I,isSetupEnabled:W,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),ue=i&&be&&j&&R>=0&&re?"debit_and_credit":i&&be?"debit":"credit",oe=Bc(s,ue),Se=k?.chargeCardTermsDetails?.fetchStatus?.fetchState,ee=r.useRef(null);r.useEffect((()=>{Se==="In-Progress"?ee.current=oe:Se!=="Error"&&Se!=="Not-Started"||(ee.current=null)}),[Se,oe]);const De=Se!=="In-Progress"&&Se!=="Completed"||ee.current==null?oe:ee.current;r.useEffect((()=>{oe==="credit"&&(K||j===!1&&W)||oe==="debit"&&W||oe==="debit_and_credit"&&W&&K?a("../"):(oe==="debit_and_credit"&&H===!0&&I===!0||oe==="credit"&&(H===!0||j===!1&&I===!0)||oe==="debit"&&I===!0)&&c===!0&&a("../setup")}),[U,K,W,oe,H,I]),r.useEffect((()=>{Ae||(g(zo("cardAdmin")),ge(!0))}),[Ae]);const ve=d((J=>sr(J.userState,J.userRoleState,J.userListViewState,"cardAdmin"))),Ce=Xe(j,i,W,K);return(J=>{switch(J){case"credit":return v;case"debit":return P;case"debit_and_credit":return v&&P;default:return!1}})(De)?(re||be)&&V==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{if(ae.trackPageLoaded(Er.Event.cardsPromoPage),!!j&&!K||!!i&&!W||!!j&&!!i&&!W&&!K){const J=Zi({isDebitCardSetupEnabled:W,isChargeCardSetupEnabled:K,isCreditCardProductVisibleForExpressInterest:j,isDebitCardProductVisible:i});ae.trackCardsPromoView(S,Ce,"Page",J,"Promo Page")}}}),o.jsx(nt,{showConfetti:q}),o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:N}),o.jsx(Ki,{signedInUser:x,location:C,meetingUrl:e("charge_card_promo"),showEnableCardButton:U,isCompanyBusinessVerificationAndPaymentSetUpDone:U,isChargeCardSetupEnabled:K,isDebitCardSetupEnabled:W,companyLegalName:T.companyName,adminList:ve.users,isCheckingEnabled:z,navigate:a,companyId:B,cardPromoType:De,controllerEmails:S,productInformation:Ce,isCreditCardProductVisible:f,isDebitCardFeatureEnabled:m,isEarlyPayEnabled:F,cashbackRate:l,chargeCardsCreditAccountLimit:R,onClickMenuIcon:()=>{N(!0)}})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:N}),o.jsx(_c,{})]}):o.jsx(Je,{to:"../",replace:!0})},Zi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:a,isCreditCardProductVisibleForExpressInterest:n,isDebitCardProductVisible:t})=>n&&t&&!e&&!a?"Credit & Debit Card":n&&!a?"Credit Card":t&&!e?"Debit Card":"";function Id(){const e=he(),a=d((Q=>fe(Q))),{useFeatureGate:n}=le(),{isFeatureEnabled:t}=n(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=n(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:g}=n(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:b}=n(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:h}=n(Y.isCardPolicyEnabled),A=Be(s,a),u=Re({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:A}),m=wc(a,t,s),F=!!a.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!a.company?.companyDebitCardInfo.isDebitCardTOSAccepted,p=!!a.company?.companyChargeCardInfo?.isChargeCardEnabled,T=!!a.company?.companyDebitCardInfo?.isDebitCardEnabled,L=!!a.companyChargeCardInfo?.info?.isChargeCardEnabled,S=!!a.companyDebitCardInfo?.info?.isDebitCardEnabled,l=Le(),C=Te(l?.loggedInUserRoleMap),{isCardsShuttingDown:B}=kr(a.tenantId,a.company?.managementInfo?.receiverEmails),k=xt(l?.loggedInUserRoleMap),{isFeatureEnabled:_}=n(Y.isCashbackFeatureEnabled),D=a.userRole.includes("charge_card_user"),M=!D,E=!D&&L,y=a?.userRole!=null&&Yo(a?.userRole),R=(a?.company==null||a.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&Wo(l?.loggedInUserRoleMap),i=qo(l?.loggedInUserRoleMap),f=(a?.company==null||a.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&Jo(l?.loggedInUserRoleMap),{isFeatureEnabled:j}=n(Y.isDepositAccountsFeatureEnabled),G=j&&!y&&Kn(l?.loggedInUserRoleMap),U=L&&p&&!y,x=S&&T&&!y,z=m&&!y&&Te(l?.loggedInUserRoleMap),H=Qo(l?.loggedInUserRoleMap),v=Fe(a),P=xe(a),K=a.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,W=Oe({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:t,isBookKeepingTenant:P,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:K}),I=a.companyChargeCardInfo?.info!=null&&Ia({cardInfo:a.companyChargeCardInfo.info,isProductVisible:W&&p,isTOSAccepted:F,isSetupEnabled:L,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),N=a.companyDebitCardInfo?.info!=null&&Ia({cardInfo:a.companyDebitCardInfo.info,isProductVisible:u&&T,isTOSAccepted:w,isSetupEnabled:S,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),V=I||N;return o.jsxs(cs,{children:[C?o.jsx(ne,{path:"setup",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:H,isUserHasOnlyBillPayAccess:i,productType:"charge_cards",type:"setup"})}):null,C?o.jsx(ne,{path:"verification",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isUserHasOnlyBillPayAccess:i,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:H,productType:"charge_cards",type:"verification"})}):null,C&&h?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"policy",element:o.jsx(Zc,{})}),o.jsx(ne,{path:"policy/new",element:o.jsx(jc,{})}),o.jsx(ne,{path:"policy/:templateId/edit",element:o.jsx(Hc,{})})]}):null,o.jsx(ne,{path:"promo",element:o.jsx(zi,{})}),U||x?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"/",element:o.jsx(kn,{isPaymentDrawerOpen:!1})}),z&&g?o.jsx(ne,{path:"payment",element:o.jsx(kn,{isPaymentDrawerOpen:!0})}):null,o.jsx(ne,{path:"activate",element:o.jsx(Gi,{})}),o.jsx(ne,{path:"onboard",element:o.jsx(wi,{})}),C&&B!==!0?o.jsx(ne,{path:"new",element:o.jsx(Ni,{})}):C?o.jsx(ne,{path:"new",element:o.jsx(Je,{to:"..",replace:!0})}):null,_&&M?o.jsx(ne,{path:"cashback",element:o.jsx(Qc,{})}):null,E?o.jsx(ne,{path:"statements",element:o.jsx(Di,{})}):null,z&&b&&L?o.jsx(ne,{path:"payment-history",element:o.jsx(Ai,{})}):null,o.jsx(ne,{path:":cardId/activate",element:o.jsx(ai,{})}),o.jsx(ne,{path:":cardId/setPin",element:o.jsx(xi,{})}),o.jsx(ne,{path:":cardId/addToWallet",element:o.jsx(Yc,{})}),o.jsx(ne,{path:":cardId/*",element:o.jsx(ui,{})}),o.jsx(ne,{path:"*",element:o.jsx(ot,{})})]}):(F||w)&&C?o.jsx(ne,{path:"*",element:o.jsx(Je,{to:"../setup"})}):V?o.jsx(ne,{path:"*",element:o.jsx(Je,{to:"../promo",state:e.state})}):o.jsx(ne,{path:"*",element:null})]})}export{Id as default};
|
|
71
|
+
`,$i=Pe((function(e,a){const{myPendingActivationChargeCardListState:n}=a;return{myPendingActivationChargeCardListView:n,uiState:n.uiState,signedInUser:a.signedInUser}}),(function(e,a){const{navigate:n,currentTenant:t,location:s,signedInUser:g,myPendingActivationChargeCardListState:b}=a,{tenantEmailDomain:h}=t,{cards:A}=b;return{onChargeCardRowClick:u=>{const m=Pr(A,u),F=_e(h,u,g,m),w=ke(s.state?.pathnameStackToGoBack,s.pathname);n(F,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(u,m)=>{e(It({uiState:{sortKey:u,sortOrder:m}}))},onReloadCards:()=>{e(Me())},onBackClick:()=>{const u=t.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),n("../")}}}))(Ac);function Gi(){const e=de(),a=me(),n=he(),t=Ot(),[s,g]=r.useState(!1),b=d((x=>Go(x))),h=d((x=>fe(x))),A=d((x=>da(x,h.companyId))),u=la(A.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=m(Z.isDebitCardFeatureEnabled),p=Be(w,h),T=Re({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:p}),L=!!h.companyDebitCardInfo?.info?.isDebitCardEnabled,S=!!h.companyChargeCardInfo?.info?.isChargeCardEnabled,l=Le(),C=Fe(h),B=xe(h),k=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,_=Oe({isCardsOnlyTenant:C,isChargeCardFeatureEnabled:F,isBookKeepingTenant:B,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:k}),D=Te(l?.loggedInUserRoleMap),M=d((x=>ma(x))),{creditAccount:E,creditAccountRepayment:y}=d((x=>ua(x))),R=d((x=>cr(x))).cards.filter((x=>x.type.code.includes("debit"))).map((x=>x.connectedAccountId)),i=[...new Set(R)],f=d((x=>tt(x,i)));r.useEffect((()=>{s||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(g(!0),a(Me()),a(Ja()))}),[s,a,b.fetchState]),r.useEffect((()=>{if(b.fetchState==="Completed"&&b.cards.length===1&&j!=null){const x=_e(h.tenantEmailDomain,b.cards[0].id,j,b.cards[0]);e(x,{state:{message:n.state?.message}})}}),[b.fetchState,b.cards]);const j=te.getSignedInUser();r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&_&&S&&D&&a(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&D&&a(Tt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&T&&L&&D&&a(ir())}),[E.fetchState,y.fetchState,a,f.fetchState,T,L,D,_,S]);const G=aa(h);if(Vt({events:ha(G,zr),onEvent:(x,z)=>{if(!Vi.has(x))return;const H=Yt(z);if(x===pa){const v=ie(H?.card_id);if(v!=null){const P=Zt(H,v);if(P!=null)return void a(Ft(P))}}a(Me(!0))},onSubscribed:()=>{a(Me(!0))}}),j==null)throw Error("Can't access address page without signing in...");const U=b.cards!=null&&b.cards.length>0;if(b.fetchState==="Completed"||U){const x=Xe(_,T,L,S);return o.jsx(Hi,{children:o.jsx($i,{navigate:e,currentTenant:h,signedInUser:j,productInformation:x,myPendingActivationChargeCardListState:b,isChargeCardFeatureEnabled:_,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:S,chargeCardCashbackDetailState:M,creditAccount:E,creditAccountRepayment:y,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:n})})}return o.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:t.colors.grey5}})}const Ki=Pe((function(e,a){const{companyId:n,companyLegalName:t}=a;return{chargeCardSetupView:wa(e,n),admins:a.adminList,companyLegalName:t}}),(function(e,a){const{navigate:n,companyId:t,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:g,isChargeCardSetupEnabled:b,signedInUser:h,location:A,productInformation:u,isEarlyPayEnabled:m,controllerEmails:F,chargeCardsCreditAccountLimit:w}=a;return{onSetupButtonClick:p=>{if(h!=null&&ae.trackCardsPromoPageClicked("enable cards"),s)switch(ae.trackCardsEnableCardsClick(F,u,"Cards Promo"),p){case"credit":e(We(t,!0,"charge_cards",m,!1));break;case"debit":e(We(t,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?We(t,!0,"debit_cards",m,!0):We(t,!0,"charge_cards__debit_cards",m,!1))}else switch(ae.trackCardsSetupCardsClick(F,u,"Cards Promo"),p){case"credit":e(We(t,!1,"charge_cards",m,!1));break;case"debit":e(We(t,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?We(t,!1,"debit_cards",m,!0):We(t,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const p=we(A.state?.pathnameStackToGoBack);let T=p.poppedPathname;T==null&&(T=g||b?"..":"../.."),n(T,{state:{pathnameStackToGoBack:p.newStack}})},onLetsGoClick:()=>{n("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Qa()),n("../",{relative:"path"})):n("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Yo(t))}}}))(Pc),zi=()=>{const e=Dc(),a=de(),{tenantEmailDomain:n}=Ne(),[t]=_n(),s=t.get("cardPromoType"),g=me(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),{isFeatureEnabled:m}=h(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=h(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:w}=h(Z.isChargeCardFeatureEnabled),{configValue:p}=b(Qe.zeniCardsConfig),T=d((J=>fe(J))),L=d((J=>da(J,T.companyId))),S=la(L.controllers),l=p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,C=he(),B=te.getSignedInUserTenant(n)?.companyId??T.companyId,k=d((J=>wa(J,B))),_=k.primaryFundingAccount,D=T.companyBillPayInfo?.info,M=Fe(T),E=xe(T),y=Be(m,T),R=T.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Re({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:y}),f=Oe({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E,isDebitCardProductVisible:i,chargeCardsCreditAccountLimit:R}),j=_r({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E}),G=i&&f===!1,U=D?.businessVerificationStatus?.code==="verified"&&(G||_?.accType==="depositAccount"||Ko(_?.providerVerificationStatus?.code??"")),x=te.getSignedInUser(),z=!!T.companyZeniAccountInfo?.info?.isZeniAccountEnabled,H=!!T.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,v=!!T.company?.companyChargeCardInfo?.isChargeCardEnabled,P=!!T.company?.companyDebitCardInfo?.isDebitCardEnabled,K=!!T.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!!T.companyDebitCardInfo?.info?.isDebitCardEnabled,I=!!T.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,N=J=>{u(J)},V=d((J=>J.chargeCardSetupViewState.fetchState));if(x==null)throw Error("Can't access Charge Card promo page without signing in...");const Q=Le(),c=Te(Q?.loggedInUserRoleMap),O=xt(Q?.loggedInUserRoleMap),[q,se]=r.useState(!1),[X,He]=r.useState(!1),[Ae,ge]=r.useState(!1);r.useEffect((()=>{q===!1&&C.state?.message==="activation"&&se(!0)}),[C.state]),r.useEffect((()=>{X||V!=="Not-Started"||B==null||(He(!0),g(Pa(B,!0)))}),[X,V,B,g]);const re=T.companyChargeCardInfo?.info!=null&&Ia({cardInfo:T.companyChargeCardInfo.info,isProductVisible:j&&v,isTOSAccepted:H,isSetupEnabled:K,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),be=T.companyDebitCardInfo?.info!=null&&Ia({cardInfo:T.companyDebitCardInfo.info,isProductVisible:i&&P,isTOSAccepted:I,isSetupEnabled:W,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),ue=i&&be&&j&&R>=0&&re?"debit_and_credit":i&&be?"debit":"credit",oe=Bc(s,ue),Se=k?.chargeCardTermsDetails?.fetchStatus?.fetchState,ee=r.useRef(null);r.useEffect((()=>{Se==="In-Progress"?ee.current=oe:Se!=="Error"&&Se!=="Not-Started"||(ee.current=null)}),[Se,oe]);const De=Se!=="In-Progress"&&Se!=="Completed"||ee.current==null?oe:ee.current;r.useEffect((()=>{oe==="credit"&&(K||j===!1&&W)||oe==="debit"&&W||oe==="debit_and_credit"&&W&&K?a("../"):(oe==="debit_and_credit"&&H===!0&&I===!0||oe==="credit"&&(H===!0||j===!1&&I===!0)||oe==="debit"&&I===!0)&&c===!0&&a("../setup")}),[U,K,W,oe,H,I]),r.useEffect((()=>{Ae||(g(zo("cardAdmin")),ge(!0))}),[Ae]);const ve=d((J=>sr(J.userState,J.userRoleState,J.userListViewState,"cardAdmin"))),Ce=Xe(j,i,W,K);return(J=>{switch(J){case"credit":return v;case"debit":return P;case"debit_and_credit":return v&&P;default:return!1}})(De)?(re||be)&&V==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{if(ae.trackPageLoaded(Er.Event.cardsPromoPage),!!j&&!K||!!i&&!W||!!j&&!!i&&!W&&!K){const J=Yi({isDebitCardSetupEnabled:W,isChargeCardSetupEnabled:K,isCreditCardProductVisibleForExpressInterest:j,isDebitCardProductVisible:i});ae.trackCardsPromoView(S,Ce,"Page",J,"Promo Page")}}}),o.jsx(nt,{showConfetti:q}),o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:N}),o.jsx(Ki,{signedInUser:x,location:C,meetingUrl:e("charge_card_promo"),showEnableCardButton:U,isCompanyBusinessVerificationAndPaymentSetUpDone:U,isChargeCardSetupEnabled:K,isDebitCardSetupEnabled:W,companyLegalName:T.companyName,adminList:ve.users,isCheckingEnabled:z,navigate:a,companyId:B,cardPromoType:De,controllerEmails:S,productInformation:Ce,isCreditCardProductVisible:f,isDebitCardFeatureEnabled:m,isEarlyPayEnabled:F,cashbackRate:l,chargeCardsCreditAccountLimit:R,onClickMenuIcon:()=>{N(!0)}})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:N}),o.jsx(_c,{})]}):o.jsx(Je,{to:"../",replace:!0})},Yi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:a,isCreditCardProductVisibleForExpressInterest:n,isDebitCardProductVisible:t})=>n&&t&&!e&&!a?"Credit & Debit Card":n&&!a?"Credit Card":t&&!e?"Debit Card":"";function Id(){const e=he(),a=d((Q=>fe(Q))),{useFeatureGate:n}=le(),{isFeatureEnabled:t}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=n(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:g}=n(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:b}=n(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:h}=n(Z.isCardPolicyEnabled),A=Be(s,a),u=Re({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:A}),m=wc(a,t,s),F=!!a.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!a.company?.companyDebitCardInfo.isDebitCardTOSAccepted,p=!!a.company?.companyChargeCardInfo?.isChargeCardEnabled,T=!!a.company?.companyDebitCardInfo?.isDebitCardEnabled,L=!!a.companyChargeCardInfo?.info?.isChargeCardEnabled,S=!!a.companyDebitCardInfo?.info?.isDebitCardEnabled,l=Le(),C=Te(l?.loggedInUserRoleMap),{isCardsShuttingDown:B}=kr(a.tenantId,a.company?.managementInfo?.receiverEmails),k=xt(l?.loggedInUserRoleMap),{isFeatureEnabled:_}=n(Z.isCashbackFeatureEnabled),D=a.userRole.includes("charge_card_user"),M=!D,E=!D&&L,y=a?.userRole!=null&&Zo(a?.userRole),R=(a?.company==null||a.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&Wo(l?.loggedInUserRoleMap),i=qo(l?.loggedInUserRoleMap),f=(a?.company==null||a.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&Jo(l?.loggedInUserRoleMap),{isFeatureEnabled:j}=n(Z.isDepositAccountsFeatureEnabled),G=j&&!y&&Kn(l?.loggedInUserRoleMap),U=L&&p&&!y,x=S&&T&&!y,z=m&&!y&&Te(l?.loggedInUserRoleMap),H=Qo(l?.loggedInUserRoleMap),v=Fe(a),P=xe(a),K=a.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,W=Oe({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:t,isBookKeepingTenant:P,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:K}),I=a.companyChargeCardInfo?.info!=null&&Ia({cardInfo:a.companyChargeCardInfo.info,isProductVisible:W&&p,isTOSAccepted:F,isSetupEnabled:L,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),N=a.companyDebitCardInfo?.info!=null&&Ia({cardInfo:a.companyDebitCardInfo.info,isProductVisible:u&&T,isTOSAccepted:w,isSetupEnabled:S,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),V=I||N;return o.jsxs(cs,{children:[C?o.jsx(ne,{path:"setup",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:H,isUserHasOnlyBillPayAccess:i,productType:"charge_cards",type:"setup"})}):null,C?o.jsx(ne,{path:"verification",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isUserHasOnlyBillPayAccess:i,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:H,productType:"charge_cards",type:"verification"})}):null,C&&h?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"policy",element:o.jsx(Yc,{})}),o.jsx(ne,{path:"policy/new",element:o.jsx(jc,{})}),o.jsx(ne,{path:"policy/:templateId/edit",element:o.jsx(Hc,{})})]}):null,o.jsx(ne,{path:"promo",element:o.jsx(zi,{})}),U||x?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"/",element:o.jsx(kn,{isPaymentDrawerOpen:!1})}),z&&g?o.jsx(ne,{path:"payment",element:o.jsx(kn,{isPaymentDrawerOpen:!0})}):null,o.jsx(ne,{path:"activate",element:o.jsx(Gi,{})}),o.jsx(ne,{path:"onboard",element:o.jsx(wi,{})}),C&&B!==!0?o.jsx(ne,{path:"new",element:o.jsx(Ni,{})}):C?o.jsx(ne,{path:"new",element:o.jsx(Je,{to:"..",replace:!0})}):null,_&&M?o.jsx(ne,{path:"cashback",element:o.jsx(Qc,{})}):null,E?o.jsx(ne,{path:"statements",element:o.jsx(Di,{})}):null,z&&b&&L?o.jsx(ne,{path:"payment-history",element:o.jsx(Ai,{})}):null,o.jsx(ne,{path:":cardId/activate",element:o.jsx(ai,{})}),o.jsx(ne,{path:":cardId/setPin",element:o.jsx(xi,{})}),o.jsx(ne,{path:":cardId/addToWallet",element:o.jsx(Zc,{})}),o.jsx(ne,{path:":cardId/*",element:o.jsx(ui,{})}),o.jsx(ne,{path:"*",element:o.jsx(ot,{})})]}):(F||w)&&C?o.jsx(ne,{path:"*",element:o.jsx(Je,{to:"../setup"})}):V?o.jsx(ne,{path:"*",element:o.jsx(Je,{to:"../promo",state:e.state})}):o.jsx(ne,{path:"*",element:null})]})}export{Id as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-SKYC1C2A.js";import{a as g}from"./sentry-DZfHa7Ie.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-BxGWoVcT.js";import{z as C,bt as F,a9 as P,l as V,V as j,r as b,bu as L,af as A,aH as U,p as B}from"./index-DKWZmEZ6.js";import{fF as N,gI as M,BE as _,gD as z,c8 as R,Ye as Y,bn as G,uX as H,uL as X,mz as Z,o8 as S,Yf as $,bE as q,cE as D,oj as J,ot as K}from"./zeni-epic-state-C7XRcjyb.js";import"./mui-KBl5-FbY.js";import{d as Q}from"./routePaths-Z5dkQJU8.js";import{M as W}from"./MobileAppDrawer-BQafCiIm.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="db2a3d09-bddb-4c02-aefa-9312993ff6ad",t._sentryDebugIdIdentifier="sentry-dbid-db2a3d09-bddb-4c02-aefa-9312993ff6ad")}catch{}})();const ee=E((function(t){const n=z(t),i=C.getSignedInUser(),p=N(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(p?.userRole??[])&&n.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(t.companyConfigState),a=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:n.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:n,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:G(i)}}),(function(t,n){const{companyId:i,currentTenant:p,navigate:c,location:l}=n,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const a=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?D(u):void 0,meetingLink:y!=""&&y!=null?D(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t($(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(Z({files:e}))},onDeleteFile:e=>{t(X(e))},onEditFileName:(e,a)=>{t(H(e,a.split(".")[0]))}}}))(L);function de(){const t=w(),n=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),a=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>N(s))),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||a!=="Not-Started"||d==null||(l(!0),n(M(d)))}),[c,a,d,n]),g.useEffect((()=>{o==="Not-Started"&&n(_())}),[o,n]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|