@zeniai/web-app-ui 5.1.11-qa → 5.1.12-next
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-DykoRAr_.js +1 -0
- package/dist/assets/{AddressScreen-CRrDzWsY.js → AddressScreen-7nwOGQ8s.js} +2 -2
- package/dist/assets/{AiCfoScreen-DxhETGED.js → AiCfoScreen-D2QaXfWQ.js} +5 -5
- package/dist/assets/{BillPayApprovalRoutes-CxNlHFNb.js → BillPayApprovalRoutes--IO3aJDG.js} +1 -1
- package/dist/assets/{BillPayRoutes-CTjqggXh.js → BillPayRoutes-E-zGYI9N.js} +17 -17
- package/dist/assets/{BusinessVerificationPageScreen-Bl62F8HW.js → BusinessVerificationPageScreen-DThyLXGr.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-BueI2N6O.js → ChargeCardRoutes-BEhu6-Wg.js} +11 -11
- package/dist/assets/CompanyPassportScreen-Dcwohpcb.js +1 -0
- package/dist/assets/ConnectionAuthScreen-BkKixyE0.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-CwZtO0Z6.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-D_wdFspJ.js → CustomerOnboardingRoutes-SJOMT_B7.js} +5 -5
- package/dist/assets/{DashboardRoutes-ZPnn5_T-.js → DashboardRoutes-PpVL5-Xq.js} +1 -1
- package/dist/assets/{DefaultTenantHome-IDQRl70n.js → DefaultTenantHome-DRQjKaEk.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-CF6GWEad.js → DomesticWireDetailScreen-DtdCLqkF.js} +3 -3
- package/dist/assets/DrawerScreen-DYJlmfqG.js +1 -0
- package/dist/assets/EntityDetailRoutes-BfObltjq.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-Dxve9v31.js +25 -0
- package/dist/assets/{FeaturePreviewScreen-BPOiDLyk.js → FeaturePreviewScreen-DB96O688.js} +1 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-BwzYMiIG.js +1 -0
- package/dist/assets/{MagicLinkRoutes-DZfGTk5d.js → MagicLinkRoutes-CFW5g_4m.js} +10 -10
- package/dist/assets/MagicLinkSignInScreen-Bc1Chb2Q.js +12 -0
- package/dist/assets/{MobileAppDrawer-D10FOYX9.js → MobileAppDrawer-DFoyPc6B.js} +1 -1
- package/dist/assets/NotFoundScreen-Dm363BZM.js +1 -0
- package/dist/assets/{NotificationRoutes-CINWKOOj.js → NotificationRoutes-DH5Z8BaJ.js} +1 -1
- package/dist/assets/OAuthConsentScreen-BUWqqruX.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-h6cMu5oM.js +1 -0
- package/dist/assets/PeopleRoutes-CrjJsNxF.js +22 -0
- package/dist/assets/PerformanceRoutes-C-sDhO4a.js +1 -0
- package/dist/assets/{Preview-C90UIzEj.js → Preview-b_3veiZr.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DRrkUHrN.js → QBOConnectionScreen-f0GbNY7x.js} +1 -1
- package/dist/assets/ReferralListScreen-DIQMR9rR.js +5 -0
- package/dist/assets/ReimbursementApprovalRoutes-Co56hzJu.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-B7K2L3zO.js → ReimbursementApprovalRuleDetailScreen-PXvWGMwO.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-BEWmltFK.js → ReimbursementRoutes-CUU9NBy4.js} +9 -9
- package/dist/assets/{ReportsRoutes-BlEu5VUB.js → ReportsRoutes-C_Cimfi6.js} +1 -1
- package/dist/assets/RewardsRoutes-CRxGrJVw.js +1 -0
- package/dist/assets/ScreenRoutes-Cv2JSSQj.js +2 -0
- package/dist/assets/{SettingsRoutes-BCLuKjgw.js → SettingsRoutes-Du35BHGj.js} +6 -6
- package/dist/assets/{SetupPagesScreen-BIREjuYj.js → SetupPagesScreen-C-FtQJ8e.js} +5 -5
- package/dist/assets/SignInScreen-DxkH75ph.js +1 -0
- package/dist/assets/SignOutScreen-DwMIr1xR.js +9 -0
- package/dist/assets/{TaskListScreen-Chjij5Lk.js → TaskListScreen-sKdlcELO.js} +2 -2
- package/dist/assets/{TaskRoutes-CNiBmdRL.js → TaskRoutes-BFmZDhlh.js} +2 -2
- package/dist/assets/{TransactionDetailRoutes-D6qLZBIA.js → TransactionDetailRoutes-KznEX-4y.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-kS2Tur05.js → TransactionDetailScreen-RcOrsW_7.js} +2 -2
- package/dist/assets/{TransactionListRoutes-CB60J7GL.js → TransactionListRoutes-6FNXE9GQ.js} +1 -1
- package/dist/assets/TreasuryRoutes-Bie1-wTI.js +37 -0
- package/dist/assets/{VendorsRoutes-C3wPybWP.js → VendorsRoutes-qXPy5R5E.js} +22 -22
- package/dist/assets/WiseConfirmationScreen-TgbSqTHt.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-CpYsdVqq.js → ZeniAccountRoutes-CSqePoER.js} +11 -11
- package/dist/assets/ZeniAccountStatementScreen-DW4RC0ro.js +9 -0
- package/dist/assets/{accountMappingHelper-sAcB3ur2.js → accountMappingHelper-CShBal-E.js} +1 -1
- package/dist/assets/{analytics-DlpS0EZD.js → analytics-BVe2_H5A.js} +1 -1
- package/dist/assets/analyticsHelper-2Oe3qfeK.js +1 -0
- package/dist/assets/{core-DoPN7aB0.js → core-DGFWDVAl.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-BLIrwfN0.js → decodeURIComponentSafe-C_utkack.js} +1 -1
- package/dist/assets/{dnd-BxvQI0v0.js → dnd-Bgw7mJ4_.js} +1 -1
- package/dist/assets/{empty-D1BBe51D.js → empty-BQXzpfcR.js} +1 -1
- package/dist/assets/{empty-Cqp9lrhA.js → empty-BultNb92.js} +1 -1
- package/dist/assets/{emptyVideoElement-Ce6CtoIu.js → emptyVideoElement-BYOnTpLg.js} +1 -1
- package/dist/assets/epic-CW9fsiHU.js +2 -0
- package/dist/assets/getLocaleForTenant-C6buF13l.js +1 -0
- package/dist/assets/{index-BiGz2-_X.js → index-BCfONTGr.js} +1 -1
- package/dist/assets/{index-B5Rc6zYf.js → index-BaFapQaI.js} +1 -1
- package/dist/assets/{index-BkkhGvOl.js → index-BtY3x-vU.js} +1 -1
- package/dist/assets/{index-n6xxQQLv.js → index-CY6bWWQK.js} +1 -1
- package/dist/assets/{index-g7YhP_Bw.js → index-CYmB3538.js} +2 -2
- package/dist/assets/{index-COdOvzG8.js → index-DdDbQEWy.js} +10533 -10537
- package/dist/assets/{index-3_oH59VI.js → index-MzF3VhZj.js} +1 -1
- package/dist/assets/{index-B9IfMYPs.js → index-pwHeJ9iW.js} +1 -1
- package/dist/assets/{lexical-CvJEYdLr.js → lexical-WJOlCNii.js} +1 -1
- package/dist/assets/{liveblocks-iTHbJlig.js → liveblocks-B3rZ8J8S.js} +1 -1
- package/dist/assets/{lottie--rFgLXuF.js → lottie-CIs_xEi6.js} +1 -1
- package/dist/assets/{mui-Dn1-Cj7l.js → mui-Dbkdx3RD.js} +1 -1
- package/dist/assets/{pathToGoBack-Duln7lg7.js → pathToGoBack-CTcyuYMY.js} +1 -1
- package/dist/assets/{pdf-BLJjiQGr.js → pdf-BwZYmtfA.js} +3 -3
- package/dist/assets/{pdf-lib-BNzjozs9.js → pdf-lib-BhV4O1kJ.js} +1 -1
- package/dist/assets/{plaid-DyRwUZ7U.js → plaid-S75yXU2f.js} +1 -1
- package/dist/assets/{pusher-C76_Qxug.js → pusher-CjDNe_Ji.js} +1 -1
- package/dist/assets/{react-DoXg-26u.js → react-A2uXeZ4D.js} +1 -1
- package/dist/assets/{react-C7BVvqaN.js → react-CKqM59-7.js} +1 -1
- package/dist/assets/{react-BCO4AmuD.js → react-Crl3XmiC.js} +1 -1
- package/dist/assets/{react-BxBuUL6A.js → react-CxOaCG2w.js} +1 -1
- package/dist/assets/{react-RmrBeLna.js → react-DoAt-Fpx.js} +1 -1
- package/dist/assets/{react-BTluqps5.js → react-dcUM81CU.js} +1 -1
- package/dist/assets/{recharts-ut2IEaK8.js → recharts-n-g8syHd.js} +1 -1
- package/dist/assets/{routePaths-xREGgmDf.js → routePaths-BHlRt2v2.js} +1 -1
- package/dist/assets/{sentry-CrNI2YmF.js → sentry-DUcvQrSc.js} +1 -1
- package/dist/assets/{url-C2y-3Iz5.js → url-BqaHlfln.js} +1 -1
- package/dist/assets/{url-Czi-NL3N.js → url-DXNYKjlB.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-KgzYfQAN.js → useAiCfoDashboardSuggestedQuestionsChips-CZD85ryf.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CvRDdc_b.js +1 -0
- package/dist/assets/{useDeviceId-jpFxZuUm.js → useDeviceId-L1ajRT6H.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-CgYhjY14.js → useInitialThreadRequest-DG59fsOg.js} +1 -1
- package/dist/assets/{utils-COxqlyTI.js → utils-Ch467FKd.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-TM2OO-sz.js → withTransactionSidePanel-CQXBb533.js} +3 -3
- package/dist/assets/{zeni-epic-state-n2hRi6Hc.js → zeni-epic-state-CZCR_U6U.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-QK4zuGlg.js +0 -1
- package/dist/assets/CompanyPassportScreen-7tyI3vWU.js +0 -1
- package/dist/assets/ConnectionAuthScreen-CjGAe9Ey.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-B9t6VP2e.js +0 -1
- package/dist/assets/DrawerScreen-Bz6bl4pe.js +0 -1
- package/dist/assets/EntityDetailRoutes-Bfs84hXg.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-HCZXBcpx.js +0 -25
- package/dist/assets/HubSpotOAuthCallbackScreen-BB825kOT.js +0 -1
- package/dist/assets/MagicLinkSignInScreen-BCbmBCYL.js +0 -12
- package/dist/assets/NotFoundScreen-B__yzCu5.js +0 -1
- package/dist/assets/OAuthConsentScreen-BKOXpDT0.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-BFssF5ra.js +0 -1
- package/dist/assets/PeopleRoutes-D5lD1e4G.js +0 -22
- package/dist/assets/PerformanceRoutes-u64eSj3P.js +0 -1
- package/dist/assets/ReferralListScreen-XxUcH9Xo.js +0 -5
- package/dist/assets/ReimbursementApprovalRoutes-EmR0eEAI.js +0 -1
- package/dist/assets/RewardsRoutes-BZUiKX6E.js +0 -1
- package/dist/assets/ScreenRoutes-CkGo3VBp.js +0 -2
- package/dist/assets/SignInScreen-CaAPqIqG.js +0 -1
- package/dist/assets/SignOutScreen-DjfHOhJ2.js +0 -9
- package/dist/assets/TreasuryRoutes-CXP7_EEg.js +0 -37
- package/dist/assets/WiseConfirmationScreen-CLrWsKeC.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-BLajmoIH.js +0 -9
- package/dist/assets/analyticsHelper-CIApSWb5.js +0 -1
- package/dist/assets/epic-C1m-ORGj.js +0 -2
- package/dist/assets/getLocaleForTenant-NXDGPoAr.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-DaSnSbIN.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-iTHbJlig.js";import{h as le,i as ca,u as ue,j as y,g as ge,n as pe,N as ga,s as ut,o as qt,p as ne}from"./core-DoPN7aB0.js";import{eP as ce,bs as Ue,Pe as ka,eY as be,eZ as ye,e_ as Se,fT as $e,cs as ze,Pf as Ye,Pg as Ma,tv as ba,jO as ya,Ph as Sa,gT as oa,z$ as Je,A1 as Ga,A2 as $a,jE as mt,Pi as Ze,zP as Ct,Pj as Qt,Pk as Xt,zS as Da,Pl as Jt,NE as Pa,rH as pt,zY as za,h2 as en,Pm as ht,Pn as Ke,bq as an,Po as tn,fE as _a,fD as wa,Aw as nn,fC as Ta,Nk as rn,Pp as ft,cl as gt,cM as sn,ND as da,B6 as on,Pq as tt,AI as Fa,Pr as bt,B7 as cn,O3 as dn,B8 as ln,C2 as un,sR as mn,BY as Cn,Ah as yt,Aa as pn,Ps as hn,fV as fn,Aq as St,Au as It,fU as gn,Pt as bn,AU as At,Pu as yn,Pv as Sn,Pw as In,As as Et,Ad as kt,zV as Dt,Am as Pt,Ak as _t,Ao as An,A0 as nt,Px as wt,Py as va,AF as Ia,Kj as Tt,cN as Ya,Pz as En,PA as kn,PB as Dn,PC as Pn,AC as Va,A$ as _n,AX as wn,Ay as Tn,AZ as Fn,AP as vn,AR as xn,PD as Ft,B5 as vt,HI as Bn,PE as Ln,PF as Rn,PG as Un,PH as xt,PI as On,Bs as jn,AH as Bt,AB as ia,AG as Vn,PJ as Hn,PK as Nn,zM as Mn,PL as Lt,PM as Rt,PN as Gn,zO as $n,zN as rt,PO as zn,PP as Yn,PQ as Zn,Kf as Kn,PR as Za,PS as Wn,wn as Ut,km as qn,gU as Qn,Bx as Xn,PT as Ot,PU as Jn,By as er,PV as ar,de as tr,tp as nr,Bn as rr,Bh as Re,bt as sr,bF as or,cx as ir,bG as cr,Js as dr}from"./zeni-epic-state-n2hRi6Hc.js";import{z as J,k as je,v as se,I as Y,B as la,c2 as xa,cd as lr,p as ve,ce as ur,cf as mr,J as ua,aN as Fe,n as fe,bm as Ka,cg as Cr,y as ma,f as Ba,h as Wa,c as Q,D as qa,ch as pr,W as jt,aq as Qa,by as Qe,ci as Ha,cj as hr,Y as Xa,a7 as fr,ck as gr,at as Vt,a2 as Na,U as Ht,e as Nt,cl as br,cm as yr,cn as Sr,co as Ir,cp as Ar,cq as Er,o as Aa,cr as kr,cs as Dr,ct as Ua,r as Pr,cu as _r,cv as wr,cw as Tr,cx as Fr,cy as vr,a9 as xr}from"./index-COdOvzG8.js";import{n as Pe,D as Mt,S as Br}from"./mui-Dn1-Cj7l.js";import{a as c}from"./sentry-CrNI2YmF.js";import{g as Ce,a as Ca,b as Gt,c as Ie,d as Ae,e as Oe,f as Ve,A as Lr,h as Ja,P as Rr,i as et,s as Xe,j as $t,k as Me,l as zt,m as Ur,n as Yt,p as Or,S as st}from"./SetupPagesScreen-BIREjuYj.js";import{u as Zt}from"./useInitialThreadRequest-CgYhjY14.js";import La from"./NotFoundScreen-B__yzCu5.js";import{M as Ge}from"./MobileAppDrawer-D10FOYX9.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-DaSnSbIN.js";import{v as ot}from"./utils-COxqlyTI.js";import{t as jr}from"./AddressScreen-CRrDzWsY.js";import"./recharts-ut2IEaK8.js";import"./analytics-DlpS0EZD.js";import"./plaid-DyRwUZ7U.js";import"./dnd-BxvQI0v0.js";import"./stripe-DMRn4zHo.js";import"./lottie--rFgLXuF.js";import"./lexical-CvJEYdLr.js";import"./pdf-BLJjiQGr.js";import"./analyticsHelper-CIApSWb5.js";import"./routePaths-xREGgmDf.js";import"./BusinessVerificationPageScreen-Bl62F8HW.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fa449b67-2bce-414a-92d5-c59f4b734b58",e._sentryDebugIdIdentifier="sentry-dbid-fa449b67-2bce-414a-92d5-c59f4b734b58")}catch{}})();function Vr(){const e=le(),{cardId:t}=ca(),a=ue(),r=J.getSignedInUser(),n=y(X=>ce(X)),C=je(),m=Ue(C?.loggedInUserRoleMap),{useFeatureGate:g}=se();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=y(X=>ka(X).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const E=n.userRole.includes("charge_card_user"),{isFeatureEnabled:S}=g(Y.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=g(Y.isDebitCardFeatureEnabled),v=be(n),D=ye(n),p=Se(O,n),u=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,b=Ie({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:p}),l=Ae({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:S,isBookKeepingTenant:D,isDebitCardProductVisible:b,chargeCardsCreditAccountLimit:u}),P=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,F=y(X=>$e(X,n.companyId)),R=ze(F.controllers),{creditAccount:B,creditAccountRepayment:T}=y(X=>Ye(X)),H=y(X=>X.classListState.fetchState),d=!E&&l&&f,h=y(X=>Ma(X,t,d,l)),[_,w]=c.useState(!1),U=h.chargeCard,j=U?.cardCreatedByUser?.userId,$=y(X=>j!=null?ba(X.userRoleState,j):void 0),N=$?.accountingClassIDs[0],V=y(X=>N!=null?ya(X.classState,{classId:N,reportId:"class_list"}):void 0),A=U?.cardHolderUser?.userId,L=y(X=>A!=null?ba(X.userRoleState,A):void 0),W=L?.accountingClassIDs[0],k=y(X=>W!=null?ya(X.classState,{classId:W,reportId:"class_list"}):void 0),Z=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",q=U?.type.code==="business_physical_debit_card";c.useEffect(()=>{i&&I===!1&&Z&&(o(!0),setTimeout(()=>{a(Sa()),q&&a(oa({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[i,I,Z,q]),c.useEffect(()=>{_||h.fetchState==="Completed"||h.fetchState==="In-Progress"||t==null||(w(!0),a(Je(t,d,!1)))},[_,h,t,a]),c.useEffect(()=>{if(h.fetchState==="Completed"&&(Z===!1||Z&&U?.status?.code!=="active"||U?.cardHolderUserId!==r.userId||i===!1&&I===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=Ce(n.tenantEmailDomain,t,r,U,i);e(X)}},[h.fetchState,i,Z]),c.useEffect(()=>{B.fetchState!=="Completed"&&B.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a($a()),H!=="Completed"&&H!=="In-Progress"&&a(mt())},[B.fetchState,T.fetchState,a,l,f,m,H]);const z=()=>{if(r!=null&&t!=null){a(Sa());const X=Ce(n.tenantEmailDomain,t,r);e(X)}},x=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",oe=Oe(l,b,P,f),ee=Ca(l,f,m,B,T),te=Gt(x,h);return h.fetchState!=="Completed"?s.jsx(la,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(xa,{showConfetti:i}),s.jsx(lr,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:R,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:P,isChargeCardSetupEnabled:f,productInformation:oe,creditAccountInformation:ee,debitAccountInformation:te,chargeCardDetailView:h,creditAccount:B,classListFetchState:H,creditAccountRepayment:T,cardIssuedByRoles:$?.userRoles,cardIssuedByDepartmentName:V?.className,cardHolderRoles:L?.userRoles,cardHolderDepartmentName:k?.className})]})}const Hr=pe(function(e){const t=Ze(e);return{insightsData:t.insight,cashbackByPeriod:t.cashbackByPeriod,uiState:t.uiState,cashbackSummary:t.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(t,a)=>{e(Qt({uiState:{sortKey:t,sortOrder:a}}))}}})(mr);function Nr(){const e=le(),t=ue(),a=ge(),r=J.getSignedInUser(),n=y(S=>ce(S)),{useFeatureGate:C}=se(),{isFeatureEnabled:m}=C(Y.isCardsCommentingEnabled),[g,I]=c.useState(!1),o=y(S=>Ze(S)),i=Zt(n.companyId,{clearParams:o.fetchState==="Completed"}),E=c.useCallback(()=>{const S=ve(a.state?.pathnameStackToGoBack),f=S.poppedPathname??Mr(n.tenantEmailDomain);e(f,{state:{pathnameStackToGoBack:S.newStack}})},[e,a,n.tenantEmailDomain]);if(c.useEffect(()=>{g||o.fetchState==="Completed"||o.fetchState==="In-Progress"||(I(!0),t(Ct()))},[g,o,t]),r==null)throw Error("Can't access cashback detail page without signing in...");return o.fetchState==="In-Progress"?s.jsx(ur,{onBackClick:E}):o.cashbackSummary.cashbackEarned.amount===0&&o.fetchState==="Completed"?s.jsx(La,{}):s.jsx(Hr,{onBackClick:E,isCardsCommentingEnabled:m,initialOpenThreadRequest:i})}const Mr=e=>`/${e}/cards`,Gr={containerWidth:new ma(100,58)},$r=({appContent:e})=>{const t=ua(),a=ue(),r=le(),{cardId:n}=ca(),C=ge(),{useDynamicConfig:m}=se(),[g,I]=c.useState(!1),[o,i]=c.useState(!1),[E,S]=c.useState(!1),[f,O]=c.useState(!1),v=J.getSignedInUser();if(v==null)throw Error("Can't access onboarding card page without signing in...");const D=y(k=>ce(k));if(n==null)throw Error("Empty card id is not valid...");const{configValue:p}=m(Fe.zeniCardsConfig),u=p.max_charge_card_activation_attempts_by_card_id,b=y(k=>Xt(k,n)),l=b.chargeCard,P=y(k=>k.chargeCardConfigState.fetchState),{useFeatureGate:F}=se(),{isFeatureEnabled:R}=F(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=F(Y.isDebitCardFeatureEnabled),T=Se(B,D),H=Ie({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:T}),d=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,h=D.userRole.includes("charge_card_user"),_=be(D),w=ye(D),U=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,j=Ae({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:R,isBookKeepingTenant:w,isDebitCardProductVisible:H,chargeCardsCreditAccountLimit:U}),$=!h&&j&&d;c.useEffect(()=>{g===!1&&P!=="In-Progress"&&P!=="Completed"&&(a(Da()),I(!0)),o===!1&&b.fetchState==="Not-Started"&&(i(!0),a(Je(n,$,j)))},[o,b.fetchState,g,P]);const N=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";c.useEffect(()=>{if(b.fetchState==="Completed"){if(E===!1&&(N===!1||N&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==v.userId)){const k=Ce(D.tenantEmailDomain,n,v,l,!0),Z=fe(C.state?.pathnameStackToGoBack,C.pathname);r(k,{state:{pathnameStackToGoBack:Z}})}else if(E&&b.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){a(Jt({chargeCardId:n}));const k=Ce(D.tenantEmailDomain,n,v,l,!0),Z=fe(C.state?.pathnameStackToGoBack,C.pathname);a(Pa()),r(k,{state:{pathnameStackToGoBack:Z}})}}},[b.fetchState,l?.type.code,E,b.isRefreshingViewInBackground]);const V=J.getZeniOtpTokenForCardHolder(n),A=y(k=>pt(k.userState,v.userId)),L=()=>{l?.status?.code!=="active"&&a(za(n,!0))};c.useEffect(()=>{b.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(k=>k.statusCode==="success")===!0&&E===!1&&(setTimeout(L,3e3),S(!0))},[b.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const W=k=>{O(k)};if(P!=="Completed"||l==null)return s.jsx(la,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(A?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Zr,{children:[s.jsx(Ge,{isAppContentDrawerOpen:f,handleDrawerToggle:W}),s.jsx(zr,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:A.phone,signedInUser:v,isSandboxEnv:Ka(),chargeCardDetailState:b,signedInUserToken:V,navigate:r,currentTenant:D,location:C,maxChargeCardActivationAttempts:u[n]!=null?u[n]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{W(!0)}}),e!=null?s.jsx(Yr,{windowSize:t,children:e}):null]})},zr=pe(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const C=en(e.addressState,a);if(C==null)throw Error("Can't access shippingAddress.");const m=ht(e,n),g=t.updateStatus,I=Ke(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(an())||i,showMenuIcon:o,shippingAddress:C,vgsVaultId:Ba.cardVaultId,twoFAView:m,activationWaitStatus:g,isRefreshingViewInBackground:t.isRefreshingViewInBackground}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:C,chargeCardDetailState:m}=t,g=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=C;return{onGetOtp:o=>{g!=null&&e(Ta(o,"ChargeCardHolder",r))},onUpdatePhysicalChargeCardAttempt:o=>{e(nn(r,o))},onResendOtp:o=>{g!=null&&e(wa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{g!=null&&e(_a(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&J.saveZeniOtpTokenForCardHolder(o,r)},onCVVActivateSuccess:()=>{e(tn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("onboard")===!0?Ve(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(Cr),Yr=Pe.div`
|
|
1
|
+
import{j as s}from"./liveblocks-B3rZ8J8S.js";import{h as le,i as ca,u as ue,j as y,g as ge,n as pe,N as ga,s as ut,o as qt,p as ne}from"./core-DGFWDVAl.js";import{eP as ce,bs as Ue,Pc as ka,eY as be,eZ as ye,e_ as Se,fT as $e,cs as ze,Pd as Ze,Pe as Ma,tt as ba,jO as ya,Pf as Sa,gT as oa,zZ as Je,z$ as Ga,A0 as $a,jE as mt,Pg as Ye,zN as Ct,Ph as Qt,Pi as Xt,zQ as Da,Pj as Jt,NC as _a,rF as pt,zW as za,h2 as en,Pk as ht,Pl as Ke,bq as an,Pm as tn,fE as Pa,fD as wa,Au as nn,fC as Ta,Ni as rn,Pn as ft,cl as gt,cM as sn,NB as da,B4 as on,Po as tt,AG as Fa,Pp as bt,B5 as cn,O1 as dn,B6 as ln,C0 as un,sP as mn,BW as Cn,Af as yt,A8 as pn,Pq as hn,fV as fn,Ao as St,As as It,fU as gn,Pr as bn,AS as At,Ps as yn,Pt as Sn,Pu as In,Aq as Et,Ab as kt,zT as Dt,Ak as _t,Ai as Pt,Am as An,z_ as nt,Pv as wt,Pw as va,AD as Ia,Kh as Tt,cN as Za,Px as En,Py as kn,Pz as Dn,PA as _n,AA as Va,AZ as Pn,AV as wn,Aw as Tn,AX as Fn,AN as vn,AP as xn,PB as Ft,B3 as vt,HG as Bn,PC as Ln,PD as Rn,PE as Un,PF as xt,PG as On,Bq as jn,AF as Bt,Az as ia,AE as Vn,PH as Nn,PI as Hn,zK as Mn,PJ as Lt,PK as Rt,PL as Gn,zM as $n,zL as rt,PM as zn,PN as Zn,PO as Yn,Kd as Kn,PP as Ya,PQ as Wn,wl as Ut,km as qn,gU as Qn,Bv as Xn,PR as Ot,PS as Jn,Bw as er,PT as ar,de as tr,tn as nr,Bl as rr,Bf as Re,bt as sr,bF as or,cx as ir,bG as cr,Jq as dr}from"./zeni-epic-state-CZCR_U6U.js";import{z as J,k as je,v as se,I as Z,B as la,c2 as xa,cd as lr,p as ve,ce as ur,cf as mr,J as ua,aN as Fe,r as fe,bm as Ka,cg as Cr,C as ma,i as Ba,h as Wa,c as Q,D as qa,ch as pr,_ as jt,aq as Qa,by as Qe,ci as Na,cj as hr,G as Xa,a7 as fr,ck as gr,at as Vt,a2 as Ha,X as Nt,e as Ht,cl as br,cm as yr,cn as Sr,co as Ir,cp as Ar,cq as Er,o as Aa,cr as kr,cs as Dr,ct as Ua,s as _r,cu as Pr,cv as wr,cw as Tr,cx as Fr,cy as vr,a9 as xr}from"./index-DdDbQEWy.js";import{n as _e,D as Mt,S as Br}from"./mui-Dbkdx3RD.js";import{a as c}from"./sentry-DUcvQrSc.js";import{g as Ce,a as Ca,b as Gt,c as Ie,d as Ae,e as Oe,f as Ve,A as Lr,h as Ja,P as Rr,i as et,s as Xe,j as $t,k as Me,l as zt,m as Ur,n as Zt,p as Or,S as st}from"./SetupPagesScreen-C-FtQJ8e.js";import{u as Yt}from"./useInitialThreadRequest-DG59fsOg.js";import La from"./NotFoundScreen-Dm363BZM.js";import{M as Ge}from"./MobileAppDrawer-DFoyPc6B.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-CvRDdc_b.js";import{v as ot}from"./utils-Ch467FKd.js";import{t as jr}from"./AddressScreen-7nwOGQ8s.js";import"./recharts-n-g8syHd.js";import"./analytics-BVe2_H5A.js";import"./plaid-S75yXU2f.js";import"./dnd-Bgw7mJ4_.js";import"./stripe-DMRn4zHo.js";import"./lottie-CIs_xEi6.js";import"./lexical-WJOlCNii.js";import"./pdf-BwZYmtfA.js";import"./analyticsHelper-2Oe3qfeK.js";import"./routePaths-BHlRt2v2.js";import"./BusinessVerificationPageScreen-DThyLXGr.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="502ef8f3-2f32-4a47-8354-9901f8f8dc53",e._sentryDebugIdIdentifier="sentry-dbid-502ef8f3-2f32-4a47-8354-9901f8f8dc53")}catch{}})();function Vr(){const e=le(),{cardId:t}=ca(),a=ue(),r=J.getSignedInUser(),n=y(X=>ce(X)),C=je(),m=Ue(C?.loggedInUserRoleMap),{useFeatureGate:g}=se();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=y(X=>ka(X).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const E=n.userRole.includes("charge_card_user"),{isFeatureEnabled:S}=g(Z.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=g(Z.isDebitCardFeatureEnabled),v=be(n),D=ye(n),p=Se(O,n),u=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,b=Ie({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:p}),l=Ae({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:S,isBookKeepingTenant:D,isDebitCardProductVisible:b,chargeCardsCreditAccountLimit:u}),_=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,F=y(X=>$e(X,n.companyId)),R=ze(F.controllers),{creditAccount:B,creditAccountRepayment:T}=y(X=>Ze(X)),N=y(X=>X.classListState.fetchState),d=!E&&l&&f,h=y(X=>Ma(X,t,d,l)),[P,w]=c.useState(!1),U=h.chargeCard,j=U?.cardCreatedByUser?.userId,$=y(X=>j!=null?ba(X.userRoleState,j):void 0),H=$?.accountingClassIDs[0],V=y(X=>H!=null?ya(X.classState,{classId:H,reportId:"class_list"}):void 0),A=U?.cardHolderUser?.userId,L=y(X=>A!=null?ba(X.userRoleState,A):void 0),W=L?.accountingClassIDs[0],k=y(X=>W!=null?ya(X.classState,{classId:W,reportId:"class_list"}):void 0),Y=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",q=U?.type.code==="business_physical_debit_card";c.useEffect(()=>{i&&I===!1&&Y&&(o(!0),setTimeout(()=>{a(Sa()),q&&a(oa({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[i,I,Y,q]),c.useEffect(()=>{P||h.fetchState==="Completed"||h.fetchState==="In-Progress"||t==null||(w(!0),a(Je(t,d,!1)))},[P,h,t,a]),c.useEffect(()=>{if(h.fetchState==="Completed"&&(Y===!1||Y&&U?.status?.code!=="active"||U?.cardHolderUserId!==r.userId||i===!1&&I===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=Ce(n.tenantEmailDomain,t,r,U,i);e(X)}},[h.fetchState,i,Y]),c.useEffect(()=>{B.fetchState!=="Completed"&&B.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a($a()),N!=="Completed"&&N!=="In-Progress"&&a(mt())},[B.fetchState,T.fetchState,a,l,f,m,N]);const z=()=>{if(r!=null&&t!=null){a(Sa());const X=Ce(n.tenantEmailDomain,t,r);e(X)}},x=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",oe=Oe(l,b,_,f),ee=Ca(l,f,m,B,T),te=Gt(x,h);return h.fetchState!=="Completed"?s.jsx(la,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(xa,{showConfetti:i}),s.jsx(lr,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:R,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:b,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:f,productInformation:oe,creditAccountInformation:ee,debitAccountInformation:te,chargeCardDetailView:h,creditAccount:B,classListFetchState:N,creditAccountRepayment:T,cardIssuedByRoles:$?.userRoles,cardIssuedByDepartmentName:V?.className,cardHolderRoles:L?.userRoles,cardHolderDepartmentName:k?.className})]})}const Nr=pe(function(e){const t=Ye(e);return{insightsData:t.insight,cashbackByPeriod:t.cashbackByPeriod,uiState:t.uiState,cashbackSummary:t.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(t,a)=>{e(Qt({uiState:{sortKey:t,sortOrder:a}}))}}})(mr);function Hr(){const e=le(),t=ue(),a=ge(),r=J.getSignedInUser(),n=y(S=>ce(S)),{useFeatureGate:C}=se(),{isFeatureEnabled:m}=C(Z.isCardsCommentingEnabled),[g,I]=c.useState(!1),o=y(S=>Ye(S)),i=Yt(n.companyId,{clearParams:o.fetchState==="Completed"}),E=c.useCallback(()=>{const S=ve(a.state?.pathnameStackToGoBack),f=S.poppedPathname??Mr(n.tenantEmailDomain);e(f,{state:{pathnameStackToGoBack:S.newStack}})},[e,a,n.tenantEmailDomain]);if(c.useEffect(()=>{g||o.fetchState==="Completed"||o.fetchState==="In-Progress"||(I(!0),t(Ct()))},[g,o,t]),r==null)throw Error("Can't access cashback detail page without signing in...");return o.fetchState==="In-Progress"?s.jsx(ur,{onBackClick:E}):o.cashbackSummary.cashbackEarned.amount===0&&o.fetchState==="Completed"?s.jsx(La,{}):s.jsx(Nr,{onBackClick:E,isCardsCommentingEnabled:m,initialOpenThreadRequest:i})}const Mr=e=>`/${e}/cards`,Gr={containerWidth:new ma(100,58)},$r=({appContent:e})=>{const t=ua(),a=ue(),r=le(),{cardId:n}=ca(),C=ge(),{useDynamicConfig:m}=se(),[g,I]=c.useState(!1),[o,i]=c.useState(!1),[E,S]=c.useState(!1),[f,O]=c.useState(!1),v=J.getSignedInUser();if(v==null)throw Error("Can't access onboarding card page without signing in...");const D=y(k=>ce(k));if(n==null)throw Error("Empty card id is not valid...");const{configValue:p}=m(Fe.zeniCardsConfig),u=p.max_charge_card_activation_attempts_by_card_id,b=y(k=>Xt(k,n)),l=b.chargeCard,_=y(k=>k.chargeCardConfigState.fetchState),{useFeatureGate:F}=se(),{isFeatureEnabled:R}=F(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=F(Z.isDebitCardFeatureEnabled),T=Se(B,D),N=Ie({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:T}),d=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,h=D.userRole.includes("charge_card_user"),P=be(D),w=ye(D),U=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,j=Ae({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:w,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:U}),$=!h&&j&&d;c.useEffect(()=>{g===!1&&_!=="In-Progress"&&_!=="Completed"&&(a(Da()),I(!0)),o===!1&&b.fetchState==="Not-Started"&&(i(!0),a(Je(n,$,j)))},[o,b.fetchState,g,_]);const H=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";c.useEffect(()=>{if(b.fetchState==="Completed"){if(E===!1&&(H===!1||H&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==v.userId)){const k=Ce(D.tenantEmailDomain,n,v,l,!0),Y=fe(C.state?.pathnameStackToGoBack,C.pathname);r(k,{state:{pathnameStackToGoBack:Y}})}else if(E&&b.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){a(Jt({chargeCardId:n}));const k=Ce(D.tenantEmailDomain,n,v,l,!0),Y=fe(C.state?.pathnameStackToGoBack,C.pathname);a(_a()),r(k,{state:{pathnameStackToGoBack:Y}})}}},[b.fetchState,l?.type.code,E,b.isRefreshingViewInBackground]);const V=J.getZeniOtpTokenForCardHolder(n),A=y(k=>pt(k.userState,v.userId)),L=()=>{l?.status?.code!=="active"&&a(za(n,!0))};c.useEffect(()=>{b.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(k=>k.statusCode==="success")===!0&&E===!1&&(setTimeout(L,3e3),S(!0))},[b.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const W=k=>{O(k)};if(_!=="Completed"||l==null)return s.jsx(la,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(A?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Yr,{children:[s.jsx(Ge,{isAppContentDrawerOpen:f,handleDrawerToggle:W}),s.jsx(zr,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:A.phone,signedInUser:v,isSandboxEnv:Ka(),chargeCardDetailState:b,signedInUserToken:V,navigate:r,currentTenant:D,location:C,maxChargeCardActivationAttempts:u[n]!=null?u[n]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{W(!0)}}),e!=null?s.jsx(Zr,{windowSize:t,children:e}):null]})},zr=pe(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const C=en(e.addressState,a);if(C==null)throw Error("Can't access shippingAddress.");const m=ht(e,n),g=t.updateStatus,I=Ke(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(an())||i,showMenuIcon:o,shippingAddress:C,vgsVaultId:Ba.cardVaultId,twoFAView:m,activationWaitStatus:g,isRefreshingViewInBackground:t.isRefreshingViewInBackground}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:C,chargeCardDetailState:m}=t,g=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=C;return{onGetOtp:o=>{g!=null&&e(Ta(o,"ChargeCardHolder",r))},onUpdatePhysicalChargeCardAttempt:o=>{e(nn(r,o))},onResendOtp:o=>{g!=null&&e(wa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{g!=null&&e(Pa(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&J.saveZeniOtpTokenForCardHolder(o,r)},onCVVActivateSuccess:()=>{e(tn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("onboard")===!0?Ve(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(Cr),Zr=_e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Gr.containerWidth.value(e.windowSize)}%`};
|
|
5
5
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
6
|
-
`,
|
|
6
|
+
`,Yr=_e.div`
|
|
7
7
|
display: flex;
|
|
8
8
|
min-height: 100%;
|
|
9
9
|
width: 100%;
|
|
@@ -11,18 +11,18 @@ import{j as s}from"./liveblocks-iTHbJlig.js";import{h as le,i as ca,u as ue,j as
|
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
align-items: center;
|
|
13
13
|
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,Ea=qa.getLocalizedStrings().dateFormat,Kr={overlayWidth:new ma(100,100,58)},Wr=pe(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:dn(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:ln(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:C,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:g,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:E,cashbackInformation:S,paymentSourceInformation:f,creditAccountInformation:O,debitAccountInformation:v,paymentInitiatedDate:D,sourcePage:p}=t,{tenantEmailDomain:u}=r;return{onBackNavigation:()=>{if(m&&g&&I&&S!=null&&Q.trackCardsPayEarlyFormClick(o,E,S,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:D?.add(3,"day").format(Ea.visual.MMMDCommaYYYYformat),paymentInitiatedDate:D?.format(Ea.visual.MMMDCommaYYYYformat)},f,O,v),p==="cardPaymentHistory")t.closeDrawerHandler(!0),e(bt());else{const b=Ve(u);a(b)}},onUpdatePaymentAccountStatus:(b,l,
|
|
14
|
+
`,Ea=qa.getLocalizedStrings().dateFormat,Kr={overlayWidth:new ma(100,100,58)},Wr=pe(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:dn(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:ln(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:C,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:g,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:E,cashbackInformation:S,paymentSourceInformation:f,creditAccountInformation:O,debitAccountInformation:v,paymentInitiatedDate:D,sourcePage:p}=t,{tenantEmailDomain:u}=r;return{onBackNavigation:()=>{if(m&&g&&I&&S!=null&&Q.trackCardsPayEarlyFormClick(o,E,S,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:D?.add(3,"day").format(Ea.visual.MMMDCommaYYYYformat),paymentInitiatedDate:D?.format(Ea.visual.MMMDCommaYYYYformat)},f,O,v),p==="cardPaymentHistory")t.closeDrawerHandler(!0),e(bt());else{const b=Ve(u);a(b)}},onUpdatePaymentAccountStatus:(b,l,_)=>{e(Cn(b,l,"bill_pay","bill_pay_detail",_))},onEstablishConnectionSuccess:()=>{e(Fa(r.companyId,!0))},onFetchLinkTokenClick:b=>{e(mn("external_account",b))},onEstablishConnectionClick:b=>{e(un(b,r.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{n?window.open(`/${u}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{C?window.open(`/${u}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}})(pr),at=({isPaymentDrawerOpen:e,closeDrawerHandler:t,pageName:a,creditAccountSpentAmount:r,productInformation:n,sourcePage:C,creditAccountInformation:m,debitAccountInformation:g,cashbackInformation:I,isDebitCardInfoFetchStateCompleted:o,isCreditCardInfoFetchStateCompleted:i,isCashbackInfoFetchStateCompleted:E,paymentInitiatedDate:S,retryRepayment:f})=>{const O=le(),{useDynamicConfig:v}=se(),{configValue:D}=v(Fe.zeniAccountsConfig),p=rn(D),u=y(z=>ft(z)),{creditAccount:b}=y(z=>Ze(z)),l=y(z=>ce(z)),_=Wa(),F=ua(),R=ue(),B=J.getSignedInUser(),T=je(),[N,d]=c.useState(!1),[h,P]=c.useState(!1),{configValue:w}=v(Fe.zeniCardsConfig),U=w.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??w.default_credit_card_auto_pay_threshold??Lr,j=gt(T?.loggedInUserRoleMap),$=sn(T?.loggedInUserRoleMap),H=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,V=y(z=>da(z,l.companyId)),A=V.companyChargeCardInfo?.primaryFundingAccount,L=V.allFundingAccounts.find(z=>z.id===A?.accountId),W=y(z=>$e(z,l.companyId)),k=ze(W.controllers);c.useEffect(()=>{if(u.fetchState!=="Completed"&&u.fetchState!=="In-Progress"&&R(on()),u.fetchState==="Completed"&&!h){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,x=u.transferFromAccounts.find(ee=>ee.id===z);let oe;if(C==="cardPaymentHistory"&&f){const ee=f.paymentAccountId!=null?u.transferFromAccounts.find(te=>te.id===f.paymentAccountId):void 0;oe={amount:f.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ot(),transferFrom:ee??x}}else oe={amount:{amount:b.balance.amount+b.hold.amount,currencyCode:b.balance.currencyCode,currencySymbol:b.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ot(),transferFrom:x};R(tt(oe)),P(!0)}},[u.fetchState,h,C,f,u.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,b.balance.amount,b.balance.currencyCode,b.balance.currencySymbol,b.hold.amount,R]);const Y={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:L?.accType==="depositAccount",creditCardPaymentSourceAccountName:L?.label,creditCardPaymentSourceAccountType:L?.accType,creditCardPaymentSourceLastFourDigits:L?.accountLast4,creditCardPaymentSourceBalance:L?.accountBalance?.available?.amount??0};if(c.useEffect(()=>{V.fetchState!=="Completed"&&V.fetchState!=="In-Progress"&&R(Fa(l.companyId,!0))},[V.fetchState]),c.useEffect(()=>{u.updateStatus==="Completed"&&I!=null&&E&&i&&o&&Q.trackCardsPayEarlyPayNowClick(k,n,I,u.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:u.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:u.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:u.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:u.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:S?.add(3,"day").format(Ea.visual.MMMDCommaYYYYformat),paymentInitiatedDate:S?.format(Ea.visual.MMMDCommaYYYYformat)},Y,m,g)},[u.updateStatus,I,E,i,o,S]),c.useEffect(()=>{u.fetchState==="Completed"&&I!=null&&E&&i&&o&&!N&&e&&h&&I!=null&&(Q.trackCardsPayEarlyFormView(k,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,b.balance.amount,Y,m,g),d(!0))},[u,E,i,o,N,e,h]),B==null)throw Error("Can't access invite people page without signing in...");const q=()=>{t(!0),R(bt())};return s.jsx(s.Fragment,{children:s.jsx(Mt,{onClose:()=>{q()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Kr.overlayWidth.valuePercentage(F),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:_.colors.black,opacity:.75,cursor:"pointer"}}},children:s.jsx(qr,{onClick:z=>z.stopPropagation(),children:s.jsx(Wr,{closeDrawerHandler:t,navigate:O,paymentDetails:u,creditAccountSpentAmount:r,onTransferClick:()=>{E&&i&&o&&I!=null&&Q.trackCardsPayEarlyFormClick(k,n,I,"Pay Now",u.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:u.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:u.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:u.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:u.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},Y,m,g),R(cn({companyId:l.companyId}))},onDismissClick:q,onSaveChangesToLocalStore:z=>{R(tt(z))},currentTenant:l,hasZeniAccountsAdminAccess:j,isZeniAccountsUser:$,isZeniAccountSetupEnabled:H,productInformation:n,sourcePage:C,controllerEmails:k,autoPayThreshold:U,paymentSourceInformation:Y,creditAccountInformation:m,debitAccountInformation:g,cashbackInformation:I,isCashbackInfoFetchStateCompleted:E,isCreditCardInfoFetchStateCompleted:i,isDebitCardInfoFetchStateCompleted:o,paymentInitiatedDate:S,maxInsuredAmount:p.maxInsuredAmount})})})})},qr=_e(Br)`
|
|
15
15
|
display: flex;
|
|
16
16
|
min-height: 100%;
|
|
17
17
|
flex-direction: column;
|
|
18
|
-
`,Wt="charge-card-transaction-update",Oa=qa.getLocalizedStrings().dateFormat,Qr=pe(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:C}=t,m=J.getSignedInUser(),g=e.tenantState.currentTenantId,I={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},o=Ma(e,r,a,C),i=hn(e,r),E=fn(e);return{chargeCardDetailView:o,chargeCardsRecurringExpensesState:i,vgsVaultId:Ba.cardVaultId,transactionAttachmentsEndpointToFetch:`${Na}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Na}/card_transaction_attachment`,authParams:I,isSnackbarOpen:E.isSnackbarOpen,cardsEndPoint:`${Vt.cardMicroServiceBaseUrl}`,signedInUserToken:o.twoFAView.token??n}},function(e,t){const{cardId:a,currentTenant:r,navigate:n,location:C,cardProviderId:m,includeCreditAccountInfo:g,setIsPaymentOpen:I,controllerEmails:o,productInformation:i,cashbackInformation:E,primaryFundingAccountDetails:S,creditAccountInformation:f,debitAccountInformation:O,isChargeCardFeatureEnabled:v}=t,{tenantEmailDomain:D}=r;return{onEventReceived:p=>{p===Wt&&(e(za(a,!0)),e(nt(a,null,null,!0)))},onReloadTransactions:()=>{e(Je(a,g,v))},onFetchChargeCardTransactionList:(p,u)=>{e(nt(a,p,u))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{m!=null&&e(Ta(p,"ChargeCardHolder",a))},onResendOtp:p=>{m!=null&&e(wa(p,"ChargeCardHolder",a))},onVerifyOtp:(p,u)=>{m!=null&&e(_a(p,u,"ChargeCardHolder",a))},onVerifyOtpSuccess:p=>{p!=null&&J.saveZeniOtpTokenForCardHolder(p,a)},onColorCodeChange:p=>{e(An(a,p))},onLockChargeCard:(p,u)=>{e(_t(p,a,u))},onUnlockChargeCard:p=>{e(Pt(p,a))},onCloseChargeCard:p=>{e(Dt(a,p))},onFetchChargeCardsRecurringExpenses:()=>{e(kt([a]))},updateChargeCardName:(p,u)=>{e(Et(p,a,u))},updateChargeCardTransactionAttachments:(p,u)=>{u!=null&&e(In({transactionId:p,data:u}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,u,b,l)=>{e(Sn({chargeCardId:u,transactionId:p,fetchState:b,error:l}))},updateChargeCardTransactionReceiptsShowTick:(p,u,b)=>{e(yn({chargeCardId:u,transactionId:p,shouldShowTick:b}))},onChargeCardRevokeInviteClick:()=>{e(At(a))},updateChargeCardTransactionIsViewReceiptClicked:(p,u,b)=>{e(bn({chargeCardId:u,transactionId:p,isViewReceiptClicked:b}))},onChargeCardTransactionRowClick:(p,u)=>{const b=fe(C.state?.pathnameStackToGoBack,C.pathname);n(`../../transaction/${p}/${u}`,{state:{pathnameStackToGoBack:b}})},onBackClick:()=>{const p=ve(C.state?.pathnameStackToGoBack),u=Ve(D);n(u,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(gn())},onUpdateDebitCardPinAttempt:p=>{e(It(a,p)),p==="success"&&e(oa({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,u)=>{p?e(oa({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):u!=null&&e(oa({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:u.message}]}))},updateSpendLimit(p,u,b,l){e(St(p,u,b.code,l))},shouldOpenCreditCardPaymentDrawer(p){p&&E!=null&&Q.trackCardsPayEarlyClick(o,i,E,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:S?.accType==="depositAccount",creditCardPaymentSourceAccountName:S?.label,creditCardPaymentSourceAccountType:S?.accType,creditCardPaymentSourceLastFourDigits:S?.accountLast4,creditCardPaymentSourceBalance:S?.accountBalance?.available?.amount??0},f,O),I(p)}}})(fr(gr));function Xr(){const e=le(),t=ue(),a=ge(),{cardId:r}=ca(),[n,C]=c.useState(!1),[m,g]=c.useState(!1),{useDynamicConfig:I}=se(),o=J.getSignedInUser(),i=y(M=>ce(M)),E=y(M=>ka(M).firstViewAfterActivation),S=y(M=>M.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:O}=I(Fe.zeniCardsConfig),v=O.enable_card_controls_for_company_ids,D=O.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(v)&&v.includes(i.companyId),[p,u]=c.useState(!1),[b,l]=c.useState(!1),{useFeatureGate:P}=se(),{isFeatureEnabled:F}=P(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:R}=P(Y.isDebitCardFeatureEnabled),B=Se(R,i),T=Ie({isDebitCardFeatureEnabled:R,isBankingOnlyTenant:B}),{isFeatureEnabled:H}=P(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=P(Y.isCardsCommentingEnabled),h=ye(i),_=be(i),w=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Ae({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:F,isBookKeepingTenant:h,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:w}),j=!!i.companyDebitCardInfo?.info?.isDebitCardEnabled,$=!!i.companyChargeCardInfo?.info?.isChargeCardEnabled,N=!i.userRole.includes("charge_card_user")&&U&&$;if(r==null)throw Error("Empty card id is not valid...");const V=y(M=>da(M,i.companyId)),{creditAccount:A,creditAccountRepayment:L}=y(M=>Ye(M)),W=J.getZeniOtpTokenForCardHolder(r),k=y(M=>Ma(M,r,N,U)),{isAiCfoAccessEnabled:Z,onAskAiCfoClick:q}=Kt({mobileExploreReferrer:"Card Detail"});jt({isDataReady:k.fetchState==="Completed"});const z=y(M=>Ze(M)),x=k.chargeCard,oe=je(),ee=Ue(oe?.loggedInUserRoleMap),te=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_virtual_debit_card",X=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_physical_credit_card",re=x?.type.code==="business_virtual_debit_card"||x?.type.code==="business_virtual_credit_card",Ee=x?.type.code==="business_virtual_debit_card",xe=Ca(U,$,ee,A,L),K=Gt(te,k),he=Ja(ee,z),ke=Oe(U,T,j,$),Be=k.depositAccountLimitFetchState.fetchState!=="Completed"&&k.depositAccountLimitFetchState.fetchState!=="In-Progress",_e=y(M=>$e(M,i.companyId)),we=ze(_e.controllers),ae=y(M=>x?.cardCreatedByUser?.userId!=null?ba(M.userRoleState,x?.cardCreatedByUser?.userId):void 0),pa=y(M=>ae?.accountingClassIDs[0]!=null?ya(M.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0),ie=y(M=>x?.cardHolderUser?.userId!=null?ba(M.userRoleState,x?.cardHolderUser?.userId):void 0),ea=y(M=>ie?.accountingClassIDs[0]!=null?ya(M.classState,{classId:ie?.accountingClassIDs[0],reportId:"class_list"}):void 0),de=i?.userRole,Le=y(M=>Ke(M,!1,T,F).revokeCardInvite),aa=Qa(Le.saveStatus.fetchState);if(c.useEffect(()=>{if(aa==="In-Progress"&&Le.saveStatus.fetchState==="Completed"){const M=Ve(i.tenantEmailDomain);e(M)}},[aa,Le.saveStatus.fetchState,e,i.tenantEmailDomain]),c.useEffect(()=>{E&&n===!1&&re&&(C(!0),setTimeout(()=>{t(Sa()),Ee&&t(oa({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[E,n,re,Ee]),c.useEffect(()=>{p||k.fetchState==="Completed"||k.fetchState==="In-Progress"||r==null||(u(!0),t(Je(r,N,U,!1)))},[p,k,r,t]),c.useEffect(()=>{!b&&k.fetchState==="Completed"&&k.chargeCard?.connectedAccountId!=null&&te&&Be&&ee&&(l(!0),t(yt({depositAccountId:k.chargeCard?.connectedAccountId})))},[b,k,t,Be,ee]),c.useEffect(()=>{z.fetchState!=="Completed"&&z.fetchState!=="In-Progress"&&ee&&t(Ct()),S!=="Completed"&&S!=="In-Progress"&&t(mt()),k.transactionStatistics.fetchState!=="Completed"&&k.transactionStatistics.fetchState!=="In-Progress"&&t(pn({chargeCardId:r})),V.fetchState!=="Completed"&&V.fetchState!=="In-Progress"&&t(Fa(i.companyId,!0))},[z.fetchState,t,ee,S,k.transactionStatistics.fetchState,V.fetchState]),c.useEffect(()=>{if(!(k.fetchState!=="Completed"||U&&A.fetchState!=="Completed"||x==null||k.transactionStatistics.fetchState!=="Completed"||te&&ee&&k.depositAccountLimitFetchState.fetchState!=="Completed")){const M=x.type.code.includes("physical"),me=M?x.cardActivationAttemptHistory[0]?.timestamp:x.createTime;Q.trackCardsCardDetailView(we,ke,{cardId:r,cardName:x.cardName,cardType:x.type.code.includes("credit")?"credit":"debit",cardCategory:M?"physical":"virtual",cardLimit:Qe(x.limit.amount),cardLastFourDigits:x.accountLast4,cardStatus:x.status.code,cardAssignedDate:x.createTime?.format(Oa.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:x.providerCardCreateTime?.format(Oa.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:me?.format(Oa.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:x.creditLimitFrequency.name,cardSpentAmount:Qe(x.balance.amount),cardAvailableLimit:Qe(x.available.amount),cardUtilizationPercent:x.limit.amount>0?Math.round((x.limit.amount-x.available.amount)/x.limit.amount*100):0,cardUtilizationAmount:Qe(x.limit.amount-x.available.amount),totalNumberOfDeclinedTransactions:k.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:k.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:k.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:k.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:k.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:k.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:Ha(x.cardCreatedByUser,!1),cardIssuedByEmail:x.cardCreatedByUser?.email,cardIssuedByUserId:x.cardCreatedByUser?.userId,cardIssuedByRole:ae?.userRoles,cardIssuedByDepartment:pa?.className},{cardholderName:Ha(x.cardHolderUser,!1),cardholderEmail:x.cardHolderUser?.email,cardholderRole:ie?.userRoles,cardholderUserId:x.cardHolderUser?.userId,cardholderDepartment:ea?.className},xe,K)}},[k.fetchState,k.depositAccountLimitFetchState.fetchState,k.transactionStatistics.fetchState,A.fetchState,ee]),o==null)throw Error("Can't access card detail page without signing in...");const We=i.companyId??J.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ta={events:We!=null?[`private-encrypted-${We}.${Wt}`]:[],eventCallback:(M,me,Te)=>{Te.onEventReceived(M)}},na=()=>{if(r!=null&&x!=null){const{ownerName:M,cardName:me,utilisation:Te,limit:He,frequency:qe,cardColor:G}=ja(x),De=x.cardHolderUserId===o.userId;Q.trackCardsDetailPageViewed(r,M,me,Te,He,qe,G,De)}};c.useEffect(()=>{if(k.fetchState==="Completed"){const M=k.chargeCard;if(M?.status.code==="inactive"||te&&M?.isPinSet===!1||X&&E){const me=Ce(i.tenantEmailDomain,r,o,x,E);e(me)}}},[k.fetchState]);const ra=(M,me)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:He,utilisation:qe,limit:G,frequency:De}=ja(x),Ne=x.cardHolderUserId===o.userId;Q.trackCardsDetailPageClicked(r,Te,He,qe,G,De,M,Ne,me)}},sa=(M,me)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:He,utilisation:qe,limit:G,frequency:De}=ja(x),Ne=x.cardHolderUserId===o.userId;Q.trackCardsVerifyPopUpClick(r,Te,He,qe,G,De,M,Ne,me)}},Ra=A.balance.amount+A.hold.amount,ha=i.companyChargeCardInfo?.info?.primaryFundingAccount,fa=V.allFundingAccounts.find(M=>M.id===ha?.accountId);return r==null||k.fetchState==="Error"?s.jsx(La,{}):k.fetchState==="In-Progress"||k.fetchState==="Not-Started"||Le.saveStatus.fetchState==="In-Progress"||te&&ee&&k.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(hr,{}):s.jsxs(s.Fragment,{children:[s.jsx(xa,{showConfetti:E}),k.fetchState==="Completed"?s.jsx(Xa,{analytics:Q,onLoad:na}):null,m===!0?s.jsx(at,{closeDrawerHandler:()=>g(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:ke,creditAccountInformation:xe,debitAccountInformation:K,cashbackInformation:he,creditAccountSpentAmount:Ra,isDebitCardInfoFetchStateCompleted:!te||!ee||k.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||A.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!ee||z.fetchState==="Completed",paymentInitiatedDate:L.initiatedRepaymentDate}):null,s.jsx(Qr,{...ta,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:sa,onFireOnClickAnalytics:ra,isSandboxEnv:Ka(),signedInUser:o,location:a,navigate:e,setIsPaymentOpen:g,cardIssuedByRoles:ae?.userRoles,cardIssuedByDepartmentName:pa?.className,cardHolderRoles:ie?.userRoles,cardHolderDepartmentName:ea?.className,loggedInUserRole:de,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:j,isChargeCardSetupEnabled:$,isCardControlsEnabled:D,isEarlyPayEnabled:H,controllerEmails:we,chargeCardCashbackDetailState:z,productInformation:ke,creditAccountInformation:xe,debitAccountInformation:K,cashbackInformation:he,classListFetchState:S,primaryFundingAccountDetails:fa,currentTenant:i,cardProviderId:k.chargeCard?.cardProviderID,cardId:r,creditAccount:A,creditAccountRepayment:L,includeCreditAccountInfo:N,signedInUserToken:W,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:Z,onAskAiCfoClick:q,isCardsCommentingEnabled:d})]})}const ja=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,C=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:C,limit:n}},Jr=Pe.div`
|
|
18
|
+
`,Wt="charge-card-transaction-update",Oa=qa.getLocalizedStrings().dateFormat,Qr=pe(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:C}=t,m=J.getSignedInUser(),g=e.tenantState.currentTenantId,I={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},o=Ma(e,r,a,C),i=hn(e,r),E=fn(e);return{chargeCardDetailView:o,chargeCardsRecurringExpensesState:i,vgsVaultId:Ba.cardVaultId,transactionAttachmentsEndpointToFetch:`${Ha}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Ha}/card_transaction_attachment`,authParams:I,isSnackbarOpen:E.isSnackbarOpen,cardsEndPoint:`${Vt.cardMicroServiceBaseUrl}`,signedInUserToken:o.twoFAView.token??n}},function(e,t){const{cardId:a,currentTenant:r,navigate:n,location:C,cardProviderId:m,includeCreditAccountInfo:g,setIsPaymentOpen:I,controllerEmails:o,productInformation:i,cashbackInformation:E,primaryFundingAccountDetails:S,creditAccountInformation:f,debitAccountInformation:O,isChargeCardFeatureEnabled:v}=t,{tenantEmailDomain:D}=r;return{onEventReceived:p=>{p===Wt&&(e(za(a,!0)),e(nt(a,null,null,!0)))},onReloadTransactions:()=>{e(Je(a,g,v))},onFetchChargeCardTransactionList:(p,u)=>{e(nt(a,p,u))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{m!=null&&e(Ta(p,"ChargeCardHolder",a))},onResendOtp:p=>{m!=null&&e(wa(p,"ChargeCardHolder",a))},onVerifyOtp:(p,u)=>{m!=null&&e(Pa(p,u,"ChargeCardHolder",a))},onVerifyOtpSuccess:p=>{p!=null&&J.saveZeniOtpTokenForCardHolder(p,a)},onColorCodeChange:p=>{e(An(a,p))},onLockChargeCard:(p,u)=>{e(Pt(p,a,u))},onUnlockChargeCard:p=>{e(_t(p,a))},onCloseChargeCard:p=>{e(Dt(a,p))},onFetchChargeCardsRecurringExpenses:()=>{e(kt([a]))},updateChargeCardName:(p,u)=>{e(Et(p,a,u))},updateChargeCardTransactionAttachments:(p,u)=>{u!=null&&e(In({transactionId:p,data:u}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,u,b,l)=>{e(Sn({chargeCardId:u,transactionId:p,fetchState:b,error:l}))},updateChargeCardTransactionReceiptsShowTick:(p,u,b)=>{e(yn({chargeCardId:u,transactionId:p,shouldShowTick:b}))},onChargeCardRevokeInviteClick:()=>{e(At(a))},updateChargeCardTransactionIsViewReceiptClicked:(p,u,b)=>{e(bn({chargeCardId:u,transactionId:p,isViewReceiptClicked:b}))},onChargeCardTransactionRowClick:(p,u)=>{const b=fe(C.state?.pathnameStackToGoBack,C.pathname);n(`../../transaction/${p}/${u}`,{state:{pathnameStackToGoBack:b}})},onBackClick:()=>{const p=ve(C.state?.pathnameStackToGoBack),u=Ve(D);n(u,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(gn())},onUpdateDebitCardPinAttempt:p=>{e(It(a,p)),p==="success"&&e(oa({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,u)=>{p?e(oa({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):u!=null&&e(oa({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:u.message}]}))},updateSpendLimit(p,u,b,l){e(St(p,u,b.code,l))},shouldOpenCreditCardPaymentDrawer(p){p&&E!=null&&Q.trackCardsPayEarlyClick(o,i,E,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:S?.accType==="depositAccount",creditCardPaymentSourceAccountName:S?.label,creditCardPaymentSourceAccountType:S?.accType,creditCardPaymentSourceLastFourDigits:S?.accountLast4,creditCardPaymentSourceBalance:S?.accountBalance?.available?.amount??0},f,O),I(p)}}})(fr(gr));function Xr(){const e=le(),t=ue(),a=ge(),{cardId:r}=ca(),[n,C]=c.useState(!1),[m,g]=c.useState(!1),{useDynamicConfig:I}=se(),o=J.getSignedInUser(),i=y(M=>ce(M)),E=y(M=>ka(M).firstViewAfterActivation),S=y(M=>M.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:O}=I(Fe.zeniCardsConfig),v=O.enable_card_controls_for_company_ids,D=O.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(v)&&v.includes(i.companyId),[p,u]=c.useState(!1),[b,l]=c.useState(!1),{useFeatureGate:_}=se(),{isFeatureEnabled:F}=_(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:R}=_(Z.isDebitCardFeatureEnabled),B=Se(R,i),T=Ie({isDebitCardFeatureEnabled:R,isBankingOnlyTenant:B}),{isFeatureEnabled:N}=_(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=_(Z.isCardsCommentingEnabled),h=ye(i),P=be(i),w=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Ae({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:F,isBookKeepingTenant:h,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:w}),j=!!i.companyDebitCardInfo?.info?.isDebitCardEnabled,$=!!i.companyChargeCardInfo?.info?.isChargeCardEnabled,H=!i.userRole.includes("charge_card_user")&&U&&$;if(r==null)throw Error("Empty card id is not valid...");const V=y(M=>da(M,i.companyId)),{creditAccount:A,creditAccountRepayment:L}=y(M=>Ze(M)),W=J.getZeniOtpTokenForCardHolder(r),k=y(M=>Ma(M,r,H,U)),{isAiCfoAccessEnabled:Y,onAskAiCfoClick:q}=Kt({mobileExploreReferrer:"Card Detail"});jt({isDataReady:k.fetchState==="Completed"});const z=y(M=>Ye(M)),x=k.chargeCard,oe=je(),ee=Ue(oe?.loggedInUserRoleMap),te=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_virtual_debit_card",X=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_physical_credit_card",re=x?.type.code==="business_virtual_debit_card"||x?.type.code==="business_virtual_credit_card",Ee=x?.type.code==="business_virtual_debit_card",xe=Ca(U,$,ee,A,L),K=Gt(te,k),he=Ja(ee,z),ke=Oe(U,T,j,$),Be=k.depositAccountLimitFetchState.fetchState!=="Completed"&&k.depositAccountLimitFetchState.fetchState!=="In-Progress",Pe=y(M=>$e(M,i.companyId)),we=ze(Pe.controllers),ae=y(M=>x?.cardCreatedByUser?.userId!=null?ba(M.userRoleState,x?.cardCreatedByUser?.userId):void 0),pa=y(M=>ae?.accountingClassIDs[0]!=null?ya(M.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0),ie=y(M=>x?.cardHolderUser?.userId!=null?ba(M.userRoleState,x?.cardHolderUser?.userId):void 0),ea=y(M=>ie?.accountingClassIDs[0]!=null?ya(M.classState,{classId:ie?.accountingClassIDs[0],reportId:"class_list"}):void 0),de=i?.userRole,Le=y(M=>Ke(M,!1,T,F).revokeCardInvite),aa=Qa(Le.saveStatus.fetchState);if(c.useEffect(()=>{if(aa==="In-Progress"&&Le.saveStatus.fetchState==="Completed"){const M=Ve(i.tenantEmailDomain);e(M)}},[aa,Le.saveStatus.fetchState,e,i.tenantEmailDomain]),c.useEffect(()=>{E&&n===!1&&re&&(C(!0),setTimeout(()=>{t(Sa()),Ee&&t(oa({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[E,n,re,Ee]),c.useEffect(()=>{p||k.fetchState==="Completed"||k.fetchState==="In-Progress"||r==null||(u(!0),t(Je(r,H,U,!1)))},[p,k,r,t]),c.useEffect(()=>{!b&&k.fetchState==="Completed"&&k.chargeCard?.connectedAccountId!=null&&te&&Be&&ee&&(l(!0),t(yt({depositAccountId:k.chargeCard?.connectedAccountId})))},[b,k,t,Be,ee]),c.useEffect(()=>{z.fetchState!=="Completed"&&z.fetchState!=="In-Progress"&&ee&&t(Ct()),S!=="Completed"&&S!=="In-Progress"&&t(mt()),k.transactionStatistics.fetchState!=="Completed"&&k.transactionStatistics.fetchState!=="In-Progress"&&t(pn({chargeCardId:r})),V.fetchState!=="Completed"&&V.fetchState!=="In-Progress"&&t(Fa(i.companyId,!0))},[z.fetchState,t,ee,S,k.transactionStatistics.fetchState,V.fetchState]),c.useEffect(()=>{if(!(k.fetchState!=="Completed"||U&&A.fetchState!=="Completed"||x==null||k.transactionStatistics.fetchState!=="Completed"||te&&ee&&k.depositAccountLimitFetchState.fetchState!=="Completed")){const M=x.type.code.includes("physical"),me=M?x.cardActivationAttemptHistory[0]?.timestamp:x.createTime;Q.trackCardsCardDetailView(we,ke,{cardId:r,cardName:x.cardName,cardType:x.type.code.includes("credit")?"credit":"debit",cardCategory:M?"physical":"virtual",cardLimit:Qe(x.limit.amount),cardLastFourDigits:x.accountLast4,cardStatus:x.status.code,cardAssignedDate:x.createTime?.format(Oa.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:x.providerCardCreateTime?.format(Oa.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:me?.format(Oa.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:x.creditLimitFrequency.name,cardSpentAmount:Qe(x.balance.amount),cardAvailableLimit:Qe(x.available.amount),cardUtilizationPercent:x.limit.amount>0?Math.round((x.limit.amount-x.available.amount)/x.limit.amount*100):0,cardUtilizationAmount:Qe(x.limit.amount-x.available.amount),totalNumberOfDeclinedTransactions:k.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:k.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:k.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:k.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:k.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:k.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:k.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:Na(x.cardCreatedByUser,!1),cardIssuedByEmail:x.cardCreatedByUser?.email,cardIssuedByUserId:x.cardCreatedByUser?.userId,cardIssuedByRole:ae?.userRoles,cardIssuedByDepartment:pa?.className},{cardholderName:Na(x.cardHolderUser,!1),cardholderEmail:x.cardHolderUser?.email,cardholderRole:ie?.userRoles,cardholderUserId:x.cardHolderUser?.userId,cardholderDepartment:ea?.className},xe,K)}},[k.fetchState,k.depositAccountLimitFetchState.fetchState,k.transactionStatistics.fetchState,A.fetchState,ee]),o==null)throw Error("Can't access card detail page without signing in...");const We=i.companyId??J.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ta={events:We!=null?[`private-encrypted-${We}.${Wt}`]:[],eventCallback:(M,me,Te)=>{Te.onEventReceived(M)}},na=()=>{if(r!=null&&x!=null){const{ownerName:M,cardName:me,utilisation:Te,limit:Ne,frequency:qe,cardColor:G}=ja(x),De=x.cardHolderUserId===o.userId;Q.trackCardsDetailPageViewed(r,M,me,Te,Ne,qe,G,De)}};c.useEffect(()=>{if(k.fetchState==="Completed"){const M=k.chargeCard;if(M?.status.code==="inactive"||te&&M?.isPinSet===!1||X&&E){const me=Ce(i.tenantEmailDomain,r,o,x,E);e(me)}}},[k.fetchState]);const ra=(M,me)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:Ne,utilisation:qe,limit:G,frequency:De}=ja(x),He=x.cardHolderUserId===o.userId;Q.trackCardsDetailPageClicked(r,Te,Ne,qe,G,De,M,He,me)}},sa=(M,me)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:Ne,utilisation:qe,limit:G,frequency:De}=ja(x),He=x.cardHolderUserId===o.userId;Q.trackCardsVerifyPopUpClick(r,Te,Ne,qe,G,De,M,He,me)}},Ra=A.balance.amount+A.hold.amount,ha=i.companyChargeCardInfo?.info?.primaryFundingAccount,fa=V.allFundingAccounts.find(M=>M.id===ha?.accountId);return r==null||k.fetchState==="Error"?s.jsx(La,{}):k.fetchState==="In-Progress"||k.fetchState==="Not-Started"||Le.saveStatus.fetchState==="In-Progress"||te&&ee&&k.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(hr,{}):s.jsxs(s.Fragment,{children:[s.jsx(xa,{showConfetti:E}),k.fetchState==="Completed"?s.jsx(Xa,{analytics:Q,onLoad:na}):null,m===!0?s.jsx(at,{closeDrawerHandler:()=>g(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:ke,creditAccountInformation:xe,debitAccountInformation:K,cashbackInformation:he,creditAccountSpentAmount:Ra,isDebitCardInfoFetchStateCompleted:!te||!ee||k.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||A.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!ee||z.fetchState==="Completed",paymentInitiatedDate:L.initiatedRepaymentDate}):null,s.jsx(Qr,{...ta,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:sa,onFireOnClickAnalytics:ra,isSandboxEnv:Ka(),signedInUser:o,location:a,navigate:e,setIsPaymentOpen:g,cardIssuedByRoles:ae?.userRoles,cardIssuedByDepartmentName:pa?.className,cardHolderRoles:ie?.userRoles,cardHolderDepartmentName:ea?.className,loggedInUserRole:de,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:j,isChargeCardSetupEnabled:$,isCardControlsEnabled:D,isEarlyPayEnabled:N,controllerEmails:we,chargeCardCashbackDetailState:z,productInformation:ke,creditAccountInformation:xe,debitAccountInformation:K,cashbackInformation:he,classListFetchState:S,primaryFundingAccountDetails:fa,currentTenant:i,cardProviderId:k.chargeCard?.cardProviderID,cardId:r,creditAccount:A,creditAccountRepayment:L,includeCreditAccountInfo:H,signedInUserToken:W,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:Y,onAskAiCfoClick:q,isCardsCommentingEnabled:d})]})}const ja=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,C=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:C,limit:n}},Jr=_e.div`
|
|
19
19
|
display: flex;
|
|
20
20
|
width: 100%;
|
|
21
21
|
flex: 1 1 auto;
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
align-items: center;
|
|
24
24
|
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,es=pe(function(e,t){const a=Ke(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:En(e),bulkActionView:kn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:C,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:g,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:E,isDebitCardSetupEnabled:S,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:O,controllerEmails:v,depositAccountListWithDebitCardIssued:D,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:u,productInformation:b,cashbackInformation:l,creditAccountInformation:P,debitAccountInformation:F,updatePayNowInfoTooltip:R,isUserHasCardsAdminLevelAccess:B}=t,{tenantEmailDomain:T}=r,{cards:H}=m;return{onChargeCardRowClick:(d,h)=>{const _=zt(H,d);let w;_!=null&&((j=>{const $=j.limit.amount-j.available.amount,N=`${j.cardHolderUser?.firstName.toLowerCase()} ${j.cardHolderUser?.lastName.toLowerCase()}`,V=j.cardName,A=j.department?.className??"",L=j.limit.amount,W=j.creditLimitFrequency.name;Q.trackCardsListRowClicked(N,V,A,$,L,W,C.userId===j.cardHolderUserId)})(_),Me(E,S,D)&&Q.trackCardsCardListRowClick(v,b,"Card Row Item","row_clicked",h+1,{cardOwner:Ha(_.cardHolderUser,!1),cardName:_.cardName,cardType:_.type.code.includes("credit")?"credit":"debit",cardStatus:_.status.code,cardUtilizationAmount:Qe(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Qe(_.limit.amount)},l,P,F)),w=_?.status.code==="request_on_hold"&&C.userId===_.cardHolderUserId?Yt(T):Ce(T,d,C,_);const U=fe(n.state?.pathnameStackToGoBack,n.pathname);a(w,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:d=>{e(kt(d))},onFetchDepositAccountLimit:d=>{e(yt({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(xn(d))},onChargeCardRevokeInviteClick:d=>{e(At(d))},onLockChargeCardList:(d,h)=>{e(vn(d,h))},onUnlockChargeCardList:d=>{e(Fn(d))},onCloseChargeCardList:(d,h)=>{e(Tn(d,h))},onRevokeChargeCardList:d=>{e(wn(d))},updateChargeCardListSpendLimit(d,h,_){e(_n(d,h,_.code))},onLockChargeCard:(d,h)=>{e(_t(B,d,h))},onUnlockChargeCard:d=>{e(Pt(B,d))},onCloseChargeCard:(d,h)=>{e(Dt(d,h))},onUpdateSpendLimit(d,h,_,w){e(St(d,h,_.code,w))},updateChargeCardName:(d,h)=>{e(Et(B,d,h))},onClickSetupIcon:()=>{Q.trackCardsListPageClicked("settings"),Me(E,S,D)&&l!=null&&Q.trackCardsSettingsClick(v,b,l,P,F);const d=Ur(T),h=fe(n.state?.pathnameStackToGoBack,n.pathname);a(d,{state:{pathnameStackToGoBack:h}})},onIssueCardClick:()=>{Q.trackCardsListPageClicked("new card"),Me(E,S,D)&&l!=null&&Q.trackCardsNewCardClick(v,b,l,"New Button","card_creation_initiated","Card List",P,F);const d=as(T),h=fe(n.state?.pathnameStackToGoBack,n.pathname);a(d,{state:{pathnameStackToGoBack:h}})},onColumnSortConfigChanged:(d,h)=>{Me(E,S,D)&&l!=null&&Q.trackCardsCardListSortClick(v,b,l,"Sort Icon","sort",d,h==="ascending"?"ASC":"DESC","Cards List",P,F),e(Va({uiState:{sortKey:d,sortOrder:h}}))},onSearchTextChanged:d=>{e(Pn(d))},onReloadCards:()=>{e(Ia(g,E&&S,I&&i,!0))},onLetsGoClick:()=>{a("./onboard")},onBackClick:()=>{a("../../")},onTotalCashbackClick:()=>{Me(E,S,D)&&l!=null&&Q.trackCardsCashbackOverviewClick(v,b,l,"Cashback Overview","cashback_details_viewed",P,F),a("./cashback")},onClickStatementsIcon:()=>{Me(E,S,D)&&l!=null&&Q.trackCardsStatementsClick(v,b,l,P,F),a("./statements")},onCreateNowClick:d=>{Me(E,S,D)&&l!=null&&Q.trackCardsNewCardClick(v,b,l,"Promo Banner","card_creation_initiated","Card List",P,F),a(`./new?cardType=${d}`)},onPromoCardClick:d=>{a(d==="debit"&&E&&!f||d==="credit"&&o&&!O?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,h)=>{u==="Completed"&&r.company!=null&&l!=null&&Q.trackCardsPayEarlyClick(v,b,l,"Card List",d,h,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},P,F);const _=ts(T);a(_)},navigateToCreditCardPaymentHistoryPage:()=>{const d=ns(T),h=fe(n.state?.pathnameStackToGoBack,n.pathname);a(d,{state:{pathnameStackToGoBack:h}})},shouldShowPayNowInfoTooltip:R,onSetRowActionCardId:d=>{e(Dn(d))},onSetBulkActionCardIds:d=>{e(wt(d))}}})(br);function it({isPaymentDrawerOpen:e}){const t=le(),a=ue(),r=ge(),n=c.useCallback((G,De)=>{a(wt([])),t(G,De)},[a,t]),[C,m]=c.useState(!1),[g,I]=c.useState(J.getPayNowInfoTooltip()??!1),o=G=>{J.savePayNowInfoTooltip(G),I(G)},[i,E]=c.useState(!1),S=J.getSignedInUser(),f=y(G=>ce(G)),[O,v]=c.useState(!1),[D,p]=c.useState(!1),{isAiCfoAccessEnabled:u,onAskAiCfoClick:b}=Kt({mobileExploreReferrer:"Cards"}),l=f.userRole.includes("charge_card_user"),P=!l,F=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:R,useDynamicConfig:B}=se(),{isFeatureEnabled:T}=R(Y.isCashbackFeatureEnabled),{isFeatureEnabled:H}=R(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=R(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:h}=R(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:_}=R(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:w}=R(Y.isCardsCommentingEnabled),U=Se(d,f),j=Ie({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:U}),$=be(f),N=ye(f),V=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Ae({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:H,isBookKeepingTenant:N,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:V}),L=$t({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:H,isBookKeepingTenant:N}),{configValue:W}=B(Fe.zeniCardsConfig),k=je(),Z=Ue(k?.loggedInUserRoleMap),q=y(G=>$e(G,f.companyId)),z=ze(q.controllers),x=W.charge_card_cashback_rate_per_transaction!=null?W.charge_card_cashback_rate_per_transaction:.0175,oe=W.credit_card_pay_now_threshold_by_company_id?.[f.companyId]??W.default_credit_card_pay_now_threshold??Rr,ee=W.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(W.enable_card_controls_for_company_ids)&&W.enable_card_controls_for_company_ids.includes(f.companyId),te=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,X=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!f.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=y(G=>ft(G)),xe=Qa(Ee.updateStatus),K=y(G=>Ke(G,P,j&&F,A&&re)),he=K.cards.filter(G=>G.type.code.includes("debit")).map(G=>G.connectedAccountId),ke=[...new Set(he)],Be=y(G=>Ze(G)),_e=y(G=>va(G,ke)),we=y(G=>da(G,f.companyId)),ae=we.companyChargeCardInfo?.primaryFundingAccount,pa=we.allFundingAccounts.find(G=>G.id===ae?.accountId),ie=K.fetchState,ea=K.creditAccount;jt({isDataReady:ie==="Completed"});const{creditAccountRepayment:de}=y(G=>Ye(G)),Le=y(G=>ka(G).firstViewAfterActivation),{areTenantIdsInSync:aa}=Ht(),We=Ja(Z,Be),ta=Ca(A,re,Z,ea,de),na=et(j,F,Z,_e,K.debitCardSummary),ra=Oe(A,j,F,re),sa=K.creditAccount.balance.amount+K.creditAccount.hold.amount;if(c.useEffect(()=>{ie==="Completed"&&(J.getPayNowInfoTooltip()==null||sa<oe*K.creditAccount.limit.amount/100)&&o(!0)},[ie,oe,sa,K.creditAccount.limit.amount]),c.useEffect(()=>{if(e!=null&&e===!0&&de.initiatedRepayments.amount===0&&de.fetchState==="Completed"||xe==="In-Progress"&&Ee.updateStatus==="Completed")o(!1),m(!0);else if(de.initiatedRepayments.amount>0&&de.fetchState==="Completed"){m(!1),document.body.style.overflow="auto";const G=Ve(f.tenantEmailDomain);n(G)}},[e,de.initiatedRepayments.amount,de.fetchState,xe,Ee.updateStatus,n,f.tenantEmailDomain]),c.useEffect(()=>{!O&&(re||F)&&aa&&(v(!0),a(Ia(P,j&&F,A&&re,!1)))},[O,P,a,aa]),c.useEffect(()=>{Le&&i===!1&&(E(!0),setTimeout(()=>{a(Sa())},5e3))},[Le,i]),c.useEffect(()=>{ie==="Completed"&&l&&K.cards.length===1&&(K.cards[0].status.code==="inactive"&&K.cards[0].type.code==="business_physical_credit_card"?n(`./${K.cards[0].id}/activate`):K.cards[0].status.code!=="request_on_hold"&&(r.state?.message==="comingFromCardDetail"?n("../../"):n(`./${K.cards[0].id}`)))},[ie,l,r.state,n,K.cards]),c.useEffect(()=>{if(ie==="Completed"&&l){const G=K.cards.length,De=K.cards.filter(Ne=>Ne.cardHolderUserId===S?.userId).filter(Ne=>Ne.status.code==="request_on_hold");De.length>0&&G===De.length&&n("./onboard")}},[ie,K.cards,l,n,S?.userId]),c.useEffect(()=>{ie!=="Completed"||A&&de.fetchState!=="Completed"||j&&F&&Z&&_e.fetchState!=="Completed"||Q.trackCardsCardListView(z,ra,We,ta,na)},[ie,ea,de.fetchState,_e.fetchState,Z]),S==null)throw Error("Can't access charge card list page without signing in...");const Ra=y(G=>Tt(G.userState,G.userRoleState,G.userListViewState,"cardAdmin")),ha=Ya(k?.loggedInUserRoleMap),fa=G=>{p(G)},M=K.creditAccount.limit,me=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&Xe({cardInfo:f.companyChargeCardInfo.info,isProductVisible:A,isTOSAccepted:te,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:Z,isUserHasCardsAccess:ha}),He=f.companyDebitCardInfo?.info!=null&&Xe({cardInfo:f.companyDebitCardInfo.info,isProductVisible:j,isTOSAccepted:X,isSetupEnabled:F,isUserHasCardsAdminLevelAccess:Z,isUserHasCardsAccess:ha});return re||F?s.jsxs(s.Fragment,{children:[ie==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(Xa,{analytics:Q,onLoad:()=>{Q.trackPageLoaded(Nt.Event.cardsListPage),(A&&!re||j&&!F)&&Q.trackCardsPromoView(z,{isCreditCardOffered:A,isDebitCardOffered:j,isDebitCardEnabled:F,isCreditCardEnabled:re},"Banner",j&&!F?"Debit Card":A&&!re?"Credit Card":"","Card List")}}),s.jsx(xa,{showConfetti:Le})]}):null,C===!0?s.jsx(at,{closeDrawerHandler:me,isPaymentDrawerOpen:C,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:sa,productInformation:ra,creditAccountInformation:ta,debitAccountInformation:na,cashbackInformation:We,isDebitCardInfoFetchStateCompleted:!(j&&F&&Z)||_e.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||de.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!Z||Be.fetchState==="Completed",paymentInitiatedDate:de.initiatedRepaymentDate}):null,s.jsxs(Jr,{children:[s.jsx(Ge,{isAppContentDrawerOpen:D,handleDrawerToggle:fa}),s.jsx(es,{isCashbackFeatureEnabled:T,isChargeCardFeatureEnabled:A,isDebitCardFeatureEnabled:j,isCreditCardProductVisibleForExpressInterest:L,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:g,creditCardPayNowThreshold:oe,signedInUser:S,chargeCardListState:K,location:r,admins:Ra.users,navigateAndClearBulkSelection:n,currentTenant:f,isCardControlsEnabled:ee,companyChargeCardInfoCreditAccountLimit:f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:f.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:Z,includeCreditAccountDebitSummaryAndCashbackInfo:P,onClickMenuIcon:()=>{fa(!0)},creditLimit:M,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:F,isEarlyPayEnabled:h,isChargeCardPaymentHistoryFeatureEnabled:_,cashbackRate:x,controllerEmails:z,chargeCardCashbackDetailState:Be,depositAccountListWithDebitCardIssued:_e,isChargeCardTOSAccepted:te,isDebitCardTOSAccepted:X,primaryFundingAccountDetails:pa,chargeCardSetUpViewFetchState:we.fetchState,productInformation:ra,creditAccountInformation:ta,debitAccountInformation:na,cashbackInformation:We,isAiCfoAccessEnabled:u,onAskAiCfoClick:b,isCardsCommentingEnabled:w})]})]}):(te||X)&&Z===!0?s.jsx(ga,{to:"../setup"}):Te||He?s.jsx(ga,{to:"../promo"}):s.jsx(la,{fetchState:ie})}const as=e=>`/${e}/cards/new`,ts=e=>`/${e}/cards/payment`,ns=e=>`/${e}/cards/payment-history`,rs=pe(function(e){const t=J.getSignedInUser(),a=ce(e),r=e.tenantState.currentTenantId,n=Ft(e),C={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""},m=a?.companyName??"",g=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:n.fetchState,filters:n.filters,isZeniTenant:Bn(a),repaymentList:n.repaymentHistory,searchText:n.searchText,repaymentHistoryUsers:n.repaymentHistoryUsers,sortConfig:{sortKey:n.uiState.sortKey,sortOrder:n.uiState.sortOrder},downloadParams:{authParams:C,companyName:m,spendManagementEndPoint:`${Na}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:g}},function(e,t){const{location:a,navigate:r}=t;return{onBackClick:()=>{const n=ve(a.state?.pathnameStackToGoBack),C=n.poppedPathname??"..";r(C,{state:{pathnameStackToGoBack:n.newStack}})},onColumnSortConfigChanged:(n,C)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:n,sortOrder:C}}})},onFiltersChange:n=>{e(Rn({filters:n}))},onReloadPayments:()=>{e(vt(!0))},onSearchTextChanged:n=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:n})},updateDownloadStateHandler:n=>{e(Ln({uiState:{downloadState:n}}))}}})(yr);function ss(){const e=le(),t=ge(),a=ue(),{areTenantIdsInSync:r}=Ht(),{useFeatureGate:n}=se();if(J.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const C=y(q=>ce(q)),m=y(q=>Ft(q)),[g,I]=c.useState(!1),[o,i]=c.useState(!1),[E,S]=c.useState(!1),[f,O]=c.useState(null),v=!C.userRole.includes("charge_card_user"),D=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=n(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:u}=n(Y.isDebitCardFeatureEnabled),b=Se(u,C),l=Ie({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:b}),P=be(C),F=ye(C),R=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Ae({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:p,isBookKeepingTenant:F,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:R}),T=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,H=je(),d=Ue(H?.loggedInUserRoleMap),h=y(q=>Ke(q,v,l&&D,B&&T)),_=c.useMemo(()=>{const q=h.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(q.map(z=>z.connectedAccountId))]},[h.cards]),w=y(q=>Ze(q)),U=y(q=>va(q,_)),{creditAccountRepayment:j}=y(q=>Ye(q)),$=c.useMemo(()=>Ja(d,w),[d,w]),N=c.useMemo(()=>Ca(B,T,d,h.creditAccount,j),[B,T,d,h.creditAccount,j]),V=c.useMemo(()=>et(l,D,d,U,h.debitCardSummary),[l,D,d,U,h.debitCardSummary]),A=c.useMemo(()=>Oe(B,l,D,T),[B,l,D,T]),L=h.creditAccount.balance.amount+h.creditAccount.hold.amount,W=c.useMemo(()=>f!=null?m.repaymentHistory.find(q=>q.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),k=c.useCallback(q=>{O(q),a(Ia(v,l&&D,B&&T,!1)),S(!0)},[a,v,l,D,B,T]),Z=c.useCallback(()=>{S(!1),O(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{g||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(vt()))},[g,a,m.fetchState]),c.useEffect(()=>{!o&&(T||D)&&r&&(i(!0),a(Ia(v,!1,B&&T,!1)))},[o,T,D,r,a,v,B]),s.jsxs(s.Fragment,{children:[E?s.jsx(at,{closeDrawerHandler:Z,isPaymentDrawerOpen:E,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:L,productInformation:A,creditAccountInformation:N,debitAccountInformation:V,cashbackInformation:$,isDebitCardInfoFetchStateCompleted:!(l&&D&&d)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!B||j.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||w.fetchState==="Completed",paymentInitiatedDate:j.initiatedRepaymentDate,retryRepayment:W}):null,s.jsx(rs,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:k})]})}const ct=Pe.div`
|
|
25
|
+
`,es=pe(function(e,t){const a=Ke(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:En(e),bulkActionView:kn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:C,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:g,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:E,isDebitCardSetupEnabled:S,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:O,controllerEmails:v,depositAccountListWithDebitCardIssued:D,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:u,productInformation:b,cashbackInformation:l,creditAccountInformation:_,debitAccountInformation:F,updatePayNowInfoTooltip:R,isUserHasCardsAdminLevelAccess:B}=t,{tenantEmailDomain:T}=r,{cards:N}=m;return{onChargeCardRowClick:(d,h)=>{const P=zt(N,d);let w;P!=null&&((j=>{const $=j.limit.amount-j.available.amount,H=`${j.cardHolderUser?.firstName.toLowerCase()} ${j.cardHolderUser?.lastName.toLowerCase()}`,V=j.cardName,A=j.department?.className??"",L=j.limit.amount,W=j.creditLimitFrequency.name;Q.trackCardsListRowClicked(H,V,A,$,L,W,C.userId===j.cardHolderUserId)})(P),Me(E,S,D)&&Q.trackCardsCardListRowClick(v,b,"Card Row Item","row_clicked",h+1,{cardOwner:Na(P.cardHolderUser,!1),cardName:P.cardName,cardType:P.type.code.includes("credit")?"credit":"debit",cardStatus:P.status.code,cardUtilizationAmount:Qe(P.limit.amount-P.available.amount),cardUtilizationPercent:P.limit.amount>0?Math.round((P.limit.amount-P.available.amount)/P.limit.amount*100):0,cardLimit:Qe(P.limit.amount)},l,_,F)),w=P?.status.code==="request_on_hold"&&C.userId===P.cardHolderUserId?Zt(T):Ce(T,d,C,P);const U=fe(n.state?.pathnameStackToGoBack,n.pathname);a(w,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:d=>{e(kt(d))},onFetchDepositAccountLimit:d=>{e(yt({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(xn(d))},onChargeCardRevokeInviteClick:d=>{e(At(d))},onLockChargeCardList:(d,h)=>{e(vn(d,h))},onUnlockChargeCardList:d=>{e(Fn(d))},onCloseChargeCardList:(d,h)=>{e(Tn(d,h))},onRevokeChargeCardList:d=>{e(wn(d))},updateChargeCardListSpendLimit(d,h,P){e(Pn(d,h,P.code))},onLockChargeCard:(d,h)=>{e(Pt(B,d,h))},onUnlockChargeCard:d=>{e(_t(B,d))},onCloseChargeCard:(d,h)=>{e(Dt(d,h))},onUpdateSpendLimit(d,h,P,w){e(St(d,h,P.code,w))},updateChargeCardName:(d,h)=>{e(Et(B,d,h))},onClickSetupIcon:()=>{Q.trackCardsListPageClicked("settings"),Me(E,S,D)&&l!=null&&Q.trackCardsSettingsClick(v,b,l,_,F);const d=Ur(T),h=fe(n.state?.pathnameStackToGoBack,n.pathname);a(d,{state:{pathnameStackToGoBack:h}})},onIssueCardClick:()=>{Q.trackCardsListPageClicked("new card"),Me(E,S,D)&&l!=null&&Q.trackCardsNewCardClick(v,b,l,"New Button","card_creation_initiated","Card List",_,F);const d=as(T),h=fe(n.state?.pathnameStackToGoBack,n.pathname);a(d,{state:{pathnameStackToGoBack:h}})},onColumnSortConfigChanged:(d,h)=>{Me(E,S,D)&&l!=null&&Q.trackCardsCardListSortClick(v,b,l,"Sort Icon","sort",d,h==="ascending"?"ASC":"DESC","Cards List",_,F),e(Va({uiState:{sortKey:d,sortOrder:h}}))},onSearchTextChanged:d=>{e(_n(d))},onReloadCards:()=>{e(Ia(g,E&&S,I&&i,!0))},onLetsGoClick:()=>{a("./onboard")},onBackClick:()=>{a("../../")},onTotalCashbackClick:()=>{Me(E,S,D)&&l!=null&&Q.trackCardsCashbackOverviewClick(v,b,l,"Cashback Overview","cashback_details_viewed",_,F),a("./cashback")},onClickStatementsIcon:()=>{Me(E,S,D)&&l!=null&&Q.trackCardsStatementsClick(v,b,l,_,F),a("./statements")},onCreateNowClick:d=>{Me(E,S,D)&&l!=null&&Q.trackCardsNewCardClick(v,b,l,"Promo Banner","card_creation_initiated","Card List",_,F),a(`./new?cardType=${d}`)},onPromoCardClick:d=>{a(d==="debit"&&E&&!f||d==="credit"&&o&&!O?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,h)=>{u==="Completed"&&r.company!=null&&l!=null&&Q.trackCardsPayEarlyClick(v,b,l,"Card List",d,h,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},_,F);const P=ts(T);a(P)},navigateToCreditCardPaymentHistoryPage:()=>{const d=ns(T),h=fe(n.state?.pathnameStackToGoBack,n.pathname);a(d,{state:{pathnameStackToGoBack:h}})},shouldShowPayNowInfoTooltip:R,onSetRowActionCardId:d=>{e(Dn(d))},onSetBulkActionCardIds:d=>{e(wt(d))}}})(br);function it({isPaymentDrawerOpen:e}){const t=le(),a=ue(),r=ge(),n=c.useCallback((G,De)=>{a(wt([])),t(G,De)},[a,t]),[C,m]=c.useState(!1),[g,I]=c.useState(J.getPayNowInfoTooltip()??!1),o=G=>{J.savePayNowInfoTooltip(G),I(G)},[i,E]=c.useState(!1),S=J.getSignedInUser(),f=y(G=>ce(G)),[O,v]=c.useState(!1),[D,p]=c.useState(!1),{isAiCfoAccessEnabled:u,onAskAiCfoClick:b}=Kt({mobileExploreReferrer:"Cards"}),l=f.userRole.includes("charge_card_user"),_=!l,F=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:R,useDynamicConfig:B}=se(),{isFeatureEnabled:T}=R(Z.isCashbackFeatureEnabled),{isFeatureEnabled:N}=R(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=R(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:h}=R(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:P}=R(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:w}=R(Z.isCardsCommentingEnabled),U=Se(d,f),j=Ie({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:U}),$=be(f),H=ye(f),V=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Ae({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:N,isBookKeepingTenant:H,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:V}),L=$t({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:N,isBookKeepingTenant:H}),{configValue:W}=B(Fe.zeniCardsConfig),k=je(),Y=Ue(k?.loggedInUserRoleMap),q=y(G=>$e(G,f.companyId)),z=ze(q.controllers),x=W.charge_card_cashback_rate_per_transaction!=null?W.charge_card_cashback_rate_per_transaction:.0175,oe=W.credit_card_pay_now_threshold_by_company_id?.[f.companyId]??W.default_credit_card_pay_now_threshold??Rr,ee=W.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(W.enable_card_controls_for_company_ids)&&W.enable_card_controls_for_company_ids.includes(f.companyId),te=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,X=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!f.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=y(G=>ft(G)),xe=Qa(Ee.updateStatus),K=y(G=>Ke(G,_,j&&F,A&&re)),he=K.cards.filter(G=>G.type.code.includes("debit")).map(G=>G.connectedAccountId),ke=[...new Set(he)],Be=y(G=>Ye(G)),Pe=y(G=>va(G,ke)),we=y(G=>da(G,f.companyId)),ae=we.companyChargeCardInfo?.primaryFundingAccount,pa=we.allFundingAccounts.find(G=>G.id===ae?.accountId),ie=K.fetchState,ea=K.creditAccount;jt({isDataReady:ie==="Completed"});const{creditAccountRepayment:de}=y(G=>Ze(G)),Le=y(G=>ka(G).firstViewAfterActivation),{areTenantIdsInSync:aa}=Nt(),We=Ja(Y,Be),ta=Ca(A,re,Y,ea,de),na=et(j,F,Y,Pe,K.debitCardSummary),ra=Oe(A,j,F,re),sa=K.creditAccount.balance.amount+K.creditAccount.hold.amount;if(c.useEffect(()=>{ie==="Completed"&&(J.getPayNowInfoTooltip()==null||sa<oe*K.creditAccount.limit.amount/100)&&o(!0)},[ie,oe,sa,K.creditAccount.limit.amount]),c.useEffect(()=>{if(e!=null&&e===!0&&de.initiatedRepayments.amount===0&&de.fetchState==="Completed"||xe==="In-Progress"&&Ee.updateStatus==="Completed")o(!1),m(!0);else if(de.initiatedRepayments.amount>0&&de.fetchState==="Completed"){m(!1),document.body.style.overflow="auto";const G=Ve(f.tenantEmailDomain);n(G)}},[e,de.initiatedRepayments.amount,de.fetchState,xe,Ee.updateStatus,n,f.tenantEmailDomain]),c.useEffect(()=>{!O&&(re||F)&&aa&&(v(!0),a(Ia(_,j&&F,A&&re,!1)))},[O,_,a,aa]),c.useEffect(()=>{Le&&i===!1&&(E(!0),setTimeout(()=>{a(Sa())},5e3))},[Le,i]),c.useEffect(()=>{ie==="Completed"&&l&&K.cards.length===1&&(K.cards[0].status.code==="inactive"&&K.cards[0].type.code==="business_physical_credit_card"?n(`./${K.cards[0].id}/activate`):K.cards[0].status.code!=="request_on_hold"&&(r.state?.message==="comingFromCardDetail"?n("../../"):n(`./${K.cards[0].id}`)))},[ie,l,r.state,n,K.cards]),c.useEffect(()=>{if(ie==="Completed"&&l){const G=K.cards.length,De=K.cards.filter(He=>He.cardHolderUserId===S?.userId).filter(He=>He.status.code==="request_on_hold");De.length>0&&G===De.length&&n("./onboard")}},[ie,K.cards,l,n,S?.userId]),c.useEffect(()=>{ie!=="Completed"||A&&de.fetchState!=="Completed"||j&&F&&Y&&Pe.fetchState!=="Completed"||Q.trackCardsCardListView(z,ra,We,ta,na)},[ie,ea,de.fetchState,Pe.fetchState,Y]),S==null)throw Error("Can't access charge card list page without signing in...");const Ra=y(G=>Tt(G.userState,G.userRoleState,G.userListViewState,"cardAdmin")),ha=Za(k?.loggedInUserRoleMap),fa=G=>{p(G)},M=K.creditAccount.limit,me=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&Xe({cardInfo:f.companyChargeCardInfo.info,isProductVisible:A,isTOSAccepted:te,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:Y,isUserHasCardsAccess:ha}),Ne=f.companyDebitCardInfo?.info!=null&&Xe({cardInfo:f.companyDebitCardInfo.info,isProductVisible:j,isTOSAccepted:X,isSetupEnabled:F,isUserHasCardsAdminLevelAccess:Y,isUserHasCardsAccess:ha});return re||F?s.jsxs(s.Fragment,{children:[ie==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(Xa,{analytics:Q,onLoad:()=>{Q.trackPageLoaded(Ht.Event.cardsListPage),(A&&!re||j&&!F)&&Q.trackCardsPromoView(z,{isCreditCardOffered:A,isDebitCardOffered:j,isDebitCardEnabled:F,isCreditCardEnabled:re},"Banner",j&&!F?"Debit Card":A&&!re?"Credit Card":"","Card List")}}),s.jsx(xa,{showConfetti:Le})]}):null,C===!0?s.jsx(at,{closeDrawerHandler:me,isPaymentDrawerOpen:C,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:sa,productInformation:ra,creditAccountInformation:ta,debitAccountInformation:na,cashbackInformation:We,isDebitCardInfoFetchStateCompleted:!(j&&F&&Y)||Pe.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||de.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!Y||Be.fetchState==="Completed",paymentInitiatedDate:de.initiatedRepaymentDate}):null,s.jsxs(Jr,{children:[s.jsx(Ge,{isAppContentDrawerOpen:D,handleDrawerToggle:fa}),s.jsx(es,{isCashbackFeatureEnabled:T,isChargeCardFeatureEnabled:A,isDebitCardFeatureEnabled:j,isCreditCardProductVisibleForExpressInterest:L,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:g,creditCardPayNowThreshold:oe,signedInUser:S,chargeCardListState:K,location:r,admins:Ra.users,navigateAndClearBulkSelection:n,currentTenant:f,isCardControlsEnabled:ee,companyChargeCardInfoCreditAccountLimit:f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:f.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:Y,includeCreditAccountDebitSummaryAndCashbackInfo:_,onClickMenuIcon:()=>{fa(!0)},creditLimit:M,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:F,isEarlyPayEnabled:h,isChargeCardPaymentHistoryFeatureEnabled:P,cashbackRate:x,controllerEmails:z,chargeCardCashbackDetailState:Be,depositAccountListWithDebitCardIssued:Pe,isChargeCardTOSAccepted:te,isDebitCardTOSAccepted:X,primaryFundingAccountDetails:pa,chargeCardSetUpViewFetchState:we.fetchState,productInformation:ra,creditAccountInformation:ta,debitAccountInformation:na,cashbackInformation:We,isAiCfoAccessEnabled:u,onAskAiCfoClick:b,isCardsCommentingEnabled:w})]})]}):(te||X)&&Y===!0?s.jsx(ga,{to:"../setup"}):Te||Ne?s.jsx(ga,{to:"../promo"}):s.jsx(la,{fetchState:ie})}const as=e=>`/${e}/cards/new`,ts=e=>`/${e}/cards/payment`,ns=e=>`/${e}/cards/payment-history`,rs=pe(function(e){const t=J.getSignedInUser(),a=ce(e),r=e.tenantState.currentTenantId,n=Ft(e),C={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""},m=a?.companyName??"",g=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:n.fetchState,filters:n.filters,isZeniTenant:Bn(a),repaymentList:n.repaymentHistory,searchText:n.searchText,repaymentHistoryUsers:n.repaymentHistoryUsers,sortConfig:{sortKey:n.uiState.sortKey,sortOrder:n.uiState.sortOrder},downloadParams:{authParams:C,companyName:m,spendManagementEndPoint:`${Ha}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:g}},function(e,t){const{location:a,navigate:r}=t;return{onBackClick:()=>{const n=ve(a.state?.pathnameStackToGoBack),C=n.poppedPathname??"..";r(C,{state:{pathnameStackToGoBack:n.newStack}})},onColumnSortConfigChanged:(n,C)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:n,sortOrder:C}}})},onFiltersChange:n=>{e(Rn({filters:n}))},onReloadPayments:()=>{e(vt(!0))},onSearchTextChanged:n=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:n})},updateDownloadStateHandler:n=>{e(Ln({uiState:{downloadState:n}}))}}})(yr);function ss(){const e=le(),t=ge(),a=ue(),{areTenantIdsInSync:r}=Nt(),{useFeatureGate:n}=se();if(J.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const C=y(q=>ce(q)),m=y(q=>Ft(q)),[g,I]=c.useState(!1),[o,i]=c.useState(!1),[E,S]=c.useState(!1),[f,O]=c.useState(null),v=!C.userRole.includes("charge_card_user"),D=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:u}=n(Z.isDebitCardFeatureEnabled),b=Se(u,C),l=Ie({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:b}),_=be(C),F=ye(C),R=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Ae({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:p,isBookKeepingTenant:F,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:R}),T=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,N=je(),d=Ue(N?.loggedInUserRoleMap),h=y(q=>Ke(q,v,l&&D,B&&T)),P=c.useMemo(()=>{const q=h.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(q.map(z=>z.connectedAccountId))]},[h.cards]),w=y(q=>Ye(q)),U=y(q=>va(q,P)),{creditAccountRepayment:j}=y(q=>Ze(q)),$=c.useMemo(()=>Ja(d,w),[d,w]),H=c.useMemo(()=>Ca(B,T,d,h.creditAccount,j),[B,T,d,h.creditAccount,j]),V=c.useMemo(()=>et(l,D,d,U,h.debitCardSummary),[l,D,d,U,h.debitCardSummary]),A=c.useMemo(()=>Oe(B,l,D,T),[B,l,D,T]),L=h.creditAccount.balance.amount+h.creditAccount.hold.amount,W=c.useMemo(()=>f!=null?m.repaymentHistory.find(q=>q.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),k=c.useCallback(q=>{O(q),a(Ia(v,l&&D,B&&T,!1)),S(!0)},[a,v,l,D,B,T]),Y=c.useCallback(()=>{S(!1),O(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{g||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(vt()))},[g,a,m.fetchState]),c.useEffect(()=>{!o&&(T||D)&&r&&(i(!0),a(Ia(v,!1,B&&T,!1)))},[o,T,D,r,a,v,B]),s.jsxs(s.Fragment,{children:[E?s.jsx(at,{closeDrawerHandler:Y,isPaymentDrawerOpen:E,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:L,productInformation:A,creditAccountInformation:H,debitAccountInformation:V,cashbackInformation:$,isDebitCardInfoFetchStateCompleted:!(l&&D&&d)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!B||j.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||w.fetchState==="Completed",paymentInitiatedDate:j.initiatedRepaymentDate,retryRepayment:W}):null,s.jsx(rs,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:k})]})}const ct=_e.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
height: 100vh;
|
|
28
28
|
width: 100%;
|
|
@@ -31,12 +31,12 @@ import{j as s}from"./liveblocks-iTHbJlig.js";import{h as le,i as ca,u as ue,j as
|
|
|
31
31
|
overflow: auto;
|
|
32
32
|
align-items: center;
|
|
33
33
|
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,dt=qa.getLocalizedStrings().months;function os(){const e=le(),t=ue(),a=ge(),{creditAccount:r,creditAccountRepayment:n}=y(A=>
|
|
34
|
+
`,dt=qa.getLocalizedStrings().months;function os(){const e=le(),t=ue(),a=ge(),{creditAccount:r,creditAccountRepayment:n}=y(A=>Ze(A)),C=`${Vt.cardMicroServiceBaseUrl}/1.0/credit-accounts/${r.id}`,[m,g]=c.useState(!1),[I,o]=c.useState(!1),i=y(A=>Un(A)),{useFeatureGate:E}=se(),S=y(A=>ce(A)),{isFeatureEnabled:f}=E(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:O}=E(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:v}=E(Z.isCardsCommentingEnabled),D=Yt(v?S.companyId:void 0,{clearParams:v&&i.fetchState==="Completed"}),p=Se(O,S),u=Ie({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:p}),b=be(S),l=ye(S),_=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,F=Ae({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:f,isBookKeepingTenant:l,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:_}),R=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,B=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,T=y(A=>$e(A,S.companyId)),N=ze(T.controllers),d=y(A=>xt(A)),h=d.cards.filter(A=>A.type.code.includes("debit")).map(A=>A.connectedAccountId),P=[...new Set(h)],w=y(A=>va(A,P)),U=y(A=>On(A));c.useEffect(()=>{I||r.fetchState==="Completed"||r.fetchState==="In-Progress"||(g(!0),t(Ga()))},[m,t,r.fetchState]),c.useEffect(()=>{I||r.fetchState!=="Completed"||r.id==null||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(o(!0),t(jn(r.id)))},[I,t,r.fetchState,r.id,i.fetchState]),c.useEffect(()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&u&&R&&t(Bt()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&t(ia()),U.fetchState!=="Completed"&&U.fetchState!=="In-Progress"&&u&&R&&t(Vn()),n.fetchState!=="Completed"&&n.fetchState!=="In-Progress"&&F&&B&&t($a())},[w.fetchState,u,R,d.fetchState,U.fetchState,n.fetchState,F,B]),c.useEffect(()=>{if(i.fetchState==="Completed"&&r.fetchState==="Completed"&&n.fetchState==="Completed"&&d.fetchState==="Completed"&&(!u||!R||w.fetchState==="Completed"&&U.fetchState==="Completed")){let A="",L="";if(i.statements.length>0){const q=i.statements[i.statements.length-1].period,[z,x]=q.split("-"),oe=i.statements[0].period,[ee,te]=oe.split("-");A=`${dt[parseInt(x)-1]} ${z}`,L=`${dt[parseInt(te)-1]} ${ee}`}const W=Oe(F,u,R,B),k=Ca(F,B,!0,r,n),Y=et(u,R,!0,w,U);Q.trackCardsCreditCardStatementsView(N,W,{numberOfStatements:i.statements.length,oldestStatementMonthYear:A,latestStatementMonthYear:L},k,Y)}},[i.fetchState,r.fetchState,n.fetchState,w.fetchState,d.fetchState,U.fetchState]);const j=()=>{const A=ve(a.state?.pathnameStackToGoBack),L=A.poppedPathname??"..";e(L,{state:{pathnameStackToGoBack:A.newStack}})},$=y(A=>Ye(A)),H=J.getSignedInUser(),V={userId:H?.userId??"",sessionId:H?.zeniSessionId??"",tenantId:S.tenantId??""};if(H==null)throw Error("Can't access address page without signing in...");if(i.fetchState!=="Completed")return s.jsx(ct,{children:s.jsx(Sr,{onBackClick:j})});{const A=Oe(F,u,R,B);return s.jsx(ct,{children:s.jsx(Ir,{currentTenantCompanyName:S.companyName,statementListView:i,productInformation:A,onBackClick:j,authParams:V,controllerEmails:N,isChargeCardFeatureEnabled:F,isDebitCardFeatureEnabled:u,isDebitCardSetupEnabled:R,isChargeCardSetupEnabled:B,isCardsCommentingEnabled:v,initialOpenThreadRequest:D,chargeCardCashbackDetailState:$,creditAccount:r,creditAccountRepayment:n,depositAccountListWithDebitCardIssued:w,debitCardSummary:U,downloadEndPoint:C})})}}const is={containerWidth:new ma(100,58)},cs=({appContent:e})=>{const t=ua(),a=ue(),r=le(),n=ge(),{useDynamicConfig:C}=se(),[m,g]=c.useState(!1),[I,o]=c.useState(!1),[i,E]=c.useState(!1),[S,f]=c.useState(!1),[O,v]=c.useState(!1),[D,p]=c.useState(!1),u=J.getSignedInUser();if(u==null)throw Error("Can't access onboarding card page without signing in...");const b=y(L=>ce(L)),{configValue:l}=C(Fe.zeniCardsConfig),_=y(L=>Nn(L)),{tenantEmailDomain:F}=b,R=y(L=>L.settingsViewState.profile.fetchState),B=y(L=>L.chargeCardListState.fetchState),T=y(L=>L.settingsViewState.profile.userId),N=y(L=>L.chargeCardConfigState.fetchState);c.useEffect(()=>{m===!1&&R!=="In-Progress"&&R!=="Completed"&&(a(Hn()),g(!0)),I===!1&&N!=="In-Progress"&&N!=="Completed"&&(a(Da()),o(!0)),i===!1&&B==="Not-Started"&&(E(!0),a(ia()))},[m,i,B,I,N]),c.useEffect(()=>{R==="Completed"&&O===!1&&T!=null&&B==="Completed"&&_.cards.length>0&&(a(Mn({userId:T})),a(Lt({cardId:_.cards[_.cards.length-1].id})),v(!0))},[R,O,T,B]),c.useEffect(()=>{if(!S&&_.fetchState==="Completed"&&_.cards.length===0){const L=ve(n.state?.pathnameStackToGoBack),W=L.poppedPathname??Ve(F);r(W,{state:{pathnameStackToGoBack:L.newStack}})}},[_.fetchState,_.cards,S]);const d=y(L=>ka(L)),h=Qa(d.updateStatus.fetchState),P=d.currentDisplayedCardId,{useFeatureGate:w}=se(),{isFeatureEnabled:U}=w(Z.isChargeCardFeatureEnabled),j=!!b.companyChargeCardInfo?.info?.isChargeCardEnabled,$=!b.userRole.includes("charge_card_user")&&U&&j,H=y(L=>P!=null?Rt(L.chargeCardState,P):null),V=()=>{P!=null&&(a(Je(P,$,!0)),a(ia()),f(!0))};c.useEffect(()=>{if(S&&P!=null&&H!=null&&H.status.code!=="request_on_hold"){const L=Ce(b.tenantEmailDomain,P,u,H),W=fe(n.state?.pathnameStackToGoBack,n.pathname);a(Gn()),H?.type.code==="business_virtual_credit_card"&&a(_a()),r(L,{state:{pathnameStackToGoBack:W},replace:!0})}},[S,H?.status.code]),c.useEffect(()=>{h==="In-Progress"&&d.updateStatus.fetchState==="Completed"&&setTimeout(V,3e3)},[h,d.updateStatus.fetchState]);const A=L=>{p(L)};if(!S&&B!=="Completed"||R!=="Completed"||_.cards.length===0)return s.jsxs(lt,{children:[s.jsx(Ge,{isAppContentDrawerOpen:D,handleDrawerToggle:A}),s.jsx(Ar,{})]});if(T==null)throw Error("Can't access my userId.");return s.jsxs(lt,{children:[s.jsx(Ge,{isAppContentDrawerOpen:D,handleDrawerToggle:A}),s.jsx(ds,{chargeCardListView:_,cardUserOnboardingView:d,navigate:r,currentTenant:b,myUserId:T,location:n,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{A(!0)}}),e!=null?s.jsx(ls,{windowSize:t,children:e}):null]})},ds=pe(function(e,{currentTenant:t,cardUserOnboardingView:a,chargeCardListView:r,myUserId:n}){const C=Ke(e,!1,!1,!1);let m=!1;return C.fetchState==="Completed"&&C.cards.length<=1&&(m=!0),{cards:r.cards,showMenuIcon:m,companyLegalName:t.companyName,twoFAView:a.twoFAView,cardUserOnboardingLocalData:a.cardUserOnboardingLocalData??{userId:n},isDOBDisabled:a.isDOBPresent,onboardingProgressStatus:a.onboardingProgressStatus}},function(e,t){const{navigate:a,cardUserOnboardingView:r,location:n,currentTenant:C}=t,{tenantEmailDomain:m}=C;return{updateCardUserOnboardingLocalData:g=>{e(rt({localData:g}))},onGetOtp:g=>{if(r.cardUserOnboardingLocalData!=null){const I={...r.cardUserOnboardingLocalData,phone:g};e(rt({localData:I}))}e(Ta(g,"CardUserOnboarding"))},onResendOtp:g=>{e(wa(g,"CardUserOnboarding"))},onVerifyOtp:(g,I)=>{e(Pa(g,I,"CardUserOnboarding"))},onVerifyOtpSuccess:g=>{e($n()),g!=null&&J.saveZeniOtpToken(g)},setCurrentDisplayedCardId:g=>{e(Lt({cardId:g}))},onBackClick:()=>{const g=ve(n.state?.pathnameStackToGoBack),I=g.poppedPathname??Ve(m);a(I,{state:{pathnameStackToGoBack:g.newStack}})}}})(Er),ls=_e.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
width: ${e=>`${is.containerWidth.value(e.windowSize)}%`};
|
|
38
38
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
39
|
-
`,lt=
|
|
39
|
+
`,lt=_e.div`
|
|
40
40
|
display: flex;
|
|
41
41
|
min-height: 100%;
|
|
42
42
|
width: 100%;
|
|
@@ -44,13 +44,13 @@ import{j as s}from"./liveblocks-iTHbJlig.js";import{h as le,i as ca,u as ue,j as
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
align-items: center;
|
|
46
46
|
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,us={containerWidth:new ma(100,58)},ms=({appContent:e})=>{const t=ua(),a=ue(),r=le(),{cardId:n}=ca(),C=ge(),{useDynamicConfig:m,useFeatureGate:g}=se(),[I,o]=c.useState(!1),[i,E]=c.useState(!1),[S,f]=c.useState(!1),[O,v]=c.useState(!1),D=J.getSignedInUser();if(D==null)throw Error("Can't access onboarding card page without signing in...");const p=y(V=>ce(V));if(n==null)throw Error("Empty card id is not valid...");const{configValue:u}=m(Fe.zeniCardsConfig),b=y(V=>zn(V,n)),{isFeatureEnabled:l}=g(
|
|
47
|
+
`,us={containerWidth:new ma(100,58)},ms=({appContent:e})=>{const t=ua(),a=ue(),r=le(),{cardId:n}=ca(),C=ge(),{useDynamicConfig:m,useFeatureGate:g}=se(),[I,o]=c.useState(!1),[i,E]=c.useState(!1),[S,f]=c.useState(!1),[O,v]=c.useState(!1),D=J.getSignedInUser();if(D==null)throw Error("Can't access onboarding card page without signing in...");const p=y(V=>ce(V));if(n==null)throw Error("Empty card id is not valid...");const{configValue:u}=m(Fe.zeniCardsConfig),b=y(V=>zn(V,n)),{isFeatureEnabled:l}=g(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=g(Z.isDebitCardFeatureEnabled),F=Se(_,p),R=Ie({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:F}),B=be(p),T=ye(p),N=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,d=Ae({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:l,isBookKeepingTenant:T,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:N}),h=b.chargeCard,P=y(V=>V.chargeCardConfigState.fetchState);c.useEffect(()=>{I===!1&&P!=="In-Progress"&&P!=="Completed"&&(a(Da()),o(!0)),i===!1&&b.fetchState==="Not-Started"&&(E(!0),a(Je(n,!1,d)))},[i,b.fetchState,I,P]);const w=h?.type.code==="business_physical_debit_card"||h?.type.code==="business_virtual_debit_card";c.useEffect(()=>{if(b.fetchState==="Completed"){if(S===!1&&(w===!1||w&&h.status?.code!=="active"||w&&h.status.code==="active"&&h.isPinSet||h.cardHolderUserId!==D.userId)){const V=Ce(p.tenantEmailDomain,n,D,h,!0),A=fe(C.state?.pathnameStackToGoBack,C.pathname);r(V,{state:{pathnameStackToGoBack:A}})}else if(S&&b.isRefreshingViewInBackground===!1&&h?.isPinSet===!0){a(Zn({chargeCardId:n}));const V=Ce(p.tenantEmailDomain,n,D,h,!0),A=fe(C.state?.pathnameStackToGoBack,C.pathname);a(_a()),r(V,{state:{pathnameStackToGoBack:A}})}}},[b.fetchState,h?.type.code,S,b.isRefreshingViewInBackground]);const U=J.getZeniOtpTokenForCardHolder(n),j=y(V=>pt(V.userState,D.userId)),$=()=>{h?.isPinSet!==!0&&a(za(n,!0))};c.useEffect(()=>{b.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout($,3e3),f(!0))},[b.updateDebitCardPinAttemptFetchState.fetchState]);const H=V=>{v(V)};if(P!=="Completed"||h==null)return s.jsx(la,{fetchState:"In-Progress"});if(j?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(hs,{children:[s.jsx(Ge,{isAppContentDrawerOpen:O,handleDrawerToggle:H}),s.jsx(Cs,{cardId:n,card:h,phone:j.phone,signedInUser:D,isSandboxEnv:Ka(),debitCardDetailState:b,signedInUserToken:U,navigate:r,currentTenant:p,location:C,chargeCardCashbackRatePerTransaction:u.charge_card_cashback_rate_per_transaction!=null?u.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{H(!0)}}),e!=null?s.jsx(ps,{windowSize:t,children:e}):null]})},Cs=pe(function(e,{debitCardDetailState:t,cardId:a}){const r=ht(e,a),n=t.updateStatus,C=Ke(e,!1,!1,!1);let m=!1;return C.fetchState==="Completed"&&C.cards.length<=1&&(m=!0),{showMenuIcon:m,vgsVaultId:Ba.cardVaultId,twoFAView:r,setPinWaitStatus:n}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:C,debitCardDetailState:m}=t,g=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=C;return{onGetOtp:o=>{g!=null&&e(Ta(o,"ChargeCardHolder",r))},onUpdateDebitCardPinAttempt:o=>{e(It(r,o))},onResendOtp:o=>{g!=null&&e(wa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{g!=null&&e(Pa(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&J.saveZeniOtpTokenForCardHolder(o,r)},onSetPinSuccess:()=>{e(Yn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("activate")===!0?Ve(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(kr),ps=_e.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
width: ${e=>`${us.containerWidth.value(e.windowSize)}%`};
|
|
51
51
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
52
52
|
box-shadow: ${e=>`${Aa.sp0} 2px ${Aa.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
53
|
-
`,hs=
|
|
53
|
+
`,hs=_e.div`
|
|
54
54
|
display: flex;
|
|
55
55
|
min-height: 100%;
|
|
56
56
|
width: 100%;
|
|
@@ -59,7 +59,7 @@ import{j as s}from"./liveblocks-iTHbJlig.js";import{h as le,i as ca,u as ue,j as
|
|
|
59
59
|
align-items: center;
|
|
60
60
|
background-color: ${e=>e.theme.colors.grey4};
|
|
61
61
|
box-shadow: ${e=>`${Aa.sp0} 2px ${Aa.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
62
|
-
`,fs={overlayWidth:new ma(Ua[12],Ua[12],Ua[9])},gs=pe(function(e,t){const a=
|
|
62
|
+
`,fs={overlayWidth:new ma(Ua[12],Ua[12],Ua[9])},gs=pe(function(e,t){const a=Ya(e,!1,!1),r=t.lineId,n=a.customAddress[r],C=a.customAddressStatus[r]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:t.googleAPIKey,customAddress:n,customAddressStatus:C,lineId:r}},function(e,t){const{newCustomAddressId:a,lineId:r,chargeCardTypeOption:n}=t;return{onSubmitHandler:C=>{a!=null&&e(Ut(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`));const m=jr(C);e(qn({addressType:`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`,addressToCreate:m})),e(Qn(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`))},onDismissClick:()=>{t.onDismissClick(),a!=null&&e(Wn({addressId:a,cardLineId:r,cardType:n==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Dr),bs=({lineId:e,closeDrawerHandler:t,chargeCardTypeOption:a})=>{const r=Wa(),n=ua(),C=()=>{t()},m=y(g=>Kn(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,g))?.newAddressId;return s.jsx(Mt,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:fs.overlayWidth.valuePercentage(n),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:r.colors.black,cursor:"pointer"}}},onClose:(g,I)=>(I==="backdropClick"||I==="escapeKeyDown")&&C(),children:s.jsx(gs,{googleAPIKey:Ba.googleMapsAPIKey,onDismissClick:C,lineId:e,chargeCardTypeOption:a,newCustomAddressId:m})})},ys=pe(function(e,t){const{isChargeCardFeatureEnabled:a,isDebitCardFeatureEnabled:r,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:C,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:g}=t,I=Ya(e,a&&m,r&&g);return{issueChargeCards:I,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:C,isDebitCardFeatureEnabled:r,isChargeCardFeatureEnabled:a,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:g,cardHolderCandidates:I.userList.map(o=>o.user).filter(Boolean),allRoles:I.userList.map(o=>o.userRole),allAccountingClasses:I.allAccountingClasses,userList:I.userList}},function(e,t){return{onIssueCardClick:()=>{e(er())},onSaveChangesToLocalStore:a=>{e(Jn(a))},onDismissClick:()=>{e(Ot()),t.navigate("../")},resetCustomAddressByLineID:(a,r)=>{e(Ut(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(wr);function Ss(){const e=J.getSignedInUser(),t=le(),a=ue(),r=_r(),[n]=ut(),C=n.get("cardType"),{useFeatureGate:m}=se(),{isFeatureEnabled:g}=m(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isChargeCardFeatureEnabled),E=y($=>ce($)),S=Se(o,E),f=Ie({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:S}),O=be(E),v=ye(E),D=E.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=Ae({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:i,isBookKeepingTenant:v,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:D}),[u,b]=c.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");c.useEffect(()=>{u||(b(!0),a(Xn(f&&_,p&&l,!1)))},[u,b,a]);const l=!!E.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!!E.companyDebitCardInfo?.info?.isDebitCardEnabled,F=y($=>Ya($,p&&l,f&&_)),R=F.fetchState,B=F.issueCardStatus.fetchState,T=F.lastSelfIssuedDebitCardId,N=y($=>T!=null?Rt($.chargeCardState,T):void 0),[d,h]=c.useState(null),[P,w]=c.useState(null),U=()=>{h(null)},j=($,H)=>{h($),w(H)};return c.useEffect(()=>{if(B==="Completed"){if(T!=null&&N?.type.code==="business_virtual_debit_card"){let $;$=N?.status.code==="request_on_hold"&&e.userId===N.cardHolderUserId?Zt(E.tenantEmailDomain):Ce(E.tenantEmailDomain,T,e,N),t($)}else t("../");a(Ot())}},[B,T]),R==="Completed"?s.jsxs(s.Fragment,{children:[d!==null&&P!==null?s.jsx(bs,{closeDrawerHandler:U,lineId:d,chargeCardTypeOption:P}):null,s.jsx(ys,{themeState:r,isIssuePhysicalCardEnabled:g,isIssuePhysicalDebitCardEnabled:I,isDebitCardFeatureEnabled:f,isChargeCardFeatureEnabled:p,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:_,navigate:t,fetchState:F.fetchState,openAddAddressDrawerHandler:j,defaultCardType:C==="creditCard"||C==="debitCard"?C:void 0})]}):R==="Error"?s.jsx(La,{}):s.jsx(Pr,{})}const Is=_e.div`
|
|
63
63
|
display: flex;
|
|
64
64
|
height: 100vh;
|
|
65
65
|
width: 100%;
|
|
@@ -68,4 +68,4 @@ import{j as s}from"./liveblocks-iTHbJlig.js";import{h as le,i as ca,u as ue,j as
|
|
|
68
68
|
overflow: auto;
|
|
69
69
|
align-items: center;
|
|
70
70
|
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,As=pe(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:C,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:g}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=zt(I,o),E=Ce(g,o,C,i),S=fe(n.state?.pathnameStackToGoBack,n.pathname);a(E,{state:{pathnameStackToGoBack:S}})},onColumnSortConfigChanged:(o,i)=>{e(Va({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(ia())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Va({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=le(),t=ue(),a=ge(),r=Wa(),[n,C]=c.useState(!1),m=y(w=>ar(w)),g=y(w=>ce(w)),I=y(w=>$e(w,g.companyId)),o=ze(I.controllers),{useFeatureGate:i}=se(),{isFeatureEnabled:E}=i(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:S}=i(Y.isDebitCardFeatureEnabled),f=Se(S,g),O=Ie({isDebitCardFeatureEnabled:S,isBankingOnlyTenant:f}),v=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,D=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,p=je(),u=be(g),b=ye(g),l=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,P=Ae({isCardsOnlyTenant:u,isChargeCardFeatureEnabled:E,isBookKeepingTenant:b,isDebitCardProductVisible:O,chargeCardsCreditAccountLimit:l}),F=Ue(p?.loggedInUserRoleMap),R=y(w=>Ze(w)),{creditAccount:B,creditAccountRepayment:T}=y(w=>Ye(w)),H=y(w=>xt(w)).cards.filter(w=>w.type.code.includes("debit")).map(w=>w.connectedAccountId),d=[...new Set(H)],h=y(w=>va(w,d));c.useEffect(()=>{n||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(C(!0),t(ia()),t(Da()))},[n,t,m.fetchState]),c.useEffect(()=>{if(m.fetchState==="Completed"&&m.cards.length===1&&_!=null){const w=Ce(g.tenantEmailDomain,m.cards[0].id,_,m.cards[0]);e(w,{state:{message:a.state?.message}})}},[m.fetchState,m.cards]);const _=J.getSignedInUser();if(c.useEffect(()=>{B.fetchState!=="Completed"&&B.fetchState!=="In-Progress"&&P&&D&&F&&t(Ga()),T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&F&&t($a()),h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&O&&v&&F&&t(Bt())},[B.fetchState,T.fetchState,t,h.fetchState,O,v,F,P,D]),_==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(la,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const w=Oe(P,O,v,D);return s.jsx(Is,{children:s.jsx(As,{navigate:e,currentTenant:g,signedInUser:_,productInformation:w,myPendingActivationChargeCardListState:m,isChargeCardFeatureEnabled:P,isDebitCardFeatureEnabled:O,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:D,chargeCardCashbackDetailState:R,creditAccount:B,creditAccountRepayment:T,depositAccountListWithDebitCardIssued:h,controllerEmails:o,location:a})})}}const ks=pe(function(e,t){const{companyId:a,companyLegalName:r}=t;return{chargeCardSetupView:da(e,a),admins:t.adminList,companyLegalName:r,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,t){const{navigate:a,companyId:r,isCompanyBusinessVerificationAndPaymentSetUpDone:n,isDebitCardSetupEnabled:C,isChargeCardSetupEnabled:m,signedInUser:g,location:I,productInformation:o,isEarlyPayEnabled:i,controllerEmails:E,chargeCardsCreditAccountLimit:S}=t;return{onSetupButtonClick:f=>{if(g!=null&&Q.trackCardsPromoPageClicked("enable cards"),n)switch(Q.trackCardsEnableCardsClick(E,o,"Cards Promo"),f){case"credit":e(Re(r,!0,"charge_cards",i,!1));break;case"debit":e(Re(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(S===0?Re(r,!0,"debit_cards",i,!0):Re(r,!0,"charge_cards__debit_cards",i,!1))}else switch(Q.trackCardsSetupCardsClick(E,o,"Cards Promo"),f){case"credit":e(Re(r,!1,"charge_cards",i,!1));break;case"debit":e(Re(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(S===0?Re(r,!1,"debit_cards",i,!0):Re(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let O=f.poppedPathname;O==null&&(O=C||m?"..":"../.."),a(O,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(Pa()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(rr(r))}}})(vr),Ds=()=>{const e=le(),{tenantEmailDomain:t}=ca(),[a]=ut(),r=a.get("cardPromoType"),n=ue(),{useDynamicConfig:C,useFeatureGate:m}=se(),[g,I]=c.useState(!1),{isFeatureEnabled:o}=m(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:E}=m(Y.isChargeCardFeatureEnabled),{configValue:S}=C(Fe.zeniCardsConfig),f=y(ae=>ce(ae)),O=y(ae=>$e(ae,f.companyId)),v=ze(O.controllers),D=S.charge_card_cashback_rate_per_transaction!=null?S.charge_card_cashback_rate_per_transaction:.0175,p=ge(),u=J.getSignedInUserTenant(t)?.companyId??f.companyId,b=y(ae=>da(ae,u)),l=b.primaryFundingAccount,P=f.companyBillPayInfo?.info,F=be(f),R=ye(f),B=Se(o,f),T=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,H=Ie({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:B}),d=Ae({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:E,isBookKeepingTenant:R,isDebitCardProductVisible:H,chargeCardsCreditAccountLimit:T}),h=$t({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:E,isBookKeepingTenant:R}),_=H&&d===!1,w=P?.businessVerificationStatus?.code==="verified"&&(_||l?.accType==="depositAccount"||tr(l?.providerVerificationStatus?.code??"")),U=J.getSignedInUser(),j=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,$=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,N=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,V=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,A=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,L=ae=>{I(ae)},W=y(ae=>ae.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const k=je(),Z=Ue(k?.loggedInUserRoleMap),q=Ya(k?.loggedInUserRoleMap),[z,x]=c.useState(!1),[oe,ee]=c.useState(!1),[te,X]=c.useState(!1);c.useEffect(()=>{z===!1&&p.state?.message==="activation"&&x(!0)},[p.state]),c.useEffect(()=>{oe||W!=="Not-Started"||u==null||(ee(!0),n(Fa(u,!0)))},[oe,W,u,n]);const re=f.companyChargeCardInfo?.info!=null&&Xe({cardInfo:f.companyChargeCardInfo.info,isProductVisible:h,isTOSAccepted:$,isSetupEnabled:N,isUserHasCardsAdminLevelAccess:Z,isUserHasCardsAccess:q}),Ee=f.companyDebitCardInfo?.info!=null&&Xe({cardInfo:f.companyDebitCardInfo.info,isProductVisible:H,isTOSAccepted:A,isSetupEnabled:V,isUserHasCardsAdminLevelAccess:Z,isUserHasCardsAccess:q}),xe=H&&Ee&&h&&T>=0&&re?"debit_and_credit":H&&Ee?"debit":"credit",K=Or(r,xe),he=b?.chargeCardTermsDetails?.fetchStatus?.fetchState,ke=c.useRef(null);c.useEffect(()=>{he==="In-Progress"?ke.current=K:he!=="Error"&&he!=="Not-Started"||(ke.current=null)},[he,K]);const Be=he!=="In-Progress"&&he!=="Completed"||ke.current==null?K:ke.current;c.useEffect(()=>{K==="credit"&&(N||h===!1&&V)||K==="debit"&&V||K==="debit_and_credit"&&V&&N?e("../"):(K==="debit_and_credit"&&$===!0&&A===!0||K==="credit"&&($===!0||h===!1&&A===!0)||K==="debit"&&A===!0)&&Z===!0&&e("../setup")},[w,N,V,K,$,A]),c.useEffect(()=>{te||(n(nr("cardAdmin")),X(!0))},[te]);const _e=y(ae=>Tt(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin")),we=Oe(h,H,V,N);return(re||Ee)&&W==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(Xa,{analytics:Q,onLoad:()=>{if(Q.trackPageLoaded(Nt.Event.cardsPromoPage),!!h&&!N||!!H&&!V||!!h&&!!H&&!V&&!N){const ae=Ps({isDebitCardSetupEnabled:V,isChargeCardSetupEnabled:N,isCreditCardProductVisibleForExpressInterest:h,isDebitCardProductVisible:H});Q.trackCardsPromoView(v,we,"Page",ae,"Promo Page")}}}),s.jsx(xa,{showConfetti:z}),s.jsx(Ge,{isAppContentDrawerOpen:g,handleDrawerToggle:L}),s.jsx(ks,{signedInUser:U,location:p,showEnableCardButton:w,isCompanyBusinessVerificationAndPaymentSetUpDone:w,isChargeCardSetupEnabled:N,isDebitCardSetupEnabled:V,companyLegalName:f.companyName,adminList:_e.users,isCheckingEnabled:j,navigate:e,companyId:u,cardPromoType:Be,controllerEmails:v,productInformation:we,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:o,isEarlyPayEnabled:i,cashbackRate:D,chargeCardsCreditAccountLimit:T,onClickMenuIcon:()=>{L(!0)}})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ge,{isAppContentDrawerOpen:g,handleDrawerToggle:L}),s.jsx(Fr,{})]})},Ps=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Qs(){const e=ge(),t=y(W=>ce(W)),{useFeatureGate:a}=se(),{isFeatureEnabled:r}=a(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=a(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Y.isChargeCardPaymentHistoryFeatureEnabled),g=Se(n,t),I=Ie({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:g}),o=xr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,E=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,S=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,O=je(),v=Ue(O?.loggedInUserRoleMap),D=Ya(O?.loggedInUserRoleMap),{isFeatureEnabled:p}=a(Y.isCashbackFeatureEnabled),u=t.userRole.includes("charge_card_user"),b=!u,l=!u&&S,P=t?.userRole!=null&&sr(t?.userRole),F=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!P)&&or(O?.loggedInUserRoleMap),R=ir(O?.loggedInUserRoleMap),B=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!P)&&cr(O?.loggedInUserRoleMap),{isFeatureEnabled:T}=a(Y.isDepositAccountsFeatureEnabled),H=T&&!P&>(O?.loggedInUserRoleMap),d=S&&!P,h=f&&!P,_=o&&!P&&Ue(O?.loggedInUserRoleMap),w=dr(O?.loggedInUserRoleMap),U=be(t),j=ye(t),$=t.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,N=Ae({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:r,isBookKeepingTenant:j,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:$}),V=t.companyChargeCardInfo?.info!=null&&Xe({cardInfo:t.companyChargeCardInfo.info,isProductVisible:N,isTOSAccepted:i,isSetupEnabled:S,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:D}),A=t.companyDebitCardInfo?.info!=null&&Xe({cardInfo:t.companyDebitCardInfo.info,isProductVisible:I,isTOSAccepted:E,isSetupEnabled:f,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:D}),L=V||A;return s.jsxs(qt,{children:[v?s.jsx(ne,{path:"setup",element:s.jsx(st,{isBillPayAdminLevelAccess:F,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:H,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:w,isUserHasOnlyBillPayAccess:R,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(ne,{path:"verification",element:s.jsx(st,{isBillPayAdminLevelAccess:F,isUserHasOnlyBillPayAccess:R,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:H,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:w,productType:"charge_cards",type:"verification"})}):null,s.jsx(ne,{path:"promo",element:s.jsx(Ds,{})}),d||h?s.jsxs(s.Fragment,{children:[s.jsx(ne,{path:"/",element:s.jsx(it,{isPaymentDrawerOpen:!1})}),_&&C?s.jsx(ne,{path:"payment",element:s.jsx(it,{isPaymentDrawerOpen:!0})}):null,s.jsx(ne,{path:"activate",element:s.jsx(Es,{})}),s.jsx(ne,{path:"onboard",element:s.jsx(cs,{})}),v?s.jsx(ne,{path:"new",element:s.jsx(Ss,{})}):null,p&&b?s.jsx(ne,{path:"cashback",element:s.jsx(Nr,{})}):null,l?s.jsx(ne,{path:"statements",element:s.jsx(os,{})}):null,_&&m&&S?s.jsx(ne,{path:"payment-history",element:s.jsx(ss,{})}):null,s.jsx(ne,{path:":cardId/activate",element:s.jsx($r,{})}),s.jsx(ne,{path:":cardId/setPin",element:s.jsx(ms,{})}),s.jsx(ne,{path:":cardId/addToWallet",element:s.jsx(Vr,{})}),s.jsx(ne,{path:":cardId/*",element:s.jsx(Xr,{})}),s.jsx(ne,{path:"*",element:s.jsx(La,{})})]}):(i||E)&&v?s.jsx(ne,{path:"*",element:s.jsx(ga,{to:"../setup"})}):L?s.jsx(ne,{path:"*",element:s.jsx(ga,{to:"../promo",state:e.state})}):s.jsx(ne,{path:"*",element:null})]})}export{Qs as default};
|
|
71
|
+
`,As=pe(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:C,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:g}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=zt(I,o),E=Ce(g,o,C,i),S=fe(n.state?.pathnameStackToGoBack,n.pathname);a(E,{state:{pathnameStackToGoBack:S}})},onColumnSortConfigChanged:(o,i)=>{e(Va({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(ia())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Va({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=le(),t=ue(),a=ge(),r=Wa(),[n,C]=c.useState(!1),m=y(w=>ar(w)),g=y(w=>ce(w)),I=y(w=>$e(w,g.companyId)),o=ze(I.controllers),{useFeatureGate:i}=se(),{isFeatureEnabled:E}=i(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:S}=i(Z.isDebitCardFeatureEnabled),f=Se(S,g),O=Ie({isDebitCardFeatureEnabled:S,isBankingOnlyTenant:f}),v=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,D=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,p=je(),u=be(g),b=ye(g),l=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,_=Ae({isCardsOnlyTenant:u,isChargeCardFeatureEnabled:E,isBookKeepingTenant:b,isDebitCardProductVisible:O,chargeCardsCreditAccountLimit:l}),F=Ue(p?.loggedInUserRoleMap),R=y(w=>Ye(w)),{creditAccount:B,creditAccountRepayment:T}=y(w=>Ze(w)),N=y(w=>xt(w)).cards.filter(w=>w.type.code.includes("debit")).map(w=>w.connectedAccountId),d=[...new Set(N)],h=y(w=>va(w,d));c.useEffect(()=>{n||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(C(!0),t(ia()),t(Da()))},[n,t,m.fetchState]),c.useEffect(()=>{if(m.fetchState==="Completed"&&m.cards.length===1&&P!=null){const w=Ce(g.tenantEmailDomain,m.cards[0].id,P,m.cards[0]);e(w,{state:{message:a.state?.message}})}},[m.fetchState,m.cards]);const P=J.getSignedInUser();if(c.useEffect(()=>{B.fetchState!=="Completed"&&B.fetchState!=="In-Progress"&&_&&D&&F&&t(Ga()),T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&F&&t($a()),h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&O&&v&&F&&t(Bt())},[B.fetchState,T.fetchState,t,h.fetchState,O,v,F,_,D]),P==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(la,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const w=Oe(_,O,v,D);return s.jsx(Is,{children:s.jsx(As,{navigate:e,currentTenant:g,signedInUser:P,productInformation:w,myPendingActivationChargeCardListState:m,isChargeCardFeatureEnabled:_,isDebitCardFeatureEnabled:O,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:D,chargeCardCashbackDetailState:R,creditAccount:B,creditAccountRepayment:T,depositAccountListWithDebitCardIssued:h,controllerEmails:o,location:a})})}}const ks=pe(function(e,t){const{companyId:a,companyLegalName:r}=t;return{chargeCardSetupView:da(e,a),admins:t.adminList,companyLegalName:r,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,t){const{navigate:a,companyId:r,isCompanyBusinessVerificationAndPaymentSetUpDone:n,isDebitCardSetupEnabled:C,isChargeCardSetupEnabled:m,signedInUser:g,location:I,productInformation:o,isEarlyPayEnabled:i,controllerEmails:E,chargeCardsCreditAccountLimit:S}=t;return{onSetupButtonClick:f=>{if(g!=null&&Q.trackCardsPromoPageClicked("enable cards"),n)switch(Q.trackCardsEnableCardsClick(E,o,"Cards Promo"),f){case"credit":e(Re(r,!0,"charge_cards",i,!1));break;case"debit":e(Re(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(S===0?Re(r,!0,"debit_cards",i,!0):Re(r,!0,"charge_cards__debit_cards",i,!1))}else switch(Q.trackCardsSetupCardsClick(E,o,"Cards Promo"),f){case"credit":e(Re(r,!1,"charge_cards",i,!1));break;case"debit":e(Re(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(S===0?Re(r,!1,"debit_cards",i,!0):Re(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let O=f.poppedPathname;O==null&&(O=C||m?"..":"../.."),a(O,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(_a()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(rr(r))}}})(vr),Ds=()=>{const e=le(),{tenantEmailDomain:t}=ca(),[a]=ut(),r=a.get("cardPromoType"),n=ue(),{useDynamicConfig:C,useFeatureGate:m}=se(),[g,I]=c.useState(!1),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:E}=m(Z.isChargeCardFeatureEnabled),{configValue:S}=C(Fe.zeniCardsConfig),f=y(ae=>ce(ae)),O=y(ae=>$e(ae,f.companyId)),v=ze(O.controllers),D=S.charge_card_cashback_rate_per_transaction!=null?S.charge_card_cashback_rate_per_transaction:.0175,p=ge(),u=J.getSignedInUserTenant(t)?.companyId??f.companyId,b=y(ae=>da(ae,u)),l=b.primaryFundingAccount,_=f.companyBillPayInfo?.info,F=be(f),R=ye(f),B=Se(o,f),T=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,N=Ie({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:B}),d=Ae({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:E,isBookKeepingTenant:R,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:T}),h=$t({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:E,isBookKeepingTenant:R}),P=N&&d===!1,w=_?.businessVerificationStatus?.code==="verified"&&(P||l?.accType==="depositAccount"||tr(l?.providerVerificationStatus?.code??"")),U=J.getSignedInUser(),j=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,$=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,H=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,V=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,A=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,L=ae=>{I(ae)},W=y(ae=>ae.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const k=je(),Y=Ue(k?.loggedInUserRoleMap),q=Za(k?.loggedInUserRoleMap),[z,x]=c.useState(!1),[oe,ee]=c.useState(!1),[te,X]=c.useState(!1);c.useEffect(()=>{z===!1&&p.state?.message==="activation"&&x(!0)},[p.state]),c.useEffect(()=>{oe||W!=="Not-Started"||u==null||(ee(!0),n(Fa(u,!0)))},[oe,W,u,n]);const re=f.companyChargeCardInfo?.info!=null&&Xe({cardInfo:f.companyChargeCardInfo.info,isProductVisible:h,isTOSAccepted:$,isSetupEnabled:H,isUserHasCardsAdminLevelAccess:Y,isUserHasCardsAccess:q}),Ee=f.companyDebitCardInfo?.info!=null&&Xe({cardInfo:f.companyDebitCardInfo.info,isProductVisible:N,isTOSAccepted:A,isSetupEnabled:V,isUserHasCardsAdminLevelAccess:Y,isUserHasCardsAccess:q}),xe=N&&Ee&&h&&T>=0&&re?"debit_and_credit":N&&Ee?"debit":"credit",K=Or(r,xe),he=b?.chargeCardTermsDetails?.fetchStatus?.fetchState,ke=c.useRef(null);c.useEffect(()=>{he==="In-Progress"?ke.current=K:he!=="Error"&&he!=="Not-Started"||(ke.current=null)},[he,K]);const Be=he!=="In-Progress"&&he!=="Completed"||ke.current==null?K:ke.current;c.useEffect(()=>{K==="credit"&&(H||h===!1&&V)||K==="debit"&&V||K==="debit_and_credit"&&V&&H?e("../"):(K==="debit_and_credit"&&$===!0&&A===!0||K==="credit"&&($===!0||h===!1&&A===!0)||K==="debit"&&A===!0)&&Y===!0&&e("../setup")},[w,H,V,K,$,A]),c.useEffect(()=>{te||(n(nr("cardAdmin")),X(!0))},[te]);const Pe=y(ae=>Tt(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin")),we=Oe(h,N,V,H);return(re||Ee)&&W==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(Xa,{analytics:Q,onLoad:()=>{if(Q.trackPageLoaded(Ht.Event.cardsPromoPage),!!h&&!H||!!N&&!V||!!h&&!!N&&!V&&!H){const ae=_s({isDebitCardSetupEnabled:V,isChargeCardSetupEnabled:H,isCreditCardProductVisibleForExpressInterest:h,isDebitCardProductVisible:N});Q.trackCardsPromoView(v,we,"Page",ae,"Promo Page")}}}),s.jsx(xa,{showConfetti:z}),s.jsx(Ge,{isAppContentDrawerOpen:g,handleDrawerToggle:L}),s.jsx(ks,{signedInUser:U,location:p,showEnableCardButton:w,isCompanyBusinessVerificationAndPaymentSetUpDone:w,isChargeCardSetupEnabled:H,isDebitCardSetupEnabled:V,companyLegalName:f.companyName,adminList:Pe.users,isCheckingEnabled:j,navigate:e,companyId:u,cardPromoType:Be,controllerEmails:v,productInformation:we,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:o,isEarlyPayEnabled:i,cashbackRate:D,chargeCardsCreditAccountLimit:T,onClickMenuIcon:()=>{L(!0)}})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ge,{isAppContentDrawerOpen:g,handleDrawerToggle:L}),s.jsx(Fr,{})]})},_s=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Qs(){const e=ge(),t=y(W=>ce(W)),{useFeatureGate:a}=se(),{isFeatureEnabled:r}=a(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=a(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Z.isChargeCardPaymentHistoryFeatureEnabled),g=Se(n,t),I=Ie({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:g}),o=xr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,E=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,S=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,O=je(),v=Ue(O?.loggedInUserRoleMap),D=Za(O?.loggedInUserRoleMap),{isFeatureEnabled:p}=a(Z.isCashbackFeatureEnabled),u=t.userRole.includes("charge_card_user"),b=!u,l=!u&&S,_=t?.userRole!=null&&sr(t?.userRole),F=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!_)&&or(O?.loggedInUserRoleMap),R=ir(O?.loggedInUserRoleMap),B=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!_)&&cr(O?.loggedInUserRoleMap),{isFeatureEnabled:T}=a(Z.isDepositAccountsFeatureEnabled),N=T&&!_&>(O?.loggedInUserRoleMap),d=S&&!_,h=f&&!_,P=o&&!_&&Ue(O?.loggedInUserRoleMap),w=dr(O?.loggedInUserRoleMap),U=be(t),j=ye(t),$=t.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,H=Ae({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:r,isBookKeepingTenant:j,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:$}),V=t.companyChargeCardInfo?.info!=null&&Xe({cardInfo:t.companyChargeCardInfo.info,isProductVisible:H,isTOSAccepted:i,isSetupEnabled:S,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:D}),A=t.companyDebitCardInfo?.info!=null&&Xe({cardInfo:t.companyDebitCardInfo.info,isProductVisible:I,isTOSAccepted:E,isSetupEnabled:f,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:D}),L=V||A;return s.jsxs(qt,{children:[v?s.jsx(ne,{path:"setup",element:s.jsx(st,{isBillPayAdminLevelAccess:F,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:N,isChargeCardAdminLevelAccess:P,isUserHasOnlyCardAccess:w,isUserHasOnlyBillPayAccess:R,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(ne,{path:"verification",element:s.jsx(st,{isBillPayAdminLevelAccess:F,isUserHasOnlyBillPayAccess:R,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:N,isChargeCardAdminLevelAccess:P,isUserHasOnlyCardAccess:w,productType:"charge_cards",type:"verification"})}):null,s.jsx(ne,{path:"promo",element:s.jsx(Ds,{})}),d||h?s.jsxs(s.Fragment,{children:[s.jsx(ne,{path:"/",element:s.jsx(it,{isPaymentDrawerOpen:!1})}),P&&C?s.jsx(ne,{path:"payment",element:s.jsx(it,{isPaymentDrawerOpen:!0})}):null,s.jsx(ne,{path:"activate",element:s.jsx(Es,{})}),s.jsx(ne,{path:"onboard",element:s.jsx(cs,{})}),v?s.jsx(ne,{path:"new",element:s.jsx(Ss,{})}):null,p&&b?s.jsx(ne,{path:"cashback",element:s.jsx(Hr,{})}):null,l?s.jsx(ne,{path:"statements",element:s.jsx(os,{})}):null,P&&m&&S?s.jsx(ne,{path:"payment-history",element:s.jsx(ss,{})}):null,s.jsx(ne,{path:":cardId/activate",element:s.jsx($r,{})}),s.jsx(ne,{path:":cardId/setPin",element:s.jsx(ms,{})}),s.jsx(ne,{path:":cardId/addToWallet",element:s.jsx(Vr,{})}),s.jsx(ne,{path:":cardId/*",element:s.jsx(Xr,{})}),s.jsx(ne,{path:"*",element:s.jsx(La,{})})]}):(i||E)&&v?s.jsx(ne,{path:"*",element:s.jsx(ga,{to:"../setup"})}):L?s.jsx(ne,{path:"*",element:s.jsx(ga,{to:"../promo",state:e.state})}):s.jsx(ne,{path:"*",element:null})]})}export{Qs as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-B3rZ8J8S.js";import{a as g}from"./sentry-DUcvQrSc.js";import{h as w,u as k,g as x,i as T,j as O,n as E}from"./core-DGFWDVAl.js";import{z as N,b7 as P,G as F,c as V,e as j,af as C,b8 as A,at as L,au as M,r as U}from"./index-DdDbQEWy.js";import{eP as D,fG as B,se as G,fB as _,c2 as R,MH as z,bn as q,qf as H,q3 as Y,ke as K,lK as S,MI as Z,bE as $,cv as b,lS as J,lV as Q}from"./zeni-epic-state-CZCR_U6U.js";import"./mui-Dbkdx3RD.js";import{d as W}from"./routePaths-BHlRt2v2.js";import{M as X}from"./MobileAppDrawer-DFoyPc6B.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="993a304e-46bc-455c-8a3e-cec01a76ad6d",n._sentryDebugIdIdentifier="sentry-dbid-993a304e-46bc-455c-8a3e-cec01a76ad6d")}catch{}})();const ee=E(function(n){const t=_(n),i=N.getSignedInUser(),l=D(n),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}},function(n,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(Q())},onAddressClick:e=>{const a=W(f,e),o=U(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:M(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(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]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(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=>{n(Z(e))},onCompanyOfficerUpdated:e=>{n(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=>{n(K({files:e}))},onDeleteFile:e=>{n(Y(e))},onEditFileName:(e,a)=>{n(H(e,a.split(".")[0]))}}})(A);function de(){const n=w(),t=k(),i=x(),{tenantEmailDomain:l}=T(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),a=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||a!=="Not-Started"||d==null||(p(!0),t(B(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(G())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(P,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{j as C}from"./liveblocks-B3rZ8J8S.js";import{a}from"./sentry-DUcvQrSc.js";import{u as D,g as v,j as u,N as w}from"./core-DGFWDVAl.js";import{Jm as A,eP as O,fo as j,mW as U,fP as h,fn as _,eW as L,Jt as F}from"./zeni-epic-state-CZCR_U6U.js";import{u as P,z as c,L as g,D as $,o as k}from"./index-DdDbQEWy.js";import{n as H}from"./mui-Dbkdx3RD.js";import{t as z}from"./getLocaleForTenant-C6buF13l.js";import{g as R,Q as J}from"./QBOConnectionScreen-f0GbNY7x.js";import"./recharts-n-g8syHd.js";import"./analytics-BVe2_H5A.js";import"./plaid-S75yXU2f.js";import"./dnd-Bgw7mJ4_.js";import"./stripe-DMRn4zHo.js";import"./lottie-CIs_xEi6.js";import"./lexical-WJOlCNii.js";import"./pdf-BwZYmtfA.js";import"./utils-Ch467FKd.js";import"./empty-BQXzpfcR.js";import"./pdf-lib-BhV4O1kJ.js";import"./index-BtY3x-vU.js";import"./url-DXNYKjlB.js";import"./index-MzF3VhZj.js";import"./decodeURIComponentSafe-C_utkack.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]="d9735e6d-9385-4cb9-a9a7-880f042883c1",t._sentryDebugIdIdentifier="sentry-dbid-d9735e6d-9385-4cb9-a9a7-880f042883c1")}catch{}})();const W=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 ${k.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
+
`;function pe(){const t=D(),i=v(),{setLoading:d,clearAllLoading:x}=P(),p=a.useRef(!1),f=a.useRef(!1),{code:b,realmId:T,state:y}=R(i.search),N=b!==""&&T!==""&&y!=="",I=u(l=>A(l)),e=u(l=>O(l)),n=u(l=>l.tenantState.fetchState),r=u(l=>l.tenantState.activeTenantFetchState.fetchState),o=c.getSignedInUser(),m=c.getActiveTenantForUser()?.tenantId,s=e?.externalConnections?.fetchState,E=e?.externalConnections?.saveConnectionState,S=e.externalConnections?.accounting[0]?.isValid;return a.useLayoutEffect(()=>{d(g.CONNECTION_AUTH)},[d]),a.useEffect(()=>{p.current||o==null||m==null||(p.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(g.TENANT_FETCHING),t(j(o.userId,m))))},[p,n,d]),a.useEffect(()=>{e.tenantId==null&&!f.current&&o!=null&&(f.current=!0,!(m==null||m!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(U(o.userId)))},[f,n,r]),a.useEffect(()=>{o==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||E!=="Error"||(d(g.CONNECTION_AUTH),t(h(o.userId,e.tenantId)))},[E]),a.useEffect(()=>{n!=="Completed"&&r!=="Completed"||o==null||e?.tenantId==null||(t(_(e.tenantId)),c.saveActiveTenantDomainForUser(e.tenantEmailDomain),L(o?.userId,o?.zeniSessionId,e.tenantId),$.updateAppLocaleID(z(F(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||o==null||e==null||t(h(o.userId,e.tenantId)))},[n,r,s]),a.useEffect(()=>{I.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&c.saveSignedInUserTenants(I.tenantsCoreDetailsInOrder)},[I.tenantsCoreDetailsInOrder.length,n]),a.useEffect(()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||s!=="Completed"&&s!=="Error"||x()},[n,r,s]),e==null||n!=="Completed"&&r!=="Completed"||s!=="Completed"?null:N||S===!1?C.jsx(W,{children:C.jsx(J,{})}):C.jsx(w,{to:"/",replace:!0})}export{pe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-B3rZ8J8S.js";import{z as n}from"./index-DdDbQEWy.js";import{g as d}from"./QBOConnectionScreen-f0GbNY7x.js";import"./sentry-DUcvQrSc.js";import{g as p,N as a}from"./core-DGFWDVAl.js";import"./zeni-epic-state-CZCR_U6U.js";import"./recharts-n-g8syHd.js";import"./mui-Dbkdx3RD.js";import"./analytics-BVe2_H5A.js";import"./plaid-S75yXU2f.js";import"./dnd-Bgw7mJ4_.js";import"./stripe-DMRn4zHo.js";import"./lottie-CIs_xEi6.js";import"./lexical-WJOlCNii.js";import"./pdf-BwZYmtfA.js";import"./utils-Ch467FKd.js";import"./empty-BQXzpfcR.js";import"./pdf-lib-BhV4O1kJ.js";import"./index-BtY3x-vU.js";import"./url-DXNYKjlB.js";import"./index-MzF3VhZj.js";import"./decodeURIComponentSafe-C_utkack.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e53e9b9f-4e1e-4d41-afae-a46e42efc4b3",e._sentryDebugIdIdentifier="sentry-dbid-e53e9b9f-4e1e-4d41-afae-a46e42efc4b3")}catch{}})();const U=()=>{const e=p(),{code:t,realmId:o,state:r}=d(e.search),s=n.getSignedInUser()?.userId??"";if(f(t,o,r,s)===!0){const m=`../../${r}/onboarding?code=${t}&realmId=${o}&state=auth_flow`;return i.jsx(a,{to:m})}return i.jsx(a,{to:"../../"})},f=(e,t,o,r)=>e!=""&&t!=""&&o!=""&&r!=null&&r!="";export{U as default,f as hasValidParams};
|