@zeniai/web-app-ui 5.1.63-qa → 5.1.64-qa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddressRoutes-CfeuS_Ag.js +1 -0
- package/dist/assets/{AddressScreen-DZz6iLRi.js → AddressScreen-ay95AjyT.js} +2 -2
- package/dist/assets/AiCfoScreen-CNSskoeK.js +22 -0
- package/dist/assets/BillPayApprovalRoutes-DkRTzCH3.js +1 -0
- package/dist/assets/BillPayRoutes-AaRkKbnn.js +119 -0
- package/dist/assets/BusinessVerificationPageScreen-BK-kRDjQ.js +9 -0
- package/dist/assets/ChargeCardRoutes-CNTdAWSK.js +71 -0
- package/dist/assets/CompanyPassportScreen-CAEa8inv.js +1 -0
- package/dist/assets/ConnectionAuthScreen-Ctz5ySya.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-CdyKCXfZ.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-2jxeCtoH.js +23 -0
- package/dist/assets/DashboardRoutes-DKnI8ITO.js +20 -0
- package/dist/assets/DefaultTenantHome-DrzRK_A3.js +1 -0
- package/dist/assets/DomesticWireDetailScreen-BpjCiEQT.js +18 -0
- package/dist/assets/DrawerScreen-TcF0aKWR.js +1 -0
- package/dist/assets/EntityDetailRoutes-Ck3_JPiA.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-Bk7qpJQq.js +25 -0
- package/dist/assets/FeaturePreviewScreen-FqmwbgK1.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-DlLZNfdx.js +1 -0
- package/dist/assets/MagicLinkRoutes-Bjfp8zDK.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-sO4caWMt.js +12 -0
- package/dist/assets/MobileAppDrawer-KB2L4yYh.js +1 -0
- package/dist/assets/NotFoundScreen-DTlzuW8g.js +1 -0
- package/dist/assets/NotificationRoutes-CUoWsLW6.js +1 -0
- package/dist/assets/OAuthConsentScreen-LyQVO638.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-DuUVhGFv.js +1 -0
- package/dist/assets/PeopleRoutes-Cve6HQco.js +22 -0
- package/dist/assets/PerformanceRoutes-Dc2aDfOC.js +1 -0
- package/dist/assets/{Preview-C7zW6Q7F.js → Preview-BGhmLxMi.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-_B3wLRiT.js → QBOConnectionScreen-BjBRgjPW.js} +1 -1
- package/dist/assets/ReferralListScreen-DY3Jq79H.js +5 -0
- package/dist/assets/ReimbursementApprovalRoutes-Dd6B4kce.js +1 -0
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-BLwUi-7g.js +1 -0
- package/dist/assets/ReimbursementRoutes-BtesSDuB.js +68 -0
- package/dist/assets/ReportsRoutes-Ypov_XRg.js +1 -0
- package/dist/assets/RewardsRoutes-BE91uGyY.js +1 -0
- package/dist/assets/ScreenRoutes-Bt5RxjsW.js +2 -0
- package/dist/assets/SettingsRoutes-d9SQJouF.js +57 -0
- package/dist/assets/SetupPagesScreen-UbKhsOme.js +29 -0
- package/dist/assets/SignInScreen-CCSmRNKI.js +1 -0
- package/dist/assets/SignOutScreen-04tDb2m_.js +9 -0
- package/dist/assets/TaskListScreen-yP29eLKe.js +9 -0
- package/dist/assets/TaskRoutes-UAlOA4bQ.js +9 -0
- package/dist/assets/TransactionDetailRoutes-DIIsxXoI.js +1 -0
- package/dist/assets/TransactionDetailScreen-DbVp_oOR.js +5 -0
- package/dist/assets/TransactionListRoutes-BFm1xRNi.js +1 -0
- package/dist/assets/TreasuryRoutes-BQeFHsY5.js +37 -0
- package/dist/assets/{VendorsRoutes-MlvyyMTe.js → VendorsRoutes-BCP9sJSY.js} +27 -27
- package/dist/assets/WiseConfirmationScreen-ufjg25Ux.js +12 -0
- package/dist/assets/ZeniAccountRoutes-OW53QlAG.js +57 -0
- package/dist/assets/ZeniAccountStatementScreen-DStzdW01.js +9 -0
- package/dist/assets/{accountMappingHelper-BPzhOzDQ.js → accountMappingHelper-BY9t_bFx.js} +1 -1
- package/dist/assets/{analytics-Bqx0zRxd.js → analytics-DW163hO6.js} +1 -1
- package/dist/assets/{analyticsHelper-bAQTI-GF.js → analyticsHelper-C1JBjAI6.js} +1 -1
- package/dist/assets/{core-Bv1T7LZC.js → core-BYU75o8V.js} +2 -2
- package/dist/assets/{decodeURIComponentSafe-CgJ-EbJc.js → decodeURIComponentSafe-3IGQd7Vl.js} +1 -1
- package/dist/assets/dnd-BzfEm7I9.js +6 -0
- package/dist/assets/{empty-BGU_c4p_.js → empty-CVodrPUR.js} +1 -1
- package/dist/assets/empty-YJQb3-X2.js +1 -0
- package/dist/assets/{emptyVideoElement-D0DWhAqS.js → emptyVideoElement-CCQQOb7A.js} +1 -1
- package/dist/assets/epic-Nyy58_dJ.js +2 -0
- package/dist/assets/getLocaleForTenant-BKUl3rU_.js +1 -0
- package/dist/assets/{index-B-VkC3pW.js → index-9RSiem2N.js} +1 -1
- package/dist/assets/{index-BfDh5m3J.js → index-BpRPgE_1.js} +1 -1
- package/dist/assets/{index-C7MHnpYf.js → index-CT-SvzqM.js} +1 -1
- package/dist/assets/{index-CVpYlrKc.js → index-CTd0IcDC.js} +38720 -44339
- package/dist/assets/{index-BcMhlMw0.js → index-DTeE9HW6.js} +1 -1
- package/dist/assets/index-Dx7rMgzH.js +1 -0
- package/dist/assets/{index-BUmr5maU.css → index-R6GjjTB3.css} +1 -1
- package/dist/assets/{index-Bf0yAk1h.js → index-X9jJEgSP.js} +2 -2
- package/dist/assets/{empty-DZLujeFc.js → index-etDo2Eg5.js} +1 -1
- package/dist/assets/{lexical-DtmspfR6.js → lexical-a4Oisgnk.js} +1 -1
- package/dist/assets/{liveblocks-DC3GaKoW.js → liveblocks-DpbFof4_.js} +1 -1
- package/dist/assets/{lottie-BAdftm7g.js → lottie-DkmqGRq5.js} +1 -1
- package/dist/assets/{mui-VYhJrGDQ.js → mui-CaUmS2In.js} +1 -1
- package/dist/assets/{pathToGoBack-BPhnwklb.js → pathToGoBack-TOnIZxyK.js} +1 -1
- package/dist/assets/{pdf-DyfSqkK5.js → pdf-Bp96SSrk.js} +4 -4
- package/dist/assets/{pdf-lib-CPh8no6v.js → pdf-lib-C5R5lVxX.js} +1 -1
- package/dist/assets/{plaid-BlhDSPsk.js → plaid-EPzkqVUX.js} +1 -1
- package/dist/assets/{pusher-DGAKVhUw.js → pusher-DFce9zoz.js} +1 -1
- package/dist/assets/{react-mFsTSWE1.js → react-BaW6LEQr.js} +1 -1
- package/dist/assets/{react-EkeFt_9c.js → react-BrbrBbbh.js} +1 -1
- package/dist/assets/{react-D_wg-5Ag.js → react-CbOWaQLc.js} +1 -1
- package/dist/assets/{react-B1_zGwIA.js → react-Cg2u8AqZ.js} +1 -1
- package/dist/assets/{react-BJZHoUnV.js → react-DaYEBWeP.js} +1 -1
- package/dist/assets/{react-D4kHPPtw.js → react-bKgyDTt8.js} +1 -1
- package/dist/assets/{recharts-D979ncoh.js → recharts-eaz7OFOH.js} +3 -3
- package/dist/assets/{routePaths-DdjVf9j1.js → routePaths-DtPkVCZ8.js} +1 -1
- package/dist/assets/{sentry-CuaXjR5n.js → sentry-B2BY3pFv.js} +1 -1
- package/dist/assets/{url-DXrWvdUh.js → url-BeLBCtjP.js} +1 -1
- package/dist/assets/{url-73U0aVt0.js → url-Bzmb-SBW.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BYrJCl-g.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-Cu0cLXsh.js +1 -0
- package/dist/assets/{useDeviceId-BVyTAih4.js → useDeviceId-CWQ4jMCH.js} +1 -1
- package/dist/assets/useInitialThreadRequest-jFDMxuZj.js +1 -0
- package/dist/assets/{utils-DPYDOv00.js → utils-w1fZp2Am.js} +2 -2
- package/dist/assets/withTransactionSidePanel-CDwmH7-e.js +21 -0
- package/dist/assets/zeni-epic-state-De2ZE3v5.js +13 -0
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-DgZlzwKj.js +0 -1
- package/dist/assets/AiCfoScreen-BJy_pYhd.js +0 -22
- package/dist/assets/BillPayApprovalRoutes-DJjLicyn.js +0 -1
- package/dist/assets/BillPayRoutes-DAczZIUA.js +0 -119
- package/dist/assets/BusinessVerificationPageScreen-CbhS3pML.js +0 -9
- package/dist/assets/CardsAiCfoScreen-D3HVbkzL.js +0 -14
- package/dist/assets/ChargeCardRoutes-lmFHLgNx.js +0 -71
- package/dist/assets/CompanyPassportScreen-BUt2L6sz.js +0 -1
- package/dist/assets/ConnectionAuthScreen-BT3IRUL8.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-BAn5X2Wb.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-Dzhhfcds.js +0 -30
- package/dist/assets/DashboardRoutes-CDKfXwLt.js +0 -20
- package/dist/assets/DefaultTenantHome-CXh59aBD.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-iXO5zWUm.js +0 -18
- package/dist/assets/DrawerScreen-B_vR9_qC.js +0 -1
- package/dist/assets/EntityDetailRoutes-BcZQKkh1.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-CWOOkRUe.js +0 -25
- package/dist/assets/FeaturePreviewScreen-BQvRhW1f.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-DeESKpku.js +0 -1
- package/dist/assets/MagicLinkRoutes-6x7Us6_Q.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-BsUi7-40.js +0 -12
- package/dist/assets/MobileAppDrawer-CHF9nCsW.js +0 -1
- package/dist/assets/NotFoundScreen-D0AQGcoe.js +0 -1
- package/dist/assets/NotificationRoutes-BPu1VkFm.js +0 -1
- package/dist/assets/OAuthConsentScreen-DkCTDJwq.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-BEFahy-o.js +0 -1
- package/dist/assets/PeopleRoutes-sN-axVAc.js +0 -22
- package/dist/assets/PerformanceRoutes-DXXEZbBB.js +0 -1
- package/dist/assets/ReferralListScreen-CzPMgGBj.js +0 -5
- package/dist/assets/ReimbursementApprovalRoutes-DCrHBh1u.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-SmUpbSJe.js +0 -1
- package/dist/assets/ReimbursementRoutes-xFL2a98D.js +0 -68
- package/dist/assets/ReportsRoutes-BCmFjTfI.js +0 -1
- package/dist/assets/RewardsRoutes-OtuIPjdr.js +0 -1
- package/dist/assets/ScreenRoutes-CEUjM6GK.js +0 -2
- package/dist/assets/SettingsRoutes-BtEyetWY.js +0 -57
- package/dist/assets/SetupPagesScreen-CCip2k58.js +0 -29
- package/dist/assets/SignInScreen-jXShH9LP.js +0 -1
- package/dist/assets/SignOutScreen-CnWA4YZp.js +0 -9
- package/dist/assets/TaskListScreen-qq0yWrR-.js +0 -9
- package/dist/assets/TaskRoutes-B3fEaAUN.js +0 -9
- package/dist/assets/TransactionDetailRoutes-DWDGqu2s.js +0 -1
- package/dist/assets/TransactionDetailScreen-DW8t3EC2.js +0 -5
- package/dist/assets/TransactionListRoutes-DHSwzqfn.js +0 -1
- package/dist/assets/TreasuryRoutes-Cxtbe06-.js +0 -37
- package/dist/assets/WiseConfirmationScreen-D-axhjl6.js +0 -12
- package/dist/assets/ZeniAccountRoutes-BG6yVxGl.js +0 -73
- package/dist/assets/ZeniAccountStatementScreen-D1CXmWJM.js +0 -9
- package/dist/assets/dnd-CrtLd1r-.js +0 -6
- package/dist/assets/epic-C0x_kZHk.js +0 -2
- package/dist/assets/getLocaleForTenant-DrFh6zlq.js +0 -1
- package/dist/assets/index-Bgxmla6x.js +0 -1
- package/dist/assets/index-Dvxx9UaB.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CA141hZU.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-w5iOFbal.js +0 -1
- package/dist/assets/useCashManagementBanner-Drz7Ezu4.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-FFGUOH8U.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-DsiaZGrG.js +0 -1
- package/dist/assets/useInitialThreadRequest-B3tsIQAR.js +0 -1
- package/dist/assets/withTransactionSidePanel-Dy09Dwri.js +0 -21
- package/dist/assets/zeni-epic-state-DuQa9FMz.js +0 -13
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-DC3GaKoW.js";import{u as ue,j as i,h as de,g as pe,i as Me,N as ba,s as At,n as De,t as kn,o as es,p as se}from"./core-Bv1T7LZC.js";import{f7 as Dt,RS as as,fj as _t,bt as Pe,RT as ts,RU as ns,eY as mn,RV as En,f5 as An,RW as Dn,RX as _n,RY as Pn,RZ as wn,f6 as vn,fi as Tn,R_ as Fn,R$ as rs,fc as ss,fb as cs,S0 as os,C1 as xn,fl as ca,S1 as is,S2 as ds,e_ as ls,eZ as us,fy as ze,fe as Bn,fd as Rn,S3 as ms,ff as Cs,By as ps,Bx as hs,BB as fs,BD as gs,fr as Ss,eV as Ln,S4 as bs,S5 as ys,fw as On,S6 as Is,fx as St,BJ as ks,BG as Es,eW as fe,S7 as qa,fB as we,fC as ve,fD as Te,gw as oa,cv as ia,S8 as da,S9 as Pt,uQ as $a,kF as za,Sa as Ya,Ch as ka,fm as Qe,Cj as wt,kv as Un,Sb as la,C5 as _a,Sc as As,Sd as Ds,C8 as Qa,Se as _s,Qd as Ja,fh as jn,Ce as ga,hV as Ps,Sf as Mn,f8 as ua,bo as ws,Sg as vs,gh as Xa,gg as et,CN as Ts,gf as at,PV as Fs,Sh as Nn,co as Vn,cQ as xs,Qc as wa,Dm as Hn,Si as Cn,CY as Pa,Sj as Gn,Dn as Bs,QC as Rs,Do as Ls,Et as Os,ub as Us,En as js,Sk as Ms,Ci as ra,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as $s,Sq as vt,Sr as zs,Cy as $n,Cr as Ys,Ss as Ws,gy as Zs,CH as zn,CL as Yn,gx as Ks,St as qs,D8 as Wn,Su as Qs,Sv as Js,Sw as Xs,CJ as Zn,Cu as Kn,Cb as qn,CD as Qn,CB as Jn,CF as ec,Sx as Xn,Sy as ac,ft as tc,fu as nc,fv as rc,Sz as tt,fn as er,cR as Tt,SA as sc,SB as cc,SC as oc,SD as ic,CT as bt,Df as dc,Db as lc,CP as uc,Dd as mc,D3 as Cc,D5 as pc,SE as ar,Dl as Ga,Kc as hc,SF as fc,SG as gc,SH as Sc,SI as tr,SJ as bc,DI as yc,CX as nr,CS as je,CW as Ic,SK as kc,SL as Ec,C2 as Ac,SM as rr,fg as sr,SN as Dc,C4 as _c,C3 as pn,SO as Pc,SP as wc,SQ as vc,MJ as Tc,SR as Ft,SS as Fc,xQ as cr,ld as xc,hL as Bc,DN as Rc,ST as or,f2 as Lc,f3 as Oc,SU as Uc,di as jc,fk as Mc,DD as Nc,Dx as qe,bs as Vc,bJ as Hc,cA as Gc,bK as $c,LW as zc}from"./zeni-epic-state-DuQa9FMz.js";import{I as Fe,cp as ir,p as _e,cq as dr,cr as lr,cs as Yc,a as Xe,X as xt,ct as Wc,cu as Zc,O as ur,c as mr,V as Cr,n as ye,W as le,U as W,ar as ya,cv as pr,cw as Kc,cx as qc,z as ne,B as va,ce as nt,cy as Qc,cz as Jc,cA as Xc,Z as Ta,aQ as Ye,br as Bt,cB as eo,x as Fa,h as rt,m as Rt,d as J,a7 as st,cC as ao,bE as Sa,cD as yt,cE as to,w as Lt,cF as no,au as hr,a2 as It,cG as ro,T as fr,f as gr,cH as so,cI as co,cJ as oo,cK as io,cL as lo,cM as uo,o as Wa,cN as mo,cO as Co,cP as Ct,r as po,cQ as ho,cR as fo,cS as go,cT as So,cU as bo,a9 as yo}from"./index-CVpYlrKc.js";import{n as Ne,D as Sr,S as Io}from"./mui-VYhJrGDQ.js";import{a as r}from"./sentry-CuaXjR5n.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-w5iOFbal.js";import{M as Ie}from"./MobileAppDrawer-CHF9nCsW.js";import{d as Ot}from"./recharts-D979ncoh.js";import{g as Ae,a as Ba,b as br,c as xe,d as Be,e as Je,f as ea,h as aa,A as ko,i as Ut,P as Eo,j as jt,s as Ia,k as yr,l as sa,m as Ir,n as Ao,o as kr,p as Do,S as hn}from"./SetupPagesScreen-CCip2k58.js";import{u as Er}from"./useInitialThreadRequest-B3tsIQAR.js";import ct from"./NotFoundScreen-D0AQGcoe.js";import{u as Mt}from"./useChargeCardPusherEvents-FFGUOH8U.js";import{n as fn}from"./utils-DPYDOv00.js";import{t as _o}from"./AddressScreen-DZz6iLRi.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./analyticsHelper-bAQTI-GF.js";import"./routePaths-DdjVf9j1.js";import"./BusinessVerificationPageScreen-CbhS3pML.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="65d9da41-abb7-4a74-8e8f-8ab5c13687c4",e._sentryDebugIdIdentifier="sentry-dbid-65d9da41-abb7-4a74-8e8f-8ab5c13687c4")}catch{}})();const Po=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Ar=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Po(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Dr(){const e=ue(),n=i(a=>Dt(a.cardPolicyState)),t=i(a=>as(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(_t())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:gn}}}=Xe.getLocalizedStrings(),wo=e=>Bn(e,!1),vo=e=>Rn(e.name,!1);function To(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(mn())},[a]);const w=i(A=>En(A.cardPolicyState)),m=i(A=>An(A.cardPolicyState)),j=i(A=>Dn(A.cardPolicyState)),F=i(A=>_n(A.cardPolicyState)),x=i(A=>Pn(A.cardPolicyState)),h=i(A=>wn(A.cardPolicyState)),f=i(A=>vn(A.cardPolicyState)),v=i(A=>Dt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),T=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Tn())},[a,w]),Dr();const b=i(A=>Fn(A.createCardPolicyState)),U=i(A=>rs(A.createCardPolicyState)),D=i(A=>ss(A.cardPolicyState)),k=i(A=>cs(A.cardPolicyState)),R=i(A=>os(A.createCardPolicyState)),d=i(A=>xn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[d.fetchState,a]);const p=r.useMemo(()=>m.map(wo),[m]),M=r.useMemo(()=>f.map(vo),[f]),V=r.useMemo(()=>d.cards.filter(A=>!ir(A.status.code)).map(Ar),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect(()=>{O&&R==null&&a(is({cardsMasterList:V,defaultRequireReceiptAmount:l,suggestedAllowMerchants:j,suggestedBlockMerchants:F,suggestedAllowCategories:x,suggestedBlockCategories:h}))},[T,a,O,R,V,l,j,F,x,h]);const L=r.useMemo(()=>Ot(A=>{a(_t(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),H=b.fetchState,I=t!=null?`/${t}/cards/policy`:"..",P=r.useCallback(()=>{const A=_e(n.state?.pathnameStackToGoBack),K=A.poppedPathname??I;e(K,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,I]),Y=r.useCallback(()=>{e(I)},[e,I]),Q=r.useCallback(A=>{a(ds(A))},[a]),E=r.useCallback(A=>{const K=dr(A);a(ls({templates:[K]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(us(A))},[a]),Z=r.useCallback(()=>{a(mn())},[a]),X=r.useRef(H);r.useEffect(()=>{const A=X.current;X.current=H,H==="Completed"&&A!=="Completed"&&U!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(I))},[a,H,U,e,I]);const o=H==="Error"?b.error?.message??gn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?R==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(lr,{showUploadDocumentSection:!0,navBarTitle:gn.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Yc,{formDraft:R,vendorSearchOptions:M,categorySearchOptions:p,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:o,documentUploadState:D,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:B,onBackClick:P,onCancelClick:Y,onClickMenuIcon:u,onFormChange:Q,onSubmit:E,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Fo}}}=Xe.getLocalizedStrings(),xo=e=>Bn(e,!1),Bo=e=>Rn(e.name,!1);function Ro(){const e=de(),n=pe(),{tenantEmailDomain:t,templateId:a}=Me(),s=ue(),y=Fe(),g=Pe(y?.loggedInUserRoleMap),[S,_]=r.useState(!1),u=r.useCallback(o=>{_(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ms(o)),j=i(o=>En(o.cardPolicyState)),F=i(o=>An(o.cardPolicyState)),x=i(o=>Dn(o.cardPolicyState)),h=i(o=>_n(o.cardPolicyState)),f=i(o=>Pn(o.cardPolicyState)),v=i(o=>wn(o.cardPolicyState)),l=i(o=>vn(o.cardPolicyState)),T=i(o=>Dt(o.cardPolicyState)),b=i(o=>xn(o)),U=i(o=>a!=null?Cs(o.cardPolicyState,a):void 0),D=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?ps(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(hs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),Dr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{b.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[b.fetchState,s]);const R=r.useMemo(()=>F.map(xo),[F]),d=r.useMemo(()=>l.map(Bo),[l]),p=r.useMemo(()=>b.cards.filter(o=>!ir(o.status.code)).map(Ar),[b.cards]);xt({isDataReady:D!=null});const M=r.useMemo(()=>{if(D!=null)return Wc({draft:D,cardRows:p,categorySearchOptions:R,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:x,suggestedBlockMerchants:h,suggestedAllowCategories:f,suggestedBlockCategories:v})},[D,p,R,d,k,x,h,f,v]),[V,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.current=!0,O(M))},[V,M]);const z=r.useCallback(o=>{O(o)},[]),H=r.useMemo(()=>Ot(o=>{s(_t(o))},250),[s]);r.useEffect(()=>()=>{H.cancel()},[H]);const I=r.useCallback(o=>{H(o)},[H]),P=m.updateFetchState.fetchState,Y=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=_e(n.state?.pathnameStackToGoBack),A=o.poppedPathname??Y;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,Y]),E=r.useCallback(()=>{e(Y)},[e,Y]),N=r.useCallback(o=>{if(a==null)return;const A=dr(o);s(fs(A)),s(gs(a))},[s,a]),Z=r.useRef(P);r.useEffect(()=>{const o=Z.current;Z.current=P,P==="Completed"&&o!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))},[s,P,e,Y]);const X=P==="Error"?m.updateFetchState.error?.message??Fo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):V!=null&&j==="Completed"&&b.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(Zc,{templateName:m.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:R,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:I,submitState:P,submitErrorMessage:X,isAiCfoAccessEnabled:B,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:E,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(lr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:B,onAskAiCfoClick:w})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return i(n=>e==null||e===""?{chips:pt,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??pt:pt,isResolved:s}}(Ss(n,e)),At)}const pt=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Lo,subheadline:Oo,pageTitle:Uo}}}}=Xe.getLocalizedStrings(),jo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Mo(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(I=>{S(I)},[]),u=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:C}=le(),{isFeatureEnabled:B}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),F=i(I=>bs(I)),x=i(I=>Fn(I.createCardPolicyState)),h=i(I=>ys(I.createCardPolicyState)),f=i(I=>h==null?[]:On(I.aiCfoState,h).filter(P=>P.kind==="creating_policy"),At),v=x.fetchState==="In-Progress"?Math.max(f.length,1):0,l=i(I=>Is(I.createCardPolicyState)),T=ya(x.fetchState);r.useEffect(()=>{if(T==="In-Progress"&&x.fetchState==="Completed"&&h!=null)f.forEach(I=>{a(St({chatSessionId:h,id:I.id,entityIds:l,kind:"created_policy"}))});else if(T==="In-Progress"&&x.fetchState==="Error"&&h!=null){f.forEach(P=>{a(St({chatSessionId:h,id:P.id,kind:"errored_policy"}))});const I=x.error?.message!=null&&x.error.message.length>0?x.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:I}]}))}},[x.error?.message,x.fetchState,a,h,l,f,T]);const b=F.fetchState.fetchState;r.useEffect(()=>{b!=="Not-Started"&&b!=="Error"||a(ks())},[a,b]);const U=F.archiveFetchState.fetchState,D=ya(U);r.useEffect(()=>{D==="In-Progress"&&U==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,D]);const k=r.useMemo(()=>F.templates.map(jo),[F.templates]);xt({isDataReady:F.fetchState.fetchState==="Completed"});const R=k.length>0||v>0,d=function(I){const{hasAnyPolicies:P,isChargeCardAdmin:Y,isFileUploadEnabled:Q}=I,E=de(),N=pe(),{tenantEmailDomain:Z}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=ur(),A=mr(),K=Cr(),re=i(ce=>Ln(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(q,ke,3),[q,ke]),[ge,ee]=r.useState(""),me=K&&A&&Z!=null&&!X,oe=r.useCallback(ce=>{if(Z==null)return;const Ea=ye(N.state?.pathnameStackToGoBack,N.pathname);E(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[N.pathname,N.state,E,Z]),ae=r.useCallback(ce=>{ce.trim().length!==0&&(ee(""),oe(ce))},[oe]),We=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ee(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),te=r.useCallback(ce=>{ee(ce)},[]),Ze=r.useCallback(()=>{o(!0)},[o]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(me&&!P&&Y)return{aiAgentName:Uo,headline:Lo,subheadline:Oo,promptChips:Se,composer:{currentInput:ge,isSubmitting:re,isFileUploadEnabled:Q,onInputChange:te,onSubmit:We,onStopSubmit:Ee},onPromptClick:ae,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,P,me,Y,Q,re,te,Re,Ze,ae,Ee,We,Se])}({hasAnyPolicies:R,isChargeCardAdmin:y,isFileUploadEnabled:B}),p=w&&d!=null?c.jsx(pr,{...d}):null,M=m&&p==null,V=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),P=I.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),H=F.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(qc,{policies:k,archivingTemplateId:F.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:p,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function No(){const e=de(),{cardId:n}=Me(),t=ue(),a=ne.getSignedInUser(),s=i(q=>fe(q)),y=Fe(),g=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),F=we(s),x=ve(s),h=Te(j,s),f=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:h}),l=Be({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:w,isBookKeepingTenant:x,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:f}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,b=i(q=>oa(q,s.companyId)),U=ia(b.controllers),{creditAccount:D,creditAccountRepayment:k}=i(q=>da(q)),R=i(q=>q.classListState.fetchState),d=!B&&l&&m,p=i(q=>Pt(q,n,d,l)),[M,V]=r.useState(!1),O=p.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),H=z?.accountingClassIDs[0],I=i(q=>H!=null?za(q.classState,{classId:H,reportId:"class_list"}):void 0),P=O?.cardHolderUser?.userId,Y=i(q=>P!=null?$a(q.userRoleState,P):void 0),Q=Y?.accountingClassIDs[0],E=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&_===!1&&N&&(u(!0),setTimeout(()=>{t(Ya()),Z&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,_,N,Z]),r.useEffect(()=>{M||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=Ae(s.tenantEmailDomain,n,a,O,C);e(q)}},[p.fetchState,C,N]),r.useEffect(()=>{D.fetchState!=="Completed"&&D.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(wt()),R!=="Completed"&&R!=="In-Progress"&&t(Un())},[D.fetchState,k.fetchState,t,l,m,g,R]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=Ae(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Je(l,v,T,m),K=Ba(l,m,g,D,k),re=br(o,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:K,debitAccountInformation:re,chargeCardDetailView:p,creditAccount:D,classListFetchState:R,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Nt="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Vt="charge-card-limit-updated",Ht="charge-card-limit-reset",Gt="charge-card-renamed",Vo="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ho=[La,Ra],Go=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(Xc);function $o(){const e=de(),n=ue(),t=pe(),a=ne.getSignedInUser(),s=i(j=>fe(j)),{useFeatureGate:y}=le(),{isFeatureEnabled:g}=y(W.isCardsCommentingEnabled),[S,_]=r.useState(!1),u=i(j=>la(j)),C=Er(s.companyId,{clearParams:u.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),F=j.poppedPathname??zo(s.tenantEmailDomain);e(F,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=ea(s);if(Mt({events:Ca(w,Ho),onEvent:j=>{switch(j){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(_(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(Go,{onBackClick:B,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(Jc,{onBackClick:B})}const zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),{cardId:s}=Me(),y=pe(),{useDynamicConfig:g}=le(),[S,_]=r.useState(!1),[u,C]=r.useState(!1),[B,w]=r.useState(!1),[m,j]=r.useState(!1),F=ne.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const x=i(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ye.zeniCardsConfig),f=h.max_charge_card_activation_attempts_by_card_id,v=i(E=>Ds(E,s)),l=v.chargeCard,T=i(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:b}=le(),{isFeatureEnabled:U}=b(W.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=b(W.isDebitCardFeatureEnabled),k=Te(D,x),R=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:k}),d=!!x.companyChargeCardInfo?.info?.isChargeCardEnabled,p=x.userRole.includes("charge_card_user"),M=we(x),V=ve(x),O=x.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:O}),z=!p&&L&&d;r.useEffect(()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),_(!0)),u===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,v.fetchState,S,T]);const H=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(v.fetchState==="Completed"){if(B===!1&&(H===!1||H&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==F.userId)){const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:N}})}else if(B&&v.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(E,{state:{pathnameStackToGoBack:N}})}}},[v.fetchState,l?.type.code,B,v.isRefreshingViewInBackground]);const I=ne.getZeniOtpTokenForCardHolder(s),P=i(E=>jn(E.userState,F.userId)),Y=()=>{l?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(Y,3e3),w(!0))},[v.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=E=>{j(E)};if(T!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(Zo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:P.phone,signedInUser:F,isSandboxEnv:Bt(),chargeCardDetailState:v,signedInUserToken:I,navigate:a,currentTenant:x,location:y,maxChargeCardActivationAttempts:f[s]!=null?f[s]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Ps(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Mn(e,s),S=n.updateStatus,_=ua(e,!1,!1,!1);let u=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||C,showMenuIcon:u,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:_}=y;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(Ts(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&ne.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const u=_e(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(_):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(eo),Ko=Ne.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
width: ${e=>`${Yo.containerWidth.value(e.windowSize)}%`};
|
|
5
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
6
|
-
`,qo=Ne.div`
|
|
7
|
-
display: flex;
|
|
8
|
-
min-height: 100%;
|
|
9
|
-
width: 100%;
|
|
10
|
-
flex: 1 1 auto;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
align-items: center;
|
|
13
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,Za=Xe.getLocalizedStrings().dateFormat,Qo={overlayWidth:new Fa(100,100,58)},Lr=[Br,ot],Jo=new Set(Lr),Xo=De(function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Rs(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Ls(e.depositAccountState,e.depositAccountListState)}},function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:y,isCashbackInfoFetchStateCompleted:g,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:_,controllerEmails:u,paymentDetails:C,productInformation:B,cashbackInformation:w,paymentSourceInformation:m,creditAccountInformation:j,debitAccountInformation:F,paymentInitiatedDate:x,sourcePage:h}=n,{tenantEmailDomain:f}=a,v=()=>{e(Hn(!0));const l=ea(a);l!=null&&l!==""&&e(Pa(l,!0,!0)),e(Qe(!0))};return{onBackNavigation:()=>{if(g&&S&&_&&w!=null&&J.trackCardsPayEarlyFormClick(u,B,w,"Back",C.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:C.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:C.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:C.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:C.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:x?.add(3,"day").format(Za.visual.MMMDCommaYYYYformat),paymentInitiatedDate:x?.format(Za.visual.MMMDCommaYYYYformat)},m,j,F),h==="cardPaymentHistory")n.closeDrawerHandler(!0),e(Gn());else{const l=aa(f);t(l)}},onUpdatePaymentAccountStatus:(l,T,b)=>{e(js(l,T,"bill_pay","bill_pay_detail",b))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:l=>{e(Us("external_account",l))},onEstablishConnectionClick:l=>{e(Os(l,a.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{s?window.open(`/${f}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{y?window.open(`/${f}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onEventReceived:l=>{Jo.has(l)&&v()},onPusherSubscribed:v}})(st(ao)),$t=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:y,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:_,isDebitCardInfoFetchStateCompleted:u,isCreditCardInfoFetchStateCompleted:C,isCashbackInfoFetchStateCompleted:B,paymentInitiatedDate:w,retryRepayment:m})=>{const j=de(),{useDynamicConfig:F}=le(),{configValue:x}=F(Ye.zeniAccountsConfig),h=Fs(x),f=i(A=>Nn(A)),{creditAccount:v}=i(A=>da(A)),l=i(A=>fe(A)),T=Rt(),b=Ta(),U=ue(),D=ne.getSignedInUser(),k=Fe(),[R,d]=r.useState(!1),[p,M]=r.useState(!1),{configValue:V}=F(Ye.zeniCardsConfig),O=V.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??V.default_credit_card_auto_pay_threshold??ko,L=Vn(k?.loggedInUserRoleMap),z=xs(k?.loggedInUserRoleMap),H=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,I=i(A=>wa(A,l.companyId)),P=I.companyChargeCardInfo?.primaryFundingAccount,Y=I.allFundingAccounts.find(A=>A.id===P?.accountId),Q=i(A=>oa(A,l.companyId)),E=ia(Q.controllers);r.useEffect(()=>{if(f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&U(Hn()),f.fetchState==="Completed"&&!p){const A=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,K=f.transferFromAccounts.find(q=>q.id===A);let re;if(y==="cardPaymentHistory"&&m){const q=m.paymentAccountId!=null?f.transferFromAccounts.find(ke=>ke.id===m.paymentAccountId):void 0;re={amount:m.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:fn(),transferFrom:q??K}}else re={amount:{amount:v.balance.amount+v.hold.amount,currencyCode:v.balance.currencyCode,currencySymbol:v.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:fn(),transferFrom:K};U(Cn(re)),M(!0)}},[f.fetchState,p,y,m,f.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,v.balance.amount,v.balance.currencyCode,v.balance.currencySymbol,v.hold.amount,U]);const N={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:Y?.accType==="depositAccount",creditCardPaymentSourceAccountName:Y?.label,creditCardPaymentSourceAccountType:Y?.accType,creditCardPaymentSourceLastFourDigits:Y?.accountLast4,creditCardPaymentSourceBalance:Y?.accountBalance?.available?.amount??0};if(r.useEffect(()=>{I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&U(Pa(l.companyId,!0))},[I.fetchState]),r.useEffect(()=>{f.updateStatus==="Completed"&&_!=null&&B&&C&&u&&J.trackCardsPayEarlyPayNowClick(E,s,_,f.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:f.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:f.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:f.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:f.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:w?.add(3,"day").format(Za.visual.MMMDCommaYYYYformat),paymentInitiatedDate:w?.format(Za.visual.MMMDCommaYYYYformat)},N,g,S)},[f.updateStatus,_,B,C,u,w]),r.useEffect(()=>{f.fetchState==="Completed"&&_!=null&&B&&C&&u&&!R&&e&&p&&_!=null&&(J.trackCardsPayEarlyFormView(E,s,_,t,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,v.balance.amount,N,g,S),d(!0))},[f,B,C,u,R,e,p]),D==null)throw Error("Can't access invite people page without signing in...");const Z=()=>{n(!0),U(Gn())},X=ea(l),o={events:e?Ca(X,Lr):[],eventCallback:(A,K,re)=>{re.onEventReceived(A)},onSubscribed:A=>{A.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(Sr,{onClose:()=>{Z()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Qo.overlayWidth.valuePercentage(b),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:T.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(ei,{onClick:A=>A.stopPropagation(),children:c.jsx(Xo,{...o,closeDrawerHandler:n,navigate:j,paymentDetails:f,creditAccountSpentAmount:a,onTransferClick:()=>{B&&C&&u&&_!=null&&J.trackCardsPayEarlyFormClick(E,s,_,"Pay Now",f.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:f.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:f.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:f.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:f.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},N,g,S),U(Bs({companyId:l.companyId}))},onDismissClick:Z,onSaveChangesToLocalStore:A=>{U(Cn(A))},currentTenant:l,hasZeniAccountsAdminAccess:L,isZeniAccountsUser:z,isZeniAccountSetupEnabled:H,productInformation:s,sourcePage:y,controllerEmails:E,autoPayThreshold:O,paymentSourceInformation:N,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:_,isCashbackInfoFetchStateCompleted:B,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:u,paymentInitiatedDate:w,maxInsuredAmount:h.maxInsuredAmount})})})})},ei=Ne(Io)`
|
|
15
|
-
display: flex;
|
|
16
|
-
min-height: 100%;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
`,zt=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,Ue=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ka=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",ht=e=>{if(e==null||typeof e!="object")return!1;const n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!Ka(n.transaction_status)&&!!Ka(n.transaction_type)},Yt=(e,n)=>{const t=e?.card_status;if(!Ka(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},kt=[wr,vr,Tr,Fr,xr,ma,Nt,ot,Vt,Ht,Gt],Or=[La,Ra],ai=new Set([...kt,...Or]),ft=Xe.getLocalizedStrings().dateFormat,ti=De(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:y}=n,g=ne.getSignedInUser(),S=e.tenantState.currentTenantId,_={userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:S??""},u=Pt(e,a,t,y),C=Ws(e,a),B=Zs(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:C,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${It}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${It}/card_transaction_attachment`,authParams:_,isSnackbarOpen:B.isSnackbarOpen,cardsEndPoint:`${hr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:y,cardProviderId:g,includeCreditAccountInfo:S,setIsPaymentOpen:_,controllerEmails:u,productInformation:C,cashbackInformation:B,primaryFundingAccountDetails:w,creditAccountInformation:m,debitAccountInformation:j,isChargeCardFeatureEnabled:F}=n,{tenantEmailDomain:x}=a;return{onEventReceived:(h,f)=>{(({event:v,data:l,cardId:T,dispatch:b,subscribedEvents:U})=>{const D=zt(l);switch(v){case La:case Ra:return void b(_a(!0));case wr:{const k=ie(D?.card_id);if(k==null||k!==T)return;const R=ie(D?.transaction_id),d=D?.transaction_status;return R!=null&&Ka(d)?void b(zs({transactionId:R,transactionStatus:d})):void b(ra(T,null,null,!0))}case ma:{const k=ie(D?.card_id)??T;if(k!==T)return;const R=Yt(D,k);return R!=null?void b(vt(R)):void b(ga(T,!0))}case Nt:{const k=ie(D?.card_id)??T;if(k!==T)return;const R=ie(D?.currency_code),d=ie(D?.currency_symbol),p=Ue(D?.balance);return R!=null&&d!=null&&p!=null?(b($s({cardId:k,currencyCode:R,currencySymbol:d,balance:p,hold:Ue(D?.hold),dailyPurchaseSpends:Ue(D?.daily_purchase_spends),monthlyPurchaseSpends:Ue(D?.monthly_purchase_spends),dailyWithdrawals:Ue(D?.daily_withdrawals),monthlyWithdrawals:Ue(D?.monthly_withdrawals)})),void b(Qe(!0))):(b(ga(T,!0)),void b(Qe(!0)))}case ot:{const k=ie(D?.currency_code),R=ie(D?.currency_symbol),d=Ue(D?.available_amount),p=Ue(D?.balance_amount);return k!=null&&R!=null&&d!=null&&p!=null?void b(Gs({currencyCode:k,currencySymbol:R,available:d,balance:p,hold:Ue(D?.hold_amount),cashback:Ue(D?.cashback_amount)})):void b(Qe(!0))}case vr:{const k=ie(D?.card_id)??T;if(k!==T)return;const R=D?.transaction;return ht(R)?void b(Hs({cardId:k,transaction:R})):void b(ra(T,null,null,!0))}case Tr:{const k=ie(D?.card_id)??T;if(k!==T)return;const R=D?.transaction;return ht(R)?void b(Vs({cardId:k,declineReason:ie(D?.decline_reason),transaction:R})):void b(ra(T,null,null,!0))}case Fr:{const k=ie(D?.card_id)??T;if(k!==T)return;const R=D?.transaction;return ht(R)?void b(Ns({cardId:k,transaction:R})):void b(ra(T,null,null,!0))}case xr:{const k=ie(D?.card_id)??T;if(k!==T)return;const R=ie(D?.transaction_id),d=D?.attachment_file_paths;return R!=null&&Array.isArray(d)&&d.every(p=>typeof p=="string")?void b(Ms({cardId:k,transactionId:R,attachmentFilePaths:d})):void b(ra(T,null,null,!0))}case Vt:case Ht:case Gt:{const k=ie(D?.card_id);if(k==null||k!==T)return;b(ga(T,!0))}}})({event:h,data:f,cardId:t,dispatch:e,subscribedEvents:ai})},onPusherSubscribed:()=>{e(ga(t,!0)),e(ra(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,F))},onFetchChargeCardTransactionList:(h,f)=>{e(ra(t,h,f))},onUpdateScrollYOffset:h=>{},onGetOtp:h=>{g!=null&&e(at(h,"ChargeCardHolder",t))},onResendOtp:h=>{g!=null&&e(et(h,"ChargeCardHolder",t))},onVerifyOtp:(h,f)=>{g!=null&&e(Xa(h,f,"ChargeCardHolder",t))},onVerifyOtpSuccess:h=>{h!=null&&ne.saveZeniOtpTokenForCardHolder(h,t)},onColorCodeChange:h=>{e(ec(t,h))},onLockChargeCard:(h,f)=>{e(Jn(h,t,f))},onUnlockChargeCard:h=>{e(Qn(h,t))},onCloseChargeCard:h=>{e(qn(t,h))},onFetchChargeCardsRecurringExpenses:()=>{e(Kn([t]))},updateChargeCardName:(h,f)=>{e(Zn(h,t,f))},updateChargeCardTransactionAttachments:(h,f)=>{f!=null&&e(Xs({transactionId:h,data:f}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(h,f,v,l)=>{e(Js({chargeCardId:f,transactionId:h,fetchState:v,error:l}))},updateChargeCardTransactionReceiptsShowTick:(h,f,v)=>{e(Qs({chargeCardId:f,transactionId:h,shouldShowTick:v}))},onChargeCardRevokeInviteClick:()=>{e(Wn(t))},updateChargeCardTransactionIsViewReceiptClicked:(h,f,v)=>{e(qs({chargeCardId:f,transactionId:h,isViewReceiptClicked:v}))},onChargeCardTransactionRowClick:(h,f)=>{const v=ye(y.state?.pathnameStackToGoBack,y.pathname);s(`../../transaction/${h}/${f}`,{state:{pathnameStackToGoBack:v}})},onBackClick:()=>{const h=_e(y.state?.pathnameStackToGoBack),f=aa(x);s(f,{state:{pathnameStackToGoBack:h.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Ks())},onUpdateDebitCardPinAttempt:h=>{e(Yn(t,h)),h==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(h,f)=>{h?e(ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):f!=null&&e(ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:f.message}]}))},updateSpendLimit(h,f,v,l){e(zn(h,f,v.code,l))},shouldOpenCreditCardPaymentDrawer(h){h&&B!=null&&J.trackCardsPayEarlyClick(u,C,B,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},m,j),_(h)}}})(st(no));function ni(){const e=de(),n=ue(),t=pe(),{cardId:a}=Me(),[s,y]=r.useState(!1),[g,S]=r.useState(!1),{useDynamicConfig:_}=le(),u=ne.getSignedInUser(),C=i(G=>fe(G)),B=i(G=>qa(G).firstViewAfterActivation),w=i(G=>G.classListState.fetchState),{configValue:m}=_(Ye.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:j}=_(Ye.zeniCardsConfig),F=j.enable_card_controls_for_company_ids,x=j.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(F)&&F.includes(C.companyId),[h,f]=r.useState(!1),[v,l]=r.useState(!1),{useFeatureGate:T}=le(),{isFeatureEnabled:b}=T(W.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=T(W.isDebitCardFeatureEnabled),D=Te(U,C),k=xe({isDebitCardFeatureEnabled:U,isBankingOnlyTenant:D}),{isFeatureEnabled:R}=T(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=T(W.isCardsCommentingEnabled),p=ve(C),M=we(C),V=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:b,isBookKeepingTenant:p,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:V}),L=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,H=!C.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const I=i(G=>wa(G,C.companyId)),{creditAccount:P,creditAccountRepayment:Y}=i(G=>da(G)),Q=ne.getZeniOtpTokenForCardHolder(a),E=i(G=>Pt(G,a,H,O)),{isAiCfoAccessEnabled:N,onAskAiCfoClick:Z}=xa({mobileExploreReferrer:"Card Detail"});xt({isDataReady:E.fetchState==="Completed"});const X=i(G=>la(G)),o=E.chargeCard,A=Fe(),K=Pe(A?.loggedInUserRoleMap),re=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_virtual_debit_card",q=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_physical_credit_card",ke=o?.type.code==="business_virtual_debit_card"||o?.type.code==="business_virtual_credit_card",Se=o?.type.code==="business_virtual_debit_card",ge=Ba(O,z,K,P,Y),ee=br(re,E),me=Ut(K,X),oe=Je(O,k,L,z),ae=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",We=i(G=>oa(G,C.companyId)),Ee=ia(We.controllers),te=i(G=>o?.cardCreatedByUser?.userId!=null?$a(G.userRoleState,o?.cardCreatedByUser?.userId):void 0),Ze=i(G=>te?.accountingClassIDs[0]!=null?za(G.classState,{classId:te?.accountingClassIDs[0],reportId:"class_list"}):void 0),Re=i(G=>o?.cardHolderUser?.userId!=null?$a(G.userRoleState,o?.cardHolderUser?.userId):void 0),ce=i(G=>Re?.accountingClassIDs[0]!=null?za(G.classState,{classId:Re?.accountingClassIDs[0],reportId:"class_list"}):void 0),Ea=C?.userRole,pa=i(G=>ua(G,!1,k,b).revokeCardInvite),ha=ya(pa.saveStatus.fetchState);if(r.useEffect(()=>{if(ha==="In-Progress"&&pa.saveStatus.fetchState==="Completed"){const G=aa(C.tenantEmailDomain);e(G)}},[ha,pa.saveStatus.fetchState,e,C.tenantEmailDomain]),r.useEffect(()=>{B&&s===!1&&ke&&(y(!0),setTimeout(()=>{n(Ya()),Se&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[B,s,ke,Se]),r.useEffect(()=>{h||E.fetchState==="Completed"||E.fetchState==="In-Progress"||a==null||(f(!0),n(ka(a,H,O,!1)))},[h,E,a,n]),r.useEffect(()=>{!v&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&re&&ae&&K&&(l(!0),n($n({depositAccountId:E.chargeCard?.connectedAccountId})))},[v,E,n,ae,K]),r.useEffect(()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&K&&n(_a()),w!=="Completed"&&w!=="In-Progress"&&n(Un()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&n(Ys({chargeCardId:a})),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&n(Pa(C.companyId,!0))},[X.fetchState,n,K,w,E.transactionStatistics.fetchState,I.fetchState]),r.useEffect(()=>{if(!(E.fetchState!=="Completed"||O&&P.fetchState!=="Completed"||o==null||E.transactionStatistics.fetchState!=="Completed"||re&&K&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const G=o.type.code.includes("physical"),he=G?o.cardActivationAttemptHistory[0]?.timestamp:o.createTime;J.trackCardsCardDetailView(Ee,oe,{cardId:a,cardName:o.cardName,cardType:o.type.code.includes("credit")?"credit":"debit",cardCategory:G?"physical":"virtual",cardLimit:Sa(o.limit.amount),cardLastFourDigits:o.accountLast4,cardStatus:o.status.code,cardAssignedDate:o.createTime?.format(ft.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:o.providerCardCreateTime?.format(ft.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(ft.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:o.creditLimitFrequency.name,cardSpentAmount:Sa(o.balance.amount),cardAvailableLimit:Sa(o.available.amount),cardUtilizationPercent:o.limit.amount>0?Math.round((o.limit.amount-o.available.amount)/o.limit.amount*100):0,cardUtilizationAmount:Sa(o.limit.amount-o.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:yt(o.cardCreatedByUser,!1),cardIssuedByEmail:o.cardCreatedByUser?.email,cardIssuedByUserId:o.cardCreatedByUser?.userId,cardIssuedByRole:te?.userRoles,cardIssuedByDepartment:Ze?.className},{cardholderName:yt(o.cardHolderUser,!1),cardholderEmail:o.cardHolderUser?.email,cardholderRole:Re?.userRoles,cardholderUserId:o.cardHolderUser?.userId,cardholderDepartment:ce?.className},ge,ee)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,P.fetchState,K]),u==null)throw Error("Can't access card detail page without signing in...");const ta=ea(C),Aa=K?[...kt,...Or]:kt,dt={events:Ca(ta,Aa),eventCallback:(G,he,Le)=>{Le.onEventReceived(G,he)},onSubscribed:G=>{G.onPusherSubscribed()}},lt=()=>{if(a!=null&&o!=null){const{ownerName:G,cardName:he,utilisation:Le,limit:Ve,frequency:He,cardColor:Ge}=gt(o),$e=o.cardHolderUserId===u.userId;J.trackCardsDetailPageViewed(a,G,he,Le,Ve,He,Ge,$e)}};r.useEffect(()=>{if(E.fetchState==="Completed"){const G=E.chargeCard;if(G?.status.code==="inactive"||re&&G?.isPinSet===!1||q&&B){const he=Ae(C.tenantEmailDomain,a,u,o,B);e(he)}}},[E.fetchState]);const Ce=(G,he)=>{if(a!=null&&o!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=gt(o),na=o.cardHolderUserId===u.userId;J.trackCardsDetailPageClicked(a,Le,Ve,He,Ge,$e,G,na,he)}},Oa=(G,he)=>{if(a!=null&&o!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=gt(o),na=o.cardHolderUserId===u.userId;J.trackCardsVerifyPopUpClick(a,Le,Ve,He,Ge,$e,G,na,he)}},Da=P.balance.amount+P.hold.amount,ut=C.companyChargeCardInfo?.info?.primaryFundingAccount,Ua=I.allFundingAccounts.find(G=>G.id===ut?.accountId),ja=E.chargeCard!=null,Ma=E.depositAccountLimit!=null;return E.fetchState!=="Error"||ja?!ja&&(E.fetchState==="In-Progress"||E.fetchState==="Not-Started")||pa.saveStatus.fetchState==="In-Progress"||!Ma&&re&&K&&E.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(to,{}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:B}),E.fetchState==="Completed"?c.jsx(Lt,{analytics:J,onLoad:lt}):null,g===!0?c.jsx($t,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:g,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ee,cashbackInformation:me,creditAccountSpentAmount:Da,isDebitCardInfoFetchStateCompleted:!re||!K||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||P.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!K||X.fetchState==="Completed",paymentInitiatedDate:Y.initiatedRepaymentDate}):null,c.jsx(ti,{...dt,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:Oa,onFireOnClickAnalytics:Ce,isSandboxEnv:Bt(),signedInUser:u,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:te?.userRoles,cardIssuedByDepartmentName:Ze?.className,cardHolderRoles:Re?.userRoles,cardHolderDepartmentName:ce?.className,loggedInUserRole:Ea,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:z,isCardControlsEnabled:x,isEarlyPayEnabled:R,controllerEmails:Ee,chargeCardCashbackDetailState:X,productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ee,cashbackInformation:me,classListFetchState:w,primaryFundingAccountDetails:Ua,currentTenant:C,cardProviderId:E.chargeCard?.cardProviderID,cardId:a,creditAccount:P,creditAccountRepayment:Y,includeCreditAccountInfo:H,signedInUserToken:Q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:m.documentAiReceiptMaxSizeLimitBytes!=null?m.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:Z,isCardsCommentingEnabled:d})]}):c.jsx(ct,{})}const gt=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,y=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:y,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ri,subheadline:si,pageTitle:ci}}}}=Xe.getLocalizedStrings(),Ur=[ma,ot,Rr,Ra,La,it,Gt,Vo,Vt,Ht,Nt],oi=new Set(Ur),Et=Ot((e,n,t,a)=>{e(ca(n,t,a,!0))},400),ii=Ne.div`
|
|
19
|
-
display: flex;
|
|
20
|
-
width: 100%;
|
|
21
|
-
flex: 1 1 auto;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
align-items: center;
|
|
24
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,di=De(function(e,n){const t=ua(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:sc(e),bulkActionView:cc(e),companyLegalName:n.currentTenant.companyName,admins:n.admins,searchText:t.searchText,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigateAndClearBulkSelection:t,currentTenant:a,location:s,signedInUser:y,chargeCardListState:g,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:C,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:m,isChargeCardTOSAccepted:j,controllerEmails:F,depositAccountListWithDebitCardIssued:x,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:f,productInformation:v,cashbackInformation:l,creditAccountInformation:T,debitAccountInformation:b,updatePayNowInfoTooltip:U,isUserHasCardsAdminLevelAccess:D}=n,{tenantEmailDomain:k}=a,{cards:R}=g;return{onChargeCardRowClick:(d,p)=>{const M=Ir(R,d);let V;M!=null&&((L=>{const z=L.limit.amount-L.available.amount,H=`${L.cardHolderUser?.firstName.toLowerCase()} ${L.cardHolderUser?.lastName.toLowerCase()}`,I=L.cardName,P=L.department?.className??"",Y=L.limit.amount,Q=L.creditLimitFrequency.name;J.trackCardsListRowClicked(H,I,P,z,Y,Q,y.userId===L.cardHolderUserId)})(M),sa(B,w,x)&&J.trackCardsCardListRowClick(F,v,"Card Row Item","row_clicked",p+1,{cardOwner:yt(M.cardHolderUser,!1),cardName:M.cardName,cardType:M.type.code.includes("credit")?"credit":"debit",cardStatus:M.status.code,cardUtilizationAmount:Sa(M.limit.amount-M.available.amount),cardUtilizationPercent:M.limit.amount>0?Math.round((M.limit.amount-M.available.amount)/M.limit.amount*100):0,cardLimit:Sa(M.limit.amount)},l,T,b)),V=M?.status.code==="request_on_hold"&&y.userId===M.cardHolderUserId?kr(k):Ae(k,d,y,M);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(V,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:d=>{e(Kn(d))},onFetchDepositAccountLimit:d=>{e($n({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(pc(d))},onChargeCardRevokeInviteClick:d=>{e(Wn(d))},onLockChargeCardList:(d,p)=>{e(Cc(d,p))},onUnlockChargeCardList:d=>{e(mc(d))},onCloseChargeCardList:(d,p)=>{e(uc(d,p))},onRevokeChargeCardList:d=>{e(lc(d))},updateChargeCardListSpendLimit(d,p,M){e(dc(d,p,M.code))},onLockChargeCard:(d,p)=>{e(Jn(D,d,p))},onUnlockChargeCard:d=>{e(Qn(D,d))},onCloseChargeCard:(d,p)=>{e(qn(d,p))},onUpdateSpendLimit(d,p,M,V){e(zn(d,p,M.code,V))},updateChargeCardName:(d,p)=>{e(Zn(D,d,p))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),sa(B,w,x)&&l!=null&&J.trackCardsSettingsClick(F,v,l,T,b);const d=Ao(k),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:p}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),sa(B,w,x)&&l!=null&&J.trackCardsNewCardClick(F,v,l,"New Button","card_creation_initiated","Card List",T,b);const d=li(k),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:p}})},onColumnSortConfigChanged:(d,p)=>{sa(B,w,x)&&l!=null&&J.trackCardsCardListSortClick(F,v,l,"Sort Icon","sort",d,p==="ascending"?"ASC":"DESC","Cards List",T,b),e(bt({uiState:{sortKey:d,sortOrder:p}}))},onSearchTextChanged:d=>{e(ic(d))},onReloadCards:()=>{e(ca(S,B&&w,_&&C,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{sa(B,w,x)&&l!=null&&J.trackCardsCashbackOverviewClick(F,v,l,"Cashback Overview","cashback_details_viewed",T,b),t("./cashback")},onClickStatementsIcon:()=>{sa(B,w,x)&&l!=null&&J.trackCardsStatementsClick(F,v,l,T,b),t("./statements")},onCreateNowClick:d=>{sa(B,w,x)&&l!=null&&J.trackCardsNewCardClick(F,v,l,"Promo Banner","card_creation_initiated","Card List",T,b),t(`./new?cardType=${d}`)},onPromoCardClick:d=>{t(d==="debit"&&B&&!m||d==="credit"&&u&&!j?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,p)=>{f==="Completed"&&a.company!=null&&l!=null&&J.trackCardsPayEarlyClick(F,v,l,"Card List",d,p,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:h?.accType==="depositAccount",creditCardPaymentSourceAccountName:h?.label,creditCardPaymentSourceAccountType:h?.accType,creditCardPaymentSourceLastFourDigits:h?.accountLast4,creditCardPaymentSourceBalance:h?.accountBalance?.available?.amount??0},T,b);const M=ui(k);t(M)},navigateToCreditCardPaymentHistoryPage:()=>{const d=mi(k),p=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:p}})},shouldShowPayNowInfoTooltip:U,onSetRowActionCardId:d=>{e(oc(d))},onSetBulkActionCardIds:d=>{e(Xn(d))},onEventReceived:d=>{oi.has(d)&&Et(e,S,B&&w,_&&C)},onPusherSubscribed:()=>{Et(e,S,B&&w,_&&C)}}})(st(so));function Sn({isPaymentDrawerOpen:e}){const n=de(),t=ue(),a=pe(),s=r.useCallback(($,Oe)=>{t(Xn([])),n($,Oe)},[t,n]),[y,g]=r.useState(!1),[S,_]=r.useState(ne.getPayNowInfoTooltip()??!1),u=$=>{ne.savePayNowInfoTooltip($),_($)},[C,B]=r.useState(!1),w=ne.getSignedInUser(),m=i($=>fe($)),[j,F]=r.useState(!1),[x,h]=r.useState(!1),{isAiCfoAccessEnabled:f,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Cards"}),l=m.userRole.includes("charge_card_user"),T=!l,b=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:U,useDynamicConfig:D}=le(),{isFeatureEnabled:k}=U(W.isCashbackFeatureEnabled),{isFeatureEnabled:R}=U(W.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=U(W.isDebitCardFeatureEnabled),{isFeatureEnabled:p}=U(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:M}=U(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:V}=U(W.isCardsCommentingEnabled),{isFeatureEnabled:O}=U(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:L}=U(W.isCardPolicyEnabled),{isFeatureEnabled:z}=U(W.isAiCardCreationEnabled),H=Te(d,m),I=xe({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:H}),P=we(m),Y=ve(m),Q=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Be({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:Y,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:Q}),N=yr({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:Y}),{configValue:Z}=D(Ye.zeniCardsConfig),X=Fe(),o=Pe(X?.loggedInUserRoleMap),A=i($=>oa($,m.companyId)),K=ia(A.controllers),re=Z.charge_card_cashback_rate_per_transaction!=null?Z.charge_card_cashback_rate_per_transaction:.0175,q=Z.credit_card_pay_now_threshold_by_company_id?.[m.companyId]??Z.default_credit_card_pay_now_threshold??Eo,ke=Z.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(Z.enable_card_controls_for_company_ids)&&Z.enable_card_controls_for_company_ids.includes(m.companyId),Se=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,ee=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,me=i($=>Nn($)),oe=ya(me.updateStatus),ae=i($=>ua($,T,I&&b,E&&ee)),We=i($=>ac($)),Ee=i($=>tc($)),te=i($=>nc($)),Ze=i($=>rc($)),Re=i($=>te==null?[]:On($.aiCfoState,te).filter(Oe=>Oe.kind==="creating_cards"),At),ce=ya(Ee.fetchState);r.useEffect(()=>{ce==="In-Progress"&&Ee.fetchState==="Completed"&&te!=null&&Re.forEach($=>{t(St({chatSessionId:te,id:$.id,entityIds:Ze,kind:"created_cards"}))})},[t,Ee.fetchState,te,Ze,Re,ce]);const Ea=ae.cards.filter($=>$.type.code.includes("debit")).map($=>$.connectedAccountId),pa=[...new Set(Ea)],ha=i($=>la($)),ta=i($=>tt($,pa)),Aa=i($=>wa($,m.companyId)),dt=Aa.companyChargeCardInfo?.primaryFundingAccount,lt=Aa.allFundingAccounts.find($=>$.id===dt?.accountId),Ce=ae.fetchState,Oa=ae.creditAccount,Da=r.useCallback(()=>o===!0&&L===!0&&Ce==="Completed"&&ne.getCardPolicyPopupSeen(m.tenantEmailDomain??"")!==!0,[o,L,Ce,m.tenantEmailDomain]),[ut,Ua]=r.useState(Da);r.useEffect(()=>{Ua(Da())},[Da]);const ja=()=>{ne.saveCardPolicyPopupSeen(m.tenantEmailDomain??"",!0),Ua(!1)},Ma=Ce==="Completed"&&!ae.hasCreditCard&&!ae.hasDebitCard;ro({isDataReady:Ce==="Completed",pageContext:Ma?"cards_creation":"cards"});const{creditAccountRepayment:G}=i($=>da($)),he=i($=>qa($).firstViewAfterActivation),{areTenantIdsInSync:Le}=fr(),Ve=Ut(o,ha),He=Ba(E,ee,o,Oa,G),Ge=jt(I,b,o,ta,ae.debitCardSummary),$e=Je(E,I,b,ee),na=ae.creditAccount.balance.amount+ae.creditAccount.hold.amount;if(r.useEffect(()=>{Ce==="Completed"&&(ne.getPayNowInfoTooltip()==null||na<q*ae.creditAccount.limit.amount/100)&&u(!0)},[Ce,q,na,ae.creditAccount.limit.amount]),r.useEffect(()=>{if(e!=null&&e===!0&&G.initiatedRepayments.amount===0&&G.fetchState==="Completed"||oe==="In-Progress"&&me.updateStatus==="Completed")u(!1),g(!0);else if(G.initiatedRepayments.amount>0&&G.fetchState==="Completed"){g(!1),document.body.style.overflow="auto";const $=aa(m.tenantEmailDomain);s($)}},[e,G.initiatedRepayments.amount,G.fetchState,oe,me.updateStatus,s,m.tenantEmailDomain]),r.useEffect(()=>{!j&&(ee||b)&&Le&&(F(!0),t(ca(T,I&&b,E&&ee,!1)))},[j,T,t,Le]),r.useEffect(()=>{he&&C===!1&&(B(!0),setTimeout(()=>{t(Ya())},5e3))},[he,C]),r.useEffect(()=>()=>{Et.flush()},[]),r.useEffect(()=>{Ce==="Completed"&&l&&ae.cards.length===1&&(ae.cards[0].status.code==="inactive"&&ae.cards[0].type.code==="business_physical_credit_card"?s(`./${ae.cards[0].id}/activate`):ae.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ae.cards[0].id}`)))},[Ce,l,a.state,s,ae.cards]),r.useEffect(()=>{if(Ce==="Completed"&&l){const $=ae.cards.length,Oe=ae.cards.filter(Ke=>Ke.cardHolderUserId===w?.userId).filter(Ke=>Ke.status.code==="request_on_hold");Oe.length>0&&$===Oe.length&&s("./onboard")}},[Ce,ae.cards,l,s,w?.userId]),r.useEffect(()=>{Ce!=="Completed"||E&&G.fetchState!=="Completed"||I&&b&&o&&ta.fetchState!=="Completed"||J.trackCardsCardListView(K,$e,Ve,He,Ge)},[Ce,Oa,G.fetchState,ta.fetchState,o]),w==null)throw Error("Can't access charge card list page without signing in...");const Vr=i($=>er($.userState,$.userRoleState,$.userListViewState,"cardAdmin")),Wt=Tt(X?.loggedInUserRoleMap),Zt=$=>{h($)},Hr=ae.creditAccount.limit,Gr=()=>{g(!1),s("..")},$r=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:E,isTOSAccepted:Se,isSetupEnabled:ee,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),zr=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:I,isTOSAccepted:ge,isSetupEnabled:b,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Yr=$r||zr,Kt=function($){const{isEmptyCardsState:Oe,isChargeCardAdmin:Ke,isFileUploadEnabled:Qt}=$,Jt=de(),Na=pe(),{tenantEmailDomain:Va}=Me(),{isAiCfoOpen:qr,setIsAiCfoOpen:Xt}=ur(),Qr=mr(),Jr=Cr(),en=i(be=>Ln(be)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:an,isResolved:tn}=Pr("cards_creation"),nn=r.useMemo(()=>_r(an,tn,3),[an,tn]),[Ha,mt]=r.useState(""),rn=Jr&&Qr&&Va!=null&&!qr,fa=r.useCallback(be=>{if(Va==null)return;const Xr=ye(Na.state?.pathnameStackToGoBack,Na.pathname);Jt(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Xr,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})},[Na.pathname,Na.state,Jt,Va]),sn=r.useCallback(be=>{be.trim().length!==0&&(mt(""),fa(be))},[fa]),cn=r.useCallback(()=>{const be=Ha.trim();be.length!==0&&(mt(""),fa(be))},[Ha,fa]),on=r.useCallback(()=>{},[]),dn=r.useCallback(be=>{mt(be)},[]),ln=r.useCallback(()=>{Xt(!0)},[Xt]),un=r.useCallback(()=>{fa(void 0)},[fa]);return r.useMemo(()=>{if(rn&&Oe&&Ke)return{aiAgentName:ci,headline:ri,subheadline:si,promptChips:nn,composer:{currentInput:Ha,isSubmitting:en,isFileUploadEnabled:Qt,onInputChange:dn,onSubmit:cn,onStopSubmit:on},onPromptClick:sn,onOpenSidePanel:ln,onOpenFullView:un,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,rn,Ke,Oe,Qt,en,dn,un,ln,sn,on,cn,nn])}({isEmptyCardsState:Ma,isChargeCardAdmin:o,isFileUploadEnabled:O}),qt=z&&Kt!=null?c.jsx(pr,{...Kt}):null,Wr=f&&qt==null,Zr=ea(m),Kr={events:Ca(Zr,Ur),eventCallback:($,Oe,Ke)=>{Ke.onEventReceived($)},onSubscribed:$=>{$.onPusherSubscribed()}};return ee||b?c.jsxs(c.Fragment,{children:[Ce==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Lt,{analytics:J,onLoad:()=>{J.trackPageLoaded(gr.Event.cardsListPage),(E&&!ee||I&&!b)&&J.trackCardsPromoView(K,{isCreditCardOffered:E,isDebitCardOffered:I,isDebitCardEnabled:b,isCreditCardEnabled:ee},"Banner",I&&!b?"Debit Card":E&&!ee?"Credit Card":"","Card List")}}),c.jsx(nt,{showConfetti:he})]}):null,y===!0?c.jsx($t,{closeDrawerHandler:Gr,isPaymentDrawerOpen:y,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:na,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isDebitCardInfoFetchStateCompleted:!(I&&b&&o)||ta.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||G.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!o||ha.fetchState==="Completed",paymentInitiatedDate:G.initiatedRepaymentDate}):null,c.jsxs(ii,{children:[c.jsx(Ie,{isAppContentDrawerOpen:x,handleDrawerToggle:Zt}),c.jsx(di,{...Kr,isCashbackFeatureEnabled:k,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:S,creditCardPayNowThreshold:q,signedInUser:w,chargeCardListState:ae,location:a,admins:Vr.users,navigateAndClearBulkSelection:s,currentTenant:m,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:m.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:o,includeCreditAccountDebitSummaryAndCashbackInfo:T,onClickMenuIcon:()=>{Zt(!0)},creditLimit:Hr,isChargeCardSetupEnabled:ee,isDebitCardSetupEnabled:b,isEarlyPayEnabled:p,isChargeCardPaymentHistoryFeatureEnabled:M,cashbackRate:re,controllerEmails:K,chargeCardCashbackDetailState:ha,depositAccountListWithDebitCardIssued:ta,isChargeCardTOSAccepted:Se,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:lt,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isAiCfoAccessEnabled:Wr,onAskAiCfoClick:v,isCardsCommentingEnabled:V,cardsAiCfoHero:qt,onClickPolicyIcon:o&&L?()=>n(Ci(m.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ut,onPolicyIntroTooltipClose:ja,pendingCreationCount:We})]})]}):(Se||ge)&&o===!0?c.jsx(ba,{to:"../setup"}):Yr?c.jsx(ba,{to:"../promo"}):c.jsx(va,{fetchState:Ce})}const li=e=>`/${e}/cards/new`,ui=e=>`/${e}/cards/payment`,mi=e=>`/${e}/cards/payment-history`,Ci=e=>`/${e}/cards/policy`,jr=[Br,Rr],pi=new Set(jr),hi=De(function(e){const n=ne.getSignedInUser(),t=fe(e),a=e.tenantState.currentTenantId,s=ar(e),y={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},g=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:hc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:y,companyName:g,spendManagementEndPoint:`${It}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=_e(t.state?.pathnameStackToGoBack),y=s.poppedPathname??"..";a(y,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,y)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:y}}})},onFiltersChange:s=>{e(gc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{pi.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(fc({uiState:{downloadState:s}}))}}})(st(co));function fi(){const e=de(),n=pe(),t=ue(),{areTenantIdsInSync:a}=fr(),{useFeatureGate:s}=le();if(ne.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const y=i(o=>fe(o)),g=i(o=>ar(o)),[S,_]=r.useState(!1),[u,C]=r.useState(!1),[B,w]=r.useState(!1),[m,j]=r.useState(null),F=!y.userRole.includes("charge_card_user"),x=!!y.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=s(W.isChargeCardFeatureEnabled),{isFeatureEnabled:f}=s(W.isDebitCardFeatureEnabled),v=Te(f,y),l=xe({isDebitCardFeatureEnabled:f,isBankingOnlyTenant:v}),T=we(y),b=ve(y),U=y.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=Be({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:h,isBookKeepingTenant:b,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:U}),k=!!y.companyChargeCardInfo?.info?.isChargeCardEnabled,R=Fe(),d=Pe(R?.loggedInUserRoleMap),p=i(o=>ua(o,F,l&&x,D&&k)),M=r.useMemo(()=>{const o=p.cards.filter(A=>A.type.code.includes("debit"));return[...new Set(o.map(A=>A.connectedAccountId))]},[p.cards]),V=i(o=>la(o)),O=i(o=>tt(o,M)),{creditAccountRepayment:L}=i(o=>da(o)),z=r.useMemo(()=>Ut(d,V),[d,V]),H=r.useMemo(()=>Ba(D,k,d,p.creditAccount,L),[D,k,d,p.creditAccount,L]),I=r.useMemo(()=>jt(l,x,d,O,p.debitCardSummary),[l,x,d,O,p.debitCardSummary]),P=r.useMemo(()=>Je(D,l,x,k),[D,l,x,k]),Y=p.creditAccount.balance.amount+p.creditAccount.hold.amount,Q=r.useMemo(()=>m!=null?g.repaymentHistory.find(o=>o.cardRepaymentId===m):void 0,[m,g.repaymentHistory]),E=r.useCallback(o=>{j(o),t(ca(F,l&&x,D&&k,!1)),w(!0)},[t,F,l,x,D,k]),N=r.useCallback(()=>{w(!1),j(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{S||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(_(!0),t(Ga()))},[S,t,g.fetchState]),r.useEffect(()=>{!u&&(k||x)&&a&&(C(!0),t(ca(F,!1,D&&k,!1)))},[u,k,x,a,t,F,D]);const Z=ea(y),X={events:Ca(Z,jr),eventCallback:(o,A,K)=>{K.onEventReceived(o)},onSubscribed:o=>{o.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[B?c.jsx($t,{closeDrawerHandler:N,isPaymentDrawerOpen:B,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:Y,productInformation:P,creditAccountInformation:H,debitAccountInformation:I,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(l&&x&&d)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!D||L.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||V.fetchState==="Completed",paymentInitiatedDate:L.initiatedRepaymentDate,retryRepayment:Q}):null,c.jsx(hi,{...X,location:n,navigate:e,accountInfoByAccountId:g.accountInfoByAccountId,onRetryPaymentClick:E})]})}const bn=Ne.div`
|
|
26
|
-
display: flex;
|
|
27
|
-
height: 100vh;
|
|
28
|
-
width: 100%;
|
|
29
|
-
flex: 1 1 auto;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
overflow: auto;
|
|
32
|
-
align-items: center;
|
|
33
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,yn=Xe.getLocalizedStrings().months;function gi(){const e=de(),n=ue(),t=pe(),{creditAccount:a,creditAccountRepayment:s}=i(P=>da(P)),y=`${hr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[g,S]=r.useState(!1),[_,u]=r.useState(!1),C=i(P=>Sc(P)),{useFeatureGate:B}=le(),w=i(P=>fe(P)),{isFeatureEnabled:m}=B(W.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=B(W.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=B(W.isCardsCommentingEnabled),x=Er(F?w.companyId:void 0,{clearParams:F&&C.fetchState==="Completed"}),h=Te(j,w),f=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:h}),v=we(w),l=ve(w),T=w.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,b=Be({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:m,isBookKeepingTenant:l,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:T}),U=!!w.companyDebitCardInfo?.info?.isDebitCardEnabled,D=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,k=i(P=>oa(P,w.companyId)),R=ia(k.controllers),d=i(P=>tr(P)),p=d.cards.filter(P=>P.type.code.includes("debit")).map(P=>P.connectedAccountId),M=[...new Set(p)],V=i(P=>tt(P,M)),O=i(P=>bc(P));r.useEffect(()=>{_||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(S(!0),n(Qe()))},[g,n,a.fetchState]),r.useEffect(()=>{_||a.fetchState!=="Completed"||a.id==null||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(u(!0),n(yc(a.id)))},[_,n,a.fetchState,a.id,C.fetchState]),r.useEffect(()=>{V.fetchState!=="Completed"&&V.fetchState!=="In-Progress"&&f&&U&&n(nr()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&n(je()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&f&&U&&n(Ic()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&b&&D&&n(wt())},[V.fetchState,f,U,d.fetchState,O.fetchState,s.fetchState,b,D]),r.useEffect(()=>{if(C.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&d.fetchState==="Completed"&&(!f||!U||V.fetchState==="Completed"&&O.fetchState==="Completed")){let P="",Y="";if(C.statements.length>0){const Z=C.statements[C.statements.length-1].period,[X,o]=Z.split("-"),A=C.statements[0].period,[K,re]=A.split("-");P=`${yn[parseInt(o)-1]} ${X}`,Y=`${yn[parseInt(re)-1]} ${K}`}const Q=Je(b,f,U,D),E=Ba(b,D,!0,a,s),N=jt(f,U,!0,V,O);J.trackCardsCreditCardStatementsView(R,Q,{numberOfStatements:C.statements.length,oldestStatementMonthYear:P,latestStatementMonthYear:Y},E,N)}},[C.fetchState,a.fetchState,s.fetchState,V.fetchState,d.fetchState,O.fetchState]);const L=()=>{const P=_e(t.state?.pathnameStackToGoBack),Y=P.poppedPathname??"..";e(Y,{state:{pathnameStackToGoBack:P.newStack}})},z=i(P=>la(P)),H=ne.getSignedInUser(),I={userId:H?.userId??"",sessionId:H?.zeniSessionId??"",tenantId:w.tenantId??""};if(H==null)throw Error("Can't access address page without signing in...");if(C.fetchState!=="Completed")return c.jsx(bn,{children:c.jsx(oo,{onBackClick:L})});{const P=Je(b,f,U,D);return c.jsx(bn,{children:c.jsx(io,{currentTenantCompanyName:w.companyName,statementListView:C,productInformation:P,onBackClick:L,authParams:I,controllerEmails:R,isChargeCardFeatureEnabled:b,isDebitCardFeatureEnabled:f,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:D,isCardsCommentingEnabled:F,initialOpenThreadRequest:x,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:V,debitCardSummary:O,downloadEndPoint:y})})}}const Mr=[ma,it],Si=new Set(Mr),bi={containerWidth:new Fa(100,58)},yi=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),s=pe(),{useDynamicConfig:y}=le(),[g,S]=r.useState(!1),[_,u]=r.useState(!1),[C,B]=r.useState(!1),[w,m]=r.useState(!1),j=r.useRef(!1),F=r.useRef(null);r.useEffect(()=>()=>{F.current!=null&&(clearTimeout(F.current),F.current=null)},[]);const[x,h]=r.useState(!1),[f,v]=r.useState(!1),l=ne.getSignedInUser();if(l==null)throw Error("Can't access onboarding card page without signing in...");const T=i(N=>fe(N)),{configValue:b}=y(Ye.zeniCardsConfig),U=i(N=>kc(N)),{tenantEmailDomain:D}=T,k=i(N=>N.settingsViewState.profile.fetchState),R=i(N=>N.chargeCardListState.fetchState),d=i(N=>N.settingsViewState.profile.userId),p=i(N=>N.chargeCardConfigState.fetchState);r.useEffect(()=>{g===!1&&k!=="In-Progress"&&k!=="Completed"&&(t(Ec()),S(!0)),_===!1&&p!=="In-Progress"&&p!=="Completed"&&(t(Qa()),u(!0)),C===!1&&R==="Not-Started"&&(B(!0),t(je()))},[g,C,R,_,p]),r.useEffect(()=>{k==="Completed"&&x===!1&&d!=null&&R==="Completed"&&U.cards.length>0&&(t(Ac({userId:d})),t(rr({cardId:U.cards[U.cards.length-1].id})),h(!0))},[k,x,d,R]),r.useEffect(()=>{if(!w&&U.fetchState==="Completed"&&U.cards.length===0){const N=_e(s.state?.pathnameStackToGoBack),Z=N.poppedPathname??aa(D);a(Z,{state:{pathnameStackToGoBack:N.newStack}})}},[U.fetchState,U.cards,w]);const M=i(N=>qa(N)),V=ya(M.updateStatus.fetchState),O=M.currentDisplayedCardId,{useFeatureGate:L}=le(),{isFeatureEnabled:z}=L(W.isChargeCardFeatureEnabled),H=!!T.companyChargeCardInfo?.info?.isChargeCardEnabled,I=!T.userRole.includes("charge_card_user")&&z&&H,P=i(N=>O!=null?sr(N.chargeCardState,O):null),Y=()=>{O!=null&&(j.current=!0,F.current!=null&&clearTimeout(F.current),F.current=setTimeout(()=>{j.current=!1,F.current=null},5e3),t(ka(O,I,!0)),t(je(!0)),m(!0))},Q=ea(T);Mt({events:Ca(Q,Mr),onSubscribed:()=>{t(je(!0))},onEvent:(N,Z)=>{if(!Si.has(N))return;const X=zt(Z),o=j.current;if(N===ma){const K=ie(X?.card_id)??O;if(K!=null){const re=Yt(X,K);if(re!=null)return t(vt(re)),void(K!==O||o||Y())}}if(N===it)return void t(je(!0));const A=ie(X?.card_id)??O;(O==null||A===O)&&O!=null?o||Y():t(je(!0))}}),r.useEffect(()=>{if(w&&O!=null&&P!=null&&P.status.code!=="request_on_hold"){const N=Ae(T.tenantEmailDomain,O,l,P),Z=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Dc()),P?.type.code==="business_virtual_credit_card"&&t(Ja()),a(N,{state:{pathnameStackToGoBack:Z},replace:!0}),j.current=!1,F.current!=null&&(clearTimeout(F.current),F.current=null)}},[w,P?.status.code]),r.useEffect(()=>{V==="In-Progress"&&M.updateStatus.fetchState==="Completed"&&setTimeout(Y,3e3)},[V,M.updateStatus.fetchState]);const E=N=>{v(N)};if(k!=="Completed"||U.cards.length===0)return c.jsxs(In,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:E}),c.jsx(lo,{})]});if(d==null)throw Error("Can't access my userId.");return c.jsxs(In,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:E}),c.jsx(Ii,{chargeCardListView:U,cardUserOnboardingView:M,navigate:a,currentTenant:T,myUserId:d,location:s,chargeCardCashbackRatePerTransaction:b.charge_card_cashback_rate_per_transaction!=null?b.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{E(!0)}}),e!=null?c.jsx(ki,{windowSize:n,children:e}):null]})},Ii=De(function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const y=ua(e,!1,!1,!1);let g=!1;return y.fetchState==="Completed"&&y.cards.length<=1&&(g=!0),{cards:a.cards,showMenuIcon:g,companyLegalName:n.companyName,twoFAView:t.twoFAView,cardUserOnboardingLocalData:t.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:t.isDOBPresent,onboardingProgressStatus:t.onboardingProgressStatus}},function(e,n){const{navigate:t,cardUserOnboardingView:a,location:s,currentTenant:y}=n,{tenantEmailDomain:g}=y;return{updateCardUserOnboardingLocalData:S=>{e(pn({localData:S}))},onGetOtp:S=>{if(a.cardUserOnboardingLocalData!=null){const _={...a.cardUserOnboardingLocalData,phone:S};e(pn({localData:_}))}e(at(S,"CardUserOnboarding"))},onResendOtp:S=>{e(et(S,"CardUserOnboarding"))},onVerifyOtp:(S,_)=>{e(Xa(S,_,"CardUserOnboarding"))},onVerifyOtpSuccess:S=>{e(_c()),S!=null&&ne.saveZeniOtpToken(S)},setCurrentDisplayedCardId:S=>{e(rr({cardId:S}))},onBackClick:()=>{const S=_e(s.state?.pathnameStackToGoBack),_=S.poppedPathname??aa(g);t(_,{state:{pathnameStackToGoBack:S.newStack}})}}})(uo),ki=Ne.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
width: ${e=>`${bi.containerWidth.value(e.windowSize)}%`};
|
|
38
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
39
|
-
`,In=Ne.div`
|
|
40
|
-
display: flex;
|
|
41
|
-
min-height: 100%;
|
|
42
|
-
width: 100%;
|
|
43
|
-
flex: 1 1 auto;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
align-items: center;
|
|
46
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,Ei={containerWidth:new Fa(100,58)},Ai=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),{cardId:s}=Me(),y=pe(),{useDynamicConfig:g,useFeatureGate:S}=le(),[_,u]=r.useState(!1),[C,B]=r.useState(!1),[w,m]=r.useState(!1),[j,F]=r.useState(!1),x=ne.getSignedInUser();if(x==null)throw Error("Can't access onboarding card page without signing in...");const h=i(I=>fe(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:f}=g(Ye.zeniCardsConfig),v=i(I=>Pc(I,s)),{isFeatureEnabled:l}=S(W.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=S(W.isDebitCardFeatureEnabled),b=Te(T,h),U=xe({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:b}),D=we(h),k=ve(h),R=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,d=Be({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:l,isBookKeepingTenant:k,isDebitCardProductVisible:U,chargeCardsCreditAccountLimit:R}),p=v.chargeCard,M=i(I=>I.chargeCardConfigState.fetchState);r.useEffect(()=>{_===!1&&M!=="In-Progress"&&M!=="Completed"&&(t(Qa()),u(!0)),C===!1&&v.fetchState==="Not-Started"&&(B(!0),t(ka(s,!1,d)))},[C,v.fetchState,_,M]);const V=p?.type.code==="business_physical_debit_card"||p?.type.code==="business_virtual_debit_card";r.useEffect(()=>{if(v.fetchState==="Completed"){if(w===!1&&(V===!1||V&&p.status?.code!=="active"||V&&p.status.code==="active"&&p.isPinSet||p.cardHolderUserId!==x.userId)){const I=Ae(h.tenantEmailDomain,s,x,p,!0),P=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:P}})}else if(w&&v.isRefreshingViewInBackground===!1&&p?.isPinSet===!0){t(wc({chargeCardId:s}));const I=Ae(h.tenantEmailDomain,s,x,p,!0),P=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:P}})}}},[v.fetchState,p?.type.code,w,v.isRefreshingViewInBackground]);const O=ne.getZeniOtpTokenForCardHolder(s),L=i(I=>jn(I.userState,x.userId)),z=()=>{p?.isPinSet!==!0&&t(ga(s,!0))};r.useEffect(()=>{v.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),m(!0))},[v.updateDebitCardPinAttemptFetchState.fetchState]);const H=I=>{F(I)};if(M!=="Completed"||p==null)return c.jsx(va,{fetchState:"In-Progress"});if(L?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Pi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:j,handleDrawerToggle:H}),c.jsx(Di,{cardId:s,card:p,phone:L.phone,signedInUser:x,isSandboxEnv:Bt(),debitCardDetailState:v,signedInUserToken:O,navigate:a,currentTenant:h,location:y,chargeCardCashbackRatePerTransaction:f.charge_card_cashback_rate_per_transaction!=null?f.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{H(!0)}}),e!=null?c.jsx(_i,{windowSize:n,children:e}):null]})},Di=De(function(e,{debitCardDetailState:n,cardId:t}){const a=Mn(e,t),s=n.updateStatus,y=ua(e,!1,!1,!1);let g=!1;return y.fetchState==="Completed"&&y.cards.length<=1&&(g=!0),{showMenuIcon:g,vgsVaultId:rt.cardVaultId,twoFAView:a,setPinWaitStatus:s}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,debitCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:_}=y;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:u=>{e(Yn(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&ne.saveZeniOtpTokenForCardHolder(u,a)},onSetPinSuccess:()=>{e(vc({chargeCardId:a}))},onBackClick:()=>{const u=_e(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("activate")===!0?aa(_):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(mo),_i=Ne.div`
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
width: ${e=>`${Ei.containerWidth.value(e.windowSize)}%`};
|
|
51
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
52
|
-
box-shadow: ${e=>`${Wa.sp0} 2px ${Wa.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
53
|
-
`,Pi=Ne.div`
|
|
54
|
-
display: flex;
|
|
55
|
-
min-height: 100%;
|
|
56
|
-
width: 100%;
|
|
57
|
-
flex: 1 1 auto;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
align-items: center;
|
|
60
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
61
|
-
box-shadow: ${e=>`${Wa.sp0} 2px ${Wa.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
62
|
-
`,wi={overlayWidth:new Fa(Ct[12],Ct[12],Ct[9])},vi=De(function(e,n){const t=Ft(e,!1,!1),a=n.lineId,s=t.customAddress[a],y=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:y,lineId:a}},function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:y=>{t!=null&&e(cr(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const g=_o(y);e(xc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:g})),e(Bc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Fc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Co),Ti=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Rt(),s=Ta(),y=()=>{n()},g=i(S=>Tc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S))?.newAddressId;return c.jsx(Sr,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:wi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,_)=>(_==="backdropClick"||_==="escapeKeyDown")&&y(),children:c.jsx(vi,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:y,lineId:e,chargeCardTypeOption:t,newCustomAddressId:g})})},Fi=De(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S}=n,_=Ft(e,t&&g,a&&S);return{issueChargeCards:_,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S,cardHolderCandidates:_.userList.map(u=>u.user).filter(Boolean),allRoles:_.userList.map(u=>u.userRole),allAccountingClasses:_.allAccountingClasses,userList:_.userList}},function(e,n){return{onIssueCardClick:()=>{e(Oc())},onSaveChangesToLocalStore:t=>{e(Lc(t))},onDismissClick:()=>{e(or()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(cr(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(fo);function xi(){const e=ne.getSignedInUser(),n=de(),t=ue(),a=po(),[s]=kn(),y=s.get("cardType"),{useFeatureGate:g}=le(),{isFeatureEnabled:S}=g(W.isIssuePhysicalCardEnabled),{isFeatureEnabled:_}=g(W.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:u}=g(W.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(W.isChargeCardFeatureEnabled),B=i(z=>fe(z)),w=Te(u,B),m=xe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:w}),j=we(B),F=ve(B),x=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=Be({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:C,isBookKeepingTenant:F,isDebitCardProductVisible:m,chargeCardsCreditAccountLimit:x}),[f,v]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect(()=>{f||(v(!0),t(Rc(m&&T,h&&l,!1)))},[f,v,t]);const l=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,T=!!B.companyDebitCardInfo?.info?.isDebitCardEnabled,b=i(z=>Ft(z,h&&l,m&&T)),U=b.fetchState,D=b.issueCardStatus.fetchState,k=b.lastSelfIssuedDebitCardId,R=i(z=>k!=null?sr(z.chargeCardState,k):void 0),[d,p]=r.useState(null),[M,V]=r.useState(null),O=()=>{p(null)},L=(z,H)=>{p(z),V(H)};return r.useEffect(()=>{if(D==="Completed"){if(k!=null&&R?.type.code==="business_virtual_debit_card"){let z;z=R?.status.code==="request_on_hold"&&e.userId===R.cardHolderUserId?kr(B.tenantEmailDomain):Ae(B.tenantEmailDomain,k,e,R),n(z)}else n("../");t(or())}},[D,k]),U==="Completed"?c.jsxs(c.Fragment,{children:[d!==null&&M!==null?c.jsx(Ti,{closeDrawerHandler:O,lineId:d,chargeCardTypeOption:M}):null,c.jsx(Fi,{themeState:a,isIssuePhysicalCardEnabled:S,isIssuePhysicalDebitCardEnabled:_,isDebitCardFeatureEnabled:m,isChargeCardFeatureEnabled:h,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:T,navigate:n,fetchState:b.fetchState,openAddAddressDrawerHandler:L,defaultCardType:y==="creditCard"||y==="debitCard"?y:void 0})]}):U==="Error"?c.jsx(ct,{}):c.jsx(ho,{})}const Nr=[ma,it],Bi=new Set(Nr),Ri=Ne.div`
|
|
63
|
-
display: flex;
|
|
64
|
-
height: 100vh;
|
|
65
|
-
width: 100%;
|
|
66
|
-
flex: 1 1 auto;
|
|
67
|
-
flex-direction: column;
|
|
68
|
-
overflow: auto;
|
|
69
|
-
align-items: center;
|
|
70
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,Li=De(function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:y,myPendingActivationChargeCardListState:g}=n,{tenantEmailDomain:S}=a,{cards:_}=g;return{onChargeCardRowClick:u=>{const C=Ir(_,u),B=Ae(S,u,y,C),w=ye(s.state?.pathnameStackToGoBack,s.pathname);t(B,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(u,C)=>{e(bt({uiState:{sortKey:u,sortOrder:C}}))},onReloadCards:()=>{e(je())},onBackClick:()=>{const u=a.userRole.includes("charge_card_user");e(bt({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(go);function Oi(){const e=de(),n=ue(),t=pe(),a=Rt(),[s,y]=r.useState(!1),g=i(L=>Uc(L)),S=i(L=>fe(L)),_=i(L=>oa(L,S.companyId)),u=ia(_.controllers),{useFeatureGate:C}=le(),{isFeatureEnabled:B}=C(W.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(W.isDebitCardFeatureEnabled),m=Te(w,S),j=xe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:m}),F=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,x=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,h=Fe(),f=we(S),v=ve(S),l=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Be({isCardsOnlyTenant:f,isChargeCardFeatureEnabled:B,isBookKeepingTenant:v,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:l}),b=Pe(h?.loggedInUserRoleMap),U=i(L=>la(L)),{creditAccount:D,creditAccountRepayment:k}=i(L=>da(L)),R=i(L=>tr(L)).cards.filter(L=>L.type.code.includes("debit")).map(L=>L.connectedAccountId),d=[...new Set(R)],p=i(L=>tt(L,d));r.useEffect(()=>{s||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(y(!0),n(je()),n(Qa()))},[s,n,g.fetchState]),r.useEffect(()=>{if(g.fetchState==="Completed"&&g.cards.length===1&&M!=null){const L=Ae(S.tenantEmailDomain,g.cards[0].id,M,g.cards[0]);e(L,{state:{message:t.state?.message}})}},[g.fetchState,g.cards]);const M=ne.getSignedInUser();r.useEffect(()=>{D.fetchState!=="Completed"&&D.fetchState!=="In-Progress"&&T&&x&&b&&n(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&b&&n(wt()),p.fetchState!=="Completed"&&p.fetchState!=="In-Progress"&&j&&F&&b&&n(nr())},[D.fetchState,k.fetchState,n,p.fetchState,j,F,b,T,x]);const V=ea(S);if(Mt({events:Ca(V,Nr),onEvent:(L,z)=>{if(!Bi.has(L))return;const H=zt(z);if(L===ma){const I=ie(H?.card_id);if(I!=null){const P=Yt(H,I);if(P!=null)return void n(vt(P))}}n(je(!0))},onSubscribed:()=>{n(je(!0))}}),M==null)throw Error("Can't access address page without signing in...");const O=g.cards!=null&&g.cards.length>0;if(g.fetchState==="Completed"||O){const L=Je(T,j,F,x);return c.jsx(Ri,{children:c.jsx(Li,{navigate:e,currentTenant:S,signedInUser:M,productInformation:L,myPendingActivationChargeCardListState:g,isChargeCardFeatureEnabled:T,isDebitCardFeatureEnabled:j,isDebitCardSetupEnabled:F,isChargeCardSetupEnabled:x,chargeCardCashbackDetailState:U,creditAccount:D,creditAccountRepayment:k,depositAccountListWithDebitCardIssued:p,controllerEmails:u,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const Ui=De(function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:g,signedInUser:S,location:_,productInformation:u,isEarlyPayEnabled:C,controllerEmails:B,chargeCardsCreditAccountLimit:w}=n;return{onSetupButtonClick:m=>{if(S!=null&&J.trackCardsPromoPageClicked("enable cards"),s)switch(J.trackCardsEnableCardsClick(B,u,"Cards Promo"),m){case"credit":e(qe(a,!0,"charge_cards",C,!1));break;case"debit":e(qe(a,!0,"debit_cards",C,!1));break;case"debit_and_credit":e(w===0?qe(a,!0,"debit_cards",C,!0):qe(a,!0,"charge_cards__debit_cards",C,!1))}else switch(J.trackCardsSetupCardsClick(B,u,"Cards Promo"),m){case"credit":e(qe(a,!1,"charge_cards",C,!1));break;case"debit":e(qe(a,!1,"debit_cards",C,!1));break;case"debit_and_credit":e(w===0?qe(a,!1,"debit_cards",C,!0):qe(a,!1,"charge_cards__debit_cards",C,!1))}},onBackClick:()=>{const m=_e(_.state?.pathnameStackToGoBack);let j=m.poppedPathname;j==null&&(j=y||g?"..":"../.."),t(j,{state:{pathnameStackToGoBack:m.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Ja()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Nc(a))}}})(bo),ji=()=>{const e=de(),{tenantEmailDomain:n}=Me(),[t]=kn(),a=t.get("cardPromoType"),s=ue(),{useDynamicConfig:y,useFeatureGate:g}=le(),[S,_]=r.useState(!1),{isFeatureEnabled:u}=g(W.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:B}=g(W.isChargeCardFeatureEnabled),{configValue:w}=y(Ye.zeniCardsConfig),m=i(te=>fe(te)),j=i(te=>oa(te,m.companyId)),F=ia(j.controllers),x=w.charge_card_cashback_rate_per_transaction!=null?w.charge_card_cashback_rate_per_transaction:.0175,h=pe(),f=ne.getSignedInUserTenant(n)?.companyId??m.companyId,v=i(te=>wa(te,f)),l=v.primaryFundingAccount,T=m.companyBillPayInfo?.info,b=we(m),U=ve(m),D=Te(u,m),k=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=xe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:D}),d=Be({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:B,isBookKeepingTenant:U,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:k}),p=yr({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:B,isBookKeepingTenant:U}),M=R&&d===!1,V=T?.businessVerificationStatus?.code==="verified"&&(M||l?.accType==="depositAccount"||jc(l?.providerVerificationStatus?.code??"")),O=ne.getSignedInUser(),L=!!m.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,H=!!m.company?.companyChargeCardInfo.isChargeCardEnabled,I=!!m.company?.companyDebitCardInfo.isDebitCardEnabled,P=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,Y=te=>{_(te)},Q=i(te=>te.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Fe(),N=Pe(E?.loggedInUserRoleMap),Z=Tt(E?.loggedInUserRoleMap),[X,o]=r.useState(!1),[A,K]=r.useState(!1),[re,q]=r.useState(!1);r.useEffect(()=>{X===!1&&h.state?.message==="activation"&&o(!0)},[h.state]),r.useEffect(()=>{A||Q!=="Not-Started"||f==null||(K(!0),s(Pa(f,!0)))},[A,Q,f,s]);const ke=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:p,isTOSAccepted:z,isSetupEnabled:H,isUserHasCardsAdminLevelAccess:N,isUserHasCardsAccess:Z}),Se=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:R,isTOSAccepted:P,isSetupEnabled:I,isUserHasCardsAdminLevelAccess:N,isUserHasCardsAccess:Z}),ge=R&&Se&&p&&k>=0&&ke?"debit_and_credit":R&&Se?"debit":"credit",ee=Do(a,ge),me=v?.chargeCardTermsDetails?.fetchStatus?.fetchState,oe=r.useRef(null);r.useEffect(()=>{me==="In-Progress"?oe.current=ee:me!=="Error"&&me!=="Not-Started"||(oe.current=null)},[me,ee]);const ae=me!=="In-Progress"&&me!=="Completed"||oe.current==null?ee:oe.current;r.useEffect(()=>{ee==="credit"&&(H||p===!1&&I)||ee==="debit"&&I||ee==="debit_and_credit"&&I&&H?e("../"):(ee==="debit_and_credit"&&z===!0&&P===!0||ee==="credit"&&(z===!0||p===!1&&P===!0)||ee==="debit"&&P===!0)&&N===!0&&e("../setup")},[V,H,I,ee,z,P]),r.useEffect(()=>{re||(s(Mc("cardAdmin")),q(!0))},[re]);const We=i(te=>er(te.userState,te.userRoleState,te.userListViewState,"cardAdmin")),Ee=Je(p,R,I,H);return(ke||Se)&&Q==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Lt,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(gr.Event.cardsPromoPage),!!p&&!H||!!R&&!I||!!p&&!!R&&!I&&!H){const te=Mi({isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:H,isCreditCardProductVisibleForExpressInterest:p,isDebitCardProductVisible:R});J.trackCardsPromoView(F,Ee,"Page",te,"Promo Page")}}}),c.jsx(nt,{showConfetti:X}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:Y}),c.jsx(Ui,{signedInUser:O,location:h,showEnableCardButton:V,isCompanyBusinessVerificationAndPaymentSetUpDone:V,isChargeCardSetupEnabled:H,isDebitCardSetupEnabled:I,companyLegalName:m.companyName,adminList:We.users,isCheckingEnabled:L,navigate:e,companyId:f,cardPromoType:ae,controllerEmails:F,productInformation:Ee,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:u,isEarlyPayEnabled:C,cashbackRate:x,chargeCardsCreditAccountLimit:k,onClickMenuIcon:()=>{Y(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:Y}),c.jsx(So,{})]})},Mi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function ud(){const e=pe(),n=i(E=>fe(E)),{useFeatureGate:t}=le(),{isFeatureEnabled:a}=t(W.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(W.isDebitCardFeatureEnabled),{isFeatureEnabled:y}=t(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:g}=t(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(W.isCardPolicyEnabled),_=Te(s,n),u=xe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:_}),C=yo(n,a,s),B=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,m=!!n.company?.companyChargeCardInfo.isChargeCardEnabled,j=!!n.company?.companyDebitCardInfo.isDebitCardEnabled,F=Fe(),x=Pe(F?.loggedInUserRoleMap),h=Tt(F?.loggedInUserRoleMap),{isFeatureEnabled:f}=t(W.isCashbackFeatureEnabled),v=n.userRole.includes("charge_card_user"),l=!v,T=!v&&m,b=n?.userRole!=null&&Vc(n?.userRole),U=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!b)&&Hc(F?.loggedInUserRoleMap),D=Gc(F?.loggedInUserRoleMap),k=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!b)&&$c(F?.loggedInUserRoleMap),{isFeatureEnabled:R}=t(W.isDepositAccountsFeatureEnabled),d=R&&!b&&Vn(F?.loggedInUserRoleMap),p=m&&!b,M=j&&!b,V=C&&!b&&Pe(F?.loggedInUserRoleMap),O=zc(F?.loggedInUserRoleMap),L=we(n),z=ve(n),H=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Be({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:a,isBookKeepingTenant:z,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:H}),P=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:I,isTOSAccepted:B,isSetupEnabled:m,isUserHasCardsAdminLevelAccess:x,isUserHasCardsAccess:h}),Y=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:u,isTOSAccepted:w,isSetupEnabled:j,isUserHasCardsAdminLevelAccess:x,isUserHasCardsAccess:h}),Q=P||Y;return c.jsxs(es,{children:[x?c.jsx(se,{path:"setup",element:c.jsx(hn,{isBillPayAdminLevelAccess:U,isReimbursementAdminLevelAccess:k,isZeniAccountAdminLevelAccess:d,isChargeCardAdminLevelAccess:V,isUserHasOnlyCardAccess:O,isUserHasOnlyBillPayAccess:D,productType:"charge_cards",type:"setup"})}):null,x?c.jsx(se,{path:"verification",element:c.jsx(hn,{isBillPayAdminLevelAccess:U,isUserHasOnlyBillPayAccess:D,isReimbursementAdminLevelAccess:k,isZeniAccountAdminLevelAccess:d,isChargeCardAdminLevelAccess:V,isUserHasOnlyCardAccess:O,productType:"charge_cards",type:"verification"})}):null,x&&S?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"policy",element:c.jsx(Mo,{})}),c.jsx(se,{path:"policy/new",element:c.jsx(To,{})}),c.jsx(se,{path:"policy/:templateId/edit",element:c.jsx(Ro,{})})]}):null,c.jsx(se,{path:"promo",element:c.jsx(ji,{})}),p||M?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"/",element:c.jsx(Sn,{isPaymentDrawerOpen:!1})}),V&&y?c.jsx(se,{path:"payment",element:c.jsx(Sn,{isPaymentDrawerOpen:!0})}):null,c.jsx(se,{path:"activate",element:c.jsx(Oi,{})}),c.jsx(se,{path:"onboard",element:c.jsx(yi,{})}),x?c.jsx(se,{path:"new",element:c.jsx(xi,{})}):null,f&&l?c.jsx(se,{path:"cashback",element:c.jsx($o,{})}):null,T?c.jsx(se,{path:"statements",element:c.jsx(gi,{})}):null,V&&g&&m?c.jsx(se,{path:"payment-history",element:c.jsx(fi,{})}):null,c.jsx(se,{path:":cardId/activate",element:c.jsx(Wo,{})}),c.jsx(se,{path:":cardId/setPin",element:c.jsx(Ai,{})}),c.jsx(se,{path:":cardId/addToWallet",element:c.jsx(No,{})}),c.jsx(se,{path:":cardId/*",element:c.jsx(ni,{})}),c.jsx(se,{path:"*",element:c.jsx(ct,{})})]}):(B||w)&&x?c.jsx(se,{path:"*",element:c.jsx(ba,{to:"../setup"})}):Q?c.jsx(se,{path:"*",element:c.jsx(ba,{to:"../promo",state:e.state})}):c.jsx(se,{path:"*",element:null})]})}export{ud as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-DC3GaKoW.js";import{a as g}from"./sentry-CuaXjR5n.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-Bv1T7LZC.js";import{z as N,bc as P,w as F,d as j,f as V,af as C,bd as A,au as L,av as U,n as B}from"./index-CVpYlrKc.js";import{eW as D,gj as M,tC as _,ge as G,c6 as R,Pi as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Pj as W,bE as Z,cy as b,mQ as $,mT as J}from"./zeni-epic-state-DuQa9FMz.js";import"./mui-VYhJrGDQ.js";import{d as K}from"./routePaths-DdjVf9j1.js";import{M as X}from"./MobileAppDrawer-CHF9nCsW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="a8ce9541-d9da-4ee8-83c8-7cb8d2326372",t._sentryDebugIdIdentifier="sentry-dbid-a8ce9541-d9da-4ee8-83c8-7cb8d2326372")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(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(W(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(Q({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=T(),i=x(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:j,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-DC3GaKoW.js";import{a}from"./sentry-CuaXjR5n.js";import{u as D,g as v,j as m,N as w}from"./core-Bv1T7LZC.js";import{LS as A,eW as L,g1 as O,o9 as _,gs as E,g0 as j,fz as U,LZ as F}from"./zeni-epic-state-DuQa9FMz.js";import{u as $,z as c,L as C,a as k,o as z}from"./index-CVpYlrKc.js";import{n as H}from"./mui-VYhJrGDQ.js";import{t as R}from"./getLocaleForTenant-DrFh6zlq.js";import{g as P,Q as G}from"./QBOConnectionScreen-_B3wLRiT.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="5f3bc941-31eb-4bc2-ae36-dd15a969f40b",t._sentryDebugIdIdentifier="sentry-dbid-5f3bc941-31eb-4bc2-ae36-dd15a969f40b")}catch{}})();const Q=H.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex: 1 1 auto;
|
|
4
|
-
flex-direction: row;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: center;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100vh;
|
|
9
|
-
background-color: ${t=>t.theme.colors.background};
|
|
10
|
-
box-shadow: ${t=>`0px 2px ${z.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
-
`;function pe(){const t=D(),i=v(),{setLoading:d,clearAllLoading:h}=$(),p=a.useRef(!1),f=a.useRef(!1),{code:x,realmId:S,state:T}=P(i.search),y=x!==""&&S!==""&&T!=="",I=m(l=>A(l)),e=m(l=>L(l)),n=m(l=>l.tenantState.fetchState),r=m(l=>l.tenantState.activeTenantFetchState.fetchState),o=c.getSignedInUser(),u=c.getActiveTenantForUser()?.tenantId,s=e?.externalConnections?.fetchState,b=e?.externalConnections?.saveConnectionState,N=e.externalConnections?.accounting[0]?.isValid;return a.useLayoutEffect(()=>{d(C.CONNECTION_AUTH)},[d]),a.useEffect(()=>{p.current||o==null||u==null||(p.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(C.TENANT_FETCHING),t(O(o.userId,u))))},[p,n,d]),a.useEffect(()=>{e.tenantId==null&&!f.current&&o!=null&&(f.current=!0,!(u==null||u!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(_(o.userId)))},[f,n,r]),a.useEffect(()=>{o==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||b!=="Error"||(d(C.CONNECTION_AUTH),t(E(o.userId,e.tenantId)))},[b]),a.useEffect(()=>{n!=="Completed"&&r!=="Completed"||o==null||e?.tenantId==null||(t(j(e.tenantId)),c.saveActiveTenantDomainForUser(e.tenantEmailDomain),U(o?.userId,o?.zeniSessionId,e.tenantId),k.updateAppLocaleID(R(F(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||o==null||e==null||t(E(o.userId,e.tenantId)))},[n,r,s]),a.useEffect(()=>{I.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&c.saveSignedInUserTenants(I.tenantsCoreDetailsInOrder)},[I.tenantsCoreDetailsInOrder.length,n]),a.useEffect(()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||s!=="Completed"&&s!=="Error"||h()},[n,r,s]),e==null||n!=="Completed"&&r!=="Completed"||s!=="Completed"?null:y||N===!1?g.jsx(Q,{children:g.jsx(G,{})}):g.jsx(w,{to:"/",replace:!0})}export{pe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-DC3GaKoW.js";import{z as n}from"./index-CVpYlrKc.js";import{g as d}from"./QBOConnectionScreen-_B3wLRiT.js";import"./sentry-CuaXjR5n.js";import{g as p,N as s}from"./core-Bv1T7LZC.js";import"./zeni-epic-state-DuQa9FMz.js";import"./recharts-D979ncoh.js";import"./mui-VYhJrGDQ.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-DC3GaKoW.js";import{t as ft,A as Ne}from"./AddressScreen-DZz6iLRi.js";import ht from"./NotFoundScreen-D0AQGcoe.js";import{a as d}from"./sentry-CuaXjR5n.js";import{h as Ce,g as ke,u as H,i as Ie,j as _,N as j,n as Ee,l as yt,o as St,p as K}from"./core-Bv1T7LZC.js";import{r as _e,I as xe,z as G,W as Ae,U as M,s as bt,n as N,w as ce,d as Q,ap as nt,f as ve,aq as Ct,Z as kt,ar as Ge,h as ye,as as It,o as $e,at as ze,au as Et,av as Ke,aw as _t}from"./index-CVpYlrKc.js";import{eW as W,fV as xt,fD as Te,fB as Oe,bs as At,o7 as vt,fR as Tt,bS as Ot,tm as wt,tp as Pt,MR as Dt,MS as Ft,MT as jt,xK as Ut,Et as Bt,ub as Vt,MU as Rt,k9 as Se,kc as at,Mm as Lt,bY as Mt,c6 as ue,tQ as we,tB as Nt,MV as de,tR as ot,Kf as Gt,ld as st,MW as $t,MX as zt,rj as Kt,hq as Qt,Me as me,hn as Zt,Mf as qt,xZ as Ht,rn as Wt,hf as Yt,hi as Qe,MY as it,MZ as Jt,E0 as Xt,M_ as en,E4 as tn,ts as nn,tD as be,M$ as an,N0 as on,k7 as sn,ka as rn,u1 as cn,tP as dn,bE as Ze,cy as un,u0 as qe,rC as ln,rq as pn,l5 as mn,gh as gn,gg as fn,gf as hn,N1 as yn,tv as Sn,u2 as bn,u5 as Cn,u8 as kn,ue as In}from"./zeni-epic-state-DuQa9FMz.js";import{n as Pe}from"./mui-VYhJrGDQ.js";import{g as En,h as _n,q as ae}from"./QBOConnectionScreen-_B3wLRiT.js";import{u as xn}from"./useEmailConnectResultRefresh-DsiaZGrG.js";import{u as An}from"./useChargeCardPusherEvents-FFGUOH8U.js";import{u as vn}from"./plaid-BlhDSPsk.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f7436143-34fa-4dc0-8bd3-56c9e6b55852",t._sentryDebugIdIdentifier="sentry-dbid-f7436143-34fa-4dc0-8bd3-56c9e6b55852")}catch{}})();const Tn=Ee(function(t,s){const n=[];s.isApAgingFeatureEnabled===!1&&n.push("accounts_payable_aging"),s.isArAgingFeatureEnabled===!1&&n.push("accounts_receivable_aging"),s.shouldFetchZeniAccountsPromoCard===!1&&n.push("zeni_accounts_promo_card"),s.shouldFetchRewardsPlanCard===!1&&n.push("rewards_card"),s.isExpenseAutomationEnabledForUser===!1&&n.push("expense_automation_card");const a=Tt(t,n,s.signedInUser,s.isExpenseAutomationFeatureEnabledV2,s.isExpenseAutomationEnabledForUser,s.isTreasuryEnabled);return{dashboardFetchState:Ot(a.reportsInOrder.map(c=>({fetchState:c.fetchState,error:c.error}))).fetchState}},function(t,s){const{themeState:n,navigate:a,location:c}=s;return{onZeniLogoClick:()=>{n.toggle()},onDashboardFetchDone:()=>{const u=N(c.state?.pathnameStackToGoBack,c.pathname);a("../../dashboard",{state:{pathnameStackToGoBack:u,message:"activation"}})}}})(Ct),On=()=>{const t=Ce(),s=ke(),n=H(),a=_e(),[c,u]=d.useState(!1),[y,I]=d.useState(!1),{tenantEmailDomain:e}=Ie(),i=xe(),l=G.getSignedInUser(),{useFeatureGate:p}=Ae(),{isFeatureEnabled:T}=p(M.isApAgingFeatureEnabled),{isFeatureEnabled:r}=p(M.isArAgingFeatureEnabled),{isFeatureEnabled:m}=p(M.isDepositAccountsFeatureEnabled),{isFeatureEnabled:x}=p(M.isReferralFeatureEnabled),{isFeatureEnabled:E}=p(M.isExpenseAutomationEnabledV2),{isFeatureEnabled:g}=p(M.isDebitCardFeatureEnabled),U=bt(),S=_(k=>W(k)),{isFeatureEnabled:P}=p(M.isTreasuryEnabled),V=S.company!=null&&xt(S.company),h=P&&V,b=_(k=>k.onboardingCustomerViewState.fetchState),A=S.excludedResources,B=S.companyId??G.getSignedInUserTenant(e)?.companyId;if(l==null)throw Error("Can't access onboarding flow without signing in...");const D=Te(g,S),v=Oe(S),w=[],Z=A?.resources?.find(k=>k.resource==="/reports/top_expenses")==null,$=A?.resources?.find(k=>k.resource==="/reports/task_card")==null,Y=S?.userRole!=null&&At(S?.userRole),J=A?.resources?.find(k=>k.resource==="/bills")==null&&!Y,z=A?.resources?.find(k=>k.resource==="/reimbursements")==null;if(Z===!1&&w.push("top_expenses"),$===!1&&w.push("task_card"),J===!1&&w.push("bill_pay_card","bill_pay_promo_card"),z===!1&&w.push("reimbursement_card","reimbursement_promo_card"),m===!1&&w.push("zeni_accounts_promo_card"),x===!1&&w.push("rewards_card"),d.useEffect(()=>{b!=="Completed"||c||D||v||(u(!0),n(vt(l.userId,B,S.tenantId,!0,!1,w)))},[c,b,D,v,l,S.tenantId,n]),d.useEffect(()=>{(D||v)&&setTimeout(()=>{I(!0)},5e3)},[D,v]),b!=="Completed")return o.jsx(j,{to:"../"});if(b==="Completed"&&y){const k=N(s.state?.pathnameStackToGoBack,s.pathname);if(D)return o.jsx(j,{to:"../../checking",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}});if(v)return o.jsx(j,{to:"../../cards",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}})}return i?.loggedInUserRoleMap!=null?o.jsxs(o.Fragment,{children:[o.jsx(ce,{analytics:Q,onLoad:k=>(F=>F.trackPageLoaded(ve.Event.onboardingDashboardActivation))(k)}),o.jsx(Tn,{navigate:t,location:s,themeState:a,signedInUser:l,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:r,shouldFetchZeniAccountsPromoCard:m,shouldFetchRewardsPlanCard:x,isExpenseAutomationEnabledForUser:U,isExpenseAutomationFeatureEnabledV2:E,isTreasuryEnabled:h,loggedInUserRoleMap:i?.loggedInUserRoleMap})]}):o.jsx(nt,{})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],He=(t,s)=>{const n=new Map(t.map(a=>[a.key,a]));return s.map(a=>{return c=n.get(a)?.status,c==="starting"||c==="building"?c:"idle";var c})},We=(t,s)=>{if(t.length===0)return!1;const n=new Map(t.map(a=>[a.key,a]));return s.every(a=>n.get(a)?.status==="ready")},wn=new Set(Rt),Ye=Pe.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
5
|
-
`,Je=Pe.div`
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
align-items: center;
|
|
9
|
-
flex: 1;
|
|
10
|
-
min-width: 0;
|
|
11
|
-
|
|
12
|
-
${t=>t.skipLegacyDrawerOffset?`
|
|
13
|
-
width: 100%;
|
|
14
|
-
padding-left: ${$e.sp0};
|
|
15
|
-
`:`
|
|
16
|
-
min-width: calc(100% - ${ze}px);
|
|
17
|
-
padding-left: ${ze}px;
|
|
18
|
-
`}
|
|
19
|
-
|
|
20
|
-
${t=>t.theme.breakpoints.down("md")} {
|
|
21
|
-
width: 100%;
|
|
22
|
-
padding-left: ${$e.sp0};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
${t=>t.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
-
`,Xe=Ee(function(t,s){const{companyId:n,isAdmin:a,currentTenant:c,isOnAddressPage:u}=s,y=G.getSignedInUser(),I=c.tenantId,e={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:I??""},i=W(t),l=we(t,n),p=it(t),T=ue(c?.userRole??[])&&l.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",r=Jt(t.userRoleConfigState);return{onboardingCustomerView:l,analytics:Q,isRefreshingViewInBackground:!1,isDisabled:T,companyTitles:r.companyTitles,connectedAccountProvider:i.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Et.fileMicroServiceBaseUrl,authParams:e},signedInUser:G.getSignedInUser(),currentTenant:i,isAdmin:a,isOnAddressPage:u,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:p,isCardPaymentPopupOpen:!1,stripeKey:ye.stripeKey}},function(t,s){const{companyId:n,currentTenant:a,themeState:c,navigate:u,location:y}=s,{tenantEmailDomain:I}=a;return{onFetchLinkTokenClick:(e,i)=>{t(In(e,i))},onEstablishConnectionClick:(e,i)=>{t(kn(e,i))},onUpdatePaymentAccountStatus:(e,i,l)=>{t(Cn(e,i,l))},onUpdatePaymentAccountLoginStatus:(e,i)=>{t(bn(!1,e,i))},onEstablishConnectionSuccess:()=>{t(Sn(n,!0,!1))},handleOnConnectClick:()=>{Q.trackOnboardingConnectQBO(),ae.handleClick()},updateQBOPopupState:e=>{t(de({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const i=e.map(l=>{const{officerType:p,userId:T,name:r,email:m,ssn:x,nationalityCountryCode:E,dob:g,phone:U,syncToken:S,selectDocument:P,role:V,ownership:h,isSelectedForVerification:b,userVerificationStatus:A,fileIds:B,isPhoneVerified:D}=l;let v;return P.selectDocumentType==="driverLicense"?v="driving_license":P.selectDocumentType==="passport"?v="passport":P.selectDocumentType==="stateId"?v="id_document":P.selectDocumentType==="ssnCard"&&(v="social_security_card"),{officerType:p,userId:T,firstName:r.firstName,lastName:r.lastName,email:m,ssn:x,nationalityCountryCode:E?.selectedOption!=null?Ke(E.selectedOption):void 0,phone:U,birthday:g!=null?Ze(g?.toString()):g,syncToken:S,titleAtCompany:V.selectedOption,ownershipInCompany:h,documentTypeSelectedForVerification:v,isSelectedForVerification:b,userVerificationStatus:A,fileIds:B,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:D}});t(qe({officers:i}))},onGetOtp:(e,i)=>{t(hn(e,"CustomerOnboarding")),i!=null&&t(yn({officerType:i,phone:e}))},onResendOtp:e=>{t(fn(e,"CustomerOnboarding"))},onVerifyOtp:(e,i)=>{t(gn(e,i,"CustomerOnboarding"))},updateFilesEntity:e=>{t(mn({files:e}))},onDeleteFile:e=>{t(pn(e))},onEditFileName:(e,i)=>{t(ln(e,i.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:i,companyIndustry:l,companyIndustryType:p,companyLegalName:T,companyTaxId:r,companyWebsite:m,companyPhone:x,primaryContactEmail:E,primaryContactName:g,primaryContactUserId:U,primaryContactSyncToken:S,syncToken:P,fileIds:V,typeOfIncorporation:h,stateOfIncorporation:b,incDate:A,companySourceOfFunds:B,companySourceOfFundsDescription:D,companySubIndustry:v,countriesOfOperations:w,purposeOfAccount:Z,purposeOfAccountDescription:$,regulatedStatus:Y,regulatedStatusDescription:J,transactionVolume:z,transactionVolumeDescription:k,usNexus:F,usNexusTypes:oe}=e,R={companyId:n,companyDescription:i,companyIndustry:l.selectedOption,companyIndustryType:p?.selectedOption??"",companyLegalName:T,taxIdOrEIN:r,website:m!=""&&m!=null?un(m):void 0,phone:x,syncToken:P,fileIds:V,incDate:A!=null?Ze(A?.toString()):A,typeOfIncorporation:h?.selectedOption??"",stateOfIncorporation:b?.selectedOption??"",companySourceOfFunds:B?.selectedOption??"",companySourceOfFundsDescription:D,companySubIndustry:v?.selectedOption??"",countriesOfOperations:w?.selectedOptions.map(X=>X.length===2?X:Ke(X))??[],purposeOfAccount:Z?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:Y??"",regulatedStatusDescription:J,transactionVolume:z?.selectedOption??"",transactionVolumeDescription:k,usNexus:F,usNexusTypes:oe?.selectedOptions??[]},le={userId:U,firstName:g.firstName,lastName:g.lastName,email:E,syncToken:S};t(qe({companyDetails:R,primaryContactDetails:le}))},onAddressClick:(e,i)=>{const l=tt(I,e,i),p=N(y.state?.pathnameStackToGoBack,y.pathname);u(l,{state:{pathnameStackToGoBack:p}})},onRegisteredAddressClick:(e,i)=>{const l=tt(I,e,i),p=N(y.state?.pathnameStackToGoBack,y.pathname);u(l,{state:{pathnameStackToGoBack:p}})},onUpdateCustomerView:(e,i,l)=>{t(dn(n,!1,i,l,e))},onAddressEditHandler:e=>{if(e!=null){const i=ft(e);t(st({addressType:"subscription_billing_address",addressToCreate:i}))}},onSkipSetupClick:()=>{const e=N(y.state?.pathnameStackToGoBack,y.pathname);t(be(n,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:e}})},onUpdateStep:e=>{t(ot({step:e}))},onUpdateSubStep:e=>{t(cn({subStep:e}))},onZeniLogoClick:()=>{c.toggle()},handleLogOutClick:()=>{const e=N(y.state?.pathnameStackToGoBack,y.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleCreateCardSetupIntent:e=>{t(at(e))},handleConfirmCardSetupIntent:e=>{t(rn(e))},updateCardPaymentModalState:e=>{t(de({isCardPaymentPopupOpen:e}))},handleAddCardPaymentSource:(e,i,l)=>{t(sn(e,i,l))},handleFetchPaymentSources:()=>{t(Se())},resetCardPaymentViewState:()=>{t(on())},handleResetCardPaymentErrorStatuses:()=>{t(an())},redirectToProductSuitePage:()=>{const e=N(y.state?.pathnameStackToGoBack,y.pathname);t(be(n,!1,!1)),u(`/${I}/onboarding/thankyou`,{state:{pathnameStackToGoBack:e,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{n!=null&&t(nn(n))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const i=en(e.documentType);i!=null&&t(tn({target:"onboarding",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:i}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(Xt({target:"onboarding",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}})(It),re=({taxCFOCustomer:t=!1,isOnAddressPage:s=!1,appContent:n})=>{const a=Ce(),c=ke(),u=H(),y=kt(),I=_e(),[e,i]=d.useState(!1),[l,p]=d.useState(!1),[T,r]=d.useState(!1),{tenantEmailDomain:m}=Ie(),x=xe(),{useFeatureGate:E}=Ae(),{isFeatureEnabled:g}=E(M.isDebitCardFeatureEnabled),U=yt("/:tenantEmailDomain/onboarding")!==null&&c.search?.includes("code"),S=_(f=>f.onboardingCustomerViewState.fetchState),P=_(f=>f.onboardingCustomerViewState.currentStep),V=_(f=>f.onboardingCustomerViewState.uiState),h=_(f=>W(f)),b=_(f=>f.userRoleConfigState.fetchState),A=_(f=>f.cardPaymentViewState),B=Ge(A.addCardPaymentSourceStatus.fetchState),D=A.addCardPaymentSourceStatus.fetchState,{code:v,realmId:w,state:Z}=En(c.search),$=h.externalConnections?.accounting[0],Y=$?.connectionType,J=$?.connectionName,z=$?.connectionId??"",k=G.getSignedInUser()?.userId??"";d.useEffect(()=>{l||(p(!0),u(Se()))},[l,u]),d.useEffect(()=>{T||(at(["card"]),r(!0))},[T]),d.useEffect(()=>{B==="In-Progress"&&D==="Completed"&&u(Se())},[B,D]),d.useEffect(()=>{_n(v,w,Z,z,k)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&S==="Completed"&&(u(Lt(h.tenantId,{connection_type:Y??"accounting",connection_name:J??"quickbooks_online",authorization_code:v,realm_id:w,connection_id:z,user_id:k},Mt(window.location.origin+"/onboarding/auth"))),Q.trackOnboardingSaveQBOConnection(w,z),a(c.pathname))},[v,w,Z,c.pathname,S]),d.useEffect(()=>{ae.isInitiated===!1&&S==="Completed"&&ae.init("/onboarding/auth",h.tenantEmailDomain)},[S]);const F=h.companyId??G.getSignedInUserTenant(m)?.companyId,oe=ue(h?.userRole??[]),R=_(f=>we(f,F));d.useEffect(()=>{e||S!=="Not-Started"||F==null||(i(!0),u(Nt(F,!0,!U)))},[e,S,F]),d.useEffect(()=>{h.externalConnections?.saveConnectionState!=="Completed"&&h.externalConnections?.saveConnectionState!=="Error"||!V.isQBOPopupOpen||P!=="connect_ledger"||u(de({isQBOPopupOpen:!1}))},[h.externalConnections?.saveConnectionState]),d.useEffect(()=>{S==="Completed"&&U&&(u(ot({step:"connect_ledger"})),u(de({isQBOPopupOpen:!0})))},[U,S]),d.useEffect(()=>{b==="Not-Started"&&u(Gt(!0))},[b,u]);const le=Ge(R.companyDetailsLocalData?.addressStatus);d.useEffect(()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&le==null&&u(st({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const X=R.isInterimEmailSent,De=G.getSignedInUser();if(De==null)throw Error("Can't access onboarding flow without signing in...");const rt=Te(g,h),ct=Oe(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,je=f=>f.trackPageLoaded(ve.Event.onboardingPage),Ue=h.productSettings.isOtherProductsEnabled,dt=h.productSettings.isTreasuryEnabled,Be=Pn({tenantEmailDomain:m??"",signedInUserEmail:De.userEmail??"",companyId:F}),Ve=(({companyId:f})=>{const L=H(),se=_(O=>O.onboardingCustomerViewState?.aiAgentsActivation),ee=_(O=>W(O).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1),pe=d.useCallback(()=>{L(wt())},[L]);d.useEffect(()=>{pe()},[pe]);const Re=d.useCallback(()=>{f==null||f===""||ee||L(Pt(f))},[f,ee,L]),ut=d.useMemo(()=>{if(f==null||f==="")return[];const O=`private-encrypted-${f}`;return[`${O}.ledger-ingestion.counts-updated`,`${O}.ai-agents-activation.phase-changed`]},[f]),lt=d.useCallback((O,te)=>{if(te==null||typeof te!="object")return;const C=te;if(O!=="ledger-ingestion.counts-updated"){if(O==="ai-agents-activation.phase-changed"){const ie=typeof C.phase_key=="string"?C.phase_key:typeof C.key=="string"?C.key:"",q=typeof C.status=="string"?C.status:"idle";if(ie==="")return;L(Ft({key:ie,status:q==="starting"||q==="building"||q==="ready"?q:"idle",startedAt:typeof C.started_at=="string"?C.started_at:void 0,completedAt:typeof C.completed_at=="string"?C.completed_at:void 0}))}}else L(Dt({customerCount:typeof C.customer_count=="number"?C.customer_count:void 0,glAccountCount:typeof C.gl_account_count=="number"?C.gl_account_count:void 0,targetTransactionCount:typeof C.target_transaction_count=="number"?C.target_transaction_count:void 0,transactionCount:typeof C.transaction_count=="number"?C.transaction_count:void 0,vendorCount:typeof C.vendor_count=="number"?C.vendor_count:void 0}))},[L]);return An({events:ut,onEvent:lt,onSubscribed:pe}),d.useMemo(()=>{const O=se?.phases??[],te=He(O,ge),C=He(O,fe),ie=We(O,ge),q=We(O,fe),Le=O.some(gt=>gt.status!=="idle"),ne=!ee&&!Le,Me=ee&&!Le,pt=Me?ge.map(()=>"building"):te,mt=Me?fe.map(()=>"building"):C;return{ledgerRowStatuses:ne?void 0:pt,backgroundRowStatuses:ne?void 0:mt,showLedgerReadyInLabel:ne?void 0:ie,showBackgroundReadyInLabel:ne?void 0:q,forceContinueEnabled:!ne||void 0,counts:se?.counts,onContinueClicked:Re}},[se?.phases,se?.counts,ee,Re])})({companyId:F});if(Fe===!0){if(!Ue)return dt?o.jsx(j,{to:"../../treasury"}):rt?o.jsx(j,{to:"../../checking"}):ct?o.jsx(j,{to:"../../cards"}):o.jsx(j,{to:"../../dashboard"});const f=R.updateStatus.fetchState==="In-Progress";if(Ue&&!f)return t?o.jsxs(Ye,{children:[o.jsx(ce,{analytics:Q,onLoad:L=>je(L)}),o.jsx(Xe,{navigate:a,location:c,companyId:F,currentTenant:h,isAdmin:oe,isOnAddressPage:s,themeState:I,googleAPIKey:ye.googleMapsAPIKey,integrationsSectionProps:Be,aiAgentsActivationProps:Ve}),n!=null?o.jsx(Je,{windowSize:y,skipLegacyDrawerOffset:s&&h.productSettings.isOtherProductsEnabled!==!0,children:n}):null]}):o.jsx(j,{to:"../../onboarding/thankyou"})}else if(Fe===!1&&x?.loggedInUserRoleMap!=null)return X===!0?o.jsx(j,{to:"../../onboarding/thankyou"}):o.jsxs(Ye,{children:[o.jsx(ce,{analytics:Q,onLoad:f=>je(f)}),o.jsx(Xe,{navigate:a,location:c,companyId:F,currentTenant:h,isAdmin:oe,isOnAddressPage:s,themeState:I,googleAPIKey:ye.googleMapsAPIKey,integrationsSectionProps:Be,aiAgentsActivationProps:Ve}),n!=null?o.jsx(Je,{windowSize:y,skipLegacyDrawerOffset:s&&h.productSettings.isOtherProductsEnabled!==!0,children:n}):null]});return null},he="external_integrations",Pn=({tenantEmailDomain:t,signedInUserEmail:s,companyId:n})=>{const a=H();xn();const{plaidAccounts:c,onAddPlaidAccount:u}=(({companyId:r})=>{const m=H(),x=_(b=>b.plaidAccountViewState.external_account.plaidConnectionDetails.link_external_account),E=_(b=>jt(b.paymentAccountState)),g=d.useRef(!1);d.useEffect(()=>{m(Ut())},[m]);const U=d.useCallback(b=>{m(Bt(b,r,"external_account",void 0,"link_external_account")),g.current=!1},[m,r]),S=d.useCallback(()=>{g.current=!1},[]),{open:P,ready:V}=vn({token:x.linkToken??null,onSuccess:U,onExit:S});d.useEffect(()=>{g.current&&V&&(P(),g.current=!1)},[V,P]);const h=d.useCallback(()=>{g.current=!0,m(Vt("external_account","link_external_account"))},[m]);return{plaidAccounts:d.useMemo(()=>E.map(b=>{return{accountId:b.paymentAccountId,name:b.institutionDetails?.institutionName??b.accountName,mask:b.accountLast4Digits,balanceFormatted:(A=b.balances?.current?.amount,B=b.balances?.current?.currencySymbol,A==null?"":`${B??"$"}${A.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`),isActive:wn.has(b.providerVerificationStatus?.code??"")};var A,B}),[E]),onAddPlaidAccount:h}})({companyId:n}),y=_(r=>W(r)),I=_(r=>r.tenantState.fetchState),e=_(r=>$t(r,n)),i=_(r=>zt(r,he)),l=d.useMemo(()=>new Set(i.map(r=>r.additionalInfo).filter(r=>r!=null)),[i]),p=y.tenantId,T=ue(y.userRole??[]);return d.useEffect(()=>{a(Kt(he))},[a]),d.useMemo(()=>({isAdmin:T,integrationsView:e,isLoading:I==="In-Progress",notifyMeRegisteredSlugs:l,saveChargeBeeState:e.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:e.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:e.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:e.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:e.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(e.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map(([r,m])=>[r,m?.message])),deleteConnectionState:e.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:e.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{a(Qe(p,"gmail",et()))},onConnectOutlook:()=>{a(Qe(p,"outlook",et()))},onConnectHubSpot:(r,m)=>{const x=e.externalConnections?.revenue?.find(g=>g.connectionName==="hubspot")?.connectionId;if(x==null)return;const E=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:m,connection_id:x,redirect_uri:E,tenant_id:p})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(E)}`},onDisconnect:(r,m)=>{a(Yt(p,r,me(m)))},onNotifyMe:r=>{a(Wt(he,r,s))},onReconnectQBO:()=>{ae.init("/onboarding/auth",t),ae.handleClick()},onRefreshClick:()=>{e.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Ht())},onSaveChargeBeeCredentials:(r,m)=>{const x=e.externalConnections?.revenue?.find(E=>E.connectionName==="chargebee")?.connectionId;x!=null&&a(Zt(p,x,me("revenue"),qt("chargebee"),{api_key:r,site:m}))},onSaveConnectorCredentials:r=>{a(Qt(p,me("payments"),r))},plaidAccounts:c,onAddPlaidAccount:u}),[T,e,I,l,p,s,t,a,c,u])};function et(){const t=new URL(window.location.href);return t.searchParams.set("onboarding_step","connect_data_source"),t.toString()}function tt(t,s,n){let a=`/${t}/onboarding/address`;return a=n!=null?a.concat(`/edit/${s}/${encodeURIComponent(n)}`):a.concat(`/new/${s}`),a}const Dn=Pe.div`
|
|
27
|
-
display: flex;
|
|
28
|
-
height: 100vh;
|
|
29
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
30
|
-
`,Fn=Ee(function(t,s){const{companyId:n,currentTenant:a}=s,c=we(t,n),u=it(t);return{hasVerifiedBankAccount:(c.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:ue(a?.userRole??[])&&c.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:G.getSignedInUser(),currentTenant:a,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true"}},function(t,s){const{currentTenant:n,themeState:a,navigate:c,location:u}=s,{tenantEmailDomain:y}=n;return{onZeniLogoClick:()=>{a.toggle()},handleLogOutClick:()=>{const I=N(u.state?.pathnameStackToGoBack,u.pathname);c("/signout",{replace:!0,state:{pathnameStackToGoBack:I,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleUpdatePaymentAddressDetailClick:()=>{const I=N(u.state?.pathnameStackToGoBack,u.pathname);c(`/${y}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:I,message:"UpdatePaymentAddressDetail"}})}}})(_t),jn=()=>{const t=Ce(),s=H(),n=ke(),a=_e(),{useFeatureGate:c}=Ae(),{isFeatureEnabled:u}=c(M.isDebitCardFeatureEnabled),{tenantEmailDomain:y}=Ie(),I=xe(),[e,i]=d.useState(!1);d.useEffect(()=>{e===!1&&n.state?.message==="OnboardingThankyou"&&i(!0)},[n.state]);const l=_(g=>W(g)),p=l.productSettings.isOtherProductsEnabled;d.useEffect(()=>{s(be(T,!1,!p))},[]);const T=l.companyId??G.getSignedInUserTenant(y)?.companyId;if(I.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const r=Te(u,l),m=Oe(l),x=_(g=>g.onboardingCustomerViewState.updateStatus.fetchState),E=l.company?.companyOnboardingInfo.isOnboardingCompleted;if(E===!0){const g={pathnameStackToGoBack:n.state?.pathnameStackToGoBack,message:"activation"};return r?o.jsx(j,{to:"../../checking",state:g,replace:!0}):m?o.jsx(j,{to:"../../cards",state:g,replace:!0}):o.jsx(j,{to:"../../dashboard",state:g,replace:!0})}return x==="Completed"&&E===!1&&I?.loggedInUserRoleMap!=null?o.jsxs(Dn,{children:[o.jsx(ce,{analytics:Q,onLoad:g=>{g.trackPageLoaded(ve.Event.onboardingInterimPage)}}),o.jsx(Fn,{navigate:t,showUpdatePaymentDetailButton:p,location:n,companyId:T,currentTenant:l,themeState:a,isVisitingFirstTime:e})]}):o.jsx(nt,{})};function ra(){return o.jsxs(St,{children:[o.jsx(K,{path:"/",element:o.jsx(re,{})}),o.jsx(K,{path:"/billing/edit",element:o.jsx(re,{taxCFOCustomer:!0})}),o.jsx(K,{path:"/thankyou",element:o.jsx(jn,{})}),o.jsx(K,{path:"/activation",element:o.jsx(On,{})}),o.jsx(K,{path:"/address/edit/:addressType/:addressId",element:o.jsx(re,{isOnAddressPage:!0,appContent:o.jsx(Ne,{})})}),o.jsx(K,{path:"/address/new/:addressType",element:o.jsx(re,{isOnAddressPage:!0,appContent:o.jsx(Ne,{})})}),o.jsx(K,{path:"*",element:o.jsx(ht,{})})]})}export{ra as default};
|