@zeniai/web-app-ui 5.1.93-prod → 5.1.94-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddressRoutes-pUo9c-tv.js +1 -0
- package/dist/assets/{AddressScreen-Dqns8o7L.js → AddressScreen-DT4aul98.js} +2 -2
- package/dist/assets/{AiCfoScreen-CMCauxgE.js → AiCfoScreen-BhF2jfJu.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-DzOMp0L2.js → BillPayApprovalRoutes-DBrTLbUM.js} +1 -1
- package/dist/assets/{BillPayRoutes-yNX-iA8A.js → BillPayRoutes-DXvHcHbk.js} +6 -6
- package/dist/assets/{BusinessVerificationPageScreen-62HLVe0x.js → BusinessVerificationPageScreen-Om0cSThR.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-4QjrMuDm.js → CardsAiCfoScreen-CDZYVA_G.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-JT1ktnG0.js → ChargeCardRoutes-BaEr-4Sf.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-oS2G5pld.js → CompanyPassportScreen-B8wIBTwN.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-Bu06mAoB.js → ConnectionAuthScreen-3rXBpWwe.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-qfvtTE_8.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CI6qRXML.js → CustomerOnboardingRoutes-BSP_x0q_.js} +8 -8
- package/dist/assets/{DashboardRoutes-B-U5mAGm.js → DashboardRoutes-BH2h4M69.js} +3 -3
- package/dist/assets/{DefaultTenantHome-CkLznbI_.js → DefaultTenantHome-533CT5dy.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-Q3vU2bMG.js → DomesticWireDetailScreen-DyCIP-L-.js} +3 -3
- package/dist/assets/DrawerScreen-hmdKhO49.js +1 -0
- package/dist/assets/{EntityDetailRoutes-DgD0rt0Q.js → EntityDetailRoutes-BifybXji.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-CxrDAOUS.js → ExpenseAutomationRoutes-ma2T2i_P.js} +3 -3
- package/dist/assets/FeaturePreviewScreen-BDSQN3lv.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-DTFVUd5Z.js → HubSpotOAuthCallbackScreen-DNmva7H-.js} +1 -1
- package/dist/assets/MagicLinkRoutes-DbkotQYT.js +72 -0
- package/dist/assets/{MagicLinkSignInScreen-CV4klGc6.js → MagicLinkSignInScreen-NQd0hGkj.js} +1 -1
- package/dist/assets/MobileAppDrawer-CpsSMjQ2.js +1 -0
- package/dist/assets/NotFoundScreen-_taUi6Es.js +1 -0
- package/dist/assets/{NotificationRoutes-CkNzEGNi.js → NotificationRoutes-Cu5dkfdj.js} +1 -1
- package/dist/assets/OAuthConsentScreen-D99q8ZiL.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-DTEkwhMd.js +1 -0
- package/dist/assets/PeopleRoutes-W5cMaWf6.js +22 -0
- package/dist/assets/PerformanceRoutes-DyHolbpu.js +1 -0
- package/dist/assets/{Preview-DsqB8zvc.js → Preview-DGrNJzmQ.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BscD4kCT.js → QBOConnectionScreen-D8kad0sY.js} +1 -1
- package/dist/assets/ReferralListScreen-BinxYKYV.js +5 -0
- package/dist/assets/{ReimbursementApprovalRoutes-CFc6siNR.js → ReimbursementApprovalRoutes-DUXSVDw2.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-C2FMWk-j.js → ReimbursementApprovalRuleDetailScreen-CgGJOA1u.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-D54WJIgE.js → ReimbursementRoutes-BLwsvqh4.js} +1 -1
- package/dist/assets/{ReportsRoutes-BrtJ_-m2.js → ReportsRoutes-kfn77iwu.js} +1 -1
- package/dist/assets/RewardsRoutes-D-idKZz4.js +1 -0
- package/dist/assets/ScreenRoutes-DQbm0Bd3.js +2 -0
- package/dist/assets/{SettingsRoutes-DQ0yh-8g.js → SettingsRoutes-CngnqM2k.js} +7 -7
- package/dist/assets/{SetupPagesScreen-DObnppv9.js → SetupPagesScreen-Bi7ql3Uc.js} +5 -5
- package/dist/assets/SignInScreen-B9F_7T01.js +1 -0
- package/dist/assets/SignOutScreen-5ReTv-2r.js +9 -0
- package/dist/assets/{TaskListScreen-C5nOYLN5.js → TaskListScreen-B92kUrNr.js} +2 -2
- package/dist/assets/{TaskRoutes-BhLal2L_.js → TaskRoutes-CtH7gfhd.js} +2 -2
- package/dist/assets/{TransactionDetailRoutes-CiULbGzd.js → TransactionDetailRoutes-CCGKgR5c.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-ByvC4V3o.js → TransactionDetailScreen-DkN9stCC.js} +2 -2
- package/dist/assets/{TransactionListRoutes-DHP_TahM.js → TransactionListRoutes-BPGGfQYb.js} +1 -1
- package/dist/assets/{TreasuryRoutes-CJ_vGeGY.js → TreasuryRoutes-D3yl0U9P.js} +6 -6
- package/dist/assets/{VendorsRoutes-DpGiilRm.js → VendorsRoutes-CSf7xhk-.js} +1 -1
- package/dist/assets/WiseConfirmationScreen-CURrKHsJ.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-Gt73EasM.js → ZeniAccountRoutes-Bvp0Q8q4.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-BrO-jfY4.js → ZeniAccountStatementScreen-BMxfX19s.js} +2 -2
- package/dist/assets/{accountMappingHelper-DpVopnHv.js → accountMappingHelper-Dk_23sfW.js} +1 -1
- package/dist/assets/{analytics-DrcSmo8f.js → analytics-BWMRmW6M.js} +1 -1
- package/dist/assets/{analyticsHelper-JSt5oFi8.js → analyticsHelper-DG9Hj57M.js} +1 -1
- package/dist/assets/{core-C5W8nxR1.js → core-BCzXpSj2.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-B4ofrmT1.js → decodeURIComponentSafe-BaVz5hiZ.js} +1 -1
- package/dist/assets/{dnd-BN-V7BQY.js → dnd-CMRnbWd0.js} +1 -1
- package/dist/assets/{empty-MvieyTY2.js → empty-BKEgBO1f.js} +1 -1
- package/dist/assets/{empty-efGcmHNA.js → empty-Huff3QoR.js} +1 -1
- package/dist/assets/{emptyVideoElement-D22fm1RT.js → emptyVideoElement-C3GRsAmj.js} +1 -1
- package/dist/assets/{epic-C0tR2xX2.js → epic-D2GJzmn7.js} +1 -1
- package/dist/assets/getLocaleForTenant-CJtZ2gVK.js +1 -0
- package/dist/assets/{index-EdDjmZsZ.js → index-BgtDuR7o.js} +2 -2
- package/dist/assets/{index-DCXaVzkG.js → index-D93ptPBX.js} +1 -1
- package/dist/assets/{index-BBxc6qHy.js → index-DD1fRxxW.js} +1 -1
- package/dist/assets/{index-DFbS5Iez.js → index-DnXXSSQr.js} +1 -1
- package/dist/assets/{index-DepVuD4d.js → index-F79NhlWc.js} +1 -1
- package/dist/assets/{index-DhtfwmwQ.js → index-RV1w-9NK.js} +1 -1
- package/dist/assets/{index-zWiSHOLd.js → index-jnJxCrIS.js} +8969 -8899
- package/dist/assets/{index-BKQuSuay.js → index-kgnb8add.js} +1 -1
- package/dist/assets/{lexical-LmEGSncg.js → lexical-CLfce6-g.js} +1 -1
- package/dist/assets/{liveblocks-D7MTBeqB.js → liveblocks-DgQRIsyS.js} +1 -1
- package/dist/assets/{lottie-Bcxhpfzr.js → lottie-D0l9jr5K.js} +1 -1
- package/dist/assets/{mui-CD-lJRrw.js → mui-BU88kzbO.js} +1 -1
- package/dist/assets/{pathToGoBack-C_7fp8nd.js → pathToGoBack-Ct5jhqDD.js} +1 -1
- package/dist/assets/{pdf-BpbLbEAW.js → pdf-DF6S6f8j.js} +3 -3
- package/dist/assets/{pdf-lib-ByihSr1f.js → pdf-lib-f4RyuKvB.js} +1 -1
- package/dist/assets/{plaid-D3pZvM_U.js → plaid-CnRfB1Gp.js} +1 -1
- package/dist/assets/{pusher-AkfuRGDS.js → pusher-CI9cnuX_.js} +1 -1
- package/dist/assets/{react-B6crEeoU.js → react-B17DU2Q8.js} +1 -1
- package/dist/assets/{react-CSTU0nI4.js → react-BkeoZEiD.js} +1 -1
- package/dist/assets/{react-DRz-S9RE.js → react-Df1nu3Jg.js} +1 -1
- package/dist/assets/{react-D8oP0smP.js → react-DjeVbFvw.js} +1 -1
- package/dist/assets/{react-BXOXkMoR.js → react-WN5d6PKR.js} +1 -1
- package/dist/assets/{react-C52QZxfc.js → react-o34Ibe9E.js} +1 -1
- package/dist/assets/{recharts-BnfhYobU.js → recharts-LNNCqKNo.js} +1 -1
- package/dist/assets/{routePaths-DEzJucxI.js → routePaths-BrpCPMmb.js} +1 -1
- package/dist/assets/{sentry-DVVsR48F.js → sentry-BHeH_DOJ.js} +1 -1
- package/dist/assets/{url-BYgELt_H.js → url-BMGD5Vyc.js} +1 -1
- package/dist/assets/{url-DjoTUBiJ.js → url-CvYl_jYF.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CFGGYb9p.js → useAiCfoDashboardSuggestedQuestionsChips-CSP2rs4k.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BjXqzhKq.js +1 -0
- package/dist/assets/useCashManagementBanner-Chf9Io8m.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-D7wpQRE_.js → useChargeCardPusherEvents-a1rzK4fg.js} +1 -1
- package/dist/assets/{useDeviceId-BnrfnzK7.js → useDeviceId-CIiEEeSM.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-lWxckS4M.js → useEmailConnectResultRefresh-KQRYFmno.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-CPcuN5d8.js → useInitialThreadRequest-CIKn9Zyw.js} +1 -1
- package/dist/assets/{utils-fE4-NjiI.js → utils-BOLLxecq.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DL8BhG5u.js → withTransactionSidePanel-ClneTDW0.js} +2 -2
- package/dist/assets/{zeni-epic-state-BDJoMjoR.js → zeni-epic-state-CeMrW02Z.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/AddressRoutes-Cn4m82VU.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-DTabcWxk.js +0 -1
- package/dist/assets/DrawerScreen-CMGdvP71.js +0 -1
- package/dist/assets/FeaturePreviewScreen-B_0uKukg.js +0 -1
- package/dist/assets/MagicLinkRoutes-CzGwkhkX.js +0 -72
- package/dist/assets/MobileAppDrawer-B2FnRj4O.js +0 -1
- package/dist/assets/NotFoundScreen-DIeJhZda.js +0 -1
- package/dist/assets/OAuthConsentScreen-CgMFQ18r.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-H0hB0AgF.js +0 -1
- package/dist/assets/PeopleRoutes-B_g8cfdv.js +0 -22
- package/dist/assets/PerformanceRoutes-MEt6tq7t.js +0 -1
- package/dist/assets/ReferralListScreen-bLo9_GQZ.js +0 -5
- package/dist/assets/RewardsRoutes-C7Z3exkk.js +0 -1
- package/dist/assets/ScreenRoutes-DXjEvmoW.js +0 -2
- package/dist/assets/SignInScreen-CSr-6Z_R.js +0 -1
- package/dist/assets/SignOutScreen-DnThEHBw.js +0 -9
- package/dist/assets/WiseConfirmationScreen-sm6bvEyo.js +0 -12
- package/dist/assets/getLocaleForTenant-B_Il-nCM.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-DoAmGuPw.js +0 -1
- package/dist/assets/useCashManagementBanner-HwbKcvlA.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-D7MTBeqB.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Xe,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-C5W8nxR1.js";import{f8 as Pt,RW as os,fk as wt,bt as Fe,RX as is,RY as ds,eZ as fn,RZ as Pn,f6 as wn,R_ as vn,R$ as Tn,S0 as Fn,S1 as xn,f7 as Bn,fj as Ln,S2 as Rn,S3 as ls,fd as us,fc as ms,S4 as Cs,C5 as On,fm as ia,S5 as ps,S6 as hs,e$ as fs,e_ as gs,fz as Ye,ff as Un,fe as jn,S7 as Ss,fg as bs,BC as ys,BB as Is,BF as ks,BH as Es,fs as As,eW as Mn,S8 as Ds,S9 as _s,fx as Nn,Sa as Ps,fy as yt,BN as ws,BK as vs,eX as ge,Sb as qa,fC as xe,fD as Be,fE as Le,gw as da,cv as la,Sc as ua,Sd as vt,uT as $a,kF as za,Se as Ya,Cl as ka,fn as Qe,Cn as Tt,kv as Vn,Sf as ma,C9 as _a,Sg as Ts,Sh as Fs,Cc as Qa,Si as xs,Qi as Xa,fi as Hn,Ci as Sa,hV as Bs,Sj as Gn,f9 as Ca,bo as Ls,Sk as Rs,gh as Ja,gg as et,CR as Os,gf as at,P_ as Us,Sl as $n,co as zn,cQ as js,Qh as wa,Dq as Yn,Sm as gn,D0 as Pa,Sn as Wn,Dr as Ms,QG as Ns,Ds as Vs,Ex as Hs,ub as Gs,Er as $s,So as zs,Cm as ca,Sp as Ys,Sq as Ws,Sr as Zs,Ss as Ks,St as qs,Su as Ft,Sv as Qs,CC as Zn,Cv as Xs,Sw as Js,gy as ec,CL as Kn,CP as qn,gx as ac,Sx as tc,Dc as Qn,Sy as nc,Sz as rc,SA as sc,CN as Xn,Cy as Jn,Cf as er,CH as ar,CF as tr,CJ as cc,SB as nr,SC as oc,fu as ic,fv as dc,fw as lc,SD as tt,fo as rr,cS as xt,SE as uc,SF as mc,SG as Cc,SH as pc,CX as It,Dj as hc,Df as fc,CT as gc,Dh as Sc,D7 as bc,D9 as yc,SI as sr,Dp as Ga,Kg as Ic,SJ as kc,SK as Ec,SL as Ac,SM as cr,SN as Dc,DM as _c,C$ as or,CW as Ne,C_ as Pc,SO as wc,SP as vc,C6 as Tc,SQ as ir,fh as dr,SR as Fc,C8 as xc,C7 as Sn,SS as Bc,ST as Lc,SU as Rc,MN as Oc,SV as Bt,SW as Uc,xU as lr,ld as jc,hL as Mc,DR as Nc,SX as ur,f3 as Vc,f4 as Hc,SY as Gc,dj as $c,fl as zc,DH as Yc,DB as qe,bs as Wc,bJ as Zc,cA as Kc,bK as qc,L_ as Qc}from"./zeni-epic-state-BDJoMjoR.js";import{I as Re,cr as mr,p as we,cs as Cr,ct as pr,cu as Xc,a as ea,a0 as Lt,cv as Jc,cw as eo,Y as hr,c as fr,$ as gr,q as ye,C as ue,U as W,ar as ya,cx as Sr,cy as ao,cz as to,z as te,B as va,cg as nt,cA as no,cB as ro,cC as so,K as Ta,aS as We,bt as Rt,cD as co,D as Fa,j as rt,y as Ot,e as J,a9 as st,cE as oo,bG as ba,cF as kt,cG as io,w as Ut,cH as lo,au as br,a4 as Et,cI as uo,Z as yr,O as Ir,g as kr,cJ as mo,cK as Co,cL as po,cM as ho,cN as fo,cO as go,cP as So,o as Wa,cQ as bo,cR as yo,cS as ht,F as Io,cT as ko,cU as Eo,cV as Ao,cW as Do,cX as _o,i as Po}from"./index-zWiSHOLd.js";import{n as He,D as Er,S as wo}from"./mui-CD-lJRrw.js";import{a as r}from"./sentry-DVVsR48F.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-DoAmGuPw.js";import{M as Ie}from"./MobileAppDrawer-B2FnRj4O.js";import{d as jt}from"./recharts-BnfhYobU.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Je,f as aa,h as ta,A as vo,i as Mt,P as To,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as bn}from"./SetupPagesScreen-DObnppv9.js";import{u as wr}from"./useInitialThreadRequest-CPcuN5d8.js";import ct from"./NotFoundScreen-DIeJhZda.js";import{u as Vt}from"./useChargeCardPusherEvents-D7wpQRE_.js";import{n as yn}from"./utils-fE4-NjiI.js";import{t as Bo}from"./AddressScreen-Dqns8o7L.js";import"./analytics-DrcSmo8f.js";import"./plaid-D3pZvM_U.js";import"./dnd-BN-V7BQY.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bcxhpfzr.js";import"./lexical-LmEGSncg.js";import"./pdf-BpbLbEAW.js";import"./analyticsHelper-JSt5oFi8.js";import"./routePaths-DEzJucxI.js";import"./BusinessVerificationPageScreen-62HLVe0x.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="709cb1fa-0996-4255-987a-d9e7a030d695",e._sentryDebugIdIdentifier="sentry-dbid-709cb1fa-0996-4255-987a-d9e7a030d695")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Tr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>os(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(E=>{S(E)},[]),m=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(is()),a(ds()),a(fn())},[a]);const w=i(E=>Pn(E.cardPolicyState)),l=i(E=>wn(E.cardPolicyState)),j=i(E=>vn(E.cardPolicyState)),B=i(E=>Tn(E.cardPolicyState)),L=i(E=>Fn(E.cardPolicyState)),p=i(E=>xn(E.cardPolicyState)),h=i(E=>Bn(E.cardPolicyState)),T=i(E=>Pt(E.cardPolicyState)),u=i(E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount),v=i(E=>E.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())},[a,w]),Tr();const k=i(E=>Rn(E.createCardPolicyState)),U=i(E=>ls(E.createCardPolicyState)),A=i(E=>us(E.cardPolicyState)),b=i(E=>ms(E.cardPolicyState)),x=i(E=>Cs(E.createCardPolicyState)),d=i(E=>On(E));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>l.map(Ro),[l]),M=r.useMemo(()=>h.map(Oo),[h]),V=r.useMemo(()=>d.cards.filter(E=>!mr(E.status.code)).map(vr),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&v==="Completed";r.useEffect(()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))},[v,a,O,x,V,u,j,B,L,p]);const R=r.useMemo(()=>jt(E=>{a(wt(E))},250),[a]);r.useEffect(()=>()=>{R.cancel()},[R]);const z=r.useCallback(E=>{R(E)},[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const E=we(n.state?.pathnameStackToGoBack),K=E.poppedPathname??_;e(K,{state:{pathnameStackToGoBack:E.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(E=>{a(hs(E))},[a]),I=r.useCallback(E=>{const K=Cr(E);a(fs({templates:[K]}))},[a]),N=r.useCallback(E=>{E.length!==0&&a(gs(E))},[a]),Z=r.useCallback(()=>{a(fn())},[a]),X=r.useRef($);r.useEffect(()=>{const E=X.current;X.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:b,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(Xe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{m(!0)},[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i(o=>Ss(o)),j=i(o=>Pn(o.cardPolicyState)),B=i(o=>wn(o.cardPolicyState)),L=i(o=>vn(o.cardPolicyState)),p=i(o=>Tn(o.cardPolicyState)),h=i(o=>Fn(o.cardPolicyState)),T=i(o=>xn(o.cardPolicyState)),u=i(o=>Bn(o.cardPolicyState)),v=i(o=>Pt(o.cardPolicyState)),k=i(o=>On(o)),U=i(o=>a!=null?bs(o.cardPolicyState,a):void 0),A=r.useMemo(()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0,[l.templateId,l.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))},[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())},[s,j]),Tr();const b=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[k.fetchState,s]);const x=r.useMemo(()=>B.map(Mo),[B]),d=r.useMemo(()=>u.map(No),[u]),f=r.useMemo(()=>k.cards.filter(o=>!mr(o.status.code)).map(vr),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo(()=>{if(A!=null)return Jc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[A,f,x,d,b,L,p,h,T]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect(()=>{R.current||V!=null||M==null||(R.current=!0,O(M))},[V,M]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))},[s,a]),Z=r.useRef(D);r.useEffect(()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const X=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Xe,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function xr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(As(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),m=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Ds(_)),L=i(_=>Rn(_.createCardPolicyState)),p=i(_=>_s(_.createCardPolicyState)),h=i(_=>p==null?[]:Nn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i(_=>Ps(_.createCardPolicyState)),v=ya(L.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[L.error?.message,L.fetchState,a,p,u,h,v]);const k=B.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ws())},[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect(()=>{A==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,A]);const b=r.useMemo(()=>B.templates.map(zo),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=hr(),E=fr(),K=gr(),ne=i(oe=>Mn(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),ve=r.useMemo(()=>Fr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=K&&E&&Z!=null&&!X,re=r.useCallback(oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,Z]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Te=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(Sr,{...d}):null,M=l&&f==null,V=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),R=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(vs(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:b,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:T,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Wo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i(q=>da(q,s.companyId)),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:b}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!F&&u&&l,f=i(q=>vt(q,n,d,u)),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i(q=>R!=null?$a(q.userRoleState,R):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(m(!0),setTimeout(()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,Z]),r.useEffect(()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&u&&l&&g&&t(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())},[A.fetchState,b.fetchState,t,u,l,g,x]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Je(u,T,v,l),K=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:K,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Zo="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ko=[Ra,La],qo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Ts({uiState:{sortKey:n,sortOrder:t}}))}}})(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(j=>ge(j)),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(W.isCardsCommentingEnabled),[S,P]=r.useState(!1),m=i(j=>ma(j)),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback(()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Xo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Ko),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Xo=e=>`/${e}/cards`,Jo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Fs(I,s)),u=T.chargeCard,v=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),b=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect(()=>{S===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),P(!0)),m===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))},[m,T.fetchState,S,v]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,u?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Hn(I.userState,B.userId)),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),w(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Ja(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}})(co),ti=He.div`
|
|
1
|
+
import{j as c}from"./liveblocks-DgQRIsyS.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Xe,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-BCzXpSj2.js";import{f8 as Pt,RW as os,fk as wt,bt as Fe,RX as is,RY as ds,eZ as fn,RZ as Pn,f6 as wn,R_ as vn,R$ as Tn,S0 as Fn,S1 as xn,f7 as Bn,fj as Ln,S2 as Rn,S3 as ls,fd as us,fc as ms,S4 as Cs,C5 as On,fm as ia,S5 as ps,S6 as hs,e$ as fs,e_ as gs,fz as Ye,ff as Un,fe as jn,S7 as Ss,fg as bs,BC as ys,BB as Is,BF as ks,BH as Es,fs as As,eW as Mn,S8 as Ds,S9 as _s,fx as Nn,Sa as Ps,fy as yt,BN as ws,BK as vs,eX as ge,Sb as qa,fC as xe,fD as Be,fE as Le,gw as da,cv as la,Sc as ua,Sd as vt,uT as $a,kF as za,Se as Ya,Cl as ka,fn as Qe,Cn as Tt,kv as Vn,Sf as ma,C9 as _a,Sg as Ts,Sh as Fs,Cc as Qa,Si as xs,Qi as Xa,fi as Hn,Ci as Sa,hV as Bs,Sj as Gn,f9 as Ca,bo as Ls,Sk as Rs,gh as Ja,gg as et,CR as Os,gf as at,P_ as Us,Sl as $n,co as zn,cQ as js,Qh as wa,Dq as Yn,Sm as gn,D0 as Pa,Sn as Wn,Dr as Ms,QG as Ns,Ds as Vs,Ex as Hs,ub as Gs,Er as $s,So as zs,Cm as ca,Sp as Ys,Sq as Ws,Sr as Zs,Ss as Ks,St as qs,Su as Ft,Sv as Qs,CC as Zn,Cv as Xs,Sw as Js,gy as ec,CL as Kn,CP as qn,gx as ac,Sx as tc,Dc as Qn,Sy as nc,Sz as rc,SA as sc,CN as Xn,Cy as Jn,Cf as er,CH as ar,CF as tr,CJ as cc,SB as nr,SC as oc,fu as ic,fv as dc,fw as lc,SD as tt,fo as rr,cS as xt,SE as uc,SF as mc,SG as Cc,SH as pc,CX as It,Dj as hc,Df as fc,CT as gc,Dh as Sc,D7 as bc,D9 as yc,SI as sr,Dp as Ga,Kg as Ic,SJ as kc,SK as Ec,SL as Ac,SM as cr,SN as Dc,DM as _c,C$ as or,CW as Ne,C_ as Pc,SO as wc,SP as vc,C6 as Tc,SQ as ir,fh as dr,SR as Fc,C8 as xc,C7 as Sn,SS as Bc,ST as Lc,SU as Rc,MN as Oc,SV as Bt,SW as Uc,xU as lr,ld as jc,hL as Mc,DR as Nc,SX as ur,f3 as Vc,f4 as Hc,SY as Gc,dj as $c,fl as zc,DH as Yc,DB as qe,bs as Wc,bJ as Zc,cA as Kc,bK as qc,L_ as Qc}from"./zeni-epic-state-CeMrW02Z.js";import{I as Re,cr as mr,q as we,cs as Cr,ct as pr,cu as Xc,a as ea,a0 as Lt,cv as Jc,cw as eo,Y as hr,c as fr,$ as gr,r as ye,C as ue,G as W,ar as ya,cx as Sr,cy as ao,cz as to,z as te,B as va,cg as nt,cA as no,cB as ro,cC as so,K as Ta,aS as We,bt as Rt,cD as co,E as Fa,m as rt,y as Ot,f as J,a9 as st,cE as oo,bG as ba,cF as kt,cG as io,x as Ut,cH as lo,au as br,a4 as Et,cI as uo,Z as yr,e as Ir,h as kr,cJ as mo,cK as Co,cL as po,cM as ho,cN as fo,cO as go,cP as So,o as Wa,cQ as bo,cR as yo,cS as ht,N as Io,cT as ko,cU as Eo,cV as Ao,cW as Do,cX as _o,i as Po}from"./index-jnJxCrIS.js";import{n as He,D as Er,S as wo}from"./mui-BU88kzbO.js";import{a as r}from"./sentry-BHeH_DOJ.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BjXqzhKq.js";import{M as Ie}from"./MobileAppDrawer-CpsSMjQ2.js";import{d as jt}from"./recharts-LNNCqKNo.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Je,f as aa,h as ta,A as vo,i as Mt,P as To,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as bn}from"./SetupPagesScreen-Bi7ql3Uc.js";import{u as wr}from"./useInitialThreadRequest-CIKn9Zyw.js";import ct from"./NotFoundScreen-_taUi6Es.js";import{u as Vt}from"./useChargeCardPusherEvents-a1rzK4fg.js";import{n as yn}from"./utils-BOLLxecq.js";import{t as Bo}from"./AddressScreen-DT4aul98.js";import"./analytics-BWMRmW6M.js";import"./plaid-CnRfB1Gp.js";import"./dnd-CMRnbWd0.js";import"./stripe-DMRn4zHo.js";import"./lottie-D0l9jr5K.js";import"./lexical-CLfce6-g.js";import"./pdf-DF6S6f8j.js";import"./analyticsHelper-DG9Hj57M.js";import"./routePaths-BrpCPMmb.js";import"./BusinessVerificationPageScreen-Om0cSThR.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d0ffd568-7bec-4846-9c97-0d335acb856f",e._sentryDebugIdIdentifier="sentry-dbid-d0ffd568-7bec-4846-9c97-0d335acb856f")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Tr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>os(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(E=>{S(E)},[]),m=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(is()),a(ds()),a(fn())},[a]);const w=i(E=>Pn(E.cardPolicyState)),l=i(E=>wn(E.cardPolicyState)),j=i(E=>vn(E.cardPolicyState)),B=i(E=>Tn(E.cardPolicyState)),L=i(E=>Fn(E.cardPolicyState)),p=i(E=>xn(E.cardPolicyState)),h=i(E=>Bn(E.cardPolicyState)),T=i(E=>Pt(E.cardPolicyState)),u=i(E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount),v=i(E=>E.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())},[a,w]),Tr();const k=i(E=>Rn(E.createCardPolicyState)),U=i(E=>ls(E.createCardPolicyState)),A=i(E=>us(E.cardPolicyState)),b=i(E=>ms(E.cardPolicyState)),x=i(E=>Cs(E.createCardPolicyState)),d=i(E=>On(E));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>l.map(Ro),[l]),M=r.useMemo(()=>h.map(Oo),[h]),V=r.useMemo(()=>d.cards.filter(E=>!mr(E.status.code)).map(vr),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&v==="Completed";r.useEffect(()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))},[v,a,O,x,V,u,j,B,L,p]);const R=r.useMemo(()=>jt(E=>{a(wt(E))},250),[a]);r.useEffect(()=>()=>{R.cancel()},[R]);const z=r.useCallback(E=>{R(E)},[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const E=we(n.state?.pathnameStackToGoBack),K=E.poppedPathname??_;e(K,{state:{pathnameStackToGoBack:E.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(E=>{a(hs(E))},[a]),I=r.useCallback(E=>{const K=Cr(E);a(fs({templates:[K]}))},[a]),N=r.useCallback(E=>{E.length!==0&&a(gs(E))},[a]),Z=r.useCallback(()=>{a(fn())},[a]),X=r.useRef($);r.useEffect(()=>{const E=X.current;X.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:b,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(Xe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{m(!0)},[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i(o=>Ss(o)),j=i(o=>Pn(o.cardPolicyState)),B=i(o=>wn(o.cardPolicyState)),L=i(o=>vn(o.cardPolicyState)),p=i(o=>Tn(o.cardPolicyState)),h=i(o=>Fn(o.cardPolicyState)),T=i(o=>xn(o.cardPolicyState)),u=i(o=>Bn(o.cardPolicyState)),v=i(o=>Pt(o.cardPolicyState)),k=i(o=>On(o)),U=i(o=>a!=null?bs(o.cardPolicyState,a):void 0),A=r.useMemo(()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0,[l.templateId,l.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))},[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())},[s,j]),Tr();const b=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[k.fetchState,s]);const x=r.useMemo(()=>B.map(Mo),[B]),d=r.useMemo(()=>u.map(No),[u]),f=r.useMemo(()=>k.cards.filter(o=>!mr(o.status.code)).map(vr),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo(()=>{if(A!=null)return Jc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[A,f,x,d,b,L,p,h,T]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect(()=>{R.current||V!=null||M==null||(R.current=!0,O(M))},[V,M]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))},[s,a]),Z=r.useRef(D);r.useEffect(()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const X=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Xe,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function xr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(As(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),m=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Ds(_)),L=i(_=>Rn(_.createCardPolicyState)),p=i(_=>_s(_.createCardPolicyState)),h=i(_=>p==null?[]:Nn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i(_=>Ps(_.createCardPolicyState)),v=ya(L.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[L.error?.message,L.fetchState,a,p,u,h,v]);const k=B.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ws())},[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect(()=>{A==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,A]);const b=r.useMemo(()=>B.templates.map(zo),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=hr(),E=fr(),K=gr(),ne=i(oe=>Mn(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),ve=r.useMemo(()=>Fr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=K&&E&&Z!=null&&!X,re=r.useCallback(oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,Z]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Te=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(Sr,{...d}):null,M=l&&f==null,V=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),R=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(vs(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:b,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:T,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Wo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i(q=>da(q,s.companyId)),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:b}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!F&&u&&l,f=i(q=>vt(q,n,d,u)),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i(q=>R!=null?$a(q.userRoleState,R):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(m(!0),setTimeout(()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,Z]),r.useEffect(()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&u&&l&&g&&t(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())},[A.fetchState,b.fetchState,t,u,l,g,x]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Je(u,T,v,l),K=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:K,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Zo="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ko=[Ra,La],qo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Ts({uiState:{sortKey:n,sortOrder:t}}))}}})(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(j=>ge(j)),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(W.isCardsCommentingEnabled),[S,P]=r.useState(!1),m=i(j=>ma(j)),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback(()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Xo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Ko),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Xo=e=>`/${e}/cards`,Jo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Fs(I,s)),u=T.chargeCard,v=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),b=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect(()=>{S===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),P(!0)),m===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))},[m,T.fetchState,S,v]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,u?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Hn(I.userState,B.userId)),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),w(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Ja(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}})(co),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Jo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-
|
|
1
|
+
import{j as m}from"./liveblocks-DgQRIsyS.js";import{a as g}from"./sentry-BHeH_DOJ.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-BCzXpSj2.js";import{z as C,be as P,x as F,f as V,h as j,ag as b,bf as A,au as L,av as U,r as B}from"./index-jnJxCrIS.js";import{eX as h,gj as M,tC as _,ge as G,c6 as R,Pn as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Po as X,bE as Z,cy as N,mQ as $,mT as J}from"./zeni-epic-state-CeMrW02Z.js";import"./mui-BU88kzbO.js";import{d as K}from"./routePaths-BrpCPMmb.js";import{M as W}from"./MobileAppDrawer-CpsSMjQ2.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="c9408743-8b98-46e6-a9fd-9fe339d107cb",t._sentryDebugIdIdentifier="sentry-dbid-c9408743-8b98-46e6-a9fd-9fe339d107cb")}catch{}})();const ee=E(function(t){const a=G(t),i=C.getSignedInUser(),l=h(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(X(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(Q({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=T(),i=x(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>h(s)),d=r.companyId??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-
|
|
1
|
+
import{j as g}from"./liveblocks-DgQRIsyS.js";import{a}from"./sentry-BHeH_DOJ.js";import{u as D,g as v,j as m,N as w}from"./core-BCzXpSj2.js";import{LW as A,eX as O,g1 as _,o9 as j,gs as h,g0 as L,fA as U,M1 as F}from"./zeni-epic-state-CeMrW02Z.js";import{u as $,z as p,L as C,a as k,o as H}from"./index-jnJxCrIS.js";import{n as z}from"./mui-BU88kzbO.js";import{t as R}from"./getLocaleForTenant-CJtZ2gVK.js";import{g as P,Q as G}from"./QBOConnectionScreen-D8kad0sY.js";import"./recharts-LNNCqKNo.js";import"./analytics-BWMRmW6M.js";import"./plaid-CnRfB1Gp.js";import"./dnd-CMRnbWd0.js";import"./stripe-DMRn4zHo.js";import"./lottie-D0l9jr5K.js";import"./lexical-CLfce6-g.js";import"./pdf-DF6S6f8j.js";import"./utils-BOLLxecq.js";import"./empty-Huff3QoR.js";import"./pdf-lib-f4RyuKvB.js";import"./index-kgnb8add.js";import"./url-CvYl_jYF.js";import"./index-RV1w-9NK.js";import"./decodeURIComponentSafe-BaVz5hiZ.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]="b4b78fa5-2985-4494-adcd-66b73055d705",t._sentryDebugIdIdentifier="sentry-dbid-b4b78fa5-2985-4494-adcd-66b73055d705")}catch{}})();const M=z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-DgQRIsyS.js";import{z as n}from"./index-jnJxCrIS.js";import{g as d}from"./QBOConnectionScreen-D8kad0sY.js";import"./sentry-BHeH_DOJ.js";import{g as p,N as s}from"./core-BCzXpSj2.js";import"./zeni-epic-state-CeMrW02Z.js";import"./recharts-LNNCqKNo.js";import"./mui-BU88kzbO.js";import"./analytics-BWMRmW6M.js";import"./plaid-CnRfB1Gp.js";import"./dnd-CMRnbWd0.js";import"./stripe-DMRn4zHo.js";import"./lottie-D0l9jr5K.js";import"./lexical-CLfce6-g.js";import"./pdf-DF6S6f8j.js";import"./utils-BOLLxecq.js";import"./empty-Huff3QoR.js";import"./pdf-lib-f4RyuKvB.js";import"./index-kgnb8add.js";import"./url-CvYl_jYF.js";import"./index-RV1w-9NK.js";import"./decodeURIComponentSafe-BaVz5hiZ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
package/dist/assets/{CustomerOnboardingRoutes-CI6qRXML.js → CustomerOnboardingRoutes-BSP_x0q_.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-DgQRIsyS.js";import{t as yt,A as Ve}from"./AddressScreen-DT4aul98.js";import ht from"./NotFoundScreen-_taUi6Es.js";import{a as d}from"./sentry-BHeH_DOJ.js";import{h as be,g as Ie,u as ne,i as ke,j as k,N as U,l as St,n as et,o as Ct,p as q}from"./core-BCzXpSj2.js";import{z as N,C as _e,G as H,d as bt,r as K,x as ae,f as R,h as de,aq as It,K as kt,N as tt,I as nt,ar as Le,m as Se,as as _t,o as Ne,at as Re,au as vt,av as Me,aw as Ot,ax as Tt}from"./index-jnJxCrIS.js";import{eX as W,fE as ve,fC as Oe,bs as xt,fS as Et,bS as wt,o7 as At,tm as Pt,tp as Dt,MV as jt,MW as Ft,k9 as Ce,kc as at,Mq as Bt,bY as Ut,c6 as le,tQ as Te,tB as Vt,MX as ue,tR as ot,Kj as Lt,ld as st,MY as Nt,MZ as Rt,rj as Mt,hq as $t,Mi as ge,hn as Gt,Mj as zt,y1 as Kt,rn as Qt,hf as qt,hi as $e,M_ as it,M$ as Ht,E4 as Yt,N0 as Zt,E8 as Wt,ts as Xt,N1 as Jt,N2 as en,k7 as tn,ka as nn,u1 as an,tD as rt,tP as on,bE as Ge,cy as sn,u0 as ze,rC as rn,rq as cn,l5 as dn,gh as un,gg as ln,gf as pn,N3 as mn,tv as gn,u2 as fn,u5 as yn,u8 as hn,ue as Sn,cY as Cn}from"./zeni-epic-state-CeMrW02Z.js";import{n as xe}from"./mui-BU88kzbO.js";import{g as bn,h as In,q as oe}from"./QBOConnectionScreen-D8kad0sY.js";import{u as kn,a as _n}from"./useEmailConnectResultRefresh-KQRYFmno.js";import{u as vn}from"./useChargeCardPusherEvents-a1rzK4fg.js";import"./recharts-LNNCqKNo.js";import"./analytics-BWMRmW6M.js";import"./plaid-CnRfB1Gp.js";import"./dnd-CMRnbWd0.js";import"./stripe-DMRn4zHo.js";import"./lottie-D0l9jr5K.js";import"./lexical-CLfce6-g.js";import"./pdf-DF6S6f8j.js";import"./utils-BOLLxecq.js";import"./empty-Huff3QoR.js";import"./pdf-lib-f4RyuKvB.js";import"./index-kgnb8add.js";import"./url-CvYl_jYF.js";import"./index-RV1w-9NK.js";import"./decodeURIComponentSafe-BaVz5hiZ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="cf3c7d9d-3046-4b9a-88d4-410e803d39b3",t._sentryDebugIdIdentifier="sentry-dbid-cf3c7d9d-3046-4b9a-88d4-410e803d39b3")}catch{}})();const On=()=>{const t=be(),u=Ie(),i=ne(),[o,l]=d.useState(!1),[c,y]=d.useState(!1),{tenantEmailDomain:S}=ke(),e=N.getSignedInUser(),{useFeatureGate:n}=_e(),{isFeatureEnabled:s}=n(H.isApAgingFeatureEnabled),{isFeatureEnabled:C}=n(H.isArAgingFeatureEnabled),{isFeatureEnabled:_}=n(H.isReferralFeatureEnabled),{isFeatureEnabled:I}=n(H.isExpenseAutomationEnabledV2),{isFeatureEnabled:T}=n(H.isDebitCardFeatureEnabled),r=bt(),f=k(h=>W(h)),p=k(h=>h.onboardingCustomerViewState.fetchState),v=f.excludedResources,O=f.companyId??N.getSignedInUserTenant(S)?.companyId;if(e==null)throw Error("Can't access onboarding flow without signing in...");const x=ve(T,f),P=Oe(f),m=[],M=v?.resources?.find(h=>h.resource==="/reports/top_expenses")==null,j=v?.resources?.find(h=>h.resource==="/reports/task_card")==null,$=f?.userRole!=null&&xt(f?.userRole),G=v?.resources?.find(h=>h.resource==="/bills")==null&&!$,w=v?.resources?.find(h=>h.resource==="/reimbursements")==null;M===!1&&m.push("top_expenses"),j===!1&&m.push("task_card"),G===!1&&m.push("bill_pay_card","bill_pay_promo_card"),w===!1&&m.push("reimbursement_card","reimbursement_promo_card"),m.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&m.push("rewards_card");const F=k(h=>{const D=[];s===!1&&D.push("accounts_payable_aging"),C===!1&&D.push("accounts_receivable_aging"),D.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&D.push("rewards_card"),r===!1&&D.push("expense_automation_card");const Y=Et(h,D,e,I,r);return wt(Y.reportsInOrder.map(A=>({fetchState:A.fetchState,error:A.error}))).fetchState});d.useEffect(()=>{p!=="Completed"||o||x||P||(l(!0),i(At(e.userId,O,f.tenantId,!0,!1,m)))},[o,p,x,P,e,f.tenantId,i]);const Q=d.useRef(!1),z=d.useCallback(()=>{const h={pathnameStackToGoBack:K(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};t(x?"../../checking":P?"../../cards":"../../dashboard",{state:h})},[t,u,x,P]),V=d.useCallback(()=>{Q.current||(Q.current=!0,z())},[z]);return d.useEffect(()=>{const h=setTimeout(()=>y(!0),3e3);return()=>clearTimeout(h)},[]),d.useEffect(()=>{const h=setTimeout(V,6e3);return()=>clearTimeout(h)},[V]),d.useEffect(()=>{x||P||!c||F!=="Completed"&&F!=="Error"||V()},[c,F,x,P,V]),p!=="Completed"?a.jsx(U,{to:"../"}):a.jsxs(a.Fragment,{children:[a.jsx(ae,{analytics:R,onLoad:h=>h.trackPageLoaded(de.Event.onboardingDashboardActivation)}),a.jsx(It,{show:!0,onComplete:V})]})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ke=(t,u)=>{const i=new Map(t.map(o=>[o.key,o]));return u.map(o=>{return l=i.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l})},Qe=(t,u)=>{if(t.length===0)return!1;const i=new Map(t.map(o=>[o.key,o]));return u.every(o=>i.get(o)?.status==="ready")},qe=xe.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${t=>t.theme.colors.grey4};
|
|
5
|
-
`,He=
|
|
5
|
+
`,He=xe.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
align-items: center;
|
|
@@ -11,20 +11,20 @@ import{j as a}from"./liveblocks-D7MTBeqB.js";import{t as yt,A as Ve}from"./Addre
|
|
|
11
11
|
|
|
12
12
|
${t=>t.skipLegacyDrawerOffset?`
|
|
13
13
|
width: 100%;
|
|
14
|
-
padding-left: ${
|
|
14
|
+
padding-left: ${Ne.sp0};
|
|
15
15
|
`:`
|
|
16
|
-
min-width: calc(100% - ${
|
|
17
|
-
padding-left: ${
|
|
16
|
+
min-width: calc(100% - ${Re}px);
|
|
17
|
+
padding-left: ${Re}px;
|
|
18
18
|
`}
|
|
19
19
|
|
|
20
20
|
${t=>t.theme.breakpoints.down("md")} {
|
|
21
21
|
width: 100%;
|
|
22
|
-
padding-left: ${
|
|
22
|
+
padding-left: ${Ne.sp0};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
${t=>t.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
-
`,Ye=et(function(t,u){const{companyId:i,isAdmin:o,currentTenant:l,isOnAddressPage:c}=u,y=R.getSignedInUser(),S=l.tenantId,e={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},n=W(t),s=Te(t,i),C=it(t),_=le(l?.userRole??[])&&s.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",I=Ht(t.userRoleConfigState);return{onboardingCustomerView:s,analytics:N,isRefreshingViewInBackground:!1,isDisabled:_,companyTitles:I.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:vt.fileMicroServiceBaseUrl,authParams:e},signedInUser:R.getSignedInUser(),currentTenant:n,isAdmin:o,isOnAddressPage:c,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:C,isCardPaymentPopupOpen:!1,stripeKey:Se.stripeKey}},function(t,u){const{companyId:i,currentTenant:o,themeState:l,navigate:c,location:y}=u,{tenantEmailDomain:S}=o;return{onFetchLinkTokenClick:(e,n)=>{t(Sn(e,n))},onEstablishConnectionClick:(e,n)=>{t(hn(e,n))},onUpdatePaymentAccountStatus:(e,n,s)=>{t(yn(e,n,s))},onUpdatePaymentAccountLoginStatus:(e,n)=>{t(fn(!1,e,n))},onEstablishConnectionSuccess:()=>{t(gn(i,!0,!1))},handleOnConnectClick:()=>{N.trackOnboardingConnectQBO(),oe.handleClick()},updateQBOPopupState:e=>{t(ue({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const n=e.map(s=>{const{officerType:C,userId:_,name:I,email:T,ssn:r,nationalityCountryCode:f,dob:p,phone:v,syncToken:O,selectDocument:E,role:P,ownership:m,isSelectedForVerification:M,userVerificationStatus:j,fileIds:$,isPhoneVerified:G}=s;let x;return E.selectDocumentType==="driverLicense"?x="driving_license":E.selectDocumentType==="passport"?x="passport":E.selectDocumentType==="stateId"?x="id_document":E.selectDocumentType==="ssnCard"&&(x="social_security_card"),{officerType:C,userId:_,firstName:I.firstName,lastName:I.lastName,email:T,ssn:r,nationalityCountryCode:f?.selectedOption!=null?Me(f.selectedOption):void 0,phone:v,birthday:p!=null?Ge(p?.toString()):p,syncToken:O,titleAtCompany:P.selectedOption,ownershipInCompany:m,documentTypeSelectedForVerification:x,isSelectedForVerification:M,userVerificationStatus:j,fileIds:$,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:G}});t(ze({officers:n}))},onGetOtp:(e,n)=>{t(pn(e,"CustomerOnboarding")),n!=null&&t(mn({officerType:n,phone:e}))},onResendOtp:e=>{t(ln(e,"CustomerOnboarding"))},onVerifyOtp:(e,n)=>{t(un(e,n,"CustomerOnboarding"))},updateFilesEntity:e=>{t(dn({files:e}))},onDeleteFile:e=>{t(cn(e))},onEditFileName:(e,n)=>{t(rn(e,n.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:n,companyIndustry:s,companyIndustryType:C,companyLegalName:_,companyTaxId:I,companyWebsite:T,companyPhone:r,primaryContactEmail:f,primaryContactName:p,primaryContactUserId:v,primaryContactSyncToken:O,syncToken:E,fileIds:P,typeOfIncorporation:m,stateOfIncorporation:M,incDate:j,companySourceOfFunds:$,companySourceOfFundsDescription:G,companySubIndustry:x,countriesOfOperations:F,purposeOfAccount:Q,purposeOfAccountDescription:z,regulatedStatus:V,regulatedStatusDescription:h,transactionVolume:D,transactionVolumeDescription:Y,usNexus:A,usNexusTypes:se}=e,B={companyId:i,companyDescription:n,companyIndustry:s.selectedOption,companyIndustryType:C?.selectedOption??"",companyLegalName:_,taxIdOrEIN:I,website:T!=""&&T!=null?sn(T):void 0,phone:r,syncToken:E,fileIds:P,incDate:j!=null?Ge(j?.toString()):j,typeOfIncorporation:m?.selectedOption??"",stateOfIncorporation:M?.selectedOption??"",companySourceOfFunds:$?.selectedOption??"",companySourceOfFundsDescription:G,companySubIndustry:x?.selectedOption??"",countriesOfOperations:F?.selectedOptions.map(X=>X.length===2?X:Me(X))??[],purposeOfAccount:Q?.selectedOption??"",purposeOfAccountDescription:z,regulatedStatus:V??"",regulatedStatusDescription:h,transactionVolume:D?.selectedOption??"",transactionVolumeDescription:Y,usNexus:A,usNexusTypes:se?.selectedOptions??[]},pe={userId:v,firstName:p.firstName,lastName:p.lastName,email:f,syncToken:O};t(ze({companyDetails:B,primaryContactDetails:pe}))},onAddressClick:(e,n)=>{const s=We(S,e,n),C=K(y.state?.pathnameStackToGoBack,y.pathname);c(s,{state:{pathnameStackToGoBack:C}})},onRegisteredAddressClick:(e,n)=>{const s=We(S,e,n),C=K(y.state?.pathnameStackToGoBack,y.pathname);c(s,{state:{pathnameStackToGoBack:C}})},onUpdateCustomerView:(e,n,s)=>{t(on(i,!1,n,s,e))},onAddressEditHandler:e=>{if(e!=null){const n=yt(e);t(st({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const e=K(y.state?.pathnameStackToGoBack,y.pathname);t(rt(i,!1,!1)),c("./activation",{state:{pathnameStackToGoBack:e}})},onUpdateStep:e=>{t(ot({step:e}))},onUpdateSubStep:e=>{t(an({subStep:e}))},onZeniLogoClick:()=>{l.toggle()},handleLogOutClick:()=>{const e=K(y.state?.pathnameStackToGoBack,y.pathname);c("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{c(`/${S}/rewards`)},handleCreateCardSetupIntent:e=>{t(at(e))},handleConfirmCardSetupIntent:e=>{t(nn(e))},updateCardPaymentModalState:e=>{t(ue({isCardPaymentPopupOpen:e}))},handleAddCardPaymentSource:(e,n,s)=>{t(tn(e,n,s))},handleFetchPaymentSources:()=>{t(Ce())},resetCardPaymentViewState:()=>{t(en())},handleResetCardPaymentErrorStatuses:()=>{t(Jt())},redirectToProductSuitePage:()=>{const e=K(y.state?.pathnameStackToGoBack,y.pathname);c(`/${S}/onboarding/thankyou`,{state:{pathnameStackToGoBack:e,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&t(Xt(i))},onIdentityDocumentUploadedForAutofill:e=>{if(i==null)return;const n=Zt(e.documentType);n!=null&&t(Wt({target:"onboarding",companyId:i,officerType:e.officerType,fileId:e.fileId,documentType:n}))},onCompanyDocumentUploadedForAutofill:e=>{i!=null&&t(Yt({target:"onboarding",companyId:i,fileId:e.fileId,documentType:e.documentType}))}}})(_t),ce=({taxCFOCustomer:t=!1,isOnAddressPage:u=!1,appContent:i})=>{const o=be(),l=Ie(),c=ne(),y=kt(),S=tt(),[e,n]=d.useState(!1),[s,C]=d.useState(!1),[_,I]=d.useState(!1),{tenantEmailDomain:T}=ke(),r=nt(),{useFeatureGate:f}=_e(),{isFeatureEnabled:p}=f(H.isDebitCardFeatureEnabled),v=St("/:tenantEmailDomain/onboarding")!==null&&l.search?.includes("code"),O=k(g=>g.onboardingCustomerViewState.fetchState),E=k(g=>g.onboardingCustomerViewState.currentStep),P=k(g=>g.onboardingCustomerViewState.uiState),m=k(g=>W(g)),M=k(g=>g.userRoleConfigState.fetchState),j=k(g=>g.cardPaymentViewState),$=Le(j.addCardPaymentSourceStatus.fetchState),G=j.addCardPaymentSourceStatus.fetchState,{code:x,realmId:F,state:Q}=bn(l.search),z=m.externalConnections?.accounting[0],V=z?.connectionType,h=z?.connectionName,D=z?.connectionId??"",Y=R.getSignedInUser()?.userId??"";d.useEffect(()=>{s||(C(!0),c(Ce()))},[s,c]),d.useEffect(()=>{_||(at(["card"]),I(!0))},[_]),d.useEffect(()=>{$==="In-Progress"&&G==="Completed"&&c(Ce())},[$,G]),d.useEffect(()=>{In(x,F,Q,D,Y)===!0&&m.externalConnections?.saveConnectionState!=="In-Progress"&&O==="Completed"&&(c(Bt(m.tenantId,{connection_type:V??"accounting",connection_name:h??"quickbooks_online",authorization_code:x,realm_id:F,connection_id:D,user_id:Y},Ut(window.location.origin+"/onboarding/auth"))),N.trackOnboardingSaveQBOConnection(F,D),o(l.pathname))},[x,F,Q,l.pathname,O]),d.useEffect(()=>{oe.isInitiated===!1&&O==="Completed"&&oe.init("/onboarding/auth",m.tenantEmailDomain)},[O]);const A=m.companyId??R.getSignedInUserTenant(T)?.companyId,se=le(m?.userRole??[]),B=k(g=>Te(g,A));d.useEffect(()=>{e||O!=="Not-Started"||A==null||(n(!0),c(Vt(A,!0,!v)))},[e,O,A]),d.useEffect(()=>{m.externalConnections?.saveConnectionState!=="Completed"&&m.externalConnections?.saveConnectionState!=="Error"||!P.isQBOPopupOpen||E!=="connect_ledger"||c(ue({isQBOPopupOpen:!1}))},[m.externalConnections?.saveConnectionState]),d.useEffect(()=>{O==="Completed"&&v&&(c(ot({step:"connect_ledger"})),c(ue({isQBOPopupOpen:!0})))},[v,O]),d.useEffect(()=>{M==="Not-Started"&&c(Lt(!0))},[M,c]);const pe=Le(B.companyDetailsLocalData?.addressStatus);d.useEffect(()=>{B.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&B.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&pe==null&&c(st({addressType:"company_registered_address",addressToCreate:B.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[B.companyDetailsLocalData?.addressStatus?.addressToCreate,B.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const X=B.isInterimEmailSent,we=R.getSignedInUser();if(we==null)throw Error("Can't access onboarding flow without signing in...");const ct=ve(p,m),dt=Oe(m),xe=m.company?.companyOnboardingInfo.isOnboardingCompleted,Ae=g=>g.trackPageLoaded(de.Event.onboardingPage),Pe=m.productSettings.isOtherProductsEnabled,ut=m.productSettings.isTreasuryEnabled,De=Tn({tenantEmailDomain:T??"",signedInUserEmail:we.userEmail??"",companyId:A}),je=(({companyId:g})=>{const L=ne(),ie=k(w=>w.onboardingCustomerViewState?.aiAgentsActivation),J=k(w=>W(w).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1),me=d.useCallback(()=>{L(Pt())},[L]);d.useEffect(()=>{me()},[me]);const Fe=d.useCallback(()=>{g==null||g===""||J||L(Dt(g))},[g,J,L]),lt=d.useMemo(()=>{if(g==null||g==="")return[];const w=`private-encrypted-${g}`;return[`${w}.ledger-ingestion.counts-updated`,`${w}.ai-agents-activation.phase-changed`]},[g]),pt=d.useCallback((w,ee)=>{if(ee==null||typeof ee!="object")return;const b=ee;if(w!=="ledger-ingestion.counts-updated"){if(w==="ai-agents-activation.phase-changed"){const re=typeof b.phase_key=="string"?b.phase_key:typeof b.key=="string"?b.key:"",Z=typeof b.status=="string"?b.status:"idle";if(re==="")return;L(Ft({key:re,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof b.started_at=="string"?b.started_at:void 0,completedAt:typeof b.completed_at=="string"?b.completed_at:void 0}))}}else L(jt({customerCount:typeof b.customer_count=="number"?b.customer_count:void 0,glAccountCount:typeof b.gl_account_count=="number"?b.gl_account_count:void 0,targetTransactionCount:typeof b.target_transaction_count=="number"?b.target_transaction_count:void 0,transactionCount:typeof b.transaction_count=="number"?b.transaction_count:void 0,vendorCount:typeof b.vendor_count=="number"?b.vendor_count:void 0}))},[L]);return vn({events:lt,onEvent:pt,onSubscribed:me}),d.useMemo(()=>{const w=ie?.phases??[],ee=Ke(w,fe),b=Ke(w,ye),re=Qe(w,fe),Z=Qe(w,ye),Be=w.some(ft=>ft.status!=="idle"),te=!J&&!Be,Ue=J&&!Be,mt=Ue?fe.map(()=>"building"):ee,gt=Ue?ye.map(()=>"building"):b;return{ledgerRowStatuses:te?void 0:mt,backgroundRowStatuses:te?void 0:gt,showLedgerReadyInLabel:te?void 0:re,showBackgroundReadyInLabel:te?void 0:Z,forceContinueEnabled:!te||void 0,counts:ie?.counts,onContinueClicked:Fe}},[ie?.phases,ie?.counts,J,Fe])})({companyId:A});if(xe===!0){if(!Pe)return ut?a.jsx(U,{to:"../../treasury"}):ct?a.jsx(U,{to:"../../checking"}):dt?a.jsx(U,{to:"../../cards"}):a.jsx(U,{to:"../../dashboard"});const g=B.updateStatus.fetchState==="In-Progress";if(Pe&&!g)return t?a.jsxs(qe,{children:[a.jsx(ae,{analytics:N,onLoad:L=>Ae(L)}),a.jsx(Ye,{navigate:o,location:l,companyId:A,currentTenant:m,isAdmin:se,isOnAddressPage:u,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),i!=null?a.jsx(He,{windowSize:y,skipLegacyDrawerOffset:u&&m.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):a.jsx(U,{to:"../../onboarding/thankyou"})}else if(xe===!1&&r?.loggedInUserRoleMap!=null)return X===!0?a.jsx(U,{to:"../../onboarding/thankyou"}):a.jsxs(qe,{children:[a.jsx(ae,{analytics:N,onLoad:g=>Ae(g)}),a.jsx(Ye,{navigate:o,location:l,companyId:A,currentTenant:m,isAdmin:se,isOnAddressPage:u,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),i!=null?a.jsx(He,{windowSize:y,skipLegacyDrawerOffset:u&&m.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},he="external_integrations",Tn=({tenantEmailDomain:t,signedInUserEmail:u,companyId:i})=>{const o=ne(),{pendingAutoFocusTabId:l}=kn(),{plaidAccounts:c,onAddPlaidAccount:y}=_n({companyId:i}),S=k(r=>r.plaidAccountViewState.external_account.plaidConnectionDetails),e=k(r=>W(r)),n=k(r=>r.tenantState.fetchState),s=k(r=>Rt(r,i)),C=k(r=>Nt(r,he)),_=d.useMemo(()=>new Set(C.map(r=>r.additionalInfo).filter(r=>r!=null)),[C]),I=e.tenantId,T=le(e.userRole??[]);return d.useEffect(()=>{o(Mt(he))},[o]),d.useMemo(()=>({isAdmin:T,integrationsView:s,isLoading:n==="In-Progress",notifyMeRegisteredSlugs:_,autoFocusTabId:l??void 0,saveChargeBeeState:s.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:s.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:s.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:s.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:s.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(s.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map(([r,f])=>[r,f?.message])),deleteConnectionState:s.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:s.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{o($e(I,"gmail",Ze()))},onConnectOutlook:()=>{o($e(I,"outlook",Ze()))},onConnectHubSpot:(r,f)=>{const p=s.externalConnections?.revenue?.find(O=>O.connectionName==="hubspot")?.connectionId;if(p==null)return;const v=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:f,connection_id:p,redirect_uri:v,tenant_id:I})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(v)}`},onDisconnect:(r,f)=>{o(qt(I,r,ge(f)))},onNotifyMe:r=>{N.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Qt(he,r,u))},onReconnectQBO:()=>{oe.init("/onboarding/auth",t),oe.handleClick()},onRefreshClick:()=>{s.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Kt())},onSaveChargeBeeCredentials:(r,f)=>{const p=s.externalConnections?.revenue?.find(v=>v.connectionName==="chargebee")?.connectionId;p!=null&&o(Gt(I,p,ge("revenue"),zt("chargebee"),{api_key:r,site:f}))},onSaveConnectorCredentials:r=>{o($t(I,ge("payments"),r))},plaidAccounts:c,onAddPlaidAccount:y,plaidConnectionDetails:S}),[T,s,n,_,l,I,u,t,o,c,y,S])};function Ze(){const t=new URL(window.location.href);return t.searchParams.set("onboarding_step","connect_data_source"),t.toString()}function We(t,u,i){let o=`/${t}/onboarding/address`;return o=i!=null?o.concat(`/edit/${u}/${encodeURIComponent(i)}`):o.concat(`/new/${u}`),o}const Xe=Ee.div`
|
|
26
|
+
`,Ye=et(function(t,u){const{companyId:i,isAdmin:o,currentTenant:l,isOnAddressPage:c}=u,y=N.getSignedInUser(),S=l.tenantId,e={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},n=W(t),s=Te(t,i),C=it(t),_=le(l?.userRole??[])&&s.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",I=Ht(t.userRoleConfigState);return{onboardingCustomerView:s,analytics:R,isRefreshingViewInBackground:!1,isDisabled:_,companyTitles:I.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:vt.fileMicroServiceBaseUrl,authParams:e},signedInUser:N.getSignedInUser(),currentTenant:n,isAdmin:o,isOnAddressPage:c,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:C,isCardPaymentPopupOpen:!1,stripeKey:Se.stripeKey}},function(t,u){const{companyId:i,currentTenant:o,themeState:l,navigate:c,location:y}=u,{tenantEmailDomain:S}=o;return{onFetchLinkTokenClick:(e,n)=>{t(Sn(e,n))},onEstablishConnectionClick:(e,n)=>{t(hn(e,n))},onUpdatePaymentAccountStatus:(e,n,s)=>{t(yn(e,n,s))},onUpdatePaymentAccountLoginStatus:(e,n)=>{t(fn(!1,e,n))},onEstablishConnectionSuccess:()=>{t(gn(i,!0,!1))},handleOnConnectClick:()=>{R.trackOnboardingConnectQBO(),oe.handleClick()},updateQBOPopupState:e=>{t(ue({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const n=e.map(s=>{const{officerType:C,userId:_,name:I,email:T,ssn:r,nationalityCountryCode:f,dob:p,phone:v,syncToken:O,selectDocument:x,role:P,ownership:m,isSelectedForVerification:M,userVerificationStatus:j,fileIds:$,isPhoneVerified:G}=s;let w;return x.selectDocumentType==="driverLicense"?w="driving_license":x.selectDocumentType==="passport"?w="passport":x.selectDocumentType==="stateId"?w="id_document":x.selectDocumentType==="ssnCard"&&(w="social_security_card"),{officerType:C,userId:_,firstName:I.firstName,lastName:I.lastName,email:T,ssn:r,nationalityCountryCode:f?.selectedOption!=null?Me(f.selectedOption):void 0,phone:v,birthday:p!=null?Ge(p?.toString()):p,syncToken:O,titleAtCompany:P.selectedOption,ownershipInCompany:m,documentTypeSelectedForVerification:w,isSelectedForVerification:M,userVerificationStatus:j,fileIds:$,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:G}});t(ze({officers:n}))},onGetOtp:(e,n)=>{t(pn(e,"CustomerOnboarding")),n!=null&&t(mn({officerType:n,phone:e}))},onResendOtp:e=>{t(ln(e,"CustomerOnboarding"))},onVerifyOtp:(e,n)=>{t(un(e,n,"CustomerOnboarding"))},updateFilesEntity:e=>{t(dn({files:e}))},onDeleteFile:e=>{t(cn(e))},onEditFileName:(e,n)=>{t(rn(e,n.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:n,companyIndustry:s,companyIndustryType:C,companyLegalName:_,companyTaxId:I,companyWebsite:T,companyPhone:r,primaryContactEmail:f,primaryContactName:p,primaryContactUserId:v,primaryContactSyncToken:O,syncToken:x,fileIds:P,typeOfIncorporation:m,stateOfIncorporation:M,incDate:j,companySourceOfFunds:$,companySourceOfFundsDescription:G,companySubIndustry:w,countriesOfOperations:F,purposeOfAccount:Q,purposeOfAccountDescription:z,regulatedStatus:V,regulatedStatusDescription:h,transactionVolume:D,transactionVolumeDescription:Y,usNexus:A,usNexusTypes:se}=e,B={companyId:i,companyDescription:n,companyIndustry:s.selectedOption,companyIndustryType:C?.selectedOption??"",companyLegalName:_,taxIdOrEIN:I,website:T!=""&&T!=null?sn(T):void 0,phone:r,syncToken:x,fileIds:P,incDate:j!=null?Ge(j?.toString()):j,typeOfIncorporation:m?.selectedOption??"",stateOfIncorporation:M?.selectedOption??"",companySourceOfFunds:$?.selectedOption??"",companySourceOfFundsDescription:G,companySubIndustry:w?.selectedOption??"",countriesOfOperations:F?.selectedOptions.map(X=>X.length===2?X:Me(X))??[],purposeOfAccount:Q?.selectedOption??"",purposeOfAccountDescription:z,regulatedStatus:V??"",regulatedStatusDescription:h,transactionVolume:D?.selectedOption??"",transactionVolumeDescription:Y,usNexus:A,usNexusTypes:se?.selectedOptions??[]},pe={userId:v,firstName:p.firstName,lastName:p.lastName,email:f,syncToken:O};t(ze({companyDetails:B,primaryContactDetails:pe}))},onAddressClick:(e,n)=>{const s=We(S,e,n),C=K(y.state?.pathnameStackToGoBack,y.pathname);c(s,{state:{pathnameStackToGoBack:C}})},onRegisteredAddressClick:(e,n)=>{const s=We(S,e,n),C=K(y.state?.pathnameStackToGoBack,y.pathname);c(s,{state:{pathnameStackToGoBack:C}})},onUpdateCustomerView:(e,n,s)=>{t(on(i,!1,n,s,e))},onAddressEditHandler:e=>{if(e!=null){const n=yt(e);t(st({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const e=K(y.state?.pathnameStackToGoBack,y.pathname);t(rt(i,!1,!1)),c("./activation",{state:{pathnameStackToGoBack:e}})},onUpdateStep:e=>{t(ot({step:e}))},onUpdateSubStep:e=>{t(an({subStep:e}))},onZeniLogoClick:()=>{l.toggle()},handleLogOutClick:()=>{const e=K(y.state?.pathnameStackToGoBack,y.pathname);c("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{c(`/${S}/rewards`)},handleCreateCardSetupIntent:e=>{t(at(e))},handleConfirmCardSetupIntent:e=>{t(nn(e))},updateCardPaymentModalState:e=>{t(ue({isCardPaymentPopupOpen:e}))},handleAddCardPaymentSource:(e,n,s)=>{t(tn(e,n,s))},handleFetchPaymentSources:()=>{t(Ce())},resetCardPaymentViewState:()=>{t(en())},handleResetCardPaymentErrorStatuses:()=>{t(Jt())},redirectToProductSuitePage:()=>{const e=K(y.state?.pathnameStackToGoBack,y.pathname);c(`/${S}/onboarding/thankyou`,{state:{pathnameStackToGoBack:e,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&t(Xt(i))},onIdentityDocumentUploadedForAutofill:e=>{if(i==null)return;const n=Zt(e.documentType);n!=null&&t(Wt({target:"onboarding",companyId:i,officerType:e.officerType,fileId:e.fileId,documentType:n}))},onCompanyDocumentUploadedForAutofill:e=>{i!=null&&t(Yt({target:"onboarding",companyId:i,fileId:e.fileId,documentType:e.documentType}))}}})(_t),ce=({taxCFOCustomer:t=!1,isOnAddressPage:u=!1,appContent:i})=>{const o=be(),l=Ie(),c=ne(),y=kt(),S=tt(),[e,n]=d.useState(!1),[s,C]=d.useState(!1),[_,I]=d.useState(!1),{tenantEmailDomain:T}=ke(),r=nt(),{useFeatureGate:f}=_e(),{isFeatureEnabled:p}=f(H.isDebitCardFeatureEnabled),v=St("/:tenantEmailDomain/onboarding")!==null&&l.search?.includes("code"),O=k(g=>g.onboardingCustomerViewState.fetchState),x=k(g=>g.onboardingCustomerViewState.currentStep),P=k(g=>g.onboardingCustomerViewState.uiState),m=k(g=>W(g)),M=k(g=>g.userRoleConfigState.fetchState),j=k(g=>g.cardPaymentViewState),$=Le(j.addCardPaymentSourceStatus.fetchState),G=j.addCardPaymentSourceStatus.fetchState,{code:w,realmId:F,state:Q}=bn(l.search),z=m.externalConnections?.accounting[0],V=z?.connectionType,h=z?.connectionName,D=z?.connectionId??"",Y=N.getSignedInUser()?.userId??"";d.useEffect(()=>{s||(C(!0),c(Ce()))},[s,c]),d.useEffect(()=>{_||(at(["card"]),I(!0))},[_]),d.useEffect(()=>{$==="In-Progress"&&G==="Completed"&&c(Ce())},[$,G]),d.useEffect(()=>{In(w,F,Q,D,Y)===!0&&m.externalConnections?.saveConnectionState!=="In-Progress"&&O==="Completed"&&(c(Bt(m.tenantId,{connection_type:V??"accounting",connection_name:h??"quickbooks_online",authorization_code:w,realm_id:F,connection_id:D,user_id:Y},Ut(window.location.origin+"/onboarding/auth"))),R.trackOnboardingSaveQBOConnection(F,D),o(l.pathname))},[w,F,Q,l.pathname,O]),d.useEffect(()=>{oe.isInitiated===!1&&O==="Completed"&&oe.init("/onboarding/auth",m.tenantEmailDomain)},[O]);const A=m.companyId??N.getSignedInUserTenant(T)?.companyId,se=le(m?.userRole??[]),B=k(g=>Te(g,A));d.useEffect(()=>{e||O!=="Not-Started"||A==null||(n(!0),c(Vt(A,!0,!v)))},[e,O,A]),d.useEffect(()=>{m.externalConnections?.saveConnectionState!=="Completed"&&m.externalConnections?.saveConnectionState!=="Error"||!P.isQBOPopupOpen||x!=="connect_ledger"||c(ue({isQBOPopupOpen:!1}))},[m.externalConnections?.saveConnectionState]),d.useEffect(()=>{O==="Completed"&&v&&(c(ot({step:"connect_ledger"})),c(ue({isQBOPopupOpen:!0})))},[v,O]),d.useEffect(()=>{M==="Not-Started"&&c(Lt(!0))},[M,c]);const pe=Le(B.companyDetailsLocalData?.addressStatus);d.useEffect(()=>{B.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&B.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&pe==null&&c(st({addressType:"company_registered_address",addressToCreate:B.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[B.companyDetailsLocalData?.addressStatus?.addressToCreate,B.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const X=B.isInterimEmailSent,Ee=N.getSignedInUser();if(Ee==null)throw Error("Can't access onboarding flow without signing in...");const ct=ve(p,m),dt=Oe(m),we=m.company?.companyOnboardingInfo.isOnboardingCompleted,Ae=g=>g.trackPageLoaded(de.Event.onboardingPage),Pe=m.productSettings.isOtherProductsEnabled,ut=m.productSettings.isTreasuryEnabled,De=Tn({tenantEmailDomain:T??"",signedInUserEmail:Ee.userEmail??"",companyId:A}),je=(({companyId:g})=>{const L=ne(),ie=k(E=>E.onboardingCustomerViewState?.aiAgentsActivation),J=k(E=>W(E).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1),me=d.useCallback(()=>{L(Pt())},[L]);d.useEffect(()=>{me()},[me]);const Fe=d.useCallback(()=>{g==null||g===""||J||L(Dt(g))},[g,J,L]),lt=d.useMemo(()=>{if(g==null||g==="")return[];const E=`private-encrypted-${g}`;return[`${E}.ledger-ingestion.counts-updated`,`${E}.ai-agents-activation.phase-changed`]},[g]),pt=d.useCallback((E,ee)=>{if(ee==null||typeof ee!="object")return;const b=ee;if(E!=="ledger-ingestion.counts-updated"){if(E==="ai-agents-activation.phase-changed"){const re=typeof b.phase_key=="string"?b.phase_key:typeof b.key=="string"?b.key:"",Z=typeof b.status=="string"?b.status:"idle";if(re==="")return;L(Ft({key:re,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof b.started_at=="string"?b.started_at:void 0,completedAt:typeof b.completed_at=="string"?b.completed_at:void 0}))}}else L(jt({customerCount:typeof b.customer_count=="number"?b.customer_count:void 0,glAccountCount:typeof b.gl_account_count=="number"?b.gl_account_count:void 0,targetTransactionCount:typeof b.target_transaction_count=="number"?b.target_transaction_count:void 0,transactionCount:typeof b.transaction_count=="number"?b.transaction_count:void 0,vendorCount:typeof b.vendor_count=="number"?b.vendor_count:void 0}))},[L]);return vn({events:lt,onEvent:pt,onSubscribed:me}),d.useMemo(()=>{const E=ie?.phases??[],ee=Ke(E,fe),b=Ke(E,ye),re=Qe(E,fe),Z=Qe(E,ye),Be=E.some(ft=>ft.status!=="idle"),te=!J&&!Be,Ue=J&&!Be,mt=Ue?fe.map(()=>"building"):ee,gt=Ue?ye.map(()=>"building"):b;return{ledgerRowStatuses:te?void 0:mt,backgroundRowStatuses:te?void 0:gt,showLedgerReadyInLabel:te?void 0:re,showBackgroundReadyInLabel:te?void 0:Z,forceContinueEnabled:!te||void 0,counts:ie?.counts,onContinueClicked:Fe}},[ie?.phases,ie?.counts,J,Fe])})({companyId:A});if(we===!0){if(!Pe)return ut?a.jsx(U,{to:"../../treasury"}):ct?a.jsx(U,{to:"../../checking"}):dt?a.jsx(U,{to:"../../cards"}):a.jsx(U,{to:"../../dashboard"});const g=B.updateStatus.fetchState==="In-Progress";if(Pe&&!g)return t?a.jsxs(qe,{children:[a.jsx(ae,{analytics:R,onLoad:L=>Ae(L)}),a.jsx(Ye,{navigate:o,location:l,companyId:A,currentTenant:m,isAdmin:se,isOnAddressPage:u,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),i!=null?a.jsx(He,{windowSize:y,skipLegacyDrawerOffset:u&&m.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):a.jsx(U,{to:"../../onboarding/thankyou"})}else if(we===!1&&r?.loggedInUserRoleMap!=null)return X===!0?a.jsx(U,{to:"../../onboarding/thankyou"}):a.jsxs(qe,{children:[a.jsx(ae,{analytics:R,onLoad:g=>Ae(g)}),a.jsx(Ye,{navigate:o,location:l,companyId:A,currentTenant:m,isAdmin:se,isOnAddressPage:u,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),i!=null?a.jsx(He,{windowSize:y,skipLegacyDrawerOffset:u&&m.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},he="external_integrations",Tn=({tenantEmailDomain:t,signedInUserEmail:u,companyId:i})=>{const o=ne(),{pendingAutoFocusTabId:l}=kn(),{plaidAccounts:c,onAddPlaidAccount:y}=_n({companyId:i}),S=k(r=>r.plaidAccountViewState.external_account.plaidConnectionDetails),e=k(r=>W(r)),n=k(r=>r.tenantState.fetchState),s=k(r=>Nt(r,i)),C=k(r=>Rt(r,he)),_=d.useMemo(()=>new Set(C.map(r=>r.additionalInfo).filter(r=>r!=null)),[C]),I=e.tenantId,T=le(e.userRole??[]);return d.useEffect(()=>{o(Mt(he))},[o]),d.useMemo(()=>({isAdmin:T,integrationsView:s,isLoading:n==="In-Progress",notifyMeRegisteredSlugs:_,autoFocusTabId:l??void 0,saveChargeBeeState:s.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:s.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:s.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:s.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:s.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(s.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map(([r,f])=>[r,f?.message])),deleteConnectionState:s.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:s.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{o($e(I,"gmail",Ze()))},onConnectOutlook:()=>{o($e(I,"outlook",Ze()))},onConnectHubSpot:(r,f)=>{const p=s.externalConnections?.revenue?.find(O=>O.connectionName==="hubspot")?.connectionId;if(p==null)return;const v=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:f,connection_id:p,redirect_uri:v,tenant_id:I})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(v)}`},onDisconnect:(r,f)=>{o(qt(I,r,ge(f)))},onNotifyMe:r=>{R.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Qt(he,r,u))},onReconnectQBO:()=>{oe.init("/onboarding/auth",t),oe.handleClick()},onRefreshClick:()=>{s.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Kt())},onSaveChargeBeeCredentials:(r,f)=>{const p=s.externalConnections?.revenue?.find(v=>v.connectionName==="chargebee")?.connectionId;p!=null&&o(Gt(I,p,ge("revenue"),zt("chargebee"),{api_key:r,site:f}))},onSaveConnectorCredentials:r=>{o($t(I,ge("payments"),r))},plaidAccounts:c,onAddPlaidAccount:y,plaidConnectionDetails:S}),[T,s,n,_,l,I,u,t,o,c,y,S])};function Ze(){const t=new URL(window.location.href);return t.searchParams.set("onboarding_step","connect_data_source"),t.toString()}function We(t,u,i){let o=`/${t}/onboarding/address`;return o=i!=null?o.concat(`/edit/${u}/${encodeURIComponent(i)}`):o.concat(`/new/${u}`),o}const Xe=xe.div`
|
|
27
27
|
display: flex;
|
|
28
28
|
height: 100vh;
|
|
29
29
|
background-color: ${t=>t.theme.colors.grey4};
|
|
30
|
-
`,Je=et(function(t,u){const{companyId:i,currentTenant:o}=u,l=Te(t,i),c=it(t);return{hasVerifiedBankAccount:(l.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(c.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:le(o?.userRole??[])&&l.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:
|
|
30
|
+
`,Je=et(function(t,u){const{companyId:i,currentTenant:o}=u,l=Te(t,i),c=it(t);return{hasVerifiedBankAccount:(l.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(c.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:le(o?.userRole??[])&&l.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:N.getSignedInUser(),currentTenant:o,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true"}},function(t,u){const{currentTenant:i,themeState:o,navigate:l,location:c}=u,{tenantEmailDomain:y}=i;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const S=K(c.state?.pathnameStackToGoBack,c.pathname);l("/signout",{replace:!0,state:{pathnameStackToGoBack:S,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{l(`/${y}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const S=K(c.state?.pathnameStackToGoBack,c.pathname);l(`/${y}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:S,message:"UpdatePaymentAddressDetail"}})}}})(Tt),xn=()=>{const t=be(),u=ne(),i=Ie(),o=tt(),{useFeatureGate:l}=_e(),{isFeatureEnabled:c}=l(H.isDebitCardFeatureEnabled),{tenantEmailDomain:y}=ke(),S=nt(),[e,n]=d.useState(!1);d.useEffect(()=>{e===!1&&i.state?.message==="OnboardingThankyou"&&n(!0)},[i.state]);const s=k(p=>W(p)),C=s.productSettings.isOtherProductsEnabled;d.useEffect(()=>{u(rt(_,!1,!C))},[]);const _=s.companyId??N.getSignedInUserTenant(y)?.companyId;if(S.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const I=ve(c,s),T=Oe(s),r=k(p=>p.onboardingCustomerViewState.updateStatus.fetchState),f=s.company?.companyOnboardingInfo.isOnboardingCompleted;if(f!==!0||C)return r==="Completed"&&f===!0&&C&&S?.loggedInUserRoleMap!=null?a.jsxs(Xe,{children:[a.jsx(ae,{analytics:R,onLoad:p=>{p.trackPageLoaded(de.Event.onboardingLandingPage,"Onboarding",Cn(s.productSettings))}}),a.jsx(Je,{navigate:t,showUpdatePaymentDetailButton:C,location:i,companyId:_,currentTenant:s,themeState:o,isVisitingFirstTime:e})]}):r==="Completed"&&f===!1&&S?.loggedInUserRoleMap!=null?a.jsxs(Xe,{children:[a.jsx(ae,{analytics:R,onLoad:p=>{p.trackPageLoaded(de.Event.onboardingInterimPage)}}),a.jsx(Je,{navigate:t,showUpdatePaymentDetailButton:C,location:i,companyId:_,currentTenant:s,themeState:o,isVisitingFirstTime:e})]}):a.jsx(Ot,{});{const p={pathnameStackToGoBack:i.state?.pathnameStackToGoBack,message:"activation"};return I?a.jsx(U,{to:"../../checking",state:p,replace:!0}):T?a.jsx(U,{to:"../../cards",state:p,replace:!0}):a.jsx(U,{to:"../../dashboard",state:p,replace:!0})}};function ea(){return a.jsxs(Ct,{children:[a.jsx(q,{path:"/",element:a.jsx(ce,{})}),a.jsx(q,{path:"/billing/edit",element:a.jsx(ce,{taxCFOCustomer:!0})}),a.jsx(q,{path:"/thankyou",element:a.jsx(xn,{})}),a.jsx(q,{path:"/activation",element:a.jsx(On,{})}),a.jsx(q,{path:"/address/edit/:addressType/:addressId",element:a.jsx(ce,{isOnAddressPage:!0,appContent:a.jsx(Ve,{})})}),a.jsx(q,{path:"/address/new/:addressType",element:a.jsx(ce,{isOnAddressPage:!0,appContent:a.jsx(Ve,{})})}),a.jsx(q,{path:"*",element:a.jsx(ht,{})})]})}export{ea as default};
|