@zeniai/web-app-ui 5.3.98-qa → 5.3.99-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 (156) hide show
  1. package/dist/assets/AccountMappingScreen-Cwa6Sncr.js +9 -0
  2. package/dist/assets/ActualMatchingMatchDetailScreen-JAoGrJi3.js +1 -0
  3. package/dist/assets/AddressRoutes-D0QZxsbK.js +1 -0
  4. package/dist/assets/AddressScreen-hby_CR8D.js +9 -0
  5. package/dist/assets/AiCfoScreen-DNDihu3K.js +22 -0
  6. package/dist/assets/{AppDrawer-B6XGm--J.js → AppDrawer-Cupbn6L3.js} +2 -2
  7. package/dist/assets/BillPayApprovalRoutes-sOvVtkKV.js +1 -0
  8. package/dist/assets/{BillPayRoutes-BXSQK4Z1.js → BillPayRoutes-DAZ2LiAE.js} +18 -18
  9. package/dist/assets/BusinessVerificationPageScreen-CpAzjlh5.js +9 -0
  10. package/dist/assets/{CardsAiCfoScreen-D7eizM_e.js → CardsAiCfoScreen-BP02_M1s.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-CHKFOxrs.js → ChargeCardRoutes-Ba3x5MoU.js} +8 -8
  12. package/dist/assets/{CompanyPassportScreen-Dk-3Eud9.js → CompanyPassportScreen-B7KOuZR_.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-CDQ0Sa51.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-CzX3lGuD.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-n-9HOpeM.js → CustomerOnboardingRoutes-B3teunq3.js} +3 -3
  16. package/dist/assets/DashboardRoutes-DnxyUY7k.js +20 -0
  17. package/dist/assets/{DefaultTenantHome-C-xDsqWH.js → DefaultTenantHome-DNm_mIU1.js} +1 -1
  18. package/dist/assets/DomesticWireDetailScreen-Cb0F3Rod.js +18 -0
  19. package/dist/assets/DrawerScreen-B5Qgxoe2.js +1 -0
  20. package/dist/assets/EntityDetailRoutes--Mqqoc0l.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-Ce113KIS.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-Bu-JxAVw.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-B12KbAGI.js +1 -0
  24. package/dist/assets/{InboxNotificationsProvider-Db8GSYr5.js → InboxNotificationsProvider-Bz8aI0zf.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-BEEsHk_H.js → InvoicingRoutes-IUj-CS51.js} +2 -2
  26. package/dist/assets/{MagicLinkRoutes-Dj9i4Hr2.js → MagicLinkRoutes-6bWvZ6Ex.js} +18 -18
  27. package/dist/assets/MagicLinkSignInScreen-kYQNLgBh.js +12 -0
  28. package/dist/assets/MobileAppDrawer-D4DOSbVQ.js +1 -0
  29. package/dist/assets/NotFoundScreen-D92eiixV.js +1 -0
  30. package/dist/assets/NotificationRoutes-BV6tu0jZ.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-BKzEKwhD.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-CcRkLhpt.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-C6K4l799.js → PaymentLinkScreen-DVW3u8lI.js} +5 -5
  34. package/dist/assets/PeopleRoutes-DPu9dF6W.js +22 -0
  35. package/dist/assets/PerformanceRoutes-D8D-QN7a.js +1 -0
  36. package/dist/assets/{Preview-Dmk92_3R.js → Preview-DSYEA-qi.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-w89pHWnf.js → QBOConnectionScreen-BbOyxErb.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-CixN0rww.js +1 -0
  39. package/dist/assets/ReimbursementApprovalRuleDetailScreen-XsqK1nGV.js +1 -0
  40. package/dist/assets/ReimbursementRoutes-B2FNn_0P.js +68 -0
  41. package/dist/assets/{ReportsRoutes-B3kIWCeV.js → ReportsRoutes-CJrunnvK.js} +1 -1
  42. package/dist/assets/RewardsRoutes-8HmabMf6.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-edh3y6eB.js → ScheduleDetailsPrepaidExpensesScreen-DHpH5oJw.js} +5 -5
  44. package/dist/assets/ScreenRoutes-DAK3aVc9.js +2 -0
  45. package/dist/assets/{SettingsRoutes-DP3k31bS.js → SettingsRoutes-6-0ys-s5.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-CxoDK6yX.js → SetupPagesScreen-BbFcVR26.js} +5 -5
  47. package/dist/assets/SignInScreen-mTQjLuAc.js +1 -0
  48. package/dist/assets/SignOutScreen-C7lCXdn2.js +9 -0
  49. package/dist/assets/{TaskListScreen-CfRSt11Z.js → TaskListScreen-CW5lbYvD.js} +2 -2
  50. package/dist/assets/{TaskRoutes-Bsl06EUw.js → TaskRoutes-ssEkwrEi.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-DBqh72Ke.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-B1no9UdL.js +5 -0
  53. package/dist/assets/{TransactionListRoutes-Cf10-jIo.js → TransactionListRoutes-DCMjmg_J.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-CUsBc54k.js → TreasuryRoutes-BUhJHYkV.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-VjUFmibF.js → VendorsRoutes-C1J2HapW.js} +11 -11
  56. package/dist/assets/WiseConfirmationScreen-DgUBxs8P.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-CCtz7FC8.js → ZeniAccountRoutes-C4aExMdo.js} +11 -11
  58. package/dist/assets/ZeniAccountStatementScreen-Vi4F2dbO.js +9 -0
  59. package/dist/assets/{accountMappingHelper-DLreHlS2.js → accountMappingHelper-CvrKmWxH.js} +1 -1
  60. package/dist/assets/{analytics-DOu6Ih_Z.js → analytics-DbFSqIth.js} +1 -1
  61. package/dist/assets/{analyticsHelper-Bjsf9R5q.js → analyticsHelper-drNlDujn.js} +1 -1
  62. package/dist/assets/{core-Dx-yNdOO.js → core-C9Jt3gNb.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-gD0LryXw.js → decodeURIComponentSafe-Cr8jQXNX.js} +1 -1
  64. package/dist/assets/{dnd-DfkYz8Zm.js → dnd-KhFMfpEU.js} +1 -1
  65. package/dist/assets/{empty-D2eoN5PS.js → empty-D0s_5kET.js} +1 -1
  66. package/dist/assets/{empty-D1pJjZqZ.js → empty-DDPaROCO.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-BfILpxFo.js → emptyVideoElement-LvEbv-wS.js} +1 -1
  68. package/dist/assets/epic-Ds-UlHfx.js +2 -0
  69. package/dist/assets/{expenseAutomationHelper--OaaBO01.js → expenseAutomationHelper-D-1MzDTJ.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-CCedhKv9.js → getLocaleForTenant-7mVUFLO-.js} +1 -1
  71. package/dist/assets/{index-BJmkm_zf.js → index-B3Xhbg9K.js} +1 -1
  72. package/dist/assets/{index-Cp3PWInT.js → index-ByO3g4MC.js} +1 -1
  73. package/dist/assets/{index-C19xNC89.js → index-C0qnV65V.js} +1 -1
  74. package/dist/assets/{index-CFth-nEE.js → index-CFbnVkgh.js} +1 -1
  75. package/dist/assets/{index-D2mWQKs0.js → index-CIoiM__n.js} +1 -1
  76. package/dist/assets/{index-BN_JNPW3.js → index-DmFy--fV.js} +17146 -16586
  77. package/dist/assets/{index-CAZwNpzy.js → index-JIbs7_F9.js} +2 -2
  78. package/dist/assets/{index-CfVtthD8.js → index-Xo8KkzkM.js} +1 -1
  79. package/dist/assets/{lexical-CeKyhyV8.js → lexical-CpBrNOz8.js} +1 -1
  80. package/dist/assets/{liveblocks-BlNqAXG4.js → liveblocks-Bym0XjRt.js} +1 -1
  81. package/dist/assets/{lottie-CICLPim-.js → lottie-CvA92JCl.js} +1 -1
  82. package/dist/assets/{mui-DicWBIpH.js → mui-BsgiBiT9.js} +1 -1
  83. package/dist/assets/{pathToGoBack-BzzMe8-p.js → pathToGoBack-CMP2hETE.js} +1 -1
  84. package/dist/assets/{pdf-BwuxCG-0.js → pdf-O569E9WB.js} +3 -3
  85. package/dist/assets/{pdf-lib-BK2JzciQ.js → pdf-lib-CRTLGVrP.js} +1 -1
  86. package/dist/assets/{plaid-BW55_XuJ.js → plaid-C8X6T_ms.js} +1 -1
  87. package/dist/assets/{pusher-CYljAxCY.js → pusher-CudE88Nt.js} +1 -1
  88. package/dist/assets/{react-C0TfUb2o.js → react-C2Rb5fzR.js} +1 -1
  89. package/dist/assets/{react-BRFjbln3.js → react-D5axG0I8.js} +1 -1
  90. package/dist/assets/{react-CoUnzBTV.js → react-DE5Goxu8.js} +1 -1
  91. package/dist/assets/{react-Dl4MB9dn.js → react-DvRjMeo2.js} +1 -1
  92. package/dist/assets/{react-R2WFHHNj.js → react-LkPios_L.js} +1 -1
  93. package/dist/assets/{react-DZ74qEy0.js → react-eTtPELPj.js} +1 -1
  94. package/dist/assets/{recharts-DkhthbKK.js → recharts-GCccddBO.js} +1 -1
  95. package/dist/assets/routePaths-DQh6iYo4.js +1 -0
  96. package/dist/assets/{sentry-oO1cMYln.js → sentry-CoKtZcTW.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-DUyz4jOZ.js → stripSplatSuffix-B7IfcJr8.js} +1 -1
  98. package/dist/assets/{url-1v6FOp1K.js → url-BXei0vv_.js} +1 -1
  99. package/dist/assets/{url-Hqju5Y0N.js → url-llYM4lhi.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-CN5JVNal.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-3GfaqAPj.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-CgHJ-iCU.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-CCCFXoUc.js → useChargeCardPusherEvents-JxJnisR-.js} +1 -1
  104. package/dist/assets/{useDeviceId-CLaYnGNC.js → useDeviceId-Cf3xan56.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-C_lu7Qr7.js → useEmailConnectResultRefresh-Dv9IT8_0.js} +1 -1
  106. package/dist/assets/useEnsureVendorListLoaded-YOFp3iHN.js +1 -0
  107. package/dist/assets/{useInitialThreadRequest-J-yGGXi5.js → useInitialThreadRequest-DA5FMzag.js} +1 -1
  108. package/dist/assets/useTaskManagerAccess-CpacCRSq.js +1 -0
  109. package/dist/assets/{useTaskManagerPusherEvents-C9HPPvD2.js → useTaskManagerPusherEvents-CcIRdnMY.js} +1 -1
  110. package/dist/assets/{utils-vB0Nm3XK.js → utils-CNqTTzSx.js} +1 -1
  111. package/dist/assets/withTransactionSidePanel-BOIdrs8l.js +25 -0
  112. package/dist/assets/{zeni-epic-state-DU8p9Pr6.js → zeni-epic-state-OTisIlmp.js} +7 -7
  113. package/dist/index.html +1 -1
  114. package/package.json +4 -4
  115. package/dist/assets/AccountMappingScreen-CsvIh3pU.js +0 -9
  116. package/dist/assets/ActualMatchingMatchDetailScreen-BeyJfzoq.js +0 -1
  117. package/dist/assets/AddressRoutes-DlDhfbdO.js +0 -1
  118. package/dist/assets/AddressScreen-xlCgJTb4.js +0 -9
  119. package/dist/assets/AiCfoScreen-jcAGVejP.js +0 -22
  120. package/dist/assets/BillPayApprovalRoutes-CWaHbHoJ.js +0 -1
  121. package/dist/assets/BusinessVerificationPageScreen-B2MzrRz9.js +0 -9
  122. package/dist/assets/ConnectionAuthScreen-H57FpfA5.js +0 -11
  123. package/dist/assets/CustomerOnboardingAuthScreen-Bga-XNUf.js +0 -1
  124. package/dist/assets/DashboardRoutes-BdEdFLmK.js +0 -20
  125. package/dist/assets/DomesticWireDetailScreen-DtE2OBa7.js +0 -18
  126. package/dist/assets/DrawerScreen-g7gMvOCC.js +0 -1
  127. package/dist/assets/EntityDetailRoutes-CuFBFS-c.js +0 -1
  128. package/dist/assets/ExpenseAutomationRoutes-XTTRYQTO.js +0 -38
  129. package/dist/assets/FeaturePreviewScreen-ocxt03Zk.js +0 -1
  130. package/dist/assets/HubSpotOAuthCallbackScreen-BtBx3Urb.js +0 -1
  131. package/dist/assets/MagicLinkSignInScreen-C6hfbFq3.js +0 -12
  132. package/dist/assets/MobileAppDrawer-D9_9MdJz.js +0 -1
  133. package/dist/assets/NotFoundScreen-C9HgOUVr.js +0 -1
  134. package/dist/assets/NotificationRoutes-DJGhb-22.js +0 -1
  135. package/dist/assets/OAuthConsentScreen-B3Frt3xZ.js +0 -1
  136. package/dist/assets/PandLWithForecastRoutes-BVhl9s7m.js +0 -1
  137. package/dist/assets/PeopleRoutes-DcnEXgK1.js +0 -22
  138. package/dist/assets/PerformanceRoutes-CPPduOhh.js +0 -1
  139. package/dist/assets/ReimbursementApprovalRoutes-C4rWwmOK.js +0 -1
  140. package/dist/assets/ReimbursementApprovalRuleDetailScreen-C5VRjOUn.js +0 -1
  141. package/dist/assets/ReimbursementRoutes-xmP1sf5g.js +0 -68
  142. package/dist/assets/RewardsRoutes-B0ffV2tU.js +0 -1
  143. package/dist/assets/ScreenRoutes-BXmr-cb0.js +0 -2
  144. package/dist/assets/SignInScreen-iAhBMOUT.js +0 -1
  145. package/dist/assets/SignOutScreen-MC6Mvo1b.js +0 -9
  146. package/dist/assets/TransactionDetailRoutes-D82kBzWU.js +0 -1
  147. package/dist/assets/TransactionDetailScreen-DEfBPk22.js +0 -5
  148. package/dist/assets/WiseConfirmationScreen-BLzh4txk.js +0 -12
  149. package/dist/assets/ZeniAccountStatementScreen-CYxLDv4m.js +0 -9
  150. package/dist/assets/epic-BWvBjvXV.js +0 -2
  151. package/dist/assets/routePaths-P47RCoW6.js +0 -1
  152. package/dist/assets/useActualMatchingMatchDetail-CR2SRNcX.js +0 -1
  153. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CQ8NCzd2.js +0 -1
  154. package/dist/assets/useAskAiCfoHostNavButtonProps-BOks8lHg.js +0 -1
  155. package/dist/assets/useTaskManagerAccess-Ces4QXd0.js +0 -1
  156. package/dist/assets/withTransactionSidePanel-BGYKHHLT.js +0 -25
@@ -1,4 +1,4 @@
1
- import{j as u}from"./liveblocks-BlNqAXG4.js";import{h as X,g as Y,u as ee,i as W,j as k,N as R,l as H,t as en}from"./core-Dx-yNdOO.js";import{bK as nn,fI as V,cH as tn,Ik as q,ZA as an,ZD as sn,v2 as ne,uS as te,mD as ae,C6 as N,ZF as be,gJ as He,gI as Ge,gH as Ke,ZG as on,It as cn,N1 as Ce,MU as he,MR as Ie,Mw as Q,MX as Ae,M_ as _e,N4 as ke,CA as ve,h2 as rn,cC as un,e0 as dn,d$ as ln,dj as pn,bu as mn,cv as Fe,ZH as yn,Lw as fe,M8 as fn,ZI as gn,bL as Sn,Om as ge,Oa as bn,ZJ as Cn,ZK as hn,Oq as In,Ou as An,ZL as je,B$ as _n,SW as kn,ZM as vn,ZN as Pn,ZO as Tn,ZP as Je,ZQ as En,ZR as Dn,V_ as Un,YR as On,Wd as wn,ZS as qe,MI as Fn,MA as Vn,We as xn,ME as Bn,ZT as Oe,Pa as Qe,mL as jn,uV as Xe,C8 as Rn,bF as Re,Ck as Le,cF as Ln,ZU as Ye,P0 as we,OJ as Nn,OK as Mn,OO as Zn,ZV as zn,P3 as Ne,ZW as $n,ZX as Wn,ZY as Hn,PR as Se,ZZ as Gn,gZ as Kn,JF as Jn,Z_ as qn,JK as Qn,JJ as Xn}from"./zeni-epic-state-DU8p9Pr6.js";import{ag as Pe,V as ie,q as de,$ as J,z as E,a6 as se,h as D,a5 as Te,M as $,bO as Yn,ac as oe,bP as x,bg as Ve,bQ as et,bR as nt,bS as tt,n as Be,bT as at,p as Me,aE as Ze,_ as it,a9 as st,bU as ot,bV as ct,bW as rt,w as ut}from"./index-BN_JNPW3.js";import{a as h}from"./sentry-oO1cMYln.js";import{u as Ee,n as xe,D as dt,S as lt}from"./mui-DicWBIpH.js";import{u as pt,d as ze,B as Ue}from"./BusinessVerificationPageScreen-B2MzrRz9.js";import{M as le}from"./MobileAppDrawer-D9_9MdJz.js";import L from"./NotFoundScreen-C9HgOUVr.js";import{a as $e}from"./analyticsHelper-Bjsf9R5q.js";import{d as We}from"./routePaths-P47RCoW6.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="3fd10812-88c2-4762-a427-c9c15ca90e57",e._sentryDebugIdIdentifier="sentry-dbid-3fd10812-88c2-4762-a427-c9c15ca90e57")}catch{}})();const mt=xe.div`
1
+ import{j as u}from"./liveblocks-Bym0XjRt.js";import{h as X,g as Y,u as ee,i as W,j as k,N as R,l as G,t as en}from"./core-C9Jt3gNb.js";import{bL as nn,fI as V,cI as tn,Ik as J,ZT as an,ZW as sn,v2 as ne,uS as te,mD as ae,C6 as N,ZY as be,gJ as Ge,gI as He,gH as Ke,ZZ as on,It as cn,N1 as Ce,MU as he,MR as Ie,Mw as Q,MX as Ae,M_ as _e,N4 as ke,CA as ve,h2 as rn,cD as un,e1 as dn,e0 as ln,dk as pn,bu as mn,cw as Fe,Z_ as yn,Lw as fe,M8 as fn,Z$ as gn,bM as Sn,Om as ge,Oa as bn,_0 as Cn,_1 as hn,Oq as In,Ou as An,_2 as je,B$ as _n,T6 as kn,_3 as vn,_4 as Pn,_5 as Tn,_6 as qe,_7 as En,_8 as Dn,Wa as Un,Z8 as On,Wp as wn,_9 as Je,MI as Fn,MA as Vn,Wq as xn,ME as Bn,_a as Oe,Pa as Qe,mL as jn,uV as Xe,C8 as Rn,bG as Re,Ck as Le,cG as Ln,_b as Ye,P0 as we,OJ as Nn,OK as Mn,OO as zn,_c as Zn,P3 as Ne,_d as $n,_e as Wn,_f as Gn,PR as Se,_g as Hn,gZ as Kn,JF as qn,_h as Jn,JK as Qn,JJ as Xn}from"./zeni-epic-state-OTisIlmp.js";import{ag as Pe,V as ie,d as de,P as q,z as E,a6 as se,l as D,a5 as Te,Q as $,bQ as Yn,ac as oe,bR as x,bi as Ve,bS as et,bT as nt,bU as tt,q as Be,bV as at,p as Me,aE as ze,$ as it,a9 as st,bW as ot,bX as ct,bY as rt,w as ut}from"./index-DmFy--fV.js";import{a as h}from"./sentry-CoKtZcTW.js";import{u as Ee,n as xe,D as dt,S as lt}from"./mui-BsgiBiT9.js";import{u as pt,d as Ze,B as Ue}from"./BusinessVerificationPageScreen-CpAzjlh5.js";import{M as le}from"./MobileAppDrawer-D4DOSbVQ.js";import L from"./NotFoundScreen-D92eiixV.js";import{a as $e}from"./analyticsHelper-drNlDujn.js";import{d as We}from"./routePaths-DQh6iYo4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="68b6dec9-fec4-453a-a43c-b63a8b23adbb",e._sentryDebugIdIdentifier="sentry-dbid-68b6dec9-fec4-453a-a43c-b63a8b23adbb")}catch{}})();const mt=xe.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,7 +6,7 @@ import{j as u}from"./liveblocks-BlNqAXG4.js";import{h as X,g as Y,u as ee,i as W
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,yt=H((function(e,o){const{isUserBillPayAdmin:a,companyId:t}=o,r=V(e),n=an(e),i=E.getSignedInUser(),l=r.tenantId,s={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:l??""},c=sn(e,t),p=a&&c.updateStatus.fetchState!=="In-Progress"&&c.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&c.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&c.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly";return{billPaySetupView:c,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",showIntlWiseWidget:o.showIntlWiseWidget,isDisabled:p,billpayApprovalView:n,analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:s}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r}=o;return{onBusinessVerificationSectionClick:()=>{a("../verification"),r?.company?.companyBillPayInfo!=null&&r?.company?.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(q(t,!1,!0))},onSetupApprovalRulesSectionClick:()=>{a("../approval-rules")},onFetchLinkTokenClick:(n,i)=>{e(ve("bill_pay_setup",n,i))},onEstablishConnectionClick:n=>{e(ke(n,t,"bill_pay_setup","bill_pay"))},onUpdatePaymentAccountStatus:(n,i,l)=>{e(_e(n,i,"bill_pay","bill_pay_setup",l))},onUpdatePaymentAccountLoginStatus:(n,i)=>{e(Ae(!1,n,"bill_pay","bill_pay_setup",i))},onEstablishConnectionSuccess:()=>{e(q(t,!0))},onEnableBillPayClick:()=>{e(Q(t,"bill_pay"))},onUpdateAccountClick:(n,i,l)=>{e(l==="paymentAccount"?he(n,i,"bill_pay","bill_pay_setup"):Ie("reimbursement_setup",n,i))},onUpdatePrimaryFundingAccount:(n,i)=>{e(Ce(t,"bill_pay_setup",n,i))},onEnableBillPaySuccess:()=>{a("../",{relative:"path"})},onBackClick:()=>{r?.companyBillPayInfo?.info?.isBillPayEnabled!=null&&r.companyBillPayInfo.info.isBillPayEnabled===!1?a("../.."):a("../",{relative:"path"})},onAcceptUpdatedTOS:()=>{e(cn(t))},onAcceptUpdatedTOSSuccess:()=>{e(q(t,!0))},onGetOtp:(n,i)=>{e(Ke(n,"SpendManagementSetup")),i!=null&&e(on({officerType:i,phone:n}))},onResendOtp:n=>{e(Ge(n,"SpendManagementSetup"))},onVerifyOtp:(n,i)=>{e(He(n,i,"SpendManagementSetup"))},onVerifyOtpSuccess:(n,i)=>{n!=null&&i!=null&&e(N(t,n,"bill_pay",!0,!0))},onNavigateToDashboard:()=>{a("../../dashboard")},onNavigateToSettings:()=>{a("../bills/setup")},onInternationPaymentSetUpClick:()=>{a("../international-wire")},onCompanyOfficerUpdated:(n,i)=>{e(be({officerType:n,fileIds:i}))},onSendForVerificationClick:n=>{e(N(t,n,"bill_pay",!0,!0,!0))},updateFilesEntity:n=>{e(ae({files:n}))},onDeleteFile:n=>{e(te(n))},onEditFileName:(n,i)=>{e(ne(n,i.split(".")[0]))}}}))(Yn),ft=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),n=ie(),i=nn(n?.loggedInUserRoleMap),{useFeatureGate:l}=de(),{isFeatureEnabled:s}=l(J.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:c}=l(J.isBillPayLocalCurrencyFeatureEnabled),p=Ee(),[g,S]=h.useState(!1),_=h.useRef(!1),I=k((m=>m.billPaySetupViewState.fetchState)),d=k((m=>V(m)));pt();const y=d.companyId??E.getSignedInUserTenant(r)?.companyId;if(E.getSignedInUser()==null)throw Error("Can't access bill pay setup page without signing in...");const f=!!d.companyBillPayInfo?.info?.isBillPayTOSAccepted,v=tn(n?.loggedInUserRoleMap);h.useEffect((()=>{_.current||I!=="Not-Started"||y==null?_.current||I!=="Completed"||y==null||d.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||(_.current=!0,t(q(y,!1,!0))):(_.current=!0,t(q(y,!0)))}),[I,y,t]);const b=m=>{S(m)};if(f===!1||v&&!n?.loggedInUserRoleMap?.bill_pay_admin)return u.jsx(R,{to:"../promo"});if(f===!0&&n?.loggedInUserRoleMap!=null){const m=C=>C.trackPageLoaded($.Event.billPaySetup);return u.jsxs(mt,{children:[u.jsx(se,{analytics:D,onLoad:C=>m(C)}),u.jsx(le,{isAppContentDrawerOpen:g,handleDrawerToggle:b}),u.jsx(yt,{navigate:o,location:a,companyId:y,currentTenant:d,isUserBillPayAdmin:i,showIntlWiseWidget:s,meetingUrl:e("bill_pay_setup"),onClickMenuIcon:()=>{b(!0)},isLocalCurrencyEnabled:c})]})}return u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:p.colors.grey5}})},Gt=(e,o)=>e!=null&&(function(a){return a==="debit"||a==="credit"||a==="debit_and_credit"})(e)?e:o,Kt=e=>`/${e}/cards`,Jt=e=>`/${e}/cards/setup`,qt=e=>`/${e}/cards/onboard`,Qt=(e,o,a,t,r=!1)=>{let n=`/${e}/cards/${encodeURIComponent(o)}`;return t==null||t.status.code!=="inactive"||t.cardHolderUserId!==a.userId||t.type.code!=="business_physical_credit_card"&&t.type.code!=="business_physical_debit_card"?t!=null&&t.status.code==="active"&&t.cardHolderUserId===a.userId&&t.type.code==="business_physical_credit_card"&&r===!0?n+="/addToWallet":t==null||t.type.code!=="business_physical_debit_card"&&t.type.code!=="business_virtual_debit_card"||t.status.code!=="active"||t.cardHolderUserId!==a.userId||t.isPinSet!==!1||(n+="/setPin"):n+="/activate",n},Xt=(e,o)=>e.find((a=>a.id===o)),Yt=(e,o,a)=>!e||!o||a.fetchState==="Completed",gt=(e,o,a,t)=>({isCreditCardOffered:e,isDebitCardOffered:o,isDebitCardEnabled:a,isCreditCardEnabled:t}),ea=(e,o)=>e?{creditCardCashbackOffer:`${o.cashbackAnalytics.creditCardCashbackOffer}%`,debitCardCashbackOffer:`${o.cashbackAnalytics.debitCardCashbackOffer}%`,totalEarnedCashback:x(o.cashbackSummary.cashbackEarned.amount),redeemedCashback:x(o.cashbackSummary.cashbackRedeemed.amount),availableCashback:x(o.cashbackSummary.cashbackAvailable.amount),creditCardCashbackRedemptionMode:o.cashbackAnalytics.creditCardCashbackRedemptionMode,debitCardCashbackRedemptionMode:o.cashbackAnalytics.debitCardCashbackRedemptionMode}:void 0,na=(e,o,a,t,r)=>e&&o&&a?{creditAccountId:t.id,creditAccountLimit:x(t.limit.amount),creditAccountAvailableAmount:x(t.available.amount),creditAccountSpentAmount:x(t.balance.amount+t.hold.amount),creditAccountStatus:t.status,outstandingBalance:x(r.remainingAmountDue.amount)}:void 0,ta=(e,o,a,t,r)=>e&&o&&a?{debitAccountId:t.depositAccounts.map((n=>n.id)),debitAccountName:t.depositAccounts.map((n=>n.accountName)),debitAccountBalance:t.depositAccounts.map((n=>x(n.accountBalance.available.amount))),debitCardsSpend:x(r?.currentMonthSpends.amount??0),debitAccountStatus:t.depositAccounts.map((n=>n.accountStatus))}:void 0,aa=(e,o)=>e&&o.depositAccountLimit!=null&&o.chargeCard!=null?{debitAccountId:o.depositAccountLimit.id,debitAccountName:o.depositAccountLimit?.accountName??o.connectedAccount?.accountName,debitAccountBalance:x(o.depositAccountLimit?.accountBalance.available.amount),debitCardsSpend:x(o.chargeCard.limit.amount-o.chargeCard.available.amount),debitAccountStatus:o.depositAccountLimit?.accountStatus??o.connectedAccount?.accountStatus}:void 0,ia=80,sa=80,oa=e=>e.companyId??E.getSignedInUserTenant(e.tenantEmailDomain)?.companyId,St=({isBankingOnlyTenant:e,isDebitCardFeatureEnabled:o})=>o||e,bt=({isCardsOnlyTenant:e,isChargeCardFeatureEnabled:o,isBookKeepingTenant:a,isDebitCardProductVisible:t,chargeCardsCreditAccountLimit:r})=>(e||o||a)&&(!t||r>0),ca=({isCardsOnlyTenant:e,isChargeCardFeatureEnabled:o,isBookKeepingTenant:a})=>e||o||a,ra=({cardInfo:e,isProductVisible:o,isTOSAccepted:a,isSetupEnabled:t,isUserHasCardsAdminLevelAccess:r,isUserHasCardsAccess:n})=>!!e&&o&&(!a&&r||n&&!r&&!t),Ct=H((function(e,o){const{isUserChargeCardAdmin:a,chargeCardSetUpView:t,isDebitCardOnlyEnabled:r,isCreditCardOnlyEnabled:n}=o,i=V(e),l=E.getSignedInUser(),s=i.tenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},p=a&&t.updateStatus.fetchState!=="In-Progress"&&t.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&t.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&t.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly";return{chargeCardSetUpView:t,connectedAccountProvider:i.company?.featuresActivationInfo.connectedAccountProvider??"",isDisabled:p,analytics:D,isDebitCardOnlyEnabled:r,isCreditCardOnlyEnabled:n,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:c}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r,chargeCardSetUpView:n,isDebitCardTOSAccepted:i,isChargeCardTOSAccepted:l,isChargeCardSetupEnabled:s,isDebitCardSetupEnabled:c,productInformation:p,controllerEmails:g,businessVerificationStatus:S,isCardPolicyEnabled:_,isUserChargeCardAdmin:I}=o;return{onBusinessVerificationSectionClick:()=>{D.trackCardsVerifyIdentityCompanyDetailsClick(g,p,S?.code),a("../verification"),r?.company?.companyChargeCardInfo!=null&&r.company.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(fe(t,!1,!0))},...I&&_?{onCardPolicySectionClick:()=>{a("../policy")}}:{},onFetchLinkTokenClick:(d,y)=>{e(ve("charge_card_setup",d,y))},onEstablishConnectionClick:d=>{e(ke(d,t,"charge_card_setup","charge_cards"))},onUpdatePaymentAccountStatus:(d,y,f)=>{e(_e(d,y,"charge_cards","charge_card_setup",f))},onUpdatePaymentAccountLoginStatus:(d,y)=>{e(Ae(!1,d,"charge_cards","charge_card_setup",y))},onEstablishConnectionSuccess:()=>{e(fe(t,!0))},onEnableChargeCardClick:()=>{D.trackCardsEnableCardsClick(g,p,"Cards Card Setup"),l===!0&&i===!0&&s===!1&&c===!1?e(Q(t,"charge_cards__debit_cards")):l===!0&&s===!1?e(Q(t,"charge_cards")):i===!0&&c===!1&&e(Q(t,"debit_cards"))},onUpdateChargeCardClick:(d,y,f)=>{const v=n.allBankAccounts.find((m=>m.accountId===n.primaryFundingAccount?.zeniAccountId)),b=n.allBankAccounts.find((m=>m.accountId===d));D.trackCardsZeniCashAccountChangeClick(g,p,{oldZeniCashAccount:v?.accountName??"",newZeniCashAccount:b?.accountName??"",oldZeniCashAccountPosition:n.allBankAccounts.findIndex((m=>m.accountId===n.primaryFundingAccount?.zeniAccountId))+1,newZeniCashAccountPosition:n.allBankAccounts.findIndex((m=>m.accountId===d))+1,numberOfCashAccounts:n.allBankAccounts.length}),e(f==="paymentAccount"?he(d,y,"charge_cards","charge_card_setup"):Ie("charge_card_setup",d,y))},onUpdatePrimaryFundingAccount:(d,y)=>{const f=n.allFundingAccounts.find((m=>m.id===d)),v=n.allFundingAccounts.findIndex((m=>m.id===n.primaryFundingAccount?.id))+1,b=n.allFundingAccounts.findIndex((m=>m.id===d))+1;D.trackCardsPaymentAccountChangeClick(g,p,{oldPaymentAccountName:n.primaryFundingAccount?.label??"",oldPaymentAccountBalance:x(n.primaryFundingAccount?.accountBalance?.available?.amount??0),newPaymentAccountName:f?.label??"",newPaymentAccountBalance:x(f?.accountBalance?.available?.amount??0),isOldPaymentAccountRecommended:n.primaryFundingAccount?.accType==="depositAccount",isNewPaymentAccountRecommended:f?.accType==="depositAccount",oldPaymentAccountPosition:v,newPaymentAccountPosition:b,numberOfPaymentAccounts:n.allFundingAccounts.length}),e(Ce(t,"charge_card_setup",d,y))},onEnableChargeCardSuccess:()=>{e(gn()),a("../",{relative:"path"})},onBackClick:()=>{r?.companyChargeCardInfo?.info?.isChargeCardEnabled||r?.companyDebitCardInfo?.info?.isDebitCardEnabled?a("../",{relative:"path"}):a("../..",{relative:"path"})},onNavigateToDashboard:()=>{a("../../dashboard")},onCompanyOfficerUpdated:(d,y)=>{e(be({officerType:d,fileIds:y}))},onSendForVerificationClick:d=>{l===!0&&i===!0?e(N(t,d,"charge_cards__debit_cards",!0,!0,!0)):l===!0?e(N(t,d,"charge_cards",!0,!0,!0)):i===!0&&e(N(t,d,"debit_cards",!0,!0,!0))},updateFilesEntity:d=>{e(ae({files:d}))},onDeleteFile:d=>{e(te(d))},onEditFileName:(d,y)=>{e(ne(d,y.split(".")[0]))},onUpdateAutoPayClick:d=>{e(fn(t,d))}}}))(et),ht=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),n=ie(),i=k((M=>V(M))),{useDynamicConfig:l,useFeatureGate:s}=de(),c=a.state?.pathnameStackToGoBack?.[0],{configValue:p}=l(Ve.zeniCardsConfig),g=p.credit_card_auto_pay_threshold_by_company_id?.[i.companyId]??p.default_credit_card_auto_pay_threshold??80,{isFeatureEnabled:S}=s(J.isDebitCardFeatureEnabled),{isFeatureEnabled:_}=s(J.isChargeCardFeatureEnabled),{isFeatureEnabled:I}=s(J.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=s(J.isCardPolicyEnabled),y=k((M=>rn(M,i.companyId))),f=un(y.controllers),v=!!i.company?.companyChargeCardInfo.isChargeCardEnabled,b=!!i.company?.companyDebitCardInfo.isDebitCardEnabled,m=dn(S,i),C=St({isDebitCardFeatureEnabled:S,isBankingOnlyTenant:m}),P=ln(i),T=pn(i),U=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=bt({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:_,isBookKeepingTenant:T,isDebitCardProductVisible:C,chargeCardsCreditAccountLimit:U}),O=C&&A===!1,B=C===!1&&A,Z=mn(n?.loggedInUserRoleMap),F=Fe(n?.loggedInUserRoleMap),[ce,G]=h.useState(!1),[K,re]=h.useState(!1),z=k((M=>M.chargeCardSetupViewState.fetchState)),j=E.getSignedInUserTenant(r)?.companyId??i.companyId,w=E.getSignedInUser(),De=M=>{G(M)},pe=k((M=>yn(M,j)));if(w==null)throw Error("Can't access charge card setup page without signing in...");h.useEffect((()=>{K||z!=="Not-Started"||j==null?K||z!=="Completed"||j==null||i.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||t(fe(j,!1,!0)):(re(!0),t(fe(j,!0)))}),[K,z,j,t]);const me=!!i.company?.companyChargeCardInfo.isChargeCardTOSAccepted,ye=!!i.company?.companyDebitCardInfo.isDebitCardTOSAccepted,ue=gt(A,C,b,v);return me||ye?me||ye?u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:()=>{D.trackPageLoaded($.Event.cardsSetupVisited),D.trackCardsCardSetupView(f,ue,c==null?"Cards Setup":c.includes("cards/promo")?"Promo":c.includes("cards")?"Settings":"Cards Tab")}}),u.jsx(le,{isAppContentDrawerOpen:ce,handleDrawerToggle:De}),u.jsx(Ct,{autoPayThreshold:g,navigate:o,meetingUrl:e("charge_card_setup"),location:a,companyId:j,currentTenant:i,isEarlyPayEnabled:I,isChargeCardTOSAccepted:me,isDebitCardTOSAccepted:ye,isUserChargeCardAdmin:Z,isCardPolicyEnabled:d,isDebitCardOnlyEnabled:O,isCreditCardOnlyEnabled:B,chargeCardSetUpView:pe,isCreditCardProductVisible:A,isDebitCardFeatureEnabled:C,isChargeCardSetupEnabled:v,isDebitCardSetupEnabled:b,businessVerificationStatus:i.companyBillPayInfo?.info?.businessVerificationStatus,controllerEmails:f,productInformation:ue,onClickMenuIcon:()=>{De(!0)},hasZeniAccountsAdminAccess:F})]}):u.jsx(Te,{fetchState:"Not-Started"}):u.jsx(R,{to:"../promo"})},It=xe.div`
9
+ `,yt=G((function(e,o){const{isUserBillPayAdmin:a,companyId:t}=o,r=V(e),n=an(e),i=E.getSignedInUser(),l=r.tenantId,s={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:l??""},c=sn(e,t),p=a&&c.updateStatus.fetchState!=="In-Progress"&&c.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&c.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&c.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly";return{billPaySetupView:c,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",showIntlWiseWidget:o.showIntlWiseWidget,isDisabled:p,billpayApprovalView:n,analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:s}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r}=o;return{onBusinessVerificationSectionClick:()=>{a("../verification"),r?.company?.companyBillPayInfo!=null&&r?.company?.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(J(t,!1,!0))},onSetupApprovalRulesSectionClick:()=>{a("../approval-rules")},onFetchLinkTokenClick:(n,i)=>{e(ve("bill_pay_setup",n,i))},onEstablishConnectionClick:n=>{e(ke(n,t,"bill_pay_setup","bill_pay"))},onUpdatePaymentAccountStatus:(n,i,l)=>{e(_e(n,i,"bill_pay","bill_pay_setup",l))},onUpdatePaymentAccountLoginStatus:(n,i)=>{e(Ae(!1,n,"bill_pay","bill_pay_setup",i))},onEstablishConnectionSuccess:()=>{e(J(t,!0))},onEnableBillPayClick:()=>{e(Q(t,"bill_pay"))},onUpdateAccountClick:(n,i,l)=>{e(l==="paymentAccount"?he(n,i,"bill_pay","bill_pay_setup"):Ie("reimbursement_setup",n,i))},onUpdatePrimaryFundingAccount:(n,i)=>{e(Ce(t,"bill_pay_setup",n,i))},onEnableBillPaySuccess:()=>{a("../",{relative:"path"})},onBackClick:()=>{r?.companyBillPayInfo?.info?.isBillPayEnabled!=null&&r.companyBillPayInfo.info.isBillPayEnabled===!1?a("../.."):a("../",{relative:"path"})},onAcceptUpdatedTOS:()=>{e(cn(t))},onAcceptUpdatedTOSSuccess:()=>{e(J(t,!0))},onGetOtp:(n,i)=>{e(Ke(n,"SpendManagementSetup")),i!=null&&e(on({officerType:i,phone:n}))},onResendOtp:n=>{e(He(n,"SpendManagementSetup"))},onVerifyOtp:(n,i)=>{e(Ge(n,i,"SpendManagementSetup"))},onVerifyOtpSuccess:(n,i)=>{n!=null&&i!=null&&e(N(t,n,"bill_pay",!0,!0))},onNavigateToDashboard:()=>{a("../../dashboard")},onNavigateToSettings:()=>{a("../bills/setup")},onInternationPaymentSetUpClick:()=>{a("../international-wire")},onCompanyOfficerUpdated:(n,i)=>{e(be({officerType:n,fileIds:i}))},onSendForVerificationClick:n=>{e(N(t,n,"bill_pay",!0,!0,!0))},updateFilesEntity:n=>{e(ae({files:n}))},onDeleteFile:n=>{e(te(n))},onEditFileName:(n,i)=>{e(ne(n,i.split(".")[0]))}}}))(Yn),ft=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),n=ie(),i=nn(n?.loggedInUserRoleMap),{useFeatureGate:l}=de(),{isFeatureEnabled:s}=l(q.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:c}=l(q.isBillPayLocalCurrencyFeatureEnabled),p=Ee(),[g,S]=h.useState(!1),_=h.useRef(!1),I=k((m=>m.billPaySetupViewState.fetchState)),d=k((m=>V(m)));pt();const y=d.companyId??E.getSignedInUserTenant(r)?.companyId;if(E.getSignedInUser()==null)throw Error("Can't access bill pay setup page without signing in...");const f=!!d.companyBillPayInfo?.info?.isBillPayTOSAccepted,v=tn(n?.loggedInUserRoleMap);h.useEffect((()=>{_.current||I!=="Not-Started"||y==null?_.current||I!=="Completed"||y==null||d.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||(_.current=!0,t(J(y,!1,!0))):(_.current=!0,t(J(y,!0)))}),[I,y,t]);const b=m=>{S(m)};if(f===!1||v&&!n?.loggedInUserRoleMap?.bill_pay_admin)return u.jsx(R,{to:"../promo"});if(f===!0&&n?.loggedInUserRoleMap!=null){const m=C=>C.trackPageLoaded($.Event.billPaySetup);return u.jsxs(mt,{children:[u.jsx(se,{analytics:D,onLoad:C=>m(C)}),u.jsx(le,{isAppContentDrawerOpen:g,handleDrawerToggle:b}),u.jsx(yt,{navigate:o,location:a,companyId:y,currentTenant:d,isUserBillPayAdmin:i,showIntlWiseWidget:s,meetingUrl:e("bill_pay_setup"),onClickMenuIcon:()=>{b(!0)},isLocalCurrencyEnabled:c})]})}return u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:p.colors.grey5}})},Ht=(e,o)=>e!=null&&(function(a){return a==="debit"||a==="credit"||a==="debit_and_credit"})(e)?e:o,Kt=e=>`/${e}/cards`,qt=e=>`/${e}/cards/setup`,Jt=e=>`/${e}/cards/onboard`,Qt=(e,o,a,t,r=!1)=>{let n=`/${e}/cards/${encodeURIComponent(o)}`;return t==null||t.status.code!=="inactive"||t.cardHolderUserId!==a.userId||t.type.code!=="business_physical_credit_card"&&t.type.code!=="business_physical_debit_card"?t!=null&&t.status.code==="active"&&t.cardHolderUserId===a.userId&&t.type.code==="business_physical_credit_card"&&r===!0?n+="/addToWallet":t==null||t.type.code!=="business_physical_debit_card"&&t.type.code!=="business_virtual_debit_card"||t.status.code!=="active"||t.cardHolderUserId!==a.userId||t.isPinSet!==!1||(n+="/setPin"):n+="/activate",n},Xt=(e,o)=>e.find((a=>a.id===o)),Yt=(e,o,a)=>!e||!o||a.fetchState==="Completed",gt=(e,o,a,t)=>({isCreditCardOffered:e,isDebitCardOffered:o,isDebitCardEnabled:a,isCreditCardEnabled:t}),ea=(e,o)=>e?{creditCardCashbackOffer:`${o.cashbackAnalytics.creditCardCashbackOffer}%`,debitCardCashbackOffer:`${o.cashbackAnalytics.debitCardCashbackOffer}%`,totalEarnedCashback:x(o.cashbackSummary.cashbackEarned.amount),redeemedCashback:x(o.cashbackSummary.cashbackRedeemed.amount),availableCashback:x(o.cashbackSummary.cashbackAvailable.amount),creditCardCashbackRedemptionMode:o.cashbackAnalytics.creditCardCashbackRedemptionMode,debitCardCashbackRedemptionMode:o.cashbackAnalytics.debitCardCashbackRedemptionMode}:void 0,na=(e,o,a,t,r)=>e&&o&&a?{creditAccountId:t.id,creditAccountLimit:x(t.limit.amount),creditAccountAvailableAmount:x(t.available.amount),creditAccountSpentAmount:x(t.balance.amount+t.hold.amount),creditAccountStatus:t.status,outstandingBalance:x(r.remainingAmountDue.amount)}:void 0,ta=(e,o,a,t,r)=>e&&o&&a?{debitAccountId:t.depositAccounts.map((n=>n.id)),debitAccountName:t.depositAccounts.map((n=>n.accountName)),debitAccountBalance:t.depositAccounts.map((n=>x(n.accountBalance.available.amount))),debitCardsSpend:x(r?.currentMonthSpends.amount??0),debitAccountStatus:t.depositAccounts.map((n=>n.accountStatus))}:void 0,aa=(e,o)=>e&&o.depositAccountLimit!=null&&o.chargeCard!=null?{debitAccountId:o.depositAccountLimit.id,debitAccountName:o.depositAccountLimit?.accountName??o.connectedAccount?.accountName,debitAccountBalance:x(o.depositAccountLimit?.accountBalance.available.amount),debitCardsSpend:x(o.chargeCard.limit.amount-o.chargeCard.available.amount),debitAccountStatus:o.depositAccountLimit?.accountStatus??o.connectedAccount?.accountStatus}:void 0,ia=80,sa=80,oa=e=>e.companyId??E.getSignedInUserTenant(e.tenantEmailDomain)?.companyId,St=({isBankingOnlyTenant:e,isDebitCardFeatureEnabled:o})=>o||e,bt=({isCardsOnlyTenant:e,isChargeCardFeatureEnabled:o,isBookKeepingTenant:a,isDebitCardProductVisible:t,chargeCardsCreditAccountLimit:r})=>(e||o||a)&&(!t||r>0),ca=({isCardsOnlyTenant:e,isChargeCardFeatureEnabled:o,isBookKeepingTenant:a})=>e||o||a,ra=({cardInfo:e,isProductVisible:o,isTOSAccepted:a,isSetupEnabled:t,isUserHasCardsAdminLevelAccess:r,isUserHasCardsAccess:n})=>!!e&&o&&(!a&&r||n&&!r&&!t),Ct=G((function(e,o){const{isUserChargeCardAdmin:a,chargeCardSetUpView:t,isDebitCardOnlyEnabled:r,isCreditCardOnlyEnabled:n}=o,i=V(e),l=E.getSignedInUser(),s=i.tenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},p=a&&t.updateStatus.fetchState!=="In-Progress"&&t.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&t.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&t.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly";return{chargeCardSetUpView:t,connectedAccountProvider:i.company?.featuresActivationInfo.connectedAccountProvider??"",isDisabled:p,analytics:D,isDebitCardOnlyEnabled:r,isCreditCardOnlyEnabled:n,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:c}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r,chargeCardSetUpView:n,isDebitCardTOSAccepted:i,isChargeCardTOSAccepted:l,isChargeCardSetupEnabled:s,isDebitCardSetupEnabled:c,productInformation:p,controllerEmails:g,businessVerificationStatus:S,isCardPolicyEnabled:_,isUserChargeCardAdmin:I}=o;return{onBusinessVerificationSectionClick:()=>{D.trackCardsVerifyIdentityCompanyDetailsClick(g,p,S?.code),a("../verification"),r?.company?.companyChargeCardInfo!=null&&r.company.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(fe(t,!1,!0))},...I&&_?{onCardPolicySectionClick:()=>{a("../policy")}}:{},onFetchLinkTokenClick:(d,y)=>{e(ve("charge_card_setup",d,y))},onEstablishConnectionClick:d=>{e(ke(d,t,"charge_card_setup","charge_cards"))},onUpdatePaymentAccountStatus:(d,y,f)=>{e(_e(d,y,"charge_cards","charge_card_setup",f))},onUpdatePaymentAccountLoginStatus:(d,y)=>{e(Ae(!1,d,"charge_cards","charge_card_setup",y))},onEstablishConnectionSuccess:()=>{e(fe(t,!0))},onEnableChargeCardClick:()=>{D.trackCardsEnableCardsClick(g,p,"Cards Card Setup"),l===!0&&i===!0&&s===!1&&c===!1?e(Q(t,"charge_cards__debit_cards")):l===!0&&s===!1?e(Q(t,"charge_cards")):i===!0&&c===!1&&e(Q(t,"debit_cards"))},onUpdateChargeCardClick:(d,y,f)=>{const v=n.allBankAccounts.find((m=>m.accountId===n.primaryFundingAccount?.zeniAccountId)),b=n.allBankAccounts.find((m=>m.accountId===d));D.trackCardsZeniCashAccountChangeClick(g,p,{oldZeniCashAccount:v?.accountName??"",newZeniCashAccount:b?.accountName??"",oldZeniCashAccountPosition:n.allBankAccounts.findIndex((m=>m.accountId===n.primaryFundingAccount?.zeniAccountId))+1,newZeniCashAccountPosition:n.allBankAccounts.findIndex((m=>m.accountId===d))+1,numberOfCashAccounts:n.allBankAccounts.length}),e(f==="paymentAccount"?he(d,y,"charge_cards","charge_card_setup"):Ie("charge_card_setup",d,y))},onUpdatePrimaryFundingAccount:(d,y)=>{const f=n.allFundingAccounts.find((m=>m.id===d)),v=n.allFundingAccounts.findIndex((m=>m.id===n.primaryFundingAccount?.id))+1,b=n.allFundingAccounts.findIndex((m=>m.id===d))+1;D.trackCardsPaymentAccountChangeClick(g,p,{oldPaymentAccountName:n.primaryFundingAccount?.label??"",oldPaymentAccountBalance:x(n.primaryFundingAccount?.accountBalance?.available?.amount??0),newPaymentAccountName:f?.label??"",newPaymentAccountBalance:x(f?.accountBalance?.available?.amount??0),isOldPaymentAccountRecommended:n.primaryFundingAccount?.accType==="depositAccount",isNewPaymentAccountRecommended:f?.accType==="depositAccount",oldPaymentAccountPosition:v,newPaymentAccountPosition:b,numberOfPaymentAccounts:n.allFundingAccounts.length}),e(Ce(t,"charge_card_setup",d,y))},onEnableChargeCardSuccess:()=>{e(gn()),a("../",{relative:"path"})},onBackClick:()=>{r?.companyChargeCardInfo?.info?.isChargeCardEnabled||r?.companyDebitCardInfo?.info?.isDebitCardEnabled?a("../",{relative:"path"}):a("../..",{relative:"path"})},onNavigateToDashboard:()=>{a("../../dashboard")},onCompanyOfficerUpdated:(d,y)=>{e(be({officerType:d,fileIds:y}))},onSendForVerificationClick:d=>{l===!0&&i===!0?e(N(t,d,"charge_cards__debit_cards",!0,!0,!0)):l===!0?e(N(t,d,"charge_cards",!0,!0,!0)):i===!0&&e(N(t,d,"debit_cards",!0,!0,!0))},updateFilesEntity:d=>{e(ae({files:d}))},onDeleteFile:d=>{e(te(d))},onEditFileName:(d,y)=>{e(ne(d,y.split(".")[0]))},onUpdateAutoPayClick:d=>{e(fn(t,d))}}}))(et),ht=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),n=ie(),i=k((M=>V(M))),{useDynamicConfig:l,useFeatureGate:s}=de(),c=a.state?.pathnameStackToGoBack?.[0],{configValue:p}=l(Ve.zeniCardsConfig),g=p.credit_card_auto_pay_threshold_by_company_id?.[i.companyId]??p.default_credit_card_auto_pay_threshold??80,{isFeatureEnabled:S}=s(q.isDebitCardFeatureEnabled),{isFeatureEnabled:_}=s(q.isChargeCardFeatureEnabled),{isFeatureEnabled:I}=s(q.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=s(q.isCardPolicyEnabled),y=k((M=>rn(M,i.companyId))),f=un(y.controllers),v=!!i.company?.companyChargeCardInfo.isChargeCardEnabled,b=!!i.company?.companyDebitCardInfo.isDebitCardEnabled,m=dn(S,i),C=St({isDebitCardFeatureEnabled:S,isBankingOnlyTenant:m}),P=ln(i),T=pn(i),U=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=bt({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:_,isBookKeepingTenant:T,isDebitCardProductVisible:C,chargeCardsCreditAccountLimit:U}),O=C&&A===!1,B=C===!1&&A,z=mn(n?.loggedInUserRoleMap),F=Fe(n?.loggedInUserRoleMap),[ce,H]=h.useState(!1),[K,re]=h.useState(!1),Z=k((M=>M.chargeCardSetupViewState.fetchState)),j=E.getSignedInUserTenant(r)?.companyId??i.companyId,w=E.getSignedInUser(),De=M=>{H(M)},pe=k((M=>yn(M,j)));if(w==null)throw Error("Can't access charge card setup page without signing in...");h.useEffect((()=>{K||Z!=="Not-Started"||j==null?K||Z!=="Completed"||j==null||i.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||t(fe(j,!1,!0)):(re(!0),t(fe(j,!0)))}),[K,Z,j,t]);const me=!!i.company?.companyChargeCardInfo.isChargeCardTOSAccepted,ye=!!i.company?.companyDebitCardInfo.isDebitCardTOSAccepted,ue=gt(A,C,b,v);return me||ye?me||ye?u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:()=>{D.trackPageLoaded($.Event.cardsSetupVisited),D.trackCardsCardSetupView(f,ue,c==null?"Cards Setup":c.includes("cards/promo")?"Promo":c.includes("cards")?"Settings":"Cards Tab")}}),u.jsx(le,{isAppContentDrawerOpen:ce,handleDrawerToggle:De}),u.jsx(Ct,{autoPayThreshold:g,navigate:o,meetingUrl:e("charge_card_setup"),location:a,companyId:j,currentTenant:i,isEarlyPayEnabled:I,isChargeCardTOSAccepted:me,isDebitCardTOSAccepted:ye,isUserChargeCardAdmin:z,isCardPolicyEnabled:d,isDebitCardOnlyEnabled:O,isCreditCardOnlyEnabled:B,chargeCardSetUpView:pe,isCreditCardProductVisible:A,isDebitCardFeatureEnabled:C,isChargeCardSetupEnabled:v,isDebitCardSetupEnabled:b,businessVerificationStatus:i.companyBillPayInfo?.info?.businessVerificationStatus,controllerEmails:f,productInformation:ue,onClickMenuIcon:()=>{De(!0)},hasZeniAccountsAdminAccess:F})]}):u.jsx(Te,{fetchState:"Not-Started"}):u.jsx(R,{to:"../promo"})},It=xe.div`
10
10
  display: flex;
11
11
  height: 100%;
12
12
  width: 100%;
@@ -14,11 +14,11 @@ import{j as u}from"./liveblocks-BlNqAXG4.js";import{h as X,g as Y,u as ee,i as W
14
14
  flex-direction: column;
15
15
  align-items: center;
16
16
  background-color: ${e=>e.theme.colors.grey4};
17
- `,At=H((function(e,o){const{isUserRemiAdmin:a,companyId:t}=o,r=V(e),n=Cn(e),i=hn(e,t),l=E.getSignedInUser(),s=r.tenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""};return{remiSetupView:i,isDisabled:a&&i.updateStatus.fetchState!=="In-Progress"&&i.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&i.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&i.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly",remiApprovalView:n,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:c}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r}=o;return{updateMileageDetails:n=>{const{mileageAmount:i,mileageUnit:l,mileageCurrencyCode:s,mileageCurrencySymbol:c,denomination:p,denominationSymbol:g,mileageAmountInDenomination:S,description:_}=n;e(An({mileageDetails:{mileageUnitAmount:{amount:i,currencyCode:s,currencySymbol:c},denomination:p,denominationSymbol:g,mileageAmountInDenomination:S,mileageCurrencyCode:s,mileageCurrencySymbol:c,mileageUnit:l,description:_}}))},onSaveMileageClick:n=>{e(In(t)),D.trackReimbursementMileageRateSave(n)},onBusinessVerificationSectionClick:()=>{a("../verification"),r?.company?.companyReimbursementInfo!=null&&r?.company?.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(ge(t,!1,!0))},onSetupApprovalRulesSectionClick:()=>{a("../approval-rules")},onFetchLinkTokenClick:(n,i)=>{e(ve("reimbursement_setup",n,i))},onEstablishConnectionClick:n=>{e(ke(n,t,"reimbursement_setup","reimbursement"))},onUpdatePaymentAccountStatus:(n,i,l)=>{e(_e(n,i,"reimbursement","reimbursement_setup",l))},onUpdatePaymentAccountLoginStatus:(n,i)=>{e(Ae(!1,n,"reimbursement","reimbursement_setup",i))},onEstablishConnectionSuccess:()=>{e(ge(t,!0))},onEnableRemiClick:()=>{e(Q(t,"reimbursement"))},onUpdateAccountClick:(n,i,l)=>{e(l==="paymentAccount"?he(n,i,"reimbursement","reimbursement_setup"):Ie("reimbursement_setup",n,i))},onEnableRemiSuccess:()=>{a("../",{relative:"path"})},onBackClick:()=>{r?.companyReimbursementInfo?.info?.isReimbursementEnabled!=null&&r.companyReimbursementInfo.info.isReimbursementEnabled===!1?a("../.."):a("../",{relative:"path"})},onCompanyOfficerUpdated:(n,i)=>{e(be({officerType:n,fileIds:i}))},onSendForVerificationClick:n=>{e(N(t,n,"reimbursement",!0,!0,!0))},updateFilesEntity:n=>{e(ae({files:n}))},onDeleteFile:n=>{e(te(n))},onEditFileName:(n,i)=>{e(ne(n,i.split(".")[0]))},onUpdatePrimaryFundingAccount:(n,i)=>{e(Ce(t,"reimbursement_setup",n,i))}}}))(tt),_t=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),n=ie(),i=Ee(),l=Sn(n?.loggedInUserRoleMap),s=Fe(n?.loggedInUserRoleMap),[c,p]=h.useState(!1),g=h.useRef(!1),[S,_]=h.useState(!1),I=k((P=>P.remiSetupViewState.fetchState)),d=k((P=>V(P))),y=k((P=>P.remiSetupApproverViewState.fetchState)),{isApprovalRulesV3Enabled:f,isLoading:v}=nt(d?.tenantId),b=E.getSignedInUserTenant(r)?.companyId??d.companyId,m=E.getSignedInUser(),C=P=>{p(P)};if(m==null)throw Error("Can't access reimbursement setup page without signing in...");if(h.useEffect((()=>{g.current||I!=="Not-Started"||b==null?g.current||I!=="Completed"||b==null||d.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||(g.current=!0,t(ge(b,!1,!0))):(g.current=!0,t(ge(b,!0)))}),[I,b,t]),h.useEffect((()=>{S||y!=="Not-Started"||v||(_(!0),t(bn(!0,!1,!1,f)))}),[S,y,v,f,t]),d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1)return u.jsx(R,{to:"../promo"});if(d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!0){const P=T=>T.trackPageLoaded($.Event.reimbursementSetup);return u.jsxs(It,{children:[u.jsx(se,{analytics:D,onLoad:T=>P(T)}),u.jsx(le,{isAppContentDrawerOpen:c,handleDrawerToggle:C}),u.jsx(At,{navigate:o,location:a,companyId:b,currentTenant:d,isUserRemiAdmin:l,meetingUrl:e("reimbursement_setup"),onClickMenuIcon:()=>{C(!0)},hasZeniAccountsAdminAccess:s})]})}return u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:i.colors.grey5}})},kt=H((function(e,o){const{businessVerificationDetails:a,productType:t}=o,r=V(e),n=E.getSignedInUser(),i=r.tenantId,l={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:i??""},s=Un(o.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",c=On(e.companyConfigState),p=wn(e.userRoleConfigState),g=t==="zeni_treasury"?qe(e):void 0;return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:s,allIndustries:c.companyIndustries??[],companyTitles:p.companyTitles,transferDetails:g}}),(function(e,o){const{companyId:a,productType:t,currentTenant:r,navigate:n,location:i}=o,{tenantEmailDomain:l}=r;return{onCompanyDetailsChanged:s=>{const{companyDescription:c,companyIndustry:p,companyIndustryType:g,companyLegalName:S,companyTaxId:_,companyWebsite:I,companyPhone:d,primaryContactEmail:y,primaryContactName:f,primaryContactUserId:v,primaryContactSyncToken:b,syncToken:m,fileIds:C,incDate:P,typeOfIncorporation:T,stateOfIncorporation:U,sourceOfFunds:A,companySubIndustry:O,countriesOfOperations:B,companySourceOfFunds:Z,companySourceOfFundsDescription:F,transactionVolume:ce,transactionVolumeDescription:G,purposeOfAccount:K,purposeOfAccountDescription:re,regulatedStatus:z,regulatedStatusDescription:j,usNexus:w,usNexusTypes:De}=s,pe=g?.selectedOption,me={companyId:a,companyDescription:c,companyIndustry:p.selectedOption,companyIndustryType:pe==null||pe===""?void 0:pe,companyLegalName:S,taxIdOrEIN:_,website:I!=""&&I!=null?Ln(I):void 0,phone:d,syncToken:m,fileIds:C,incDate:P!=null?Re(P?.toString()):P,typeOfIncorporation:T?.selectedOption??"",stateOfIncorporation:U?.selectedOption??"",sourceOfFunds:A?.selectedOption??"",companySubIndustry:O?.selectedOption??"",countriesOfOperations:B?.selectedOptions.map((ue=>ue.length===2?ue:Ze(ue)))??[],companySourceOfFunds:Z?.selectedOption??"",companySourceOfFundsDescription:F,transactionVolume:ce?.selectedOption??"",transactionVolumeDescription:G,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:re,regulatedStatus:z??"",regulatedStatusDescription:j,usNexus:w,usNexusTypes:De?.selectedOptions??[]},ye={userId:v,firstName:f.firstName,lastName:f.lastName,email:y,syncToken:b};e(Le({companyDetails:me,primaryContactDetails:ye}))},onCompanyOfficerUpdated:s=>{const c=s.map((p=>{const{officerType:g,userId:S,name:_,email:I,nationalityCountryCode:d,ssn:y,dob:f,phone:v,syncToken:b,selectDocument:m,role:C,ownership:P,isSelectedForVerification:T,userVerificationStatus:U,treasuryUserVerificationStatus:A,fileIds:O}=p;let B;return m.selectDocumentType==="driverLicense"?B="driving_license":m.selectDocumentType==="passport"?B="passport":m.selectDocumentType==="stateId"?B="id_document":m.selectDocumentType==="ssnCard"&&(B="social_security_card"),{officerType:g,userId:S,firstName:_.firstName,lastName:_.lastName,email:I,ssn:y,nationalityCountryCode:d?.selectedOption!=null?Ze(d.selectedOption):void 0,phone:v,birthday:f!=null?Re(f?.toString()):f,syncToken:b,titleAtCompany:C.selectedOption,ownershipInCompany:P,documentTypeSelectedForVerification:B,isSelectedForVerification:T,userVerificationStatus:U,treasuryUserVerificationStatus:A,fileIds:O,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(Le({officers:c}))},onSaveDetailsClick:s=>{e(N(a,s,t))},onSendForVerificationClick:s=>{e(N(a,s,t,!0))},onAddressClick:s=>{const c=We(l,s),p=Me(i.state?.pathnameStackToGoBack,i.pathname),g=new URLSearchParams(i.search),S={};g.forEach(((_,I)=>{S[I]=_})),n(c,{state:{pathnameStackToGoBack:p,queryParams:Object.keys(S).length>0?S:void 0}})},onRegisteredAddressClick:s=>{const c=We(l,s),p=Me(i.state?.pathnameStackToGoBack,i.pathname),g=new URLSearchParams(i.search),S=Object.fromEntries(g.entries());n(c,{state:{pathnameStackToGoBack:p,queryParams:Object.keys(S).length>0?S:void 0}})},onBackClick:()=>{e(Rn({companyId:a})),n("../setup")},updateFilesEntity:s=>{e(ae({files:s}))},onDeleteFile:s=>{e(te(s))},onDeleteFileList:s=>{e(Xe(s))},onEditFileName:(s,c)=>{e(ne(s,c.split(".")[0]))},onGetOtp:s=>{e(Ke(s,"SpendManagementSetup"))},onResendOtp:s=>{e(Ge(s,"SpendManagementSetup"))},onVerifyOtp:(s,c)=>{e(He(s,c,"SpendManagementSetup"))},saveNewAddressInLocalStore:(s,c)=>{e(jn({addressType:s,addressToCreate:c}))},onExecuteTreasuryTransfer:()=>{e(Qe())},onOverlayClose:()=>{e(Oe())},onIdentityDocumentUploadedForAutofill:s=>{if(a==null)return;const c=xn(s.documentType);c!=null&&e(Bn({target:"setup",companyId:a,officerType:s.officerType,fileId:s.fileId,documentType:c}))},onCompanyDocumentUploadedForAutofill:s=>{a!=null&&e(Vn({target:"setup",companyId:a,fileId:s.fileId,documentType:s.documentType}))},onResetKycKybClick:()=>{e(Fn())}}}))(at),vt=({productType:e,isBusinessVerificationDrawerOpen:o,closeDrawerHandler:a})=>{const t=X(),r=Y(),n=ee(),[i]=en(),l=i.get("showStepProgress"),s=i.get("isTransferInitiated"),[c,p]=h.useState(!1),{tenantEmailDomain:g}=W(),S=ie(),{useDynamicConfig:_}=de(),I=Ee(),{configValue:d}=_(Ve.zeniAccountsConfig),y=je(d),f=k((A=>{switch(e){case"zeni_accounts":return A.zeniAccountSetupViewState.fetchState;case"reimbursement":return A.remiSetupViewState.fetchState;case"charge_cards":return A.chargeCardSetupViewState.fetchState;case"zeni_treasury":return A.treasurySetupViewState.fetchState;default:return A.billPaySetupViewState.fetchState}})),v=k((A=>A.companyConfigState.fetchState)),b=k((A=>A.userRoleConfigState.fetchState)),m=k((A=>V(A))),C=m.companyId??E.getSignedInUserTenant(g)?.companyId;h.useEffect((()=>{v==="Not-Started"&&n(_n()),b==="Not-Started"&&n(kn(!0))}),[v,b,n]),h.useEffect((()=>{c||f!=="Not-Started"||C==null||(p(!0),ze(n,e,C))}),[c,f,C,n]);const P=k((A=>{let O;switch(e){case"zeni_accounts":O=En(A,C);break;case"zeni_treasury":O=Je(A,C);break;case"charge_cards":O=Tn(A,C);break;case"reimbursement":O=Pn(A,C);break;default:O=vn(A,C)}return O})),T=P.kycKybResetStatus.fetchState;if(h.useEffect((()=>{T==="Completed"&&C!=null&&(ze(n,e,C,!0),n(Dn()))}),[T,C,e,n]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let U;switch(e){case"zeni_accounts":U=m.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":U=m.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":U=m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":U=m.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:U=m.companyBillPayInfo?.info?.isBillPayTOSAccepted}return U===!1?null:P.fetchState==="Completed"&&U===!0&&S?.loggedInUserRoleMap!=null?u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:A=>(O=>{switch(e){case"zeni_accounts":return O.trackPageLoaded($.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return O.trackPageLoaded($.Event.reimbursementBusinessVerification);default:return O.trackPageLoaded($.Event.billPayBusinessVerification,Be(r)?"Settings":void 0)}})(A)}),u.jsx(kt,{businessVerificationDetails:P,navigate:t,location:r,companyId:C,analytics:D,currentTenant:m,productType:e,roleMap:S.loggedInUserRoleMap,isSettings:Be(r),isOverlay:!0,isStepInProgress:l!=null,isTreasuryTransferInitiated:s!=null,onClickMenuIcon:()=>{},maxInsuredAmount:y.maxInsuredAmount,isBusinessVerificationDrawerOpen:o,closeDrawerHandler:a})]}):u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Pt={overlayWidth:new st(100,100,59)},Tt=H((function(e,o){const{isUserZeniAccountsAdmin:a,companyId:t}=o,r=V(e),n=E.getSignedInUser(),i=r.tenantId,l={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:i??""},s=Ye(e,t),c=Je(e,t),p=a&&s.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&s.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly",g=zn(e),S=g.transactions,_=qe(e),I=g.accountSummary?.totalBalance?.amount,d=S.length===0||I===0;return{treasurySetupView:s,businessVerificationDetails:c,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",transactions:S,transferDetails:_,isFirstTransfer:d,isDisabled:p,analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:l,isOnSetup:!0,maxInsuredAmount:o.maxInsuredAmount}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r,isAllocationDone:n,analytics:i,treasurySetupView:l}=o;return{onTransferSaveChangesToLocalStore:s=>{e(Hn(s))},onBusinessVerificationSectionClick:(s,c)=>{let p="../verification";s&&(p+="?showStepProgress=true",c&&(p+="&isTransferInitiated=true")),a(p),r?.company?.companyTreasuryInfo!=null&&r?.company?.companyTreasuryInfo?.businessVerificationStatus?.code==="pending_review"&&e(we(t,!1,!0))},onFetchLinkTokenClick:(s,c)=>{e(ve("treasury_setup",s,c))},onEstablishConnectionClick:s=>{e(ke(s,t,"treasury_setup","zeni_treasury"))},onUpdatePaymentAccountStatus:(s,c,p)=>{e(_e(s,c,"zeni_treasury","treasury_setup",p))},onUpdatePaymentAccountLoginStatus:(s,c)=>{e(Ae(!1,s,"zeni_treasury","treasury_setup",c))},onEstablishConnectionSuccess:()=>{e(we(t,!0))},onEnableTreasuryClick:()=>{e(Q(t,"zeni_treasury"))},onUpdateTreasuryClick:(s,c,p)=>{e(p==="paymentAccount"?he(s,c,"zeni_treasury","treasury_setup"):Ie("treasury_setup",s,c))},onUpdatePrimaryFundingAccount:(s,c)=>{e(Ce(t,"treasury_setup",s,c))},onNavigateToDashboard:()=>{a(r?.company?.companyTreasuryInfo?.businessVerificationStatus?.code==="verified"?"../":"../../")},onCompanyOfficerUpdated:(s,c)=>{e(be({officerType:s,fileIds:c}))},onSendForVerificationClick:(s,c)=>{if(e(N(t,s,"zeni_treasury",!0,!0,!0)),!n){const p=l.fundAllocationLocalData;i.trackTreasuryPortfolioConfirm(p.riskScore,$e(p)),e(Ne(!1))}c===!0&&e(Qe())},updateFilesEntity:s=>{e(ae({files:s}))},onDeleteFile:s=>{e(te(s))},onEditFileName:(s,c)=>{e(ne(s,c.split(".")[0]))},onAdditionalVerificationFieldsChanged:s=>{const{sourceOfFunds:c}=s;e(Wn({sourceOfFunds:c?.selectedOption??""}))},onUpdateFundAllocation:s=>{i.trackTreasuryAllocationAction("update",$e(s)),e($n(s))},onConfirmFundAllocation:()=>{e(Ne(n))},onOverlayClose:()=>{e(Oe())}}}))(ot),Et=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),r=Ee(),n=it(),{tenantEmailDomain:i}=W(),{useDynamicConfig:l}=de(),s=ie(),[c,p]=h.useState(!1),g=Fe(s?.loggedInUserRoleMap),{configValue:S}=l(Ve.zeniAccountsConfig),_=je(S),[I,d]=h.useState(!1),[y,f]=h.useState(!1),[v,b]=h.useState(!1),[m,C]=h.useState(!1),[P,T]=h.useState(!1),U=k((w=>w.treasurySetupViewState.fetchState)),A=k((w=>w.treasurySetupViewState.treasuryFundsDetails?.fetchStatus?.fetchState)),O=k((w=>w.treasurySetupViewState.currentAllocation.fetchStatus?.fetchState)),B=k((w=>w.treasuryDetailState.transactionsState?.fetchState)),Z=k((w=>V(w))),F=E.getSignedInUserTenant(i)?.companyId??Z.companyId,ce=k((w=>Ye(w,F))),G=ce.isAtomicAccountExists,K=E.getSignedInUser(),re=w=>{d(w)};if(K==null)throw Error("Can't access treasury setup page without signing in...");h.useEffect((()=>{y||U!=="Not-Started"||F==null||(f(!0),t(we(F,!0,!1)))}),[y,U,F,t]),h.useEffect((()=>{v||A!=="Not-Started"||F==null||(b(!0),t(Nn()))}),[v,A,F,t]),h.useEffect((()=>{m||O!=="Not-Started"||F==null||(C(!0),t(Mn()))}),[m,O,F,t]),h.useEffect((()=>{P||B!=="Not-Started"||F==null||(T(!0),t(Zn(!0)))}),[P,B,F,t]);const z=Z.companyTreasuryInfo?.info?.businessVerificationStatus?.code,j=z==="pending_review"||z==="verified";return h.useEffect((()=>{c||U!=="Completed"||G||j||!a.pathname.includes("setup")||p(!0)}),[U,G,j]),Z.companyTreasuryInfo?.info?.isTreasuryTOSAccepted===!1?u.jsx(R,{to:"../promo"}):u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:()=>{}}),u.jsx(le,{isAppContentDrawerOpen:I,handleDrawerToggle:re}),u.jsx(dt,{onClose:()=>{t(Oe()),o("../setup")},anchor:"right",open:a.pathname.includes("verification"),transitionDuration:c?0:250,PaperProps:{style:{width:Pt.overlayWidth.valuePercentage(n),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:c?"transparent":r.colors.black,opacity:.75,cursor:"pointer"}}},children:u.jsx(Dt,{onClick:w=>w.stopPropagation(),children:u.jsx(vt,{productType:"zeni_treasury",isBusinessVerificationDrawerOpen:!0,closeDrawerHandler:()=>{t(Oe()),o("../setup")}})})}),u.jsx(Tt,{navigate:o,location:a,companyId:F,currentTenant:Z,isUserZeniAccountsAdmin:g,meetingUrl:e("treasury_setup"),maxInsuredAmount:_.maxInsuredAmount,isAllocationDone:G,analytics:D,treasurySetupView:ce,onClickMenuIcon:()=>{re(!0)},showTreasurySetupOverlay:c,setShowTreasurySetupOverlay:p})]})},Dt=xe(lt)`
17
+ `,At=G((function(e,o){const{isUserRemiAdmin:a,companyId:t}=o,r=V(e),n=Cn(e),i=hn(e,t),l=E.getSignedInUser(),s=r.tenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""};return{remiSetupView:i,isDisabled:a&&i.updateStatus.fetchState!=="In-Progress"&&i.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&i.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&i.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly",remiApprovalView:n,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:c}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r}=o;return{updateMileageDetails:n=>{const{mileageAmount:i,mileageUnit:l,mileageCurrencyCode:s,mileageCurrencySymbol:c,denomination:p,denominationSymbol:g,mileageAmountInDenomination:S,description:_}=n;e(An({mileageDetails:{mileageUnitAmount:{amount:i,currencyCode:s,currencySymbol:c},denomination:p,denominationSymbol:g,mileageAmountInDenomination:S,mileageCurrencyCode:s,mileageCurrencySymbol:c,mileageUnit:l,description:_}}))},onSaveMileageClick:n=>{e(In(t)),D.trackReimbursementMileageRateSave(n)},onBusinessVerificationSectionClick:()=>{a("../verification"),r?.company?.companyReimbursementInfo!=null&&r?.company?.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(ge(t,!1,!0))},onSetupApprovalRulesSectionClick:()=>{a("../approval-rules")},onFetchLinkTokenClick:(n,i)=>{e(ve("reimbursement_setup",n,i))},onEstablishConnectionClick:n=>{e(ke(n,t,"reimbursement_setup","reimbursement"))},onUpdatePaymentAccountStatus:(n,i,l)=>{e(_e(n,i,"reimbursement","reimbursement_setup",l))},onUpdatePaymentAccountLoginStatus:(n,i)=>{e(Ae(!1,n,"reimbursement","reimbursement_setup",i))},onEstablishConnectionSuccess:()=>{e(ge(t,!0))},onEnableRemiClick:()=>{e(Q(t,"reimbursement"))},onUpdateAccountClick:(n,i,l)=>{e(l==="paymentAccount"?he(n,i,"reimbursement","reimbursement_setup"):Ie("reimbursement_setup",n,i))},onEnableRemiSuccess:()=>{a("../",{relative:"path"})},onBackClick:()=>{r?.companyReimbursementInfo?.info?.isReimbursementEnabled!=null&&r.companyReimbursementInfo.info.isReimbursementEnabled===!1?a("../.."):a("../",{relative:"path"})},onCompanyOfficerUpdated:(n,i)=>{e(be({officerType:n,fileIds:i}))},onSendForVerificationClick:n=>{e(N(t,n,"reimbursement",!0,!0,!0))},updateFilesEntity:n=>{e(ae({files:n}))},onDeleteFile:n=>{e(te(n))},onEditFileName:(n,i)=>{e(ne(n,i.split(".")[0]))},onUpdatePrimaryFundingAccount:(n,i)=>{e(Ce(t,"reimbursement_setup",n,i))}}}))(tt),_t=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),n=ie(),i=Ee(),l=Sn(n?.loggedInUserRoleMap),s=Fe(n?.loggedInUserRoleMap),[c,p]=h.useState(!1),g=h.useRef(!1),[S,_]=h.useState(!1),I=k((P=>P.remiSetupViewState.fetchState)),d=k((P=>V(P))),y=k((P=>P.remiSetupApproverViewState.fetchState)),{isApprovalRulesV3Enabled:f,isLoading:v}=nt(d?.tenantId),b=E.getSignedInUserTenant(r)?.companyId??d.companyId,m=E.getSignedInUser(),C=P=>{p(P)};if(m==null)throw Error("Can't access reimbursement setup page without signing in...");if(h.useEffect((()=>{g.current||I!=="Not-Started"||b==null?g.current||I!=="Completed"||b==null||d.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||(g.current=!0,t(ge(b,!1,!0))):(g.current=!0,t(ge(b,!0)))}),[I,b,t]),h.useEffect((()=>{S||y!=="Not-Started"||v||(_(!0),t(bn(!0,!1,!1,f)))}),[S,y,v,f,t]),d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1)return u.jsx(R,{to:"../promo"});if(d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!0){const P=T=>T.trackPageLoaded($.Event.reimbursementSetup);return u.jsxs(It,{children:[u.jsx(se,{analytics:D,onLoad:T=>P(T)}),u.jsx(le,{isAppContentDrawerOpen:c,handleDrawerToggle:C}),u.jsx(At,{navigate:o,location:a,companyId:b,currentTenant:d,isUserRemiAdmin:l,meetingUrl:e("reimbursement_setup"),onClickMenuIcon:()=>{C(!0)},hasZeniAccountsAdminAccess:s})]})}return u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:i.colors.grey5}})},kt=G((function(e,o){const{businessVerificationDetails:a,productType:t}=o,r=V(e),n=E.getSignedInUser(),i=r.tenantId,l={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:i??""},s=Un(o.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",c=On(e.companyConfigState),p=wn(e.userRoleConfigState),g=t==="zeni_treasury"?Je(e):void 0;return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:s,allIndustries:c.companyIndustries??[],companyTitles:p.companyTitles,transferDetails:g}}),(function(e,o){const{companyId:a,productType:t,currentTenant:r,navigate:n,location:i}=o,{tenantEmailDomain:l}=r;return{onCompanyDetailsChanged:s=>{const{companyDescription:c,companyIndustry:p,companyIndustryType:g,companyLegalName:S,companyTaxId:_,companyWebsite:I,companyPhone:d,primaryContactEmail:y,primaryContactName:f,primaryContactUserId:v,primaryContactSyncToken:b,syncToken:m,fileIds:C,incDate:P,typeOfIncorporation:T,stateOfIncorporation:U,sourceOfFunds:A,companySubIndustry:O,countriesOfOperations:B,companySourceOfFunds:z,companySourceOfFundsDescription:F,transactionVolume:ce,transactionVolumeDescription:H,purposeOfAccount:K,purposeOfAccountDescription:re,regulatedStatus:Z,regulatedStatusDescription:j,usNexus:w,usNexusTypes:De}=s,pe=g?.selectedOption,me={companyId:a,companyDescription:c,companyIndustry:p.selectedOption,companyIndustryType:pe==null||pe===""?void 0:pe,companyLegalName:S,taxIdOrEIN:_,website:I!=""&&I!=null?Ln(I):void 0,phone:d,syncToken:m,fileIds:C,incDate:P!=null?Re(P?.toString()):P,typeOfIncorporation:T?.selectedOption??"",stateOfIncorporation:U?.selectedOption??"",sourceOfFunds:A?.selectedOption??"",companySubIndustry:O?.selectedOption??"",countriesOfOperations:B?.selectedOptions.map((ue=>ue.length===2?ue:ze(ue)))??[],companySourceOfFunds:z?.selectedOption??"",companySourceOfFundsDescription:F,transactionVolume:ce?.selectedOption??"",transactionVolumeDescription:H,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:re,regulatedStatus:Z??"",regulatedStatusDescription:j,usNexus:w,usNexusTypes:De?.selectedOptions??[]},ye={userId:v,firstName:f.firstName,lastName:f.lastName,email:y,syncToken:b};e(Le({companyDetails:me,primaryContactDetails:ye}))},onCompanyOfficerUpdated:s=>{const c=s.map((p=>{const{officerType:g,userId:S,name:_,email:I,nationalityCountryCode:d,ssn:y,dob:f,phone:v,syncToken:b,selectDocument:m,role:C,ownership:P,isSelectedForVerification:T,userVerificationStatus:U,treasuryUserVerificationStatus:A,fileIds:O}=p;let B;return m.selectDocumentType==="driverLicense"?B="driving_license":m.selectDocumentType==="passport"?B="passport":m.selectDocumentType==="stateId"?B="id_document":m.selectDocumentType==="ssnCard"&&(B="social_security_card"),{officerType:g,userId:S,firstName:_.firstName,lastName:_.lastName,email:I,ssn:y,nationalityCountryCode:d?.selectedOption!=null?ze(d.selectedOption):void 0,phone:v,birthday:f!=null?Re(f?.toString()):f,syncToken:b,titleAtCompany:C.selectedOption,ownershipInCompany:P,documentTypeSelectedForVerification:B,isSelectedForVerification:T,userVerificationStatus:U,treasuryUserVerificationStatus:A,fileIds:O,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(Le({officers:c}))},onSaveDetailsClick:s=>{e(N(a,s,t))},onSendForVerificationClick:s=>{e(N(a,s,t,!0))},onAddressClick:s=>{const c=We(l,s),p=Me(i.state?.pathnameStackToGoBack,i.pathname),g=new URLSearchParams(i.search),S={};g.forEach(((_,I)=>{S[I]=_})),n(c,{state:{pathnameStackToGoBack:p,queryParams:Object.keys(S).length>0?S:void 0}})},onRegisteredAddressClick:s=>{const c=We(l,s),p=Me(i.state?.pathnameStackToGoBack,i.pathname),g=new URLSearchParams(i.search),S=Object.fromEntries(g.entries());n(c,{state:{pathnameStackToGoBack:p,queryParams:Object.keys(S).length>0?S:void 0}})},onBackClick:()=>{e(Rn({companyId:a})),n("../setup")},updateFilesEntity:s=>{e(ae({files:s}))},onDeleteFile:s=>{e(te(s))},onDeleteFileList:s=>{e(Xe(s))},onEditFileName:(s,c)=>{e(ne(s,c.split(".")[0]))},onGetOtp:s=>{e(Ke(s,"SpendManagementSetup"))},onResendOtp:s=>{e(He(s,"SpendManagementSetup"))},onVerifyOtp:(s,c)=>{e(Ge(s,c,"SpendManagementSetup"))},saveNewAddressInLocalStore:(s,c)=>{e(jn({addressType:s,addressToCreate:c}))},onExecuteTreasuryTransfer:()=>{e(Qe())},onOverlayClose:()=>{e(Oe())},onIdentityDocumentUploadedForAutofill:s=>{if(a==null)return;const c=xn(s.documentType);c!=null&&e(Bn({target:"setup",companyId:a,officerType:s.officerType,fileId:s.fileId,documentType:c}))},onCompanyDocumentUploadedForAutofill:s=>{a!=null&&e(Vn({target:"setup",companyId:a,fileId:s.fileId,documentType:s.documentType}))},onResetKycKybClick:()=>{e(Fn())}}}))(at),vt=({productType:e,isBusinessVerificationDrawerOpen:o,closeDrawerHandler:a})=>{const t=X(),r=Y(),n=ee(),[i]=en(),l=i.get("showStepProgress"),s=i.get("isTransferInitiated"),[c,p]=h.useState(!1),{tenantEmailDomain:g}=W(),S=ie(),{useDynamicConfig:_}=de(),I=Ee(),{configValue:d}=_(Ve.zeniAccountsConfig),y=je(d),f=k((A=>{switch(e){case"zeni_accounts":return A.zeniAccountSetupViewState.fetchState;case"reimbursement":return A.remiSetupViewState.fetchState;case"charge_cards":return A.chargeCardSetupViewState.fetchState;case"zeni_treasury":return A.treasurySetupViewState.fetchState;default:return A.billPaySetupViewState.fetchState}})),v=k((A=>A.companyConfigState.fetchState)),b=k((A=>A.userRoleConfigState.fetchState)),m=k((A=>V(A))),C=m.companyId??E.getSignedInUserTenant(g)?.companyId;h.useEffect((()=>{v==="Not-Started"&&n(_n()),b==="Not-Started"&&n(kn(!0))}),[v,b,n]),h.useEffect((()=>{c||f!=="Not-Started"||C==null||(p(!0),Ze(n,e,C))}),[c,f,C,n]);const P=k((A=>{let O;switch(e){case"zeni_accounts":O=En(A,C);break;case"zeni_treasury":O=qe(A,C);break;case"charge_cards":O=Tn(A,C);break;case"reimbursement":O=Pn(A,C);break;default:O=vn(A,C)}return O})),T=P.kycKybResetStatus.fetchState;if(h.useEffect((()=>{T==="Completed"&&C!=null&&(Ze(n,e,C,!0),n(Dn()))}),[T,C,e,n]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let U;switch(e){case"zeni_accounts":U=m.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":U=m.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":U=m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":U=m.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:U=m.companyBillPayInfo?.info?.isBillPayTOSAccepted}return U===!1?null:P.fetchState==="Completed"&&U===!0&&S?.loggedInUserRoleMap!=null?u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:A=>(O=>{switch(e){case"zeni_accounts":return O.trackPageLoaded($.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return O.trackPageLoaded($.Event.reimbursementBusinessVerification);default:return O.trackPageLoaded($.Event.billPayBusinessVerification,Be(r)?"Settings":void 0)}})(A)}),u.jsx(kt,{businessVerificationDetails:P,navigate:t,location:r,companyId:C,analytics:D,currentTenant:m,productType:e,roleMap:S.loggedInUserRoleMap,isSettings:Be(r),isOverlay:!0,isStepInProgress:l!=null,isTreasuryTransferInitiated:s!=null,onClickMenuIcon:()=>{},maxInsuredAmount:y.maxInsuredAmount,isBusinessVerificationDrawerOpen:o,closeDrawerHandler:a})]}):u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Pt={overlayWidth:new st(100,100,59)},Tt=G((function(e,o){const{isUserZeniAccountsAdmin:a,companyId:t}=o,r=V(e),n=E.getSignedInUser(),i=r.tenantId,l={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:i??""},s=Ye(e,t),c=qe(e,t),p=a&&s.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&s.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly",g=Zn(e),S=g.transactions,_=Je(e),I=g.accountSummary?.totalBalance?.amount,d=S.length===0||I===0;return{treasurySetupView:s,businessVerificationDetails:c,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",transactions:S,transferDetails:_,isFirstTransfer:d,isDisabled:p,analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:l,isOnSetup:!0,maxInsuredAmount:o.maxInsuredAmount}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r,isAllocationDone:n,analytics:i,treasurySetupView:l}=o;return{onTransferSaveChangesToLocalStore:s=>{e(Gn(s))},onBusinessVerificationSectionClick:(s,c)=>{let p="../verification";s&&(p+="?showStepProgress=true",c&&(p+="&isTransferInitiated=true")),a(p),r?.company?.companyTreasuryInfo!=null&&r?.company?.companyTreasuryInfo?.businessVerificationStatus?.code==="pending_review"&&e(we(t,!1,!0))},onFetchLinkTokenClick:(s,c)=>{e(ve("treasury_setup",s,c))},onEstablishConnectionClick:s=>{e(ke(s,t,"treasury_setup","zeni_treasury"))},onUpdatePaymentAccountStatus:(s,c,p)=>{e(_e(s,c,"zeni_treasury","treasury_setup",p))},onUpdatePaymentAccountLoginStatus:(s,c)=>{e(Ae(!1,s,"zeni_treasury","treasury_setup",c))},onEstablishConnectionSuccess:()=>{e(we(t,!0))},onEnableTreasuryClick:()=>{e(Q(t,"zeni_treasury"))},onUpdateTreasuryClick:(s,c,p)=>{e(p==="paymentAccount"?he(s,c,"zeni_treasury","treasury_setup"):Ie("treasury_setup",s,c))},onUpdatePrimaryFundingAccount:(s,c)=>{e(Ce(t,"treasury_setup",s,c))},onNavigateToDashboard:()=>{a(r?.company?.companyTreasuryInfo?.businessVerificationStatus?.code==="verified"?"../":"../../")},onCompanyOfficerUpdated:(s,c)=>{e(be({officerType:s,fileIds:c}))},onSendForVerificationClick:(s,c)=>{if(e(N(t,s,"zeni_treasury",!0,!0,!0)),!n){const p=l.fundAllocationLocalData;i.trackTreasuryPortfolioConfirm(p.riskScore,$e(p)),e(Ne(!1))}c===!0&&e(Qe())},updateFilesEntity:s=>{e(ae({files:s}))},onDeleteFile:s=>{e(te(s))},onEditFileName:(s,c)=>{e(ne(s,c.split(".")[0]))},onAdditionalVerificationFieldsChanged:s=>{const{sourceOfFunds:c}=s;e(Wn({sourceOfFunds:c?.selectedOption??""}))},onUpdateFundAllocation:s=>{i.trackTreasuryAllocationAction("update",$e(s)),e($n(s))},onConfirmFundAllocation:()=>{e(Ne(n))},onOverlayClose:()=>{e(Oe())}}}))(ot),Et=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),r=Ee(),n=it(),{tenantEmailDomain:i}=W(),{useDynamicConfig:l}=de(),s=ie(),[c,p]=h.useState(!1),g=Fe(s?.loggedInUserRoleMap),{configValue:S}=l(Ve.zeniAccountsConfig),_=je(S),[I,d]=h.useState(!1),[y,f]=h.useState(!1),[v,b]=h.useState(!1),[m,C]=h.useState(!1),[P,T]=h.useState(!1),U=k((w=>w.treasurySetupViewState.fetchState)),A=k((w=>w.treasurySetupViewState.treasuryFundsDetails?.fetchStatus?.fetchState)),O=k((w=>w.treasurySetupViewState.currentAllocation.fetchStatus?.fetchState)),B=k((w=>w.treasuryDetailState.transactionsState?.fetchState)),z=k((w=>V(w))),F=E.getSignedInUserTenant(i)?.companyId??z.companyId,ce=k((w=>Ye(w,F))),H=ce.isAtomicAccountExists,K=E.getSignedInUser(),re=w=>{d(w)};if(K==null)throw Error("Can't access treasury setup page without signing in...");h.useEffect((()=>{y||U!=="Not-Started"||F==null||(f(!0),t(we(F,!0,!1)))}),[y,U,F,t]),h.useEffect((()=>{v||A!=="Not-Started"||F==null||(b(!0),t(Nn()))}),[v,A,F,t]),h.useEffect((()=>{m||O!=="Not-Started"||F==null||(C(!0),t(Mn()))}),[m,O,F,t]),h.useEffect((()=>{P||B!=="Not-Started"||F==null||(T(!0),t(zn(!0)))}),[P,B,F,t]);const Z=z.companyTreasuryInfo?.info?.businessVerificationStatus?.code,j=Z==="pending_review"||Z==="verified";return h.useEffect((()=>{c||U!=="Completed"||H||j||!a.pathname.includes("setup")||p(!0)}),[U,H,j]),z.companyTreasuryInfo?.info?.isTreasuryTOSAccepted===!1?u.jsx(R,{to:"../promo"}):u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:()=>{}}),u.jsx(le,{isAppContentDrawerOpen:I,handleDrawerToggle:re}),u.jsx(dt,{onClose:()=>{t(Oe()),o("../setup")},anchor:"right",open:a.pathname.includes("verification"),transitionDuration:c?0:250,PaperProps:{style:{width:Pt.overlayWidth.valuePercentage(n),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:c?"transparent":r.colors.black,opacity:.75,cursor:"pointer"}}},children:u.jsx(Dt,{onClick:w=>w.stopPropagation(),children:u.jsx(vt,{productType:"zeni_treasury",isBusinessVerificationDrawerOpen:!0,closeDrawerHandler:()=>{t(Oe()),o("../setup")}})})}),u.jsx(Tt,{navigate:o,location:a,companyId:F,currentTenant:z,isUserZeniAccountsAdmin:g,meetingUrl:e("treasury_setup"),maxInsuredAmount:_.maxInsuredAmount,isAllocationDone:H,analytics:D,treasurySetupView:ce,onClickMenuIcon:()=>{re(!0)},showTreasurySetupOverlay:c,setShowTreasurySetupOverlay:p})]})},Dt=xe(lt)`
18
18
  display: flex;
19
19
  min-height: 100%;
20
20
  flex-direction: column;
21
- `,Ut=H((function(e,o){const{isUserZeniAccountsAdmin:a,companyId:t}=o,r=V(e),n=E.getSignedInUser(),i=r.tenantId,l={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:i??""},s=Gn(e,t),c=a&&s.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&s.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly";return{zeniAccountSetUpView:s,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",isDisabled:c,analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:l}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r}=o;return{onBusinessVerificationSectionClick:()=>{a("../verification"),r?.company?.companyZeniAccountInfo!=null&&r?.company?.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(Se(t,!1,!0))},onFetchLinkTokenClick:(n,i)=>{e(ve("account_setup",n,i))},onEstablishConnectionClick:n=>{e(ke(n,t,"account_setup","zeni_accounts"))},onUpdatePaymentAccountStatus:(n,i,l)=>{e(_e(n,i,"zeni_accounts","account_setup",l))},onUpdatePaymentAccountLoginStatus:(n,i)=>{e(Ae(!1,n,"zeni_accounts","account_setup",i))},onEstablishConnectionSuccess:()=>{e(Se(t,!0))},onEnableZeniAccountClick:()=>{e(Q(t,"zeni_accounts"))},onUpdateZeniAccountClick:(n,i,l)=>{e(l==="paymentAccount"?he(n,i,"zeni_accounts","account_setup"):Ie("account_setup",n,i))},onUpdatePrimaryFundingAccount:(n,i)=>{e(Ce(t,"account_setup",n,i))},onEnableZeniAccountSuccess:()=>{a("../",{relative:"path"})},onBackClick:()=>{r?.companyZeniAccountInfo?.info?.isZeniAccountEnabled?a("../"):a("../../")},onNavigateToDashboard:()=>{a("../../dashboard")},onCompanyOfficerUpdated:(n,i)=>{e(be({officerType:n,fileIds:i}))},onSendForVerificationClick:n=>{e(N(t,n,"zeni_accounts",!0,!0,!0))},updateFilesEntity:n=>{e(ae({files:n}))},onDeleteFile:n=>{e(te(n))},onEditFileName:(n,i)=>{e(ne(n,i.split(".")[0]))}}}))(ct),Ot=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),{useDynamicConfig:n}=de(),i=ie(),l=Fe(i?.loggedInUserRoleMap),{configValue:s}=n(Ve.zeniAccountsConfig),c=je(s),[p,g]=h.useState(!1),[S,_]=h.useState(!1),I=k((b=>b.zeniAccountSetupViewState.fetchState)),d=k((b=>V(b))),y=E.getSignedInUserTenant(r)?.companyId??d.companyId,f=E.getSignedInUser(),v=b=>{g(b)};if(f==null)throw Error("Can't access zeni bank account setup page without signing in...");if(h.useEffect((()=>{S||I!=="Not-Started"||y==null?S||I!=="Completed"||y==null||d.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||t(Se(y,!1,!0)):(_(!0),t(Se(y,!0)))}),[S,I,y,t]),d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted===!1)return u.jsx(R,{to:"../promo"});{const b=m=>m.trackPageLoaded($.Event.zeniAccountsSetup);return u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:m=>b(m)}),u.jsx(le,{isAppContentDrawerOpen:p,handleDrawerToggle:v}),u.jsx(Ut,{navigate:o,location:a,companyId:y,currentTenant:d,isUserZeniAccountsAdmin:l,accountsPromoConfig:c,meetingUrl:e("zeni_accounts_setup"),onClickMenuIcon:()=>{v(!0)}})]})}},wt=xe.div`
21
+ `,Ut=G((function(e,o){const{isUserZeniAccountsAdmin:a,companyId:t}=o,r=V(e),n=E.getSignedInUser(),i=r.tenantId,l={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:i??""},s=Hn(e,t),c=a&&s.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.link_account.updateStatus.fetchState!=="In-Progress"&&s.plaidConnectionDetails.update_account.updateStatus.fetchState!=="In-Progress"&&s.accountUpdateStatus?.fetchState!=="In-Progress"?void 0:"readonly";return{zeniAccountSetUpView:s,connectedAccountProvider:r.company?.featuresActivationInfo.connectedAccountProvider??"",isDisabled:c,analytics:D,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:l}}),(function(e,o){const{navigate:a,companyId:t,currentTenant:r}=o;return{onBusinessVerificationSectionClick:()=>{a("../verification"),r?.company?.companyZeniAccountInfo!=null&&r?.company?.companyBillPayInfo?.businessVerificationStatus?.code==="pending_review"&&e(Se(t,!1,!0))},onFetchLinkTokenClick:(n,i)=>{e(ve("account_setup",n,i))},onEstablishConnectionClick:n=>{e(ke(n,t,"account_setup","zeni_accounts"))},onUpdatePaymentAccountStatus:(n,i,l)=>{e(_e(n,i,"zeni_accounts","account_setup",l))},onUpdatePaymentAccountLoginStatus:(n,i)=>{e(Ae(!1,n,"zeni_accounts","account_setup",i))},onEstablishConnectionSuccess:()=>{e(Se(t,!0))},onEnableZeniAccountClick:()=>{e(Q(t,"zeni_accounts"))},onUpdateZeniAccountClick:(n,i,l)=>{e(l==="paymentAccount"?he(n,i,"zeni_accounts","account_setup"):Ie("account_setup",n,i))},onUpdatePrimaryFundingAccount:(n,i)=>{e(Ce(t,"account_setup",n,i))},onEnableZeniAccountSuccess:()=>{a("../",{relative:"path"})},onBackClick:()=>{r?.companyZeniAccountInfo?.info?.isZeniAccountEnabled?a("../"):a("../../")},onNavigateToDashboard:()=>{a("../../dashboard")},onCompanyOfficerUpdated:(n,i)=>{e(be({officerType:n,fileIds:i}))},onSendForVerificationClick:n=>{e(N(t,n,"zeni_accounts",!0,!0,!0))},updateFilesEntity:n=>{e(ae({files:n}))},onDeleteFile:n=>{e(te(n))},onEditFileName:(n,i)=>{e(ne(n,i.split(".")[0]))}}}))(ct),Ot=()=>{const e=Pe(),o=X(),a=Y(),t=ee(),{tenantEmailDomain:r}=W(),{useDynamicConfig:n}=de(),i=ie(),l=Fe(i?.loggedInUserRoleMap),{configValue:s}=n(Ve.zeniAccountsConfig),c=je(s),[p,g]=h.useState(!1),[S,_]=h.useState(!1),I=k((b=>b.zeniAccountSetupViewState.fetchState)),d=k((b=>V(b))),y=E.getSignedInUserTenant(r)?.companyId??d.companyId,f=E.getSignedInUser(),v=b=>{g(b)};if(f==null)throw Error("Can't access zeni bank account setup page without signing in...");if(h.useEffect((()=>{S||I!=="Not-Started"||y==null?S||I!=="Completed"||y==null||d.companyBillPayInfo?.info?.businessVerificationStatus?.code!=="pending_review"||t(Se(y,!1,!0)):(_(!0),t(Se(y,!0)))}),[S,I,y,t]),d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted===!1)return u.jsx(R,{to:"../promo"});{const b=m=>m.trackPageLoaded($.Event.zeniAccountsSetup);return u.jsxs(u.Fragment,{children:[u.jsx(se,{analytics:D,onLoad:m=>b(m)}),u.jsx(le,{isAppContentDrawerOpen:p,handleDrawerToggle:v}),u.jsx(Ut,{navigate:o,location:a,companyId:y,currentTenant:d,isUserZeniAccountsAdmin:l,accountsPromoConfig:c,meetingUrl:e("zeni_accounts_setup"),onClickMenuIcon:()=>{v(!0)}})]})}},wt=xe.div`
22
22
  display: flex;
23
23
  height: 100vh;
24
24
  width: 100%;
@@ -26,4 +26,4 @@ import{j as u}from"./liveblocks-BlNqAXG4.js";import{h as X,g as Y,u as ee,i as W
26
26
  flex-direction: column;
27
27
  align-items: center;
28
28
  background-color: ${e=>e.theme.colors.grey4};
29
- `,Ft=H((function(e,o){const a=V(e),t=E.getSignedInUser(),r=a.tenantId,n={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""};return{internationalOnboardingDetails:qn(e),isReadonly:o.isFormReadonly,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:n,analytics:D}}),(function(e,o){const{navigate:a}=o;return{onFormDataChange:t=>{e(Xn(t))},onSubmitClick:()=>{e(Qn(o.companyId))},onCancelClick:()=>{a("../setup")},updateFilesEntity:t=>{e(ae({files:t}))},onDeleteFile:t=>{e(te(t))},onDeleteFileList:t=>{e(Xe(t))},onEditFileName:(t,r)=>{e(ne(t,r.split(".")[0]))}}}))(rt),Vt=()=>{const e=X(),o=Y(),a=ee(),[t,r]=h.useState(!1),[n,i]=h.useState(!1),[l,s]=h.useState(!1),{tenantEmailDomain:c}=W(),p=ie(),{useFeatureGate:g}=de(),{isFeatureEnabled:S}=g(J.isBillPayLocalCurrencyFeatureEnabled),_=k((T=>T.internationalWireVerificationState.verificationFormFetchState.fetchState)),I=k((T=>T.billPaySetupViewState.fetchState)),d=k((T=>V(T))),y=Ee(),f=d.companyId??E.getSignedInUserTenant(c)?.companyId,v=k((T=>Kn(T.companyState,d.companyId))),b=v?.company.companyBillPayInfo.internationalWireOnboardingStatus,m=b?.code==="onboarding_status_not_started"?void 0:"readonly";if(h.useEffect((()=>{t||_!=="Not-Started"||f==null||(r(!0),a(Jn(f)))}),[t,_,f,a]),h.useEffect((()=>{n||I!=="Not-Started"||f==null||(i(!0),a(q(f,!0)))}),[I,n,f,a]),E.getSignedInUser()==null)throw Error("Can't access international verification without signing in...");const C=d.companyBillPayInfo?.info?.isBillPayTOSAccepted,P=T=>{s(T)};return C===!1?u.jsx(R,{to:"../promo"}):C===!0&&p?.loggedInUserRoleMap!=null?u.jsxs(wt,{children:[u.jsx(se,{analytics:D,onLoad:T=>(U=>U.trackPageLoaded($.Event.billPayBusinessVerification,void 0))(T)}),Be(o)?u.jsx(le,{isAppContentDrawerOpen:l,handleDrawerToggle:P}):null,u.jsx(Ft,{navigate:e,location:o,companyId:f,analytics:D,currentTenant:d,roleMap:p.loggedInUserRoleMap,isFormReadonly:m,isLocalCurrencyEnabled:S})]}):u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:y.colors.grey5}})},xt=H((function(){return{}}),(function(e,o){const{companyId:a,productType:t}=o;return{onEventReceived:r=>{switch(r){case"bill-pay-set-up-verification-update":case"bill-pay-wise-setup":switch(t){case"reimbursement":e(ge(a,!0,!0));break;case"zeni_accounts":e(Se(a,!0,!0));break;case"charge_cards":e(fe(a,!0,!0));break;case"zeni_treasury":e(we(a,!0,!0));break;default:e(q(a,!0,!0))}}}}}))(ut((e=>{const{isBillPayAdminLevelAccess:o,isUserHasOnlyBillPayAccess:a,isReimbursementAdminLevelAccess:t,isZeniAccountAdminLevelAccess:r,isTreasuryAdminLevelAccess:n,isChargeCardAdminLevelAccess:i,isUserHasOnlyCardAccess:l,productType:s,type:c}=e;switch(s){case"bill_pay":switch(c){case"verification":return o?u.jsx(Ue,{productType:s}):a?u.jsx(R,{to:"../"}):u.jsx(L,{});case"international-wire":return o?u.jsx(Vt,{}):a?u.jsx(R,{to:"../"}):u.jsx(L,{});default:return o?u.jsx(ft,{}):a?u.jsx(R,{to:"../"}):u.jsx(L,{})}case"reimbursement":return c==="verification"?t?u.jsx(Ue,{productType:s}):u.jsx(L,{}):t?u.jsx(_t,{}):u.jsx(L,{});case"zeni_accounts":return c==="verification"?r?u.jsx(Ue,{productType:"zeni_accounts"}):u.jsx(L,{}):r?u.jsx(Ot,{}):u.jsx(L,{});case"zeni_treasury":return n===!0?u.jsx(Et,{}):u.jsx(L,{});case"charge_cards":return c==="verification"?i?u.jsx(Ue,{productType:"charge_cards"}):l?u.jsx(R,{to:"../"}):u.jsx(L,{}):i?u.jsx(ht,{}):l?u.jsx(R,{to:"../"}):u.jsx(L,{})}})));function ua(e){const{tenantEmailDomain:o}=W(),a=k((r=>V(r))).companyId??E.getSignedInUserTenant(o)?.companyId,t={events:a!=null?[`private-encrypted-${a}.bill-pay-set-up-verification-update`,`private-encrypted-${a}.bill-pay-wise-setup`]:[],eventCallback:(r,n,i)=>{i.onEventReceived(r)}};if(E.getSignedInUser()==null)throw Error("Can't access setup details page without signing in...");return u.jsx(xt,{...e,companyId:a,...t})}export{ia as A,sa as P,ua as S,na as a,aa as b,St as c,bt as d,gt as e,oa as f,Qt as g,Kt as h,ea as i,ta as j,ca as k,Yt as l,Xt as m,Jt as n,qt as o,Gt as p,ra as s};
29
+ `,Ft=G((function(e,o){const a=V(e),t=E.getSignedInUser(),r=a.tenantId,n={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""};return{internationalOnboardingDetails:Jn(e),isReadonly:o.isFormReadonly,filesEndPoint:`${oe.fileMicroServiceBaseUrl}`,authParams:n,analytics:D}}),(function(e,o){const{navigate:a}=o;return{onFormDataChange:t=>{e(Xn(t))},onSubmitClick:()=>{e(Qn(o.companyId))},onCancelClick:()=>{a("../setup")},updateFilesEntity:t=>{e(ae({files:t}))},onDeleteFile:t=>{e(te(t))},onDeleteFileList:t=>{e(Xe(t))},onEditFileName:(t,r)=>{e(ne(t,r.split(".")[0]))}}}))(rt),Vt=()=>{const e=X(),o=Y(),a=ee(),[t,r]=h.useState(!1),[n,i]=h.useState(!1),[l,s]=h.useState(!1),{tenantEmailDomain:c}=W(),p=ie(),{useFeatureGate:g}=de(),{isFeatureEnabled:S}=g(q.isBillPayLocalCurrencyFeatureEnabled),_=k((T=>T.internationalWireVerificationState.verificationFormFetchState.fetchState)),I=k((T=>T.billPaySetupViewState.fetchState)),d=k((T=>V(T))),y=Ee(),f=d.companyId??E.getSignedInUserTenant(c)?.companyId,v=k((T=>Kn(T.companyState,d.companyId))),b=v?.company.companyBillPayInfo.internationalWireOnboardingStatus,m=b?.code==="onboarding_status_not_started"?void 0:"readonly";if(h.useEffect((()=>{t||_!=="Not-Started"||f==null||(r(!0),a(qn(f)))}),[t,_,f,a]),h.useEffect((()=>{n||I!=="Not-Started"||f==null||(i(!0),a(J(f,!0)))}),[I,n,f,a]),E.getSignedInUser()==null)throw Error("Can't access international verification without signing in...");const C=d.companyBillPayInfo?.info?.isBillPayTOSAccepted,P=T=>{s(T)};return C===!1?u.jsx(R,{to:"../promo"}):C===!0&&p?.loggedInUserRoleMap!=null?u.jsxs(wt,{children:[u.jsx(se,{analytics:D,onLoad:T=>(U=>U.trackPageLoaded($.Event.billPayBusinessVerification,void 0))(T)}),Be(o)?u.jsx(le,{isAppContentDrawerOpen:l,handleDrawerToggle:P}):null,u.jsx(Ft,{navigate:e,location:o,companyId:f,analytics:D,currentTenant:d,roleMap:p.loggedInUserRoleMap,isFormReadonly:m,isLocalCurrencyEnabled:S})]}):u.jsx(Te,{fetchState:"In-Progress",style:{backgroundColor:y.colors.grey5}})},xt=G((function(){return{}}),(function(e,o){const{companyId:a,productType:t}=o;return{onEventReceived:r=>{switch(r){case"bill-pay-set-up-verification-update":case"bill-pay-wise-setup":switch(t){case"reimbursement":e(ge(a,!0,!0));break;case"zeni_accounts":e(Se(a,!0,!0));break;case"charge_cards":e(fe(a,!0,!0));break;case"zeni_treasury":e(we(a,!0,!0));break;default:e(J(a,!0,!0))}}}}}))(ut((e=>{const{isBillPayAdminLevelAccess:o,isUserHasOnlyBillPayAccess:a,isReimbursementAdminLevelAccess:t,isZeniAccountAdminLevelAccess:r,isTreasuryAdminLevelAccess:n,isChargeCardAdminLevelAccess:i,isUserHasOnlyCardAccess:l,productType:s,type:c}=e;switch(s){case"bill_pay":switch(c){case"verification":return o?u.jsx(Ue,{productType:s}):a?u.jsx(R,{to:"../"}):u.jsx(L,{});case"international-wire":return o?u.jsx(Vt,{}):a?u.jsx(R,{to:"../"}):u.jsx(L,{});default:return o?u.jsx(ft,{}):a?u.jsx(R,{to:"../"}):u.jsx(L,{})}case"reimbursement":return c==="verification"?t?u.jsx(Ue,{productType:s}):u.jsx(L,{}):t?u.jsx(_t,{}):u.jsx(L,{});case"zeni_accounts":return c==="verification"?r?u.jsx(Ue,{productType:"zeni_accounts"}):u.jsx(L,{}):r?u.jsx(Ot,{}):u.jsx(L,{});case"zeni_treasury":return n===!0?u.jsx(Et,{}):u.jsx(L,{});case"charge_cards":return c==="verification"?i?u.jsx(Ue,{productType:"charge_cards"}):l?u.jsx(R,{to:"../"}):u.jsx(L,{}):i?u.jsx(ht,{}):l?u.jsx(R,{to:"../"}):u.jsx(L,{})}})));function ua(e){const{tenantEmailDomain:o}=W(),a=k((r=>V(r))).companyId??E.getSignedInUserTenant(o)?.companyId,t={events:a!=null?[`private-encrypted-${a}.bill-pay-set-up-verification-update`,`private-encrypted-${a}.bill-pay-wise-setup`]:[],eventCallback:(r,n,i)=>{i.onEventReceived(r)}};if(E.getSignedInUser()==null)throw Error("Can't access setup details page without signing in...");return u.jsx(xt,{...e,companyId:a,...t})}export{ia as A,sa as P,ua as S,na as a,aa as b,St as c,bt as d,gt as e,oa as f,Qt as g,Kt as h,ea as i,ta as j,ca as k,Yt as l,Xt as m,qt as n,Jt as o,Ht as p,ra as s};
@@ -0,0 +1 @@
1
+ import{j as f}from"./liveblocks-Bym0XjRt.js";import{a as u,R as T,t as A}from"./sentry-CoKtZcTW.js";import{u as z,h as D,j as l,g as M,N as O,l as V}from"./core-C9Jt3gNb.js";import{u as j,z as s,l as E,G as P,N as F,Q as N,S as _,T as B,U as J,W as v}from"./index-DmFy--fV.js";import{fI as W,UJ as $,V1 as Q,gl as R,gn as Y,V6 as G,gY as H,dl as q,V7 as U,V8 as K,V9 as X,c1 as y}from"./zeni-epic-state-OTisIlmp.js";import{u as Z}from"./mui-BsgiBiT9.js";import{u as ee}from"./useDeviceId-Cf3xan56.js";import{f as te}from"./analyticsHelper-drNlDujn.js";import{t as ne}from"./getLocaleForTenant-7mVUFLO-.js";import"./recharts-GCccddBO.js";import"./analytics-DbFSqIth.js";import"./plaid-C8X6T_ms.js";import"./dnd-KhFMfpEU.js";import"./stripe-cKAAJElX.js";import"./lottie-CvA92JCl.js";import"./lexical-CpBrNOz8.js";import"./pdf-O569E9WB.js";import"./utils-CNqTTzSx.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]="06753672-f8e6-4eb5-8e24-0872065f5111",t._sentryDebugIdIdentifier="sentry-dbid-06753672-f8e6-4eb5-8e24-0872065f5111")}catch{}})();const ie=V((function(t,i){const d=t.tenantState.fetchState,g=t.tenantState.sendEmailMagicLinkFetchState,{magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}=i;return{googleClientId:v.googleClientId,microsoftClientId:v.microsoftClientId,signInError:t.tenantState.error?.error,fetchState:d,sendMagicLinkStatus:g,magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}}),(function(t,i){const{location:d,navigate:g}=i;return console.warn(JSON.stringify(window.location)),{onOAuthError:(n,a)=>{A({message:`OAuth error from provider ${a} with error ${n}`,level:"error",tags:{authProvider:a,errorType:"zeni.login.error"},extra:{error:n,windowLocation:window.location.href}})},onOAuthSuccess:(n,a)=>{const c=a==="google"?window.location.origin:window.location.origin+window.location.pathname;t(X({authCode:n,oauthProvider:a,appType:"web",redirectUri:y(c),sourceUri:y(d.state!=null?d.state.origin:"")}))},getSignedInUser:()=>s.getSignedInUser(),onSignedInCallback:()=>{const n=d.state?.origin;n&&n!=="/"?g(n,{replace:!0}):window.open(window.location.origin,"_self")},sendMagicLink:n=>{const{deviceId:a}=i;a!=null&&(s.saveMagicLinkEmail(n),t(K(n,a)))},clearSignInError:()=>{t(U())}}}))(J),ae=T.memo(ie);function ve({setTenantEmailDomain:t}){const i=z(),d=D(),{clearAllLoading:g}=j(),n=s.getSignedInUser();u.useLayoutEffect((()=>{g()}),[g]);const a=ee(),c=l((e=>e.tenantState.magicLinkCodeVerifier)),{sendEmailMagicLinkFetchState:k,accountLocked:C,accountUnlockTime:L}=l((e=>e.tenantState)),p=l((e=>e.tenantState.fetchState)),h=l((e=>e.tenantState.activeTenantFetchState.fetchState)),S=l((e=>e.tenantState.signInState)),o=l((e=>e.tenantState.loggedInUser)),r=l((e=>W(e))),I=l((e=>$(e))),m=M(),w=Z().mode,b=m.state?.magicLinkExpired,x=m.state?.magicLinkAlreadyUsed;if(u.useEffect((()=>{k.fetchState==="Completed"&&c!=null&&(E.trackSignInLinkSent(),s.saveMagicLinkCodeVerifier(c))}),[k.fetchState,c]),u.useEffect((()=>{t(void 0)}),[]),u.useEffect((()=>{S!=="In-Progress"||p!=="Completed"&&h!=="Completed"||o?.zeniSessionId==null||r==null||(s.savePayNowInfoTooltip(!0,o.zeniSessionId),s.saveSignedInUserWithSession(o,o.zeniSessionId),s.saveSignedInUserTenants(Q(I.tenantsInOrder),o.zeniSessionId),R(o.userId,o.zeniSessionId,r.tenantId),i(Y(r.tenantId)),s.saveActiveTenantDomainForUser(r.tenantEmailDomain),i(G("Completed")),P.updateAppLocaleID(ne(r)),te(o,r,w,void 0,I.tenantsInOrder),H().then((()=>{const e=B();e!=null&&F(e)})),setTimeout((()=>{E.trackLogin(N.Event.loginSuccess,o.authProvider??"google",q(r.productSettings))}),2e3))}),[S,p,h,o,r,I,w,m.state,i]),S==="In-Progress"&&p==="Completed"&&o?.zeniSessionId!=null&&r!=null||n!=null){const e=m.state?.origin??"/";return f.jsx(O,{to:e,state:{...m.state,origin:""}})}return f.jsxs(f.Fragment,{children:[f.jsx(ae,{magicLinkExpired:!!b,magicLinkAlreadyUsed:!!x,magicLinkExpiredEmail:s.getMagicLinkEmail()??void 0,location:m,navigate:d,deviceId:a??void 0,showEmailLogin:!0}),C===!0&&L!=null?f.jsx(_,{onClose:()=>i(U()),unlockDate:L}):null]})}export{ve as default};
@@ -0,0 +1,9 @@
1
+ import{j as s}from"./liveblocks-Bym0XjRt.js";import{a as i}from"./sentry-CoKtZcTW.js";import{u as c,g as d,N as u}from"./core-C9Jt3gNb.js";import{z as a,l as n,Q as m,a5 as p}from"./index-DmFy--fV.js";import{g$ as g,Vn as y}from"./zeni-epic-state-OTisIlmp.js";import{n as b}from"./mui-BsgiBiT9.js";import"./recharts-GCccddBO.js";import"./analytics-DbFSqIth.js";import"./plaid-C8X6T_ms.js";import"./dnd-KhFMfpEU.js";import"./stripe-cKAAJElX.js";import"./lottie-CvA92JCl.js";import"./lexical-CpBrNOz8.js";import"./pdf-O569E9WB.js";import"./utils-CNqTTzSx.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="5ab5a4a7-a127-4805-96f0-829c2194542f",t._sentryDebugIdIdentifier="sentry-dbid-5ab5a4a7-a127-4805-96f0-829c2194542f")}catch{}})();function N(){const t=c(),e=d(),r=i.useRef(!1),f=a.isSignedIn(),o=e.state?.message==="logout"||f;return i.useEffect((()=>{if(o&&!r.current){r.current=!0;try{t(g()),y(),n.trackLogout(m.Event.logoutSuccess),n.resetUserIdentity(),a.clearAll()}catch(l){console.error("Error during sign out:",l)}finally{window.location.replace("/signin/auth")}}}),[o,t]),o?s.jsx(h,{children:s.jsx(p,{fetchState:"In-Progress"})}):s.jsx(u,{to:"../",replace:!0})}const h=b.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${t=>t.theme.colors.grey4};
9
+ `;export{N as default};
@@ -1,4 +1,4 @@
1
- import{j as A}from"./liveblocks-BlNqAXG4.js";import{a as u}from"./sentry-oO1cMYln.js";import{u as H,k as X,j as C,h as me,g as Se,i as ye,l as be}from"./core-Dx-yNdOO.js";import{z as M,q as De,$ as I,aq as Ee,a6 as he,h as Ce,M as Ge,e4 as Ae,p as F,a2 as Ie}from"./index-BN_JNPW3.js";import{QI as Re,Rw as ve,fI as Be,a2P as ne,gQ as V,a2Q as re,a2K as Le,Q_ as Y,a2R as Ke,Rc as J,QK as we,Qm as Ue,RI as ee,a2S as ae,gk as Pe,Rz as Fe,RE as je,Rr as xe,Rp as te,RF as $e,Rm as Oe,a2T as Ne,a2U as Qe,a2V as ze,a2W as Me,a2X as R,dy as Ve,dx as Ze,a2Y as qe,QH as We}from"./zeni-epic-state-DU8p9Pr6.js";import{n as He}from"./mui-DicWBIpH.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-BOks8lHg.js";import{M as Ye}from"./MobileAppDrawer-D9_9MdJz.js";import{u as Je}from"./useTaskManagerPusherEvents-C9HPPvD2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c995b56-2dbb-47dc-b8e9-d49806c54748",e._sentryDebugIdIdentifier="sentry-dbid-1c995b56-2dbb-47dc-b8e9-d49806c54748")}catch{}})();const _={TASK_CREATED:"task-created",TASK_UPDATED:"task-updated",TASK_SNOOZE_RESURFACED:"task-snooze-resurfaced",TASKS_BULK_UPDATED:"tasks-bulk-updated",TASKS_BULK_DELETED:"tasks-bulk-deleted"},ea=(e,t)=>e==null||e===""?[]:t.map((n=>`private-encrypted-${e}.${n}`)),aa=(e,t)=>e==null||e===""?[]:t.map((n=>`private-encrypted-${e}.${n}`)),j=e=>Array.isArray(e)&&e.every((t=>typeof t=="string")),oe=e=>typeof e.task_id=="string"?e.task_id:typeof e.id=="string"?e.id:null,ga=e=>{if(e==null||typeof e!="object")return null;const t=e,n=oe(t);if(n==null)return null;const c={task_id:n};return typeof t.parent_task_id=="string"&&(c.parent_task_id=t.parent_task_id),typeof t.sync_token=="string"&&(c.sync_token=t.sync_token),typeof t.is_deleted=="boolean"&&(c.is_deleted=t.is_deleted),typeof t.is_private=="boolean"&&(c.is_private=t.is_private),c},ta=e=>{if(e==null||typeof e!="object")return null;const t=e;return j(t.task_ids)?{task_ids:t.task_ids}:null},_a=e=>{if(e==null||typeof e!="object")return null;const t=e;return typeof t.task_id!="string"?null:{task_id:t.task_id}},sa=He.div`
1
+ import{j as A}from"./liveblocks-Bym0XjRt.js";import{a as u}from"./sentry-CoKtZcTW.js";import{u as H,k as J,j as C,h as me,g as Se,i as ye,l as De}from"./core-C9Jt3gNb.js";import{z as Z,d as Ee,P as I,aq as be,a6 as he,l as Ce,Q as Ge,e6 as Ae,p as F,a2 as Ie}from"./index-DmFy--fV.js";import{QI as Re,Rw as ve,fI as Be,a37 as ne,gQ as M,a38 as re,a32 as Le,Q_ as X,a39 as Ke,Rc as Y,QK as we,Qm as Ue,RI as ee,a3a as ae,gk as Pe,Rz as Fe,RE as je,Rr as xe,Rp as te,RF as $e,Rm as Oe,a3b as Ne,a3c as ze,a3d as Qe,a3e as Ze,a3f as R,dz as Me,dy as Ve,a3g as qe,QH as We}from"./zeni-epic-state-OTisIlmp.js";import{n as He}from"./mui-BsgiBiT9.js";import{u as Je}from"./useAskAiCfoHostNavButtonProps-CgHJ-iCU.js";import{M as Xe}from"./MobileAppDrawer-D4DOSbVQ.js";import{u as Ye}from"./useTaskManagerPusherEvents-CcIRdnMY.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b469e9c1-5efa-40a5-a078-88aa9c4e725e",e._sentryDebugIdIdentifier="sentry-dbid-b469e9c1-5efa-40a5-a078-88aa9c4e725e")}catch{}})();const _={TASK_CREATED:"task-created",TASK_UPDATED:"task-updated",TASK_SNOOZE_RESURFACED:"task-snooze-resurfaced",TASKS_BULK_UPDATED:"tasks-bulk-updated",TASKS_BULK_DELETED:"tasks-bulk-deleted"},ea=(e,t)=>e==null||e===""?[]:t.map((n=>`private-encrypted-${e}.${n}`)),aa=(e,t)=>e==null||e===""?[]:t.map((n=>`private-encrypted-${e}.${n}`)),j=e=>Array.isArray(e)&&e.every((t=>typeof t=="string")),oe=e=>typeof e.task_id=="string"?e.task_id:typeof e.id=="string"?e.id:null,ga=e=>{if(e==null||typeof e!="object")return null;const t=e,n=oe(t);if(n==null)return null;const c={task_id:n};return typeof t.parent_task_id=="string"&&(c.parent_task_id=t.parent_task_id),typeof t.sync_token=="string"&&(c.sync_token=t.sync_token),typeof t.is_deleted=="boolean"&&(c.is_deleted=t.is_deleted),typeof t.is_private=="boolean"&&(c.is_private=t.is_private),c},ta=e=>{if(e==null||typeof e!="object")return null;const t=e;return j(t.task_ids)?{task_ids:t.task_ids}:null},_a=e=>{if(e==null||typeof e!="object")return null;const t=e;return typeof t.task_id!="string"?null:{task_id:t.task_id}},sa=He.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as A}from"./liveblocks-BlNqAXG4.js";import{a as u}from"./sentry-oO1cMYl
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,na=be((function(e,t){const n=ne(e,t.isTaskTemplatesEnabled),{taskGroupId:c}=t,p=c!=null&&c!==""?{...n,taskGroupsWithTasksList:n.taskGroupsWithTasksList.map((a=>({...a,tasks:a.tasks.filter((s=>s.taskGroupIds.includes(c)))}))).filter((a=>a.tasks.length>0))}:n,y=Le(e),T=M.isZeniUser(),v=e.taskDetailState?.subTaskCreateStatus?.fetchState;return{taskListView:p,tagListView:y,localData:p.localData,isTaskTemplatesEnabled:t.isTaskTemplatesEnabled,isZeniUser:T,subTaskCreateStatus:v}}),(function(e,t){const{navigate:n,currentTenant:c,location:p,isTaskTemplatesEnabled:y}=t,{tenantEmailDomain:T}=c,{groupByKey:v}=t.uiState;return{onTaskManagementRowClick:a=>{const s=se(T,a),b=F(p.state?.pathnameStackToGoBack,p.pathname);n(s,{state:{pathnameStackToGoBack:b}})},onReloadTasks:()=>{e(V(!0,y))},onTabChange:a=>{e(Me(a))},onParentTaskClick:a=>{const s=se(T,a);window.open(s,"_blank","noopener")},bulkUpdateTasks:(a,s)=>{e(te(a,null,s))},onNewTaskClick:()=>{if(t.localData.defaultTaskGroupId!=null){const a=z(T,t.localData.defaultTaskGroupId),s=F(p.state?.pathnameStackToGoBack,p.pathname);n(a,{state:{pathnameStackToGoBack:s,message:"comingFromTaskListPage"}})}},onColumnSortConfigChanged:(a,s)=>{e(ae({uiState:{sortKey:a,sortOrder:s}}))},onFiltersChange:a=>{e(ze({filters:a}))},onSearchTextChanged:a=>{e(Qe({searchText:a}))},onReloadCards:()=>{e(V(!0,y))},onBackClick:()=>{if(p.state?.message==="triggerBackClick"){const a=Ie(p.state?.pathnameStackToGoBack),s=a.poppedPathname??"../";n(s,{state:{pathnameStackToGoBack:a.newStack}})}else n("../")},updateLocalData:a=>{e(Ne({localData:a}))},resetLocalData:()=>{e(re({taskGroupById:t.taskGroupState.taskGroupById}))},handleCreateGroup:a=>{e(Oe(t.localData.newTaskGroupName,a))},assignGroupToTasks:a=>{e(te(t.localData.selectedTaskIds,a,$e(t.uiState.groupByKey,a)))},onDeleteTaskGroup:a=>{e(xe(a))},onAddNewTaskToTaskGroup:a=>{if(t.localData.defaultTaskGroupId!=null){const s=oa(v,a);e(Y({taskDetailLocalData:s}));const b=z(T,t.uiState.groupByKey==="groupName"?a:t.localData.defaultTaskGroupId),x=F(p.state?.pathnameStackToGoBack,p.pathname);n(b,{state:{pathnameStackToGoBack:x,message:"comingFromTaskListPage"}})}},onDragNDrop:(a,s)=>{e(je(t.localData.selectedTaskIds.length>0?t.localData.selectedTaskIds:[a],s))},onTaskGroupRename:(a,s)=>{e(Fe(a,s))},onTimeSpentUpdate:(a,s)=>{e(ee({task:a,updates:s}))},onShowToast:a=>{e(Pe(a))},onGroupByFilterChange:a=>{e(ae({uiState:{groupByKey:a}}))},updateTask:(a,s)=>{e(ee({task:a,updates:s}))},onCreateTagClick:(a,s)=>{e(Ue(a,s))},onSubtaskCreation:(a,s)=>{e(we({...s,parentTaskId:a}))},handleGroupTemplateClick:a=>{e(J(a,[]))},handleGroupTemplateTaskClick:(a,s)=>{e(J(a,[s]))},handleNewTaskInitialization:a=>{if(e(Y({taskDetailLocalData:{...Ke,name:a}})),t.localData.defaultTaskGroupId!=null){const s=z(T,t.localData.defaultTaskGroupId),b=F(p.state?.pathnameStackToGoBack,p.pathname);n(s,{state:{pathnameStackToGoBack:b,message:"comingFromTaskListPage"}})}},onTaskGroupNameClick:a=>{n(`/${T}/tasks/group/${a}`)},onQuickResponsesClick:()=>{n(`/${T}/tasks/quick-responses`)}}}))(Ae);function ra(){const e=me(),t=H(),n=Se(),c=M.getSignedInUser(),p=M.isZeniUser(),y=X(),T=C((d=>Be(d))),{taskGroupId:v}=ye(),{useFeatureGate:a}=De(),{isFeatureEnabled:s}=a(I.isTaskTemplatesEnabled),{isFeatureEnabled:b}=a(I.isTaskCannedResponsesEnabled),{isFeatureEnabled:x}=a(I.isTaskCategorizationEnabled),{isFeatureEnabled:ie}=a(I.isTaskBulkResolutionEnabled),{isFeatureEnabled:le}=a(I.isTaskGroupAssigneesEnabled),{isFeatureEnabled:ue}=a(I.isTaskRecurringParentEnabled),[ce,de]=u.useState(!1),$=C((d=>ne(d,s))),O=C((d=>d.taskGroupState)),B=$.fetchState,{isAiCfoAccessEnabled:ke,onAskAiCfoClick:pe}=Xe({mobileExploreReferrer:"Task Checklist"});Ee({isDataReady:B==="Completed"});const{markBoardFetchInFlight:Z,requestTaskRefetch:N}=(function(d){const m=H(),r=X(),f=u.useRef(!1),o=u.useRef(!1),k=u.useRef(!1),g=u.useRef(),l=u.useRef(),S=u.useRef(!1),L=u.useRef(),K=u.useCallback((()=>{L.current=r.getState().taskListState.byTab.live,S.current=!0}),[r]),w=u.useCallback((()=>{K(),m(Re())}),[m,K]),D=u.useCallback((()=>{g.current=r.getState().taskGroupState.taskGroupById,k.current=!0,m(ve())}),[m,r]),E=u.useCallback((()=>{f.current=!1,l.current!=null&&(clearTimeout(l.current),l.current=void 0),w(),k.current||r.getState().taskGroupViewState.fetchState==="In-Progress"?o.current=!0:D()}),[w,D,r]),Q=u.useCallback((()=>{S.current?(f.current=!0,l.current==null&&(l.current=setTimeout((()=>{l.current=void 0,f.current&&r.getState().taskListState.fetchState!=="In-Progress"&&(S.current=!1,E())}),6e3))):E()}),[E,r]);u.useEffect((()=>{l.current!=null&&(clearTimeout(l.current),l.current=void 0),f.current=!1,o.current=!1,k.current=!1}),[d]);const h=C((i=>i.taskListState.fetchState)),G=C((i=>i.taskGroupViewState.fetchState)),U=C((i=>i.taskListState.byTab.live)),P=C((i=>i.taskGroupState.taskGroupById));return u.useEffect((()=>{h!=="In-Progress"&&(!S.current||U!==L.current||h==="Error")&&(S.current=!1,f.current&&(h!=="Completed"?h==="Error"&&(f.current=!1,l.current!=null&&(clearTimeout(l.current),l.current=void 0)):E()))}),[h,U,E]),u.useEffect((()=>{G!=="In-Progress"&&(!k.current||P!==g.current||G==="Error")&&(k.current=!1,o.current&&(o.current=!1,G!=="Error"&&D()))}),[G,P,D]),u.useEffect((()=>()=>{l.current!=null&&(clearTimeout(l.current),l.current=void 0)}),[]),{markBoardFetchInFlight:K,requestTaskRefetch:Q}})(T?.tenantId);u.useEffect((()=>{y.getState().taskListState.hasValidState()||Z(),t(V(!1,s))}),[T?.tenantId,t,s,Z,y]);const Te=u.useMemo((()=>{const d=[_.TASK_CREATED,_.TASK_UPDATED,_.TASKS_BULK_UPDATED,_.TASKS_BULK_DELETED],m=[_.TASK_CREATED,_.TASK_UPDATED,_.TASK_SNOOZE_RESURFACED,_.TASKS_BULK_UPDATED];return[...ea(T?.companyId,d),...aa(c?.userId,m)]}),[T?.companyId,c?.userId]);if(Je({events:Te,onEvent:(d,m)=>{switch(d){case _.TASK_CREATED:case _.TASK_UPDATED:{const r=(f=>{if(f==null||typeof f!="object")return null;const o=f,k=oe(o);if(k==null||typeof o.tenant_id!="string"||typeof o.event_type!="string")return null;const g={task_id:k,tenant_id:o.tenant_id,event_type:o.event_type};return typeof o.is_private=="boolean"&&(g.is_private=o.is_private),j(o.assignees)&&(g.assignees=o.assignees),j(o.direct_assignees)&&(g.direct_assignees=o.direct_assignees),typeof o.created_by=="string"&&(g.created_by=o.created_by),j(o.task_group_ids)&&(g.task_group_ids=o.task_group_ids),typeof o.name=="string"&&(g.name=o.name),typeof o.parent_task_id=="string"&&(g.parent_task_id=o.parent_task_id),g})(m);if(r!=null){const f=y.getState(),o=r.task_id,k=o!=null?f.taskState.taskByID?.[o]:void 0,g=k!=null;if(!p)if(r.is_private===!0){if(!g)return}else{const l=c?.userId,S=new Set([...r.assignees??[],...r.direct_assignees??[]]);if(r.created_by!=null&&r.created_by!==""&&S.add(r.created_by),!(l!=null&&S.has(l))&&!g)return}if(d===_.TASK_UPDATED&&g&&k!=null&&Array.isArray(r.task_group_ids)){const l=new Set(Object.values(f.taskGroupState.taskGroupById??{}).filter((i=>i!=null&&!i.isDeleted)).map((i=>i.id))),S=(k.taskGroupIds??[]).filter((i=>l.has(i))),L=(r.task_group_ids??[]).filter((i=>l.has(i))),K=S.length===L.length&&S.every((i=>L.includes(i))),w=k.taskGroupIds??[],D=r.task_group_ids??[],E=w.length!==D.length||!w.every((i=>D.includes(i))),Q=(i,fe)=>{const q=i??[],W=fe??[];if(q.length!==W.length)return!1;const ge=new Set(W);return q.every((_e=>ge.has(_e)))},h=r.name==null||r.name===k.name,G=r.is_private==null||r.is_private===k.isPrivate,U=r.assignees==null||Q(r.assignees,k.assignees),P=r.direct_assignees==null;if(K&&E&&h&&G&&U&&P)return}}return void N()}case _.TASKS_BULK_DELETED:{const r=ta(m);return r==null?void 0:void r.task_ids.forEach((f=>t(We(f))))}case _.TASKS_BULK_UPDATED:case _.TASK_SNOOZE_RESURFACED:return void N()}},onSubscribed:()=>{N()}}),u.useEffect((()=>{B==="Completed"&&t(re({taskGroupById:O.taskGroupById}))}),[B,O.taskGroupById]),c==null)throw Error("Can't access task list page without signing in...");return A.jsxs(A.Fragment,{children:[B==="Completed"?A.jsx(he,{analytics:Ce,onLoad:d=>(m=>m.trackPageLoaded(Ge.Event.taskListPage))(d)}):null,A.jsxs(sa,{children:[A.jsx(Ye,{isAppContentDrawerOpen:ce,handleDrawerToggle:d=>{de(d)}}),A.jsx(na,{location:n,navigate:e,currentTenant:T,taskGroupId:v,taskGroupState:O,localData:$.localData,uiState:$.uiState,isTaskTemplatesEnabled:s,taskListFetchState:B,isTaskCategorizationEnabled:x,isTaskCannedResponsesEnabled:b,isTaskBulkResolutionEnabled:ie,isTaskGroupAssigneesEnabled:le,isTaskRecurringParentEnabled:ue,isAiCfoAccessEnabled:ke,onAskAiCfoClick:pe})]})]})}const se=(e,t)=>`/${e}/tasks/${encodeURIComponent(t)}`,z=(e,t)=>`/${e}/tasks/new/${t}`,oa=(e,t)=>{if(e==="assignee"){const n=t.split(",");return{...R.taskDetailLocalData,assignee:n}}if(e==="priority"){const n=Ve(t);return{...R.taskDetailLocalData,priority:n}}if(e==="status"){const n=Ze(t);return{...R.taskDetailLocalData,status:n}}if(e==="tag"){const n=t.split(",");return{...R.taskDetailLocalData,tagIds:n}}if(e==="dueDate"){const n=qe(t);return{...R.taskDetailLocalData,dueDate:n}}return{...R.taskDetailLocalData}},ma=Object.freeze(Object.defineProperty({__proto__:null,default:ra},Symbol.toStringTag,{value:"Module"}));export{_ as T,aa as a,ea as b,_a as c,ta as d,ra as e,ma as f,ga as t};
9
+ `,na=De((function(e,t){const n=ne(e,t.isTaskTemplatesEnabled),{taskGroupId:c}=t,p=c!=null&&c!==""?{...n,taskGroupsWithTasksList:n.taskGroupsWithTasksList.map((a=>({...a,tasks:a.tasks.filter((s=>s.taskGroupIds.includes(c)))}))).filter((a=>a.tasks.length>0))}:n,y=Le(e),f=Z.isZeniUser(),v=e.taskDetailState?.subTaskCreateStatus?.fetchState;return{taskListView:p,tagListView:y,localData:p.localData,isTaskTemplatesEnabled:t.isTaskTemplatesEnabled,isZeniUser:f,subTaskCreateStatus:v}}),(function(e,t){const{navigate:n,currentTenant:c,location:p,isTaskTemplatesEnabled:y}=t,{tenantEmailDomain:f}=c,{groupByKey:v}=t.uiState;return{onTaskManagementRowClick:a=>{const s=se(f,a),D=F(p.state?.pathnameStackToGoBack,p.pathname);n(s,{state:{pathnameStackToGoBack:D}})},onReloadTasks:()=>{e(M(!0,y))},onTabChange:a=>{e(Ze(a))},onParentTaskClick:a=>{const s=se(f,a);window.open(s,"_blank","noopener")},bulkUpdateTasks:(a,s)=>{e(te(a,null,s))},onNewTaskClick:()=>{if(t.localData.defaultTaskGroupId!=null){const a=Q(f,t.localData.defaultTaskGroupId),s=F(p.state?.pathnameStackToGoBack,p.pathname);n(a,{state:{pathnameStackToGoBack:s,message:"comingFromTaskListPage"}})}},onColumnSortConfigChanged:(a,s)=>{e(ae({uiState:{sortKey:a,sortOrder:s}}))},onFiltersChange:a=>{e(Qe({filters:a}))},onSearchTextChanged:a=>{e(ze({searchText:a}))},onReloadCards:()=>{e(M(!0,y))},onBackClick:()=>{if(p.state?.message==="triggerBackClick"){const a=Ie(p.state?.pathnameStackToGoBack),s=a.poppedPathname??"../";n(s,{state:{pathnameStackToGoBack:a.newStack}})}else n("../")},updateLocalData:a=>{e(Ne({localData:a}))},resetLocalData:()=>{e(re({taskGroupById:t.taskGroupState.taskGroupById}))},handleCreateGroup:a=>{e(Oe(t.localData.newTaskGroupName,a))},assignGroupToTasks:a=>{e(te(t.localData.selectedTaskIds,a,$e(t.uiState.groupByKey,a)))},onDeleteTaskGroup:a=>{e(xe(a))},onAddNewTaskToTaskGroup:a=>{if(t.localData.defaultTaskGroupId!=null){const s=oa(v,a);e(X({taskDetailLocalData:s}));const D=Q(f,t.uiState.groupByKey==="groupName"?a:t.localData.defaultTaskGroupId),x=F(p.state?.pathnameStackToGoBack,p.pathname);n(D,{state:{pathnameStackToGoBack:x,message:"comingFromTaskListPage"}})}},onDragNDrop:(a,s)=>{e(je(t.localData.selectedTaskIds.length>0?t.localData.selectedTaskIds:[a],s))},onTaskGroupRename:(a,s)=>{e(Fe(a,s))},onTimeSpentUpdate:(a,s)=>{e(ee({task:a,updates:s}))},onShowToast:a=>{e(Pe(a))},onGroupByFilterChange:a=>{e(ae({uiState:{groupByKey:a}}))},updateTask:(a,s)=>{e(ee({task:a,updates:s}))},onCreateTagClick:(a,s)=>{e(Ue(a,s))},onSubtaskCreation:(a,s)=>{e(we({...s,parentTaskId:a}))},handleGroupTemplateClick:a=>{e(Y(a,[]))},handleGroupTemplateTaskClick:(a,s)=>{e(Y(a,[s]))},handleNewTaskInitialization:a=>{if(e(X({taskDetailLocalData:{...Ke,name:a}})),t.localData.defaultTaskGroupId!=null){const s=Q(f,t.localData.defaultTaskGroupId),D=F(p.state?.pathnameStackToGoBack,p.pathname);n(s,{state:{pathnameStackToGoBack:D,message:"comingFromTaskListPage"}})}},onTaskGroupNameClick:a=>{n(`/${f}/tasks/group/${a}`)},onQuickResponsesClick:()=>{n(`/${f}/tasks/quick-responses`)}}}))(Ae);function ra(){const e=me(),t=H(),n=Se(),c=Z.getSignedInUser(),p=Z.isZeniUser(),y=J(),f=C((d=>Be(d))),{taskGroupId:v}=ye(),{useFeatureGate:a}=Ee(),{isFeatureEnabled:s}=a(I.isTaskTemplatesEnabled),{isFeatureEnabled:D}=a(I.isTaskCannedResponsesEnabled),{isFeatureEnabled:x}=a(I.isTaskCategorizationEnabled),{isFeatureEnabled:ie}=a(I.isTaskBulkResolutionEnabled),{isFeatureEnabled:le}=a(I.isTaskGroupAssigneesEnabled),{isFeatureEnabled:ue}=a(I.isTaskRecurringParentEnabled),[ce,de]=u.useState(!1),$=C((d=>ne(d,s))),O=C((d=>d.taskGroupState)),B=$.fetchState,{isAiCfoAccessEnabled:ke,onAskAiCfoClick:pe}=Je({mobileExploreReferrer:"Task Checklist"});be({isDataReady:B==="Completed"});const{markBoardFetchInFlight:V,requestTaskRefetch:N}=(function(d){const m=H(),r=J(),T=u.useRef(!1),o=u.useRef(!1),k=u.useRef(!1),g=u.useRef(),l=u.useRef(),S=u.useRef(!1),L=u.useRef(),K=u.useCallback((()=>{L.current=r.getState().taskListState.byTab.live,S.current=!0}),[r]),w=u.useCallback((()=>{K(),m(Re())}),[m,K]),E=u.useCallback((()=>{g.current=r.getState().taskGroupState.taskGroupById,k.current=!0,m(ve())}),[m,r]),b=u.useCallback((()=>{T.current=!1,l.current!=null&&(clearTimeout(l.current),l.current=void 0),w(),k.current||r.getState().taskGroupViewState.fetchState==="In-Progress"?o.current=!0:E()}),[w,E,r]),z=u.useCallback((()=>{S.current?(T.current=!0,l.current==null&&(l.current=setTimeout((()=>{l.current=void 0,T.current&&r.getState().taskListState.fetchState!=="In-Progress"&&(S.current=!1,b())}),6e3))):b()}),[b,r]);u.useEffect((()=>{l.current!=null&&(clearTimeout(l.current),l.current=void 0),T.current=!1,o.current=!1,k.current=!1}),[d]);const h=C((i=>i.taskListState.fetchState)),G=C((i=>i.taskGroupViewState.fetchState)),U=C((i=>i.taskListState.byTab.live)),P=C((i=>i.taskGroupState.taskGroupById));return u.useEffect((()=>{h!=="In-Progress"&&(!S.current||U!==L.current||h==="Error")&&(S.current=!1,T.current&&(h!=="Completed"?h==="Error"&&(T.current=!1,l.current!=null&&(clearTimeout(l.current),l.current=void 0)):b()))}),[h,U,b]),u.useEffect((()=>{G!=="In-Progress"&&(!k.current||P!==g.current||G==="Error")&&(k.current=!1,o.current&&(o.current=!1,G!=="Error"&&E()))}),[G,P,E]),u.useEffect((()=>()=>{l.current!=null&&(clearTimeout(l.current),l.current=void 0)}),[]),{markBoardFetchInFlight:K,requestTaskRefetch:z}})(f?.tenantId);u.useEffect((()=>{y.getState().taskListState.hasValidState()||V(),t(M(!1,s))}),[f?.tenantId,t,s,V,y]);const fe=u.useMemo((()=>{const d=[_.TASK_CREATED,_.TASK_UPDATED,_.TASKS_BULK_UPDATED,_.TASKS_BULK_DELETED],m=[_.TASK_CREATED,_.TASK_UPDATED,_.TASK_SNOOZE_RESURFACED,_.TASKS_BULK_UPDATED];return[...ea(f?.companyId,d),...aa(c?.userId,m)]}),[f?.companyId,c?.userId]);if(Ye({events:fe,onEvent:(d,m)=>{switch(d){case _.TASK_CREATED:case _.TASK_UPDATED:{const r=(T=>{if(T==null||typeof T!="object")return null;const o=T,k=oe(o);if(k==null||typeof o.tenant_id!="string"||typeof o.event_type!="string")return null;const g={task_id:k,tenant_id:o.tenant_id,event_type:o.event_type};return typeof o.is_private=="boolean"&&(g.is_private=o.is_private),j(o.assignees)&&(g.assignees=o.assignees),j(o.direct_assignees)&&(g.direct_assignees=o.direct_assignees),typeof o.created_by=="string"&&(g.created_by=o.created_by),j(o.task_group_ids)&&(g.task_group_ids=o.task_group_ids),typeof o.name=="string"&&(g.name=o.name),typeof o.parent_task_id=="string"&&(g.parent_task_id=o.parent_task_id),g})(m);if(r!=null){const T=y.getState(),o=r.task_id,k=o!=null?T.taskState.taskByID?.[o]:void 0,g=k!=null;if(!p)if(r.is_private===!0){if(!g)return}else{const l=c?.userId,S=new Set([...r.assignees??[],...r.direct_assignees??[]]);if(r.created_by!=null&&r.created_by!==""&&S.add(r.created_by),!(l!=null&&S.has(l))&&!g)return}if(d===_.TASK_UPDATED&&g&&k!=null&&Array.isArray(r.task_group_ids)){const l=new Set(Object.values(T.taskGroupState.taskGroupById??{}).filter((i=>i!=null&&!i.isDeleted)).map((i=>i.id))),S=(k.taskGroupIds??[]).filter((i=>l.has(i))),L=(r.task_group_ids??[]).filter((i=>l.has(i))),K=S.length===L.length&&S.every((i=>L.includes(i))),w=k.taskGroupIds??[],E=r.task_group_ids??[],b=w.length!==E.length||!w.every((i=>E.includes(i))),z=(i,Te)=>{const q=i??[],W=Te??[];if(q.length!==W.length)return!1;const ge=new Set(W);return q.every((_e=>ge.has(_e)))},h=r.name==null||r.name===k.name,G=r.is_private==null||r.is_private===k.isPrivate,U=r.assignees==null||z(r.assignees,k.assignees),P=r.direct_assignees==null;if(K&&b&&h&&G&&U&&P)return}}return void N()}case _.TASKS_BULK_DELETED:{const r=ta(m);return r==null?void 0:void r.task_ids.forEach((T=>t(We(T))))}case _.TASKS_BULK_UPDATED:case _.TASK_SNOOZE_RESURFACED:return void N()}},onSubscribed:()=>{N()}}),u.useEffect((()=>{B==="Completed"&&t(re({taskGroupById:O.taskGroupById}))}),[B,O.taskGroupById]),c==null)throw Error("Can't access task list page without signing in...");return A.jsxs(A.Fragment,{children:[B==="Completed"?A.jsx(he,{analytics:Ce,onLoad:d=>(m=>m.trackPageLoaded(Ge.Event.taskListPage))(d)}):null,A.jsxs(sa,{children:[A.jsx(Xe,{isAppContentDrawerOpen:ce,handleDrawerToggle:d=>{de(d)}}),A.jsx(na,{location:n,navigate:e,currentTenant:f,taskGroupId:v,taskGroupState:O,localData:$.localData,uiState:$.uiState,isTaskTemplatesEnabled:s,taskListFetchState:B,isTaskCategorizationEnabled:x,isTaskCannedResponsesEnabled:D,isTaskBulkResolutionEnabled:ie,isTaskGroupAssigneesEnabled:le,isTaskRecurringParentEnabled:ue,isAiCfoAccessEnabled:ke,onAskAiCfoClick:pe})]})]})}const se=(e,t)=>`/${e}/tasks/${encodeURIComponent(t)}`,Q=(e,t)=>`/${e}/tasks/new/${t}`,oa=(e,t)=>{if(e==="assignee"){const n=t.split(",");return{...R.taskDetailLocalData,assignee:n}}if(e==="priority"){const n=Me(t);return{...R.taskDetailLocalData,priority:n}}if(e==="status"){const n=Ve(t);return{...R.taskDetailLocalData,status:n}}if(e==="tag"){const n=t.split(",");return{...R.taskDetailLocalData,tagIds:n}}if(e==="dueDate"){const n=qe(t);return{...R.taskDetailLocalData,dueDate:n}}return{...R.taskDetailLocalData}},ma=Object.freeze(Object.defineProperty({__proto__:null,default:ra},Symbol.toStringTag,{value:"Module"}));export{_ as T,aa as a,ea as b,_a as c,ta as d,ra as e,ma as f,ga as t};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-BlNqAXG4.js";import fe from"./NotFoundScreen-C9HgOUVr.js";import{a as u}from"./sentry-oO1cMYln.js";import{h as ee,u as ae,j as h,g as he,i as ge,N as Ee,l as be,n as De,o as g}from"./core-Dx-yNdOO.js";import{Qz as se,QC as Ie,Qw as Ce,a2J as Re,fI as te,a2K as ne,R1 as b,QQ as E,Qt as _e,Rw as ye,Rp as Ge,a2L as oe,gk as ie,a2M as W,a2N as Ae,Qp as Ue,Qm as ve,v2 as we,uS as xe,mD as Be,QO as je,a2O as Pe,RI as Fe,QK as Ke,Rb as Le,R8 as Ne,QF as Qe,R5 as $e,Q_ as Oe}from"./zeni-epic-state-DU8p9Pr6.js";import{z as D,e2 as Ze,k as ze,q as Me,$ as _,a2 as re,p as y,a6 as Ve,h as X,M as qe,e3 as Je,T as Y,ac as We}from"./index-BN_JNPW3.js";import{n as Xe}from"./mui-DicWBIpH.js";import{u as Ye}from"./useInitialThreadRequest-J-yGGXi5.js";import{M as He}from"./MobileAppDrawer-D9_9MdJz.js";import{T as m,t as ea,b as aa,a as sa,c as ta,d as H,e as na}from"./TaskListScreen-CfRSt11Z.js";import{u as oa}from"./useTaskManagerPusherEvents-C9HPPvD2.js";import"./recharts-DkhthbKK.js";import"./analytics-DOu6Ih_Z.js";import"./plaid-BW55_XuJ.js";import"./dnd-DfkYz8Zm.js";import"./stripe-cKAAJElX.js";import"./lottie-CICLPim-.js";import"./lexical-CeKyhyV8.js";import"./pdf-BwuxCG-0.js";import"./utils-vB0Nm3XK.js";import"./InboxNotificationsProvider-Db8GSYr5.js";import"./useTaskManagerAccess-Ces4QXd0.js";import"./useAskAiCfoHostNavButtonProps-BOks8lHg.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]="dc470ab5-5f00-4dad-96f2-cc328a3d657c",e._sentryDebugIdIdentifier="sentry-dbid-dc470ab5-5f00-4dad-96f2-cc328a3d657c")}catch{}})();function ia(){const e=ee(),a=ae(),n=D.getSignedInUser(),{cannedResponses:c,fetchState:t,saveFetchState:l}=h((i=>i.cannedResponsesState)),d=u.useCallback((()=>{a(se())}),[a]),S=u.useCallback(((i,I,C)=>{a(Ie({name:i,content:I,cannedResponseId:C}))}),[a]),s=u.useCallback((i=>{a(Ce({cannedResponseId:i}))}),[a]);if(n==null)throw Error("Can't access quick responses page without signing in...");return r.jsx(Ze,{cannedResponses:c,isLoading:t==="In-Progress"||t==="Not-Started",isSaving:l==="In-Progress",onBackClick:()=>e(-1),onDelete:s,onFetch:d,onSave:S})}const L=e=>e?.taskState?.taskByID,F=(e,a)=>{const n=L(e);if(a!=null&&n!=null)return n[a]?.parentTaskId??void 0},ra=Re([F,(e,a)=>{const n=F(e,a),c=L(e);if(n!=null&&c!=null)return c[n]?.name},(e,a)=>{const n=F(e,a),c=L(e);return n!=null&&c!=null&&c[n]!=null}],((e,a,n)=>{if(e!=null&&n===!0)return{id:e,name:a??""}})),ca=be((function(e,a){const{location:n,taskGroupId:c}=a,t=oe(e,a.taskId),l=te(e),d=ra(e,a.taskId),S=t.taskGroupId??c,s=S!=null?W(e.taskGroupState,S):void 0,i=D.getSignedInUser(),I=l.tenantId,C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:I??""},v=ne(e),{tenantEmailDomain:w}=l,G=t.recurringSourceTaskId,x=G!=null?`${Y.appUrl}/${w}/tasks/${encodeURIComponent(G)}`:void 0;return{taskDetailSelectorView:t,authParams:C,isZeniUser:D.isZeniUser(),userGroupList:Ae(e),isNewClicked:n.state?.message==="comingFromTaskListPage",filesEndPoint:We.fileMicroServiceBaseUrl,companyName:a.currentTenant.companyName,companyId:a.currentTenant.companyId,currentUrl:`${Y.appUrl}${a.location.pathname}`,cannedResponses:e.cannedResponsesState.cannedResponses,isCannedResponsesLoading:e.cannedResponsesState.fetchState==="In-Progress",recurringSourceTaskUrl:x,tagListView:v,taskGroupName:S!=null&&s!=null&&s.isDefault===!1?s.name:void 0,taskGroupList:e.taskGroupViewState.taskGroupsIds.map((T=>W(e.taskGroupState,T))).filter((T=>T!=null&&!T.isDeleted)).map((T=>({id:T.id,name:T.name,isDefault:T.isDefault}))),subtasks:t.subtasks,parentTaskRef:d,subTaskCreateStatus:e.taskDetailState?.subTaskCreateStatus?.fetchState}}),(function(e,a){const{taskId:n,navigate:c,currentTenant:t,location:l,taskGroupId:d}=a,{tenantEmailDomain:S}=t;return{onSaveChangesToLocalStore:s=>{e(Oe({taskDetailLocalData:s,taskId:n}))},onSaveDetailClick:s=>{e($e(n,s??d))},onArchiveTaskClick:()=>{a.taskId!=null&&e(Qe(a.taskId))},onSnoozeTask:(s,i)=>{e(Ne(s,i))},onUnsnoozeTask:s=>{e(Le(s))},onCreateSubtask:(s,i)=>{e(Ke({...i,parentTaskId:s}))},onSubtaskUpdate:(s,i)=>{e(Fe({task:s,updates:i}))},onShowToast:s=>{e(ie(s))},onSubtaskRowClick:s=>{c(`/${S}/tasks/${s}`,{state:{pathnameStackToGoBack:y(l.state?.pathnameStackToGoBack,l.pathname)}})},onParentBreadcrumbClick:s=>{c(`/${S}/tasks/${s}`,{state:{pathnameStackToGoBack:y(l.state?.pathnameStackToGoBack,l.pathname)}})},onDismissClick:()=>{if(l.state?.message==="triggerBackClick"){const s=re(l.state?.pathnameStackToGoBack),i=s.poppedPathname??"../../dashboard";c(i,{state:{pathnameStackToGoBack:s.newStack}})}else{const s=U(S),i=y(l.state?.pathnameStackToGoBack,l.pathname);c(s,{state:{pathnameStackToGoBack:i}})}e(Pe({taskId:n}))},onDeleteTaskClick:()=>{e(je(n))},updateFilesEntity:s=>{e(Be({files:s}))},onDeleteFile:s=>{e(xe(s))},onEditFileName:(s,i)=>{e(we(s,i.split(".")[0]))},onReloadTaskDetailPage:()=>{e(b(!1,n))},onCreateTagClick:s=>{e(ve(s,n))},onDeleteTagClick:s=>{e(Ue(s,n))},onFetchCannedResponses:()=>{e(se())},onManageTemplatesClick:()=>{c(`/${t.tenantEmailDomain}/tasks/quick-responses`)}}}))(Je);function K(){const e=ee(),a=ae(),n=he(),c=ze(),{taskId:t,taskGroupId:l}=ge(),d=h((o=>te(o))),S=Ye(d?.companyId),{useFeatureGate:s}=Me(),{isFeatureEnabled:i}=s(_.isTaskSnoozeEnabled),{isFeatureEnabled:I}=s(_.isTaskVisibilityEnabled),{isFeatureEnabled:C}=s(_.isTaskCannedResponsesEnabled),{isFeatureEnabled:v}=s(_.isTaskRecurringParentEnabled),{isFeatureEnabled:w}=s(_.isTaskGroupAssigneesEnabled),[G,x]=u.useState(!1),[T,ce]=u.useState(!1),[N,le]=u.useState(!1),[Q,B]=u.useState(!1),R=u.useRef(!1),A=h((o=>o.taskListState.updateTasksFetchState.fetchState)),$=h((o=>ne(o))),O=h((o=>o.taskGroupViewState.fetchState));u.useEffect((()=>{a(b(!1,t)),t!=null&&a(E(t))}),[a,t]);const Z=D.getSignedInUser()?.userId,de=D.isZeniUser(),ke=h((o=>t!=null?o.taskState.taskByID[t]?.syncToken:void 0)),z=()=>{d?.tenantEmailDomain!=null&&e(U(d.tenantEmailDomain))},M=()=>{a(ie({messageSection:"delete_task",messageText:"success",type:"success"})),z()},ue=u.useMemo((()=>{const o=[m.TASK_CREATED,m.TASK_UPDATED,m.TASKS_BULK_UPDATED,m.TASKS_BULK_DELETED],k=[...o,m.TASK_SNOOZE_RESURFACED];return[...aa(d?.companyId,o),...sa(Z,k)]}),[d?.companyId,Z]);oa({events:ue,onSubscribed:()=>{t!=null&&(a(b(!0,t)),a(E(t)))},onEvent:(o,k)=>{if(t!=null)switch(o){case m.TASK_CREATED:case m.TASK_UPDATED:{const p=((P,me,{isZeniUser:Se,storedSyncToken:Te,taskId:J})=>{if(P!==m.TASK_CREATED&&P!==m.TASK_UPDATED)return"none";const f=ea(me);return f==null?"none":f.parent_task_id===J?"refreshSubtasks":P!==m.TASK_UPDATED||f.task_id!==J?"none":f.is_deleted===!0?"leaveDeleted":f.is_private!==!0||Se?f.sync_token!=null&&f.sync_token===Te?"none":"refreshTask":"leaveNoAccess"})(o,k,{isZeniUser:de,storedSyncToken:ke,taskId:t});p==="refreshTask"?(a(b(!0,t)),a(E(t))):p==="refreshSubtasks"?a(E(t)):p==="leaveDeleted"?M():p==="leaveNoAccess"&&z();break}case m.TASKS_BULK_UPDATED:{const p=H(k);if(p==null)break;p.task_ids.includes(t)&&a(b(!0,t)),a(E(t));break}case m.TASKS_BULK_DELETED:{const p=H(k);if(p==null)break;if(p.task_ids.includes(t)){M();break}a(E(t));break}case m.TASK_SNOOZE_RESURFACED:{ta(k)?.task_id===t&&a(b(!0,t));break}}}}),u.useEffect((()=>{T||$.fetchState==="Completed"||(ce(!0),a(_e()))}),[T,a,$.fetchState]),u.useEffect((()=>{N||O==="Completed"||(le(!0),a(ye()))}),[N,a,O]);const pe=u.useCallback((()=>{t!=null&&(R.current=!1,a(Ge([t],null,{isArchived:!1})),B(!0))}),[a,t]);u.useEffect((()=>{if(Q)if(A!=="In-Progress"){if(R.current){if(A==="Error")return B(!1),void(R.current=!1);if(A==="Completed"){B(!1),R.current=!1;const{tenantEmailDomain:o}=d;if(n.state?.message==="triggerBackClick"){const k=re(n.state?.pathnameStackToGoBack);e(k.poppedPathname??"../../dashboard",{state:{pathnameStackToGoBack:k.newStack}})}else{const k=U(o);e(k,{state:{pathnameStackToGoBack:y(n.state?.pathnameStackToGoBack,n.pathname)}})}}}}else R.current=!0}),[Q,A,d,n,e]);const V=h((o=>oe(o,t))),j=V.fetchState,q=D.getSignedInUser();if(q==null)throw Error("Can't access task detail page without signing in...");if(j==="Error"&&V.error?.code===400){const{tenantEmailDomain:o}=d,k=U(o),p=y(n.state?.pathnameStackToGoBack,n.pathname);return r.jsx(Ee,{to:k,state:{pathnameStackToGoBack:p}})}return r.jsxs(r.Fragment,{children:[j==="Completed"?r.jsx(Ve,{analytics:X,onLoad:o=>(k=>k.trackPageLoaded(qe.Event.taskDetailPage))(o)}):null,r.jsxs(la,{children:[r.jsx(He,{isAppContentDrawerOpen:G,handleDrawerToggle:o=>{x(o)}}),r.jsx(ca,{analytics:X,currentTenant:d,handleZeniLogoClick:()=>{c.toggle()},initialOpenThreadRequest:S,location:n,loggedInUser:q,navigate:e,taskGroupId:l,taskId:t,taskDetailFetchState:j,onUnarchiveTaskClick:pe,isTaskSnoozeEnabled:i,isTaskVisibilityEnabled:I,isTaskCannedResponsesEnabled:C,isTaskRecurringParentEnabled:v,isTaskGroupAssigneesEnabled:w})]})]})}const la=Xe.div`
1
+ import{j as r}from"./liveblocks-Bym0XjRt.js";import fe from"./NotFoundScreen-D92eiixV.js";import{a as u}from"./sentry-CoKtZcTW.js";import{h as ee,u as ae,j as g,g as ge,i as he,N as Ee,l as be,n as De,o as h}from"./core-C9Jt3gNb.js";import{Qz as se,QC as Ie,Qw as Ce,a31 as Re,fI as te,a32 as ne,R1 as b,QQ as E,Qt as _e,Rw as ye,Rp as Ge,a33 as oe,gk as ie,a34 as W,a35 as Ae,Qp as Ue,Qm as ve,v2 as we,uS as xe,mD as Be,QO as Pe,a36 as je,RI as Fe,QK as Ke,Rb as Le,R8 as Qe,QF as $e,R5 as Ne,Q_ as Ze}from"./zeni-epic-state-OTisIlmp.js";import{z as D,e4 as ze,c as Oe,d as Ve,P as _,a2 as re,p as y,a6 as qe,l as X,Q as Me,e5 as Je,W as Y,ac as We}from"./index-DmFy--fV.js";import{n as Xe}from"./mui-BsgiBiT9.js";import{u as Ye}from"./useInitialThreadRequest-DA5FMzag.js";import{M as He}from"./MobileAppDrawer-D4DOSbVQ.js";import{T as m,t as ea,b as aa,a as sa,c as ta,d as H,e as na}from"./TaskListScreen-CW5lbYvD.js";import{u as oa}from"./useTaskManagerPusherEvents-CcIRdnMY.js";import"./recharts-GCccddBO.js";import"./analytics-DbFSqIth.js";import"./plaid-C8X6T_ms.js";import"./dnd-KhFMfpEU.js";import"./stripe-cKAAJElX.js";import"./lottie-CvA92JCl.js";import"./lexical-CpBrNOz8.js";import"./pdf-O569E9WB.js";import"./utils-CNqTTzSx.js";import"./InboxNotificationsProvider-Bz8aI0zf.js";import"./useTaskManagerAccess-CpacCRSq.js";import"./useAskAiCfoHostNavButtonProps-CgHJ-iCU.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]="7618ea3d-8add-4ddf-90a8-bd04fde04c03",e._sentryDebugIdIdentifier="sentry-dbid-7618ea3d-8add-4ddf-90a8-bd04fde04c03")}catch{}})();function ia(){const e=ee(),a=ae(),n=D.getSignedInUser(),{cannedResponses:c,fetchState:t,saveFetchState:l}=g((i=>i.cannedResponsesState)),d=u.useCallback((()=>{a(se())}),[a]),S=u.useCallback(((i,I,C)=>{a(Ie({name:i,content:I,cannedResponseId:C}))}),[a]),s=u.useCallback((i=>{a(Ce({cannedResponseId:i}))}),[a]);if(n==null)throw Error("Can't access quick responses page without signing in...");return r.jsx(ze,{cannedResponses:c,isLoading:t==="In-Progress"||t==="Not-Started",isSaving:l==="In-Progress",onBackClick:()=>e(-1),onDelete:s,onFetch:d,onSave:S})}const L=e=>e?.taskState?.taskByID,F=(e,a)=>{const n=L(e);if(a!=null&&n!=null)return n[a]?.parentTaskId??void 0},ra=Re([F,(e,a)=>{const n=F(e,a),c=L(e);if(n!=null&&c!=null)return c[n]?.name},(e,a)=>{const n=F(e,a),c=L(e);return n!=null&&c!=null&&c[n]!=null}],((e,a,n)=>{if(e!=null&&n===!0)return{id:e,name:a??""}})),ca=be((function(e,a){const{location:n,taskGroupId:c}=a,t=oe(e,a.taskId),l=te(e),d=ra(e,a.taskId),S=t.taskGroupId??c,s=S!=null?W(e.taskGroupState,S):void 0,i=D.getSignedInUser(),I=l.tenantId,C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:I??""},v=ne(e),{tenantEmailDomain:w}=l,G=t.recurringSourceTaskId,x=G!=null?`${Y.appUrl}/${w}/tasks/${encodeURIComponent(G)}`:void 0;return{taskDetailSelectorView:t,authParams:C,isZeniUser:D.isZeniUser(),userGroupList:Ae(e),isNewClicked:n.state?.message==="comingFromTaskListPage",filesEndPoint:We.fileMicroServiceBaseUrl,companyName:a.currentTenant.companyName,companyId:a.currentTenant.companyId,currentUrl:`${Y.appUrl}${a.location.pathname}`,cannedResponses:e.cannedResponsesState.cannedResponses,isCannedResponsesLoading:e.cannedResponsesState.fetchState==="In-Progress",recurringSourceTaskUrl:x,tagListView:v,taskGroupName:S!=null&&s!=null&&s.isDefault===!1?s.name:void 0,taskGroupList:e.taskGroupViewState.taskGroupsIds.map((T=>W(e.taskGroupState,T))).filter((T=>T!=null&&!T.isDeleted)).map((T=>({id:T.id,name:T.name,isDefault:T.isDefault}))),subtasks:t.subtasks,parentTaskRef:d,subTaskCreateStatus:e.taskDetailState?.subTaskCreateStatus?.fetchState}}),(function(e,a){const{taskId:n,navigate:c,currentTenant:t,location:l,taskGroupId:d}=a,{tenantEmailDomain:S}=t;return{onSaveChangesToLocalStore:s=>{e(Ze({taskDetailLocalData:s,taskId:n}))},onSaveDetailClick:s=>{e(Ne(n,s??d))},onArchiveTaskClick:()=>{a.taskId!=null&&e($e(a.taskId))},onSnoozeTask:(s,i)=>{e(Qe(s,i))},onUnsnoozeTask:s=>{e(Le(s))},onCreateSubtask:(s,i)=>{e(Ke({...i,parentTaskId:s}))},onSubtaskUpdate:(s,i)=>{e(Fe({task:s,updates:i}))},onShowToast:s=>{e(ie(s))},onSubtaskRowClick:s=>{c(`/${S}/tasks/${s}`,{state:{pathnameStackToGoBack:y(l.state?.pathnameStackToGoBack,l.pathname)}})},onParentBreadcrumbClick:s=>{c(`/${S}/tasks/${s}`,{state:{pathnameStackToGoBack:y(l.state?.pathnameStackToGoBack,l.pathname)}})},onDismissClick:()=>{if(l.state?.message==="triggerBackClick"){const s=re(l.state?.pathnameStackToGoBack),i=s.poppedPathname??"../../dashboard";c(i,{state:{pathnameStackToGoBack:s.newStack}})}else{const s=U(S),i=y(l.state?.pathnameStackToGoBack,l.pathname);c(s,{state:{pathnameStackToGoBack:i}})}e(je({taskId:n}))},onDeleteTaskClick:()=>{e(Pe(n))},updateFilesEntity:s=>{e(Be({files:s}))},onDeleteFile:s=>{e(xe(s))},onEditFileName:(s,i)=>{e(we(s,i.split(".")[0]))},onReloadTaskDetailPage:()=>{e(b(!1,n))},onCreateTagClick:s=>{e(ve(s,n))},onDeleteTagClick:s=>{e(Ue(s,n))},onFetchCannedResponses:()=>{e(se())},onManageTemplatesClick:()=>{c(`/${t.tenantEmailDomain}/tasks/quick-responses`)}}}))(Je);function K(){const e=ee(),a=ae(),n=ge(),c=Oe(),{taskId:t,taskGroupId:l}=he(),d=g((o=>te(o))),S=Ye(d?.companyId),{useFeatureGate:s}=Ve(),{isFeatureEnabled:i}=s(_.isTaskSnoozeEnabled),{isFeatureEnabled:I}=s(_.isTaskVisibilityEnabled),{isFeatureEnabled:C}=s(_.isTaskCannedResponsesEnabled),{isFeatureEnabled:v}=s(_.isTaskRecurringParentEnabled),{isFeatureEnabled:w}=s(_.isTaskGroupAssigneesEnabled),[G,x]=u.useState(!1),[T,ce]=u.useState(!1),[Q,le]=u.useState(!1),[$,B]=u.useState(!1),R=u.useRef(!1),A=g((o=>o.taskListState.updateTasksFetchState.fetchState)),N=g((o=>ne(o))),Z=g((o=>o.taskGroupViewState.fetchState));u.useEffect((()=>{a(b(!1,t)),t!=null&&a(E(t))}),[a,t]);const z=D.getSignedInUser()?.userId,de=D.isZeniUser(),ke=g((o=>t!=null?o.taskState.taskByID[t]?.syncToken:void 0)),O=()=>{d?.tenantEmailDomain!=null&&e(U(d.tenantEmailDomain))},V=()=>{a(ie({messageSection:"delete_task",messageText:"success",type:"success"})),O()},ue=u.useMemo((()=>{const o=[m.TASK_CREATED,m.TASK_UPDATED,m.TASKS_BULK_UPDATED,m.TASKS_BULK_DELETED],k=[...o,m.TASK_SNOOZE_RESURFACED];return[...aa(d?.companyId,o),...sa(z,k)]}),[d?.companyId,z]);oa({events:ue,onSubscribed:()=>{t!=null&&(a(b(!0,t)),a(E(t)))},onEvent:(o,k)=>{if(t!=null)switch(o){case m.TASK_CREATED:case m.TASK_UPDATED:{const p=((j,me,{isZeniUser:Se,storedSyncToken:Te,taskId:J})=>{if(j!==m.TASK_CREATED&&j!==m.TASK_UPDATED)return"none";const f=ea(me);return f==null?"none":f.parent_task_id===J?"refreshSubtasks":j!==m.TASK_UPDATED||f.task_id!==J?"none":f.is_deleted===!0?"leaveDeleted":f.is_private!==!0||Se?f.sync_token!=null&&f.sync_token===Te?"none":"refreshTask":"leaveNoAccess"})(o,k,{isZeniUser:de,storedSyncToken:ke,taskId:t});p==="refreshTask"?(a(b(!0,t)),a(E(t))):p==="refreshSubtasks"?a(E(t)):p==="leaveDeleted"?V():p==="leaveNoAccess"&&O();break}case m.TASKS_BULK_UPDATED:{const p=H(k);if(p==null)break;p.task_ids.includes(t)&&a(b(!0,t)),a(E(t));break}case m.TASKS_BULK_DELETED:{const p=H(k);if(p==null)break;if(p.task_ids.includes(t)){V();break}a(E(t));break}case m.TASK_SNOOZE_RESURFACED:{ta(k)?.task_id===t&&a(b(!0,t));break}}}}),u.useEffect((()=>{T||N.fetchState==="Completed"||(ce(!0),a(_e()))}),[T,a,N.fetchState]),u.useEffect((()=>{Q||Z==="Completed"||(le(!0),a(ye()))}),[Q,a,Z]);const pe=u.useCallback((()=>{t!=null&&(R.current=!1,a(Ge([t],null,{isArchived:!1})),B(!0))}),[a,t]);u.useEffect((()=>{if($)if(A!=="In-Progress"){if(R.current){if(A==="Error")return B(!1),void(R.current=!1);if(A==="Completed"){B(!1),R.current=!1;const{tenantEmailDomain:o}=d;if(n.state?.message==="triggerBackClick"){const k=re(n.state?.pathnameStackToGoBack);e(k.poppedPathname??"../../dashboard",{state:{pathnameStackToGoBack:k.newStack}})}else{const k=U(o);e(k,{state:{pathnameStackToGoBack:y(n.state?.pathnameStackToGoBack,n.pathname)}})}}}}else R.current=!0}),[$,A,d,n,e]);const q=g((o=>oe(o,t))),P=q.fetchState,M=D.getSignedInUser();if(M==null)throw Error("Can't access task detail page without signing in...");if(P==="Error"&&q.error?.code===400){const{tenantEmailDomain:o}=d,k=U(o),p=y(n.state?.pathnameStackToGoBack,n.pathname);return r.jsx(Ee,{to:k,state:{pathnameStackToGoBack:p}})}return r.jsxs(r.Fragment,{children:[P==="Completed"?r.jsx(qe,{analytics:X,onLoad:o=>(k=>k.trackPageLoaded(Me.Event.taskDetailPage))(o)}):null,r.jsxs(la,{children:[r.jsx(He,{isAppContentDrawerOpen:G,handleDrawerToggle:o=>{x(o)}}),r.jsx(ca,{analytics:X,currentTenant:d,handleZeniLogoClick:()=>{c.toggle()},initialOpenThreadRequest:S,location:n,loggedInUser:M,navigate:e,taskGroupId:l,taskId:t,taskDetailFetchState:P,onUnarchiveTaskClick:pe,isTaskSnoozeEnabled:i,isTaskVisibilityEnabled:I,isTaskCannedResponsesEnabled:C,isTaskRecurringParentEnabled:v,isTaskGroupAssigneesEnabled:w})]})]})}const la=Xe.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as r}from"./liveblocks-BlNqAXG4.js";import fe from"./NotFoundScreen-C9H
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,U=e=>`/${e}/tasks`;function xa(){return r.jsxs(De,{children:[r.jsx(g,{path:"/new",element:r.jsx(K,{})}),r.jsx(g,{path:"/new/:taskGroupId",element:r.jsx(K,{})}),r.jsx(g,{path:"/group/:taskGroupId",element:r.jsx(na,{})}),r.jsx(g,{path:"/quick-responses",element:r.jsx(ia,{})}),r.jsx(g,{path:"/:taskId",element:r.jsx(K,{})}),r.jsx(g,{path:"*",element:r.jsx(fe,{})})]})}export{xa as default};
9
+ `,U=e=>`/${e}/tasks`;function xa(){return r.jsxs(De,{children:[r.jsx(h,{path:"/new",element:r.jsx(K,{})}),r.jsx(h,{path:"/new/:taskGroupId",element:r.jsx(K,{})}),r.jsx(h,{path:"/group/:taskGroupId",element:r.jsx(na,{})}),r.jsx(h,{path:"/quick-responses",element:r.jsx(ia,{})}),r.jsx(h,{path:"/:taskId",element:r.jsx(K,{})}),r.jsx(h,{path:"*",element:r.jsx(fe,{})})]})}export{xa as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-Bym0XjRt.js";import P from"./NotFoundScreen-D92eiixV.js";import{a as n}from"./sentry-CoKtZcTW.js";import{u as le,h as ue,g as me,i as pe,j as o,n as fe,o as p}from"./core-C9Jt3gNb.js";import{fI as ye,gZ as be,m3 as Ie,uh as Se,XI as he,XD as je,XJ as Ce,S1 as ge,S2 as Te,i3 as Ee,m1 as Le,ui as ve,RT as xe,Ss as De,XK as ke,XL as Ae,R_ as Me,RX as Xe,XM as we,XN as Fe,XO as Ne}from"./zeni-epic-state-OTisIlmp.js";import{d as Re,V as _e,P as _,b0 as qe,z as ze,g as Pe,l as q,b1 as Ue,ac as He,G as Ge}from"./index-DmFy--fV.js";import"./mui-BsgiBiT9.js";import{d as Oe}from"./decodeURIComponentSafe-Cr8jQXNX.js";import{u as Ve}from"./useEnsureVendorListLoaded-YOFp3iHN.js";import{u as $e,T as h}from"./TransactionDetailScreen-B1no9UdL.js";import{c as Be}from"./routePaths-DQh6iYo4.js";import"./recharts-GCccddBO.js";import"./analytics-DbFSqIth.js";import"./plaid-C8X6T_ms.js";import"./dnd-KhFMfpEU.js";import"./stripe-cKAAJElX.js";import"./lottie-CvA92JCl.js";import"./lexical-CpBrNOz8.js";import"./pdf-O569E9WB.js";import"./utils-CNqTTzSx.js";import"./useAskAiCfoHostNavButtonProps-CgHJ-iCU.js";import"./useInitialThreadRequest-DA5FMzag.js";import"./expenseAutomationHelper-D-1MzDTJ.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]="bb5a372a-63a8-4d76-8a4a-d481c50c704f",t._sentryDebugIdIdentifier="sentry-dbid-bb5a372a-63a8-4d76-8a4a-d481c50c704f")}catch{}})();const{common:{currency:z}}=Ge.getLocalizedStrings();function Je(){const t=le(),i=ue(),y=me(),{tenantEmailDomain:l,transactionTypeEncoded:U}=pe(),{useFeatureGate:j}=Re(),H=_e(),{isFeatureEnabled:G}=j(_.isCreateTransactionEnabled),{isFeatureEnabled:C}=j(_.isProjectsTransactionsEnabled),O=Oe(U??""),a=Ne.find((e=>e===O)),b=o((e=>ye(e))),g=qe(b.companyId,a),T=o((e=>be(e.companyState,b.companyId)?.company.companyLocaleInfo)),V=T?.currencyCode??z.currencyCode,$=T?.currencySymbol??z.currencySymbol,E=o((e=>e.tenantState.currentTenantId)),L=ze.getSignedInUser(),v=L?.userId??"",x=L?.zeniSessionId??"",B=n.useMemo((()=>({userId:v,sessionId:x,tenantId:E??""})),[v,x,E]),J=o((e=>Ie(e))),D=o((e=>Se(e))),k=D&&C===!0,I=o((e=>e.projectListState)),A=o((e=>e.projectState)),K=n.useMemo((()=>he(A,I).projects),[A,I]),S=o((e=>je(e,"common"))),M=o((e=>e.accountListState.byReportId.accountList.fetchState)),X=o((e=>e.classListState.fetchState)),r=o((e=>a!=null?Ce(e,a):void 0));n.useEffect((()=>{if(a!=null)return t(ge(a)),()=>{t(Te(a))}}),[t,a]);const Z=Pe(),Q=o((e=>{const{activeTenantFetchState:c,currentTenantId:R,fetchState:ie,tenantsById:de}=e.tenantState;return R!=null&&de[R]!=null&&(c.fetchState==="Completed"||ie==="Completed")})),d=Z&&Q;n.useEffect((()=>{d&&M==="Not-Started"&&t(Ee("accountList"))}),[t,d,M]),n.useEffect((()=>{d&&X==="Not-Started"&&t(Le())}),[t,d,X]);const w=I.fetchState;n.useEffect((()=>{d&&k&&w==="Not-Started"&&t(ve())}),[t,d,k,w]),Ve(d),$e(d&&a==="transfer",!1);const W=n.useCallback(((e,c=[])=>{c.length>0&&t(xe(c)),l!=null&&i(Be(e,l))}),[t,l,i]),Y=n.useCallback((()=>{y.key==="default"?l!=null&&i(`/${l}/month_end_close_checks/review/transaction_categorization`):i(-1)}),[y.key,i,l]),ee=n.useCallback((e=>{t(De(e))}),[t]),F=n.useRef(void 0),m=r?.createStatus.error;n.useEffect((()=>{if(a==null||m==null)return;const e=`${m.code??""}-${m.message??""}`;F.current!==e&&(F.current=e,q.trackCreateTransactionFailed({transactionType:a,errorCode:m.code}))}),[m,a]);const f=n.useCallback((e=>e),[]),u=n.useMemo((()=>(r?.vendorList??[]).filter((e=>!e.isDeleted)).sort(((e,c)=>e.name.localeCompare(c.name)))),[r?.vendorList]),N=r?.localData.vendorId,te=n.useMemo((()=>{const e=u.find((c=>c.id===N));if(e!=null)return e.qboId!==""&&e.qboId!==e.name?e.qboId:e.name}),[u,N]),ae=o((e=>ke(e,te))),ne=n.useMemo((()=>f(u.map((e=>({id:e.id,label:e.name}))))),[u,f]),oe=n.useMemo((()=>({...S,vendor:[...u.map((e=>({id:e.id,name:e.name,qboId:e.qboId,type:"vendor",zeniId:e.id}))),...S.vendor]})),[S,u]),se=n.useMemo((()=>f((r?.transferAccountsList??[]).map((e=>({id:e.accountId,label:e.accountName}))))),[r?.transferAccountsList,f]),re=n.useCallback((e=>{a!=null&&t(Ae(a,e))}),[t,a]),ce=n.useCallback(((e,c)=>{a!=null&&t(Me(a,c,e))}),[t,a]);return g==null?null:a!=null&&r!=null&&G===!0&&g&&H?.connectionName!=="netsuite"?s.jsx(Ue,{analytics:q,attachmentUploadEndpoint:He.accountMicroServiceBaseUrl,authParams:B,createdTransactionId:r.createdTransactionId,transactionType:a,localData:r.localData,createStatus:r.createStatus,accountsHierarchyList:r.accountListNestedAccountHierarchy,classHierarchyList:r.classListNestedAccountHierarchy,vendorOptions:ne,transferAccountOptions:se,isAccountingClassesEnabled:J,isAccountingProjectsEnabled:D,isProjectsTransactionsEnabled:C===!0,projects:K,currencyCode:V,currencySymbol:$,bookCloseDate:b.bookCloseDate?.toDate(),entityAutoCompleteView:oe,vendorRecommendationFetchState:ae.fetchState,onUpdateLocalData:re,onAddLine:()=>t(Fe(a)),onRemoveLine:e=>t(we(a,e)),onSubmit:()=>t(Xe(a)),onCancel:Y,onCreateTransactionComplete:W,onUploadAttachmentAttachment:ee,onFetchRecommendationsForVendor:ce}):s.jsx(P,{})}function St(){return s.jsxs(fe,{children:[s.jsx(p,{path:"/new/:transactionTypeEncoded",element:s.jsx(Je,{})}),s.jsx(p,{path:"/:transactionTypeEncoded/:transactionId",element:s.jsx(h,{})}),s.jsx(p,{path:"/:transactionTypeEncoded/:transactionId/page-not-found",element:s.jsx(P,{})}),s.jsx(p,{path:"/:transactionTypeEncoded/:transactionId/vendor/create",element:s.jsx(h,{})}),s.jsx(p,{path:"/*",element:s.jsx(h,{})})]})}export{St as default};
@@ -0,0 +1,5 @@
1
+ import{j as _}from"./liveblocks-Bym0XjRt.js";import{a as i}from"./sentry-CoKtZcTW.js";import{u as M,k as ot,j as g,s as ge,g as ke,h as Ce,i as Ae,N as st,l as ct}from"./core-C9Jt3gNb.js";import{pz as Ie,fI as K,gZ as it,Vu as rt,oF as lt,of as dt,E0 as se,XP as ut,gk as mt,bn as pt,dh as _e,bq as Pe,sZ as W,WA as q,XQ as Re,XR as le,W_ as we,me as Fe,XS as Ue,X3 as de,X4 as ue,n3 as xe,S_ as me,XE as $,m8 as Ve,m6 as Le,mi as ft,pm as St,XT as ht,XU as yt,DT as Q,md as Be,Sj as Oe,co as Tt,dn as bt,XV as gt,XD as It,XW as vt,XX as Et,XY as Dt,XZ as kt,DP as Ct,X_ as At,X$ as _t,Y0 as Pt,Y1 as Rt,Y2 as wt,mh as Ft,Y3 as Ut,Y4 as xt,XF as Vt,Y5 as Lt,Y6 as Bt,Y7 as Ot,Sd as Nt,S3 as zt,Ss as jt,mj as Mt,S$ as ve,pr as Xt}from"./zeni-epic-state-OTisIlmp.js";import{d as H,P as R,l as G,b2 as $t,z as Ne,$ as Gt,b3 as Yt,a9 as Wt,a2 as ce,V as qt,b4 as Ht,p as ie,aq as Zt,b5 as Qt,b6 as Jt,b7 as Kt,ac as en,at as oe}from"./index-DmFy--fV.js";import{n as tn,S as nn,u as an,D as on}from"./mui-BsgiBiT9.js";import{u as sn}from"./useAskAiCfoHostNavButtonProps-CgHJ-iCU.js";import{d as ze}from"./decodeURIComponentSafe-Cr8jQXNX.js";import{u as cn}from"./useInitialThreadRequest-DA5FMzag.js";import{h as je,c as Me,g as rn,e as ln}from"./routePaths-DQh6iYo4.js";import{u as dn}from"./expenseAutomationHelper-D-1MzDTJ.js";import{A as un}from"./utils-CNqTTzSx.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e29e2c81-d834-4451-b347-555f61b999d6",t._sentryDebugIdIdentifier="sentry-dbid-e29e2c81-d834-4451-b347-555f61b999d6")}catch{}})();function mn(t=!0,e=!0){const o=M(),n=ot(),{useFeatureGate:a}=H(),{isFeatureEnabled:s}=a(R.isCreateTransferEntryFromExpenseEnabled);i.useEffect((()=>{if(!t||e&&s!==!0)return;const c=d=>{const S=n.getState().createTransferEntryState.transferAccountsByType[d].fetchState;return S!=="In-Progress"&&S!=="Completed"};c("transferEntryEligible")&&o(Ie({kind:"transferEntryEligible"})),c("creditCardOnlyEligible")&&o(Ie({kind:"creditCardOnlyEligible"}))}),[t,e,s,o,n])}function pn(t,e){const o=(function(){const d=M(),[S,h]=i.useState(!1),[k,p]=i.useState(null),[l,u]=i.useState(null),{useDynamicConfig:y}=H(),{configValue:v,isDynamicConfigLoading:f}=y("transaction_categorization_config"),T=!f&&v?.capitalization_enabled===!0,D=g((I=>K(I))),C=D.companyId,w=g((I=>it(I.companyState,D.companyId)?.company.companyLocaleInfo?.currencySymbol??"$")),{capitalizableAccounts:A,capitalizableAccountOverrides:F,dismissedAccounts:U}=g((I=>{const b=I.tenantState.currentTenantId,P=b!=null?I.tenantState.tenantsById[b]:void 0;return{capitalizableAccounts:P?.capitalizableAccounts??null,capitalizableAccountOverrides:P?.capitalizableAccountOverrides??null,dismissedAccounts:P?.capitalizationOnboardingDismissedAccounts??null}}),ge),L=i.useRef(A);L.current=A;const x=i.useRef(F);x.current=F;const B=i.useRef(U);B.current=U;const O=g((I=>rt(I.accountState)),ge),X=i.useMemo((()=>{const I={};for(const b of O)b.accountId!=null&&b.accountName!=null&&(I[b.accountId]=b.accountName);return I}),[O]),Y=l!=null?X[l]??null:null,N=i.useCallback((I=>{if(!T)return;const b=L.current;if(b==null)return;const P=b.accounts??[],Z=new Set(I),ee=x.current??{},te=B.current;for(const z of P)if(Z.has(z.accountId)&&ee[z.accountId]==null&&te?.[z.accountId]==null)return p(z.classificationType),u(z.accountId),void h(!0)}),[T]),E=i.useCallback(((I,b)=>{d(lt(C,I,b,!0)),h(!1),p(null),u(null)}),[d,C]),r=i.useCallback((()=>{l!=null&&(d(dt(C,l)),h(!1),p(null),u(null))}),[d,C,l]);return{showPopup:S&&T,popupType:k,popupAccountId:l,popupAccountName:Y,currencySymbol:w,checkAndShowPopup:N,handleSubmit:E,handleDismiss:r}})(),n=i.useRef(void 0),a=i.useRef([]),s=i.useRef(o.checkAndShowPopup);s.current=o.checkAndShowPopup;const c=i.useRef(e);return c.current=e,i.useEffect((()=>{t==="In-Progress"&&(a.current=c.current()),t==="Completed"&&n.current==="In-Progress"&&a.current.length>0&&(s.current(a.current),a.current=[]),n.current=t}),[t]),o}const j=new Map,Ee=(t,e,o)=>`${t}|${e??""}|${o}`,J=(t,e)=>{const[o,n]=t.shownRecommendations;return{recommendationFor:t.dimension,recommendation:o?.name??"",recommendationSource:o?.engine??null,recommendationConfidencePercentage:o?.confidencePercentage??null,alternativeRecommendation:n?.name??null,alternativeRecommendationSource:n?.engine??null,alternativeRecommendationConfidencePercentage:n?.confidencePercentage??null,selectedValue:t.selected.name,numberOfRecommendations:t.shownRecommendations.length,transactionId:e,lineId:t.lineId??null}},re=(t,e,o)=>({transactionId:e,lineId:t.lineId,dimension:t.dimension,outcome:t.outcome,selected:{name:t.selected.name,id:t.selected.id},matchedSource:t.matchedSource,matchedRank:t.matchedRank,topPickSource:t.topPickSource,shownRecommendations:t.shownRecommendations.map((n=>({source:n.source,rank:n.rank,value:{name:n.name,id:n.id},confidence:n.confidencePercentage!=null?n.confidencePercentage/100:void 0}))),...o}),Xe=(t,e,o)=>{G.trackRecommendationFeedbackRetracted(J(e,o)),t(se(re(e,o,{outcome:"retracted"})))},Ln=(t,e)=>{const o=new Set(e.map(String));j.forEach(((n,a)=>{o.has(n.transactionId)&&(j.delete(a),Xe(t,n.feedback,n.transactionId))}))},Bn=t=>{const e=new Set(t.map(String));j.forEach(((o,n)=>{e.has(o.transactionId)&&j.delete(n)}))};function fn(t){const e=M(),[o,n]=i.useState(null),[a,s]=i.useState(!1),{fetchState:c}=g(ut),{isEnabled:d,fallbackTransactionId:S}=t,h=i.useCallback((u=>u.transactionId??S??""),[S]),k=i.useCallback((u=>{if(!d)return;const y=h(u);if(y==="")return;if(u.outcome!=="accepted")return void n(u);((f,T,D,C)=>{const w=Ee(T,D,C),A=j.get(w);return A!=null&&(j.delete(w),Xe(f,A.feedback,A.transactionId),!0)})(e,y,u.lineId,u.dimension)||(((f,T)=>{G.trackRecommendationAccepted(J(f,T))})(u,y),e(se(re(u,y,{}))))}),[d,h,e]),p=i.useCallback((u=>{if(o==null)return;const y=h(o);((v,f,T)=>{G.trackRecommendationFeedbackSubmitted({...J(v,f),feedbackReason:T})})(o,y,u),e(se(re(o,y,{reasonText:u,skipped:!1}))),((v,f)=>{j.set(Ee(f,v.lineId,v.dimension),{feedback:v,transactionId:f})})(o,y),s(!0)}),[o,h,e]),l=i.useCallback((()=>{var u,y;o!=null&&(u=o,y=h(o),G.trackRecommendationFeedbackSkipped(J(u,y)),s(!1),n(null))}),[o,h]);return i.useEffect((()=>{if(!a||c!=="Completed"&&c!=="Error")return;s(!1),n(null);const u=c==="Completed";e(mt({messageSection:"recommendation_feedback",messageText:u?"success":"failed",type:u?"success":"error",showStatusIcon:!0}))}),[a,c,e]),{onRecommendationSelection:k,popup:o!=null?_.jsx($t,{feedback:o,submitState:a?c:"Not-Started",onSubmit:p,onSkip:l}):null}}const pe=()=>{const t=Ne.getSignedInUser(),{useFeatureGate:e}=H(),{isFeatureEnabled:o}=e(R.isChainOfThoughtEnabled);return i.useMemo((()=>pt(t)&&o),[t,o])};function $e(t){if(t!=null){if("customer"in t&&t.customer!=null){const{customer:e}=t;return{id:e.id,name:e.name,logo:e.logo,type:"customer",zeniId:e.id,qboId:e.id}}if("vendor"in t&&t.vendor!=null){const{vendor:e}=t;return{id:e.id,name:e.name,logo:e.logo,type:"vendor",zeniId:e.id,qboId:e.id}}}}function On(t,e){const o=M(),{useFeatureGate:n}=H(),a=g((r=>K(r))),s=a.userRole.includes("charge_card_user")||a.userRole.includes("charge_card_admin"),c=a.userRole!=null&&_e(a.userRole),d=a.userRole!=null&&Pe(a.userRole),{isFeatureEnabled:S}=n(R.isVendorBulkUpdateOnTransactionEnabled),{isFeatureEnabled:h}=n(R.isExpenseAutomationEnabled),k=pe(),p=i.useMemo((()=>({id:t,type:W(e)})),[t,e]),l=g((r=>q(r,p))),u=l?.transactionDetailUpdateStatus?.fetchState,y=l?.transactionDetailLocalData?.lineItemById,v=g((r=>{const I=q(r,p)?.transactionDetailLocalData.vendorUpdates?.id;return I==null?"Not-Started":r.transactionVendorViewState.editVendorStateById[I]?.saveStatus.fetchState??"Not-Started"})),f=i.useMemo((()=>l?.fetchState==="Completed"?$e(l?.transaction):void 0),[l?.fetchState,l?.transaction]),T=g((r=>{if(f!=null)return Re(r.customerIncomeState,r.vendorExpenseState,r.trendState,f,"month")})),D=g((r=>le(r))),C=g((r=>{if(f!=null)return we(r.trendWithTransactionsState,f,"TransactionDetail")})),w=a.company?.companyInfo.firstMonthOfFY??1,A=g((r=>Fe(r.accountState,r.accountListState,"accountList"))),[F,U]=i.useState(!1),[L,x]=i.useState(!1),[B,O]=i.useState(!1);i.useEffect((()=>{U(!1),x(!1),O(!1)}),[t,e]);const X=i.useCallback((()=>{U(!1),x(!1)}),[]),[Y,N]=i.useState(!1),E=C?.selectedPeriod?.timePeriod;return i.useEffect((()=>{B||l==null||l.transaction==null||(o(Ue({id:l.transaction.id,type:l.transaction.type})),O(!0)),f!=null&&(!s||c&&d===!1)&&(F?L||T==null||(x(!0),o(me(f,"TransactionDetail",{timeframe:"month",timePeriod:E??T}))):(o(de()),o(ue()),U(!0),o(xe(f))))}),[o,B,l?.fetchState,l?.transaction,f,s,c,d,F,L,T,E]),i.useEffect((()=>{D.newVendorState?.vendorDetailLocalData?.vendorName!=null?N(!0):N(!1)}),[D.newVendorState?.vendorDetailLocalData?.vendorName]),i.useEffect((()=>()=>{o($("common"))}),[o]),{currentTenant:a,loggedInUserHasCardUserOrAdminRole:s,isUserHasDashboardAccess:c,isUserHasInvestorOrBankerAccess:d,isVendorBulkUpdateOnTransactionEnabled:S,isExpenseAutomationEnabled:h,isChainOfThoughtEnabled:k,selectedTransaction:p,transactionDetail:l,rawDetailSaveStatus:u,rawDetailLineItemById:y,vendorSaveStatus:v,tranEntity:f,defaultTrendTransactionTimePeriod:T,vendorViewDetails:D,uiState:C,firstMonthOfFY:w,uncategorizedAccounts:A,resetTrendIsFetchedStates:X,isCreateVendorDrawerOpen:Y,setIsCreateVendorDrawerOpen:N}}const Sn={overlayWidth:new Wt(100,100,58)},hn=({isOpen:t,onSaveVendor:e,onSaveSuccess:o,onCancel:n,vendorViewDetails:a})=>{const s=an(),c=Gt(),d=M(),S=g((p=>le(p))),h=()=>{n()},k={vendorDetailView:a??S,onSaveSuccess:()=>{d(Le()),d(ft("Not-Started")),o()},onSaveVendor:e,onCancelClick:h,saveVendorDetailLocalData:p=>{d(Ve({vendorId:void 0,localData:p}))}};return _.jsx(on,{anchor:"right",open:t,PaperProps:{style:{width:Sn.overlayWidth.valuePercentage(c),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:s.colors.black,opacity:.4,cursor:"pointer"}}},onClose:h,children:_.jsx(yn,{onClick:p=>p.stopPropagation(),children:_.jsx(Yt,{...k})})})},yn=tn(nn)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `;function Tn(t,e){t(St({transactionId:e.transactionId,creditAccountIntegrationId:e.creditAccountIntegrationId,debitAccountIntegrationId:e.debitAccountIntegrationId,memo:e.memo,transactionType:W(e.transactionType),sourceTransactionType:W(e.sourceTransactionType)}))}function bn({currentTransactionId:t,enabled:e=!0,buildPath:o,beforeNavigate:n,navigate:a,navigateState:s}){const c=g((S=>S.createTransferEntryState.lastTransferEntryReplacement)),d=i.useRef(null);i.useEffect((()=>{if(!e||c==null||t==null||d.current===c)return;const{previousTransactionId:S,newTransactionId:h}=c;t.id===S.id&&t.type===S.type&&(d.current=c,n?.(),a(o(h),{replace:!0,state:s}))}),[e,c,t,o,n,a,s])}const gn=({closeDrawerHandler:t,overrideTransactionId:e,overrideTransactionType:o})=>{const n=ke(),a=Ce(),s=M(),c=pe(),{transactionTypeEncoded:d,transactionId:S}=Ae(),h=e??S,k=o??ze(d??"");let p;je(h,k)&&(p={id:h,type:W(k)});const l=p!=null?g((y=>q(y,p))):void 0,u=()=>{const y=ce(n.state?.pathnameStackToGoBack),v=y.poppedPathname??((f=2)=>{let T="../";for(let D=0;D<f;D++)T=`${T}../`;return T})(1);a(v,{state:{pathnameStackToGoBack:y.newStack}})};return{transactionId:p,onSaveVendor:()=>{s(Be(p,void 0))},onSaveSuccess:()=>{if(l!=null&&l?.transaction&&l?.transactionDetailLocalData.vendorUpdates?.qboId!=null&&l?.transactionDetailLocalData.vendorUpdates?.id!=null){const y=l?.transactionDetailLocalData.vendorUpdates,v={id:l?.transactionDetailLocalData.vendorUpdates?.qboId,zeniId:l?.transactionDetailLocalData.vendorUpdates?.id,type:"vendor",name:y?.name,qboId:l?.transactionDetailLocalData.vendorUpdates?.qboId??""},f={transactionId:{id:l?.transaction?.id,type:l?.transaction?.type},transaction:l?.transaction,lineIds:l?.transaction?.lines?.map((T=>T.id))??[]};s(Q({entity:v,amount:l?.transaction?.amount.amount,transactionDetails:f,flowType:"detail",isFetchCOT:c}))}u()},onCancel:()=>{p!=null&&s(ht({transactionId:p})),s(Le()),s(yt()),t(!0),u()}}},In=ct((function(t,e){const o=q(t,e.selectedTransaction);let n;o==null&&console.warn("Check if the you've selected the transaction before getting the details");const a=Ne.getSignedInUser(),s=t.tenantState.currentTenantId,c={userId:a?.userId??"",sessionId:a?.zeniSessionId??"",tenantId:s??""};o!=null&&o.fetchState==="Completed"&&o.transaction!=null&&e.entity!=null&&(n=gt(t,e.entity,"TransactionDetail"));const d=t.entityAutoCompleteState.autoCompleteText.common,S=It(t,"common"),h=K(t);return{transactionDetail:o,transactionAttachmentEndpointToDownload:`${oe}/transaction_attachment`,transactionAttachmentsEndpointToFetch:h.externalConnections?.accounting[0]?.connectionName==="netsuite"?`${oe}/transaction_attachments_accounting_provider`:`${oe}/transaction_attachments`,attachmentUploadEndpoint:`${en.accountMicroServiceBaseUrl}`,isCOTEnabled:e.isCOTEnabled,authParams:c,trendReport:n,analytics:G,uncategorizedAccounts:e.uncategorizedAccounts,autoCompleteData:{autoCompleteText:d,entityAutoCompleteView:S},isVendorBulkUpdateOnTransactionEnabled:e.isVendorBulkUpdateOnTransactionEnabled,isExpenseAutomationEnabled:e.isExpenseAutomationEnabled,enableBackClickOnSave:e.location.state?.message?.startsWith("comingFromScheduleDetails"),isTransactionSplitEditMode:o?.transactionDetailLocalData?.editMode??!1}}),(function(t,e){const{isCOTEnabled:o}=e;return{onBackClick:()=>{if(t($("common")),e.onBackClick!=null)return void e.onBackClick();const n=ce(e.location.state?.pathnameStackToGoBack),a=n.poppedPathname??Ge(2);e.navigate(a,{state:{pathnameStackToGoBack:n.newStack,message:"comingFromTransactionDetail"}})},discardTransactionDetailLocalData:(n,a)=>{e.transaction!=null&&t(Xt({transactionId:{id:e.transaction.id,type:e.transaction.type},vendorId:n,customerId:a}))},onTransactionClick:n=>{e.resetTrendIsFetchedStates(),t(de()),t(ue());const a=ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(Me(n,e.tenantEmailDomain),{state:{pathnameStackToGoBack:a}})},onTrendSelectedPeriodChange:n=>{if(n==null)e.defaultTrendTransactionTimePeriod!=null&&t(ve(e.entity,"TransactionDetail",{timeframe:"month",timePeriod:e.defaultTrendTransactionTimePeriod}));else{const a=n.currentTimePeriod==null?n.addTimePeriod:{startDate:n.addTimePeriod.startDate,endDate:n.currentTimePeriod.endDate};t(me(e.entity,"TransactionDetail",{timeframe:n.timeframe,timePeriod:n.addTimePeriod})),t(ve(e.entity,"TransactionDetail",{timeframe:n.timeframe,timePeriod:a}))}},onSaveUpdates:(n,a,s,c)=>{t(c===!0&&s!=null?Be(n,s,!0,e.isExpenseAutomationEnabled):Mt({transactionId:n,isExpenseAutomationEnabled:e.isExpenseAutomationEnabled,cotTransactionTracking:a})),t($("common"))},onUploadAttachmentAttachment:n=>{t(jt(n))},onDeleteAttachment:n=>{e.transaction!=null&&t(zt(n,{id:e.transaction.id,type:e.transaction.type}))},onSaveTransactionDetailLocalData:(n,a)=>{t(Nt({transactionId:n,transactionLocalData:a}))},onUpdateAllChecked:(n,a,s,c)=>{e.transaction!=null&&t(Ot(e.selectedTransaction,e.transaction,n,a,s,c))},onResetLineItemsCategoryClassInLocalData:(n,a,s,c,d,S)=>{t(Bt(n,a,s,c,d,S))},onChangeCategoryClassWhenUpdateAllIsChecked:(n,a)=>{e.transaction!=null&&t(Lt({id:e.transaction.id,type:e.transaction.type},e.transaction,n,a))},onSaveSuccess:()=>{const n=ce(e.location.state?.pathnameStackToGoBack);if(n.poppedPathname!=null){const a=un(n.poppedPathname,"/").split("/"),s=a[a.length-1];if(["uncategorized-income","uncategorized-expense","missing-receipts"].includes(s)&&e.navigate(n.poppedPathname,{state:{pathnameStackToGoBack:n.newStack}}),e.location.state?.message==="comingFromScheduleDetails"){const c=`${rn(e.tenantEmailDomain)}`;e.navigate(c)}else if(e.location.state?.message==="comingFromScheduleDetailsFixedAssets"){const c=`${ln(e.tenantEmailDomain)}`;e.navigate(c)}}},onPageRefresh:()=>{t(Oe(e.selectedTransaction,!0))},autoCompleteActions:{onAutoCompleteInputChange:(n,a)=>{n.trim().length>=2?t(Vt({searchString:n,entityType:a,searchOrigin:"common"})):n.trim().length===0&&t($("common"))},onCancelAutoComplete:()=>{t($("common"))}},onFetchRecommendationsForEntity:(n,a,s,c)=>{t(Q({entity:n,amount:a,transactionDetails:s,flowType:"detail",isBulkFetch:c,isFetchCOT:o}))},clearRecommendationForLineId:n=>{const{transactionId:a,transaction:s,lineId:c}=n;t(xt(a,s,c))},resetUpdateErrorState:()=>{const n={id:e.selectedTransaction.id,type:e.selectedTransaction.type};t(Ut(n))},onSaveVendorInLocalData:(n,a,s,c,d)=>{if(t(Ft({transactionId:n,vendorUpdates:a,entity:s})),a.id!=null&&s!=null&&c!=null&&d!=null&&t(Q({entity:s,amount:c,transactionDetails:d,flowType:"detail",isFetchCOT:o})),t(Ve({vendorId:a.id?a.id:void 0,localData:{vendorName:a.name,vendorId:a.id?a.id:void 0}})),!a.id&&e.transaction!=null){const S=e.transaction,h=ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(`/${e.tenantEmailDomain}/transaction/${encodeURIComponent(S.type??"")}/${S.id}/vendor/create`,{state:{pathnameStackToGoBack:h}})}},onSaveCustomerInLocalData:(n,a,s,c,d)=>{t(wt({transactionId:n,customerUpdates:a,entity:s})),a.id!=null&&s!=null&&c!=null&&d!=null&&t(Q({entity:s,amount:c,transactionDetails:d,flowType:"detail",isFetchCOT:o}))},onUpdateAllTranactionsWithCurrentVendorChecked:n=>{t(Rt({transactionId:{id:e.selectedTransaction.id,type:e.selectedTransaction.type},isUpdateEnabled:n}))},onClickUpdateVendorToAllLineItems:(n,a,s)=>{t(Pt(n,a,s))},onResetVendorToAllLineItems:(n,a,s)=>{t(_t(n,a,s))},saveLatestSelectedEntity:(n,a,s)=>{t(At({transactionId:n,lineId:a,entity:s}))},updateVendorBulkRecommendationsFetchStatus:(n,a)=>{t(Ct(n,a))},setIsVendorUpdateAllChecked:(n,a,s)=>{t(kt(n,a,s))},onCreateTransferEntry:e.isCreateTransferEntryFromExpenseEnabled===!0?n=>Tn(t,n):void 0,onLineAdd:()=>{if(e.transaction==null)return;const n={id:e.transaction.id,type:e.transaction.type},a=e.transaction.type==="journal_entry",s=e.transaction.amount?.currencyCode??"",c=e.transaction.amount?.currencySymbol??"",d=a?{amount:{amount:0,currencyCode:s,currencySymbol:c},id:crypto.randomUUID(),isCategoryMiscategorized:!1,isClassMiscategorized:!1,lineDescription:"",platformLineDetailType:"journal_entry_line_detail",type:"journal_entry_transaction_line",postingType:void 0,postingTypeName:"",lineTransactionType:"journal_entry"}:{amount:{amount:0,currencyCode:s,currencySymbol:c},id:crypto.randomUUID(),isCategoryMiscategorized:!1,isClassMiscategorized:!1,lineDescription:"",platformLineDetailType:"account_based_expense_line_detail",type:"transaction_with_account_and_class_line"};t(Dt(n,d))},onLineDelete:n=>{if(e.transaction==null)return;const a={id:e.transaction.id,type:e.transaction.type};t(Et(a,n))},onToggleSplitEditMode:n=>{if(e.transaction==null)return;const a={id:e.transaction.id,type:e.transaction.type};t(vt(a,n))}}}))(Kt);function Nn(){const t=Ce(),e=M(),o=ke(),{useFeatureGate:n}=H(),a=qt(),s=g((m=>K(m))),c=s.userRole.includes("charge_card_user")||s.userRole.includes("charge_card_admin"),d=s.userRole!=null&&_e(s.userRole),S=s.userRole!=null&&Pe(s.userRole),{isFeatureEnabled:h}=n(R.isVendorBulkUpdateOnTransactionEnabled),{isFeatureEnabled:k}=n(R.isExpenseAutomationEnabled),{tenantEmailDomain:p,transactionTypeEncoded:l,transactionId:u}=Ae(),[y,v]=i.useState(!1),f=ze(l??""),T=je(u,f),D=g((m=>m.transactionVendorViewState)),C=pe(),{isFeatureEnabled:w}=n(R.isRecommendationFeedbackEnabled),A=Ht(),{onRecommendationSelection:F,popup:U}=fn({isEnabled:w,fallbackTransactionId:u}),L=i.useMemo((()=>({...A,onRecommendationSelection:F})),[A,F]),{isFeatureEnabled:x}=n(R.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:B}=n(R.isProjectsTransactionsEnabled),{isFeatureEnabled:O}=n(R.isTransactionSplitEnabled),X=a?.currentTenant?.companyId,Y=a?.currentTenant?.companyName,N=cn(X),E=i.useMemo((()=>{if(T)return{id:u,type:W(f)}}),[T,u,f]),r=E!=null?g((m=>q(m,E))):void 0,I=r?.transactionDetailLocalData.vendorUpdates?.id!=null?D.editVendorStateById[r?.transactionDetailLocalData.vendorUpdates.id]?.saveStatus.fetchState:"Not-Started",b=r?.fetchState==="Completed"?$e(r?.transaction):void 0,P=g((m=>b!=null?Re(m.customerIncomeState,m.vendorExpenseState,m.trendState,b,"month"):void 0)),Z=g((m=>le(m))),ee=g((m=>b!=null?we(m.trendWithTransactionsState,b,"TransactionDetail"):void 0)),te=s.company?.companyInfo.firstMonthOfFY??1,z=g((m=>Fe(m.accountState,m.accountListState,"accountList"))),[Ye,fe]=i.useState(!1),[We,Se]=i.useState(!1),[qe,he]=i.useState(!1),He=i.useCallback((m=>Me(m,p??"")+o.search),[p,o.search]),Ze=i.useCallback((()=>{he(!1)}),[]);bn({currentTransactionId:E,enabled:p!=null&&p!=="",buildPath:He,beforeNavigate:Ze,navigate:t,navigateState:o.state});const ye=()=>{fe(!1),Se(!1)},Te=dn();mn();const ne=i.useRef(r?.transaction);ne.current=r?.transaction;const Qe=r?.transactionDetailUpdateStatus?.fetchState,V=pn(Qe,(()=>{const m=[];if(ne.current!=null)for(const ae of ne.current.lines??[])"account"in ae&&ae.account?.accountId!=null&&m.push(ae.account.accountId);return m}));i.useEffect((()=>{E!=null&&r!=null&&r.fetchState==="Not-Started"&&(e(Oe(E,!1)),ye())}),[e,E,r?.fetchState]),i.useEffect((()=>{if(E!=null&&r?.fetchState==="Error"){const m=ie(o.state?.pathnameStackToGoBack,o.pathname);t("page-not-found",{replace:!0,state:Te?{pathnameStackToGoBack:m,message:"expenseAutomation",origin:"transaction_categorization"}:{pathnameStackToGoBack:m,message:"pageNotFound",origin:"transaction_detail"}})}}),[E,r?.fetchState,t,o.state,o.pathname,Te]),i.useEffect((()=>{qe||r==null||r.transaction==null||(e(Ue({id:r.transaction.id,type:r.transaction.type})),he(!0));const m=o.state?.searchContext;b==null&&r?.fetchState==="Completed"&&De(r?.transaction,m),b!=null&&(!c||d&&S===!1)&&(Ye?We||P==null||(Se(!0),e(me(b,"TransactionDetail",{timeframe:"month",timePeriod:ee?.selectedPeriod?.timePeriod??P}))):(e(de()),e(ue()),De(r?.transaction,m),fe(!0),e(xe(b))))}),[r?.fetchState,r?.transaction,P,c]),i.useEffect((()=>{Z.newVendorState?.vendorDetailLocalData?.vendorName!=null?v(!0):v(!1)}),[Z.newVendorState?.vendorDetailLocalData?.vendorName]),i.useEffect((()=>()=>{e($("common"))}),[]);const Je=[l,u].filter((m=>m!=null)),{transactionId:be,onSaveVendor:Ke,onSaveSuccess:et,onCancel:tt}=gn({closeDrawerHandler:m=>{v(!1),t(m?"../":"../..")}}),{isAiCfoAccessEnabled:nt,onAskAiCfoClick:at}=sn({mobileExploreReferrer:"Transaction Details"});return Zt({isDataReady:r?.fetchState==="Completed"}),T?_.jsxs(_.Fragment,{children:[be!=null&&y&&_.jsx(hn,{isOpen:y,transactionId:be,onSaveVendor:Ke,onSaveSuccess:et,onCancel:tt}),_.jsx(Qt,{toolkit:L,children:_.jsx(In,{hideDeleteAttachment:!0,firstMonthOfFY:te,isDisabled:r?.transaction?.type==="transfer"&&a?.connectionName==="netsuite"?"readonly":void 0,tenantEmailDomain:p,location:o,navigate:t,selectedTransaction:E,entity:b,isCOTEnabled:C,defaultTrendTransactionTimePeriod:P,resetTrendIsFetchedStates:ye,transaction:r?.transaction,uncategorizedAccounts:z,vendorSaveStatus:I,isVendorBulkUpdateOnTransactionEnabled:h,isCreateTransferEntryFromExpenseEnabled:x,isExpenseAutomationEnabled:k,isAiCfoAccessEnabled:nt,onAskAiCfoClick:at,isProjectsTransactionsEnabled:B,isTransactionSplitEnabled:O,companyId:X,companyName:Y,initialOpenThreadRequest:N})}),U,V.showPopup&&V.popupType!=null&&_.jsx(Jt,{popupType:V.popupType,currencySymbol:V.currencySymbol,accountId:V.popupAccountId??"",accountName:V.popupAccountName??"",onSubmit:V.handleSubmit,onDismiss:V.handleDismiss})]}):_.jsx(st,{to:Ge(Je.length)})}const Ge=(t=2)=>{let e="../";for(let o=0;o<t;o++)e=`${e}../`;return e},De=(t,e)=>{if(t!=null){const{transactionCategory:o,transactionClass:n}=vn(t),a=En(t);G.trackTransactionDetails(t.account?.accountId,t.account?.accountName,t.id,a,o.length>0?o:void 0,n.length>0?n:void 0,t.type,t.amount,t.memo,t.lines?.length??0,t.attachments?.map((s=>s.fileName)),e!=null?"Search":void 0,e?.searchTerm,e?.resultPosition,e?.resultsCount)}},vn=t=>{const e=[],o=[];return t.lines?.forEach((n=>{switch(n.type){case"transaction_with_account_and_class_line":case"transaction_with_product_or_service_line":case"journal_entry_transaction_line":case"linked_transaction_line":{const a=n;a!=null&&a.account!=null&&a.account.accountName?.length>0&&e.push(a.account.accountName),a.class!=null&&a.class.className?.length>0&&o.push(a.class.className);break}}})),{transactionCategory:e,transactionClass:o}},En=t=>Tt(t)===!0?t.customer?.name??"":bt(t)===!0?t.vendor?.name??"":t.memo!=null?t.memo:t.type;export{hn as C,Nn as T,On as a,fn as b,pn as c,gn as d,In as e,bn as f,pe as g,Tn as h,Bn as i,De as l,Ln as r,mn as u};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-BlNqAXG4.js";import{h as H,g as J,u as K,i as Q,j as g,N as U,l as X,n as Me,o as M}from"./core-Dx-yNdOO.js";import{fI as q,uh as Z,lj as p,eI as ee,SF as Ae,br as me,a0k as Be,m3 as te,WQ as ae,a0l as pe,a0m as Ce,bF as k,SB as Se,a0n as Le,a0o as fe,a0p as Fe,SE as he,a0q as Oe,a0r as Te,a0s as ze,a0t as ge,a0u as Ge,a0v as we,a0w as De,TS as $e}from"./zeni-epic-state-DU8p9Pr6.js";import{q as ne,$ as ce,h as L,G as Ie,db as oe,p as R,a2 as se,ao as Re,o as _e}from"./index-BN_JNPW3.js";import"./mui-DicWBIpH.js";import{a as y}from"./sentry-oO1cMYln.js";import{w as ie}from"./withTransactionSidePanel-BGYKHHLT.js";import{p as re,c as de}from"./routePaths-P47RCoW6.js";import{B as Ve}from"./utils-vB0Nm3XK.js";import{d as j}from"./decodeURIComponentSafe-gD0LryXw.js";import{Z as Ne}from"./ZeniAccountStatementScreen-CYxLDv4m.js";import"./recharts-DkhthbKK.js";import"./analytics-DOu6Ih_Z.js";import"./plaid-BW55_XuJ.js";import"./dnd-DfkYz8Zm.js";import"./stripe-cKAAJElX.js";import"./lottie-CICLPim-.js";import"./lexical-CeKyhyV8.js";import"./pdf-BwuxCG-0.js";import"./useAskAiCfoHostNavButtonProps-BOks8lHg.js";import"./TransactionDetailScreen-DEfBPk22.js";import"./useInitialThreadRequest-J-yGGXi5.js";import"./expenseAutomationHelper--OaaBO01.js";import"./stripSplatSuffix-DUyz4jOZ.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="6080bb27-f4b9-470e-a0e2-eafc295e3814",a._sentryDebugIdIdentifier="sentry-dbid-6080bb27-f4b9-470e-a0e2-eafc295e3814")}catch{}})();const Je=["uncategorized-income","uncategorized-expense","miscategorized-income","miscategorized-expense","missing-receipts"],N=a=>Ve(a),ke=()=>{const{common:a,uncategorizedTransactionList:e}=Ie.getLocalizedStrings();return{amount:e.missingReceipt.missingReceiptMinAmount.amount,currencyCode:a.currency.currencyCode,currencySymbol:a.currency.currencySymbol}},Ue=X((function(a,e){const t=Be(a.transactionState,a.transactionListState,e.selectedAccount.period,e.selectedAccount.timeframe,N(e.selectedAccount.tranListType));return{title:e.selectedAccount.title,subTitle:e.selectedAccount.subTitle,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:e.dataAvailableForPeriod,report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??"../../";e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();const o=N(e.selectedAccount.tranListType),d=He(t,n,c,o,e.bookCloseDate);L.trackTransactionList(void 0,void 0,void 0,e.selectedAccount.title,void 0,!0),a(pe({uiState:{dateRange:d},type:N(e.selectedAccount.tranListType)})),a(Ae(o,p(d),!1,o==="missingReceipts"?ke():void 0)),e.onSelectedTimePeriodChange(p(d))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(pe({uiState:{scrollYOffset:t},type:N(e.selectedAccount.tranListType)}))}}}))(oe),V=ie((function({...a}){const e=H(),t=J(),n=K(),c=t.pathname.split("/").find((l=>Je.includes(l))),o=c??"uncategorized-expense",{tenantEmailDomain:d}=Q(),{accountType:Y,title:b,subTitle:A}=qe(o),f="month",T=g((l=>q(l))),v=T.company?.companyInfo.firstMonthOfFY??1,{useFeatureGate:S}=ne(),{isFeatureEnabled:h}=S(ce.isProjectsTransactionsEnabled),I=g((l=>Z(l)))&&h,{dataAvailable:x,initialTimeframeTick:F}=We(o,v,T.bookCloseDate),[P,O]=y.useState(!1),[E,z]=y.useState(void 0),u=y.useMemo((()=>{const l=p(F);return{tranListType:o,accountType:ee(Y),title:b,subTitle:A,timeframe:f,period:l}}),[o,f,Y,x]);y.useEffect((()=>{if(!P&&u!=null){O(!0),L.trackTransactionList(void 0,void 0,void 0,u.title);const l=N(u.tranListType);n(Ae(l,u.period,!0,l==="missingReceipts"?ke():void 0))}}),[P,u,n]);let B=u;return u!=null&&E!=null&&(B={...u,period:E}),c==null||B==null?s.jsx(U,{to:"../"}):s.jsx(Ue,{firstMonthOfFY:v,tenantEmailDomain:d,location:t,useFixedPeriod:{timeframe:"month",numberOfPeriods:12},dataAvailableForPeriod:x,navigate:e,showProjectField:I,selectedAccount:B,referrerType:o,bookCloseDate:T.bookCloseDate,onSelectedTimePeriodChange:l=>z(l),...a})})),qe=a=>{let e="",t="";const n=Ie.getLocalizedStrings();switch(a){case"uncategorized-income":e="income",t=n.uncategorizedTransactionList.income.title;break;case"uncategorized-expense":e="expenses",t=n.common.texts.uncategorizedExpenses;break;case"miscategorized-expense":e="expenses",t=n.miscategorizedTransactionList.expense.title;break;case"miscategorized-income":e="income",t=n.miscategorizedTransactionList.income.title;break;case"missing-receipts":t=n.common.texts.receipts}return{accountType:e,title:t,subTitle:""}},We=(a,e,t)=>{const n=me();let c=me().startOf("month").subtract(11,"month");return t!=null&&a!=="missing-receipts"?t.add(1,"day").isBefore(c)?{dataAvailable:{startDate:t.add(1,"day"),endDate:n},initialTimeframeTick:{startDate:c,endDate:n}}:(c=t.add(1,"day"),{dataAvailable:{startDate:c,endDate:n},initialTimeframeTick:{startDate:c,endDate:n}}):{dataAvailable:re(5,e),initialTimeframeTick:{startDate:c,endDate:n}}},He=(a,e,t,n,c)=>{let o=e;return n==="missingReceipts"||c==null?a.startDate.isBefore(e.startDate,t)?o={startDate:a.startDate,endDate:e.endDate}:a.startDate.isAfter(e.endDate,t)?o={startDate:e.startDate,endDate:a.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(a)}`):o=a.startDate.isBefore(c,t)?{startDate:c.add(1,"day"),endDate:e.endDate}:{startDate:a.startDate,endDate:e.endDate},o},Ke=X((function(a,e){const t=Le(a.transactionState,a.transactionListState,e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.classId,e.selectedAccount.timeframe,e.selectedAccount.period);return{accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,title:e.selectedAccount.title,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:re(5,e.firstMonthOfFY),report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??Ye();e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();let o=n;t.startDate.isBefore(n.startDate,c)?o={startDate:t.startDate,endDate:n.endDate}:t.startDate.isAfter(n.endDate,c)?o={startDate:n.startDate,endDate:t.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(t)}`),L.trackTransactionList(e.selectedAccount.accountId,void 0,e.referrerType,e.selectedAccount.title,void 0,!0),a(fe({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,classId:e.selectedAccount.classId,uiState:{dateRange:o}})),a(Se(e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.classId,p(o))),e.onSelectedTimePeriodChange(p(o))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(fe({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,classId:e.selectedAccount.classId,uiState:{scrollYOffset:t}}))}}}))(oe),Qe=ie((function({referrerType:a,...e}){const t=H(),n=J(),c=K(),{tenantEmailDomain:o,accountTypeEncoded:d,accountIdEncoded:Y,classIdEncoded:b,timeframe:A,startDate:f,endDate:T,titleEncoded:v}=Q(),S=j(d??""),h=j(Y??""),I=j(b??""),x=j(v??""),F=g((r=>Ce(r.transactionListState,h,S,I))),[P,O]=y.useState(!1),[E,z]=y.useState(void 0),u=g((r=>q(r))),B=u.company?.companyInfo.firstMonthOfFY??1,{useFeatureGate:l}=ne(),{isFeatureEnabled:m}=l(ce.isProjectsTransactionsEnabled),w=g((r=>Z(r)))&&m;let i;const G=Xe(S,h,I,A,f,T,x);if(G){const r={startDate:k(f,"YYYY-MM-DD"),endDate:k(T,"YYYY-MM-DD")},$=Ze(F?.dateRange,r);i={accountId:h,accountType:ee(S),classId:I,title:x,timeframe:A,period:$}}y.useEffect((()=>{P||i==null||(O(!0),L.trackTransactionList(i.accountId,void 0,a,i.title),c(Se(i.accountId,i.accountType,i.classId,i.period)))}),[P,i,c]);let C=i;i!=null&&E!=null&&(C={...i,period:E});const _=[d,Y,b,A,f,T,v].filter((r=>r!=null));return G&&C!=null?s.jsx(Ke,{firstMonthOfFY:B,tenantEmailDomain:o,location:n,navigate:t,showProjectField:w,selectedAccount:C,referrerType:a,onSelectedTimePeriodChange:r=>z(r),...e}):s.jsx(U,{to:Ye(_.length)})})),Ye=(a=7)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e},Xe=(a,e,t,n,c,o,d)=>a!=null&&e!=null&&t!=null&&n!=null&&c!=null&&o!=null&&(n==="month"||n==="quarter")&&k(c,"YYYY-MM-DD").isValid()&&k(o,"YYYY-MM-DD").isValid()&&d!=null,Ze=(a,e)=>a!=null&&a.endDate.isSame(e.endDate,"day")&&a.startDate.isBefore(e.startDate,"day")?p(a):p(e),et=X((function(a,e){const t=Oe(a.transactionState,a.transactionListState,e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.projectId,e.selectedAccount.timeframe,e.selectedAccount.period);return{accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,title:e.selectedAccount.title,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:re(5,e.firstMonthOfFY),report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??be();e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();let o=n;t.startDate.isBefore(n.startDate,c)?o={startDate:t.startDate,endDate:n.endDate}:t.startDate.isAfter(n.endDate,c)?o={startDate:n.startDate,endDate:t.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(t)}`),L.trackTransactionList(e.selectedAccount.accountId,void 0,e.referrerType,e.selectedAccount.title,void 0,!0),a(Te({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,projectId:e.selectedAccount.projectId,uiState:{dateRange:o}})),a(he(e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.projectId,p(o))),e.onSelectedTimePeriodChange(p(o))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(Te({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,projectId:e.selectedAccount.projectId,uiState:{scrollYOffset:t}}))}}}))(oe),tt=ie((function({referrerType:a,...e}){const t=H(),n=J(),c=K(),{tenantEmailDomain:o,accountTypeEncoded:d,accountIdEncoded:Y,projectIdEncoded:b,timeframe:A,startDate:f,endDate:T,titleEncoded:v}=Q(),S=j(d??""),h=j(Y??""),I=j(b??""),x=j(v??""),F=g((r=>Fe(r.transactionListState,h,S,I))),[P,O]=y.useState(!1),[E,z]=y.useState(void 0),u=g((r=>q(r))),B=u.company?.companyInfo.firstMonthOfFY??1,{useFeatureGate:l}=ne(),{isFeatureEnabled:m}=l(ce.isProjectsTransactionsEnabled),w=g((r=>Z(r)))&&m;let i;const G=at(S,h,I,A,f,T,x);if(G){const r={startDate:k(f,"YYYY-MM-DD"),endDate:k(T,"YYYY-MM-DD")},$=nt(F?.dateRange,r);i={accountId:h,accountType:ee(S),projectId:I,title:x,timeframe:A,period:$}}y.useEffect((()=>{P||i==null||(O(!0),L.trackTransactionList(i.accountId,void 0,a,i.title),c(he(i.accountId,i.accountType,i.projectId,i.period)))}),[P,i,c]);let C=i;i!=null&&E!=null&&(C={...i,period:E});const _=[d,Y,b,A,f,T,v].filter((r=>r!=null));return G&&C!=null?s.jsx(et,{firstMonthOfFY:B,tenantEmailDomain:o,location:n,navigate:t,showProjectField:w,selectedAccount:C,referrerType:a,onSelectedTimePeriodChange:r=>z(r),...e}):s.jsx(U,{to:be(_.length)})})),be=(a=7)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e},at=(a,e,t,n,c,o,d)=>a!=null&&e!=null&&t!=null&&n!=null&&c!=null&&o!=null&&(n==="month"||n==="quarter")&&k(c,"YYYY-MM-DD").isValid()&&k(o,"YYYY-MM-DD").isValid()&&d!=null,nt=(a,e)=>a!=null&&a.endDate.isSame(e.endDate,"day")&&a.startDate.isBefore(e.startDate,"day")?p(a):p(e),ct=X((function(a,e){const t=Ge(a.transactionState,a.transactionListState,e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.timeframe,e.selectedAccount.period),n=t.account?.coaId,c=e.isConnectedAccountProviderUnit&&we(n??"");return{accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,title:e.selectedAccount.title,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:re(5,e.firstMonthOfFY),report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,showStatementPageIcon:c,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??ve();e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();let o=n;t.startDate.isBefore(n.startDate,c)?o={startDate:t.startDate,endDate:n.endDate}:t.startDate.isAfter(n.endDate,c)?o={startDate:n.startDate,endDate:t.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(t)}`),L.trackTransactionList(e.selectedAccount.accountId,void 0,e.referrerType,e.selectedAccount.title,void 0,!0),a(De({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,uiState:{dateRange:o}})),a(ge(e.selectedAccount.accountId,e.selectedAccount.accountType,p(o))),e.onSelectedTimePeriodChange(p(o))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(De({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,uiState:{scrollYOffset:t}}))},onStatementPageIconClick:()=>{const t=it(e.tenantEmailDomain),n=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(t,{state:{pathnameStackToGoBack:n}})}}}))(oe),ye=ie((function({referrerType:a,...e}){const t=H(),n=J(),c=K(),{tenantEmailDomain:o,accountTypeEncoded:d,accountIdEncoded:Y,timeframe:b,startDate:A,endDate:f,titleEncoded:T,excludeSubAccounts:v}=Q(),S=j(d??""),h=j(Y??""),I=j(T??""),x=!(v!=null&&v==="exclude_subaccounts"),F=g((D=>ze(D.transactionListState,h,S))),[P,O]=y.useState(!1),[E,z]=y.useState(void 0),u=g((D=>q(D))),B=u.company?.featuresActivationInfo.connectedAccountProvider==="unit",l=u.company?.companyInfo.firstMonthOfFY??1;let m;const w=ot(S,h,b,A,f,I);if(w){const D={startDate:k(A,"YYYY-MM-DD"),endDate:k(f,"YYYY-MM-DD")},le=st(F?.dateRange,D);m={accountId:h,accountType:ee(S),title:I,timeframe:b,period:le}}let i=m;m!=null&&E!=null&&(i={...m,period:E});const{useFeatureGate:G}=ne(),C=y.useCallback(((D,le)=>{if(o==null)return;const ue=D.url.split(`/${o}/`)[1];if(ue==null)return;const[Ee,je]=ue.split("?"),W=new URLSearchParams(je??"");W.set("view","full"),W.set("thread_id",le),W.set("entity_type",D.entityType);const xe=R(n.state?.pathnameStackToGoBack,n.pathname);t(`/${o}/${Ee}?${W.toString()}`,{state:{pathnameStackToGoBack:xe}})}),[t,o,n.state,n.pathname]),{isFeatureEnabled:_}=G(ce.isProjectsTransactionsEnabled),r=g((D=>Z(D)))&&_,{areTenantIdsInSync:$}=Re();y.useEffect((()=>{!P&&m!=null&&$&&(O(!0),L.trackTransactionList(m.accountId,void 0,a,m.title),c(ge(m.accountId,m.accountType,m.period,void 0,!1,x)))}),[P,m,c,$]);const Pe=[d,Y,b,A,f,T].filter((D=>D!=null));return w&&i!=null?s.jsx(ct,{firstMonthOfFY:l,tenantEmailDomain:o,location:n,navigate:t,isConnectedAccountProviderUnit:B,onCommentThreadClick:C,showProjectField:r,selectedAccount:i,referrerType:a,onSelectedTimePeriodChange:D=>z(D),...e}):s.jsx(U,{to:ve(Pe.length)})})),ve=(a=7)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e},ot=(a,e,t,n,c,o)=>a!=null&&e!=null&&t!=null&&n!=null&&c!=null&&(t==="month"||t==="quarter")&&k(n,"YYYY-MM-DD").isValid()&&k(c,"YYYY-MM-DD").isValid()&&o!=null,st=(a,e)=>a!=null&&a.endDate.isSame(e.endDate,"day")&&a.startDate.isBefore(e.startDate,"day")?p(a):p(e),it=a=>`/${a}/transactions/${$e}/statements`;function Bt(){const a=J().state?.referrer,e=g((n=>n.expenseAutomationViewState.selectedPeriodByTenantId))[g((n=>q(n))).tenantId],t=_e();return s.jsxs(Me,{children:[s.jsx(M,{path:"/:accountTypeEncoded/:accountIdEncoded/:timeframe/:startDate/:endDate/:titleEncoded/:excludeSubAccounts/*",element:s.jsx(ye,{referrerType:a})}),s.jsx(M,{path:"/zeni-clearing-account/statements",element:s.jsx(Ne,{})}),s.jsx(M,{path:"/*",element:s.jsx(ye,{referrerType:a})}),s.jsx(M,{path:"/uncategorized-income/*",element:s.jsx(V,{})}),s.jsx(M,{path:"/uncategorized-expense/*",element:s.jsx(V,{})}),s.jsx(M,{path:"/miscategorized-income/*",element:s.jsx(V,{})}),s.jsx(M,{path:"/miscategorized-expense/*",element:s.jsx(V,{})}),s.jsx(M,{path:"/missing-receipts/*",element:t?s.jsx(U,{to:`../../month_end_close_checks/review/missing_receipts/${e.month}-${e.year}`}):s.jsx(V,{})}),s.jsx(M,{path:"/by-class/:accountTypeEncoded/:accountIdEncoded/:classIdEncoded/:timeframe/:startDate/:endDate/:titleEncoded/*",element:s.jsx(Qe,{referrerType:a})}),s.jsx(M,{path:"/by-project/:accountTypeEncoded/:accountIdEncoded/:projectIdEncoded/:timeframe/:startDate/:endDate/:titleEncoded/*",element:s.jsx(tt,{referrerType:a})})]})}export{Bt as default};
1
+ import{j as s}from"./liveblocks-Bym0XjRt.js";import{h as K,g as U,u as X,i as Q,j as g,N as V,l as W,n as Me,o as M}from"./core-C9Jt3gNb.js";import{fI as q,uh as Z,lj as p,eI as ee,SR as Ae,br as me,a0D as Ce,m3 as te,X0 as ae,a0E as pe,a0F as Be,bG as k,SN as Se,a0G as Le,a0H as fe,a0I as Fe,SQ as he,a0J as Oe,a0K as Te,a0L as Ge,a0M as ge,a0N as ze,a0O as we,a0P as De,U2 as $e}from"./zeni-epic-state-OTisIlmp.js";import{d as ne,P as ce,l as L,G as Ie,dd as oe,p as R,a2 as se,ao as Re,_ as _e}from"./index-DmFy--fV.js";import"./mui-BsgiBiT9.js";import{a as y}from"./sentry-CoKtZcTW.js";import{w as ie}from"./withTransactionSidePanel-BOIdrs8l.js";import{p as re,c as de}from"./routePaths-DQh6iYo4.js";import{B as Ne}from"./utils-CNqTTzSx.js";import{d as j}from"./decodeURIComponentSafe-Cr8jQXNX.js";import{Z as Je}from"./ZeniAccountStatementScreen-Vi4F2dbO.js";import"./recharts-GCccddBO.js";import"./analytics-DbFSqIth.js";import"./plaid-C8X6T_ms.js";import"./dnd-KhFMfpEU.js";import"./stripe-cKAAJElX.js";import"./lottie-CvA92JCl.js";import"./lexical-CpBrNOz8.js";import"./pdf-O569E9WB.js";import"./useAskAiCfoHostNavButtonProps-CgHJ-iCU.js";import"./TransactionDetailScreen-B1no9UdL.js";import"./useInitialThreadRequest-DA5FMzag.js";import"./expenseAutomationHelper-D-1MzDTJ.js";import"./stripSplatSuffix-B7IfcJr8.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="118ccefe-8b73-4c5d-ab88-63d931f08b1e",a._sentryDebugIdIdentifier="sentry-dbid-118ccefe-8b73-4c5d-ab88-63d931f08b1e")}catch{}})();const Ue=["uncategorized-income","uncategorized-expense","miscategorized-income","miscategorized-expense","missing-receipts"],J=a=>Ne(a),ke=()=>{const{common:a,uncategorizedTransactionList:e}=Ie.getLocalizedStrings();return{amount:e.missingReceipt.missingReceiptMinAmount.amount,currencyCode:a.currency.currencyCode,currencySymbol:a.currency.currencySymbol}},Ve=W((function(a,e){const t=Ce(a.transactionState,a.transactionListState,e.selectedAccount.period,e.selectedAccount.timeframe,J(e.selectedAccount.tranListType));return{title:e.selectedAccount.title,subTitle:e.selectedAccount.subTitle,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:e.dataAvailableForPeriod,report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??"../../";e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();const o=J(e.selectedAccount.tranListType),d=Ke(t,n,c,o,e.bookCloseDate);L.trackTransactionList(void 0,void 0,void 0,e.selectedAccount.title,void 0,!0),a(pe({uiState:{dateRange:d},type:J(e.selectedAccount.tranListType)})),a(Ae(o,p(d),!1,o==="missingReceipts"?ke():void 0)),e.onSelectedTimePeriodChange(p(d))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(pe({uiState:{scrollYOffset:t},type:J(e.selectedAccount.tranListType)}))}}}))(oe),N=ie((function({...a}){const e=K(),t=U(),n=X(),c=t.pathname.split("/").find((l=>Ue.includes(l))),o=c??"uncategorized-expense",{tenantEmailDomain:d}=Q(),{accountType:Y,title:b,subTitle:A}=qe(o),f="month",T=g((l=>q(l))),v=T.company?.companyInfo.firstMonthOfFY??1,{useFeatureGate:S}=ne(),{isFeatureEnabled:h}=S(ce.isProjectsTransactionsEnabled),I=g((l=>Z(l)))&&h,{dataAvailable:x,initialTimeframeTick:F}=He(o,v,T.bookCloseDate),[P,O]=y.useState(!1),[E,G]=y.useState(void 0),u=y.useMemo((()=>{const l=p(F);return{tranListType:o,accountType:ee(Y),title:b,subTitle:A,timeframe:f,period:l}}),[o,f,Y,x]);y.useEffect((()=>{if(!P&&u!=null){O(!0),L.trackTransactionList(void 0,void 0,void 0,u.title);const l=J(u.tranListType);n(Ae(l,u.period,!0,l==="missingReceipts"?ke():void 0))}}),[P,u,n]);let C=u;return u!=null&&E!=null&&(C={...u,period:E}),c==null||C==null?s.jsx(V,{to:"../"}):s.jsx(Ve,{firstMonthOfFY:v,tenantEmailDomain:d,location:t,useFixedPeriod:{timeframe:"month",numberOfPeriods:12},dataAvailableForPeriod:x,navigate:e,showProjectField:I,selectedAccount:C,referrerType:o,bookCloseDate:T.bookCloseDate,onSelectedTimePeriodChange:l=>G(l),...a})})),qe=a=>{let e="",t="";const n=Ie.getLocalizedStrings();switch(a){case"uncategorized-income":e="income",t=n.uncategorizedTransactionList.income.title;break;case"uncategorized-expense":e="expenses",t=n.common.texts.uncategorizedExpenses;break;case"miscategorized-expense":e="expenses",t=n.miscategorizedTransactionList.expense.title;break;case"miscategorized-income":e="income",t=n.miscategorizedTransactionList.income.title;break;case"missing-receipts":t=n.common.texts.receipts}return{accountType:e,title:t,subTitle:""}},He=(a,e,t)=>{const n=me();let c=me().startOf("month").subtract(11,"month");return t!=null&&a!=="missing-receipts"?t.add(1,"day").isBefore(c)?{dataAvailable:{startDate:t.add(1,"day"),endDate:n},initialTimeframeTick:{startDate:c,endDate:n}}:(c=t.add(1,"day"),{dataAvailable:{startDate:c,endDate:n},initialTimeframeTick:{startDate:c,endDate:n}}):{dataAvailable:re(5,e),initialTimeframeTick:{startDate:c,endDate:n}}},Ke=(a,e,t,n,c)=>{let o=e;return n==="missingReceipts"||c==null?a.startDate.isBefore(e.startDate,t)?o={startDate:a.startDate,endDate:e.endDate}:a.startDate.isAfter(e.endDate,t)?o={startDate:e.startDate,endDate:a.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(a)}`):o=a.startDate.isBefore(c,t)?{startDate:c.add(1,"day"),endDate:e.endDate}:{startDate:a.startDate,endDate:e.endDate},o},Xe=W((function(a,e){const t=Le(a.transactionState,a.transactionListState,e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.classId,e.selectedAccount.timeframe,e.selectedAccount.period);return{accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,title:e.selectedAccount.title,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:re(5,e.firstMonthOfFY),report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??Ye();e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();let o=n;t.startDate.isBefore(n.startDate,c)?o={startDate:t.startDate,endDate:n.endDate}:t.startDate.isAfter(n.endDate,c)?o={startDate:n.startDate,endDate:t.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(t)}`),L.trackTransactionList(e.selectedAccount.accountId,void 0,e.referrerType,e.selectedAccount.title,void 0,!0),a(fe({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,classId:e.selectedAccount.classId,uiState:{dateRange:o}})),a(Se(e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.classId,p(o))),e.onSelectedTimePeriodChange(p(o))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(fe({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,classId:e.selectedAccount.classId,uiState:{scrollYOffset:t}}))}}}))(oe),Qe=ie((function({referrerType:a,...e}){const t=K(),n=U(),c=X(),{tenantEmailDomain:o,accountTypeEncoded:d,accountIdEncoded:Y,classIdEncoded:b,timeframe:A,startDate:f,endDate:T,titleEncoded:v}=Q(),S=j(d??""),h=j(Y??""),I=j(b??""),x=j(v??""),F=g((r=>Be(r.transactionListState,h,S,I))),[P,O]=y.useState(!1),[E,G]=y.useState(void 0),u=g((r=>q(r))),C=u.company?.companyInfo.firstMonthOfFY??1,{useFeatureGate:l}=ne(),{isFeatureEnabled:m}=l(ce.isProjectsTransactionsEnabled),w=g((r=>Z(r)))&&m;let i;const z=We(S,h,I,A,f,T,x);if(z){const r={startDate:k(f,"YYYY-MM-DD"),endDate:k(T,"YYYY-MM-DD")},$=Ze(F?.dateRange,r);i={accountId:h,accountType:ee(S),classId:I,title:x,timeframe:A,period:$}}y.useEffect((()=>{P||i==null||(O(!0),L.trackTransactionList(i.accountId,void 0,a,i.title),c(Se(i.accountId,i.accountType,i.classId,i.period)))}),[P,i,c]);let B=i;i!=null&&E!=null&&(B={...i,period:E});const _=[d,Y,b,A,f,T,v].filter((r=>r!=null));return z&&B!=null?s.jsx(Xe,{firstMonthOfFY:C,tenantEmailDomain:o,location:n,navigate:t,showProjectField:w,selectedAccount:B,referrerType:a,onSelectedTimePeriodChange:r=>G(r),...e}):s.jsx(V,{to:Ye(_.length)})})),Ye=(a=7)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e},We=(a,e,t,n,c,o,d)=>a!=null&&e!=null&&t!=null&&n!=null&&c!=null&&o!=null&&(n==="month"||n==="quarter")&&k(c,"YYYY-MM-DD").isValid()&&k(o,"YYYY-MM-DD").isValid()&&d!=null,Ze=(a,e)=>a!=null&&a.endDate.isSame(e.endDate,"day")&&a.startDate.isBefore(e.startDate,"day")?p(a):p(e),et=W((function(a,e){const t=Oe(a.transactionState,a.transactionListState,e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.projectId,e.selectedAccount.timeframe,e.selectedAccount.period);return{accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,title:e.selectedAccount.title,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:re(5,e.firstMonthOfFY),report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??be();e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();let o=n;t.startDate.isBefore(n.startDate,c)?o={startDate:t.startDate,endDate:n.endDate}:t.startDate.isAfter(n.endDate,c)?o={startDate:n.startDate,endDate:t.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(t)}`),L.trackTransactionList(e.selectedAccount.accountId,void 0,e.referrerType,e.selectedAccount.title,void 0,!0),a(Te({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,projectId:e.selectedAccount.projectId,uiState:{dateRange:o}})),a(he(e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.projectId,p(o))),e.onSelectedTimePeriodChange(p(o))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(Te({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,projectId:e.selectedAccount.projectId,uiState:{scrollYOffset:t}}))}}}))(oe),tt=ie((function({referrerType:a,...e}){const t=K(),n=U(),c=X(),{tenantEmailDomain:o,accountTypeEncoded:d,accountIdEncoded:Y,projectIdEncoded:b,timeframe:A,startDate:f,endDate:T,titleEncoded:v}=Q(),S=j(d??""),h=j(Y??""),I=j(b??""),x=j(v??""),F=g((r=>Fe(r.transactionListState,h,S,I))),[P,O]=y.useState(!1),[E,G]=y.useState(void 0),u=g((r=>q(r))),C=u.company?.companyInfo.firstMonthOfFY??1,{useFeatureGate:l}=ne(),{isFeatureEnabled:m}=l(ce.isProjectsTransactionsEnabled),w=g((r=>Z(r)))&&m;let i;const z=at(S,h,I,A,f,T,x);if(z){const r={startDate:k(f,"YYYY-MM-DD"),endDate:k(T,"YYYY-MM-DD")},$=nt(F?.dateRange,r);i={accountId:h,accountType:ee(S),projectId:I,title:x,timeframe:A,period:$}}y.useEffect((()=>{P||i==null||(O(!0),L.trackTransactionList(i.accountId,void 0,a,i.title),c(he(i.accountId,i.accountType,i.projectId,i.period)))}),[P,i,c]);let B=i;i!=null&&E!=null&&(B={...i,period:E});const _=[d,Y,b,A,f,T,v].filter((r=>r!=null));return z&&B!=null?s.jsx(et,{firstMonthOfFY:C,tenantEmailDomain:o,location:n,navigate:t,showProjectField:w,selectedAccount:B,referrerType:a,onSelectedTimePeriodChange:r=>G(r),...e}):s.jsx(V,{to:be(_.length)})})),be=(a=7)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e},at=(a,e,t,n,c,o,d)=>a!=null&&e!=null&&t!=null&&n!=null&&c!=null&&o!=null&&(n==="month"||n==="quarter")&&k(c,"YYYY-MM-DD").isValid()&&k(o,"YYYY-MM-DD").isValid()&&d!=null,nt=(a,e)=>a!=null&&a.endDate.isSame(e.endDate,"day")&&a.startDate.isBefore(e.startDate,"day")?p(a):p(e),ct=W((function(a,e){const t=ze(a.transactionState,a.transactionListState,e.selectedAccount.accountId,e.selectedAccount.accountType,e.selectedAccount.timeframe,e.selectedAccount.period),n=t.account?.coaId,c=e.isConnectedAccountProviderUnit&&we(n??"");return{accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,title:e.selectedAccount.title,timeframe:e.selectedAccount.timeframe,timePeriod:ae(e.selectedAccount.period),dataAvailableForPeriod:re(5,e.firstMonthOfFY),report:t,currentScrollYOffset:t.uiState?.scrollYOffset??0,showStatementPageIcon:c,isAccountingClassesEnabled:te(a)}}),(function(a,e){return{onBackClick:()=>{const t=se(e.location.state?.pathnameStackToGoBack),n=t.poppedPathname??ve();e.navigate(n,{state:{pathnameStackToGoBack:t.newStack}})},onTimePeriodChange:(t,n,c)=>{e.closeSidePanel?.();let o=n;t.startDate.isBefore(n.startDate,c)?o={startDate:t.startDate,endDate:n.endDate}:t.startDate.isAfter(n.endDate,c)?o={startDate:n.startDate,endDate:t.endDate}:console.error(`Invalid addTimePeriod ${JSON.stringify(t)}`),L.trackTransactionList(e.selectedAccount.accountId,void 0,e.referrerType,e.selectedAccount.title,void 0,!0),a(De({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,uiState:{dateRange:o}})),a(ge(e.selectedAccount.accountId,e.selectedAccount.accountType,p(o))),e.onSelectedTimePeriodChange(p(o))},onTransactionItemClick:t=>{if(e.openTransactionPanel)return void e.openTransactionPanel(t.id,t.type);const n=de(t,e.tenantEmailDomain),c=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(n,{state:{pathnameStackToGoBack:c}})},onTransactionListScroll:t=>{a(De({accountId:e.selectedAccount.accountId,accountType:e.selectedAccount.accountType,uiState:{scrollYOffset:t}}))},onStatementPageIconClick:()=>{const t=it(e.tenantEmailDomain),n=R(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(t,{state:{pathnameStackToGoBack:n}})}}}))(oe),ye=ie((function({referrerType:a,...e}){const t=K(),n=U(),c=X(),{tenantEmailDomain:o,accountTypeEncoded:d,accountIdEncoded:Y,timeframe:b,startDate:A,endDate:f,titleEncoded:T,excludeSubAccounts:v}=Q(),S=j(d??""),h=j(Y??""),I=j(T??""),x=!(v!=null&&v==="exclude_subaccounts"),F=g((D=>Ge(D.transactionListState,h,S))),[P,O]=y.useState(!1),[E,G]=y.useState(void 0),u=g((D=>q(D))),C=u.company?.featuresActivationInfo.connectedAccountProvider==="unit",l=u.company?.companyInfo.firstMonthOfFY??1;let m;const w=ot(S,h,b,A,f,I);if(w){const D={startDate:k(A,"YYYY-MM-DD"),endDate:k(f,"YYYY-MM-DD")},le=st(F?.dateRange,D);m={accountId:h,accountType:ee(S),title:I,timeframe:b,period:le}}let i=m;m!=null&&E!=null&&(i={...m,period:E});const{useFeatureGate:z}=ne(),B=y.useCallback(((D,le)=>{if(o==null)return;const ue=D.url.split(`/${o}/`)[1];if(ue==null)return;const[Ee,je]=ue.split("?"),H=new URLSearchParams(je??"");H.set("view","full"),H.set("thread_id",le),H.set("entity_type",D.entityType);const xe=R(n.state?.pathnameStackToGoBack,n.pathname);t(`/${o}/${Ee}?${H.toString()}`,{state:{pathnameStackToGoBack:xe}})}),[t,o,n.state,n.pathname]),{isFeatureEnabled:_}=z(ce.isProjectsTransactionsEnabled),r=g((D=>Z(D)))&&_,{areTenantIdsInSync:$}=Re();y.useEffect((()=>{!P&&m!=null&&$&&(O(!0),L.trackTransactionList(m.accountId,void 0,a,m.title),c(ge(m.accountId,m.accountType,m.period,void 0,!1,x)))}),[P,m,c,$]);const Pe=[d,Y,b,A,f,T].filter((D=>D!=null));return w&&i!=null?s.jsx(ct,{firstMonthOfFY:l,tenantEmailDomain:o,location:n,navigate:t,isConnectedAccountProviderUnit:C,onCommentThreadClick:B,showProjectField:r,selectedAccount:i,referrerType:a,onSelectedTimePeriodChange:D=>G(D),...e}):s.jsx(V,{to:ve(Pe.length)})})),ve=(a=7)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e},ot=(a,e,t,n,c,o)=>a!=null&&e!=null&&t!=null&&n!=null&&c!=null&&(t==="month"||t==="quarter")&&k(n,"YYYY-MM-DD").isValid()&&k(c,"YYYY-MM-DD").isValid()&&o!=null,st=(a,e)=>a!=null&&a.endDate.isSame(e.endDate,"day")&&a.startDate.isBefore(e.startDate,"day")?p(a):p(e),it=a=>`/${a}/transactions/${$e}/statements`;function Ct(){const a=U().state?.referrer,e=g((n=>n.expenseAutomationViewState.selectedPeriodByTenantId))[g((n=>q(n))).tenantId],t=_e();return s.jsxs(Me,{children:[s.jsx(M,{path:"/:accountTypeEncoded/:accountIdEncoded/:timeframe/:startDate/:endDate/:titleEncoded/:excludeSubAccounts/*",element:s.jsx(ye,{referrerType:a})}),s.jsx(M,{path:"/zeni-clearing-account/statements",element:s.jsx(Je,{})}),s.jsx(M,{path:"/*",element:s.jsx(ye,{referrerType:a})}),s.jsx(M,{path:"/uncategorized-income/*",element:s.jsx(N,{})}),s.jsx(M,{path:"/uncategorized-expense/*",element:s.jsx(N,{})}),s.jsx(M,{path:"/miscategorized-income/*",element:s.jsx(N,{})}),s.jsx(M,{path:"/miscategorized-expense/*",element:s.jsx(N,{})}),s.jsx(M,{path:"/missing-receipts/*",element:t?s.jsx(V,{to:`../../month_end_close_checks/review/missing_receipts/${e.month}-${e.year}`}):s.jsx(N,{})}),s.jsx(M,{path:"/by-class/:accountTypeEncoded/:accountIdEncoded/:classIdEncoded/:timeframe/:startDate/:endDate/:titleEncoded/*",element:s.jsx(Qe,{referrerType:a})}),s.jsx(M,{path:"/by-project/:accountTypeEncoded/:accountIdEncoded/:projectIdEncoded/:timeframe/:startDate/:endDate/:titleEncoded/*",element:s.jsx(tt,{referrerType:a})})]})}export{Ct as default};