@zeniai/web-app-ui 5.4.16-dev → 5.4.17-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-CDXqSiAc.js → AccountMappingScreen-DIZ1qWql.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-CLGyk8Pf.js → ActualMatchingMatchDetailScreen-C6MMW6xe.js} +1 -1
- package/dist/assets/AddressRoutes-DneYortX.js +1 -0
- package/dist/assets/AddressScreen-CxRV-hrD.js +9 -0
- package/dist/assets/AiCfoScreen-Ct8ctLoM.js +22 -0
- package/dist/assets/{AppDrawer-B2nKx9FM.js → AppDrawer-DDlKiLbC.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-DZgRuPl7.js → BillPayApprovalRoutes-WPV-16X0.js} +1 -1
- package/dist/assets/{BillPayRoutes-DswppA7i.js → BillPayRoutes-PQbxiOB3.js} +1 -1
- package/dist/assets/BusinessVerificationPageScreen-DaAqJAwC.js +9 -0
- package/dist/assets/{CardsAiCfoScreen-BcEAv9Pt.js → CardsAiCfoScreen-CVenT1_U.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-DeJE6G2a.js → ChargeCardRoutes-uCAqAWIA.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-u9kNx3Tg.js → CompanyPassportScreen-DtXzsb3x.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-BC1VQ6tg.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-DGFpytn-.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-i8teYQ0f.js → CustomerOnboardingRoutes-B6np-cNh.js} +5 -5
- package/dist/assets/{DashboardRoutes-CVe5_3-I.js → DashboardRoutes-9dawbCei.js} +4 -4
- package/dist/assets/{DefaultTenantHome-D6T8HuT3.js → DefaultTenantHome-BgSSAKid.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-dIpkGH6g.js → DomesticWireDetailScreen-u2HKaCWA.js} +3 -3
- package/dist/assets/{DrawerScreen-Bl0Kb-2-.js → DrawerScreen-BmZb1i83.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-DDHIuX8U.js → EntityDetailRoutes-DV-gNWAZ.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-DgHZQYiA.js → ExpenseAutomationRoutes-DJyIDCG4.js} +1 -1
- package/dist/assets/{FallBackRoute-VU9noj8V.js → FallBackRoute--cXyuVDR.js} +2 -2
- package/dist/assets/FeaturePreviewScreen-DjPPDYKv.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-DL6_G6pe.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-BGgv9Z5e.js → InboxNotificationsProvider-Daf1RQwd.js} +1 -1
- package/dist/assets/{InvoicingRoutes-BsZlsusO.js → InvoicingRoutes-DKlu_pXq.js} +2 -2
- package/dist/assets/{MagicLinkRoutes-BhGsmEvC.js → MagicLinkRoutes-BkZcOPcj.js} +17 -17
- package/dist/assets/MagicLinkSignInScreen-CmIZfa-U.js +12 -0
- package/dist/assets/{MobileAppDrawer-BUD0j7G2.js → MobileAppDrawer-DTqKEh3f.js} +1 -1
- package/dist/assets/NotFoundScreen-CY-XFa3a.js +1 -0
- package/dist/assets/{NotificationRoutes-ZaAHYFIU.js → NotificationRoutes-BwTXq37O.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BKY_MZq1.js → OAuthConsentScreen-NPetpQky.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-YG8pfDPq.js → PandLWithForecastRoutes-eI5sgFXq.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-CO2Phrs3.js → PaymentLinkScreen-C3fxjzB1.js} +1 -1
- package/dist/assets/{PeopleRoutes-B0Fd7My2.js → PeopleRoutes-B4kdNKMm.js} +5 -5
- package/dist/assets/PerformanceRoutes-CT8b6LEZ.js +1 -0
- package/dist/assets/{Preview-CHNtDMAW.js → Preview-Cr2n9zp9.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-C4tVfsJt.js → QBOConnectionScreen-BLLJy6Ug.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-fl_RHS7J.js → ReimbursementApprovalRoutes-DX03V50m.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-C-svNJCY.js → ReimbursementApprovalRuleDetailScreen-y6N7Iuxh.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-D_O2yTEO.js → ReimbursementRoutes-50C6Ebhr.js} +1 -1
- package/dist/assets/{ReportsRoutes-DvldCkWE.js → ReportsRoutes-CPbwIPP-.js} +1 -1
- package/dist/assets/{RewardsRoutes-DUEA8SkB.js → RewardsRoutes-cADkol8X.js} +1 -1
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-Cx-76x6C.js → ScheduleDetailsPrepaidExpensesScreen-Bb90T06-.js} +5 -5
- package/dist/assets/{ScreenRoutes-v-i1WS06.js → ScreenRoutes-BOM6GDiC.js} +2 -2
- package/dist/assets/{SettingsRoutes-B8JbWE0A.js → SettingsRoutes-Dd8PYfpt.js} +6 -6
- package/dist/assets/{SetupPagesScreen-QcHSEVBO.js → SetupPagesScreen-BY0N32JD.js} +1 -1
- package/dist/assets/SignInScreen-DGgeSRO8.js +1 -0
- package/dist/assets/SignOutScreen-DPsA_-Qd.js +9 -0
- package/dist/assets/{TaskListScreen-C4glK-a5.js → TaskListScreen-yze1VNuP.js} +2 -2
- package/dist/assets/{TaskRoutes-Bm5_wmyb.js → TaskRoutes-B5s7sZXk.js} +2 -2
- package/dist/assets/{TransactionDetailRoutes-Dv09esw0.js → TransactionDetailRoutes-D5llvRhv.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-DvsztMnO.js → TransactionDetailScreen-CebcYk9B.js} +2 -2
- package/dist/assets/{TransactionListRoutes-B8IVQdNf.js → TransactionListRoutes-PnEvh6qc.js} +1 -1
- package/dist/assets/{TreasuryRoutes-CWptww3e.js → TreasuryRoutes-DbBm2doo.js} +4 -4
- package/dist/assets/{VendorsRoutes-BFk85yO0.js → VendorsRoutes-CQjAHjxC.js} +7 -7
- package/dist/assets/{WiseConfirmationScreen-Do34o9lu.js → WiseConfirmationScreen-d0_FJyyD.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-DLhkkoyT.js → ZeniAccountRoutes-CrROItmj.js} +8 -8
- package/dist/assets/{ZeniAccountStatementScreen-YKTGrgZ2.js → ZeniAccountStatementScreen-DiwM8zAQ.js} +1 -1
- package/dist/assets/{accountMappingHelper-DrXX0Mo9.js → accountMappingHelper-DHkHknqJ.js} +1 -1
- package/dist/assets/{analytics-Dt3suRsK.js → analytics-CabaUa1L.js} +1 -1
- package/dist/assets/{analyticsHelper-Cqab08I6.js → analyticsHelper-BOs1nNPv.js} +1 -1
- package/dist/assets/{core-BQjZS2e8.js → core-BQ6YlWys.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CIIlt5ol.js → decodeURIComponentSafe-D_MvDEMm.js} +1 -1
- package/dist/assets/{dnd-DccPQo-x.js → dnd-DL41lZFs.js} +1 -1
- package/dist/assets/{empty-DGN7Wz7m.js → empty-CmBSqEpE.js} +1 -1
- package/dist/assets/{empty-CmsHIcyu.js → empty-mwfdcHvm.js} +1 -1
- package/dist/assets/{emptyVideoElement-CEk87dLW.js → emptyVideoElement-BIOkPHF6.js} +1 -1
- package/dist/assets/{epic-Cqfxkt7p.js → epic-PdviWWJR.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-CTi3ttti.js → expenseAutomationHelper-Bn2j121J.js} +1 -1
- package/dist/assets/{getLocaleForTenant-DFe6xj72.js → getLocaleForTenant-jg4r2V28.js} +1 -1
- package/dist/assets/{index-But8NFor.js → index-B7zYAj-7.js} +1 -1
- package/dist/assets/{index-B2-Bbk9y.js → index-BNuLRh9K.js} +1 -1
- package/dist/assets/{index-hbfcGbz2.js → index-Bfsx1pdD.js} +1 -1
- package/dist/assets/{index-CbNzra9d.js → index-BiyVMPcR.js} +1 -1
- package/dist/assets/{index-CRxR6I-b.js → index-CamOdFyi.js} +1 -1
- package/dist/assets/{index-BkGKDMtv.js → index-DZBfE5XI.js} +3587 -3587
- package/dist/assets/{index-CZ1vtmNn.js → index-Deo5Hnb2.js} +1 -1
- package/dist/assets/{index-Bpok7EIX.js → index-Du1SP9oT.js} +2 -2
- package/dist/assets/{lexical-DQq5IX8L.js → lexical-BmxGnuDE.js} +1 -1
- package/dist/assets/{liveblocks-CueKZN6-.js → liveblocks-UAxYbctH.js} +1 -1
- package/dist/assets/{lottie-D6SetWLo.js → lottie-BPF4ysWw.js} +1 -1
- package/dist/assets/{mui-CQYR1UI4.js → mui-DYo6Z7Si.js} +1 -1
- package/dist/assets/{pathToGoBack-nfdDmjjO.js → pathToGoBack-CxX9ql3A.js} +1 -1
- package/dist/assets/{pdf-CqrelrTK.js → pdf-CHT1_0Mk.js} +3 -3
- package/dist/assets/{pdf-lib-CkerEMYe.js → pdf-lib-BMce44-8.js} +1 -1
- package/dist/assets/{plaid-Db_iti-b.js → plaid-BNcFec4W.js} +1 -1
- package/dist/assets/{pusher-DBCzLw-Z.js → pusher-C1AzfTgV.js} +1 -1
- package/dist/assets/{react-CT55RMnu.js → react-B13-Yejj.js} +1 -1
- package/dist/assets/{react-CQAnUX6b.js → react-BnffftLd.js} +1 -1
- package/dist/assets/{react-Bl0w5iM8.js → react-CSOME4pA.js} +1 -1
- package/dist/assets/{react-BazjfJbS.js → react-CT8AAIAI.js} +1 -1
- package/dist/assets/{react-Cg5Hbc0T.js → react-CjoLUzLz.js} +1 -1
- package/dist/assets/{react-H6VVspcR.js → react-DZjZzXEf.js} +1 -1
- package/dist/assets/{recharts-DNLEWX3j.js → recharts-VJtr9O-6.js} +1 -1
- package/dist/assets/{reportTimeframe-BsDWtESB.js → reportTimeframe-D2vFkQK6.js} +1 -1
- package/dist/assets/{routePaths-CiV55sI1.js → routePaths-CaZTJQOM.js} +1 -1
- package/dist/assets/{sentry-uvO3Tp8f.js → sentry-CQfqw6mU.js} +1 -1
- package/dist/assets/{stripSplatSuffix-C6Dmp1Fj.js → stripSplatSuffix-TzoGXcwz.js} +1 -1
- package/dist/assets/{url-CR4W537l.js → url-OL55dppf.js} +1 -1
- package/dist/assets/{url-BRJzriUX.js → url-dVvWrnA9.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-DY4J4jvo.js → useActualMatchingMatchDetail-DglThU_y.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-U0l3bFxn.js → useAiCfoDashboardSuggestedQuestionsChips-B4OxQoVy.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-DV6iNvbF.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-Ba7ulirt.js → useChargeCardPusherEvents-Gp7Qmy_v.js} +1 -1
- package/dist/assets/{useDeviceId-CgZjgOTE.js → useDeviceId-B6KB8W5T.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BMjAwZWL.js → useEmailConnectResultRefresh-DJgvOf06.js} +1 -1
- package/dist/assets/{useEnsureVendorListLoaded-BSdY2ycY.js → useEnsureVendorListLoaded-BbjOUcqm.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-E--3OsRP.js → useInitialThreadRequest-BpNcTGLt.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-DzHDJDg5.js → useTaskManagerAccess-CP331xWN.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-BKgeoe5K.js → useTaskManagerPusherEvents-BmjCwNse.js} +1 -1
- package/dist/assets/{utils-BUB23Z37.js → utils-BpLD-La5.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-D8qNv0pH.js → withTransactionSidePanel-7NlWHlVm.js} +1 -1
- package/dist/assets/{zeni-epic-state-DNah8dni.js → zeni-epic-state-j9Po26Lg.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/AddressRoutes-BTMFaoPH.js +0 -1
- package/dist/assets/AddressScreen-CS8bv4zo.js +0 -9
- package/dist/assets/AiCfoScreen-CLNLnVZu.js +0 -22
- package/dist/assets/BusinessVerificationPageScreen-ByDASFk9.js +0 -9
- package/dist/assets/ConnectionAuthScreen-DVi6hxMj.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-cEY6ZjCp.js +0 -1
- package/dist/assets/FeaturePreviewScreen-e7I8ExNO.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CU5AUU74.js +0 -1
- package/dist/assets/MagicLinkSignInScreen-BRRvS_-g.js +0 -12
- package/dist/assets/NotFoundScreen-Da0kpRnr.js +0 -1
- package/dist/assets/PerformanceRoutes-4RVlZlPh.js +0 -1
- package/dist/assets/SignInScreen-6YsvQGsU.js +0 -1
- package/dist/assets/SignOutScreen-50K2PKll.js +0 -9
- package/dist/assets/useAskAiCfoHostNavButtonProps-Ds1IYXBl.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-CueKZN6-.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Je,s as _t,l as Pe,t as _n,n as os,o as ne}from"./core-BQjZS2e8.js";import{fV as Dt,Ze as cs,g5 as Pt,br as Fe,Zf as is,Zg as ds,fK as hn,Zh as Dn,fT as Pn,Zi as wn,Zj as Tn,Zk as vn,Zl as Fn,fU as xn,g4 as Ln,Zm as Bn,Zn as ls,f_ as us,fZ as ms,Zo as Cs,KK as Rn,g7 as ia,Zp as ps,Zq as hs,fM as fs,fL as gs,gk as ze,g0 as On,f$ as Un,Zr as bs,g1 as Ss,Kg as ys,Kf as Is,Kj as ks,Kl as Es,gd as As,fH as jn,Zs as _s,Zt as Ds,gi as Mn,Zu as Ps,gj as St,Kr as ws,Ko as Ts,fI as ge,Zv as Wa,ep as xe,d2 as Le,eq as Be,h2 as da,cs as la,Zw as ua,Zx as wt,Dt as Za,mi as Ga,Zy as $a,K_ as Ia,g8 as Qe,L0 as Tt,m8 as Nn,Zz as ma,KO as _a,ZA as vs,ZB as Fs,KR as qa,ZC as xs,ZD as Qa,g3 as Vn,KX as ga,iB as Ls,ZE as Hn,fW as Ca,bv as Bs,ZF as Rs,gJ as Ja,gI as Xa,Lu as Os,gH as et,ZG as Zn,cl as Gn,eb as Us,ZH as Pa,M3 as $n,ZI as fn,LF as Da,ZJ as Kn,M4 as js,Yg as Ms,M5 as Ns,Nd as Vs,CJ as Hs,N7 as Zs,ZK as Gs,K$ as oa,ZL as $s,ZM as Ks,ZN as zs,ZO as Ys,ZP as Ws,ZQ as vt,ZR as qs,Lf as zn,L8 as Qs,ZS as Js,h4 as Xs,ZT as Yn,Lo as Wn,Ls as qn,h3 as eo,ZU as ao,LR as Qn,ZV as to,ZW as no,ZX as ro,Lq as Jn,Lb as Xn,KU as er,Lk as ar,Li as tr,Lm as so,ZY as nr,ZZ as oo,gf as co,gg as io,gh as lo,Z_ as at,g9 as rr,ed as Ft,Z$ as uo,_0 as mo,_1 as Co,_2 as po,LA as yt,LY as ho,LU as fo,Lw as go,LW as bo,LM as So,LO as yo,_3 as sr,M2 as Ha,T8 as Io,_4 as ko,_5 as Eo,_6 as Ao,_7 as or,_8 as _o,Mp as Do,LE as cr,Lz as Ne,LD as Po,_9 as wo,_a as To,KL as vo,_b as ir,g2 as dr,_c as Fo,KN as xo,KM as gn,_d as Lo,_e as Bo,_f as Ro,_g as Oo,_h as xt,_i as Uo,xJ as lr,mS as jo,ir as Mo,Mu as No,_j as ur,fQ as Vo,fR as Ho,_k as Zo,dA as Go,g6 as $o,Mk as Ko,Me as qe,bp as zo,bJ as Yo,cx as Wo,bK as qo,ha as Qo}from"./zeni-epic-state-DNah8dni.js";import{V as Re,bs as mr,a5 as we,bt as Cr,bu as pr,bv as Jo,G as aa,al as Lt,bw as Xo,bx as ec,j as hr,a as fr,ar as gr,v as Ee,p as de,b as q,s as Sa,by as br,bz as ac,bA as tc,z as te,a8 as wa,bB as tt,bC as nc,bD as rc,bE as sc,a2 as Ta,au as Xe,aT as Bt,bF as oc,ac as va,_ as nt,e as ee,w as rt,bG as cc,bH as ba,bI as It,bJ as ic,a9 as Rt,bK as dc,af as Sr,aj as kt,bL as lc,aC as yr,L as Ir,U as kr,aB as uc,bM as mc,bN as Cc,bO as pc,bP as hc,bQ as fc,bR as gc,R as Ka,bS as bc,bT as Sc,x as pt,k as yc,bU as Ic,bV as kc,bW as Ec,az as Ac,bX as _c,bY as Dc,i as Pc}from"./index-BkGKDMtv.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-CQYR1UI4.js";import{a as r}from"./sentry-uvO3Tp8f.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-Ds1IYXBl.js";import{M as Ae}from"./MobileAppDrawer-BUD0j7G2.js";import{d as Ut}from"./recharts-DNLEWX3j.js";import{g as De,a as xa,b as Ar,c as Oe,d as Ue,e as ea,f as ta,h as na,A as Tc,i as jt,P as vc,j as Mt,s as ya,k as _r,l as ca,m as Dr,n as Fc,o as Pr,p as xc,S as bn}from"./SetupPagesScreen-QcHSEVBO.js";import{u as wr}from"./useInitialThreadRequest-E--3OsRP.js";import st from"./NotFoundScreen-Da0kpRnr.js";import{u as Nt}from"./useChargeCardPusherEvents-Ba7ulirt.js";import{n as Sn}from"./utils-BUB23Z37.js";import{t as Lc}from"./AddressScreen-CS8bv4zo.js";import"./analytics-Dt3suRsK.js";import"./plaid-Db_iti-b.js";import"./dnd-DccPQo-x.js";import"./stripe-cKAAJElX.js";import"./lottie-D6SetWLo.js";import"./lexical-DQq5IX8L.js";import"./pdf-CqrelrTK.js";import"./InboxNotificationsProvider-BGgv9Z5e.js";import"./useTaskManagerAccess-DzHDJDg5.js";import"./BusinessVerificationPageScreen-ByDASFk9.js";import"./routePaths-CiV55sI1.js";import"./analyticsHelper-Cqab08I6.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b0771d16-cd37-463e-a04b-0c1bc570ab66",e._sentryDebugIdIdentifier="sentry-dbid-b0771d16-cd37-463e-a04b-0c1bc570ab66")}catch{}})();const Bc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Bc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=le(),a=d((t=>Dt(t.cardPolicyState))),n=d((t=>cs(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(Pt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:yn}}}=aa.getLocalizedStrings(),Rc=e=>On(e,!1),Oc=e=>Un(e.name,!1);function Uc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((P=>{m(P)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:l,onAskAiCfoClick:B}=Fa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(is()),t(ds()),t(hn())}),[t]);const _=d((P=>Dn(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>Tn(P.cardPolicyState))),S=d((P=>vn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>Dt(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{_!=="Completed"&&_!=="In-Progress"&&t(Ln())}),[t,_]),vr();const k=d((P=>Bn(P.createCardPolicyState))),V=d((P=>ls(P.createCardPolicyState))),w=d((P=>us(P.cardPolicyState))),y=d((P=>ms(P.cardPolicyState))),F=d((P=>Cs(P.createCardPolicyState))),i=d((P=>Rn(P)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const g=r.useMemo((()=>C.map(Rc)),[C]),R=r.useMemo((()=>p.map(Oc)),[p]),Z=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(Tr)),[i.cards]),M=_==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:Z,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,Z,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const K=r.useCallback((P=>{L(P)}),[L]),j=k.fetchState,h=n!=null?`/${n}/cards/policy`:"..",H=r.useCallback((()=>{const P=we(a.state?.pathnameStackToGoBack),ae=P.poppedPathname??h;e(ae,{state:{pathnameStackToGoBack:P.newStack}})}),[a.state,e,h]),z=r.useCallback((()=>{e(h)}),[e,h]),D=r.useCallback((P=>{t(hs(P))}),[t]),W=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),G=r.useCallback((()=>{t(hn())}),[t]),v=r.useRef(j);r.useEffect((()=>{const P=v.current;v.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const T=j==="Error"?k.error?.message??yn.createPolicyGenericErrorMessage:void 0;return f&&n!=null?F==null?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:yn.createPageTitle,onBackClick:H,onClickMenuIcon:u,isAiCfoAccessEnabled:l,onAskAiCfoClick:B})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Jo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:K,submitState:j,submitErrorMessage:T,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:z,onClickMenuIcon:u,onFormChange:D,onSubmit:W,onUploadDocument:N,onRemoveDocument:G})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jc}}}=aa.getLocalizedStrings(),Mc=e=>On(e,!1),Nc=e=>Un(e.name,!1);function Vc(){const e=ie(),a=me(),{tenantEmailDomain:n,templateId:t}=Ve(),s=le(),f=Re(),b=Fe(f?.loggedInUserRoleMap),[m,A]=r.useState(!1),u=r.useCallback((T=>{A(T)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:_}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((T=>bs(T))),O=d((T=>Dn(T.cardPolicyState))),U=d((T=>Pn(T.cardPolicyState))),S=d((T=>wn(T.cardPolicyState))),c=d((T=>Tn(T.cardPolicyState))),p=d((T=>vn(T.cardPolicyState))),x=d((T=>Fn(T.cardPolicyState))),E=d((T=>xn(T.cardPolicyState))),I=d((T=>Dt(T.cardPolicyState))),k=d((T=>Rn(T))),V=d((T=>t!=null?Ss(T.cardPolicyState,t):void 0)),w=r.useMemo((()=>C.templateId===t&&C.formDraft!=null?C.formDraft:V!=null?ys(V):void 0),[C.templateId,C.formDraft,V,t]);r.useEffect((()=>{if(t==null)return;const T=C.detailFetchState.fetchState;C.templateId===t&&(T==="Completed"||T==="In-Progress")||V!=null||s(Is(t))}),[s,t,C.templateId,C.detailFetchState.fetchState,V]),r.useEffect((()=>{O!=="Completed"&&O!=="In-Progress"&&s(Ln())}),[s,O]),vr();const y=d((T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const F=r.useMemo((()=>U.map(Mc)),[U]),i=r.useMemo((()=>E.map(Nc)),[E]),g=r.useMemo((()=>k.cards.filter((T=>!mr(T.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Xo({draft:w,cardRows:g,categorySearchOptions:F,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:c,suggestedAllowCategories:p,suggestedBlockCategories:x})}),[w,g,F,i,y,S,c,p,x]),[Z,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||Z!=null||R==null||(L.current=!0,M(R))}),[Z,R]);const K=r.useCallback((T=>{M(T)}),[]),j=r.useMemo((()=>Ut((T=>{s(Pt(T))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((T=>{j(T)}),[j]),H=C.updateFetchState.fetchState,z=n!=null?`/${n}/cards/policy`:"..",D=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??z;e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e,z]),W=r.useCallback((()=>{e(z)}),[e,z]),N=r.useCallback((T=>{if(t==null)return;const P=Cr(T);s(ks(P)),s(Es(t))}),[s,t]),G=r.useRef(H);r.useEffect((()=>{const T=G.current;G.current=H,H==="Completed"&&T!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(z))}),[s,H,e,z]);const v=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):Z!=null&&O==="Completed"&&k.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(ec,{templateName:C.template?.name??"",formDraft:Z,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:v,isAiCfoAccessEnabled:B,onAskAiCfoClick:_,onBackClick:D,onCancelClick:W,onClickMenuIcon:l,onFormChange:K,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:D,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:_})]})}function Fr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function xr(e){return d((a=>e==null||e===""?{chips:ht,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ht:ht,isResolved:s}})(As(a,e))),_t)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Zc,pageTitle:Gc}}}}=aa.getLocalizedStrings(),$c=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Kc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((h=>{m(h)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:l}=de(),{isFeatureEnabled:B}=l(q.isAiCfoFileUploadEnabled),{isFeatureEnabled:_}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>_s(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>Ds(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),_t),x=S.fetchState==="In-Progress"?Math.max(p.length,1):0,E=d((h=>Ps(h.createCardPolicyState))),I=Sa(S.fetchState);r.useEffect((()=>{if(I==="In-Progress"&&S.fetchState==="Completed"&&c!=null)p.forEach((h=>{t(St({chatSessionId:c,id:h.id,entityIds:E,kind:"created_policy"}))}));else if(I==="In-Progress"&&S.fetchState==="Error"&&c!=null){p.forEach((H=>{t(St({chatSessionId:c,id:H.id,kind:"errored_policy"}))}));const h=S.error?.message!=null&&S.error.message.length>0?S.error.message:aa.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map($c)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:z,isFileUploadEnabled:D}=h,W=ie(),N=me(),{tenantEmailDomain:G}=Ve(),{isAiCfoOpen:v,setIsAiCfoOpen:T}=hr(),P=fr(),ae=gr(),Ce=d((Q=>jn(Q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Te}=xr("card_policy"),Ie=r.useMemo((()=>Fr(X,Te,3)),[X,Te]),[re,be]=r.useState(""),pe=ae&&P&&G!=null&&!v,he=r.useCallback((Q=>{if(G==null)return;const Ze=Ee(N.state?.pathnameStackToGoBack,N.pathname);W(`/${G}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ze,referrer:"card_policy_hero",aiCfoInitialQuestion:Q,aiCfoShouldSubmit:Q!=null&&Q.trim().length>0}})}),[N.pathname,N.state,W,G]),oe=r.useCallback((Q=>{Q.trim().length!==0&&(be(""),he(Q))}),[he]),J=r.useCallback((()=>{const Q=re.trim();Q.length!==0&&(be(""),he(Q))}),[re,he]),Se=r.useCallback((()=>{}),[]),_e=r.useCallback((Q=>{be(Q)}),[]),fe=r.useCallback((()=>{T(!0)}),[T]),ve=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&z)return{aiAgentName:Gc,headline:Hc,subheadline:Zc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:D,onInputChange:_e,onSubmit:J,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:ve,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,z,D,Ce,_e,ve,fe,oe,Se,J,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=_&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,Z=r.useCallback((()=>{const h=we(a.state?.pathnameStackToGoBack),H=h.poppedPathname??"..";e(H,{state:{pathnameStackToGoBack:h.newStack}})}),[a.state,e]),M=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),L=r.useCallback((h=>{n!=null&&e(`/${n}/cards/policy/${h}/edit`)}),[e,n]),K=r.useCallback((h=>{t(Ts(h))}),[t]),j=U.fetchState.fetchState;return!F&&j!=="Completed"&&j!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(ac,{onBackClick:Z,onNewPolicyClick:M,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:O})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{policies:y,archivingTemplateId:U.archiveTargetTemplateId,pendingCreationCount:x,onBackClick:Z,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:K,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function zc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((X=>ge(X))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((X=>Wa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:_}=m(q.isChargeCardFeatureEnabled),C=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=m(q.isDebitCardFeatureEnabled),U=xe(s),S=Le(s),c=Be(O,s),p=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:c}),E=Ue({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:_,isBookKeepingTenant:S,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:p}),I=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=d((X=>da(X,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((X=>ua(X))),F=d((X=>X.classListState.fetchState)),i=!B&&E&&C,g=d((X=>wt(X,a,i,E))),[R,Z]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,K=d((X=>L!=null?Za(X.userRoleState,L):void 0)),j=K?.accountingClassIDs[0],h=d((X=>j!=null?Ga(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,z=d((X=>H!=null?Za(X.userRoleState,H):void 0)),D=z?.accountingClassIDs[0],W=d((X=>D!=null?Ga(X.classState,{classId:D,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",G=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n($a()),G&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,G]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(Z(!0),n(Ia(a,i,!1)))}),[R,g,a,n]),r.useEffect((()=>{if(g.fetchState==="Completed"&&(N===!1||N&&M?.status?.code!=="active"||M?.cardHolderUserId!==t.userId||l===!1&&A===!1||M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card")){const X=De(s.tenantEmailDomain,a,t,M,l);e(X)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(Tt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const v=()=>{if(t!=null&&a!=null){n($a());const X=De(s.tenantEmailDomain,a,t);e(X)}},T=M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card",P=ea(E,x,I,C),ae=xa(E,C,b,w,y),Ce=Ar(T,g);return g.fetchState!=="Completed"?o.jsx(wa,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{showConfetti:l}),o.jsx(nc,{onGotItClick:v,isDebitCard:M?.type.code==="business_physical_debit_card",controllerEmails:V,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:C,productInformation:P,creditAccountInformation:ae,debitAccountInformation:Ce,chargeCardDetailView:g,creditAccount:w,classListFetchState:F,creditAccountRepayment:y,cardIssuedByRoles:K?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:z?.userRoles,cardHolderDepartmentName:W?.className})]})}const Lr="charge-card-transaction-update",Br="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",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",Zt="charge-card-limit-reset",Gt="charge-card-renamed",Yc="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ba="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Wc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(vs({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Qc(){const e=ie(),a=le(),n=me(),t=te.getSignedInUser(),s=d((_=>ge(_))),[f,b]=r.useState(!1),m=d((_=>ma(_))),A=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),u=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),C=_.poppedPathname??Jc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:_.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Wc),onEvent:_=>{switch(_){case Ba:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(_a()))}),[f,m,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const B=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||B?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?o.jsx(st,{}):o.jsx(qc,{onBackClick:u,initialOpenThreadRequest:A}):o.jsx(rc,{onBackClick:u})}const Jc=e=>`/${e}/cards`,Xc={containerWidth:new va(100,58)},ei=({appContent:e})=>{const a=Ta(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,_]=r.useState(!1),[C,O]=r.useState(!1),U=te.getSignedInUser();if(U==null)throw Error("Can't access onboarding card page without signing in...");const S=d((W=>ge(W)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((W=>Fs(W,s))),E=x.chargeCard,I=d((W=>W.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),Z=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:Z,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),K=!g&&L&&i;r.useEffect((()=>{m===!1&&I!=="In-Progress"&&I!=="Completed"&&(n(qa()),A(!0)),u===!1&&x.fetchState==="Not-Started"&&(l(!0),n(Ia(s,K,L)))}),[u,x.fetchState,m,I]);const j=E?.type.code==="business_physical_credit_card"||E?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(x.fetchState==="Completed"){if(B===!1&&(j===!1||j&&E?.status?.code!=="inactive"||E?.cardHolderUserId!==U.userId)){const W=De(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(W,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const W=De(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Qa()),t(W,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((W=>Vn(W.userState,U.userId))),z=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((W=>W.statusCode==="success"))===!0&&B===!1&&(setTimeout(z,3e3),_(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const D=W=>{O(W)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:D}),o.jsx(ai,{cardId:s,card:E,shippingAddressId:E.shippingAddressId,phone:H.phone,signedInUser:U,isSandboxEnv:Bt(),chargeCardDetailState:x,signedInUserToken:h,navigate:t,currentTenant:S,location:f,maxChargeCardActivationAttempts:p[s]!=null?p[s]:c.default_max_charge_card_activation_attempts!=null?c.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:c.charge_card_cashback_rate_per_transaction!=null?c.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{D(!0)}}),e!=null?o.jsx(ti,{windowSize:a,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const f=Ls(e.addressState,n);if(f==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),m=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const l=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Bs())||l,showMenuIcon:u,shippingAddress:f,vgsVaultId:nt.cardVaultId,twoFAView:b,activationWaitStatus:m,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:f,chargeCardDetailState:b}=a,m=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=f;return{onGetOtp:u=>{m!=null&&e(et(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Os(t,u))},onResendOtp:u=>{m!=null&&e(Xa(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Ja(u,l,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),l=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?na(A):u.poppedPathname;n(l,{state:{pathnameStackToGoBack:u.newStack}})}}}))(oc),ti=He.div`
|
|
1
|
+
import{j as o}from"./liveblocks-UAxYbctH.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Je,s as _t,l as Pe,t as _n,n as os,o as ne}from"./core-BQ6YlWys.js";import{fV as Dt,Ze as cs,g5 as Pt,br as Fe,Zf as is,Zg as ds,fK as hn,Zh as Dn,fT as Pn,Zi as wn,Zj as Tn,Zk as vn,Zl as Fn,fU as xn,g4 as Ln,Zm as Bn,Zn as ls,f_ as us,fZ as ms,Zo as Cs,KK as Rn,g7 as ia,Zp as ps,Zq as hs,fM as fs,fL as gs,gk as ze,g0 as On,f$ as Un,Zr as bs,g1 as Ss,Kg as ys,Kf as Is,Kj as ks,Kl as Es,gd as As,fH as jn,Zs as _s,Zt as Ds,gi as Mn,Zu as Ps,gj as St,Kr as ws,Ko as Ts,fI as ge,Zv as Wa,ep as xe,d2 as Le,eq as Be,h2 as da,cs as la,Zw as ua,Zx as wt,Dt as Za,mi as Ga,Zy as $a,K_ as Ia,g8 as Qe,L0 as Tt,m8 as Nn,Zz as ma,KO as _a,ZA as vs,ZB as Fs,KR as qa,ZC as xs,ZD as Qa,g3 as Vn,KX as ga,iB as Ls,ZE as Hn,fW as Ca,bv as Bs,ZF as Rs,gJ as Ja,gI as Xa,Lu as Os,gH as et,ZG as Zn,cl as Gn,eb as Us,ZH as Pa,M3 as $n,ZI as fn,LF as Da,ZJ as Kn,M4 as js,Yg as Ms,M5 as Ns,Nd as Vs,CJ as Hs,N7 as Zs,ZK as Gs,K$ as oa,ZL as $s,ZM as Ks,ZN as zs,ZO as Ys,ZP as Ws,ZQ as vt,ZR as qs,Lf as zn,L8 as Qs,ZS as Js,h4 as Xs,ZT as Yn,Lo as Wn,Ls as qn,h3 as eo,ZU as ao,LR as Qn,ZV as to,ZW as no,ZX as ro,Lq as Jn,Lb as Xn,KU as er,Lk as ar,Li as tr,Lm as so,ZY as nr,ZZ as oo,gf as co,gg as io,gh as lo,Z_ as at,g9 as rr,ed as Ft,Z$ as uo,_0 as mo,_1 as Co,_2 as po,LA as yt,LY as ho,LU as fo,Lw as go,LW as bo,LM as So,LO as yo,_3 as sr,M2 as Ha,T8 as Io,_4 as ko,_5 as Eo,_6 as Ao,_7 as or,_8 as _o,Mp as Do,LE as cr,Lz as Ne,LD as Po,_9 as wo,_a as To,KL as vo,_b as ir,g2 as dr,_c as Fo,KN as xo,KM as gn,_d as Lo,_e as Bo,_f as Ro,_g as Oo,_h as xt,_i as Uo,xJ as lr,mS as jo,ir as Mo,Mu as No,_j as ur,fQ as Vo,fR as Ho,_k as Zo,dA as Go,g6 as $o,Mk as Ko,Me as qe,bp as zo,bJ as Yo,cx as Wo,bK as qo,ha as Qo}from"./zeni-epic-state-j9Po26Lg.js";import{V as Re,bs as mr,a5 as we,bt as Cr,bu as pr,bv as Jo,G as aa,al as Lt,bw as Xo,bx as ec,h as hr,a as fr,ar as gr,s as Ee,p as de,N as q,q as Sa,by as br,bz as ac,bA as tc,z as te,a8 as wa,bB as tt,bC as nc,bD as rc,bE as sc,a2 as Ta,au as Xe,aT as Bt,bF as oc,ac as va,_ as nt,d as ee,w as rt,bG as cc,bH as ba,bI as It,bJ as ic,a9 as Rt,bK as dc,af as Sr,aj as kt,bL as lc,aC as yr,L as Ir,U as kr,aB as uc,bM as mc,bN as Cc,bO as pc,bP as hc,bQ as fc,bR as gc,R as Ka,bS as bc,bT as Sc,v as pt,j as yc,bU as Ic,bV as kc,bW as Ec,az as Ac,bX as _c,bY as Dc,i as Pc}from"./index-DZBfE5XI.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-DYo6Z7Si.js";import{a as r}from"./sentry-CQfqw6mU.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-DV6iNvbF.js";import{M as Ae}from"./MobileAppDrawer-DTqKEh3f.js";import{d as Ut}from"./recharts-VJtr9O-6.js";import{g as De,a as xa,b as Ar,c as Oe,d as Ue,e as ea,f as ta,h as na,A as Tc,i as jt,P as vc,j as Mt,s as ya,k as _r,l as ca,m as Dr,n as Fc,o as Pr,p as xc,S as bn}from"./SetupPagesScreen-BY0N32JD.js";import{u as wr}from"./useInitialThreadRequest-BpNcTGLt.js";import st from"./NotFoundScreen-CY-XFa3a.js";import{u as Nt}from"./useChargeCardPusherEvents-Gp7Qmy_v.js";import{n as Sn}from"./utils-BpLD-La5.js";import{t as Lc}from"./AddressScreen-CxRV-hrD.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./InboxNotificationsProvider-Daf1RQwd.js";import"./useTaskManagerAccess-CP331xWN.js";import"./BusinessVerificationPageScreen-DaAqJAwC.js";import"./routePaths-CaZTJQOM.js";import"./analyticsHelper-BOs1nNPv.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="7f2adb77-d269-4179-925a-b470601b96bb",e._sentryDebugIdIdentifier="sentry-dbid-7f2adb77-d269-4179-925a-b470601b96bb")}catch{}})();const Bc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Bc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=le(),a=d((t=>Dt(t.cardPolicyState))),n=d((t=>cs(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(Pt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:yn}}}=aa.getLocalizedStrings(),Rc=e=>On(e,!1),Oc=e=>Un(e.name,!1);function Uc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((P=>{m(P)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:l,onAskAiCfoClick:B}=Fa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(is()),t(ds()),t(hn())}),[t]);const _=d((P=>Dn(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>Tn(P.cardPolicyState))),S=d((P=>vn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>Dt(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{_!=="Completed"&&_!=="In-Progress"&&t(Ln())}),[t,_]),vr();const k=d((P=>Bn(P.createCardPolicyState))),V=d((P=>ls(P.createCardPolicyState))),w=d((P=>us(P.cardPolicyState))),y=d((P=>ms(P.cardPolicyState))),F=d((P=>Cs(P.createCardPolicyState))),i=d((P=>Rn(P)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const g=r.useMemo((()=>C.map(Rc)),[C]),R=r.useMemo((()=>p.map(Oc)),[p]),Z=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(Tr)),[i.cards]),M=_==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:Z,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,Z,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const K=r.useCallback((P=>{L(P)}),[L]),j=k.fetchState,h=n!=null?`/${n}/cards/policy`:"..",H=r.useCallback((()=>{const P=we(a.state?.pathnameStackToGoBack),ae=P.poppedPathname??h;e(ae,{state:{pathnameStackToGoBack:P.newStack}})}),[a.state,e,h]),z=r.useCallback((()=>{e(h)}),[e,h]),D=r.useCallback((P=>{t(hs(P))}),[t]),W=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),G=r.useCallback((()=>{t(hn())}),[t]),v=r.useRef(j);r.useEffect((()=>{const P=v.current;v.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const T=j==="Error"?k.error?.message??yn.createPolicyGenericErrorMessage:void 0;return f&&n!=null?F==null?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:yn.createPageTitle,onBackClick:H,onClickMenuIcon:u,isAiCfoAccessEnabled:l,onAskAiCfoClick:B})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Jo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:K,submitState:j,submitErrorMessage:T,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:z,onClickMenuIcon:u,onFormChange:D,onSubmit:W,onUploadDocument:N,onRemoveDocument:G})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jc}}}=aa.getLocalizedStrings(),Mc=e=>On(e,!1),Nc=e=>Un(e.name,!1);function Vc(){const e=ie(),a=me(),{tenantEmailDomain:n,templateId:t}=Ve(),s=le(),f=Re(),b=Fe(f?.loggedInUserRoleMap),[m,A]=r.useState(!1),u=r.useCallback((T=>{A(T)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:_}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((T=>bs(T))),O=d((T=>Dn(T.cardPolicyState))),U=d((T=>Pn(T.cardPolicyState))),S=d((T=>wn(T.cardPolicyState))),c=d((T=>Tn(T.cardPolicyState))),p=d((T=>vn(T.cardPolicyState))),x=d((T=>Fn(T.cardPolicyState))),E=d((T=>xn(T.cardPolicyState))),I=d((T=>Dt(T.cardPolicyState))),k=d((T=>Rn(T))),V=d((T=>t!=null?Ss(T.cardPolicyState,t):void 0)),w=r.useMemo((()=>C.templateId===t&&C.formDraft!=null?C.formDraft:V!=null?ys(V):void 0),[C.templateId,C.formDraft,V,t]);r.useEffect((()=>{if(t==null)return;const T=C.detailFetchState.fetchState;C.templateId===t&&(T==="Completed"||T==="In-Progress")||V!=null||s(Is(t))}),[s,t,C.templateId,C.detailFetchState.fetchState,V]),r.useEffect((()=>{O!=="Completed"&&O!=="In-Progress"&&s(Ln())}),[s,O]),vr();const y=d((T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const F=r.useMemo((()=>U.map(Mc)),[U]),i=r.useMemo((()=>E.map(Nc)),[E]),g=r.useMemo((()=>k.cards.filter((T=>!mr(T.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Xo({draft:w,cardRows:g,categorySearchOptions:F,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:c,suggestedAllowCategories:p,suggestedBlockCategories:x})}),[w,g,F,i,y,S,c,p,x]),[Z,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||Z!=null||R==null||(L.current=!0,M(R))}),[Z,R]);const K=r.useCallback((T=>{M(T)}),[]),j=r.useMemo((()=>Ut((T=>{s(Pt(T))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((T=>{j(T)}),[j]),H=C.updateFetchState.fetchState,z=n!=null?`/${n}/cards/policy`:"..",D=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??z;e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e,z]),W=r.useCallback((()=>{e(z)}),[e,z]),N=r.useCallback((T=>{if(t==null)return;const P=Cr(T);s(ks(P)),s(Es(t))}),[s,t]),G=r.useRef(H);r.useEffect((()=>{const T=G.current;G.current=H,H==="Completed"&&T!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(z))}),[s,H,e,z]);const v=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):Z!=null&&O==="Completed"&&k.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(ec,{templateName:C.template?.name??"",formDraft:Z,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:v,isAiCfoAccessEnabled:B,onAskAiCfoClick:_,onBackClick:D,onCancelClick:W,onClickMenuIcon:l,onFormChange:K,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:D,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:_})]})}function Fr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function xr(e){return d((a=>e==null||e===""?{chips:ht,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ht:ht,isResolved:s}})(As(a,e))),_t)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Zc,pageTitle:Gc}}}}=aa.getLocalizedStrings(),$c=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Kc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((h=>{m(h)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:l}=de(),{isFeatureEnabled:B}=l(q.isAiCfoFileUploadEnabled),{isFeatureEnabled:_}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>_s(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>Ds(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),_t),x=S.fetchState==="In-Progress"?Math.max(p.length,1):0,E=d((h=>Ps(h.createCardPolicyState))),I=Sa(S.fetchState);r.useEffect((()=>{if(I==="In-Progress"&&S.fetchState==="Completed"&&c!=null)p.forEach((h=>{t(St({chatSessionId:c,id:h.id,entityIds:E,kind:"created_policy"}))}));else if(I==="In-Progress"&&S.fetchState==="Error"&&c!=null){p.forEach((H=>{t(St({chatSessionId:c,id:H.id,kind:"errored_policy"}))}));const h=S.error?.message!=null&&S.error.message.length>0?S.error.message:aa.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map($c)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:z,isFileUploadEnabled:D}=h,W=ie(),N=me(),{tenantEmailDomain:G}=Ve(),{isAiCfoOpen:v,setIsAiCfoOpen:T}=hr(),P=fr(),ae=gr(),Ce=d((Q=>jn(Q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Te}=xr("card_policy"),Ie=r.useMemo((()=>Fr(X,Te,3)),[X,Te]),[re,be]=r.useState(""),pe=ae&&P&&G!=null&&!v,he=r.useCallback((Q=>{if(G==null)return;const Ze=Ee(N.state?.pathnameStackToGoBack,N.pathname);W(`/${G}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ze,referrer:"card_policy_hero",aiCfoInitialQuestion:Q,aiCfoShouldSubmit:Q!=null&&Q.trim().length>0}})}),[N.pathname,N.state,W,G]),oe=r.useCallback((Q=>{Q.trim().length!==0&&(be(""),he(Q))}),[he]),J=r.useCallback((()=>{const Q=re.trim();Q.length!==0&&(be(""),he(Q))}),[re,he]),Se=r.useCallback((()=>{}),[]),_e=r.useCallback((Q=>{be(Q)}),[]),fe=r.useCallback((()=>{T(!0)}),[T]),ve=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&z)return{aiAgentName:Gc,headline:Hc,subheadline:Zc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:D,onInputChange:_e,onSubmit:J,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:ve,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,z,D,Ce,_e,ve,fe,oe,Se,J,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=_&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,Z=r.useCallback((()=>{const h=we(a.state?.pathnameStackToGoBack),H=h.poppedPathname??"..";e(H,{state:{pathnameStackToGoBack:h.newStack}})}),[a.state,e]),M=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),L=r.useCallback((h=>{n!=null&&e(`/${n}/cards/policy/${h}/edit`)}),[e,n]),K=r.useCallback((h=>{t(Ts(h))}),[t]),j=U.fetchState.fetchState;return!F&&j!=="Completed"&&j!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(ac,{onBackClick:Z,onNewPolicyClick:M,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:O})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{policies:y,archivingTemplateId:U.archiveTargetTemplateId,pendingCreationCount:x,onBackClick:Z,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:K,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function zc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((X=>ge(X))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((X=>Wa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:_}=m(q.isChargeCardFeatureEnabled),C=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=m(q.isDebitCardFeatureEnabled),U=xe(s),S=Le(s),c=Be(O,s),p=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:c}),E=Ue({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:_,isBookKeepingTenant:S,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:p}),I=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=d((X=>da(X,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((X=>ua(X))),F=d((X=>X.classListState.fetchState)),i=!B&&E&&C,g=d((X=>wt(X,a,i,E))),[R,Z]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,K=d((X=>L!=null?Za(X.userRoleState,L):void 0)),j=K?.accountingClassIDs[0],h=d((X=>j!=null?Ga(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,z=d((X=>H!=null?Za(X.userRoleState,H):void 0)),D=z?.accountingClassIDs[0],W=d((X=>D!=null?Ga(X.classState,{classId:D,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",G=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n($a()),G&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,G]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(Z(!0),n(Ia(a,i,!1)))}),[R,g,a,n]),r.useEffect((()=>{if(g.fetchState==="Completed"&&(N===!1||N&&M?.status?.code!=="active"||M?.cardHolderUserId!==t.userId||l===!1&&A===!1||M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card")){const X=De(s.tenantEmailDomain,a,t,M,l);e(X)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(Tt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const v=()=>{if(t!=null&&a!=null){n($a());const X=De(s.tenantEmailDomain,a,t);e(X)}},T=M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card",P=ea(E,x,I,C),ae=xa(E,C,b,w,y),Ce=Ar(T,g);return g.fetchState!=="Completed"?o.jsx(wa,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{showConfetti:l}),o.jsx(nc,{onGotItClick:v,isDebitCard:M?.type.code==="business_physical_debit_card",controllerEmails:V,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:C,productInformation:P,creditAccountInformation:ae,debitAccountInformation:Ce,chargeCardDetailView:g,creditAccount:w,classListFetchState:F,creditAccountRepayment:y,cardIssuedByRoles:K?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:z?.userRoles,cardHolderDepartmentName:W?.className})]})}const Lr="charge-card-transaction-update",Br="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",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",Zt="charge-card-limit-reset",Gt="charge-card-renamed",Yc="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ba="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Wc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(vs({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Qc(){const e=ie(),a=le(),n=me(),t=te.getSignedInUser(),s=d((_=>ge(_))),[f,b]=r.useState(!1),m=d((_=>ma(_))),A=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),u=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),C=_.poppedPathname??Jc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:_.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Wc),onEvent:_=>{switch(_){case Ba:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(_a()))}),[f,m,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const B=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||B?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?o.jsx(st,{}):o.jsx(qc,{onBackClick:u,initialOpenThreadRequest:A}):o.jsx(rc,{onBackClick:u})}const Jc=e=>`/${e}/cards`,Xc={containerWidth:new va(100,58)},ei=({appContent:e})=>{const a=Ta(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,_]=r.useState(!1),[C,O]=r.useState(!1),U=te.getSignedInUser();if(U==null)throw Error("Can't access onboarding card page without signing in...");const S=d((W=>ge(W)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((W=>Fs(W,s))),E=x.chargeCard,I=d((W=>W.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),Z=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:Z,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),K=!g&&L&&i;r.useEffect((()=>{m===!1&&I!=="In-Progress"&&I!=="Completed"&&(n(qa()),A(!0)),u===!1&&x.fetchState==="Not-Started"&&(l(!0),n(Ia(s,K,L)))}),[u,x.fetchState,m,I]);const j=E?.type.code==="business_physical_credit_card"||E?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(x.fetchState==="Completed"){if(B===!1&&(j===!1||j&&E?.status?.code!=="inactive"||E?.cardHolderUserId!==U.userId)){const W=De(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(W,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const W=De(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Qa()),t(W,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((W=>Vn(W.userState,U.userId))),z=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((W=>W.statusCode==="success"))===!0&&B===!1&&(setTimeout(z,3e3),_(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const D=W=>{O(W)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:D}),o.jsx(ai,{cardId:s,card:E,shippingAddressId:E.shippingAddressId,phone:H.phone,signedInUser:U,isSandboxEnv:Bt(),chargeCardDetailState:x,signedInUserToken:h,navigate:t,currentTenant:S,location:f,maxChargeCardActivationAttempts:p[s]!=null?p[s]:c.default_max_charge_card_activation_attempts!=null?c.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:c.charge_card_cashback_rate_per_transaction!=null?c.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{D(!0)}}),e!=null?o.jsx(ti,{windowSize:a,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const f=Ls(e.addressState,n);if(f==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),m=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const l=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Bs())||l,showMenuIcon:u,shippingAddress:f,vgsVaultId:nt.cardVaultId,twoFAView:b,activationWaitStatus:m,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:f,chargeCardDetailState:b}=a,m=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=f;return{onGetOtp:u=>{m!=null&&e(et(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Os(t,u))},onResendOtp:u=>{m!=null&&e(Xa(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Ja(u,l,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),l=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?na(A):u.poppedPathname;n(l,{state:{pathnameStackToGoBack:u.newStack}})}}}))(oc),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Xc.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as l}from"./liveblocks-
|
|
1
|
+
import{j as l}from"./liveblocks-UAxYbctH.js";import{a as g}from"./sentry-CQfqw6mU.js";import{h as w,u as x,g as E,i as T,j as O,l as k}from"./core-BQ6YlWys.js";import{z as b,aZ as F,a9 as P,d as j,U as V,C as h,a8 as L,bf as A,af as U,bg as M,s as B}from"./index-DZBfE5XI.js";import{fI as N,gL as _,C8 as G,gG as R,c7 as Y,YE as z,bm as Z,vc as H,v0 as K,mK as $,oj as S,YF as q,bE as J,cv as C,ou as Q,oE as W}from"./zeni-epic-state-j9Po26Lg.js";import"./mui-DYo6Z7Si.js";import{d as X}from"./routePaths-CaZTJQOM.js";import{M as ee}from"./MobileAppDrawer-DTqKEh3f.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new a.Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="152083b2-3b22-4e97-a38d-2c5e3a32f360",a._sentryDebugIdIdentifier="sentry-dbid-152083b2-3b22-4e97-a38d-2c5e3a32f360")}catch{}})();const te=k((function(a){const n=R(a),i=b.getSignedInUser(),p=N(a),c=p.tenantId,u={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},y=Y(p?.userRole??[])&&n.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(a.companyConfigState),t=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:n.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:n,allIndustries:e.companyIndustries??[],allNationalityCountries:t,isDisabled:y,authParams:u,filesEndPoint:`${U.fileMicroServiceBaseUrl}`,isZeniUser:Z(i)}}),(function(a,n){const{companyId:i,currentTenant:p,navigate:c,location:u}=n,{tenantEmailDomain:y}=p;return{onScheduleClick:e=>{let t=e.href;t.includes("http")||(t="https://".concat(t)),window.open(t,"_blank")},onSaveAll:()=>{a(W())},onAddressClick:e=>{const t=X(y,e),o=B(u.state?.pathnameStackToGoBack,u.pathname);c(t,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(Q({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:t,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:m}=t,{meetingLink:f}=d,{incDate:s}=o,{taxesFiledYears:v}=r,D={companyInfo:{...t,website:m!=""&&m!=null?C(m):void 0,meetingLink:f!=""&&f!=null?C(f):void 0,industry:t.industry.selectedOption,companyIndustryType:t.companyIndustryType?.selectedOption??void 0,companySubIndustry:t.companySubIndustry?.selectedOption??void 0,businessModel:t.businessModel.selectedOption??"",companySourceOfFunds:t.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:t.companySourceOfFundsDescription??void 0,countriesOfOperations:t.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:M(I)))??[],transactionVolume:t.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:t.transactionVolumeDescription??void 0,regulatedStatus:t.regulatedStatus??void 0,regulatedStatusDescription:t.regulatedStatusDescription??void 0,usNexus:t.usNexus??void 0,usNexusTypes:t.usNexusTypes?.selectedOptions??[],purposeOfAccount:t.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:t.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:v.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};a(S({companyDetails:D}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(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=>{a(q(e))},onCompanyOfficerUpdated:e=>{a(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=>{a($({files:e}))},onDeleteFile:e=>{a(K(e))},onEditFileName:(e,t)=>{a(H(e,t.split(".")[0]))}}}))(A);function le(){const a=w(),n=x(),i=E(),{tenantEmailDomain:p}=T(),[c,u]=g.useState(!1),[y,e]=g.useState(!1),t=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>N(s))),d=r.companyId??b.getSignedInUserTenant(p)?.companyId;if(b.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||t!=="Not-Started"||d==null||(u(!0),n(_(d)))}),[c,t,d,n]),g.useEffect((()=>{o==="Not-Started"&&n(G())}),[o,n]);const m=s=>{e(s)},f=t==="Not-Started"||t==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&t==="Error"?l.jsx(F,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):l.jsxs(l.Fragment,{children:[l.jsx(P,{analytics:j,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,h(i)?"Settings":"Company Passport")}),h(i)?l.jsx(ee,{isAppContentDrawerOpen:y,handleDrawerToggle:m}):null,f?l.jsx(L,{fetchState:"In-Progress",style:{height:"calc(100vh - 110px)"}}):l.jsx(te,{companyId:d,navigate:a,location:i,isLoading:f,currentTenant:r,isSettings:h(i),onClickMenuIcon:()=>{m(!0)}})]})}export{le as C};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{j as I}from"./liveblocks-UAxYbctH.js";import{a as o}from"./sentry-CQfqw6mU.js";import{u as F,h as L,g as H,j as C,N as w}from"./core-BQ6YlWys.js";import{UN as q,fI as z,go as G,hd as V,gP as A,gn as Q,gl as B,V6 as J,gk as O}from"./zeni-epic-state-j9Po26Lg.js";import{u as K,z as E,b as D,G as M,R as W}from"./index-DZBfE5XI.js";import{n as X}from"./mui-DYo6Z7Si.js";import{P as b,a as T}from"./AccountMappingScreen-DIZ1qWql.js";import{t as Y}from"./getLocaleForTenant-jg4r2V28.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-BLLJy6Ug.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";import"./MobileAppDrawer-DTqKEh3f.js";import"./InboxNotificationsProvider-Daf1RQwd.js";import"./useTaskManagerAccess-CP331xWN.js";import"./accountMappingHelper-DHkHknqJ.js";import"./empty-mwfdcHvm.js";import"./pdf-lib-BMce44-8.js";import"./index-Bfsx1pdD.js";import"./url-OL55dppf.js";import"./index-B7zYAj-7.js";import"./decodeURIComponentSafe-D_MvDEMm.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]="89febcc8-aff1-4c6b-a25a-5a2b69ec4896",t._sentryDebugIdIdentifier="sentry-dbid-89febcc8-aff1-4c6b-a25a-5a2b69ec4896")}catch{}})();const te=X.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1 1 auto;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
background-color: ${t=>t.theme.colors.background};
|
|
10
|
+
box-shadow: ${t=>`0px 2px ${W.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
+
`;function we(){const t=F(),i=L(),v=H(),{setLoading:d,clearAllLoading:m}=K(),h=o.useRef(!1),S=o.useRef(!1),N=o.useRef(!1),f=o.useRef(!1),{code:U,realmId:$,state:P}=Z(v.search),p=U!==""&&$!==""&&P!=="";p&&(N.current=!0);const j=sessionStorage.getItem(b),u=j===T.pending,R=j===T.ready,x=C((s=>q(s))),e=C((s=>z(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,c=e?.externalConnections?.saveConnectionState,y=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{d(D.CONNECTION_AUTH)}),[d]),o.useEffect((()=>{h.current||a==null||g==null||(h.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(D.TENANT_FETCHING),t(G(a.userId,g))))}),[h,n,d]),o.useEffect((()=>{e.tenantId==null&&!S.current&&a!=null&&(S.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(V(a.userId)))}),[S,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||c!=="Error"||(d(D.CONNECTION_AUTH),t(A(a.userId,e.tenantId)))}),[c]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(Q(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),B(a?.userId,a?.zeniSessionId,e.tenantId),M.updateAppLocaleID(Y(J(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(A(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{x.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(x.tenantsCoreDetailsInOrder)}),[x.tenantsCoreDetailsInOrder.length,n]);const _=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&c==="In-Progress"&&(f.current=!0)}),[u,c]),o.useEffect((()=>{if(!u||_)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return f.current&&c==="Completed"?(sessionStorage.setItem(b,T.ready),m(),void i(s,{replace:!0})):f.current&&c==="Error"?(sessionStorage.removeItem(b),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(p||N.current||f.current||y!==!0||(sessionStorage.removeItem(b),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,_,c,p,y,e.tenantEmailDomain,m,t,i]),_)return null;if(p||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return R?I.jsx(w,{to:k,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-UAxYbctH.js";import{z as m}from"./index-DZBfE5XI.js";import{g as n}from"./QBOConnectionScreen-BLLJy6Ug.js";import"./sentry-CQfqw6mU.js";import{g as p,N as a}from"./core-BQ6YlWys.js";import"./zeni-epic-state-j9Po26Lg.js";import"./recharts-VJtr9O-6.js";import"./mui-DYo6Z7Si.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";import"./empty-mwfdcHvm.js";import"./pdf-lib-BMce44-8.js";import"./index-Bfsx1pdD.js";import"./url-OL55dppf.js";import"./index-B7zYAj-7.js";import"./decodeURIComponentSafe-D_MvDEMm.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]="ebd28598-e6ad-49c0-9fdb-a537e411a6fc",t._sentryDebugIdIdentifier="sentry-dbid-ebd28598-e6ad-49c0-9fdb-a537e411a6fc")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),s=m.getSignedInUser()?.userId??"";if(f(o,r,e,s)===!0){const d=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(a,{to:d})}return i.jsx(a,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
package/dist/assets/{CustomerOnboardingRoutes-i8teYQ0f.js → CustomerOnboardingRoutes-B6np-cNh.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-
|
|
1
|
+
import{j as s}from"./liveblocks-UAxYbctH.js";import{t as wn,A as $e}from"./AddressScreen-CxRV-hrD.js";import An from"./NotFoundScreen-CY-XFa3a.js";import{a as d,x as Me}from"./sentry-CQfqw6mU.js";import{h as _e,g as Te,u as se,i as xe,j as E,N as Q,q as Pn,l as cn,n as Dn,o as H}from"./core-BQ6YlWys.js";import{fI as X,eq as Ee,ep as we,bp as jn,V2 as Fn,bR as Bn,q3 as Vn,BU as Un,BX as Rn,a1Y as Ln,a1Z as Nn,lF as Oe,lI as dn,a1h as Gn,d$ as $n,c7 as fe,Cm as Ae,C7 as Mn,a1_ as me,Cn as un,Tc as Qn,mS as ln,d2 as pn,Yd as Kn,Ye as zn,uV as qn,Vm as he,i4 as Hn,Vl as be,i1 as Yn,GT as Zn,uZ as Jn,hV as Wn,hY as Qe,a1$ as mn,a1b as Xn,MJ as et,a1c as nt,MN as tt,B_ as at,Ya as ot,Yb as st,lD as rt,lG as it,Cz as ct,C9 as gn,Cl as dt,bE as Ke,cv as ut,Cy as ze,vc as lt,v0 as pt,mK as mt,gJ as gt,gI as ft,gH as yt,a20 as Ct,C1 as ht,CA as bt,CD as St,CG as It,CM as kt,d3 as Ot}from"./zeni-epic-state-j9Po26Lg.js";import{z,p as Pe,N as J,f as vt,s as q,a9 as re,d as g,dm as _t,az as fn,a2 as Tt,j as yn,V as Cn,q as W,_ as ge,U as ve,dn as xt,R as qe,H as He,af as Et,bg as Ye,dp as wt,dq as At}from"./index-DZBfE5XI.js";import{n as De}from"./mui-DYo6Z7Si.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-BLLJy6Ug.js";import{u as jt,a as Ft}from"./useEmailConnectResultRefresh-DJgvOf06.js";import{u as Bt}from"./useChargeCardPusherEvents-Gp7Qmy_v.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";import"./empty-mwfdcHvm.js";import"./pdf-lib-BMce44-8.js";import"./index-Bfsx1pdD.js";import"./url-OL55dppf.js";import"./index-B7zYAj-7.js";import"./decodeURIComponentSafe-D_MvDEMm.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="9645c2d8-ef5b-4452-9bef-281292defe5d",e._sentryDebugIdIdentifier="sentry-dbid-9645c2d8-ef5b-4452-9bef-281292defe5d")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Vt=()=>{const e=_e(),l=Te(),i=se(),[o,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=xe(),n=z.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:h}=t(J.isApAgingFeatureEnabled),{isFeatureEnabled:a}=t(J.isArAgingFeatureEnabled),{isFeatureEnabled:A}=t(J.isReferralFeatureEnabled),{isFeatureEnabled:w}=t(J.isDebitCardFeatureEnabled),k=vt(),O=E((S=>X(S))),P=E((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,B=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(n==null)throw Error("Can't access onboarding flow without signing in...");const m=Ee(w,O),b=we(O),D=[],U=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,C=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&jn(O?.userRole),T=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),C===!1&&D.push("task_card"),T===!1&&D.push("bill_pay_card","bill_pay_promo_card"),x===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=E((S=>{const V=[];h===!1&&V.push("accounts_payable_aging"),a===!1&&V.push("accounts_receivable_aging"),V.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&V.push("rewards_card"),k===!1&&V.push("expense_automation_card");const Y=Fn(S,V);return Bn(Y.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||o||m||b||(p(!0),i(Vn(n.userId,B,O.tenantId,!0,!1,D)))}),[o,P,m,b,n,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_t,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Je=(e,l)=>{const i=new Map(e.map((o=>[o.key,o])));return l.map((o=>{return p=i.get(o)?.status,p==="starting"||p==="building"?p:"idle";var p}))},We=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((o=>[o.key,o])));return l.every((o=>i.get(o)?.status==="ready"))},Xe=De.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${e=>e.theme.colors.grey4};
|
|
@@ -13,8 +13,8 @@ import{j as s}from"./liveblocks-CueKZN6-.js";import{t as wn,A as $e}from"./Addre
|
|
|
13
13
|
width: 100%;
|
|
14
14
|
padding-left: ${qe.sp0};
|
|
15
15
|
`:`
|
|
16
|
-
min-width: calc(100% - ${
|
|
17
|
-
padding-left: ${
|
|
16
|
+
min-width: calc(100% - ${He}px);
|
|
17
|
+
padding-left: ${He}px;
|
|
18
18
|
`}
|
|
19
19
|
|
|
20
20
|
${e=>e.theme.breakpoints.down("md")} {
|
|
@@ -23,8 +23,8 @@ import{j as s}from"./liveblocks-CueKZN6-.js";import{t as wn,A as $e}from"./Addre
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
-
`,nn=cn((function(e,l){const{companyId:i,isAdmin:o,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=X(e),h=Ae(e,i),a=mn(e),A=fe(p?.userRole??[])&&h.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xn(e.userRoleConfigState);return{onboardingCustomerView:h,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Et.fileMicroServiceBaseUrl,authParams:n},signedInUser:z.getSignedInUser(),currentTenant:t,isAdmin:o,isOnAddressPage:u,cardPaymentView:a,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:o,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=o;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,h)=>{e(St(n,t,h))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(ht(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((h=>{const{officerType:a,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:B,syncToken:m,selectDocument:b,role:D,ownership:U,isSelectedForVerification:C,userVerificationStatus:r,fileIds:T,isPhoneVerified:x}=h;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:a,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?He(P.selectedOption):void 0,phone:B,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:U,documentTypeSelectedForVerification:f,isSelectedForVerification:C,userVerificationStatus:r,fileIds:T,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:x}}));e(ze({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(Ct({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:h,companyIndustryType:a,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:B,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:U,stateOfIncorporation:C,incDate:r,companySourceOfFunds:T,companySourceOfFundsDescription:x,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:H,usNexusTypes:$}=n,M={companyId:i,companyDescription:t,companyIndustry:h.selectedOption,companyIndustryType:a?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:U?.selectedOption??"",stateOfIncorporation:C?.selectedOption??"",companySourceOfFunds:T?.selectedOption??"",companySourceOfFundsDescription:x,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:He(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:H,usNexusTypes:$?.selectedOptions??[]},ce={userId:B,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const h=an(v,n,t),a=q(c.state?.pathnameStackToGoBack,c.pathname);u(h,{state:{pathnameStackToGoBack:a}})},onRegisteredAddressClick:(n,t)=>{const h=an(v,n,t),a=q(c.state?.pathnameStackToGoBack,c.pathname);u(h,{state:{pathnameStackToGoBack:a}})},onUpdateCustomerView:(n,t,h,a)=>{e(dt(i,!1,t,h,n,a))},onAddressEditHandler:n=>{if(n!=null){const t=wn(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,h)=>{e(rt(n,t,h))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(xt),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const o=fn(),p=_e(),u=Te(),c=se(),v=Tt(),n=yn(),[t,h]=d.useState(!1),[a,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=xe(),P=Cn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:B}=_(J.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=E((y=>y.onboardingCustomerViewState.fetchState)),D=E((y=>y.onboardingCustomerViewState.currentStep)),U=E((y=>y.onboardingCustomerViewState.uiState)),C=E((y=>X(y))),r=E((y=>y.userRoleConfigState.fetchState)),T=E((y=>y.cardPaymentViewState)),x=W(T.addCardPaymentSourceStatus.fetchState),f=T.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pt(u.search),L=C.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,V=L?.connectionId??"",H=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{a||(A(!0),c(Oe()))}),[a,c]),d.useEffect((()=>{w||(dn(["card"]),k(!0))}),[w]),d.useEffect((()=>{x==="In-Progress"&&f==="Completed"&&c(Oe())}),[x,f]),d.useEffect((()=>{Dt(j,N,G,V,H)===!0&&C.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Gn(C.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:H},$n(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:V},g.trackOnboardingSaveQBOConnection(N,V),p(u.pathname))}),[j,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",C.tenantEmailDomain)}),[b]);const M=C.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(C?.userRole??[]),R=E((y=>Ae(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(h(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=C.externalConnections?.saveConnectionState,je=W(ne);d.useEffect((()=>{je==="In-Progress"&&(ne==="Completed"||ne==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,C.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,je,U.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const hn=W(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&hn==null&&c(ln({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=R.isInterimEmailSent,Fe=z.getSignedInUser();if(Fe==null)throw Error("Can't access onboarding flow without signing in...");const Sn=Ee(B,C),In=we(C),Be=C.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=C.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(C),On=C.productSettings.isTreasuryEnabled,Ue=Ut({tenantEmailDomain:O??"",signedInUserEmail:Fe.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=E((F=>F.onboardingCustomerViewState?.aiAgentsActivation)),te=E((F=>X(F).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),Ce=d.useCallback((()=>{K(Un())}),[K]);d.useEffect((()=>{Ce()}),[Ce]);const Le=d.useCallback((()=>{y==null||y===""||te||K(Rn(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const F=`private-encrypted-${y}`;return[`${F}.ledger-ingestion.counts-updated`,`${F}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((F,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(F!=="ledger-ingestion.counts-updated"){if(F==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Ln({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Bt({events:vn,onEvent:_n,onSubscribed:Ce}),d.useMemo((()=>{const F=de?.phases??[],ae=Je(F,Se),I=Je(F,Ie),ue=We(F,Se),Z=We(F,Ie),Ne=F.some((En=>En.status!=="idle")),oe=!te&&!Ne,Ge=te&&!Ne,Tn=Ge?Se.map((()=>"building")):ae,xn=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:Tn,backgroundRowStatuses:oe?void 0:xn,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:M});if(Be===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Xe,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ve(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:C,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&C.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Be===!1&&P?.loggedInUserRoleMap!=null)return bn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Xe,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ve(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:C,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&C.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Ut=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const o=se(),{pendingAutoFocusTabId:p}=jt(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Ft({companyId:i}),n=E((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=E((r=>X(r))),h=E((r=>r.tenantState.fetchState)),a=E((r=>Kn(r,i))),A=E((r=>zn(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{o(qn(ke))}),[o]);const P=a.externalConnections?.saveAPIKeyConnectionState,_=a.externalConnections?.saveAPIKeyConnectionError?.message,B=W(P);d.useEffect((()=>{B==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,B,_]);const m=a.externalConnections?.saveOAuthConnectionState,b=a.externalConnections?.saveOAuthConnectionError?.message,D=W(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const U=a.externalConnections?.saveConnectorCredentialsStateBySlug,C=W(U);return d.useEffect((()=>{const r=U??{},T=C??{},x=a.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(T[f]!=="In-Progress")return;let j;try{j=he(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",x[f]?.message??"")}))}),[U,C,a]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:a,isLoading:h==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:a.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:a.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:a.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:a.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:a.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(a.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,T])=>[r,T?.message]))),deleteConnectionState:a.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:a.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),o(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),o(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,T)=>{const x=a.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(x==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:T,connection_id:x,redirect_uri:f,tenant_id:k})),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(f)}`},onDisconnect:(r,T)=>{const x=[...a.externalConnections?.accounting??[],...a.externalConnections?.payments??[],...a.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=x!=null?he(x):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",T),o(Wn(k,r,be(T)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Jn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{a.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Zn())},onSaveChargeBeeCredentials:(r,T)=>{const x=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;x!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),o(Hn(k,x,be("revenue"),he("chargebee"),{api_key:r,site:T})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),o(Yn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,a,h,w,p,k,l,e,o,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let o=`/${e}/onboarding/address`;return o=i!=null?o.concat(`/edit/${l}/${encodeURIComponent(i)}`):o.concat(`/new/${l}`),o}const on=De.div`
|
|
26
|
+
`,nn=cn((function(e,l){const{companyId:i,isAdmin:o,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=X(e),h=Ae(e,i),a=mn(e),A=fe(p?.userRole??[])&&h.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xn(e.userRoleConfigState);return{onboardingCustomerView:h,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Et.fileMicroServiceBaseUrl,authParams:n},signedInUser:z.getSignedInUser(),currentTenant:t,isAdmin:o,isOnAddressPage:u,cardPaymentView:a,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:o,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=o;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,h)=>{e(St(n,t,h))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(ht(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((h=>{const{officerType:a,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:B,syncToken:m,selectDocument:b,role:D,ownership:U,isSelectedForVerification:C,userVerificationStatus:r,fileIds:T,isPhoneVerified:x}=h;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:a,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?Ye(P.selectedOption):void 0,phone:B,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:U,documentTypeSelectedForVerification:f,isSelectedForVerification:C,userVerificationStatus:r,fileIds:T,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:x}}));e(ze({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(Ct({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:h,companyIndustryType:a,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:B,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:U,stateOfIncorporation:C,incDate:r,companySourceOfFunds:T,companySourceOfFundsDescription:x,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:Y,usNexusTypes:$}=n,M={companyId:i,companyDescription:t,companyIndustry:h.selectedOption,companyIndustryType:a?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:U?.selectedOption??"",stateOfIncorporation:C?.selectedOption??"",companySourceOfFunds:T?.selectedOption??"",companySourceOfFundsDescription:x,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:Ye(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:Y,usNexusTypes:$?.selectedOptions??[]},ce={userId:B,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const h=an(v,n,t),a=q(c.state?.pathnameStackToGoBack,c.pathname);u(h,{state:{pathnameStackToGoBack:a}})},onRegisteredAddressClick:(n,t)=>{const h=an(v,n,t),a=q(c.state?.pathnameStackToGoBack,c.pathname);u(h,{state:{pathnameStackToGoBack:a}})},onUpdateCustomerView:(n,t,h,a)=>{e(dt(i,!1,t,h,n,a))},onAddressEditHandler:n=>{if(n!=null){const t=wn(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,h)=>{e(rt(n,t,h))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(xt),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const o=fn(),p=_e(),u=Te(),c=se(),v=Tt(),n=yn(),[t,h]=d.useState(!1),[a,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=xe(),P=Cn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:B}=_(J.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=E((y=>y.onboardingCustomerViewState.fetchState)),D=E((y=>y.onboardingCustomerViewState.currentStep)),U=E((y=>y.onboardingCustomerViewState.uiState)),C=E((y=>X(y))),r=E((y=>y.userRoleConfigState.fetchState)),T=E((y=>y.cardPaymentViewState)),x=W(T.addCardPaymentSourceStatus.fetchState),f=T.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pt(u.search),L=C.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,V=L?.connectionId??"",Y=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{a||(A(!0),c(Oe()))}),[a,c]),d.useEffect((()=>{w||(dn(["card"]),k(!0))}),[w]),d.useEffect((()=>{x==="In-Progress"&&f==="Completed"&&c(Oe())}),[x,f]),d.useEffect((()=>{Dt(j,N,G,V,Y)===!0&&C.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Gn(C.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:Y},$n(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:V},g.trackOnboardingSaveQBOConnection(N,V),p(u.pathname))}),[j,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",C.tenantEmailDomain)}),[b]);const M=C.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(C?.userRole??[]),R=E((y=>Ae(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(h(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=C.externalConnections?.saveConnectionState,je=W(ne);d.useEffect((()=>{je==="In-Progress"&&(ne==="Completed"||ne==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,C.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,je,U.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const hn=W(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&hn==null&&c(ln({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=R.isInterimEmailSent,Fe=z.getSignedInUser();if(Fe==null)throw Error("Can't access onboarding flow without signing in...");const Sn=Ee(B,C),In=we(C),Be=C.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=C.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(C),On=C.productSettings.isTreasuryEnabled,Ue=Ut({tenantEmailDomain:O??"",signedInUserEmail:Fe.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=E((F=>F.onboardingCustomerViewState?.aiAgentsActivation)),te=E((F=>X(F).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),Ce=d.useCallback((()=>{K(Un())}),[K]);d.useEffect((()=>{Ce()}),[Ce]);const Le=d.useCallback((()=>{y==null||y===""||te||K(Rn(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const F=`private-encrypted-${y}`;return[`${F}.ledger-ingestion.counts-updated`,`${F}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((F,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(F!=="ledger-ingestion.counts-updated"){if(F==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Ln({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Bt({events:vn,onEvent:_n,onSubscribed:Ce}),d.useMemo((()=>{const F=de?.phases??[],ae=Je(F,Se),I=Je(F,Ie),ue=We(F,Se),Z=We(F,Ie),Ne=F.some((En=>En.status!=="idle")),oe=!te&&!Ne,Ge=te&&!Ne,Tn=Ge?Se.map((()=>"building")):ae,xn=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:Tn,backgroundRowStatuses:oe?void 0:xn,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:M});if(Be===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Xe,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ve(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:C,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&C.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Be===!1&&P?.loggedInUserRoleMap!=null)return bn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Xe,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ve(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:C,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&C.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Ut=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const o=se(),{pendingAutoFocusTabId:p}=jt(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Ft({companyId:i}),n=E((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=E((r=>X(r))),h=E((r=>r.tenantState.fetchState)),a=E((r=>Kn(r,i))),A=E((r=>zn(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{o(qn(ke))}),[o]);const P=a.externalConnections?.saveAPIKeyConnectionState,_=a.externalConnections?.saveAPIKeyConnectionError?.message,B=W(P);d.useEffect((()=>{B==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,B,_]);const m=a.externalConnections?.saveOAuthConnectionState,b=a.externalConnections?.saveOAuthConnectionError?.message,D=W(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const U=a.externalConnections?.saveConnectorCredentialsStateBySlug,C=W(U);return d.useEffect((()=>{const r=U??{},T=C??{},x=a.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(T[f]!=="In-Progress")return;let j;try{j=he(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",x[f]?.message??"")}))}),[U,C,a]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:a,isLoading:h==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:a.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:a.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:a.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:a.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:a.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(a.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,T])=>[r,T?.message]))),deleteConnectionState:a.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:a.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),o(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),o(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,T)=>{const x=a.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(x==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:T,connection_id:x,redirect_uri:f,tenant_id:k})),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(f)}`},onDisconnect:(r,T)=>{const x=[...a.externalConnections?.accounting??[],...a.externalConnections?.payments??[],...a.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=x!=null?he(x):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",T),o(Wn(k,r,be(T)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Jn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{a.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Zn())},onSaveChargeBeeCredentials:(r,T)=>{const x=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;x!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),o(Yn(k,x,be("revenue"),he("chargebee"),{api_key:r,site:T})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),o(Hn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,a,h,w,p,k,l,e,o,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let o=`/${e}/onboarding/address`;return o=i!=null?o.concat(`/edit/${l}/${encodeURIComponent(i)}`):o.concat(`/new/${l}`),o}const on=De.div`
|
|
27
27
|
display: flex;
|
|
28
28
|
height: 100vh;
|
|
29
29
|
background-color: ${e=>e.theme.colors.grey4};
|
|
30
|
-
`,sn=cn((function(e,l){const{companyId:i,currentTenant:o}=l,p=Ae(e,i),u=mn(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(o?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:o}}),(function(e,l){const{currentTenant:i,themeState:o,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p("/signout",{replace:!0,state:{pathnameStackToGoBack:v,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{p(`/${c}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(At),Rt=()=>{const e=fn(),l=_e(),i=se(),o=Te(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(J.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=xe(),n=Cn(),[t,h]=d.useState(!1);d.useEffect((()=>{t===!1&&o.state?.message==="OnboardingThankyou"&&h(!0)}),[o.state]);const a=E((m=>X(m))),A=a.productSettings.isOtherProductsEnabled,w=A===!0&&!pn(a);d.useEffect((()=>{i(gn(k,!1,!w))}),[]);const k=a.companyId??z.getSignedInUserTenant(v)?.companyId;if(n.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Ee(c,a),P=we(a),_=E((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),B=a.company?.companyOnboardingInfo.isOnboardingCompleted;if(B!==!0||w)return _==="Completed"&&B===!0&&w&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",Ot(a.productSettings))}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&B===!1&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):s.jsx(wt,{});{const m={pathnameStackToGoBack:o.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rn(){return typeof Me=="function"?Me():void 0}let pe=0;function Lt(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const o=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rn();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&o()}),1e3)),()=>{l=!0,o(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rn();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Lt(),s.jsxs(Dn,{children:[s.jsx(
|
|
30
|
+
`,sn=cn((function(e,l){const{companyId:i,currentTenant:o}=l,p=Ae(e,i),u=mn(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(o?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:o}}),(function(e,l){const{currentTenant:i,themeState:o,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p("/signout",{replace:!0,state:{pathnameStackToGoBack:v,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{p(`/${c}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(At),Rt=()=>{const e=fn(),l=_e(),i=se(),o=Te(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(J.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=xe(),n=Cn(),[t,h]=d.useState(!1);d.useEffect((()=>{t===!1&&o.state?.message==="OnboardingThankyou"&&h(!0)}),[o.state]);const a=E((m=>X(m))),A=a.productSettings.isOtherProductsEnabled,w=A===!0&&!pn(a);d.useEffect((()=>{i(gn(k,!1,!w))}),[]);const k=a.companyId??z.getSignedInUserTenant(v)?.companyId;if(n.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Ee(c,a),P=we(a),_=E((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),B=a.company?.companyOnboardingInfo.isOnboardingCompleted;if(B!==!0||w)return _==="Completed"&&B===!0&&w&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",Ot(a.productSettings))}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&B===!1&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):s.jsx(wt,{});{const m={pathnameStackToGoBack:o.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rn(){return typeof Me=="function"?Me():void 0}let pe=0;function Lt(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const o=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rn();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&o()}),1e3)),()=>{l=!0,o(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rn();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Lt(),s.jsxs(Dn,{children:[s.jsx(H,{path:"/",element:s.jsx(le,{})}),s.jsx(H,{path:"/billing/edit",element:s.jsx(le,{taxCFOCustomer:!0})}),s.jsx(H,{path:"/thankyou",element:s.jsx(Rt,{})}),s.jsx(H,{path:"/activation",element:s.jsx(Vt,{})}),s.jsx(H,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"*",element:s.jsx(An,{})})]})}export{pa as default};
|