@zeniai/web-app-ui 5.3.63-dev → 5.3.64-qa
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-BRZHYOUR.js → AccountMappingScreen-DivKdf2Z.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-CT_TfQgQ.js → ActualMatchingMatchDetailScreen-BVGeVheO.js} +1 -1
- package/dist/assets/AddressRoutes-BokWmAg8.js +1 -0
- package/dist/assets/{AddressScreen-CrINuapd.js → AddressScreen-rwxaZTG1.js} +2 -2
- package/dist/assets/{AiCfoScreen-BXw0LDjo.js → AiCfoScreen-bINGDW9e.js} +1 -1
- package/dist/assets/{AppDrawer-DZIMVdFc.js → AppDrawer-Dp7qEJuM.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-Dp_PkbIk.js → BillPayApprovalRoutes-B_lv7T-J.js} +1 -1
- package/dist/assets/{BillPayRoutes-CUUjBefv.js → BillPayRoutes-0Sw-GQIA.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-DFamYzxa.js → BusinessVerificationPageScreen-D3HFVVs1.js} +2 -2
- package/dist/assets/CardsAiCfoScreen-oXR70NHe.js +14 -0
- package/dist/assets/{ChargeCardRoutes-DzIBuJeY.js → ChargeCardRoutes-GPeivNsL.js} +1 -1
- package/dist/assets/CompanyPassportScreen-BQIdqUeH.js +1 -0
- package/dist/assets/ConnectionAuthScreen-B6OliLVm.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-CBVP8bsG.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CjmJGGJm.js → CustomerOnboardingRoutes-C0r1dw1S.js} +3 -3
- package/dist/assets/{DashboardRoutes-ByHBLKcB.js → DashboardRoutes-DiVKBsiD.js} +4 -4
- package/dist/assets/{DefaultTenantHome-Dm9FOXup.js → DefaultTenantHome-BrlnSikW.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-086WQWRB.js → DomesticWireDetailScreen-sF9fArJp.js} +3 -3
- package/dist/assets/{DrawerScreen-B5BqRZEJ.js → DrawerScreen-_LTFqCkp.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-BuN3sXNp.js → EntityDetailRoutes-4B2Yzc2k.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-Ce3IicTe.js → ExpenseAutomationRoutes-BO6oNRaR.js} +7 -7
- package/dist/assets/FeaturePreviewScreen--_B7whPE.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-BRUwb2B6.js → HubSpotOAuthCallbackScreen-DYtx9CHZ.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-x0fdv66l.js → InboxNotificationsProvider-CYNlrTK-.js} +1 -1
- package/dist/assets/InvoicingRoutes-B76qsOVo.js +2 -0
- package/dist/assets/{MagicLinkRoutes-C5BKMtwW.js → MagicLinkRoutes-BLMLAWL4.js} +8 -8
- package/dist/assets/{MagicLinkSignInScreen-9LYlxmop.js → MagicLinkSignInScreen-ul8q5KIh.js} +1 -1
- package/dist/assets/{MobileAppDrawer-DX2JnkbM.js → MobileAppDrawer-B_iTAp0X.js} +1 -1
- package/dist/assets/NotFoundScreen-ytl2lDpJ.js +1 -0
- package/dist/assets/{NotificationRoutes-DICT3yoM.js → NotificationRoutes-CHchBCXf.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BmiLDdxn.js → OAuthConsentScreen-ByZnDGsv.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-DAq9XRB1.js → PandLWithForecastRoutes-CEbI4eNj.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-Cz1wlNqO.js → PaymentLinkScreen-Bp_f7EM0.js} +9 -9
- package/dist/assets/{PeopleRoutes-DgYtveDU.js → PeopleRoutes-Bnjxv-wy.js} +5 -5
- package/dist/assets/{PerformanceRoutes-B6iTINLg.js → PerformanceRoutes-D_c4D-Lq.js} +1 -1
- package/dist/assets/{Preview-Dz6yJNce.js → Preview-Cqz8sG2s.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-D8eeXRWb.js → QBOConnectionScreen-TwPTSdM4.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CE6y6IwA.js → ReimbursementApprovalRoutes-WuV-IA60.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BT_O_PEv.js → ReimbursementApprovalRuleDetailScreen-NNjpXxDw.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-BmOT-3C-.js → ReimbursementRoutes-VHBLpzUI.js} +4 -4
- package/dist/assets/{ReportsRoutes-CqUKv9Uh.js → ReportsRoutes-LNVh_-sv.js} +1 -1
- package/dist/assets/RewardsRoutes-CoqgpEpv.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CLEogplJ.js → ScheduleDetailsPrepaidExpensesScreen-BtoKhMiB.js} +5 -5
- package/dist/assets/{ScreenRoutes-xDjhbdP1.js → ScreenRoutes-59q3MUGL.js} +2 -2
- package/dist/assets/{SettingsRoutes-QcMcR-j3.js → SettingsRoutes-C4j0IBI2.js} +4 -4
- package/dist/assets/{SetupPagesScreen-fuvb0IYd.js → SetupPagesScreen-7E5X1hE5.js} +5 -5
- package/dist/assets/SignInScreen-CEUScjMX.js +1 -0
- package/dist/assets/SignOutScreen-BIBuRC_E.js +9 -0
- package/dist/assets/{TaskListScreen-C2urPjKT.js → TaskListScreen-lzy6FFpY.js} +2 -2
- package/dist/assets/{TaskRoutes-BuzkCbPW.js → TaskRoutes-DiG1t9-7.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-B0iRCFEi.js +1 -0
- package/dist/assets/{TransactionDetailScreen-CQr1YyP0.js → TransactionDetailScreen-CeJRenTr.js} +2 -2
- package/dist/assets/{TransactionListRoutes-BTidVr9Z.js → TransactionListRoutes-YHpSLzO6.js} +1 -1
- package/dist/assets/{TreasuryRoutes-CbD79DO8.js → TreasuryRoutes-BjSaj-AP.js} +5 -5
- package/dist/assets/{VendorsRoutes-CCYu89Uf.js → VendorsRoutes-CeQ2Hysa.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-B0HeU8Sh.js → WiseConfirmationScreen-DgytZSXe.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-CoRmS3Mc.js → ZeniAccountRoutes-wpK9n9Q7.js} +9 -9
- package/dist/assets/{ZeniAccountStatementScreen-BnpFJ5jB.js → ZeniAccountStatementScreen-DbrLHVIs.js} +1 -1
- package/dist/assets/{accountMappingHelper-tmyjt9rr.js → accountMappingHelper-Gh8rpbjD.js} +1 -1
- package/dist/assets/analytics-S5MhEivL.js +68 -0
- package/dist/assets/{analyticsHelper-BEL0ra9X.js → analyticsHelper-vbAuZJHT.js} +1 -1
- package/dist/assets/{core-CHD8T-IM.js → core-Cc7wW2EM.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-p_nrn8Pg.js → decodeURIComponentSafe-DhqIXi_U.js} +1 -1
- package/dist/assets/{dnd-Dwi6R-ey.js → dnd-DEyyKSEC.js} +1 -1
- package/dist/assets/{empty-CeRjDJvl.js → empty-6MFM8UPN.js} +1 -1
- package/dist/assets/{empty-CZC5CrVC.js → empty-CjY9w6q2.js} +1 -1
- package/dist/assets/{emptyVideoElement-BQ5qxpg6.js → emptyVideoElement-MGXFhhLz.js} +1 -1
- package/dist/assets/{epic-BW8jUHg5.js → epic-D9Y6xcsI.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-kGR6VZFG.js → expenseAutomationHelper-iXuIUZiF.js} +1 -1
- package/dist/assets/{getLocaleForTenant-D-or0iZO.js → getLocaleForTenant-rFLZBDSf.js} +1 -1
- package/dist/assets/{index-BVHBHjSe.js → index-2QCkbhu2.js} +1 -1
- package/dist/assets/{index-BMy5YH8G.js → index-BZ6qOKkD.js} +1 -1
- package/dist/assets/{index-DKH4PK2B.js → index-CFXYM6OK.js} +4561 -4561
- package/dist/assets/{index-yiW1aZfy.js → index-Cm43WhAF.js} +2 -2
- package/dist/assets/{index-CKiMoeFX.js → index-D2oCZR3F.js} +1 -1
- package/dist/assets/{index-XRUedCJ0.js → index-DpnxiqBj.js} +1 -1
- package/dist/assets/{index-C1KaIuMT.js → index-gtGWrJ79.js} +1 -1
- package/dist/assets/{index-w09kaOHP.js → index-ldlm2cjp.js} +1 -1
- package/dist/assets/{lexical-CMNdypK6.js → lexical-DXgKWO29.js} +1 -1
- package/dist/assets/{liveblocks-e6rGc1UF.js → liveblocks-CgHUgeBY.js} +1 -1
- package/dist/assets/{lottie-B778bt56.js → lottie-C1A2hiZE.js} +1 -1
- package/dist/assets/{mui-NTaF3UaY.js → mui-C4zFSCiU.js} +1 -1
- package/dist/assets/{pathToGoBack-3T3qt1CN.js → pathToGoBack-C17GqrA7.js} +1 -1
- package/dist/assets/{pdf-lib-CSbJ_JNk.js → pdf-lib-CsM74zBq.js} +1 -1
- package/dist/assets/{pdf-Bx92ZlM_.js → pdf-rXyPRm1U.js} +3 -3
- package/dist/assets/{plaid-DdTo7m1-.js → plaid-vsHcqLdj.js} +1 -1
- package/dist/assets/{pusher-TnSBrmnt.js → pusher-C0EhdUPA.js} +1 -1
- package/dist/assets/{react-BRi8TcMI.js → react-BU_8yW5D.js} +1 -1
- package/dist/assets/{react-Ci1ltUcy.js → react-CEepHjWP.js} +1 -1
- package/dist/assets/{react-Ba46BK4D.js → react-CzfY0Vx3.js} +1 -1
- package/dist/assets/{react-DJOUavGZ.js → react-DG8YneWb.js} +1 -1
- package/dist/assets/{react-B75Gnqob.js → react-Gc0eJCMR.js} +1 -1
- package/dist/assets/{react-COkaiBQo.js → react-Yy9ZuxR6.js} +1 -1
- package/dist/assets/{recharts-C6xUtcdL.js → recharts-DJGeJ2v_.js} +1 -1
- package/dist/assets/{routePaths-CGyE-cU7.js → routePaths-BvBrBOWH.js} +1 -1
- package/dist/assets/{sentry-DsyKtMW2.js → sentry-DSWD_gIh.js} +1 -1
- package/dist/assets/{stripSplatSuffix-CKrdD9MQ.js → stripSplatSuffix-kLnY55Qt.js} +1 -1
- package/dist/assets/{url-Zl9uXQ4e.js → url-DCbpXgdk.js} +1 -1
- package/dist/assets/{url-ClJewK9Y.js → url-DUlo21cY.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-Cc17Q5Tv.js → useActualMatchingMatchDetail-CF9oxT8n.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CHbHmZzx.js → useAiCfoDashboardSuggestedQuestionsChips-CDkZMoxt.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-QQl24-IT.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-BWi4_PP5.js → useChargeCardPusherEvents-CXbFOxvL.js} +1 -1
- package/dist/assets/{useDeviceId-VsdzmSZI.js → useDeviceId-B5zol9VP.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-ClXdZp-6.js → useEmailConnectResultRefresh-Dd25HleM.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-DDr_z_RH.js → useInitialThreadRequest-DIgkNFzN.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-CUv6a62x.js → useTaskManagerAccess-P-CWGdcX.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-DCIopLVZ.js → useTaskManagerPusherEvents-BREP8CYU.js} +1 -1
- package/dist/assets/{utils-CCA3F0sZ.js → utils-DiIEQ7_h.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-B_xgLNm6.js → withTransactionSidePanel-CF9KOU3s.js} +4 -4
- package/dist/assets/{zeni-epic-state-BO3zdDfL.js → zeni-epic-state-BVJjEVAA.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-CisWqyoC.js +0 -1
- package/dist/assets/CardsAiCfoScreen-Cx5KkOYw.js +0 -14
- package/dist/assets/CompanyPassportScreen-CENbDnLW.js +0 -1
- package/dist/assets/ConnectionAuthScreen-DTyZxcME.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-zLmHJyqv.js +0 -1
- package/dist/assets/FeaturePreviewScreen-D54Nwanb.js +0 -1
- package/dist/assets/InvoicingRoutes-IQsFojD0.js +0 -2
- package/dist/assets/NotFoundScreen-CtgFRYZy.js +0 -1
- package/dist/assets/RewardsRoutes-D5CR9NnI.js +0 -1
- package/dist/assets/SignInScreen-ekGlkjLH.js +0 -1
- package/dist/assets/SignOutScreen-9NJIr2hr.js +0 -9
- package/dist/assets/TransactionDetailRoutes-D99Yv6kv.js +0 -1
- package/dist/assets/analytics-C3e3An3a.js +0 -68
- package/dist/assets/useAskAiCfoHostNavButtonProps-BcCbRGDK.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-e6rGc1UF.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-CHD8T-IM.js";import{fS as _t,$X as cs,g2 as Pt,bt as Fe,$Y as is,$Z as ds,fH as hn,$_ as _n,fQ as Pn,$$ as wn,a00 as vn,a01 as Tn,a02 as Fn,fR as xn,g1 as Ln,a03 as Bn,a04 as ls,fX as us,fW as ms,a05 as Cs,K8 as Rn,g4 as ia,a06 as ps,a07 as hs,fJ as fs,fI as gs,gh as Ze,fZ as On,fY as Un,a08 as bs,f_ as Ss,JG as ys,JF as Is,JJ as ks,JL as Es,ga as As,fE as jn,a09 as Ds,a0a as _s,gf as Mn,a0b as Ps,gg as St,JR as ws,JO as vs,fF as ge,a0c as Wa,dZ as xe,di as Le,d_ as Be,g_ as da,cB as la,a0d as ua,a0e as wt,CZ as Ga,m7 as $a,a0f as Ka,Ko as Ia,g5 as Je,Kq as vt,lZ as Nn,a0g as ma,Kc as Da,a0h as Ts,a0i as Fs,Kf as qa,a0j as xs,Z8 as Ja,g0 as Vn,Kl as ga,iq as Ls,a0k as Hn,fT as Ca,br as Bs,a0l as Rs,gG as Qa,gF as Xa,KU as Os,gE as et,a0m as Gn,cu as $n,da as Us,Z7 as Pa,Lt as Kn,a0n as fn,L3 as _a,a0o as zn,Lu as js,Zx as Ms,Lv as Ns,MA as Vs,Cd as Hs,Mu as Gs,a0p as $s,Kp as oa,a0q as Ks,a0r as zs,a0s as Zs,a0t as Ys,a0u as Ws,a0v as Tt,a0w as qs,KF as Zn,Ky as Js,a0x as Qs,h0 as Xs,a0y as Yn,KO as Wn,KS as qn,g$ as eo,a0z as ao,Lf as Jn,a0A as to,a0B as no,a0C as ro,KQ as Qn,KB as Xn,Ki as er,KK as ar,KI as tr,KM as so,a0D as nr,a0E as oo,gc as co,gd as io,ge as lo,a0F as at,g6 as rr,dc as Ft,a0G as uo,a0H as mo,a0I as Co,a0J as po,K_ as yt,Lm as ho,Li as fo,KW as go,Lk as bo,La as So,Lc as yo,a0K as sr,Ls as Ha,Sj as Io,a0L as ko,a0M as Eo,a0N as Ao,a0O as or,a0P as Do,LP as _o,L2 as cr,KZ as Ne,L1 as Po,a0Q as wo,a0R as vo,K9 as To,a0S as ir,f$ as dr,a0T as Fo,Kb as xo,Ka as gn,a0U as Lo,a0V as Bo,a0W as Ro,Vr as Oo,a0X as xt,a0Y as Uo,xj as lr,mH as jo,ie as Mo,LU as No,a0Z as ur,fN as Vo,fO as Ho,a0_ as Go,dO as $o,g3 as Ko,LK as zo,LE as qe,bq as Zo,bJ as Yo,cG as Wo,bK as qo,Ui as Jo}from"./zeni-epic-state-BO3zdDfL.js";import{W as Re,df as mr,a5 as we,dg as Cr,dh as pr,di as Qo,G as aa,at as Lt,dj as Xo,dk as ec,a as hr,d as fr,as as gr,p as Ee,N as de,f as q,l as Sa,dl as br,dm as ac,dn as tc,z as te,a8 as wa,d4 as tt,dp as nc,dq as rc,dr as sc,a2 as va,bj as Xe,bG as Bt,ds as oc,ac as Ta,_ as nt,E as Rt,k as ee,w as rt,dt as cc,bS as ba,du as It,dv as ic,a9 as Ot,dw as dc,af as Sr,aw as kt,dx as lc,ar as yr,X as Ir,U as kr,bo as uc,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,J as za,dE as bc,dF as Sc,m as pt,F as yc,dG as Ic,dH as kc,dI as Ec,aj as Ac,dJ as Dc,dK as _c,g as Pc}from"./index-DKH4PK2B.js";import{n as He,D as Er,S as wc}from"./mui-NTaF3UaY.js";import{a as r}from"./sentry-DsyKtMW2.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-BcCbRGDK.js";import{M as Ae}from"./MobileAppDrawer-DX2JnkbM.js";import{d as Ut}from"./recharts-C6xUtcdL.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-fuvb0IYd.js";import{u as wr}from"./useInitialThreadRequest-DDr_z_RH.js";import st from"./NotFoundScreen-CtgFRYZy.js";import{u as Nt}from"./useChargeCardPusherEvents-BWi4_PP5.js";import{n as Sn}from"./utils-CCA3F0sZ.js";import{t as Lc}from"./AddressScreen-CrINuapd.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./InboxNotificationsProvider-x0fdv66l.js";import"./useTaskManagerAccess-CUv6a62x.js";import"./BusinessVerificationPageScreen-DFamYzxa.js";import"./routePaths-CGyE-cU7.js";import"./analyticsHelper-BEL0ra9X.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]="1dd766ba-8dda-4e47-9090-5f12acbb2d06",e._sentryDebugIdIdentifier="sentry-dbid-1dd766ba-8dda-4e47-9090-5f12acbb2d06")}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]),Z=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),W=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=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(Ze({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:Z,onClickMenuIcon:u,onFormChange:_,onSubmit:W,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,Z=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??Z;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,Z]),W=r.useCallback((()=>{e(Z)}),[e,Z]),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(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Z))}),[s,H,e,Z]);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:W,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(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:Z,isFileUploadEnabled:_}=h,W=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);W(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,W,$]),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&&Z)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,Z,_,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 Zc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((X=>ge(X))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((X=>Wa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled: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,Z=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=Z?.accountingClassIDs[0],W=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(Ze({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:Z?.userRoles,cardHolderDepartmentName:W?.className})]})}const Lr="charge-card-transaction-update",Br="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",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}`)),Wc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(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,Wc),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((W=>ge(W)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((W=>Fs(W,s))),E=x.chargeCard,I=d((W=>W.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),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 W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(W,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Ja()),t(W,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((W=>Vn(W.userState,U.userId))),Z=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((W=>W.statusCode==="success"))===!0&&B===!1&&(setTimeout(Z,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=W=>{O(W)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:_}),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-CgHUgeBY.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-Cc7wW2EM.js";import{fS as _t,$X as cs,g2 as Pt,bt as Fe,$Y as is,$Z as ds,fH as hn,$_ as _n,fQ as Pn,$$ as wn,a00 as vn,a01 as Tn,a02 as Fn,fR as xn,g1 as Ln,a03 as Bn,a04 as ls,fX as us,fW as ms,a05 as Cs,K8 as Rn,g4 as ia,a06 as ps,a07 as hs,fJ as fs,fI as gs,gh as Ze,fZ as On,fY as Un,a08 as bs,f_ as Ss,JG as ys,JF as Is,JJ as ks,JL as Es,ga as As,fE as jn,a09 as Ds,a0a as _s,gf as Mn,a0b as Ps,gg as St,JR as ws,JO as vs,fF as ge,a0c as Wa,dZ as xe,di as Le,d_ as Be,g_ as da,cB as la,a0d as ua,a0e as wt,CZ as Ga,m7 as $a,a0f as Ka,Ko as Ia,g5 as Je,Kq as vt,lZ as Nn,a0g as ma,Kc as Da,a0h as Ts,a0i as Fs,Kf as qa,a0j as xs,Z8 as Ja,g0 as Vn,Kl as ga,iq as Ls,a0k as Hn,fT as Ca,br as Bs,a0l as Rs,gG as Qa,gF as Xa,KU as Os,gE as et,a0m as Gn,cu as $n,da as Us,Z7 as Pa,Lt as Kn,a0n as fn,L3 as _a,a0o as zn,Lu as js,Zx as Ms,Lv as Ns,MA as Vs,Cd as Hs,Mu as Gs,a0p as $s,Kp as oa,a0q as Ks,a0r as zs,a0s as Zs,a0t as Ys,a0u as Ws,a0v as Tt,a0w as qs,KF as Zn,Ky as Js,a0x as Qs,h0 as Xs,a0y as Yn,KO as Wn,KS as qn,g$ as eo,a0z as ao,Lf as Jn,a0A as to,a0B as no,a0C as ro,KQ as Qn,KB as Xn,Ki as er,KK as ar,KI as tr,KM as so,a0D as nr,a0E as oo,gc as co,gd as io,ge as lo,a0F as at,g6 as rr,dc as Ft,a0G as uo,a0H as mo,a0I as Co,a0J as po,K_ as yt,Lm as ho,Li as fo,KW as go,Lk as bo,La as So,Lc as yo,a0K as sr,Ls as Ha,Sj as Io,a0L as ko,a0M as Eo,a0N as Ao,a0O as or,a0P as Do,LP as _o,L2 as cr,KZ as Ne,L1 as Po,a0Q as wo,a0R as vo,K9 as To,a0S as ir,f$ as dr,a0T as Fo,Kb as xo,Ka as gn,a0U as Lo,a0V as Bo,a0W as Ro,Vr as Oo,a0X as xt,a0Y as Uo,xj as lr,mH as jo,ie as Mo,LU as No,a0Z as ur,fN as Vo,fO as Ho,a0_ as Go,dO as $o,g3 as Ko,LK as zo,LE as qe,bq as Zo,bJ as Yo,cG as Wo,bK as qo,Ui as Jo}from"./zeni-epic-state-BVJjEVAA.js";import{P as Re,df as mr,a5 as we,dg as Cr,dh as pr,di as Qo,G as aa,at as Lt,dj as Xo,dk as ec,a as hr,d as fr,as as gr,p as Ee,N as de,f as q,l as Sa,dl as br,dm as ac,dn as tc,z as te,a8 as wa,d4 as tt,dp as nc,dq as rc,dr as sc,a2 as va,bj as Xe,bG as Bt,ds as oc,ac as Ta,_ as nt,E as Rt,j as ee,w as rt,dt as cc,bS as ba,du as It,dv as ic,a9 as Ot,dw as dc,af as Sr,aw as kt,dx as lc,ar as yr,X as Ir,U as kr,bo as uc,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,K as za,dE as bc,dF as Sc,m as pt,F as yc,dG as Ic,dH as kc,dI as Ec,aj as Ac,dJ as Dc,dK as _c,g as Pc}from"./index-CFXYM6OK.js";import{n as He,D as Er,S as wc}from"./mui-C4zFSCiU.js";import{a as r}from"./sentry-DSWD_gIh.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-QQl24-IT.js";import{M as Ae}from"./MobileAppDrawer-B_iTAp0X.js";import{d as Ut}from"./recharts-DJGeJ2v_.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-7E5X1hE5.js";import{u as wr}from"./useInitialThreadRequest-DIgkNFzN.js";import st from"./NotFoundScreen-ytl2lDpJ.js";import{u as Nt}from"./useChargeCardPusherEvents-CXbFOxvL.js";import{n as Sn}from"./utils-DiIEQ7_h.js";import{t as Lc}from"./AddressScreen-rwxaZTG1.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-P-CWGdcX.js";import"./BusinessVerificationPageScreen-D3HFVVs1.js";import"./routePaths-BvBrBOWH.js";import"./analyticsHelper-vbAuZJHT.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]="fcb6052f-60e0-48de-9f11-8b5860674213",e._sentryDebugIdIdentifier="sentry-dbid-fcb6052f-60e0-48de-9f11-8b5860674213")}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]),Z=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),W=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=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(Ze({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:Z,onClickMenuIcon:u,onFormChange:_,onSubmit:W,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,Z=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??Z;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,Z]),W=r.useCallback((()=>{e(Z)}),[e,Z]),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(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Z))}),[s,H,e,Z]);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:W,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(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:Z,isFileUploadEnabled:_}=h,W=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);W(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,W,$]),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&&Z)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,Z,_,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 Zc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((X=>ge(X))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((X=>Wa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled: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,Z=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=Z?.accountingClassIDs[0],W=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(Ze({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:Z?.userRoles,cardHolderDepartmentName:W?.className})]})}const Lr="charge-card-transaction-update",Br="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",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}`)),Wc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(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,Wc),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((W=>ge(W)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((W=>Fs(W,s))),E=x.chargeCard,I=d((W=>W.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),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 W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(W,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Ja()),t(W,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((W=>Vn(W.userState,U.userId))),Z=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((W=>W.statusCode==="success"))===!0&&B===!1&&(setTimeout(Z,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=W=>{O(W)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:_}),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-CgHUgeBY.js";import{a as g}from"./sentry-DSWD_gIh.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-Cc7wW2EM.js";import{z as C,bt as F,a9 as P,j,U as V,q as b,bu as L,af as A,aH as U,p as B}from"./index-CFXYM6OK.js";import{fF as N,gI as M,BE as _,gD as z,c8 as R,Yh as Y,bn as G,uX as H,uL as q,mz as X,o8 as S,Yi as Z,bE as $,cE as D,oj as J,ot as K}from"./zeni-epic-state-BVJjEVAA.js";import"./mui-C4zFSCiU.js";import{d as Q}from"./routePaths-BvBrBOWH.js";import{M as W}from"./MobileAppDrawer-B_iTAp0X.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new a.Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="715b9157-85b7-45ab-aea9-ceeb331f7290",a._sentryDebugIdIdentifier="sentry-dbid-715b9157-85b7-45ab-aea9-ceeb331f7290")}catch{}})();const ee=E((function(a){const n=z(a),i=C.getSignedInUser(),p=N(a),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(p?.userRole??[])&&n.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(a.companyConfigState),t=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:n.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:n,allIndustries:e.companyIndustries??[],allNationalityCountries:t,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:G(i)}}),(function(a,n){const{companyId:i,currentTenant:p,navigate:c,location:l}=n,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let t=e.href;t.includes("http")||(t="https://".concat(t)),window.open(t,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const t=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(t,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(J({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?D(u):void 0,meetingLink:y!=""&&y!=null?D(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:U(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?$(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]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(Z(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(X({files:e}))},onDeleteFile:e=>{a(q(e))},onEditFileName:(e,t)=>{a(H(e,t.split(".")[0]))}}}))(L);function de(){const a=w(),n=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=>N(s))),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||t!=="Not-Started"||d==null||(l(!0),n(M(d)))}),[c,t,d,n]),g.useEffect((()=>{o==="Not-Started"&&n(_())}),[o,n]);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:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:j,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{j as I}from"./liveblocks-CgHUgeBY.js";import{a as o}from"./sentry-DSWD_gIh.js";import{u as P,h as R,g as H,j as C,N as w}from"./core-Cc7wW2EM.js";import{TX as q,fF as z,gl as G,pS as K,gM as A,gk as M,gi as Q,Ul as V,gh as O}from"./zeni-epic-state-BVJjEVAA.js";import{u as X,z as E,L as D,G as B,K as J}from"./index-CFXYM6OK.js";import{n as W}from"./mui-C4zFSCiU.js";import{P as h,a as _}from"./AccountMappingScreen-DivKdf2Z.js";import{t as Y}from"./getLocaleForTenant-rFLZBDSf.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-TwPTSdM4.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./MobileAppDrawer-B_iTAp0X.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-P-CWGdcX.js";import"./accountMappingHelper-Gh8rpbjD.js";import"./empty-6MFM8UPN.js";import"./pdf-lib-CsM74zBq.js";import"./index-2QCkbhu2.js";import"./url-DUlo21cY.js";import"./index-D2oCZR3F.js";import"./decodeURIComponentSafe-DhqIXi_U.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]="f99b5931-2172-45b5-9a70-9fc7fd580dac",t._sentryDebugIdIdentifier="sentry-dbid-f99b5931-2172-45b5-9a70-9fc7fd580dac")}catch{}})();const te=W.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1 1 auto;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
background-color: ${t=>t.theme.colors.background};
|
|
10
|
+
box-shadow: ${t=>`0px 2px ${J.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
+
`;function we(){const t=P(),i=R(),v=H(),{setLoading:c,clearAllLoading:m}=X(),S=o.useRef(!1),b=o.useRef(!1),N=o.useRef(!1),f=o.useRef(!1),{code:U,realmId:$,state:F}=Z(v.search),p=U!==""&&$!==""&&F!=="";p&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===_.pending,L=j===_.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(D.CONNECTION_AUTH)}),[c]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(c(D.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,c]),o.useEffect((()=>{e.tenantId==null&&!b.current&&a!=null&&(b.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(K(a.userId)))}),[b,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(c(D.CONNECTION_AUTH),t(A(a.userId,e.tenantId)))}),[d]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(M(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),Q(a?.userId,a?.zeniSessionId,e.tenantId),B.updateAppLocaleID(Y(V(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(A(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{x.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(x.tenantsCoreDetailsInOrder)}),[x.tenantsCoreDetailsInOrder.length,n]);const T=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"&&(f.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||T)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return f.current&&d==="Completed"?(sessionStorage.setItem(h,_.ready),m(),void i(s,{replace:!0})):f.current&&d==="Error"?(sessionStorage.removeItem(h),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(p||N.current||f.current||y!==!0||(sessionStorage.removeItem(h),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,T,d,p,y,e.tenantEmailDomain,m,t,i]),T)return null;if(p||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return L?I.jsx(w,{to:k,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-CgHUgeBY.js";import{z as m}from"./index-CFXYM6OK.js";import{g as n}from"./QBOConnectionScreen-TwPTSdM4.js";import"./sentry-DSWD_gIh.js";import{g as p,N as a}from"./core-Cc7wW2EM.js";import"./zeni-epic-state-BVJjEVAA.js";import"./recharts-DJGeJ2v_.js";import"./mui-C4zFSCiU.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./empty-6MFM8UPN.js";import"./pdf-lib-CsM74zBq.js";import"./index-2QCkbhu2.js";import"./url-DUlo21cY.js";import"./index-D2oCZR3F.js";import"./decodeURIComponentSafe-DhqIXi_U.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-CjmJGGJm.js → CustomerOnboardingRoutes-C0r1dw1S.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-
|
|
1
|
+
import{j as s}from"./liveblocks-CgHUgeBY.js";import{t as Tt,A as $e}from"./AddressScreen-rwxaZTG1.js";import wt from"./NotFoundScreen-ytl2lDpJ.js";import{a as d,t as Me}from"./sentry-DSWD_gIh.js";import{h as _e,g as Ee,u as se,i as xe,j as T,N as Q,q as At,l as it,n as Pt,o as H}from"./core-Cc7wW2EM.js";import{fF as Y,d_ as Te,dZ as we,bq as Dt,Uc as jt,bR as Bt,pQ as Ft,Bo as Vt,Br as Ut,Vz as Rt,VA as Lt,lu as Oe,lx as ct,UP as Nt,b$ as Gt,c8 as fe,BS as Ae,BD as $t,VB as me,BT as dt,Sm as Mt,mH as ut,di as lt,VC as Qt,VD as Kt,uE as zt,UC as Ce,hV as qt,UB as be,hS as Ht,Gh as Jt,uI as Zt,hK as Wt,hN as Qe,VE as pt,VF as Xt,M7 as Yt,VG as en,Mb as tn,Bu as nn,VH as an,VI as on,ls as sn,lv as rn,C3 as cn,BF as mt,BR as dn,bE as Ke,cE as un,C2 as ze,uX as ln,uL as pn,mz as mn,gG as gn,gF as fn,gE as yn,VJ as hn,Bx as Cn,C4 as bn,C7 as Sn,Ca as In,Cg as kn,dj as On}from"./zeni-epic-state-BVJjEVAA.js";import{z,N as Pe,f as W,V as vn,p as q,a9 as re,j as g,aF as _n,aj as gt,a2 as En,F as ft,P as yt,l as X,_ as ge,U as ve,aG as xn,K as qe,v as He,af as Tn,aH as Je,aI as wn,aJ as An}from"./index-CFXYM6OK.js";import{n as De}from"./mui-C4zFSCiU.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-TwPTSdM4.js";import{u as jn,a as Bn}from"./useEmailConnectResultRefresh-Dd25HleM.js";import{u as Fn}from"./useChargeCardPusherEvents-CXbFOxvL.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./empty-6MFM8UPN.js";import"./pdf-lib-CsM74zBq.js";import"./index-2QCkbhu2.js";import"./url-DUlo21cY.js";import"./index-D2oCZR3F.js";import"./decodeURIComponentSafe-DhqIXi_U.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]="e30f413f-7bae-4b4e-9f2b-2c224bb814f3",e._sentryDebugIdIdentifier="sentry-dbid-e30f413f-7bae-4b4e-9f2b-2c224bb814f3")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Vn=()=>{const e=_e(),l=Ee(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=xe(),t=z.getSignedInUser(),{useFeatureGate:n}=Pe(),{isFeatureEnabled:C}=n(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=n(W.isArAgingFeatureEnabled),{isFeatureEnabled:A}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:w}=n(W.isDebitCardFeatureEnabled),k=vn(),O=T((S=>Y(S))),P=T((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Te(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&&Dt(O?.userRole),E=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),E===!1&&D.push("bill_pay_card","bill_pay_promo_card"),x===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=T((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 J=jt(S,V);return Bt(J.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Ft(t.userId,F,O.tenantId,!0,!1,D)))}),[a,P,m,b,t,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_n,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],We=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(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"))},Ye=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-e6rGc1UF.js";import{t as Tt,A as $e}from"./Addre
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
-
`,tt=it((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,t={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},n=Y(e),C=Ae(e,i),o=pt(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xt(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Tn.fileMicroServiceBaseUrl,authParams:t},signedInUser:z.getSignedInUser(),currentTenant:n,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:(t,n)=>{e(kn(t,n))},onEstablishConnectionClick:(t,n)=>{e(In(t,n))},onUpdatePaymentAccountStatus:(t,n,C)=>{e(Sn(t,n,C))},onUpdatePaymentAccountLoginStatus:(t,n)=>{e(bn(!1,t,n))},onEstablishConnectionSuccess:()=>{e(Cn(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:t=>{e(me({isQBOPopupOpen:t}))},onCompanyOfficerUpdated:t=>{const n=t.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:E}=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:E}}));e(ze({officers:n}))},onGetOtp:(t,n)=>{e(yn(t,"CustomerOnboarding")),n!=null&&e(hn({officerType:n,phone:t}))},onResendOtp:t=>{e(fn(t,"CustomerOnboarding"))},onVerifyOtp:(t,n)=>{g.trackOnboardingPhoneVerified(),e(gn(t,n,"CustomerOnboarding"))},updateFilesEntity:t=>{e(mn({files:t}))},onDeleteFile:t=>{e(pn(t))},onEditFileName:(t,n)=>{e(ln(t,n.split(".")[0]))},onCompanyDetailsChanged:t=>{const{companyDescription:n,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:E,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:J,usNexusTypes:$}=t,M={companyId:i,companyDescription:n,companyIndustry:C.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?un(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:E,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:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(t,n,C)=>{e(dn(i,!1,n,C,t))},onAddressEditHandler:t=>{if(t!=null){const n=Tt(t);e(ut({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);e(mt(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:t}})},onUpdateStep:t=>{e(dt({step:t}))},onUpdateSubStep:t=>{e(cn({subStep:t}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:t,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:t=>{e(ct(t))},handleConfirmCardSetupIntent:t=>{e(rn(t))},updateCardPaymentModalState:t=>{e(me({isCardPaymentPopupOpen:t}))},handleAddCardPaymentSource:(t,n,C)=>{e(sn(t,n,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(on())},handleResetCardPaymentErrorStatuses:()=>{e(an())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const t=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:t,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(nn(i)))},onIdentityDocumentUploadedForAutofill:t=>{if(i==null)return;const n=en(t.documentType);n!=null&&(g.trackOnboardingDocumentUploaded("kyc",n),e(tn({target:"onboarding",companyId:i,officerType:t.officerType,fileId:t.fileId,documentType:n})))},onCompanyDocumentUploadedForAutofill:t=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",t.documentType),e(Yt({target:"onboarding",companyId:i,fileId:t.fileId,documentType:t.documentType})))}}}))(En),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=gt(),p=_e(),u=xe(),c=se(),v=xn(),t=ft(),[n,C]=d.useState(!1),[o,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=Ee(),P=yt(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(W.isDebitCardFeatureEnabled),m=At("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=T((y=>y.onboardingCustomerViewState.fetchState)),D=T((y=>y.onboardingCustomerViewState.currentStep)),U=T((y=>y.onboardingCustomerViewState.uiState)),h=T((y=>Y(y))),r=T((y=>y.userRoleConfigState.fetchState)),x=T((y=>y.cardPaymentViewState)),E=X(x.addCardPaymentSourceStatus.fetchState),f=x.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pn(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||(ct(["card"]),k(!0))}),[w]),d.useEffect((()=>{E==="In-Progress"&&f==="Completed"&&c(Oe())}),[E,f]),d.useEffect((()=>{Dn(j,N,G,V,J)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Nt(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:J},Gt(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=T((y=>Ae(y,M)));d.useEffect((()=>{n||b!=="Not-Started"||M==null||(C(!0),c($t(M,!0,!m)))}),[n,b,M]);const te=h.externalConnections?.saveConnectionState,je=X(te);d.useEffect((()=>{je==="In-Progress"&&(te==="Completed"||te==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(te==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[te,je,U.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(dt({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Mt(!0))}),[r,c]);const ht=X(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&ht==null&&c(ut({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Ct=R.isInterimEmailSent,Be=z.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const bt=Te(F,h),St=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,It=ye===!0&&!lt(h),kt=h.productSettings.isTreasuryEnabled,Ue=Un({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=T((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),ne=T((B=>Y(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vt())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||ne||K(Ut(y))}),[y,ne,K]),Ot=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]),vt=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:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Lt({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Rt({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 Fn({events:Ot,onEvent:vt,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=We(B,Se),I=We(B,Ie),ue=Xe(B,Se),Z=Xe(B,Ie),Ne=B.some((Et=>Et.status!=="idle")),oe=!ne&&!Ne,Ge=ne&&!Ne,_t=Ge?Se.map((()=>"building")):ae,xt=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:_t,backgroundRowStatuses:oe?void 0:xt,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,ne,Le])})({companyId:M});if(Fe===!0){if(!ye)return kt?s.jsx(Q,{to:"../../treasury"}):bt?s.jsx(Q,{to:"../../checking"}):St?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ve(K)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{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 Ct===!0&&It?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ve(y)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Un=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=jn(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Bn({companyId:i}),t=T((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),n=T((r=>Y(r))),C=T((r=>r.tenantState.fetchState)),o=T((r=>Qt(r,i))),A=T((r=>Kt(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=n.tenantId,O=fe(n.userRole??[]);d.useEffect((()=>{a(zt(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,F=X(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=X(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=X(U);return d.useEffect((()=>{const r=U??{},x=h??{},E=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",E[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",nt()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",nt()))},onConnectHubSpot:(r,x)=>{const E=o.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(E==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:E,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 E=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=E!=null?Ce(E):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",x),a(Wt(k,r,be(x)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zt(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Jt())},onSaveChargeBeeCredentials:(r,x)=>{const E=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;E!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Ht(k,E,be("revenue"),Ce("chargebee"),{api_key:r,site:x})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(qt(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:t})),[O,o,C,w,p,k,l,e,a,u,c,v,t])};function nt(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function at(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const ot=De.div`
|
|
26
|
+
`,tt=it((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,t={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},n=Y(e),C=Ae(e,i),o=pt(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xt(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Tn.fileMicroServiceBaseUrl,authParams:t},signedInUser:z.getSignedInUser(),currentTenant:n,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:(t,n)=>{e(kn(t,n))},onEstablishConnectionClick:(t,n)=>{e(In(t,n))},onUpdatePaymentAccountStatus:(t,n,C)=>{e(Sn(t,n,C))},onUpdatePaymentAccountLoginStatus:(t,n)=>{e(bn(!1,t,n))},onEstablishConnectionSuccess:()=>{e(Cn(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:t=>{e(me({isQBOPopupOpen:t}))},onCompanyOfficerUpdated:t=>{const n=t.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:E,isPhoneVerified:x}=C;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType: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:E,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:x}}));e(ze({officers:n}))},onGetOtp:(t,n)=>{e(yn(t,"CustomerOnboarding")),n!=null&&e(hn({officerType:n,phone:t}))},onResendOtp:t=>{e(fn(t,"CustomerOnboarding"))},onVerifyOtp:(t,n)=>{g.trackOnboardingPhoneVerified(),e(gn(t,n,"CustomerOnboarding"))},updateFilesEntity:t=>{e(mn({files:t}))},onDeleteFile:t=>{e(pn(t))},onEditFileName:(t,n)=>{e(ln(t,n.split(".")[0]))},onCompanyDetailsChanged:t=>{const{companyDescription:n,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:E,companySourceOfFundsDescription:x,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:J,usNexusTypes:$}=t,M={companyId:i,companyDescription:n,companyIndustry:C.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?un(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:U?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:E?.selectedOption??"",companySourceOfFundsDescription:x,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:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(t,n,C)=>{e(dn(i,!1,n,C,t))},onAddressEditHandler:t=>{if(t!=null){const n=Tt(t);e(ut({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);e(mt(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:t}})},onUpdateStep:t=>{e(dt({step:t}))},onUpdateSubStep:t=>{e(cn({subStep:t}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:t,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:t=>{e(ct(t))},handleConfirmCardSetupIntent:t=>{e(rn(t))},updateCardPaymentModalState:t=>{e(me({isCardPaymentPopupOpen:t}))},handleAddCardPaymentSource:(t,n,C)=>{e(sn(t,n,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(on())},handleResetCardPaymentErrorStatuses:()=>{e(an())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const t=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:t,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(nn(i)))},onIdentityDocumentUploadedForAutofill:t=>{if(i==null)return;const n=en(t.documentType);n!=null&&(g.trackOnboardingDocumentUploaded("kyc",n),e(tn({target:"onboarding",companyId:i,officerType:t.officerType,fileId:t.fileId,documentType:n})))},onCompanyDocumentUploadedForAutofill:t=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",t.documentType),e(Yt({target:"onboarding",companyId:i,fileId:t.fileId,documentType:t.documentType})))}}}))(xn),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=gt(),p=_e(),u=Ee(),c=se(),v=En(),t=ft(),[n,C]=d.useState(!1),[o,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=xe(),P=yt(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(W.isDebitCardFeatureEnabled),m=At("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=T((y=>y.onboardingCustomerViewState.fetchState)),D=T((y=>y.onboardingCustomerViewState.currentStep)),U=T((y=>y.onboardingCustomerViewState.uiState)),h=T((y=>Y(y))),r=T((y=>y.userRoleConfigState.fetchState)),E=T((y=>y.cardPaymentViewState)),x=X(E.addCardPaymentSourceStatus.fetchState),f=E.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pn(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||(ct(["card"]),k(!0))}),[w]),d.useEffect((()=>{x==="In-Progress"&&f==="Completed"&&c(Oe())}),[x,f]),d.useEffect((()=>{Dn(j,N,G,V,J)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Nt(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:J},Gt(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=T((y=>Ae(y,M)));d.useEffect((()=>{n||b!=="Not-Started"||M==null||(C(!0),c($t(M,!0,!m)))}),[n,b,M]);const te=h.externalConnections?.saveConnectionState,je=X(te);d.useEffect((()=>{je==="In-Progress"&&(te==="Completed"||te==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(te==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[te,je,U.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(dt({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Mt(!0))}),[r,c]);const ht=X(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&ht==null&&c(ut({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Ct=R.isInterimEmailSent,Be=z.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const bt=Te(F,h),St=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,It=ye===!0&&!lt(h),kt=h.productSettings.isTreasuryEnabled,Ue=Un({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=T((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),ne=T((B=>Y(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vt())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||ne||K(Ut(y))}),[y,ne,K]),Ot=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]),vt=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:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Lt({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Rt({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 Fn({events:Ot,onEvent:vt,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=We(B,Se),I=We(B,Ie),ue=Xe(B,Se),Z=Xe(B,Ie),Ne=B.some((xt=>xt.status!=="idle")),oe=!ne&&!Ne,Ge=ne&&!Ne,_t=Ge?Se.map((()=>"building")):ae,Et=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:_t,backgroundRowStatuses:oe?void 0:Et,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,ne,Le])})({companyId:M});if(Fe===!0){if(!ye)return kt?s.jsx(Q,{to:"../../treasury"}):bt?s.jsx(Q,{to:"../../checking"}):St?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ve(K)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{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 Ct===!0&&It?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ve(y)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Un=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=jn(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Bn({companyId:i}),t=T((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),n=T((r=>Y(r))),C=T((r=>r.tenantState.fetchState)),o=T((r=>Qt(r,i))),A=T((r=>Kt(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=n.tenantId,O=fe(n.userRole??[]);d.useEffect((()=>{a(zt(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,F=X(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=X(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=X(U);return d.useEffect((()=>{const r=U??{},E=h??{},x=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(E[f]!=="In-Progress")return;let j;try{j=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",x[f]?.message??"")}))}),[U,h,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,E])=>[r,E?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",nt()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",nt()))},onConnectHubSpot:(r,E)=>{const x=o.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(x==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:E,connection_id:x,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,E)=>{const x=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=x!=null?Ce(x):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",E),a(Wt(k,r,be(E)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zt(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Jt())},onSaveChargeBeeCredentials:(r,E)=>{const x=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;x!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Ht(k,x,be("revenue"),Ce("chargebee"),{api_key:r,site:E})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(qt(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:t})),[O,o,C,w,p,k,l,e,a,u,c,v,t])};function nt(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function at(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const ot=De.div`
|
|
27
27
|
display: flex;
|
|
28
28
|
height: 100vh;
|
|
29
29
|
background-color: ${e=>e.theme.colors.grey4};
|
|
30
|
-
`,st=it((function(e,l){const{companyId:i,currentTenant:a}=l,p=Ae(e,i),u=pt(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"}})}}}))(An),Rn=()=>{const e=gt(),l=_e(),i=se(),a=
|
|
30
|
+
`,st=it((function(e,l){const{companyId:i,currentTenant:a}=l,p=Ae(e,i),u=pt(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"}})}}}))(An),Rn=()=>{const e=gt(),l=_e(),i=se(),a=Ee(),p=ft(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(W.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=xe(),t=yt(),[n,C]=d.useState(!1);d.useEffect((()=>{n===!1&&a.state?.message==="OnboardingThankyou"&&C(!0)}),[a.state]);const o=T((m=>Y(m))),A=o.productSettings.isOtherProductsEnabled,w=A===!0&&!lt(o);d.useEffect((()=>{i(mt(k,!1,!w))}),[]);const k=o.companyId??z.getSignedInUserTenant(v)?.companyId;if(t.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Te(c,o),P=we(o),_=T((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),F=o.company?.companyOnboardingInfo.isOnboardingCompleted;if(F!==!0||w)return _==="Completed"&&F===!0&&w&&t?.loggedInUserRoleMap!=null?s.jsxs(ot,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",On(o.productSettings))}}),s.jsx(st,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:n,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&F===!1&&t?.loggedInUserRoleMap!=null?s.jsxs(ot,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(st,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:n,meetingUrl:e("onboarding_overview")})]}):s.jsx(wn,{});{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 rt(){return typeof Me=="function"?Me():void 0}let pe=0;function Ln(){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=rt();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=rt();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Ln(),s.jsxs(Pt,{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(Rn,{})}),s.jsx(H,{path:"/activation",element:s.jsx(Vn,{})}),s.jsx(H,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"*",element:s.jsx(wt,{})})]})}export{pa as default};
|