@zeniai/web-app-ui 5.3.69-dev → 5.3.70-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-CAQA7lne.js → AccountMappingScreen-D3djYfgp.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-BifxUBTA.js → ActualMatchingMatchDetailScreen-Cq0gOwnW.js} +1 -1
- package/dist/assets/AddressRoutes-DgNiwEJi.js +1 -0
- package/dist/assets/{AddressScreen-icxXA3w4.js → AddressScreen-BwYO5U79.js} +2 -2
- package/dist/assets/AiCfoScreen-DA63Fu9p.js +22 -0
- package/dist/assets/{AppDrawer-hE6okzG9.js → AppDrawer-BOrQkKOR.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-eAwSxg7-.js → BillPayApprovalRoutes-B55H8WmV.js} +1 -1
- package/dist/assets/{BillPayRoutes-CPSa9tRu.js → BillPayRoutes-YFeZZcxr.js} +18 -18
- package/dist/assets/{BusinessVerificationPageScreen-XOO4dt2W.js → BusinessVerificationPageScreen-DNvCS3RC.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-oZaMLLYZ.js → CardsAiCfoScreen-WX6-qDlM.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-CR22MdW5.js → ChargeCardRoutes-DgHeyyF1.js} +1 -1
- package/dist/assets/CompanyPassportScreen-2YW4iiFQ.js +1 -0
- package/dist/assets/ConnectionAuthScreen-C3krXtMn.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-DuDZDqm3.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-EqYjJciA.js +30 -0
- package/dist/assets/{DashboardRoutes-ksNQmz1b.js → DashboardRoutes-C3kckIqd.js} +4 -4
- package/dist/assets/{DefaultTenantHome-6h7pYNWH.js → DefaultTenantHome-d_TjwNxm.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-HvKTTv-k.js +18 -0
- package/dist/assets/{DrawerScreen-D2sNIMxZ.js → DrawerScreen-lfwUNd7g.js} +1 -1
- package/dist/assets/EntityDetailRoutes-C7CCgNbG.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-WQsWVsrz.js → ExpenseAutomationRoutes-DhSen9oE.js} +7 -7
- package/dist/assets/{FeaturePreviewScreen-DrW5sKTA.js → FeaturePreviewScreen-DJDJb7ut.js} +1 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-2bg-7CdA.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-D6GwXgCp.js → InboxNotificationsProvider-RMyde6sE.js} +1 -1
- package/dist/assets/{InvoicingRoutes-EwIfHCd8.js → InvoicingRoutes-DbeQ0GGQ.js} +2 -2
- package/dist/assets/MagicLinkRoutes-BJYHiuf3.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-C_8LOIdG.js +12 -0
- package/dist/assets/{MobileAppDrawer-r4WOmIWX.js → MobileAppDrawer-FDyQcQG6.js} +1 -1
- package/dist/assets/NotFoundScreen-Pkv6JCVI.js +1 -0
- package/dist/assets/NotificationRoutes-DRxPH61k.js +1 -0
- package/dist/assets/OAuthConsentScreen-o8HVpzqy.js +1 -0
- package/dist/assets/{PandLWithForecastRoutes-DNnwlAH1.js → PandLWithForecastRoutes-BoCd9gMg.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-C_1-1L8E.js → PaymentLinkScreen-BD2vlE8X.js} +1 -1
- package/dist/assets/PeopleRoutes-BrDezhiU.js +22 -0
- package/dist/assets/PerformanceRoutes-CkvcEEfk.js +1 -0
- package/dist/assets/{Preview-CCdAPHVf.js → Preview-CHfSVeda.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-Cbteo3If.js → QBOConnectionScreen-rYcXSEuv.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-DeuDXp10.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-Bs4p5t9E.js → ReimbursementApprovalRuleDetailScreen-Dc1dHQbP.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-BbvmwzbP.js → ReimbursementRoutes-BiK6w-bL.js} +4 -4
- package/dist/assets/{ReportsRoutes-DHQlYB_r.js → ReportsRoutes-B0eprtYT.js} +1 -1
- package/dist/assets/RewardsRoutes-BYgzQdTF.js +1 -0
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-DWKBiKA_.js +33 -0
- package/dist/assets/ScreenRoutes-CSYASqmo.js +2 -0
- package/dist/assets/{SettingsRoutes-CN7GV-oe.js → SettingsRoutes-C5_WEhpe.js} +1 -1
- package/dist/assets/{SetupPagesScreen-BJMKj009.js → SetupPagesScreen-D70oyW5d.js} +5 -5
- package/dist/assets/{SignInScreen-atM-bsdO.js → SignInScreen-CGIJ3MaT.js} +1 -1
- package/dist/assets/SignOutScreen-ChO6ZqKr.js +9 -0
- package/dist/assets/{TaskListScreen-B70VtP2u.js → TaskListScreen-D7zAKLvf.js} +2 -2
- package/dist/assets/TaskRoutes-BFQ2Wv7G.js +9 -0
- package/dist/assets/TransactionDetailRoutes-8wfYIjz_.js +1 -0
- package/dist/assets/{TransactionDetailScreen-1gITEJfr.js → TransactionDetailScreen-Dakxd2K4.js} +2 -2
- package/dist/assets/TransactionListRoutes-wVc7qhB0.js +1 -0
- package/dist/assets/{TreasuryRoutes-DWmpGaGA.js → TreasuryRoutes-C8xJsRN4.js} +5 -5
- package/dist/assets/{VendorsRoutes-B0HnUIhj.js → VendorsRoutes-BEDJSvt_.js} +10 -10
- package/dist/assets/WiseConfirmationScreen-Dv4iPWVl.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-BI-IsmW_.js → ZeniAccountRoutes-BZbo3Uuo.js} +10 -10
- package/dist/assets/ZeniAccountStatementScreen-CyKPDLyf.js +9 -0
- package/dist/assets/{accountMappingHelper-D-qmKFUw.js → accountMappingHelper-CDXfdGYB.js} +1 -1
- package/dist/assets/{analytics-C6U4wpfB.js → analytics-Bwul-sh2.js} +1 -1
- package/dist/assets/{analyticsHelper-qAafKEWE.js → analyticsHelper-D_76GpgW.js} +1 -1
- package/dist/assets/{core-Dk5JD2l2.js → core-BTRpO5kD.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-NBY1IhYb.js → decodeURIComponentSafe-gQrUmSgy.js} +1 -1
- package/dist/assets/{dnd-CSZKLHxv.js → dnd-2ZjyQ0g9.js} +1 -1
- package/dist/assets/{empty-CDCQLT9Y.js → empty-Cb7Nu9Hh.js} +1 -1
- package/dist/assets/{empty-D0msLZIr.js → empty-W69oI4tU.js} +1 -1
- package/dist/assets/{emptyVideoElement-EOYyzQLg.js → emptyVideoElement-BykFTq6U.js} +1 -1
- package/dist/assets/epic-dVflju6K.js +2 -0
- package/dist/assets/expenseAutomationHelper-D83VUSa4.js +1 -0
- package/dist/assets/{getLocaleForTenant-Tff_ZVu3.js → getLocaleForTenant-DKQ9xDck.js} +1 -1
- package/dist/assets/{index-Cr97VFCj.js → index-BNStHB6B.js} +1 -1
- package/dist/assets/{index-CaO8T0Mn.js → index-BUq8vLqs.js} +15939 -15922
- package/dist/assets/{index-B_zuMfAK.js → index-BpHR89qw.js} +1 -1
- package/dist/assets/{index-CTXzqHUs.js → index-CyWlZL1X.js} +2 -2
- package/dist/assets/{index-BFxiz-4U.js → index-Ds59pPsN.js} +1 -1
- package/dist/assets/{index-B_rhGKNa.js → index-Dt8qJC5s.js} +1 -1
- package/dist/assets/{index-BzY7ptmA.js → index-EIrua76A.js} +1 -1
- package/dist/assets/{index-Cos3hzZM.js → index-O5NQ6O4f.js} +1 -1
- package/dist/assets/{lexical-BtWXzxnq.js → lexical-B4Vx7iXM.js} +1 -1
- package/dist/assets/{liveblocks-DtuUpF5h.js → liveblocks-CSh_vLcI.js} +1 -1
- package/dist/assets/{lottie-BlG_vWSt.js → lottie-CkDkDB9t.js} +1 -1
- package/dist/assets/{mui-DAOUhz91.js → mui-DxxQrDXb.js} +1 -1
- package/dist/assets/{pathToGoBack-CcxULKW_.js → pathToGoBack-CVTu70jh.js} +1 -1
- package/dist/assets/{pdf-iocWnEuY.js → pdf-B5u-xbSo.js} +3 -3
- package/dist/assets/{pdf-lib-BLLTrAOR.js → pdf-lib-reHt5MEc.js} +1 -1
- package/dist/assets/{plaid-DBHSfOGH.js → plaid-BETTZw7O.js} +1 -1
- package/dist/assets/{pusher-3cjBHlw_.js → pusher-Ckps79Gu.js} +1 -1
- package/dist/assets/{react-DLzgi1In.js → react-2QuTt-Yq.js} +1 -1
- package/dist/assets/{react-vdYrKzLj.js → react-BEHSpArB.js} +1 -1
- package/dist/assets/{react-BTlfsyLA.js → react-BwbSXuKk.js} +1 -1
- package/dist/assets/{react-DzzhDNXC.js → react-CnCpDB3_.js} +1 -1
- package/dist/assets/{react-CNVeotaZ.js → react-D5AIOkBV.js} +1 -1
- package/dist/assets/{react-D62BIM3q.js → react-DAYatQOH.js} +1 -1
- package/dist/assets/{recharts-BMD3jyO6.js → recharts-TU-ixTpA.js} +1 -1
- package/dist/assets/{routePaths-CIClX-hy.js → routePaths-BOMJaLfj.js} +1 -1
- package/dist/assets/{sentry-BWDuLt7o.js → sentry-BbRn6Rps.js} +1 -1
- package/dist/assets/{stripSplatSuffix-KkY0P5Vm.js → stripSplatSuffix-CHEOIiL-.js} +1 -1
- package/dist/assets/{url-CCl9sM9J.js → url-COMcQU2v.js} +1 -1
- package/dist/assets/{url-YYqHrm-X.js → url-DFeqMB02.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-03OPYHW8.js → useActualMatchingMatchDetail-Boxo0AoI.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BdGVlzMy.js → useAiCfoDashboardSuggestedQuestionsChips-B1P2UXZw.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-ClE0s8SA.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-Z8m3rGDA.js → useChargeCardPusherEvents-XNiZ825w.js} +1 -1
- package/dist/assets/{useDeviceId-BRjUTxWs.js → useDeviceId-BNqfuCC6.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-xLk05vNk.js → useEmailConnectResultRefresh-C4LXGHtc.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-Decdti18.js → useInitialThreadRequest-8iuM_OK9.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-CSCgZk-0.js → useTaskManagerAccess-Cv2RmrOC.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-9oqzMu2Z.js → useTaskManagerPusherEvents-D5RRqeH4.js} +1 -1
- package/dist/assets/{utils-CWVNtCN5.js → utils-CG6WKZWt.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-BKpEvUWX.js → withTransactionSidePanel-jttxQkuf.js} +5 -5
- package/dist/assets/{zeni-epic-state-BtP47QJT.js → zeni-epic-state-GGdMfKwk.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-D2DM52hy.js +0 -1
- package/dist/assets/AiCfoScreen-BWbqBoIu.js +0 -22
- package/dist/assets/CompanyPassportScreen-Cy2hV9k7.js +0 -1
- package/dist/assets/ConnectionAuthScreen-BBARCtpg.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-B9cNdta1.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-DaBtZTum.js +0 -30
- package/dist/assets/DomesticWireDetailScreen-BYIVpvay.js +0 -18
- package/dist/assets/EntityDetailRoutes-DaTOqhWC.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CDRkL0Tq.js +0 -1
- package/dist/assets/MagicLinkRoutes-Df_wnLE7.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-CByT-Ct-.js +0 -12
- package/dist/assets/NotFoundScreen-BbJtMThz.js +0 -1
- package/dist/assets/NotificationRoutes-CxCX3W_0.js +0 -1
- package/dist/assets/OAuthConsentScreen-luQCTUbA.js +0 -1
- package/dist/assets/PeopleRoutes-BInCnWy4.js +0 -22
- package/dist/assets/PerformanceRoutes-cn6KpA4Q.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-pw9U836q.js +0 -1
- package/dist/assets/RewardsRoutes--4mAjEXA.js +0 -1
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-DjYg30gm.js +0 -33
- package/dist/assets/ScreenRoutes-0M7Mtqep.js +0 -2
- package/dist/assets/SignOutScreen-iiZR9Vvf.js +0 -9
- package/dist/assets/TaskRoutes-Bq52Yuvt.js +0 -9
- package/dist/assets/TransactionDetailRoutes-DliVWUyB.js +0 -1
- package/dist/assets/TransactionListRoutes-DoKdE5EQ.js +0 -1
- package/dist/assets/WiseConfirmationScreen-CmQFx7C9.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-CoNFUylV.js +0 -9
- package/dist/assets/epic-BwpjzDGA.js +0 -2
- package/dist/assets/expenseAutomationHelper-BwdyIQYD.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BeCZgIua.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-DtuUpF5h.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Qe,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-Dk5JD2l2.js";import{fV as _t,a07 as cs,g5 as Pt,bu as Fe,a08 as is,a09 as ds,fK as hn,a0a as _n,fT as Pn,a0b as wn,a0c as vn,a0d as Tn,a0e as Fn,fU as xn,g4 as Ln,a0f as Bn,a0g as ls,f_ as us,fZ as ms,a0h as Cs,Kg as Rn,g7 as ia,a0i as ps,a0j as hs,fM as fs,fL as gs,gk as We,g0 as On,f$ as Un,a0k as bs,g1 as Ss,JO as ys,JN as Is,JR as ks,JT as Es,gd as As,fH as jn,a0l as Ds,a0m as _s,gi as Mn,a0n as Ps,gj as St,JZ as ws,JW as vs,fI as ge,a0o as Za,d$ as xe,dj as Le,e0 as Be,h1 as da,cC as la,a0p as ua,a0q as wt,D5 as Ga,ma as $a,a0r as Ka,Kw as Ia,g8 as Je,Ky as vt,m0 as Nn,a0s as ma,Kk as Da,a0t as Ts,a0u as Fs,Kn as qa,a0v as xs,Zj as Ja,g3 as Vn,Kt as ga,it as Ls,a0w as Hn,fW as Ca,br as Bs,a0x as Rs,gJ as Qa,gI as Xa,L0 as Os,gH as et,a0y as Gn,cv as $n,db as Us,Zi as Pa,LB as Kn,a0z as fn,Lb as _a,a0A as zn,LC as js,ZJ as Ms,LD as Ns,ML as Vs,Cl as Hs,MF as Gs,a0B as $s,Kx as oa,a0C as Ks,a0D as zs,a0E as Ws,a0F as Ys,a0G as Zs,a0H as Tt,a0I as qs,KN as Wn,KG as Js,a0J as Qs,h3 as Xs,a0K as Yn,KW as Zn,K_ as qn,h2 as eo,a0L as ao,Ln as Jn,a0M as to,a0N as no,a0O as ro,KY as Qn,KJ as Xn,Kq as er,KS as ar,KQ as tr,KU as so,a0P as nr,a0Q as oo,gf as co,gg as io,gh as lo,a0R as at,g9 as rr,dd as Ft,a0S as uo,a0T as mo,a0U as Co,a0V as po,L6 as yt,Lu as ho,Lq as fo,L2 as go,Ls as bo,Li as So,Lk as yo,a0W as sr,LA as Ha,Su as Io,a0X as ko,a0Y as Eo,a0Z as Ao,a0_ as or,a0$ as Do,LX as _o,La as cr,L5 as Ne,L9 as Po,a10 as wo,a11 as vo,Kh as To,a12 as ir,g2 as dr,a13 as Fo,Kj as xo,Ki as gn,a14 as Lo,a15 as Bo,a16 as Ro,VC as Oo,a17 as xt,a18 as Uo,xr as lr,mK as jo,ii as Mo,M0 as No,a19 as ur,fQ as Vo,fR as Ho,a1a as Go,dQ as $o,g6 as Ko,LS as zo,LM as qe,bq as Wo,bK as Yo,cH as Zo,bL as qo,Ut as Jo}from"./zeni-epic-state-BtP47QJT.js";import{Q as Re,de as mr,a4 as we,df as Cr,dg as pr,dh as Qo,G as aa,as as Lt,di as Xo,dj as ec,a as hr,f as fr,ar as gr,p as Ee,c as de,g as q,l as Sa,dk as br,dl as ac,dm as tc,z as te,a7 as wa,d3 as tt,dn as nc,dp as rc,dq as sc,a1 as va,bi as Xe,bF as Bt,dr as oc,ab as Ta,Z as nt,E as Rt,m as ee,w as rt,ds as cc,bR as ba,dt as It,du as ic,a8 as Ot,dv as dc,ae as Sr,av as kt,dw as lc,aq as yr,U as Ir,V as kr,bn as uc,dx as mc,dy as Cc,dz as pc,dA as hc,dB as fc,dC as gc,N as za,dD as bc,dE as Sc,n as pt,d as yc,dF as Ic,dG as kc,dH as Ec,ai as Ac,dI as Dc,dJ as _c,k as Pc}from"./index-CaO8T0Mn.js";import{n as He,D as Er,S as wc}from"./mui-DAOUhz91.js";import{a as r}from"./sentry-BWDuLt7o.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-BeCZgIua.js";import{M as Ae}from"./MobileAppDrawer-r4WOmIWX.js";import{d as Ut}from"./recharts-BMD3jyO6.js";import{g as _e,a as xa,b as Ar,c as Oe,d as Ue,e as ea,f as ta,h as na,A as vc,i as jt,P as Tc,j as Mt,s as ya,k as Dr,l as ca,m as _r,n as Fc,o as Pr,p as xc,S as bn}from"./SetupPagesScreen-BJMKj009.js";import{u as wr}from"./useInitialThreadRequest-Decdti18.js";import st from"./NotFoundScreen-BbJtMThz.js";import{u as Nt}from"./useChargeCardPusherEvents-Z8m3rGDA.js";import{n as Sn}from"./utils-CWVNtCN5.js";import{t as Lc}from"./AddressScreen-icxXA3w4.js";import"./analytics-C6U4wpfB.js";import"./plaid-DBHSfOGH.js";import"./dnd-CSZKLHxv.js";import"./stripe-cKAAJElX.js";import"./lottie-BlG_vWSt.js";import"./lexical-BtWXzxnq.js";import"./pdf-iocWnEuY.js";import"./InboxNotificationsProvider-D6GwXgCp.js";import"./useTaskManagerAccess-CSCgZk-0.js";import"./BusinessVerificationPageScreen-XOO4dt2W.js";import"./routePaths-CIClX-hy.js";import"./analyticsHelper-qAafKEWE.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]="f18484ce-d61f-4ddf-bb8d-ae6138d79201",e._sentryDebugIdIdentifier="sentry-dbid-f18484ce-d61f-4ddf-bb8d-ae6138d79201")}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}},vr=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 Tr(){const e=le(),a=d((t=>_t(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=d((P=>_n(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>vn(P.cardPolicyState))),S=d((P=>Tn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>_t(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{D!=="Completed"&&D!=="In-Progress"&&t(Ln())}),[t,D]),Tr();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]),G=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(vr)),[i.cards]),M=D==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:G,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,G,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const z=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]),W=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),Z=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=r.useCallback((()=>{t(hn())}),[t]),T=r.useRef(j);r.useEffect((()=>{const P=T.current;T.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(We({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const v=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(Qo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:v,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:W,onClickMenuIcon:u,onFormChange:_,onSubmit:Z,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Qe,{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((v=>{A(v)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((v=>bs(v))),O=d((v=>_n(v.cardPolicyState))),U=d((v=>Pn(v.cardPolicyState))),S=d((v=>wn(v.cardPolicyState))),c=d((v=>vn(v.cardPolicyState))),p=d((v=>Tn(v.cardPolicyState))),x=d((v=>Fn(v.cardPolicyState))),E=d((v=>xn(v.cardPolicyState))),I=d((v=>_t(v.cardPolicyState))),k=d((v=>Rn(v))),V=d((v=>t!=null?Ss(v.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 v=C.detailFetchState.fetchState;C.templateId===t&&(v==="Completed"||v==="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]),Tr();const y=d((v=>v.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((v=>!mr(v.status.code))).map(vr)),[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]),[G,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||G!=null||R==null||(L.current=!0,M(R))}),[G,R]);const z=r.useCallback((v=>{M(v)}),[]),j=r.useMemo((()=>Ut((v=>{s(Pt(v))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((v=>{j(v)}),[j]),H=C.updateFetchState.fetchState,W=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??W;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,W]),Z=r.useCallback((()=>{e(W)}),[e,W]),N=r.useCallback((v=>{if(t==null)return;const P=Cr(v);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const v=$.current;$.current=H,H==="Completed"&&v!=="Completed"&&(s(We({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(W))}),[s,H,e,W]);const T=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Qe,{to:"..",replace:!0}):G!=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:G,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:T,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:Z,onClickMenuIcon:l,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:_,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}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))),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:$c}}}}=aa.getLocalizedStrings(),Kc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function zc(){const e=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:D}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>Ds(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>_s(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),Dt),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(We({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(We({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:W,isFileUploadEnabled:_}=h,Z=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:T,setIsAiCfoOpen:v}=hr(),P=fr(),ae=gr(),Ce=d((J=>jn(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:ve}=xr("card_policy"),Ie=r.useMemo((()=>Fr(X,ve,3)),[X,ve]),[re,be]=r.useState(""),pe=ae&&P&&$!=null&&!T,he=r.useCallback((J=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);Z(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,Z,$]),oe=r.useCallback((J=>{J.trim().length!==0&&(be(""),he(J))}),[he]),Q=r.useCallback((()=>{const J=re.trim();J.length!==0&&(be(""),he(J))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{be(J)}),[]),fe=r.useCallback((()=>{v(!0)}),[v]),Te=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&W)return{aiAgentName:$c,headline:Hc,subheadline:Gc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:_,onInputChange:De,onSubmit:Q,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:Te,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,W,_,Ce,De,Te,fe,oe,Se,Q,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=D&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,G=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]),z=r.useCallback((h=>{t(vs(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:G,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:G,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function Wc(){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=>Za(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=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:D,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,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((X=>L!=null?Ga(X.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((X=>j!=null?$a(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,W=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=W?.accountingClassIDs[0],Z=d((X=>_!=null?$a(X.classState,{classId:_,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",$=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n(Ka()),$&&n(We({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,$]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(G(!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=_e(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(Je()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(vt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const T=()=>{if(t!=null&&a!=null){n(Ka());const X=_e(s.tenantEmailDomain,a,t);e(X)}},v=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(v,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:T,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:z?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:Z?.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",Gt="charge-card-limit-reset",$t="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}`)),Zc=[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(Ts({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Jc(){const e=ie(),a=le(),n=me(),t=te.getSignedInUser(),s=d((D=>ge(D))),[f,b]=r.useState(!1),m=d((D=>ma(D))),A=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),u=r.useCallback((()=>{const D=we(n.state?.pathnameStackToGoBack),C=D.poppedPathname??Qc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Zc),onEvent:D=>{switch(D){case Ba:case La:return void a(Da(!0))}},onSubscribed:()=>{a(Da(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(Da()))}),[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 Qc=e=>`/${e}/cards`,Xc={containerWidth:new Ta(100,58)},ei=({appContent:e})=>{const a=va(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,D]=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((Z=>ge(Z)));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((Z=>Fs(Z,s))),E=x.chargeCard,I=d((Z=>Z.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),G=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:G,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),z=!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,z,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 Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(Z,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Ja()),t(Z,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((Z=>Vn(Z.userState,U.userId))),W=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((Z=>Z.statusCode==="success"))===!0&&B===!1&&(setTimeout(W,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=Z=>{O(Z)};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:_}),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:()=>{_(!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(Qa(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-CSh_vLcI.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Qe,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-BTRpO5kD.js";import{fV as _t,a06 as cs,g5 as Pt,bu as Fe,a07 as is,a08 as ds,fK as hn,a09 as _n,fT as Pn,a0a as wn,a0b as vn,a0c as Tn,a0d as Fn,fU as xn,g4 as Ln,a0e as Bn,a0f as ls,f_ as us,fZ as ms,a0g as Cs,Kf as Rn,g7 as ia,a0h as ps,a0i as hs,fM as fs,fL as gs,gk as We,g0 as On,f$ as Un,a0j as bs,g1 as Ss,JN as ys,JM as Is,JQ as ks,JS as Es,gd as As,fH as jn,a0k as Ds,a0l as _s,gi as Mn,a0m as Ps,gj as St,JY as ws,JV as vs,fI as ge,a0n as Za,d$ as xe,dj as Le,e0 as Be,h1 as da,cC as la,a0o as ua,a0p as wt,D4 as Ga,ma as $a,a0q as Ka,Kv as Ia,g8 as Je,Kx as vt,m0 as Nn,a0r as ma,Kj as Da,a0s as Ts,a0t as Fs,Km as qa,a0u as xs,Zi as Ja,g3 as Vn,Ks as ga,it as Ls,a0v as Hn,fW as Ca,br as Bs,a0w as Rs,gJ as Qa,gI as Xa,K$ as Os,gH as et,a0x as Gn,cv as $n,db as Us,Zh as Pa,LA as Kn,a0y as fn,La as _a,a0z as zn,LB as js,ZI as Ms,LC as Ns,MK as Vs,Ck as Hs,ME as Gs,a0A as $s,Kw as oa,a0B as Ks,a0C as zs,a0D as Ws,a0E as Ys,a0F as Zs,a0G as Tt,a0H as qs,KM as Wn,KF as Js,a0I as Qs,h3 as Xs,a0J as Yn,KV as Zn,KZ as qn,h2 as eo,a0K as ao,Lm as Jn,a0L as to,a0M as no,a0N as ro,KX as Qn,KI as Xn,Kp as er,KR as ar,KP as tr,KT as so,a0O as nr,a0P as oo,gf as co,gg as io,gh as lo,a0Q as at,g9 as rr,dd as Ft,a0R as uo,a0S as mo,a0T as Co,a0U as po,L5 as yt,Lt as ho,Lp as fo,L1 as go,Lr as bo,Lh as So,Lj as yo,a0V as sr,Lz as Ha,St as Io,a0W as ko,a0X as Eo,a0Y as Ao,a0Z as or,a0_ as Do,LW as _o,L9 as cr,L4 as Ne,L8 as Po,a0$ as wo,a10 as vo,Kg as To,a11 as ir,g2 as dr,a12 as Fo,Ki as xo,Kh as gn,a13 as Lo,a14 as Bo,a15 as Ro,VB as Oo,a16 as xt,a17 as Uo,xq as lr,mK as jo,ii as Mo,L$ as No,a18 as ur,fQ as Vo,fR as Ho,a19 as Go,dQ as $o,g6 as Ko,LR as zo,LL as qe,bq as Wo,bK as Yo,cH as Zo,bL as qo,Us as Jo}from"./zeni-epic-state-GGdMfKwk.js";import{W as Re,de as mr,a4 as we,df as Cr,dg as pr,dh as Qo,G as aa,as as Lt,di as Xo,dj as ec,a as hr,e as fr,ar as gr,p as Ee,c as de,g as q,l as Sa,dk as br,dl as ac,dm as tc,z as te,a7 as wa,d3 as tt,dn as nc,dp as rc,dq as sc,a1 as va,bi as Xe,bF as Bt,dr as oc,ab as Ta,Z as nt,E as Rt,m as ee,w as rt,ds as cc,bR as ba,dt as It,du as ic,a8 as Ot,dv as dc,ae as Sr,av as kt,dw as lc,aq as yr,X as Ir,T as kr,bn as uc,dx as mc,dy as Cc,dz as pc,dA as hc,dB as fc,dC as gc,N as za,dD as bc,dE as Sc,n as pt,y as yc,dF as Ic,dG as kc,dH as Ec,ai as Ac,dI as Dc,dJ as _c,h as Pc}from"./index-BUq8vLqs.js";import{n as He,D as Er,S as wc}from"./mui-DxxQrDXb.js";import{a as r}from"./sentry-BbRn6Rps.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-ClE0s8SA.js";import{M as Ae}from"./MobileAppDrawer-FDyQcQG6.js";import{d as Ut}from"./recharts-TU-ixTpA.js";import{g as _e,a as xa,b as Ar,c as Oe,d as Ue,e as ea,f as ta,h as na,A as vc,i as jt,P as Tc,j as Mt,s as ya,k as Dr,l as ca,m as _r,n as Fc,o as Pr,p as xc,S as bn}from"./SetupPagesScreen-D70oyW5d.js";import{u as wr}from"./useInitialThreadRequest-8iuM_OK9.js";import st from"./NotFoundScreen-Pkv6JCVI.js";import{u as Nt}from"./useChargeCardPusherEvents-XNiZ825w.js";import{n as Sn}from"./utils-CG6WKZWt.js";import{t as Lc}from"./AddressScreen-BwYO5U79.js";import"./analytics-Bwul-sh2.js";import"./plaid-BETTZw7O.js";import"./dnd-2ZjyQ0g9.js";import"./stripe-cKAAJElX.js";import"./lottie-CkDkDB9t.js";import"./lexical-B4Vx7iXM.js";import"./pdf-B5u-xbSo.js";import"./InboxNotificationsProvider-RMyde6sE.js";import"./useTaskManagerAccess-Cv2RmrOC.js";import"./BusinessVerificationPageScreen-DNvCS3RC.js";import"./routePaths-BOMJaLfj.js";import"./analyticsHelper-D_76GpgW.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]="03d79009-6126-4384-9961-6100847ff9dd",e._sentryDebugIdIdentifier="sentry-dbid-03d79009-6126-4384-9961-6100847ff9dd")}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}},vr=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 Tr(){const e=le(),a=d((t=>_t(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=d((P=>_n(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>vn(P.cardPolicyState))),S=d((P=>Tn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>_t(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{D!=="Completed"&&D!=="In-Progress"&&t(Ln())}),[t,D]),Tr();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]),G=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(vr)),[i.cards]),M=D==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:G,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,G,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const z=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]),W=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),Z=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=r.useCallback((()=>{t(hn())}),[t]),T=r.useRef(j);r.useEffect((()=>{const P=T.current;T.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(We({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const v=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(Qo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:v,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:W,onClickMenuIcon:u,onFormChange:_,onSubmit:Z,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Qe,{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((v=>{A(v)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((v=>bs(v))),O=d((v=>_n(v.cardPolicyState))),U=d((v=>Pn(v.cardPolicyState))),S=d((v=>wn(v.cardPolicyState))),c=d((v=>vn(v.cardPolicyState))),p=d((v=>Tn(v.cardPolicyState))),x=d((v=>Fn(v.cardPolicyState))),E=d((v=>xn(v.cardPolicyState))),I=d((v=>_t(v.cardPolicyState))),k=d((v=>Rn(v))),V=d((v=>t!=null?Ss(v.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 v=C.detailFetchState.fetchState;C.templateId===t&&(v==="Completed"||v==="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]),Tr();const y=d((v=>v.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((v=>!mr(v.status.code))).map(vr)),[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]),[G,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||G!=null||R==null||(L.current=!0,M(R))}),[G,R]);const z=r.useCallback((v=>{M(v)}),[]),j=r.useMemo((()=>Ut((v=>{s(Pt(v))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((v=>{j(v)}),[j]),H=C.updateFetchState.fetchState,W=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??W;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,W]),Z=r.useCallback((()=>{e(W)}),[e,W]),N=r.useCallback((v=>{if(t==null)return;const P=Cr(v);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const v=$.current;$.current=H,H==="Completed"&&v!=="Completed"&&(s(We({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(W))}),[s,H,e,W]);const T=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Qe,{to:"..",replace:!0}):G!=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:G,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:T,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:Z,onClickMenuIcon:l,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:_,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}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))),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:$c}}}}=aa.getLocalizedStrings(),Kc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function zc(){const e=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:D}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>Ds(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>_s(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),Dt),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(We({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(We({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:W,isFileUploadEnabled:_}=h,Z=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:T,setIsAiCfoOpen:v}=hr(),P=fr(),ae=gr(),Ce=d((J=>jn(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:ve}=xr("card_policy"),Ie=r.useMemo((()=>Fr(X,ve,3)),[X,ve]),[re,be]=r.useState(""),pe=ae&&P&&$!=null&&!T,he=r.useCallback((J=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);Z(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,Z,$]),oe=r.useCallback((J=>{J.trim().length!==0&&(be(""),he(J))}),[he]),Q=r.useCallback((()=>{const J=re.trim();J.length!==0&&(be(""),he(J))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{be(J)}),[]),fe=r.useCallback((()=>{v(!0)}),[v]),Te=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&W)return{aiAgentName:$c,headline:Hc,subheadline:Gc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:_,onInputChange:De,onSubmit:Q,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:Te,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,W,_,Ce,De,Te,fe,oe,Se,Q,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=D&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,G=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]),z=r.useCallback((h=>{t(vs(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:G,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:G,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function Wc(){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=>Za(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=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:D,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,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((X=>L!=null?Ga(X.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((X=>j!=null?$a(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,W=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=W?.accountingClassIDs[0],Z=d((X=>_!=null?$a(X.classState,{classId:_,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",$=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n(Ka()),$&&n(We({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,$]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(G(!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=_e(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(Je()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(vt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const T=()=>{if(t!=null&&a!=null){n(Ka());const X=_e(s.tenantEmailDomain,a,t);e(X)}},v=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(v,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:T,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:z?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:Z?.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",Gt="charge-card-limit-reset",$t="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}`)),Zc=[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(Ts({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Jc(){const e=ie(),a=le(),n=me(),t=te.getSignedInUser(),s=d((D=>ge(D))),[f,b]=r.useState(!1),m=d((D=>ma(D))),A=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),u=r.useCallback((()=>{const D=we(n.state?.pathnameStackToGoBack),C=D.poppedPathname??Qc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Zc),onEvent:D=>{switch(D){case Ba:case La:return void a(Da(!0))}},onSubscribed:()=>{a(Da(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(Da()))}),[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 Qc=e=>`/${e}/cards`,Xc={containerWidth:new Ta(100,58)},ei=({appContent:e})=>{const a=va(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,D]=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((Z=>ge(Z)));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((Z=>Fs(Z,s))),E=x.chargeCard,I=d((Z=>Z.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),G=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:G,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),z=!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,z,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 Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(Z,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Ja()),t(Z,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((Z=>Vn(Z.userState,U.userId))),W=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((Z=>Z.statusCode==="success"))===!0&&B===!1&&(setTimeout(W,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=Z=>{O(Z)};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:_}),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:()=>{_(!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(Qa(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)}%`};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-CSh_vLcI.js";import{a as g}from"./sentry-BbRn6Rps.js";import{h as w,u as T,g as x,i as k,j as O,l as E}from"./core-BTRpO5kD.js";import{z as N,bs as F,a8 as P,m as L,T as V,s as b,bt as j,ae as A,aG as U,p as B}from"./index-BUq8vLqs.js";import{fI as D,gL as G,BL as M,gG as R,c9 as _,Yr as Y,bn as z,v1 as H,uR as Z,mC as $,ob as S,Ys as q,bF as J,cF as C,om as K,ow as Q}from"./zeni-epic-state-GGdMfKwk.js";import"./mui-DxxQrDXb.js";import{d as W}from"./routePaths-BOMJaLfj.js";import{M as X}from"./MobileAppDrawer-FDyQcQG6.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="15bc0f4b-2491-4737-838d-4e8a9d6628e6",t._sentryDebugIdIdentifier="sentry-dbid-15bc0f4b-2491-4737-838d-4e8a9d6628e6")}catch{}})();const ee=E((function(t){const a=R(t),i=N.getSignedInUser(),p=D(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=_(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:z(i)}}),(function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(Q())},onAddressClick:e=>{const n=W(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(K({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(q(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t($({files:e}))},onDeleteFile:e=>{t(Z(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=T(),i=x(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(G(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(M())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:L,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{j as I}from"./liveblocks-CSh_vLcI.js";import{a as o}from"./sentry-BbRn6Rps.js";import{u as F,h as R,g as H,j as C,N as w}from"./core-BTRpO5kD.js";import{U5 as q,fI as z,go as G,pV as V,gP as U,gn as Q,gl as B,Uv as J,gk as A}from"./zeni-epic-state-GGdMfKwk.js";import{u as K,z as E,L as D,G as M,N as W}from"./index-BUq8vLqs.js";import{n as X}from"./mui-DxxQrDXb.js";import{P as h,a as T}from"./AccountMappingScreen-D3djYfgp.js";import{t as Y}from"./getLocaleForTenant-DKQ9xDck.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-rYcXSEuv.js";import"./recharts-TU-ixTpA.js";import"./analytics-Bwul-sh2.js";import"./plaid-BETTZw7O.js";import"./dnd-2ZjyQ0g9.js";import"./stripe-cKAAJElX.js";import"./lottie-CkDkDB9t.js";import"./lexical-B4Vx7iXM.js";import"./pdf-B5u-xbSo.js";import"./utils-CG6WKZWt.js";import"./MobileAppDrawer-FDyQcQG6.js";import"./InboxNotificationsProvider-RMyde6sE.js";import"./useTaskManagerAccess-Cv2RmrOC.js";import"./accountMappingHelper-CDXfdGYB.js";import"./empty-Cb7Nu9Hh.js";import"./pdf-lib-reHt5MEc.js";import"./index-EIrua76A.js";import"./url-COMcQU2v.js";import"./index-Ds59pPsN.js";import"./decodeURIComponentSafe-gQrUmSgy.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]="efa2a614-00e1-4012-a1b1-58014dbfd98e",t._sentryDebugIdIdentifier="sentry-dbid-efa2a614-00e1-4012-a1b1-58014dbfd98e")}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=R(),_=H(),{setLoading:m,clearAllLoading:c}=K(),S=o.useRef(!1),b=o.useRef(!1),N=o.useRef(!1),p=o.useRef(!1),{code:O,realmId:$,state:L}=Z(_.search),f=O!==""&&$!==""&&L!=="";f&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===T.pending,P=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,d=e?.externalConnections?.saveConnectionState,y=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{m(D.CONNECTION_AUTH)}),[m]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(m(D.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,m]),o.useEffect((()=>{e.tenantId==null&&!b.current&&a!=null&&(b.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(V(a.userId)))}),[b,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(m(D.CONNECTION_AUTH),t(U(a.userId,e.tenantId)))}),[d]),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(U(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{x.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(x.tenantsCoreDetailsInOrder)}),[x.tenantsCoreDetailsInOrder.length,n]);const v=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||c()}),[n,r,l]),o.useEffect((()=>{u&&d==="In-Progress"&&(p.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||v)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return p.current&&d==="Completed"?(sessionStorage.setItem(h,T.ready),c(),void i(s,{replace:!0})):p.current&&d==="Error"?(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),c(),void i(s,{replace:!0})):void(f||N.current||p.current||y!==!0||(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),c(),i(s,{replace:!0})))}),[u,v,d,f,y,e.tenantEmailDomain,c,t,i]),v)return null;if(f||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return P?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-CSh_vLcI.js";import{z as m}from"./index-BUq8vLqs.js";import{g as n}from"./QBOConnectionScreen-rYcXSEuv.js";import"./sentry-BbRn6Rps.js";import{g as p,N as a}from"./core-BTRpO5kD.js";import"./zeni-epic-state-GGdMfKwk.js";import"./recharts-TU-ixTpA.js";import"./mui-DxxQrDXb.js";import"./analytics-Bwul-sh2.js";import"./plaid-BETTZw7O.js";import"./dnd-2ZjyQ0g9.js";import"./stripe-cKAAJElX.js";import"./lottie-CkDkDB9t.js";import"./lexical-B4Vx7iXM.js";import"./pdf-B5u-xbSo.js";import"./utils-CG6WKZWt.js";import"./empty-Cb7Nu9Hh.js";import"./pdf-lib-reHt5MEc.js";import"./index-EIrua76A.js";import"./url-COMcQU2v.js";import"./index-Ds59pPsN.js";import"./decodeURIComponentSafe-gQrUmSgy.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]="a1205b81-d106-415b-bd92-85aeae53ace3",t._sentryDebugIdIdentifier="sentry-dbid-a1205b81-d106-415b-bd92-85aeae53ace3")}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};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-CSh_vLcI.js";import{t as wn,A as Me}from"./AddressScreen-BwYO5U79.js";import An from"./NotFoundScreen-Pkv6JCVI.js";import{a as d,t as $e}from"./sentry-BbRn6Rps.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-BTRpO5kD.js";import{fI as X,e0 as Ee,d$ as we,bq as jn,Um as Bn,bS as Fn,pT as Vn,Bv as Un,By as Rn,VJ as Ln,VK as Nn,lx as Oe,lA as dn,UZ as Gn,c0 as Mn,c9 as fe,BZ as Ae,BK as $n,VL as me,B_ as un,Sw as Qn,mK as ln,dj as pn,VM as Kn,VN as zn,uK as qn,UM as Ce,hY as Hn,UL as be,hV as Zn,Go as Jn,uO as Wn,hN as Yn,hQ as Qe,VO as mn,VP as Xn,Me as et,VQ as nt,Mi as tt,BB as at,VR as ot,VS as st,lv as rt,ly as it,Ca as ct,BM as gn,BY as dt,bF as Ke,cF as ut,C9 as ze,v1 as lt,uR as pt,mC as mt,gJ as gt,gI as ft,gH as yt,VT as ht,BE as Ct,Cb as bt,Ce as St,Ch as It,Cn as kt,dk as Ot}from"./zeni-epic-state-GGdMfKwk.js";import{z,c as Pe,g as W,A as vt,p as q,a8 as re,m as g,aE as _t,ai as fn,a1 as Tt,y as yn,W as hn,l as Y,Z as ge,T as ve,aF as xt,N as qe,C as He,ae as Et,aG as Ze,aH as wt,aI as At}from"./index-BUq8vLqs.js";import{n as De}from"./mui-DxxQrDXb.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-rYcXSEuv.js";import{u as jt,a as Bt}from"./useEmailConnectResultRefresh-C4LXGHtc.js";import{u as Ft}from"./useChargeCardPusherEvents-XNiZ825w.js";import"./recharts-TU-ixTpA.js";import"./analytics-Bwul-sh2.js";import"./plaid-BETTZw7O.js";import"./dnd-2ZjyQ0g9.js";import"./stripe-cKAAJElX.js";import"./lottie-CkDkDB9t.js";import"./lexical-B4Vx7iXM.js";import"./pdf-B5u-xbSo.js";import"./utils-CG6WKZWt.js";import"./empty-Cb7Nu9Hh.js";import"./pdf-lib-reHt5MEc.js";import"./index-EIrua76A.js";import"./url-COMcQU2v.js";import"./index-Ds59pPsN.js";import"./decodeURIComponentSafe-gQrUmSgy.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]="d75e2f07-588a-420c-aef4-cef4c0dee99c",e._sentryDebugIdIdentifier="sentry-dbid-d75e2f07-588a-420c-aef4-cef4c0dee99c")}catch{}})();const Je=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:C}=t(W.isApAgingFeatureEnabled),{isFeatureEnabled:a}=t(W.isArAgingFeatureEnabled),{isFeatureEnabled:A}=t(W.isReferralFeatureEnabled),{isFeatureEnabled:w}=t(W.isDebitCardFeatureEnabled),k=vt(),O=E((S=>X(S))),P=E((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=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,h=_?.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"),h===!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=[];C===!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 Z=Bn(S,V);return Fn(Z.reportsInOrder.map((M=>({fetchState:M.fetchState,error:M.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||o||m||b||(p(!0),i(Vn(n.userId,F,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:Je(L?.businessVerified?.status),isKycDone:Je(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"],We=(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}))},Ye=(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
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
5
|
+
`,en=De.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
|
|
12
|
+
${e=>e.skipLegacyDrawerOffset?`
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding-left: ${qe.sp0};
|
|
15
|
+
`:`
|
|
16
|
+
min-width: calc(100% - ${He}px);
|
|
17
|
+
padding-left: ${He}px;
|
|
18
|
+
`}
|
|
19
|
+
|
|
20
|
+
${e=>e.theme.breakpoints.down("md")} {
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding-left: ${qe.sp0};
|
|
23
|
+
}
|
|
24
|
+
|
|
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),C=Ae(e,i),a=mn(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xn(e.userRoleConfigState);return{onboardingCustomerView:C,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,C)=>{e(St(n,t,C))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(Ct(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((C=>{const{officerType:a,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:F,syncToken:m,selectDocument:b,role:D,ownership:U,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,isPhoneVerified:x}=C;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?Ze(P.selectedOption):void 0,phone:F,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:U,documentTypeSelectedForVerification:f,isSelectedForVerification:h,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(ht({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:C,companyIndustryType:a,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:F,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:U,stateOfIncorporation:h,incDate:r,companySourceOfFunds:T,companySourceOfFundsDescription:x,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:Z,usNexusTypes:M}=n,$={companyId:i,companyDescription:t,companyIndustry:C.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:h?.selectedOption??"",companySourceOfFunds:T?.selectedOption??"",companySourceOfFundsDescription:x,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:Ze(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:Z,usNexusTypes:M?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:$,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),a=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:a}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),a=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:a}})},onUpdateCustomerView:(n,t,C,a)=>{e(dt(i,!1,t,C,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,C)=>{e(rt(n,t,C))},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,C]=d.useState(!1),[a,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=xe(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(W.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)),h=E((y=>X(y))),r=E((y=>y.userRoleConfigState.fetchState)),T=E((y=>y.cardPaymentViewState)),x=Y(T.addCardPaymentSourceStatus.fetchState),f=T.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pt(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,V=L?.connectionId??"",Z=z.getSignedInUser()?.userId??"",M=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,Z)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Gn(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:Z},Mn(window.location.origin+"/onboarding/auth"))),M.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",h.tenantEmailDomain)}),[b]);const $=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),R=E((y=>Ae(y,$)));d.useEffect((()=>{t||b!=="Not-Started"||$==null||(C(!0),c($n($,!0,!m)))}),[t,b,$]);const ne=h.externalConnections?.saveConnectionState,je=Y(ne);d.useEffect((()=>{je==="In-Progress"&&(ne==="Completed"||ne==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess(M.current.realmId,M.current.connectionId):g.trackOnboardingQBOConnectionFailed(M.current.realmId,M.current.connectionId,h.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 Cn=Y(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Cn==null&&c(ln({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=R.isInterimEmailSent,Be=z.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const Sn=Ee(F,h),In=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(h),On=h.productSettings.isTreasuryEnabled,Ue=Ut({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:$}),Re=(({companyId:y})=>{const K=se(),de=E((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),te=E((B=>X(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Un())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||te||K(Rn(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const B=`private-encrypted-${y}`;return[`${B}.ledger-ingestion.counts-updated`,`${B}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((B,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(B!=="ledger-ingestion.counts-updated"){if(B==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",J=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:J==="starting"||J==="building"||J==="ready"?J:"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 Ft({events:vn,onEvent:_n,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=We(B,Se),I=We(B,Ie),ue=Ye(B,Se),J=Ye(B,Ie),Ne=B.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:J,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:$});if(Fe===!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:$,currentTenant:h,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&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Fe===!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:$,currentTenant:h,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&&h.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}=Bt({companyId:i}),n=E((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=E((r=>X(r))),C=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,F=Y(P);d.useEffect((()=>{F==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,F,_]);const m=a.externalConnections?.saveOAuthConnectionState,b=a.externalConnections?.saveOAuthConnectionError?.message,D=Y(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,h=Y(U);return d.useEffect((()=>{const r=U??{},T=h??{},x=a.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(T[f]!=="In-Progress")return;let j;try{j=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",x[f]?.message??"")}))}),[U,h,a]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:a,isLoading:C==="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?Ce(x):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",T),o(Yn(k,r,be(T)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Wn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{a.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Jn())},onSaveChargeBeeCredentials:(r,T)=>{const x=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;x!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),o(Zn(k,x,be("revenue"),Ce("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,C,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
|
+
display: flex;
|
|
28
|
+
height: 100vh;
|
|
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(W.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=xe(),n=hn(),[t,C]=d.useState(!1);d.useEffect((()=>{t===!1&&o.state?.message==="OnboardingThankyou"&&C(!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)),F=a.company?.companyOnboardingInfo.isOnboardingCompleted;if(F!==!0||w)return _==="Completed"&&F===!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"&&F===!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 $e=="function"?$e():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(Me,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Me,{})})}),s.jsx(H,{path:"*",element:s.jsx(An,{})})]})}export{pa as default};
|