@zeniai/web-app-ui 5.3.95-dev → 5.3.96-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/assets/{AccountMappingScreen-CJpxPjym.js → AccountMappingScreen-BEj2Jzjh.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-BI1Xbj3L.js → ActualMatchingMatchDetailScreen-BhGe8oi6.js} +1 -1
  3. package/dist/assets/AddressRoutes-BVSHrg7z.js +1 -0
  4. package/dist/assets/AddressScreen-Doe_aPe9.js +9 -0
  5. package/dist/assets/{AiCfoScreen-baKqq38G.js → AiCfoScreen-T9wsddnc.js} +1 -1
  6. package/dist/assets/{AppDrawer-BAy3i2Dk.js → AppDrawer-BO5m3PED.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-BLLQGNfF.js → BillPayApprovalRoutes-B8F3GVxs.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-BF0qZi8Q.js → BillPayRoutes-DcSqsOgQ.js} +1 -1
  9. package/dist/assets/{BusinessVerificationPageScreen-B6gKgGKZ.js → BusinessVerificationPageScreen-JarRxoSX.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-495-iwbX.js → CardsAiCfoScreen-Cdz5Oqoj.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-CsLMN32g.js → ChargeCardRoutes-fZYBlxkt.js} +1 -1
  12. package/dist/assets/{CompanyPassportScreen-DFOWHlG6.js → CompanyPassportScreen-CoIn2qzM.js} +1 -1
  13. package/dist/assets/{ConnectionAuthScreen-DcGlWxyf.js → ConnectionAuthScreen-DYsUrO3M.js} +2 -2
  14. package/dist/assets/CustomerOnboardingAuthScreen-cy1fiuJH.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-7Bwv09dV.js → CustomerOnboardingRoutes-D5GZ0VVR.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-s3deN1Di.js → DashboardRoutes-DMdxy8l4.js} +4 -4
  17. package/dist/assets/{DefaultTenantHome-Bi2eWO-I.js → DefaultTenantHome-BcGsaBpe.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-CVJejZP9.js → DomesticWireDetailScreen-BbDPbcRA.js} +3 -3
  19. package/dist/assets/{DrawerScreen-Bev9sxN6.js → DrawerScreen-37FDqOIx.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-DTd2OX4g.js → EntityDetailRoutes-DVrb6Fuj.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-BNvZ1Bwi.js → ExpenseAutomationRoutes-CxhAtnDQ.js} +1 -1
  22. package/dist/assets/{FeaturePreviewScreen-DETqyCpy.js → FeaturePreviewScreen-yUa195bz.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-LgF5qdxr.js → HubSpotOAuthCallbackScreen--RhQBan-.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-LdTK3V9o.js → InboxNotificationsProvider-C3xMqTmq.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-B-1POvyE.js +3 -0
  26. package/dist/assets/{MagicLinkRoutes-BAL4OpO8.js → MagicLinkRoutes-PBem0q8b.js} +1 -1
  27. package/dist/assets/MagicLinkSignInScreen-BcCW10cQ.js +12 -0
  28. package/dist/assets/MobileAppDrawer-DfWAieCr.js +1 -0
  29. package/dist/assets/NotFoundScreen-Bowln8Np.js +1 -0
  30. package/dist/assets/{NotificationRoutes-_8GAMr1Q.js → NotificationRoutes-DvSviwho.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-DrAajreS.js → OAuthConsentScreen-CY6jrUj6.js} +1 -1
  32. package/dist/assets/{PandLWithForecastRoutes-BoihVLwz.js → PandLWithForecastRoutes-Dhy9JC2p.js} +1 -1
  33. package/dist/assets/{PaymentLinkScreen-QPSeahMe.js → PaymentLinkScreen-JV3evKRP.js} +5 -5
  34. package/dist/assets/{PeopleRoutes-BJ_Rsbpd.js → PeopleRoutes-Cse3a3sb.js} +3 -3
  35. package/dist/assets/{PerformanceRoutes-BU_ssv__.js → PerformanceRoutes-CxRwjZ1i.js} +1 -1
  36. package/dist/assets/{Preview-S6mtKRFK.js → Preview-DwgMDfYC.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-DMcsRcZG.js → QBOConnectionScreen-D6uUWSjU.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-c_eicF80.js → ReimbursementApprovalRoutes-DHWyOWyD.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-NQbCpzYz.js → ReimbursementApprovalRuleDetailScreen-meuFzn-o.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-BVOB8GHt.js → ReimbursementRoutes-z4gQLteF.js} +1 -1
  41. package/dist/assets/{ReportsRoutes-BaXWnnZZ.js → ReportsRoutes-S7M6Uyzv.js} +1 -1
  42. package/dist/assets/RewardsRoutes-DjHnoowA.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-OdknWRFf.js → ScheduleDetailsPrepaidExpensesScreen-ByJabNd7.js} +5 -5
  44. package/dist/assets/ScreenRoutes-DxeRaGXX.js +2 -0
  45. package/dist/assets/{SettingsRoutes-CwikuwVk.js → SettingsRoutes-BRlBwm37.js} +5 -5
  46. package/dist/assets/{SetupPagesScreen-B0b-Fgla.js → SetupPagesScreen-D3fdAxOs.js} +5 -5
  47. package/dist/assets/{SignInScreen-DYTURHhx.js → SignInScreen-Bq6wqyFV.js} +1 -1
  48. package/dist/assets/SignOutScreen-CMyUFCH3.js +9 -0
  49. package/dist/assets/{TaskListScreen-adKZru26.js → TaskListScreen-BcmmmrTo.js} +2 -2
  50. package/dist/assets/{TaskRoutes-B74sfUtJ.js → TaskRoutes-C4T84shI.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-BnJFdHti.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-CS9DS32g.js → TransactionDetailScreen-Dpzd-yXF.js} +2 -2
  53. package/dist/assets/{TransactionListRoutes-BIufDhIc.js → TransactionListRoutes-Bu7PI8Rl.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-Bt27xnQK.js → TreasuryRoutes-D6tE6770.js} +4 -4
  55. package/dist/assets/{VendorsRoutes-ZMV0CecT.js → VendorsRoutes-D_WhDWVM.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-ZJ4gewaT.js → WiseConfirmationScreen-BhYBEIyb.js} +1 -1
  57. package/dist/assets/{ZeniAccountRoutes-DV3rsGFn.js → ZeniAccountRoutes-CtYkEuA8.js} +9 -9
  58. package/dist/assets/{ZeniAccountStatementScreen-B-L8iMJL.js → ZeniAccountStatementScreen-F5yZU3cz.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-1wM-u5pk.js → accountMappingHelper-BIdzFaKc.js} +1 -1
  60. package/dist/assets/{analytics-DhotUQIQ.js → analytics-BreoHt0J.js} +1 -1
  61. package/dist/assets/{analyticsHelper-BkudU6tc.js → analyticsHelper-DbQsERTh.js} +1 -1
  62. package/dist/assets/{core-B1R51LGS.js → core-CSm69gJV.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-sNmSv15A.js → decodeURIComponentSafe-DD9Neunj.js} +1 -1
  64. package/dist/assets/{dnd-CBDtHD8g.js → dnd-BvLWSTOT.js} +1 -1
  65. package/dist/assets/{empty-DDVSRnUK.js → empty-BPKm1KLs.js} +1 -1
  66. package/dist/assets/{empty-1ZFG33kK.js → empty-D-Gn9Jdo.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-Cmgjsfjv.js → emptyVideoElement-LUxShx9x.js} +1 -1
  68. package/dist/assets/{epic--rTGN1ZF.js → epic-B1XMIJyC.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-Bb1c_nBx.js → expenseAutomationHelper-Djn6yrb_.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-Nj4zPyxj.js → getLocaleForTenant-uCoslywF.js} +1 -1
  71. package/dist/assets/{index-DUjhchTx.js → index-B-RYxEU1.js} +1 -1
  72. package/dist/assets/{index-4kuDVIdn.js → index-Bx0cVQTh.js} +1 -1
  73. package/dist/assets/{index-DaxOKW2h.js → index-C6_y02Df.js} +2 -2
  74. package/dist/assets/{index-B4fRbcqK.js → index-CSw2zedd.js} +1 -1
  75. package/dist/assets/{index-C5-029-z.js → index-DfmKliEE.js} +1 -1
  76. package/dist/assets/{index-Dp_Uc3gy.js → index-Di0x3KLC.js} +6167 -6167
  77. package/dist/assets/{index-CmqWYVaK.js → index-mW6D32De.js} +1 -1
  78. package/dist/assets/{index-BgCxp-PW.js → index-t_yPrnJX.js} +1 -1
  79. package/dist/assets/{lexical-Cft6chCX.js → lexical-CC3pmboN.js} +1 -1
  80. package/dist/assets/{liveblocks-BYqz0SWy.js → liveblocks-Css5YxVy.js} +1 -1
  81. package/dist/assets/{lottie-C4orech3.js → lottie-scQSn0xo.js} +1 -1
  82. package/dist/assets/{mui-D-_RYGgU.js → mui-CgZjFJJF.js} +1 -1
  83. package/dist/assets/{pathToGoBack-DZ8Lgq0-.js → pathToGoBack-Cx0NwHdB.js} +1 -1
  84. package/dist/assets/{pdf-DFgrdLB6.js → pdf-DXPt-TDj.js} +3 -3
  85. package/dist/assets/{pdf-lib-2bJZTByw.js → pdf-lib-kfbS5Id9.js} +1 -1
  86. package/dist/assets/{plaid-B0PWXAfV.js → plaid-vksPD1j4.js} +1 -1
  87. package/dist/assets/{pusher-F6-lSe0Y.js → pusher-BpFLgay1.js} +1 -1
  88. package/dist/assets/{react-BwTGo4yk.js → react-BFVWe54o.js} +1 -1
  89. package/dist/assets/{react-CM16A7NA.js → react-BpwHczl-.js} +1 -1
  90. package/dist/assets/{react-CB4vP-t_.js → react-DBgZvtMG.js} +1 -1
  91. package/dist/assets/{react-DyLpv-r1.js → react-iYq3GXPy.js} +1 -1
  92. package/dist/assets/{react-DUg8Ws81.js → react-mGF_kQSA.js} +1 -1
  93. package/dist/assets/{react-D_SPu3Ud.js → react-rwzOK-1r.js} +1 -1
  94. package/dist/assets/{recharts-By7FVN8f.js → recharts-DQBC-7lc.js} +1 -1
  95. package/dist/assets/{routePaths-BALvGXpp.js → routePaths-DNuW5jQV.js} +1 -1
  96. package/dist/assets/{sentry-DjmIorbX.js → sentry-BBNrx1Ml.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-B5IwbFj2.js → stripSplatSuffix-L-JRH5Ri.js} +1 -1
  98. package/dist/assets/{url-B8llcdww.js → url-CiYRfW83.js} +1 -1
  99. package/dist/assets/{url-SyxPcinx.js → url-D0TdjO3t.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-CuDY29_K.js → useActualMatchingMatchDetail-CekpYB8W.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-B5pmnrb8.js → useAiCfoDashboardSuggestedQuestionsChips-Dn4uN4J8.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-Ba1QPj42.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-Ce-wULUB.js → useChargeCardPusherEvents-Bc01kHYP.js} +1 -1
  104. package/dist/assets/{useDeviceId-D6nAUa-g.js → useDeviceId-ClCFOYOX.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-CQX3dx0q.js → useEmailConnectResultRefresh-DgdB9uv-.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-BaIZPAUw.js → useInitialThreadRequest-2hi5iAsL.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-CFJAytRv.js → useTaskManagerAccess-D_aPdTiN.js} +1 -1
  108. package/dist/assets/{useTaskManagerPusherEvents-B_vM_sss.js → useTaskManagerPusherEvents-Ypcuts7J.js} +1 -1
  109. package/dist/assets/{utils-iOnDyQuG.js → utils-B8asVtkx.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-BuJ7rAhb.js → withTransactionSidePanel-Bb5FevX_.js} +1 -1
  111. package/dist/assets/{zeni-epic-state-M9sMLOaG.js → zeni-epic-state-CQbasAjU.js} +7 -7
  112. package/dist/index.html +1 -1
  113. package/package.json +3 -3
  114. package/dist/assets/AddressRoutes-27wvZSFH.js +0 -1
  115. package/dist/assets/AddressScreen-Ce6wpOqL.js +0 -9
  116. package/dist/assets/CustomerOnboardingAuthScreen-Da1wSVu0.js +0 -1
  117. package/dist/assets/InvoicingRoutes-Mbynj2-j.js +0 -3
  118. package/dist/assets/MagicLinkSignInScreen-BIY2mGLo.js +0 -12
  119. package/dist/assets/MobileAppDrawer-CsfNveW9.js +0 -1
  120. package/dist/assets/NotFoundScreen-DDA41Ig7.js +0 -1
  121. package/dist/assets/RewardsRoutes-Dr_V6CBY.js +0 -1
  122. package/dist/assets/ScreenRoutes-MAHnboyU.js +0 -2
  123. package/dist/assets/SignOutScreen-Be_uJc5B.js +0 -9
  124. package/dist/assets/TransactionDetailRoutes-DRKjV_CD.js +0 -1
  125. package/dist/assets/useAskAiCfoHostNavButtonProps-DWkTPomv.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as o}from"./liveblocks-BYqz0SWy.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Je,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-B1R51LGS.js";import{fV as _t,a0w as cs,g5 as Pt,bu as Fe,a0x as is,a0y as ds,fK as hn,a0z as _n,fT as Pn,a0A as wn,a0B as vn,a0C as Tn,a0D as Fn,fU as xn,g4 as Ln,a0E as Bn,a0F as ls,f_ as us,fZ as ms,a0G as Cs,KA as Rn,g7 as ia,a0H as ps,a0I as hs,fM as fs,fL as gs,gk as We,g0 as On,f$ as Un,a0J as bs,g1 as Ss,K6 as ys,K5 as Is,K9 as ks,Kb as Es,gd as As,fH as jn,a0K as Ds,a0L as _s,gi as Mn,a0M as Ps,gj as St,Kh as ws,Ke as vs,fI as ge,a0N as Za,d$ as xe,dj as Le,e0 as Be,h2 as da,cC as la,a0O as ua,a0P as wt,Dk as Ga,mb as $a,a0Q as Ka,KQ as Ia,g8 as Qe,KS as vt,m1 as Nn,a0R as ma,KE as Da,a0S as Ts,a0T as Fs,KH as qa,a0U as xs,ZH as Qa,g3 as Vn,KN as ga,iu as Ls,a0V as Hn,fW as Ca,br as Bs,a0W as Rs,gJ as Ja,gI as Xa,Lk as Os,gH as et,a0X as Gn,cv as $n,db as Us,ZG as Pa,LV as Kn,a0Y as fn,Lv as _a,a0Z as zn,LW as js,_5 as Ms,LX as Ns,N3 as Vs,CA as Hs,MZ as Gs,a0_ as $s,KR as oa,a0$ as Ks,a10 as zs,a11 as Ws,a12 as Ys,a13 as Zs,a14 as Tt,a15 as qs,L5 as Wn,K_ as Qs,a16 as Js,h4 as Xs,a17 as Yn,Le as Zn,Li as qn,h3 as eo,a18 as ao,LH as Qn,a19 as to,a1a as no,a1b as ro,Lg as Jn,L1 as Xn,KK as er,La as ar,L8 as tr,Lc as so,a1c as nr,a1d as oo,gf as co,gg as io,gh as lo,a1e as at,g9 as rr,dd as Ft,a1f as uo,a1g as mo,a1h as Co,a1i as po,Lq as yt,LO as ho,LK as fo,Lm as go,LM as bo,LC as So,LE as yo,a1j as sr,LU as Ha,SR as Io,a1k as ko,a1l as Eo,a1m as Ao,a1n as or,a1o as Do,Mf as _o,Lu as cr,Lp as Ne,Lt as Po,a1p as wo,a1q as vo,KB as To,a1r as ir,g2 as dr,a1s as Fo,KD as xo,KC as gn,a1t as Lo,a1u as Bo,a1v as Ro,V_ as Oo,a1w as xt,a1x as Uo,xz as lr,mL as jo,ij as Mo,Mk as No,a1y as ur,fQ as Vo,fR as Ho,a1z as Go,dQ as $o,g6 as Ko,Ma as zo,M4 as qe,bq as Wo,bK as Yo,cH as Zo,bL as qo,UR as Qo}from"./zeni-epic-state-M9sMLOaG.js";import{V as Re,dc as mr,a2 as we,dd as Cr,de as pr,df as Jo,G as aa,aq as Lt,dg as Xo,dh as ec,a as hr,e as fr,ap as gr,p as Ee,c as de,$ as q,j as Sa,di as br,dj as ac,dk as tc,z as te,a5 as wa,d1 as tt,dl as nc,dm as rc,dn as sc,_ as va,bg as Xe,bD as Bt,dp as oc,a9 as Ta,Q as nt,l as ee,w as rt,dq as cc,bP as ba,dr as It,ds as ic,a6 as Rt,dt as dc,ac as Sr,at as kt,du as lc,ao as yr,H as Ir,K as kr,bl as uc,dv as mc,dw as Cc,dx as pc,dy as hc,dz as fc,dA as gc,E as za,dB as bc,dC as Sc,m as pt,k as yc,dD as Ic,dE as kc,dF as Ec,ag as Ac,dG as Dc,dH as _c,h as Pc}from"./index-Dp_Uc3gy.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-D-_RYGgU.js";import{a as r}from"./sentry-DjmIorbX.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-DWkTPomv.js";import{M as Ae}from"./MobileAppDrawer-CsfNveW9.js";import{d as Ut}from"./recharts-By7FVN8f.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-B0b-Fgla.js";import{u as wr}from"./useInitialThreadRequest-BaIZPAUw.js";import st from"./NotFoundScreen-DDA41Ig7.js";import{u as Nt}from"./useChargeCardPusherEvents-Ce-wULUB.js";import{n as Sn}from"./utils-iOnDyQuG.js";import{t as Lc}from"./AddressScreen-Ce6wpOqL.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./InboxNotificationsProvider-LdTK3V9o.js";import"./useTaskManagerAccess-CFJAytRv.js";import"./BusinessVerificationPageScreen-B6gKgGKZ.js";import"./routePaths-BALvGXpp.js";import"./analyticsHelper-BkudU6tc.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]="8f2527fa-d9e0-4c0d-8754-5c6b6172cd83",e._sentryDebugIdIdentifier="sentry-dbid-8f2527fa-d9e0-4c0d-8754-5c6b6172cd83")}catch{}})();const Bc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Bc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Tr(){const e=le(),a=d((t=>_t(t.cardPolicyState))),n=d((t=>cs(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(Pt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:yn}}}=aa.getLocalizedStrings(),Rc=e=>On(e,!1),Oc=e=>Un(e.name,!1);function Uc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((P=>{m(P)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:l,onAskAiCfoClick:B}=Fa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(is()),t(ds()),t(hn())}),[t]);const D=d((P=>_n(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>vn(P.cardPolicyState))),S=d((P=>Tn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>_t(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{D!=="Completed"&&D!=="In-Progress"&&t(Ln())}),[t,D]),Tr();const k=d((P=>Bn(P.createCardPolicyState))),V=d((P=>ls(P.createCardPolicyState))),w=d((P=>us(P.cardPolicyState))),y=d((P=>ms(P.cardPolicyState))),F=d((P=>Cs(P.createCardPolicyState))),i=d((P=>Rn(P)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const g=r.useMemo((()=>C.map(Rc)),[C]),R=r.useMemo((()=>p.map(Oc)),[p]),G=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(vr)),[i.cards]),M=D==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:G,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,G,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const z=r.useCallback((P=>{L(P)}),[L]),j=k.fetchState,h=n!=null?`/${n}/cards/policy`:"..",H=r.useCallback((()=>{const P=we(a.state?.pathnameStackToGoBack),ae=P.poppedPathname??h;e(ae,{state:{pathnameStackToGoBack:P.newStack}})}),[a.state,e,h]),W=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),Z=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=r.useCallback((()=>{t(hn())}),[t]),T=r.useRef(j);r.useEffect((()=>{const P=T.current;T.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(We({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const v=j==="Error"?k.error?.message??yn.createPolicyGenericErrorMessage:void 0;return f&&n!=null?F==null?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:yn.createPageTitle,onBackClick:H,onClickMenuIcon:u,isAiCfoAccessEnabled:l,onAskAiCfoClick:B})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Jo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:v,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:W,onClickMenuIcon:u,onFormChange:_,onSubmit:Z,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jc}}}=aa.getLocalizedStrings(),Mc=e=>On(e,!1),Nc=e=>Un(e.name,!1);function Vc(){const e=ie(),a=me(),{tenantEmailDomain:n,templateId:t}=Ve(),s=le(),f=Re(),b=Fe(f?.loggedInUserRoleMap),[m,A]=r.useState(!1),u=r.useCallback((v=>{A(v)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((v=>bs(v))),O=d((v=>_n(v.cardPolicyState))),U=d((v=>Pn(v.cardPolicyState))),S=d((v=>wn(v.cardPolicyState))),c=d((v=>vn(v.cardPolicyState))),p=d((v=>Tn(v.cardPolicyState))),x=d((v=>Fn(v.cardPolicyState))),E=d((v=>xn(v.cardPolicyState))),I=d((v=>_t(v.cardPolicyState))),k=d((v=>Rn(v))),V=d((v=>t!=null?Ss(v.cardPolicyState,t):void 0)),w=r.useMemo((()=>C.templateId===t&&C.formDraft!=null?C.formDraft:V!=null?ys(V):void 0),[C.templateId,C.formDraft,V,t]);r.useEffect((()=>{if(t==null)return;const v=C.detailFetchState.fetchState;C.templateId===t&&(v==="Completed"||v==="In-Progress")||V!=null||s(Is(t))}),[s,t,C.templateId,C.detailFetchState.fetchState,V]),r.useEffect((()=>{O!=="Completed"&&O!=="In-Progress"&&s(Ln())}),[s,O]),Tr();const y=d((v=>v.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const F=r.useMemo((()=>U.map(Mc)),[U]),i=r.useMemo((()=>E.map(Nc)),[E]),g=r.useMemo((()=>k.cards.filter((v=>!mr(v.status.code))).map(vr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Xo({draft:w,cardRows:g,categorySearchOptions:F,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:c,suggestedAllowCategories:p,suggestedBlockCategories:x})}),[w,g,F,i,y,S,c,p,x]),[G,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||G!=null||R==null||(L.current=!0,M(R))}),[G,R]);const z=r.useCallback((v=>{M(v)}),[]),j=r.useMemo((()=>Ut((v=>{s(Pt(v))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((v=>{j(v)}),[j]),H=C.updateFetchState.fetchState,W=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??W;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,W]),Z=r.useCallback((()=>{e(W)}),[e,W]),N=r.useCallback((v=>{if(t==null)return;const P=Cr(v);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const v=$.current;$.current=H,H==="Completed"&&v!=="Completed"&&(s(We({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(W))}),[s,H,e,W]);const T=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&O==="Completed"&&k.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(ec,{templateName:C.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:T,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:Z,onClickMenuIcon:l,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:_,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function Fr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function xr(e){return d((a=>e==null||e===""?{chips:ht,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ht:ht,isResolved:s}})(As(a,e))),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:$c}}}}=aa.getLocalizedStrings(),Kc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function zc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((h=>{m(h)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:l}=de(),{isFeatureEnabled:B}=l(q.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>Ds(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>_s(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),Dt),x=S.fetchState==="In-Progress"?Math.max(p.length,1):0,E=d((h=>Ps(h.createCardPolicyState))),I=Sa(S.fetchState);r.useEffect((()=>{if(I==="In-Progress"&&S.fetchState==="Completed"&&c!=null)p.forEach((h=>{t(St({chatSessionId:c,id:h.id,entityIds:E,kind:"created_policy"}))}));else if(I==="In-Progress"&&S.fetchState==="Error"&&c!=null){p.forEach((H=>{t(St({chatSessionId:c,id:H.id,kind:"errored_policy"}))}));const h=S.error?.message!=null&&S.error.message.length>0?S.error.message:aa.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(We({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(We({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:W,isFileUploadEnabled:_}=h,Z=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:T,setIsAiCfoOpen:v}=hr(),P=fr(),ae=gr(),Ce=d((Q=>jn(Q))).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((Q=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);Z(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:Q,aiCfoShouldSubmit:Q!=null&&Q.trim().length>0}})}),[N.pathname,N.state,Z,$]),oe=r.useCallback((Q=>{Q.trim().length!==0&&(be(""),he(Q))}),[he]),J=r.useCallback((()=>{const Q=re.trim();Q.length!==0&&(be(""),he(Q))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((Q=>{be(Q)}),[]),fe=r.useCallback((()=>{v(!0)}),[v]),Te=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&W)return{aiAgentName:$c,headline:Hc,subheadline:Gc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:_,onInputChange:De,onSubmit:J,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:Te,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,W,_,Ce,De,Te,fe,oe,Se,J,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=D&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,G=r.useCallback((()=>{const h=we(a.state?.pathnameStackToGoBack),H=h.poppedPathname??"..";e(H,{state:{pathnameStackToGoBack:h.newStack}})}),[a.state,e]),M=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),L=r.useCallback((h=>{n!=null&&e(`/${n}/cards/policy/${h}/edit`)}),[e,n]),z=r.useCallback((h=>{t(vs(h))}),[t]),j=U.fetchState.fetchState;return!F&&j!=="Completed"&&j!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(ac,{onBackClick:G,onNewPolicyClick:M,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:O})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{policies:y,archivingTemplateId:U.archiveTargetTemplateId,pendingCreationCount:x,onBackClick:G,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function Wc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((X=>ge(X))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((X=>Za(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=m(q.isChargeCardFeatureEnabled),C=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=m(q.isDebitCardFeatureEnabled),U=xe(s),S=Le(s),c=Be(O,s),p=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:c}),E=Ue({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:D,isBookKeepingTenant:S,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:p}),I=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=d((X=>da(X,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((X=>ua(X))),F=d((X=>X.classListState.fetchState)),i=!B&&E&&C,g=d((X=>wt(X,a,i,E))),[R,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((X=>L!=null?Ga(X.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((X=>j!=null?$a(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,W=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=W?.accountingClassIDs[0],Z=d((X=>_!=null?$a(X.classState,{classId:_,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",$=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n(Ka()),$&&n(We({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,$]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(G(!0),n(Ia(a,i,!1)))}),[R,g,a,n]),r.useEffect((()=>{if(g.fetchState==="Completed"&&(N===!1||N&&M?.status?.code!=="active"||M?.cardHolderUserId!==t.userId||l===!1&&A===!1||M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,M,l);e(X)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(vt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const T=()=>{if(t!=null&&a!=null){n(Ka());const X=_e(s.tenantEmailDomain,a,t);e(X)}},v=M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card",P=ea(E,x,I,C),ae=xa(E,C,b,w,y),Ce=Ar(v,g);return g.fetchState!=="Completed"?o.jsx(wa,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{showConfetti:l}),o.jsx(nc,{onGotItClick:T,isDebitCard:M?.type.code==="business_physical_debit_card",controllerEmails:V,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:C,productInformation:P,creditAccountInformation:ae,debitAccountInformation:Ce,chargeCardDetailView:g,creditAccount:w,classListFetchState:F,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:Z?.className})]})}const Lr="charge-card-transaction-update",Br="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",$t="charge-card-renamed",Yc="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ba="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Zc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Ts({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Qc(){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??Jc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Zc),onEvent:D=>{switch(D){case Ba:case La:return void a(Da(!0))}},onSubscribed:()=>{a(Da(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(Da()))}),[f,m,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const B=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||B?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?o.jsx(st,{}):o.jsx(qc,{onBackClick:u,initialOpenThreadRequest:A}):o.jsx(rc,{onBackClick:u})}const Jc=e=>`/${e}/cards`,Xc={containerWidth:new Ta(100,58)},ei=({appContent:e})=>{const a=va(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,D]=r.useState(!1),[C,O]=r.useState(!1),U=te.getSignedInUser();if(U==null)throw Error("Can't access onboarding card page without signing in...");const S=d((Z=>ge(Z)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((Z=>Fs(Z,s))),E=x.chargeCard,I=d((Z=>Z.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),G=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:G,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),z=!g&&L&&i;r.useEffect((()=>{m===!1&&I!=="In-Progress"&&I!=="Completed"&&(n(qa()),A(!0)),u===!1&&x.fetchState==="Not-Started"&&(l(!0),n(Ia(s,z,L)))}),[u,x.fetchState,m,I]);const j=E?.type.code==="business_physical_credit_card"||E?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(x.fetchState==="Completed"){if(B===!1&&(j===!1||j&&E?.status?.code!=="inactive"||E?.cardHolderUserId!==U.userId)){const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(Z,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Qa()),t(Z,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((Z=>Vn(Z.userState,U.userId))),W=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((Z=>Z.statusCode==="success"))===!0&&B===!1&&(setTimeout(W,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=Z=>{O(Z)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:_}),o.jsx(ai,{cardId:s,card:E,shippingAddressId:E.shippingAddressId,phone:H.phone,signedInUser:U,isSandboxEnv:Bt(),chargeCardDetailState:x,signedInUserToken:h,navigate:t,currentTenant:S,location:f,maxChargeCardActivationAttempts:p[s]!=null?p[s]:c.default_max_charge_card_activation_attempts!=null?c.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:c.charge_card_cashback_rate_per_transaction!=null?c.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{_(!0)}}),e!=null?o.jsx(ti,{windowSize:a,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const f=Ls(e.addressState,n);if(f==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),m=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const l=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Bs())||l,showMenuIcon:u,shippingAddress:f,vgsVaultId:nt.cardVaultId,twoFAView:b,activationWaitStatus:m,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:f,chargeCardDetailState:b}=a,m=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=f;return{onGetOtp:u=>{m!=null&&e(et(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Os(t,u))},onResendOtp:u=>{m!=null&&e(Xa(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Ja(u,l,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),l=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?na(A):u.poppedPathname;n(l,{state:{pathnameStackToGoBack:u.newStack}})}}}))(oc),ti=He.div`
1
+ import{j as o}from"./liveblocks-Css5YxVy.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Je,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-CSm69gJV.js";import{fV as _t,a0w as cs,g5 as Pt,bu as Fe,a0x as is,a0y as ds,fK as hn,a0z as _n,fT as Pn,a0A as wn,a0B as vn,a0C as Tn,a0D as Fn,fU as xn,g4 as Ln,a0E as Bn,a0F as ls,f_ as us,fZ as ms,a0G as Cs,KA as Rn,g7 as ia,a0H as ps,a0I as hs,fM as fs,fL as gs,gk as We,g0 as On,f$ as Un,a0J as bs,g1 as Ss,K6 as ys,K5 as Is,K9 as ks,Kb as Es,gd as As,fH as jn,a0K as Ds,a0L as _s,gi as Mn,a0M as Ps,gj as St,Kh as ws,Ke as vs,fI as ge,a0N as Za,d$ as xe,dj as Le,e0 as Be,h2 as da,cC as la,a0O as ua,a0P as wt,Dk as Ga,mb as $a,a0Q as Ka,KQ as Ia,g8 as Qe,KS as vt,m1 as Nn,a0R as ma,KE as Da,a0S as Ts,a0T as Fs,KH as qa,a0U as xs,ZH as Qa,g3 as Vn,KN as ga,iu as Ls,a0V as Hn,fW as Ca,br as Bs,a0W as Rs,gJ as Ja,gI as Xa,Lk as Os,gH as et,a0X as Gn,cv as $n,db as Us,ZG as Pa,LV as Kn,a0Y as fn,Lv as _a,a0Z as zn,LW as js,_5 as Ms,LX as Ns,N3 as Vs,CA as Hs,MZ as Gs,a0_ as $s,KR as oa,a0$ as Ks,a10 as zs,a11 as Ws,a12 as Ys,a13 as Zs,a14 as Tt,a15 as qs,L5 as Wn,K_ as Qs,a16 as Js,h4 as Xs,a17 as Yn,Le as Zn,Li as qn,h3 as eo,a18 as ao,LH as Qn,a19 as to,a1a as no,a1b as ro,Lg as Jn,L1 as Xn,KK as er,La as ar,L8 as tr,Lc as so,a1c as nr,a1d as oo,gf as co,gg as io,gh as lo,a1e as at,g9 as rr,dd as Ft,a1f as uo,a1g as mo,a1h as Co,a1i as po,Lq as yt,LO as ho,LK as fo,Lm as go,LM as bo,LC as So,LE as yo,a1j as sr,LU as Ha,SR as Io,a1k as ko,a1l as Eo,a1m as Ao,a1n as or,a1o as Do,Mf as _o,Lu as cr,Lp as Ne,Lt as Po,a1p as wo,a1q as vo,KB as To,a1r as ir,g2 as dr,a1s as Fo,KD as xo,KC as gn,a1t as Lo,a1u as Bo,a1v as Ro,V_ as Oo,a1w as xt,a1x as Uo,xz as lr,mL as jo,ij as Mo,Mk as No,a1y as ur,fQ as Vo,fR as Ho,a1z as Go,dQ as $o,g6 as Ko,Ma as zo,M4 as qe,bq as Wo,bK as Yo,cH as Zo,bL as qo,UR as Qo}from"./zeni-epic-state-CQbasAjU.js";import{V as Re,dc as mr,a2 as we,dd as Cr,de as pr,df as Jo,G as aa,aq as Lt,dg as Xo,dh as ec,a as hr,e as fr,ap as gr,p as Ee,c as de,$ as q,j as Sa,di as br,dj as ac,dk as tc,z as te,a5 as wa,d1 as tt,dl as nc,dm as rc,dn as sc,_ as va,bg as Xe,bD as Bt,dp as oc,a9 as Ta,Q as nt,k as ee,w as rt,dq as cc,bP as ba,dr as It,ds as ic,a6 as Rt,dt as dc,ac as Sr,at as kt,du as lc,ao as yr,F as Ir,K as kr,bl as uc,dv as mc,dw as Cc,dx as pc,dy as hc,dz as fc,dA as gc,D as za,dB as bc,dC as Sc,m as pt,I as yc,dD as Ic,dE as kc,dF as Ec,ag as Ac,dG as Dc,dH as _c,h as Pc}from"./index-Di0x3KLC.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-CgZjFJJF.js";import{a as r}from"./sentry-BBNrx1Ml.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-Ba1QPj42.js";import{M as Ae}from"./MobileAppDrawer-DfWAieCr.js";import{d as Ut}from"./recharts-DQBC-7lc.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-D3fdAxOs.js";import{u as wr}from"./useInitialThreadRequest-2hi5iAsL.js";import st from"./NotFoundScreen-Bowln8Np.js";import{u as Nt}from"./useChargeCardPusherEvents-Bc01kHYP.js";import{n as Sn}from"./utils-B8asVtkx.js";import{t as Lc}from"./AddressScreen-Doe_aPe9.js";import"./analytics-BreoHt0J.js";import"./plaid-vksPD1j4.js";import"./dnd-BvLWSTOT.js";import"./stripe-cKAAJElX.js";import"./lottie-scQSn0xo.js";import"./lexical-CC3pmboN.js";import"./pdf-DXPt-TDj.js";import"./InboxNotificationsProvider-C3xMqTmq.js";import"./useTaskManagerAccess-D_aPdTiN.js";import"./BusinessVerificationPageScreen-JarRxoSX.js";import"./routePaths-DNuW5jQV.js";import"./analyticsHelper-DbQsERTh.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]="f90eefa2-67c3-4ac0-8f06-f1e6128392bc",e._sentryDebugIdIdentifier="sentry-dbid-f90eefa2-67c3-4ac0-8f06-f1e6128392bc")}catch{}})();const Bc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Bc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Tr(){const e=le(),a=d((t=>_t(t.cardPolicyState))),n=d((t=>cs(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(Pt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:yn}}}=aa.getLocalizedStrings(),Rc=e=>On(e,!1),Oc=e=>Un(e.name,!1);function Uc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((P=>{m(P)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:l,onAskAiCfoClick:B}=Fa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(is()),t(ds()),t(hn())}),[t]);const D=d((P=>_n(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>vn(P.cardPolicyState))),S=d((P=>Tn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>_t(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{D!=="Completed"&&D!=="In-Progress"&&t(Ln())}),[t,D]),Tr();const k=d((P=>Bn(P.createCardPolicyState))),V=d((P=>ls(P.createCardPolicyState))),w=d((P=>us(P.cardPolicyState))),y=d((P=>ms(P.cardPolicyState))),F=d((P=>Cs(P.createCardPolicyState))),i=d((P=>Rn(P)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const g=r.useMemo((()=>C.map(Rc)),[C]),R=r.useMemo((()=>p.map(Oc)),[p]),G=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(vr)),[i.cards]),M=D==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:G,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,G,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const z=r.useCallback((P=>{L(P)}),[L]),j=k.fetchState,h=n!=null?`/${n}/cards/policy`:"..",H=r.useCallback((()=>{const P=we(a.state?.pathnameStackToGoBack),ae=P.poppedPathname??h;e(ae,{state:{pathnameStackToGoBack:P.newStack}})}),[a.state,e,h]),W=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),Z=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=r.useCallback((()=>{t(hn())}),[t]),T=r.useRef(j);r.useEffect((()=>{const P=T.current;T.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(We({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const v=j==="Error"?k.error?.message??yn.createPolicyGenericErrorMessage:void 0;return f&&n!=null?F==null?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:yn.createPageTitle,onBackClick:H,onClickMenuIcon:u,isAiCfoAccessEnabled:l,onAskAiCfoClick:B})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Jo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:v,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:W,onClickMenuIcon:u,onFormChange:_,onSubmit:Z,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jc}}}=aa.getLocalizedStrings(),Mc=e=>On(e,!1),Nc=e=>Un(e.name,!1);function Vc(){const e=ie(),a=me(),{tenantEmailDomain:n,templateId:t}=Ve(),s=le(),f=Re(),b=Fe(f?.loggedInUserRoleMap),[m,A]=r.useState(!1),u=r.useCallback((v=>{A(v)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((v=>bs(v))),O=d((v=>_n(v.cardPolicyState))),U=d((v=>Pn(v.cardPolicyState))),S=d((v=>wn(v.cardPolicyState))),c=d((v=>vn(v.cardPolicyState))),p=d((v=>Tn(v.cardPolicyState))),x=d((v=>Fn(v.cardPolicyState))),E=d((v=>xn(v.cardPolicyState))),I=d((v=>_t(v.cardPolicyState))),k=d((v=>Rn(v))),V=d((v=>t!=null?Ss(v.cardPolicyState,t):void 0)),w=r.useMemo((()=>C.templateId===t&&C.formDraft!=null?C.formDraft:V!=null?ys(V):void 0),[C.templateId,C.formDraft,V,t]);r.useEffect((()=>{if(t==null)return;const v=C.detailFetchState.fetchState;C.templateId===t&&(v==="Completed"||v==="In-Progress")||V!=null||s(Is(t))}),[s,t,C.templateId,C.detailFetchState.fetchState,V]),r.useEffect((()=>{O!=="Completed"&&O!=="In-Progress"&&s(Ln())}),[s,O]),Tr();const y=d((v=>v.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const F=r.useMemo((()=>U.map(Mc)),[U]),i=r.useMemo((()=>E.map(Nc)),[E]),g=r.useMemo((()=>k.cards.filter((v=>!mr(v.status.code))).map(vr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Xo({draft:w,cardRows:g,categorySearchOptions:F,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:c,suggestedAllowCategories:p,suggestedBlockCategories:x})}),[w,g,F,i,y,S,c,p,x]),[G,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||G!=null||R==null||(L.current=!0,M(R))}),[G,R]);const z=r.useCallback((v=>{M(v)}),[]),j=r.useMemo((()=>Ut((v=>{s(Pt(v))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((v=>{j(v)}),[j]),H=C.updateFetchState.fetchState,W=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??W;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,W]),Z=r.useCallback((()=>{e(W)}),[e,W]),N=r.useCallback((v=>{if(t==null)return;const P=Cr(v);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const v=$.current;$.current=H,H==="Completed"&&v!=="Completed"&&(s(We({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(W))}),[s,H,e,W]);const T=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&O==="Completed"&&k.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(ec,{templateName:C.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:T,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:Z,onClickMenuIcon:l,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:_,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function Fr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function xr(e){return d((a=>e==null||e===""?{chips:ht,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ht:ht,isResolved:s}})(As(a,e))),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:$c}}}}=aa.getLocalizedStrings(),Kc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function zc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((h=>{m(h)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:l}=de(),{isFeatureEnabled:B}=l(q.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>Ds(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>_s(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),Dt),x=S.fetchState==="In-Progress"?Math.max(p.length,1):0,E=d((h=>Ps(h.createCardPolicyState))),I=Sa(S.fetchState);r.useEffect((()=>{if(I==="In-Progress"&&S.fetchState==="Completed"&&c!=null)p.forEach((h=>{t(St({chatSessionId:c,id:h.id,entityIds:E,kind:"created_policy"}))}));else if(I==="In-Progress"&&S.fetchState==="Error"&&c!=null){p.forEach((H=>{t(St({chatSessionId:c,id:H.id,kind:"errored_policy"}))}));const h=S.error?.message!=null&&S.error.message.length>0?S.error.message:aa.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(We({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(We({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:W,isFileUploadEnabled:_}=h,Z=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:T,setIsAiCfoOpen:v}=hr(),P=fr(),ae=gr(),Ce=d((Q=>jn(Q))).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((Q=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);Z(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:Q,aiCfoShouldSubmit:Q!=null&&Q.trim().length>0}})}),[N.pathname,N.state,Z,$]),oe=r.useCallback((Q=>{Q.trim().length!==0&&(be(""),he(Q))}),[he]),J=r.useCallback((()=>{const Q=re.trim();Q.length!==0&&(be(""),he(Q))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((Q=>{be(Q)}),[]),fe=r.useCallback((()=>{v(!0)}),[v]),Te=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&W)return{aiAgentName:$c,headline:Hc,subheadline:Gc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:_,onInputChange:De,onSubmit:J,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:Te,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,W,_,Ce,De,Te,fe,oe,Se,J,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=D&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,G=r.useCallback((()=>{const h=we(a.state?.pathnameStackToGoBack),H=h.poppedPathname??"..";e(H,{state:{pathnameStackToGoBack:h.newStack}})}),[a.state,e]),M=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),L=r.useCallback((h=>{n!=null&&e(`/${n}/cards/policy/${h}/edit`)}),[e,n]),z=r.useCallback((h=>{t(vs(h))}),[t]),j=U.fetchState.fetchState;return!F&&j!=="Completed"&&j!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(ac,{onBackClick:G,onNewPolicyClick:M,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:O})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{policies:y,archivingTemplateId:U.archiveTargetTemplateId,pendingCreationCount:x,onBackClick:G,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function Wc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((X=>ge(X))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((X=>Za(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=m(q.isChargeCardFeatureEnabled),C=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=m(q.isDebitCardFeatureEnabled),U=xe(s),S=Le(s),c=Be(O,s),p=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:c}),E=Ue({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:D,isBookKeepingTenant:S,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:p}),I=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=d((X=>da(X,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((X=>ua(X))),F=d((X=>X.classListState.fetchState)),i=!B&&E&&C,g=d((X=>wt(X,a,i,E))),[R,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((X=>L!=null?Ga(X.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((X=>j!=null?$a(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,W=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=W?.accountingClassIDs[0],Z=d((X=>_!=null?$a(X.classState,{classId:_,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",$=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n(Ka()),$&&n(We({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,$]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(G(!0),n(Ia(a,i,!1)))}),[R,g,a,n]),r.useEffect((()=>{if(g.fetchState==="Completed"&&(N===!1||N&&M?.status?.code!=="active"||M?.cardHolderUserId!==t.userId||l===!1&&A===!1||M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,M,l);e(X)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(vt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const T=()=>{if(t!=null&&a!=null){n(Ka());const X=_e(s.tenantEmailDomain,a,t);e(X)}},v=M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card",P=ea(E,x,I,C),ae=xa(E,C,b,w,y),Ce=Ar(v,g);return g.fetchState!=="Completed"?o.jsx(wa,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{showConfetti:l}),o.jsx(nc,{onGotItClick:T,isDebitCard:M?.type.code==="business_physical_debit_card",controllerEmails:V,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:C,productInformation:P,creditAccountInformation:ae,debitAccountInformation:Ce,chargeCardDetailView:g,creditAccount:w,classListFetchState:F,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:Z?.className})]})}const Lr="charge-card-transaction-update",Br="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",$t="charge-card-renamed",Yc="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ba="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Zc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Ts({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Qc(){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??Jc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Zc),onEvent:D=>{switch(D){case Ba:case La:return void a(Da(!0))}},onSubscribed:()=>{a(Da(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(Da()))}),[f,m,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const B=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||B?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?o.jsx(st,{}):o.jsx(qc,{onBackClick:u,initialOpenThreadRequest:A}):o.jsx(rc,{onBackClick:u})}const Jc=e=>`/${e}/cards`,Xc={containerWidth:new Ta(100,58)},ei=({appContent:e})=>{const a=va(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,D]=r.useState(!1),[C,O]=r.useState(!1),U=te.getSignedInUser();if(U==null)throw Error("Can't access onboarding card page without signing in...");const S=d((Z=>ge(Z)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((Z=>Fs(Z,s))),E=x.chargeCard,I=d((Z=>Z.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),G=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:G,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),z=!g&&L&&i;r.useEffect((()=>{m===!1&&I!=="In-Progress"&&I!=="Completed"&&(n(qa()),A(!0)),u===!1&&x.fetchState==="Not-Started"&&(l(!0),n(Ia(s,z,L)))}),[u,x.fetchState,m,I]);const j=E?.type.code==="business_physical_credit_card"||E?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(x.fetchState==="Completed"){if(B===!1&&(j===!1||j&&E?.status?.code!=="inactive"||E?.cardHolderUserId!==U.userId)){const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(Z,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Qa()),t(Z,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((Z=>Vn(Z.userState,U.userId))),W=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((Z=>Z.statusCode==="success"))===!0&&B===!1&&(setTimeout(W,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=Z=>{O(Z)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:_}),o.jsx(ai,{cardId:s,card:E,shippingAddressId:E.shippingAddressId,phone:H.phone,signedInUser:U,isSandboxEnv:Bt(),chargeCardDetailState:x,signedInUserToken:h,navigate:t,currentTenant:S,location:f,maxChargeCardActivationAttempts:p[s]!=null?p[s]:c.default_max_charge_card_activation_attempts!=null?c.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:c.charge_card_cashback_rate_per_transaction!=null?c.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{_(!0)}}),e!=null?o.jsx(ti,{windowSize:a,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const f=Ls(e.addressState,n);if(f==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),m=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const l=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Bs())||l,showMenuIcon:u,shippingAddress:f,vgsVaultId:nt.cardVaultId,twoFAView:b,activationWaitStatus:m,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:f,chargeCardDetailState:b}=a,m=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=f;return{onGetOtp:u=>{m!=null&&e(et(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Os(t,u))},onResendOtp:u=>{m!=null&&e(Xa(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Ja(u,l,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),l=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?na(A):u.poppedPathname;n(l,{state:{pathnameStackToGoBack:u.newStack}})}}}))(oc),ti=He.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${Xc.containerWidth.value(e.windowSize)}%`};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-BYqz0SWy.js";import{a as g}from"./sentry-DjmIorbX.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-B1R51LGS.js";import{z as D,bq as F,a6 as P,l as V,K as L,r as C,br as j,ac as A,aE as U,p as B}from"./index-Dp_Uc3gy.js";import{fI as b,gL as M,B$ as R,gG as _,c9 as G,YQ as Y,bn as z,v2 as $,uS as q,mD as H,oc as S,YR as K,bF as Q,cF as N,on as Z,ox as J}from"./zeni-epic-state-M9sMLOaG.js";import"./mui-D-_RYGgU.js";import{d as W}from"./routePaths-BALvGXpp.js";import{M as X}from"./MobileAppDrawer-CsfNveW9.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="5ca6988d-d927-41ea-9f39-b07446890712",t._sentryDebugIdIdentifier="sentry-dbid-5ca6988d-d927-41ea-9f39-b07446890712")}catch{}})();const ee=E((function(t){const a=_(t),i=D.getSignedInUser(),p=b(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=G(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:z(i)}}),(function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=W(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(Z({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(K(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(H({files:e}))},onDeleteFile:e=>{t(q(e))},onEditFileName:(e,n)=>{t($(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>b(s))),d=r.companyId??D.getSignedInUserTenant(p)?.companyId;if(D.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(R())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(L.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-Css5YxVy.js";import{a as g}from"./sentry-BBNrx1Ml.js";import{h as w,u as x,g as k,i as T,j as O,l as E}from"./core-CSm69gJV.js";import{z as D,bq as F,a6 as P,k as V,K as L,q as C,br as j,ac as A,aE as U,p as B}from"./index-Di0x3KLC.js";import{fI as b,gL as M,B$ as R,gG as _,c9 as G,YQ as Y,bn as z,v2 as q,uS as $,mD as H,oc as S,YR as K,bF as Q,cF as N,on as Z,ox as J}from"./zeni-epic-state-CQbasAjU.js";import"./mui-CgZjFJJF.js";import{d as W}from"./routePaths-DNuW5jQV.js";import{M as X}from"./MobileAppDrawer-DfWAieCr.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="7ae13814-ea09-42a6-b7e2-cde0f9080c9e",a._sentryDebugIdIdentifier="sentry-dbid-7ae13814-ea09-42a6-b7e2-cde0f9080c9e")}catch{}})();const ee=E((function(a){const t=_(a),i=D.getSignedInUser(),p=b(a),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=G(p?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(a.companyConfigState),n=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:z(i)}}),(function(a,t){const{companyId:i,currentTenant:p,navigate:c,location:l}=t,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{a(J())},onAddressClick:e=>{const n=W(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(Z({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Q(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(K(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(H({files:e}))},onDeleteFile:e=>{a($(e))},onEditFileName:(e,n)=>{a(q(e,n.split(".")[0]))}}}))(j);function de(){const a=w(),t=x(),i=k(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>b(s))),d=r.companyId??D.getSignedInUserTenant(p)?.companyId;if(D.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),t(M(d)))}),[c,n,d,t]),g.useEffect((()=>{o==="Not-Started"&&t(R())}),[o,t]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(L.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as I}from"./liveblocks-BYqz0SWy.js";import{a as o}from"./sentry-DjmIorbX.js";import{u as F,h as R,g as H,j as C,N as w}from"./core-B1R51LGS.js";import{Uu as q,fI as z,go as G,pW as Q,gP as U,gn as V,gl as W,UU as B,gk as A}from"./zeni-epic-state-M9sMLOaG.js";import{u as J,z as E,L as T,G as K,E as M}from"./index-Dp_Uc3gy.js";import{n as X}from"./mui-D-_RYGgU.js";import{P as h,a as _}from"./AccountMappingScreen-CJpxPjym.js";import{t as Y}from"./getLocaleForTenant-Nj4zPyxj.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-DMcsRcZG.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";import"./MobileAppDrawer-CsfNveW9.js";import"./InboxNotificationsProvider-LdTK3V9o.js";import"./useTaskManagerAccess-CFJAytRv.js";import"./accountMappingHelper-1wM-u5pk.js";import"./empty-DDVSRnUK.js";import"./pdf-lib-2bJZTByw.js";import"./index-DUjhchTx.js";import"./url-SyxPcinx.js";import"./index-BgCxp-PW.js";import"./decodeURIComponentSafe-sNmSv15A.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]="4663c42c-4fc7-484f-ad1c-5f12836de403",t._sentryDebugIdIdentifier="sentry-dbid-4663c42c-4fc7-484f-ad1c-5f12836de403")}catch{}})();const te=X.div`
1
+ import{j as I}from"./liveblocks-Css5YxVy.js";import{a as o}from"./sentry-BBNrx1Ml.js";import{u as F,h as R,g as H,j as C,N as w}from"./core-CSm69gJV.js";import{Uu as q,fI as z,go as G,pW as Q,gP as U,gn as V,gl as W,UU as B,gk as A}from"./zeni-epic-state-CQbasAjU.js";import{u as J,z as E,L as T,G as K,D as M}from"./index-Di0x3KLC.js";import{n as X}from"./mui-CgZjFJJF.js";import{P as h,a as _}from"./AccountMappingScreen-BEj2Jzjh.js";import{t as Y}from"./getLocaleForTenant-uCoslywF.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-D6uUWSjU.js";import"./recharts-DQBC-7lc.js";import"./analytics-BreoHt0J.js";import"./plaid-vksPD1j4.js";import"./dnd-BvLWSTOT.js";import"./stripe-cKAAJElX.js";import"./lottie-scQSn0xo.js";import"./lexical-CC3pmboN.js";import"./pdf-DXPt-TDj.js";import"./utils-B8asVtkx.js";import"./MobileAppDrawer-DfWAieCr.js";import"./InboxNotificationsProvider-C3xMqTmq.js";import"./useTaskManagerAccess-D_aPdTiN.js";import"./accountMappingHelper-BIdzFaKc.js";import"./empty-BPKm1KLs.js";import"./pdf-lib-kfbS5Id9.js";import"./index-B-RYxEU1.js";import"./url-D0TdjO3t.js";import"./index-t_yPrnJX.js";import"./decodeURIComponentSafe-DD9Neunj.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]="ac8543da-a61a-45c5-8309-12227e9655cf",t._sentryDebugIdIdentifier="sentry-dbid-ac8543da-a61a-45c5-8309-12227e9655cf")}catch{}})();const te=X.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -8,4 +8,4 @@ import{j as I}from"./liveblocks-BYqz0SWy.js";import{a as o}from"./sentry-DjmIorb
8
8
  height: 100vh;
9
9
  background-color: ${t=>t.theme.colors.background};
10
10
  box-shadow: ${t=>`0px 2px ${M.sp1} ${t.theme.colors.dropShadowNormal}`};
11
- `;function we(){const t=F(),i=R(),v=H(),{setLoading:d,clearAllLoading:m}=J(),S=o.useRef(!1),x=o.useRef(!1),N=o.useRef(!1),f=o.useRef(!1),{code:O,realmId:$,state:L}=Z(v.search),p=O!==""&&$!==""&&L!=="";p&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===_.pending,P=j===_.ready,y=C((s=>q(s))),e=C((s=>z(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,c=e?.externalConnections?.saveConnectionState,b=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{d(T.CONNECTION_AUTH)}),[d]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(T.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,d]),o.useEffect((()=>{e.tenantId==null&&!x.current&&a!=null&&(x.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(Q(a.userId)))}),[x,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||c!=="Error"||(d(T.CONNECTION_AUTH),t(U(a.userId,e.tenantId)))}),[c]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(V(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),W(a?.userId,a?.zeniSessionId,e.tenantId),K.updateAppLocaleID(Y(B(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(U(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{y.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(y.tenantsCoreDetailsInOrder)}),[y.tenantsCoreDetailsInOrder.length,n]);const D=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&c==="In-Progress"&&(f.current=!0)}),[u,c]),o.useEffect((()=>{if(!u||D)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return f.current&&c==="Completed"?(sessionStorage.setItem(h,_.ready),m(),void i(s,{replace:!0})):f.current&&c==="Error"?(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(p||N.current||f.current||b!==!0||(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,D,c,p,b,e.tenantEmailDomain,m,t,i]),D)return null;if(p||b!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return P?I.jsx(w,{to:k,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
11
+ `;function we(){const t=F(),i=R(),v=H(),{setLoading:d,clearAllLoading:m}=J(),S=o.useRef(!1),x=o.useRef(!1),N=o.useRef(!1),p=o.useRef(!1),{code:O,realmId:$,state:L}=Z(v.search),f=O!==""&&$!==""&&L!=="";f&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===_.pending,P=j===_.ready,y=C((s=>q(s))),e=C((s=>z(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,c=e?.externalConnections?.saveConnectionState,D=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{d(T.CONNECTION_AUTH)}),[d]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(T.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,d]),o.useEffect((()=>{e.tenantId==null&&!x.current&&a!=null&&(x.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(Q(a.userId)))}),[x,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||c!=="Error"||(d(T.CONNECTION_AUTH),t(U(a.userId,e.tenantId)))}),[c]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(V(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),W(a?.userId,a?.zeniSessionId,e.tenantId),K.updateAppLocaleID(Y(B(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(U(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{y.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(y.tenantsCoreDetailsInOrder)}),[y.tenantsCoreDetailsInOrder.length,n]);const b=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&c==="In-Progress"&&(p.current=!0)}),[u,c]),o.useEffect((()=>{if(!u||b)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return p.current&&c==="Completed"?(sessionStorage.setItem(h,_.ready),m(),void i(s,{replace:!0})):p.current&&c==="Error"?(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(f||N.current||p.current||D!==!0||(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,b,c,f,D,e.tenantEmailDomain,m,t,i]),b)return null;if(f||D!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return P?I.jsx(w,{to:k,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-Css5YxVy.js";import{z as m}from"./index-Di0x3KLC.js";import{g as n}from"./QBOConnectionScreen-D6uUWSjU.js";import"./sentry-BBNrx1Ml.js";import{g as p,N as a}from"./core-CSm69gJV.js";import"./zeni-epic-state-CQbasAjU.js";import"./recharts-DQBC-7lc.js";import"./mui-CgZjFJJF.js";import"./analytics-BreoHt0J.js";import"./plaid-vksPD1j4.js";import"./dnd-BvLWSTOT.js";import"./stripe-cKAAJElX.js";import"./lottie-scQSn0xo.js";import"./lexical-CC3pmboN.js";import"./pdf-DXPt-TDj.js";import"./utils-B8asVtkx.js";import"./empty-BPKm1KLs.js";import"./pdf-lib-kfbS5Id9.js";import"./index-B-RYxEU1.js";import"./url-D0TdjO3t.js";import"./index-t_yPrnJX.js";import"./decodeURIComponentSafe-DD9Neunj.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};
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-BYqz0SWy.js";import{t as wn,A as Ge}from"./AddressScreen-Ce6wpOqL.js";import An from"./NotFoundScreen-DDA41Ig7.js";import{a as d,u as Me}from"./sentry-DjmIorbX.js";import{h as _e,g as xe,u as se,i as Ee,j as T,N as Q,q as Pn,l as cn,n as Dn,o as q}from"./core-B1R51LGS.js";import{fI as Y,e0 as Te,d$ as we,bq as jn,UL as Bn,bS as Fn,pU as Un,BL as Vn,BO as Ln,W6 as Rn,W7 as Nn,ly as Oe,lB as dn,Vm as $n,c0 as Gn,c9 as fe,Cd as Ae,B_ as Mn,W8 as me,Ce as un,SV as Qn,mL as ln,dj as pn,W9 as Kn,Wa as Wn,uL as zn,V9 as Ce,hZ as qn,V8 as be,hW as Hn,GJ as Jn,uP as Zn,hO as Xn,hR as Qe,Wb as mn,Wc as Yn,Mz as et,Wd as nt,MD as tt,BR as at,We as ot,Wf as st,lw as rt,lz as it,Cq as ct,C0 as gn,Cc as dt,bF as Ke,cF as ut,Cp as We,v2 as lt,uS as pt,mD as mt,gJ as gt,gI as ft,gH as yt,Wg as ht,BU as Ct,Cr as bt,Cu as St,Cx as It,CD as kt,dk as Ot}from"./zeni-epic-state-M9sMLOaG.js";import{z as W,c as Pe,$ as Z,f as vt,p as z,a6 as re,l as g,aC as _t,ag as fn,_ as xt,k as yn,V as hn,j as X,Q as ge,K as ve,aD as Et,E as ze,v as qe,ac as Tt,aE as He,aF as wt,aG as At}from"./index-Dp_Uc3gy.js";import{n as De}from"./mui-D-_RYGgU.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-DMcsRcZG.js";import{u as jt,a as Bt}from"./useEmailConnectResultRefresh-CQX3dx0q.js";import{u as Ft}from"./useChargeCardPusherEvents-Ce-wULUB.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";import"./empty-DDVSRnUK.js";import"./pdf-lib-2bJZTByw.js";import"./index-DUjhchTx.js";import"./url-SyxPcinx.js";import"./index-BgCxp-PW.js";import"./decodeURIComponentSafe-sNmSv15A.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]="93f06eba-272a-4956-b823-4caab7ed152a",e._sentryDebugIdIdentifier="sentry-dbid-93f06eba-272a-4956-b823-4caab7ed152a")}catch{}})();const Je=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Ut=()=>{const e=_e(),l=xe(),i=se(),[o,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=Ee(),n=W.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:C}=t(Z.isApAgingFeatureEnabled),{isFeatureEnabled:a}=t(Z.isArAgingFeatureEnabled),{isFeatureEnabled:A}=t(Z.isReferralFeatureEnabled),{isFeatureEnabled:w}=t(Z.isDebitCardFeatureEnabled),k=vt(),O=T((S=>Y(S))),P=T((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??W.getSignedInUserTenant(v)?.companyId;if(n==null)throw Error("Can't access onboarding flow without signing in...");const m=Te(w,O),b=we(O),D=[],V=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&jn(O?.userRole),x=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,E=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;V===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),x===!1&&D.push("bill_pay_card","bill_pay_promo_card"),E===!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 U=[];C===!1&&U.push("accounts_payable_aging"),a===!1&&U.push("accounts_receivable_aging"),U.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&U.push("rewards_card"),k===!1&&U.push("expense_automation_card");const H=Bn(S,U);return Fn(H.reportsInOrder.map((G=>({fetchState:G.fetchState,error:G.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||o||m||b||(p(!0),i(Un(n.userId,F,O.tenantId,!0,!1,D)))}),[o,P,m,b,n,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:z(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),$=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout($,6e3);return()=>clearTimeout(S)}),[$]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||$()}),[u,f,m,b,$]),P!=="Completed")return s.jsx(Q,{to:"../"});const R=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:R?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:R?.onboardingToQuoteSignMinutes??0,isKybDone:Je(R?.businessVerified?.status),isKycDone:Je(R?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:R?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_t,{show:!0,onComplete:$})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ze=(e,l)=>{const i=new Map(e.map((o=>[o.key,o])));return l.map((o=>{return p=i.get(o)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((o=>[o.key,o])));return l.every((o=>i.get(o)?.status==="ready"))},Ye=De.div`
1
+ import{j as s}from"./liveblocks-Css5YxVy.js";import{t as wn,A as Ge}from"./AddressScreen-Doe_aPe9.js";import An from"./NotFoundScreen-Bowln8Np.js";import{a as d,u as Me}from"./sentry-BBNrx1Ml.js";import{h as _e,g as xe,u as se,i as Te,j as E,N as Q,q as Pn,l as cn,n as Dn,o as q}from"./core-CSm69gJV.js";import{fI as Y,e0 as Ee,d$ as we,bq as jn,UL as Bn,bS as Fn,pU as Un,BL as Vn,BO as Ln,W6 as Rn,W7 as Nn,ly as Oe,lB as dn,Vm as $n,c0 as Gn,c9 as fe,Cd as Ae,B_ as Mn,W8 as me,Ce as un,SV as Qn,mL as ln,dj as pn,W9 as Kn,Wa as Wn,uL as zn,V9 as Ce,hZ as qn,V8 as be,hW as Hn,GJ as Jn,uP as Zn,hO as Xn,hR as Qe,Wb as mn,Wc as Yn,Mz as et,Wd as nt,MD as tt,BR as at,We as ot,Wf as st,lw as rt,lz as it,Cq as ct,C0 as gn,Cc as dt,bF as Ke,cF as ut,Cp as We,v2 as lt,uS as pt,mD as mt,gJ as gt,gI as ft,gH as yt,Wg as ht,BU as Ct,Cr as bt,Cu as St,Cx as It,CD as kt,dk as Ot}from"./zeni-epic-state-CQbasAjU.js";import{z as W,c as Pe,$ as Z,f as vt,p as z,a6 as re,k as g,aC as _t,ag as fn,_ as xt,I as yn,V as hn,j as X,Q as ge,K as ve,aD as Tt,D as ze,s as qe,ac as Et,aE as He,aF as wt,aG as At}from"./index-Di0x3KLC.js";import{n as De}from"./mui-CgZjFJJF.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-D6uUWSjU.js";import{u as jt,a as Bt}from"./useEmailConnectResultRefresh-DgdB9uv-.js";import{u as Ft}from"./useChargeCardPusherEvents-Bc01kHYP.js";import"./recharts-DQBC-7lc.js";import"./analytics-BreoHt0J.js";import"./plaid-vksPD1j4.js";import"./dnd-BvLWSTOT.js";import"./stripe-cKAAJElX.js";import"./lottie-scQSn0xo.js";import"./lexical-CC3pmboN.js";import"./pdf-DXPt-TDj.js";import"./utils-B8asVtkx.js";import"./empty-BPKm1KLs.js";import"./pdf-lib-kfbS5Id9.js";import"./index-B-RYxEU1.js";import"./url-D0TdjO3t.js";import"./index-t_yPrnJX.js";import"./decodeURIComponentSafe-DD9Neunj.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]="9b2e058e-fc4a-4fa8-94c5-dba8e1ee3543",e._sentryDebugIdIdentifier="sentry-dbid-9b2e058e-fc4a-4fa8-94c5-dba8e1ee3543")}catch{}})();const Je=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Ut=()=>{const e=_e(),l=xe(),i=se(),[o,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=Te(),n=W.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:C}=t(Z.isApAgingFeatureEnabled),{isFeatureEnabled:a}=t(Z.isArAgingFeatureEnabled),{isFeatureEnabled:A}=t(Z.isReferralFeatureEnabled),{isFeatureEnabled:w}=t(Z.isDebitCardFeatureEnabled),k=vt(),O=E((S=>Y(S))),P=E((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??W.getSignedInUserTenant(v)?.companyId;if(n==null)throw Error("Can't access onboarding flow without signing in...");const m=Ee(w,O),b=we(O),D=[],V=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&jn(O?.userRole),x=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,T=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;V===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),x===!1&&D.push("bill_pay_card","bill_pay_promo_card"),T===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=E((S=>{const U=[];C===!1&&U.push("accounts_payable_aging"),a===!1&&U.push("accounts_receivable_aging"),U.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&U.push("rewards_card"),k===!1&&U.push("expense_automation_card");const H=Bn(S,U);return Fn(H.reportsInOrder.map((G=>({fetchState:G.fetchState,error:G.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||o||m||b||(p(!0),i(Un(n.userId,F,O.tenantId,!0,!1,D)))}),[o,P,m,b,n,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:z(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),$=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout($,6e3);return()=>clearTimeout(S)}),[$]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||$()}),[u,f,m,b,$]),P!=="Completed")return s.jsx(Q,{to:"../"});const R=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:R?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:R?.onboardingToQuoteSignMinutes??0,isKybDone:Je(R?.businessVerified?.status),isKycDone:Je(R?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:R?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_t,{show:!0,onComplete:$})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ze=(e,l)=>{const i=new Map(e.map((o=>[o.key,o])));return l.map((o=>{return p=i.get(o)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((o=>[o.key,o])));return l.every((o=>i.get(o)?.status==="ready"))},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-BYqz0SWy.js";import{t as wn,A as Ge}from"./Addre
23
23
  }
24
24
 
25
25
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
26
- `,nn=cn((function(e,l){const{companyId:i,isAdmin:o,currentTenant:p,isOnAddressPage:u}=l,c=W.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=Y(e),C=Ae(e,i),a=mn(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Yn(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Tt.fileMicroServiceBaseUrl,authParams:n},signedInUser:W.getSignedInUser(),currentTenant:t,isAdmin:o,isOnAddressPage:u,cardPaymentView:a,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:o,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=o;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,C)=>{e(St(n,t,C))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(Ct(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((C=>{const{officerType:a,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:F,syncToken:m,selectDocument:b,role:D,ownership:V,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:a,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?He(P.selectedOption):void 0,phone:F,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:V,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:x,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:E}}));e(We({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(ht({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:C,companyIndustryType:a,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:F,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:V,stateOfIncorporation:h,incDate:r,companySourceOfFunds:x,companySourceOfFundsDescription:E,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:$,regulatedStatus:R,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:U,usNexus:H,usNexusTypes:G}=n,M={companyId:i,companyDescription:t,companyIndustry:C.selectedOption,companyIndustryType:a?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:V?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:x?.selectedOption??"",companySourceOfFundsDescription:E,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((L=>L.length===2?L:He(L)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:R??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:U,usNexus:H,usNexusTypes:G?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(We({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),a=z(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:a}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),a=z(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:a}})},onUpdateCustomerView:(n,t,C,a)=>{e(dt(i,!1,t,C,n,a))},onAddressEditHandler:n=>{if(n!=null){const t=wn(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=z(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=z(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,C)=>{e(rt(n,t,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=z(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(Et),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const o=fn(),p=_e(),u=xe(),c=se(),v=xt(),n=yn(),[t,C]=d.useState(!1),[a,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=Ee(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(Z.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=T((y=>y.onboardingCustomerViewState.fetchState)),D=T((y=>y.onboardingCustomerViewState.currentStep)),V=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:$}=Pt(u.search),R=h.externalConnections?.accounting[0],ee=R?.connectionType,S=R?.connectionName,U=R?.connectionId??"",H=W.getSignedInUser()?.userId??"",G=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{a||(A(!0),c(Oe()))}),[a,c]),d.useEffect((()=>{w||(dn(["card"]),k(!0))}),[w]),d.useEffect((()=>{E==="In-Progress"&&f==="Completed"&&c(Oe())}),[E,f]),d.useEffect((()=>{Dt(j,N,$,U,H)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c($n(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:U,user_id:H},Gn(window.location.origin+"/onboarding/auth"))),G.current={realmId:N,connectionId:U},g.trackOnboardingSaveQBOConnection(N,U),p(u.pathname))}),[j,N,$,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??W.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),L=T((y=>Ae(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(C(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=h.externalConnections?.saveConnectionState,je=X(ne);d.useEffect((()=>{je==="In-Progress"&&(ne==="Completed"||ne==="Error")&&V.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess(G.current.realmId,G.current.connectionId):g.trackOnboardingQBOConnectionFailed(G.current.realmId,G.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,je,V.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const Cn=X(L.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{L.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&L.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Cn==null&&c(ln({addressType:"company_registered_address",addressToCreate:L.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[L.companyDetailsLocalData?.addressStatus?.addressToCreate,L.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=L.isInterimEmailSent,Be=W.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const Sn=Te(F,h),In=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ue=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(h),On=h.productSettings.isTreasuryEnabled,Ve=Vt({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:M}),Le=(({companyId:y})=>{const K=se(),de=T((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),te=T((B=>Y(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vn())}),[K]);d.useEffect((()=>{he()}),[he]);const Re=d.useCallback((()=>{y==null||y===""||te||K(Ln(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const B=`private-encrypted-${y}`;return[`${B}.ledger-ingestion.counts-updated`,`${B}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((B,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(B!=="ledger-ingestion.counts-updated"){if(B==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",J=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:J==="starting"||J==="building"||J==="ready"?J:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Rn({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Ft({events:vn,onEvent:_n,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=Ze(B,Se),I=Ze(B,Ie),ue=Xe(B,Se),J=Xe(B,Ie),Ne=B.some((Tn=>Tn.status!=="idle")),oe=!te&&!Ne,$e=te&&!Ne,xn=$e?Se.map((()=>"building")):ae,En=$e?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:xn,backgroundRowStatuses:oe?void 0:En,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:J,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Re}}),[de?.phases,de?.counts,te,Re])})({companyId:M});if(Fe===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=L.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ue(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ve,aiAgentsActivationProps:Le,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Fe===!1&&P?.loggedInUserRoleMap!=null)return bn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ue(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ve,aiAgentsActivationProps:Le,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Vt=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const o=se(),{pendingAutoFocusTabId:p}=jt(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Bt({companyId:i}),n=T((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=T((r=>Y(r))),C=T((r=>r.tenantState.fetchState)),a=T((r=>Kn(r,i))),A=T((r=>Wn(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{o(zn(ke))}),[o]);const P=a.externalConnections?.saveAPIKeyConnectionState,_=a.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=a.externalConnections?.saveOAuthConnectionState,b=a.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 V=a.externalConnections?.saveConnectorCredentialsStateBySlug,h=X(V);return d.useEffect((()=>{const r=V??{},x=h??{},E=a.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??"")}))}),[V,h,a]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:a,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:a.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:a.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:a.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:a.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:a.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(a.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,x])=>[r,x?.message]))),deleteConnectionState:a.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:a.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),o(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),o(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,x)=>{const E=a.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=[...a.externalConnections?.accounting??[],...a.externalConnections?.payments??[],...a.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),o(Xn(k,r,be(x)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Zn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{a.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Jn())},onSaveChargeBeeCredentials:(r,x)=>{const E=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;E!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),o(Hn(k,E,be("revenue"),Ce("chargebee"),{api_key:r,site:x})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),o(qn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,a,C,w,p,k,l,e,o,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let o=`/${e}/onboarding/address`;return o=i!=null?o.concat(`/edit/${l}/${encodeURIComponent(i)}`):o.concat(`/new/${l}`),o}const on=De.div`
26
+ `,nn=cn((function(e,l){const{companyId:i,isAdmin:o,currentTenant:p,isOnAddressPage:u}=l,c=W.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=Y(e),C=Ae(e,i),a=mn(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Yn(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Et.fileMicroServiceBaseUrl,authParams:n},signedInUser:W.getSignedInUser(),currentTenant:t,isAdmin:o,isOnAddressPage:u,cardPaymentView:a,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:o,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=o;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,C)=>{e(St(n,t,C))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(Ct(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((C=>{const{officerType:a,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:F,syncToken:m,selectDocument:b,role:D,ownership:V,isSelectedForVerification:h,userVerificationStatus:r,fileIds:x,isPhoneVerified:T}=C;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:a,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?He(P.selectedOption):void 0,phone:F,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:V,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:x,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:T}}));e(We({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(ht({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:C,companyIndustryType:a,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:F,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:V,stateOfIncorporation:h,incDate:r,companySourceOfFunds:x,companySourceOfFundsDescription:T,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:$,regulatedStatus:R,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:U,usNexus:H,usNexusTypes:G}=n,M={companyId:i,companyDescription:t,companyIndustry:C.selectedOption,companyIndustryType:a?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:V?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:x?.selectedOption??"",companySourceOfFundsDescription:T,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((L=>L.length===2?L:He(L)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:R??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:U,usNexus:H,usNexusTypes:G?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(We({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),a=z(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:a}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),a=z(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:a}})},onUpdateCustomerView:(n,t,C,a)=>{e(dt(i,!1,t,C,n,a))},onAddressEditHandler:n=>{if(n!=null){const t=wn(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=z(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=z(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,C)=>{e(rt(n,t,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=z(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(Tt),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const o=fn(),p=_e(),u=xe(),c=se(),v=xt(),n=yn(),[t,C]=d.useState(!1),[a,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=Te(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(Z.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=E((y=>y.onboardingCustomerViewState.fetchState)),D=E((y=>y.onboardingCustomerViewState.currentStep)),V=E((y=>y.onboardingCustomerViewState.uiState)),h=E((y=>Y(y))),r=E((y=>y.userRoleConfigState.fetchState)),x=E((y=>y.cardPaymentViewState)),T=X(x.addCardPaymentSourceStatus.fetchState),f=x.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:$}=Pt(u.search),R=h.externalConnections?.accounting[0],ee=R?.connectionType,S=R?.connectionName,U=R?.connectionId??"",H=W.getSignedInUser()?.userId??"",G=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{a||(A(!0),c(Oe()))}),[a,c]),d.useEffect((()=>{w||(dn(["card"]),k(!0))}),[w]),d.useEffect((()=>{T==="In-Progress"&&f==="Completed"&&c(Oe())}),[T,f]),d.useEffect((()=>{Dt(j,N,$,U,H)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c($n(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:U,user_id:H},Gn(window.location.origin+"/onboarding/auth"))),G.current={realmId:N,connectionId:U},g.trackOnboardingSaveQBOConnection(N,U),p(u.pathname))}),[j,N,$,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??W.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),L=E((y=>Ae(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(C(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=h.externalConnections?.saveConnectionState,je=X(ne);d.useEffect((()=>{je==="In-Progress"&&(ne==="Completed"||ne==="Error")&&V.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess(G.current.realmId,G.current.connectionId):g.trackOnboardingQBOConnectionFailed(G.current.realmId,G.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,je,V.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const Cn=X(L.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{L.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&L.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Cn==null&&c(ln({addressType:"company_registered_address",addressToCreate:L.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[L.companyDetailsLocalData?.addressStatus?.addressToCreate,L.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=L.isInterimEmailSent,Be=W.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const Sn=Ee(F,h),In=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ue=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(h),On=h.productSettings.isTreasuryEnabled,Ve=Vt({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:M}),Le=(({companyId:y})=>{const K=se(),de=E((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),te=E((B=>Y(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vn())}),[K]);d.useEffect((()=>{he()}),[he]);const Re=d.useCallback((()=>{y==null||y===""||te||K(Ln(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const B=`private-encrypted-${y}`;return[`${B}.ledger-ingestion.counts-updated`,`${B}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((B,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(B!=="ledger-ingestion.counts-updated"){if(B==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",J=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:J==="starting"||J==="building"||J==="ready"?J:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Rn({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Ft({events:vn,onEvent:_n,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=Ze(B,Se),I=Ze(B,Ie),ue=Xe(B,Se),J=Xe(B,Ie),Ne=B.some((En=>En.status!=="idle")),oe=!te&&!Ne,$e=te&&!Ne,xn=$e?Se.map((()=>"building")):ae,Tn=$e?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:xn,backgroundRowStatuses:oe?void 0:Tn,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:J,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Re}}),[de?.phases,de?.counts,te,Re])})({companyId:M});if(Fe===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=L.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ue(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ve,aiAgentsActivationProps:Le,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Fe===!1&&P?.loggedInUserRoleMap!=null)return bn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ue(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ve,aiAgentsActivationProps:Le,meetingUrl:o("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Vt=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const o=se(),{pendingAutoFocusTabId:p}=jt(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Bt({companyId:i}),n=E((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=E((r=>Y(r))),C=E((r=>r.tenantState.fetchState)),a=E((r=>Kn(r,i))),A=E((r=>Wn(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{o(zn(ke))}),[o]);const P=a.externalConnections?.saveAPIKeyConnectionState,_=a.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=a.externalConnections?.saveOAuthConnectionState,b=a.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 V=a.externalConnections?.saveConnectorCredentialsStateBySlug,h=X(V);return d.useEffect((()=>{const r=V??{},x=h??{},T=a.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(x[f]!=="In-Progress")return;let j;try{j=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",T[f]?.message??"")}))}),[V,h,a]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:a,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:a.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:a.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:a.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:a.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:a.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(a.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,x])=>[r,x?.message]))),deleteConnectionState:a.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:a.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),o(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),o(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,x)=>{const T=a.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(T==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:x,connection_id:T,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,x)=>{const T=[...a.externalConnections?.accounting??[],...a.externalConnections?.payments??[],...a.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=T!=null?Ce(T):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",x),o(Xn(k,r,be(x)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Zn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{a.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Jn())},onSaveChargeBeeCredentials:(r,x)=>{const T=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;T!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),o(Hn(k,T,be("revenue"),Ce("chargebee"),{api_key:r,site:x})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),o(qn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,a,C,w,p,k,l,e,o,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let o=`/${e}/onboarding/address`;return o=i!=null?o.concat(`/edit/${l}/${encodeURIComponent(i)}`):o.concat(`/new/${l}`),o}const on=De.div`
27
27
  display: flex;
28
28
  height: 100vh;
29
29
  background-color: ${e=>e.theme.colors.grey4};
30
- `,sn=cn((function(e,l){const{companyId:i,currentTenant:o}=l,p=Ae(e,i),u=mn(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(o?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:W.getSignedInUser(),currentTenant:o}}),(function(e,l){const{currentTenant:i,themeState:o,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const v=z(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=z(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(At),Lt=()=>{const e=fn(),l=_e(),i=se(),o=xe(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(Z.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=Ee(),n=hn(),[t,C]=d.useState(!1);d.useEffect((()=>{t===!1&&o.state?.message==="OnboardingThankyou"&&C(!0)}),[o.state]);const a=T((m=>Y(m))),A=a.productSettings.isOtherProductsEnabled,w=A===!0&&!pn(a);d.useEffect((()=>{i(gn(k,!1,!w))}),[]);const k=a.companyId??W.getSignedInUserTenant(v)?.companyId;if(n.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Te(c,a),P=we(a),_=T((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),F=a.company?.companyOnboardingInfo.isOnboardingCompleted;if(F!==!0||w)return _==="Completed"&&F===!0&&w&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",Ot(a.productSettings))}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&F===!1&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):s.jsx(wt,{});{const m={pathnameStackToGoBack:o.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rn(){return typeof Me=="function"?Me():void 0}let pe=0;function Rt(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const o=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rn();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&o()}),1e3)),()=>{l=!0,o(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rn();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Rt(),s.jsxs(Dn,{children:[s.jsx(q,{path:"/",element:s.jsx(le,{})}),s.jsx(q,{path:"/billing/edit",element:s.jsx(le,{taxCFOCustomer:!0})}),s.jsx(q,{path:"/thankyou",element:s.jsx(Lt,{})}),s.jsx(q,{path:"/activation",element:s.jsx(Ut,{})}),s.jsx(q,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(q,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(q,{path:"*",element:s.jsx(An,{})})]})}export{pa as default};
30
+ `,sn=cn((function(e,l){const{companyId:i,currentTenant:o}=l,p=Ae(e,i),u=mn(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(o?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:W.getSignedInUser(),currentTenant:o}}),(function(e,l){const{currentTenant:i,themeState:o,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const v=z(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=z(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(At),Lt=()=>{const e=fn(),l=_e(),i=se(),o=xe(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(Z.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=Te(),n=hn(),[t,C]=d.useState(!1);d.useEffect((()=>{t===!1&&o.state?.message==="OnboardingThankyou"&&C(!0)}),[o.state]);const a=E((m=>Y(m))),A=a.productSettings.isOtherProductsEnabled,w=A===!0&&!pn(a);d.useEffect((()=>{i(gn(k,!1,!w))}),[]);const k=a.companyId??W.getSignedInUserTenant(v)?.companyId;if(n.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Ee(c,a),P=we(a),_=E((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),F=a.company?.companyOnboardingInfo.isOnboardingCompleted;if(F!==!0||w)return _==="Completed"&&F===!0&&w&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",Ot(a.productSettings))}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&F===!1&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:A,location:o,companyId:k,currentTenant:a,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):s.jsx(wt,{});{const m={pathnameStackToGoBack:o.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rn(){return typeof Me=="function"?Me():void 0}let pe=0;function Rt(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const o=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rn();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&o()}),1e3)),()=>{l=!0,o(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rn();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Rt(),s.jsxs(Dn,{children:[s.jsx(q,{path:"/",element:s.jsx(le,{})}),s.jsx(q,{path:"/billing/edit",element:s.jsx(le,{taxCFOCustomer:!0})}),s.jsx(q,{path:"/thankyou",element:s.jsx(Lt,{})}),s.jsx(q,{path:"/activation",element:s.jsx(Ut,{})}),s.jsx(q,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(q,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(q,{path:"*",element:s.jsx(An,{})})]})}export{pa as default};