@zeniai/web-app-ui 5.3.68-qa → 5.3.69-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-BJ8Qa3VP.js → AccountMappingScreen-CAQA7lne.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-CUTPqWRI.js → ActualMatchingMatchDetailScreen-BifxUBTA.js} +1 -1
- package/dist/assets/AddressRoutes-D2DM52hy.js +1 -0
- package/dist/assets/{AddressScreen-CWOiTvRF.js → AddressScreen-icxXA3w4.js} +2 -2
- package/dist/assets/{AiCfoScreen-DvC4fPmH.js → AiCfoScreen-BWbqBoIu.js} +5 -5
- package/dist/assets/AppDrawer-hE6okzG9.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-C_Af8HsQ.js → BillPayApprovalRoutes-eAwSxg7-.js} +1 -1
- package/dist/assets/{BillPayRoutes-CY-9HU6O.js → BillPayRoutes-CPSa9tRu.js} +18 -18
- package/dist/assets/{BusinessVerificationPageScreen-BhBRQ4et.js → BusinessVerificationPageScreen-XOO4dt2W.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-aHg-_2GW.js → CardsAiCfoScreen-oZaMLLYZ.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-CBr3gp6R.js → ChargeCardRoutes-CR22MdW5.js} +1 -1
- package/dist/assets/CompanyPassportScreen-Cy2hV9k7.js +1 -0
- package/dist/assets/{ConnectionAuthScreen-C0fuz1UE.js → ConnectionAuthScreen-BBARCtpg.js} +2 -2
- package/dist/assets/CustomerOnboardingAuthScreen-B9cNdta1.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-Dv2Suyn4.js → CustomerOnboardingRoutes-DaBtZTum.js} +3 -3
- package/dist/assets/{DashboardRoutes-z64cgLkz.js → DashboardRoutes-ksNQmz1b.js} +4 -4
- package/dist/assets/{DefaultTenantHome-Ble5mI0T.js → DefaultTenantHome-6h7pYNWH.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-D90iGLbr.js → DomesticWireDetailScreen-BYIVpvay.js} +3 -3
- package/dist/assets/{DrawerScreen-CS-aklyB.js → DrawerScreen-D2sNIMxZ.js} +1 -1
- package/dist/assets/EntityDetailRoutes-DaTOqhWC.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-BQ7YbuTZ.js → ExpenseAutomationRoutes-WQsWVsrz.js} +7 -7
- package/dist/assets/FeaturePreviewScreen-DrW5sKTA.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-CDRkL0Tq.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-BLd671md.js → InboxNotificationsProvider-D6GwXgCp.js} +1 -1
- package/dist/assets/{InvoicingRoutes-0OZERb2r.js → InvoicingRoutes-EwIfHCd8.js} +2 -2
- package/dist/assets/MagicLinkRoutes-Df_wnLE7.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-CByT-Ct-.js +12 -0
- package/dist/assets/MobileAppDrawer-r4WOmIWX.js +1 -0
- package/dist/assets/NotFoundScreen-BbJtMThz.js +1 -0
- package/dist/assets/NotificationRoutes-CxCX3W_0.js +1 -0
- package/dist/assets/OAuthConsentScreen-luQCTUbA.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-DNnwlAH1.js +1 -0
- package/dist/assets/PaymentLinkScreen-C_1-1L8E.js +21 -0
- package/dist/assets/PeopleRoutes-BInCnWy4.js +22 -0
- package/dist/assets/PerformanceRoutes-cn6KpA4Q.js +1 -0
- package/dist/assets/{Preview-DjryQabZ.js → Preview-CCdAPHVf.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-C19Z9_90.js → QBOConnectionScreen-Cbteo3If.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-pw9U836q.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-4bQKYZkQ.js → ReimbursementApprovalRuleDetailScreen-Bs4p5t9E.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-N-41IZRW.js → ReimbursementRoutes-BbvmwzbP.js} +5 -5
- package/dist/assets/{ReportsRoutes-BHkhb0Qh.js → ReportsRoutes-DHQlYB_r.js} +1 -1
- package/dist/assets/RewardsRoutes--4mAjEXA.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BVoPXeMk.js → ScheduleDetailsPrepaidExpensesScreen-DjYg30gm.js} +5 -5
- package/dist/assets/ScreenRoutes-0M7Mtqep.js +2 -0
- package/dist/assets/{SettingsRoutes-C_2Y15w6.js → SettingsRoutes-CN7GV-oe.js} +6 -6
- package/dist/assets/{SetupPagesScreen-CpgaPU76.js → SetupPagesScreen-BJMKj009.js} +5 -5
- package/dist/assets/SignInScreen-atM-bsdO.js +1 -0
- package/dist/assets/SignOutScreen-iiZR9Vvf.js +9 -0
- package/dist/assets/{TaskListScreen-D8invzcS.js → TaskListScreen-B70VtP2u.js} +2 -2
- package/dist/assets/TaskRoutes-Bq52Yuvt.js +9 -0
- package/dist/assets/TransactionDetailRoutes-DliVWUyB.js +1 -0
- package/dist/assets/{TransactionDetailScreen-CEy0Lwxl.js → TransactionDetailScreen-1gITEJfr.js} +2 -2
- package/dist/assets/TransactionListRoutes-DoKdE5EQ.js +1 -0
- package/dist/assets/{TreasuryRoutes-BiUKGCs0.js → TreasuryRoutes-DWmpGaGA.js} +5 -5
- package/dist/assets/{VendorsRoutes-Dp-0KASn.js → VendorsRoutes-B0HnUIhj.js} +11 -11
- package/dist/assets/WiseConfirmationScreen-CmQFx7C9.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-DRc9w9vd.js → ZeniAccountRoutes-BI-IsmW_.js} +8 -8
- package/dist/assets/ZeniAccountStatementScreen-CoNFUylV.js +9 -0
- package/dist/assets/{accountMappingHelper-DDpt4thU.js → accountMappingHelper-D-qmKFUw.js} +1 -1
- package/dist/assets/{analytics-HUGlc_YA.js → analytics-C6U4wpfB.js} +1 -1
- package/dist/assets/{analyticsHelper-CiUO2xmL.js → analyticsHelper-qAafKEWE.js} +1 -1
- package/dist/assets/{core-BAlzhg_1.js → core-Dk5JD2l2.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-BlS7R_TX.js → decodeURIComponentSafe-NBY1IhYb.js} +1 -1
- package/dist/assets/{dnd-CtBfGkHE.js → dnd-CSZKLHxv.js} +1 -1
- package/dist/assets/{empty-Bi7Yf941.js → empty-CDCQLT9Y.js} +1 -1
- package/dist/assets/{empty-BRHFv2sW.js → empty-D0msLZIr.js} +1 -1
- package/dist/assets/{emptyVideoElement-63TR5aDR.js → emptyVideoElement-EOYyzQLg.js} +1 -1
- package/dist/assets/epic-BwpjzDGA.js +2 -0
- package/dist/assets/expenseAutomationHelper-BwdyIQYD.js +1 -0
- package/dist/assets/{getLocaleForTenant-CaSkczur.js → getLocaleForTenant-Tff_ZVu3.js} +1 -1
- package/dist/assets/{index-BvIRHYdj.js → index-BFxiz-4U.js} +1 -1
- package/dist/assets/{index-CGTcDwKM.js → index-B_rhGKNa.js} +1 -1
- package/dist/assets/{index-C3vxNQm5.js → index-B_zuMfAK.js} +1 -1
- package/dist/assets/{index-CWRZ55RL.js → index-BzY7ptmA.js} +1 -1
- package/dist/assets/{index-Df4gn8fh.js → index-CTXzqHUs.js} +2 -2
- package/dist/assets/{index-BuzwqQko.js → index-CaO8T0Mn.js} +15208 -15208
- package/dist/assets/{index-DGpWyM9Y.js → index-Cos3hzZM.js} +1 -1
- package/dist/assets/{index-DuPam2hY.js → index-Cr97VFCj.js} +1 -1
- package/dist/assets/{lexical-CpUvnOjl.js → lexical-BtWXzxnq.js} +1 -1
- package/dist/assets/{liveblocks-Cmn0IneY.js → liveblocks-DtuUpF5h.js} +1 -1
- package/dist/assets/{lottie-CqVjxmYG.js → lottie-BlG_vWSt.js} +1 -1
- package/dist/assets/{mui-BP68m4Fu.js → mui-DAOUhz91.js} +1 -1
- package/dist/assets/{pathToGoBack-WCSQSILz.js → pathToGoBack-CcxULKW_.js} +1 -1
- package/dist/assets/{pdf-DVoBxypI.js → pdf-iocWnEuY.js} +3 -3
- package/dist/assets/{pdf-lib-CfwiSXQl.js → pdf-lib-BLLTrAOR.js} +1 -1
- package/dist/assets/{plaid-D_c1UYI3.js → plaid-DBHSfOGH.js} +1 -1
- package/dist/assets/{pusher-HOxR7Sbp.js → pusher-3cjBHlw_.js} +1 -1
- package/dist/assets/{react-S7mn4-ov.js → react-BTlfsyLA.js} +1 -1
- package/dist/assets/{react-C7Adach0.js → react-CNVeotaZ.js} +1 -1
- package/dist/assets/{react-DxMuJXc7.js → react-D62BIM3q.js} +1 -1
- package/dist/assets/{react-CAp25EsP.js → react-DLzgi1In.js} +1 -1
- package/dist/assets/{react-AUOblSvr.js → react-DzzhDNXC.js} +1 -1
- package/dist/assets/{react-Deo915rj.js → react-vdYrKzLj.js} +1 -1
- package/dist/assets/{recharts-BDERfoBp.js → recharts-BMD3jyO6.js} +1 -1
- package/dist/assets/{routePaths-DcA1oXkd.js → routePaths-CIClX-hy.js} +1 -1
- package/dist/assets/{sentry-D-L93P51.js → sentry-BWDuLt7o.js} +1 -1
- package/dist/assets/{stripSplatSuffix--MOgwIwN.js → stripSplatSuffix-KkY0P5Vm.js} +1 -1
- package/dist/assets/{url-D0vuH2sS.js → url-CCl9sM9J.js} +1 -1
- package/dist/assets/{url-BDV8gAHg.js → url-YYqHrm-X.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-DOPTximW.js → useActualMatchingMatchDetail-03OPYHW8.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-IAyDtzKt.js → useAiCfoDashboardSuggestedQuestionsChips-BdGVlzMy.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BeCZgIua.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-eJ5TdEHr.js → useChargeCardPusherEvents-Z8m3rGDA.js} +1 -1
- package/dist/assets/{useDeviceId-BjLcJw5r.js → useDeviceId-BRjUTxWs.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-xLk05vNk.js +1 -0
- package/dist/assets/{useInitialThreadRequest-ZgjjBFJn.js → useInitialThreadRequest-Decdti18.js} +1 -1
- package/dist/assets/useTaskManagerAccess-CSCgZk-0.js +1 -0
- package/dist/assets/{useTaskManagerPusherEvents-BIpJN20u.js → useTaskManagerPusherEvents-9oqzMu2Z.js} +1 -1
- package/dist/assets/{utils-DrMX637r.js → utils-CWVNtCN5.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-CttEmIwT.js → withTransactionSidePanel-BKpEvUWX.js} +4 -4
- package/dist/assets/{zeni-epic-state-CGi26_dN.js → zeni-epic-state-BtP47QJT.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-d5LhRwCF.js +0 -1
- package/dist/assets/AppDrawer-sgx8j8j9.js +0 -10
- package/dist/assets/CompanyPassportScreen-BK1e1SIF.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-f4F2AbNk.js +0 -1
- package/dist/assets/EntityDetailRoutes-CO4aShHt.js +0 -1
- package/dist/assets/FeaturePreviewScreen-Dnb7hWMs.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-LrZ63Z1U.js +0 -1
- package/dist/assets/MagicLinkRoutes-wPgg-u3j.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-Da53S421.js +0 -12
- package/dist/assets/MobileAppDrawer-BIq9690g.js +0 -1
- package/dist/assets/NotFoundScreen-HysbkNZq.js +0 -1
- package/dist/assets/NotificationRoutes-CuDjIrFy.js +0 -1
- package/dist/assets/OAuthConsentScreen-4nBfdF35.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-DAOiKBBm.js +0 -1
- package/dist/assets/PaymentLinkScreen-BIZyCj8d.js +0 -21
- package/dist/assets/PeopleRoutes-CS6HbkWh.js +0 -22
- package/dist/assets/PerformanceRoutes-exxWd6LX.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-B5I76f_G.js +0 -1
- package/dist/assets/RewardsRoutes-e1Vu0waB.js +0 -1
- package/dist/assets/ScreenRoutes-EmcYY3HU.js +0 -2
- package/dist/assets/SignInScreen-CfajyxGt.js +0 -1
- package/dist/assets/SignOutScreen-CwY7bxuI.js +0 -9
- package/dist/assets/TaskRoutes-DHRiOgTO.js +0 -9
- package/dist/assets/TransactionDetailRoutes-q5pf-IIg.js +0 -1
- package/dist/assets/TransactionListRoutes-O9AQjdOx.js +0 -1
- package/dist/assets/WiseConfirmationScreen-oerpARUP.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-Dw1LsH1F.js +0 -9
- package/dist/assets/epic-ucHpX8wh.js +0 -2
- package/dist/assets/expenseAutomationHelper-D89gAMsk.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CPPivAFj.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-Ba_17xZV.js +0 -1
- package/dist/assets/useTaskManagerAccess-CGzprH0E.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-Cmn0IneY.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-BAlzhg_1.js";import{fV as _t,a05 as cs,g5 as Pt,bu as Fe,a06 as is,a07 as ds,fK as hn,a08 as _n,fT as Pn,a09 as wn,a0a as vn,a0b as Tn,a0c as Fn,fU as xn,g4 as Ln,a0d as Bn,a0e as ls,f_ as us,fZ as ms,a0f as Cs,Ke as Rn,g7 as ia,a0g as ps,a0h as hs,fM as fs,fL as gs,gk as We,g0 as On,f$ as Un,a0i as bs,g1 as Ss,JM as ys,JL as Is,JP as ks,JR as Es,gd as As,fH as jn,a0j as Ds,a0k as _s,gi as Mn,a0l as Ps,gj as St,JX as ws,JU as vs,fI as ge,a0m as Za,d$ as xe,dj as Le,e0 as Be,h1 as da,cC as la,a0n as ua,a0o as wt,D3 as Ga,ma as $a,a0p as Ka,Ku as Ia,g8 as Je,Kw as vt,m0 as Nn,a0q as ma,Ki as Da,a0r as Ts,a0s as Fs,Kl as qa,a0t as xs,Zh as Ja,g3 as Vn,Kr as ga,it as Ls,a0u as Hn,fW as Ca,br as Bs,a0v as Rs,gJ as Qa,gI as Xa,K_ as Os,gH as et,a0w as Gn,cv as $n,db as Us,Zg as Pa,Lz as Kn,a0x as fn,L9 as _a,a0y as zn,LA as js,ZH as Ms,LB as Ns,MJ as Vs,Cj as Hs,MD as Gs,a0z as $s,Kv as oa,a0A as Ks,a0B as zs,a0C as Ws,a0D as Ys,a0E as Zs,a0F as Tt,a0G as qs,KL as Wn,KE as Js,a0H as Qs,h3 as Xs,a0I as Yn,KU as Zn,KY as qn,h2 as eo,a0J as ao,Ll as Jn,a0K as to,a0L as no,a0M as ro,KW as Qn,KH as Xn,Ko as er,KQ as ar,KO as tr,KS as so,a0N as nr,a0O as oo,gf as co,gg as io,gh as lo,a0P as at,g9 as rr,dd as Ft,a0Q as uo,a0R as mo,a0S as Co,a0T as po,L4 as yt,Ls as ho,Lo as fo,L0 as go,Lq as bo,Lg as So,Li as yo,a0U as sr,Ly as Ha,Ss as Io,a0V as ko,a0W as Eo,a0X as Ao,a0Y as or,a0Z as Do,LV as _o,L8 as cr,L3 as Ne,L7 as Po,a0_ as wo,a0$ as vo,Kf as To,a10 as ir,g2 as dr,a11 as Fo,Kh as xo,Kg as gn,a12 as Lo,a13 as Bo,a14 as Ro,VA as Oo,a15 as xt,a16 as Uo,xp as lr,mK as jo,ii as Mo,L_ as No,a17 as ur,fQ as Vo,fR as Ho,a18 as Go,dQ as $o,g6 as Ko,LQ as zo,LK as qe,bq as Wo,bK as Yo,cH as Zo,bL as qo,Ur as Jo}from"./zeni-epic-state-CGi26_dN.js";import{K 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,N as de,m as q,j 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,T as nt,E as Rt,k 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,W as Ir,Q as kr,bn as uc,dx as mc,dy as Cc,dz as pc,dA as hc,dB as fc,dC as gc,I as za,dD as bc,dE as Sc,l as pt,c 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-BuzwqQko.js";import{n as He,D as Er,S as wc}from"./mui-BP68m4Fu.js";import{a as r}from"./sentry-D-L93P51.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-CPPivAFj.js";import{M as Ae}from"./MobileAppDrawer-BIq9690g.js";import{d as Ut}from"./recharts-BDERfoBp.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-CpgaPU76.js";import{u as wr}from"./useInitialThreadRequest-ZgjjBFJn.js";import st from"./NotFoundScreen-HysbkNZq.js";import{u as Nt}from"./useChargeCardPusherEvents-eJ5TdEHr.js";import{n as Sn}from"./utils-DrMX637r.js";import{t as Lc}from"./AddressScreen-CWOiTvRF.js";import"./analytics-HUGlc_YA.js";import"./plaid-D_c1UYI3.js";import"./dnd-CtBfGkHE.js";import"./stripe-cKAAJElX.js";import"./lottie-CqVjxmYG.js";import"./lexical-CpUvnOjl.js";import"./pdf-DVoBxypI.js";import"./InboxNotificationsProvider-BLd671md.js";import"./useTaskManagerAccess-CGzprH0E.js";import"./BusinessVerificationPageScreen-BhBRQ4et.js";import"./routePaths-DcA1oXkd.js";import"./analyticsHelper-CiUO2xmL.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]="691e4d2d-415e-411f-ab9d-b24f48e79f97",e._sentryDebugIdIdentifier="sentry-dbid-691e4d2d-415e-411f-ab9d-b24f48e79f97")}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-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`
|
|
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-DtuUpF5h.js";import{a as g}from"./sentry-BWDuLt7o.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-Dk5JD2l2.js";import{z as N,bs as F,a8 as P,m as V,V as L,s as b,bt as j,ae as A,aG as M,p as U}from"./index-CaO8T0Mn.js";import{fI as D,gL as B,BM as G,gG as R,c9 as _,Ys as Y,bn as z,v1 as H,uR as Z,mC as $,ob as S,Yt as q,bF as J,cF as C,om as K,ow as Q}from"./zeni-epic-state-BtP47QJT.js";import"./mui-DAOUhz91.js";import{d as W}from"./routePaths-CIClX-hy.js";import{M as X}from"./MobileAppDrawer-r4WOmIWX.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="d9431558-e3b8-4742-8e94-6cd3f09d132b",n._sentryDebugIdIdentifier="sentry-dbid-d9431558-e3b8-4742-8e94-6cd3f09d132b")}catch{}})();const ee=E((function(n){const a=R(n),i=N.getSignedInUser(),p=D(n),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(n.companyConfigState),t=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:t,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:z(i)}}),(function(n,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let t=e.href;t.includes("http")||(t="https://".concat(t)),window.open(t,"_blank")},onSaveAll:()=>{n(Q())},onAddressClick:e=>{const t=W(f,e),o=U(l.state?.pathnameStackToGoBack,l.pathname);c(t,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(K({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:t,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=t,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...t,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:t.industry.selectedOption,companyIndustryType:t.companyIndustryType?.selectedOption??void 0,companySubIndustry:t.companySubIndustry?.selectedOption??void 0,businessModel:t.businessModel.selectedOption??"",companySourceOfFunds:t.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:t.companySourceOfFundsDescription??void 0,countriesOfOperations:t.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:M(I)))??[],transactionVolume:t.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:t.transactionVolumeDescription??void 0,regulatedStatus:t.regulatedStatus??void 0,regulatedStatusDescription:t.regulatedStatusDescription??void 0,usNexus:t.usNexus??void 0,usNexusTypes:t.usNexusTypes?.selectedOptions??[],purposeOfAccount:t.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:t.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n(q(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n($({files:e}))},onDeleteFile:e=>{n(Z(e))},onEditFileName:(e,t)=>{n(H(e,t.split(".")[0]))}}}))(j);function de(){const n=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),t=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||t!=="Not-Started"||d==null||(l(!0),a(B(d)))}),[c,t,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(G())}),[o,a]);const u=s=>{e(s)},y=t==="Not-Started"||t==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&t==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(L.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as I}from"./liveblocks-
|
|
1
|
+
import{j as I}from"./liveblocks-DtuUpF5h.js";import{a as o}from"./sentry-BWDuLt7o.js";import{u as F,h as R,g as H,j as C,N as j}from"./core-Dk5JD2l2.js";import{U6 as q,fI as z,go as G,pV as V,gP as U,gn as Q,gl as B,Uw as J,gk as A}from"./zeni-epic-state-BtP47QJT.js";import{u as K,z as E,L as T,G as M,N as W}from"./index-CaO8T0Mn.js";import{n as X}from"./mui-DAOUhz91.js";import{P as b,a as _}from"./AccountMappingScreen-CAQA7lne.js";import{t as Y}from"./getLocaleForTenant-Tff_ZVu3.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-Cbteo3If.js";import"./recharts-BMD3jyO6.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"./utils-CWVNtCN5.js";import"./MobileAppDrawer-r4WOmIWX.js";import"./InboxNotificationsProvider-D6GwXgCp.js";import"./useTaskManagerAccess-CSCgZk-0.js";import"./accountMappingHelper-D-qmKFUw.js";import"./empty-CDCQLT9Y.js";import"./pdf-lib-BLLTrAOR.js";import"./index-BzY7ptmA.js";import"./url-CCl9sM9J.js";import"./index-BFxiz-4U.js";import"./decodeURIComponentSafe-NBY1IhYb.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]="6ceb3716-cbd8-4ca6-a1db-2f58e70cd1d4",t._sentryDebugIdIdentifier="sentry-dbid-6ceb3716-cbd8-4ca6-a1db-2f58e70cd1d4")}catch{}})();const te=X.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -8,4 +8,4 @@ import{j as I}from"./liveblocks-Cmn0IneY.js";import{a as o}from"./sentry-D-L93P5
|
|
|
8
8
|
height: 100vh;
|
|
9
9
|
background-color: ${t=>t.theme.colors.background};
|
|
10
10
|
box-shadow: ${t=>`0px 2px ${W.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
-
`;function
|
|
11
|
+
`;function je(){const t=F(),i=R(),v=H(),{setLoading:c,clearAllLoading:m}=K(),h=o.useRef(!1),S=o.useRef(!1),N=o.useRef(!1),p=o.useRef(!1),{code:O,realmId:$,state:L}=Z(v.search),f=O!==""&&$!==""&&L!=="";f&&(N.current=!0);const w=sessionStorage.getItem(b),u=w===_.pending,P=w===_.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((()=>{c(T.CONNECTION_AUTH)}),[c]),o.useEffect((()=>{h.current||a==null||g==null||(h.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(c(T.TENANT_FETCHING),t(G(a.userId,g))))}),[h,n,c]),o.useEffect((()=>{e.tenantId==null&&!S.current&&a!=null&&(S.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(V(a.userId)))}),[S,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(c(T.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 D=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&d==="In-Progress"&&(p.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||D)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return p.current&&d==="Completed"?(sessionStorage.setItem(b,_.ready),m(),void i(s,{replace:!0})):p.current&&d==="Error"?(sessionStorage.removeItem(b),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(f||N.current||p.current||y!==!0||(sessionStorage.removeItem(b),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,D,d,f,y,e.tenantEmailDomain,m,t,i]),D)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(j,{to:k,replace:!0}):I.jsx(j,{to:"/",replace:!0})}export{je as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-DtuUpF5h.js";import{z as m}from"./index-CaO8T0Mn.js";import{g as n}from"./QBOConnectionScreen-Cbteo3If.js";import"./sentry-BWDuLt7o.js";import{g as p,N as a}from"./core-Dk5JD2l2.js";import"./zeni-epic-state-BtP47QJT.js";import"./recharts-BMD3jyO6.js";import"./mui-DAOUhz91.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"./utils-CWVNtCN5.js";import"./empty-CDCQLT9Y.js";import"./pdf-lib-BLLTrAOR.js";import"./index-BzY7ptmA.js";import"./url-CCl9sM9J.js";import"./index-BFxiz-4U.js";import"./decodeURIComponentSafe-NBY1IhYb.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};
|
package/dist/assets/{CustomerOnboardingRoutes-Dv2Suyn4.js → CustomerOnboardingRoutes-DaBtZTum.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-
|
|
1
|
+
import{j as s}from"./liveblocks-DtuUpF5h.js";import{t as wn,A as Ge}from"./AddressScreen-icxXA3w4.js";import An from"./NotFoundScreen-BbJtMThz.js";import{a as d,t as Me}from"./sentry-BWDuLt7o.js";import{h as _e,g as xe,u as se,i as Te,j as E,N as Q,q as Pn,l as cn,n as Dn,o as H}from"./core-Dk5JD2l2.js";import{fI as X,e0 as Ee,d$ as we,bq as jn,Un as Bn,bS as Fn,pT as Vn,Bw as Un,Bz as Rn,VK as Ln,VL as Nn,lx as Oe,lA as dn,U_ as $n,c0 as Gn,c9 as fe,B_ as Ae,BL as Mn,VM as me,B$ as un,Sx as Qn,mK as ln,dj as pn,VN as Kn,VO as zn,uK as qn,UN as Ce,hY as Hn,UM as be,hV as Zn,Gp as Jn,uO as Wn,hN as Yn,hQ as Qe,VP as mn,VQ as Xn,Mf as et,VR as nt,Mj as tt,BC as at,VS as ot,VT as st,lv as rt,ly as it,Cb as ct,BN as gn,BZ as dt,bF as Ke,cF as ut,Ca as ze,v1 as lt,uR as pt,mC as mt,gJ as gt,gI as ft,gH as yt,VU as ht,BF as Ct,Cc as bt,Cf as St,Ci as It,Co as kt,dk as Ot}from"./zeni-epic-state-BtP47QJT.js";import{z,c as Pe,g as W,h as vt,p as q,a8 as re,m as g,aE as _t,ai as fn,a1 as xt,d as yn,Q as hn,l as Y,Z as ge,V as ve,aF as Tt,N as qe,y as He,ae as Et,aG as Ze,aH as wt,aI as At}from"./index-CaO8T0Mn.js";import{n as De}from"./mui-DAOUhz91.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-Cbteo3If.js";import{u as jt,a as Bt}from"./useEmailConnectResultRefresh-xLk05vNk.js";import{u as Ft}from"./useChargeCardPusherEvents-Z8m3rGDA.js";import"./recharts-BMD3jyO6.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"./utils-CWVNtCN5.js";import"./empty-CDCQLT9Y.js";import"./pdf-lib-BLLTrAOR.js";import"./index-BzY7ptmA.js";import"./url-CCl9sM9J.js";import"./index-BFxiz-4U.js";import"./decodeURIComponentSafe-NBY1IhYb.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]="9dcde0bb-cb89-4353-a196-e06b5c53fa98",e._sentryDebugIdIdentifier="sentry-dbid-9dcde0bb-cb89-4353-a196-e06b5c53fa98")}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=xe(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=Te(),n=z.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:C}=t(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=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),x=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,T=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),x===!1&&D.push("bill_pay_card","bill_pay_promo_card"),T===!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"),o===!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((G=>({fetchState:G.fetchState,error:G.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Vn(n.userId,F,O.tenantId,!0,!1,D)))}),[a,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]),$=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($,6e3);return()=>clearTimeout(S)}),[$]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||$()}),[u,f,m,b,$]),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:$})]})},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((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Ye=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Xe=De.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${e=>e.theme.colors.grey4};
|
|
@@ -23,8 +23,8 @@ import{j as s}from"./liveblocks-Cmn0IneY.js";import{t as wn,A as $e}from"./Addre
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
-
`,nn=cn((function(e,l){const{companyId:i,isAdmin:a,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),o=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:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;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:o,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:x,isPhoneVerified:T}=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:o,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?Je(P.selectedOption):void 0,phone:F,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:U,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:x,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:T}}));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:o,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:x,companySourceOfFundsDescription:T,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:J,usNexusTypes:$}=n,M={companyId:i,companyDescription:t,companyIndustry:C.selectedOption,companyIndustryType:o?.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:x?.selectedOption??"",companySourceOfFundsDescription:T,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:Je(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:J,usNexusTypes:$?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(n,t,C)=>{e(dt(i,!1,t,C,n))},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})))}}}))(Tt),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=fn(),p=_e(),u=xe(),c=se(),v=xt(),n=yn(),[t,C]=d.useState(!1),[o,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=Te(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(Z.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)),x=E((y=>y.cardPaymentViewState)),T=W(x.addCardPaymentSourceStatus.fetchState),f=x.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??"",J=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(A(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{w||(dn(["card"]),k(!0))}),[w]),d.useEffect((()=>{T==="In-Progress"&&f==="Completed"&&c(Oe())}),[T,f]),d.useEffect((()=>{Dt(j,N,G,V,J)===!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:J},$n(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:V},g.trackOnboardingSaveQBOConnection(N,V),p(u.pathname))}),[j,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),R=E((y=>Ae(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(C(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=h.externalConnections?.saveConnectionState,je=W(ne);d.useEffect((()=>{je==="In-Progress"&&(ne==="Completed"||ne==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,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=W(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:M}),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:"",Y=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:Y==="starting"||Y==="building"||Y==="ready"?Y:"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=Ze(B,Se),I=Ze(B,Ie),ue=We(B,Se),Y=We(B,Ie),Ne=B.some((En=>En.status!=="idle")),oe=!te&&!Ne,Ge=te&&!Ne,xn=Ge?Se.map((()=>"building")):ae,Tn=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:xn,backgroundRowStatuses:oe?void 0:Tn,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Y,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:M});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:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("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:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("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 a=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)),o=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((()=>{a(qn(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,F=W(P);d.useEffect((()=>{F==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,F,_]);const m=o.externalConnections?.saveOAuthConnectionState,b=o.externalConnections?.saveOAuthConnectionError?.message,D=W(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const U=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=W(U);return d.useEffect((()=>{const r=U??{},x=h??{},T=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(x[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",T[f]?.message??"")}))}),[U,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,x])=>[r,x?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,x)=>{const T=o.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(T==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:x,connection_id:T,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,x)=>{const T=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=T!=null?Ce(T):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",x),a(Wn(k,r,be(x)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Yn())},onSaveChargeBeeCredentials:(r,x)=>{const T=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;T!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Jn(k,T,be("revenue"),Ce("chargebee"),{api_key:r,site:x})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(Hn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,o,C,w,p,k,l,e,a,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 a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const on=De.div`
|
|
26
|
+
`,nn=cn((function(e,l){const{companyId:i,isAdmin:a,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),o=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:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;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:o,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:x,isPhoneVerified:T}=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:o,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:x,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:T}}));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:o,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:x,companySourceOfFundsDescription:T,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:$,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:Z,usNexusTypes:G}=n,M={companyId:i,companyDescription:t,companyIndustry:C.selectedOption,companyIndustryType:o?.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:x?.selectedOption??"",companySourceOfFundsDescription:T,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:Ze(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:Z,usNexusTypes:G?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(n,t,C)=>{e(dt(i,!1,t,C,n))},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})))}}}))(Tt),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=fn(),p=_e(),u=xe(),c=se(),v=xt(),n=yn(),[t,C]=d.useState(!1),[o,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=Te(),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)),x=E((y=>y.cardPaymentViewState)),T=Y(x.addCardPaymentSourceStatus.fetchState),f=x.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:$}=Pt(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,V=L?.connectionId??"",Z=z.getSignedInUser()?.userId??"",G=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(A(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{w||(dn(["card"]),k(!0))}),[w]),d.useEffect((()=>{T==="In-Progress"&&f==="Completed"&&c(Oe())}),[T,f]),d.useEffect((()=>{Dt(j,N,$,V,Z)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c($n(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:Z},Gn(window.location.origin+"/onboarding/auth"))),G.current={realmId:N,connectionId:V},g.trackOnboardingSaveQBOConnection(N,V),p(u.pathname))}),[j,N,$,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),R=E((y=>Ae(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(C(!0),c(Mn(M,!0,!m)))}),[t,b,M]);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(G.current.realmId,G.current.connectionId):g.trackOnboardingQBOConnectionFailed(G.current.realmId,G.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:M}),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,$e=te&&!Ne,xn=$e?Se.map((()=>"building")):ae,Tn=$e?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:xn,backgroundRowStatuses:oe?void 0:Tn,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:M});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:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("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:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("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 a=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)),o=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((()=>{a(qn(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.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=o.externalConnections?.saveOAuthConnectionState,b=o.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=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=Y(U);return d.useEffect((()=>{const r=U??{},x=h??{},T=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(x[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",T[f]?.message??"")}))}),[U,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,x])=>[r,x?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,x)=>{const T=o.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(T==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:x,connection_id:T,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,x)=>{const T=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=T!=null?Ce(T):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",x),a(Yn(k,r,be(x)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Wn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Jn())},onSaveChargeBeeCredentials:(r,x)=>{const T=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;T!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Zn(k,T,be("revenue"),Ce("chargebee"),{api_key:r,site:x})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(Hn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,o,C,w,p,k,l,e,a,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 a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const on=De.div`
|
|
27
27
|
display: flex;
|
|
28
28
|
height: 100vh;
|
|
29
29
|
background-color: ${e=>e.theme.colors.grey4};
|
|
30
|
-
`,sn=cn((function(e,l){const{companyId:i,currentTenant:a}=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(a?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:a}}),(function(e,l){const{currentTenant:i,themeState:a,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{a.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(),a=xe(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(
|
|
30
|
+
`,sn=cn((function(e,l){const{companyId:i,currentTenant:a}=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(a?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:a}}),(function(e,l){const{currentTenant:i,themeState:a,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{a.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(),a=xe(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(W.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=Te(),n=hn(),[t,C]=d.useState(!1);d.useEffect((()=>{t===!1&&a.state?.message==="OnboardingThankyou"&&C(!0)}),[a.state]);const o=E((m=>X(m))),A=o.productSettings.isOtherProductsEnabled,w=A===!0&&!pn(o);d.useEffect((()=>{i(gn(k,!1,!w))}),[]);const k=o.companyId??z.getSignedInUserTenant(v)?.companyId;if(n.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Ee(c,o),P=we(o),_=E((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),F=o.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(o.productSettings))}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,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:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):s.jsx(wt,{});{const m={pathnameStackToGoBack:a.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rn(){return typeof Me=="function"?Me():void 0}let pe=0;function Lt(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const a=()=>{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)&&a()}),1e3)),()=>{l=!0,a(),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(Ge,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(H,{path:"*",element:s.jsx(An,{})})]})}export{pa as default};
|