@zeniai/web-app-ui 5.4.10-dev → 5.4.11-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 (153) hide show
  1. package/dist/assets/{AccountMappingScreen-BT4O8HTD.js → AccountMappingScreen-CMj3JkGt.js} +2 -2
  2. package/dist/assets/ActualMatchingMatchDetailScreen-Dd_vJSSr.js +1 -0
  3. package/dist/assets/AddressRoutes-7FdlQcLM.js +1 -0
  4. package/dist/assets/AddressScreen-BbgME8aO.js +9 -0
  5. package/dist/assets/{AiCfoScreen-RbcUBAdM.js → AiCfoScreen-CU1e2Oi8.js} +5 -5
  6. package/dist/assets/{AppDrawer-Sa4LLULj.js → AppDrawer-Dm9C8j__.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-BbNV-MR5.js → BillPayApprovalRoutes-GN_PKZBM.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-uNYLvj5o.js → BillPayRoutes-7abJ7Y81.js} +8 -8
  9. package/dist/assets/{BusinessVerificationPageScreen-ibSIK2nI.js → BusinessVerificationPageScreen-8VbyEZWD.js} +2 -2
  10. package/dist/assets/CardsAiCfoScreen-BcEHiZtA.js +14 -0
  11. package/dist/assets/{ChargeCardRoutes-CO87Ou5-.js → ChargeCardRoutes-BR5_qY8y.js} +9 -9
  12. package/dist/assets/CompanyPassportScreen-L6OY8AwA.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-F-iZ536h.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-Gnqx1b1N.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-BynW3iC3.js → CustomerOnboardingRoutes-3OH4ZWPk.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-ndbO6Qws.js → DashboardRoutes-X31R7cQf.js} +4 -4
  17. package/dist/assets/{DefaultTenantHome-2hNb0a3U.js → DefaultTenantHome-FpeIWNLr.js} +1 -1
  18. package/dist/assets/DomesticWireDetailScreen-BZbvzqXc.js +18 -0
  19. package/dist/assets/{DrawerScreen-b7QdOhuW.js → DrawerScreen-CmgVB1Zi.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-5IMi-E-b.js +1 -0
  21. package/dist/assets/{ExpenseAutomationRoutes-C6_zyg5Q.js → ExpenseAutomationRoutes-DH5uN2wQ.js} +6 -6
  22. package/dist/assets/{FeaturePreviewScreen-B5U7lEG-.js → FeaturePreviewScreen-Cnh2Fe6t.js} +1 -1
  23. package/dist/assets/HubSpotOAuthCallbackScreen-C94ZBMtd.js +1 -0
  24. package/dist/assets/InboxNotificationsProvider-CJt6vmnU.js +1 -0
  25. package/dist/assets/{InvoicingRoutes-C4zfN1Wc.js → InvoicingRoutes-Q-6aUqgu.js} +2 -2
  26. package/dist/assets/{MagicLinkRoutes-BDl3Flj2.js → MagicLinkRoutes-CR6ShXCQ.js} +20 -20
  27. package/dist/assets/MagicLinkSignInScreen-CBjgwG_1.js +12 -0
  28. package/dist/assets/{MobileAppDrawer-DVldqyUl.js → MobileAppDrawer-B4_Hh2uX.js} +1 -1
  29. package/dist/assets/NotFoundScreen-CxVO6BUm.js +1 -0
  30. package/dist/assets/{NotificationRoutes-UAhv091T.js → NotificationRoutes-CDa5TISi.js} +1 -1
  31. package/dist/assets/OAuthConsentScreen-D8WvwiVN.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-CiaozOzI.js +1 -0
  33. package/dist/assets/PaymentLinkScreen-BN13u2tw.js +21 -0
  34. package/dist/assets/PeopleRoutes-B5eZw1Xs.js +22 -0
  35. package/dist/assets/PerformanceRoutes-B5KqyHoS.js +1 -0
  36. package/dist/assets/{Preview-CU7aguP4.js → Preview-gj_-pUjR.js} +1 -1
  37. package/dist/assets/QBOConnectionScreen-BD6w4pxT.js +101 -0
  38. package/dist/assets/{ReimbursementApprovalRoutes-DrsMWkl8.js → ReimbursementApprovalRoutes-_wQ1m-SZ.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-Dw7QQEoQ.js → ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-mHGAbMEo.js +68 -0
  41. package/dist/assets/{ReportsRoutes-B5lACyrL.js → ReportsRoutes-DNdr9gVu.js} +1 -1
  42. package/dist/assets/RewardsRoutes-CRQaDmuu.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-LwZh192V.js → ScheduleDetailsPrepaidExpensesScreen-Bgrqk-Br.js} +5 -5
  44. package/dist/assets/ScreenRoutes-Cix6ynkH.js +2 -0
  45. package/dist/assets/{SettingsRoutes-DEHUtOgG.js → SettingsRoutes-CXzUd0P6.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-Dv6lGRG5.js → SetupPagesScreen-DzLiX5R5.js} +5 -5
  47. package/dist/assets/SignInScreen-VX0iUVME.js +1 -0
  48. package/dist/assets/SignOutScreen-BXVxv4o-.js +9 -0
  49. package/dist/assets/{TaskListScreen-8hq6cEbk.js → TaskListScreen-Dv5TjArL.js} +2 -2
  50. package/dist/assets/TaskRoutes-aDI7RZCK.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-C0gGgGik.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-It6ORIbN.js → TransactionDetailScreen-BsGN3Yd5.js} +2 -2
  53. package/dist/assets/{TransactionListRoutes-BTjkHFVX.js → TransactionListRoutes-_bc9UoMG.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-Bys8F57E.js → TreasuryRoutes-C7ABXX2A.js} +6 -6
  55. package/dist/assets/{VendorsRoutes-abjQ1HGQ.js → VendorsRoutes-BlorNbi4.js} +11 -11
  56. package/dist/assets/WiseConfirmationScreen-DhPTIeWc.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-DlvpS2Bq.js → ZeniAccountRoutes-QObrERl4.js} +11 -11
  58. package/dist/assets/ZeniAccountStatementScreen-BHlw6cTG.js +9 -0
  59. package/dist/assets/{accountMappingHelper-C9fFA6EC.js → accountMappingHelper-BbISzw1n.js} +1 -1
  60. package/dist/assets/{analytics-C3OBHjEG.js → analytics-C4ICDJLl.js} +1 -1
  61. package/dist/assets/{analyticsHelper-exrV7AE9.js → analyticsHelper-CPHVprda.js} +1 -1
  62. package/dist/assets/{core-o-ca34AJ.js → core-C4Vfz6Ll.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-CdLVPaCS.js → decodeURIComponentSafe-CYsmEPcV.js} +1 -1
  64. package/dist/assets/{dnd-sqKp8sUm.js → dnd-kAQqqaX2.js} +1 -1
  65. package/dist/assets/{empty-CynSKeaU.js → empty-asCy4wrm.js} +1 -1
  66. package/dist/assets/{empty-BnmFWJHQ.js → empty-uRyODf4S.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-BUTaximG.js → emptyVideoElement-79iYt27c.js} +1 -1
  68. package/dist/assets/epic-B2pHLhBD.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-hmRJBbGd.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-CBmE-ohA.js → getLocaleForTenant-DJIJUZ-c.js} +1 -1
  71. package/dist/assets/{index-BLrePuqf.js → index-BTd7WWV0.js} +1 -1
  72. package/dist/assets/{index-Btt0Zihe.js → index-B_kv_EmZ.js} +1 -1
  73. package/dist/assets/{index-Bqod5kmp.js → index-Bg8f4cim.js} +1 -1
  74. package/dist/assets/{index-Bx2gJO4r.js → index-CJ_pjNEa.js} +7 -7
  75. package/dist/assets/{index-j2p4Lnj3.js → index-Doknm_HP.js} +1 -1
  76. package/dist/assets/index-E3novWwq.js +1 -0
  77. package/dist/assets/{index-D4vHXZ_y.js → index-UMoTq5JU.js} +2 -2
  78. package/dist/assets/index-pA4BduR_.js +1 -0
  79. package/dist/assets/{lexical-CEO4_NFb.js → lexical-SeD-pdYj.js} +1 -1
  80. package/dist/assets/liveblocks-DZUXZ-JO.js +59 -0
  81. package/dist/assets/{lottie-Dl8uwTmw.js → lottie-txhqSe8x.js} +1 -1
  82. package/dist/assets/{mui-cK5UWUvi.js → mui-C0PYnbt1.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bk8jMuE9.js → pathToGoBack-DF1y-0ht.js} +1 -1
  84. package/dist/assets/{pdf-BNJo5ucI.js → pdf-bOGTjHnz.js} +5 -5
  85. package/dist/assets/{pdf-lib-C69QvBGc.js → pdf-lib-BsfRp21l.js} +1 -1
  86. package/dist/assets/{plaid-C8bTkbCG.js → plaid-hQES7k9Y.js} +1 -1
  87. package/dist/assets/{pusher-C6PXikRK.js → pusher-BoH5mrch.js} +1 -1
  88. package/dist/assets/{react-BgHw6ZMD.js → react-BQ6jUfzX.js} +1 -1
  89. package/dist/assets/{react-BCP4YdKf.js → react-BgJrrMxk.js} +1 -1
  90. package/dist/assets/{react-BfzBm-jN.js → react-Boil267a.js} +1 -1
  91. package/dist/assets/{react-CTNewL67.js → react-DXSBT-1v.js} +1 -1
  92. package/dist/assets/{react-UiIuY6Fo.js → react-ZM05SSz2.js} +1 -1
  93. package/dist/assets/{react-ixvlVzZ9.js → react-qLaRPrw4.js} +1 -1
  94. package/dist/assets/{recharts-DK1tbN_A.js → recharts-rN5v_P87.js} +1 -1
  95. package/dist/assets/{reportTimeframe-6FnDbaGY.js → reportTimeframe-C5AD1AL2.js} +1 -1
  96. package/dist/assets/{routePaths-DBf4ybcn.js → routePaths-DYebh4Li.js} +1 -1
  97. package/dist/assets/{sentry-Buwow292.js → sentry-DfoGRlTp.js} +1 -1
  98. package/dist/assets/{stripSplatSuffix-BKbpznmZ.js → stripSplatSuffix-Db8ayksN.js} +1 -1
  99. package/dist/assets/{url-B_oojQRK.js → url-B-JScRaX.js} +1 -1
  100. package/dist/assets/{url-C7oPARVv.js → url-BtS-4pap.js} +1 -1
  101. package/dist/assets/{useActualMatchingMatchDetail-DBoUtV2d.js → useActualMatchingMatchDetail-DPtaMcdm.js} +1 -1
  102. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-D_VhexUa.js → useAiCfoDashboardSuggestedQuestionsChips-D2InIpSO.js} +1 -1
  103. package/dist/assets/useAskAiCfoHostNavButtonProps-k11tYjVi.js +1 -0
  104. package/dist/assets/{useChargeCardPusherEvents-B6OwhCNo.js → useChargeCardPusherEvents-Bf7Vv0PE.js} +1 -1
  105. package/dist/assets/{useDeviceId-CeB6LWI8.js → useDeviceId-_3Ay4Sah.js} +1 -1
  106. package/dist/assets/useEmailConnectResultRefresh-BCLtP2Ad.js +1 -0
  107. package/dist/assets/useEnsureVendorListLoaded-Bud-c91I.js +1 -0
  108. package/dist/assets/{useInitialThreadRequest-C3w5IRp7.js → useInitialThreadRequest-BVMcY486.js} +1 -1
  109. package/dist/assets/useTaskManagerAccess-Cp8R2Cu9.js +1 -0
  110. package/dist/assets/{useTaskManagerPusherEvents-LOx5aVW8.js → useTaskManagerPusherEvents-p1TIydvw.js} +1 -1
  111. package/dist/assets/utils-CmKqkYr5.js +36 -0
  112. package/dist/assets/{withTransactionSidePanel-CVCleugc.js → withTransactionSidePanel-btBdqPWA.js} +5 -5
  113. package/dist/assets/{zeni-epic-state-MQ0qdl-Q.js → zeni-epic-state-DmXGRK_Y.js} +4 -4
  114. package/dist/index.html +1 -1
  115. package/package.json +1 -1
  116. package/dist/assets/ActualMatchingMatchDetailScreen-Ce_XDU4u.js +0 -1
  117. package/dist/assets/AddressRoutes-BQEPn0Yr.js +0 -1
  118. package/dist/assets/AddressScreen-D2FVWJY-.js +0 -9
  119. package/dist/assets/CardsAiCfoScreen-CkEc2DEo.js +0 -14
  120. package/dist/assets/CompanyPassportScreen-DJeoMdCg.js +0 -1
  121. package/dist/assets/ConnectionAuthScreen-Bf2Ucb1Q.js +0 -11
  122. package/dist/assets/CustomerOnboardingAuthScreen-D3RbfqTk.js +0 -1
  123. package/dist/assets/DomesticWireDetailScreen-BqDioG6P.js +0 -18
  124. package/dist/assets/EntityDetailRoutes-aGFvyTv5.js +0 -1
  125. package/dist/assets/HubSpotOAuthCallbackScreen-Dr1Xep8u.js +0 -1
  126. package/dist/assets/InboxNotificationsProvider-Cph6MP0g.js +0 -1
  127. package/dist/assets/MagicLinkSignInScreen-Bie6nkkJ.js +0 -12
  128. package/dist/assets/NotFoundScreen-BXfz4Cwt.js +0 -1
  129. package/dist/assets/OAuthConsentScreen-yv2un5zc.js +0 -1
  130. package/dist/assets/PandLWithForecastRoutes-DZO_Ak_R.js +0 -1
  131. package/dist/assets/PaymentLinkScreen-DgjQbdJS.js +0 -21
  132. package/dist/assets/PeopleRoutes-CBBW0nYr.js +0 -22
  133. package/dist/assets/PerformanceRoutes-CIoRY1pR.js +0 -1
  134. package/dist/assets/QBOConnectionScreen-CI47ZrlS.js +0 -100
  135. package/dist/assets/ReimbursementRoutes-BiacT-VJ.js +0 -68
  136. package/dist/assets/RewardsRoutes-26PBDRkk.js +0 -1
  137. package/dist/assets/ScreenRoutes-CdEeBqiV.js +0 -2
  138. package/dist/assets/SignInScreen-CzvdRg4U.js +0 -1
  139. package/dist/assets/SignOutScreen-DfTRMdjb.js +0 -9
  140. package/dist/assets/TaskRoutes-C1KzEFV7.js +0 -9
  141. package/dist/assets/TransactionDetailRoutes-BB45JvGj.js +0 -1
  142. package/dist/assets/WiseConfirmationScreen-DewxnFTy.js +0 -12
  143. package/dist/assets/ZeniAccountStatementScreen-DVR6RIK2.js +0 -9
  144. package/dist/assets/epic-bBvrG0DE.js +0 -2
  145. package/dist/assets/expenseAutomationHelper-8n6GRk1T.js +0 -1
  146. package/dist/assets/index-BzW-Y7Lk.js +0 -1
  147. package/dist/assets/index-Cmb8jqqj.js +0 -1
  148. package/dist/assets/liveblocks-BdMPZzDQ.js +0 -59
  149. package/dist/assets/useAskAiCfoHostNavButtonProps-B6lOnQ69.js +0 -1
  150. package/dist/assets/useEmailConnectResultRefresh-t37-D3lN.js +0 -1
  151. package/dist/assets/useEnsureVendorListLoaded-BmranjK0.js +0 -1
  152. package/dist/assets/useTaskManagerAccess-By_NjZen.js +0 -1
  153. package/dist/assets/utils-D4KfE2cr.js +0 -36
@@ -1 +1 @@
1
- import{j as r}from"./liveblocks-BdMPZzDQ.js";import z from"./NotFoundScreen-BXfz4Cwt.js";import{a as p}from"./sentry-Buwow292.js";import{h as C,g as D,u as V,j as u,N as k,l as O,n as K,o as h}from"./core-o-ca34AJ.js";import{fI as E,_9 as b,_r as w,Oi as U,Oe as L,Oh as f,O7 as N,_Q as B,Ob as Q,Ok as q}from"./zeni-epic-state-MQ0qdl-Q.js";import{z as _,w as T,cc as F,x as $,bV as G,cd as H}from"./index-Bx2gJO4r.js";import"./mui-cK5UWUvi.js";import{u as J}from"./useEnsureVendorListLoaded-BmranjK0.js";import{R as x}from"./ReimbursementApprovalRuleDetailScreen-Dw7QQEoQ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="02c3e997-adf3-48d6-a932-67c3e01f8fd4",e._sentryDebugIdIdentifier="sentry-dbid-02c3e997-adf3-48d6-a932-67c3e01f8fd4")}catch{}})();const j="reimbursement-approval-rule-update",M=O((function(e){return{approvalView:b(e),remiSetupApproverViewUpdateData:w(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(j)&&e(B(!1))},onBackClick:()=>{$(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(N(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))(T(F)),P=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>b(o))),g=u((o=>w(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{g?.updateStatus.fetchState==="Completed"&&a(U())}),[g]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!1)))}),[t,S,e,a]),_.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(R(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${j}`]:[],eventCallback:(o,y,I)=>{o.endsWith(j)&&I.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(M,{currentTenant:c,location:n,navigate:s,...m})},A="reimbursement-approval-rule-update",X=O((function(e){const s=b(e),n=w(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e(B(!1))},onBackClick:()=>{$(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(N(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(q(t,!0))}}}))(T(H)),Y=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=G(e?.tenantId);return s?r.jsx(Z,{isLoading:n}):r.jsx(P,{isLoading:n})},Z=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),g=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>b(i)));J();const y=u((i=>w(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(U())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||g!=="Not-Started"||e||(R(!0),a(Q(!1,!0)))}),[v,g,e,a]),_.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(f())),s("./new"))}),[S,o,a]);const I={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${A}`]:[],eventCallback:(i,ee,W)=>{i.endsWith(A)&&W.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(X,{currentTenant:m,location:n,navigate:s,isLoading:e,...I})};function ue(){return r.jsxs(K,{children:[r.jsx(h,{path:"/",element:r.jsx(Y,{})}),r.jsx(h,{path:"/new",element:r.jsx(x,{})}),r.jsx(h,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(h,{path:"*",element:r.jsx(z,{})})]})}export{ue as R};
1
+ import{j as r}from"./liveblocks-DZUXZ-JO.js";import z from"./NotFoundScreen-CxVO6BUm.js";import{a as p}from"./sentry-DfoGRlTp.js";import{h as C,g as D,u as V,j as u,N as k,l as O,n as K,o as b}from"./core-C4Vfz6Ll.js";import{fE as E,_5 as h,_n as w,Oe as U,Oa as L,Od as f,O3 as N,_M as B,O7 as M,Og as q}from"./zeni-epic-state-DmXGRK_Y.js";import{z as _,w as T,cc as F,x as $,bV as G,cd as H}from"./index-CJ_pjNEa.js";import"./mui-C0PYnbt1.js";import{u as J}from"./useEnsureVendorListLoaded-Bud-c91I.js";import{R as x}from"./ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="248a537f-75b8-4b0e-a06a-51e788334f58",e._sentryDebugIdIdentifier="sentry-dbid-248a537f-75b8-4b0e-a06a-51e788334f58")}catch{}})();const j="reimbursement-approval-rule-update",P=O((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:w(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(j)&&e(B(!1))},onBackClick:()=>{$(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(N(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))(T(F)),Q=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),g=u((o=>w(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{g?.updateStatus.fetchState==="Completed"&&a(U())}),[g]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!1)))}),[t,S,e,a]),_.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(R(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${j}`]:[],eventCallback:(o,y,I)=>{o.endsWith(j)&&I.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(P,{currentTenant:c,location:n,navigate:s,...m})},A="reimbursement-approval-rule-update",X=O((function(e){const s=h(e),n=w(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e(B(!1))},onBackClick:()=>{$(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(N(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(q(t,!0))}}}))(T(H)),Y=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=G(e?.tenantId);return s?r.jsx(Z,{isLoading:n}):r.jsx(Q,{isLoading:n})},Z=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),g=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>h(i)));J();const y=u((i=>w(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(U())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||g!=="Not-Started"||e||(R(!0),a(M(!1,!0)))}),[v,g,e,a]),_.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(f())),s("./new"))}),[S,o,a]);const I={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${A}`]:[],eventCallback:(i,ee,W)=>{i.endsWith(A)&&W.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(X,{currentTenant:m,location:n,navigate:s,isLoading:e,...I})};function ue(){return r.jsxs(K,{children:[r.jsx(b,{path:"/",element:r.jsx(Y,{})}),r.jsx(b,{path:"/new",element:r.jsx(x,{})}),r.jsx(b,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(b,{path:"*",element:r.jsx(z,{})})]})}export{ue as R};
@@ -1 +1 @@
1
- import{j as g}from"./liveblocks-BdMPZzDQ.js";import{a as y}from"./sentry-Buwow292.js";import{h as U,u as x,g as C,i as V,j as R,l as k}from"./core-o-ca34AJ.js";import{_r as _,_9 as O,Oa as j,On as B,Oi as A,Oj as E,_s as F,fI as K,Oh as L}from"./zeni-epic-state-MQ0qdl-Q.js";import{z as N,a6 as P,c3 as W,x as $,bV as G,c4 as H}from"./index-Bx2gJO4r.js";import{u as q}from"./mui-cK5UWUvi.js";import{u as J}from"./useEnsureVendorListLoaded-BmranjK0.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="a1ac6167-a07a-40f7-895b-28b1843db551",e._sentryDebugIdIdentifier="sentry-dbid-a1ac6167-a07a-40f7-895b-28b1843db551")}catch{}})();const M=k((function(e,p){const t=_(e),o=t.remiSetupApproverViewUpdateData?.type??"approval_create",s=o==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return p.approvalRuleId&&(i=t.allApprovalRules.findIndex((r=>r.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:s,isLowerBoundDisabled:i,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:s,approvalRuleId:i}=p,r=o.remiSetupApproverViewUpdateData?.type,l=$(p.location);return{onApprovalRuleDataUpdated:a=>{const d=v=>{const h=[];return v.forEach((u=>{const I=u.actors.selectedUsers.map((m=>({type:"user",subType:void 0,userId:m.userId,idType:"user",isImplicitActor:!1}))),b=u.actors.selectedNonUsers.map((m=>{const f=(S=m.value,F(S)==null);var S;return{type:f?"attribute":"role",subType:m.value,userId:void 0,idType:void 0,isImplicitActor:!f}})),c=I.concat(b);h.push({action:u.stepType.selectedOption,actors:c,operator:c.length>1?u.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),h},n={amount:{type:"amount",comparator:"range",min:{amount:a.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:a.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const v={criteria:n,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}else{const v={approvalRuleId:i,criteria:n,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(W);function Q(){const e=U(),p=x(),t=C(),{approvalRuleId:o}=V(),s=N.getSignedInUser(),i=q(),r=R((n=>_(n))),l=R((n=>O(n))),[a,d]=y.useState(!1);if(y.useEffect((()=>{a||(d(!0),p(j(!0)))})),y.useEffect((()=>{l.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[l,o]),s==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?g.jsx(P,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):g.jsx(M,{navigate:e,approvalUpdateDataView:r,approvalRuleId:o,approverViewData:l,location:t})}function se(e){return F(e)==null}const X=k((function(e,p){const t=_(e),o=t.remiSetupApproverViewUpdateData?.type??"approval_create",s=[],i={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(s.push(r.id),i[r.id]=r.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:s,vendorNamesById:i,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:O(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:s,approvalRuleId:i}=p,r=o.remiSetupApproverViewUpdateData?.type,l=$(p.location);return{onApprovalRuleDataUpdated:a=>{const d=c=>{const m=[];return c.forEach((f=>{const S=f.actorKind?.selectedOption,z=f.selectedRole?.selectedNonUsers??[];let D=[];S==="role"?D=z.map((w=>({type:"attribute",subType:w.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):S==="specific_person"&&(D=(f.persons?.selectedUsers??[]).map((w=>({type:"user",subType:void 0,userId:w.userId,idType:"user",isImplicitActor:!1}))));const T=f.action??"require_approval";m.push({action:T,actors:D,operator:D.length>1?T==="require_approval"?"or":"and":"is"})})),m},n=a.amountCriteria,v=a.vendorCriteria,h=a.departmentCriteria,u={};if(n!=null&&n.comparator.selectedOption!=null){const c=n.comparator.selectedOption;u.amount={type:"amount",comparator:c,min:c==="less_than"?void 0:n.min,max:c==="greater_than"?void 0:n.max}}const I=v?.selection.selectedOptions??[];I.length>0&&(u.vendor={type:"vendor",operator:v?.operator.selectedOption??"is",vendorIds:I});const b=h?.selection.selectedOptions??[];if(b.length>0&&(u.department={type:"department",operator:h?.operator.selectedOption??"is",departmentIds:b}),r==="approval_create"){const c={name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:u,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}else{const c={approvalRuleId:i,name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:u,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:a=>{e(L(a)),t(r==="approval_update"?`../../${a}/edit`:`../${a}/edit`)}}}))(H);function ne(){const e=R((t=>K(t))),{isApprovalRulesV3Enabled:p}=G(e?.tenantId);return p?g.jsx(Y,{}):g.jsx(Q,{})}function Y(){const e=U(),p=x(),t=C(),{approvalRuleId:o}=V(),s=N.getSignedInUser(),i=q(),r=R((n=>_(n))),l=R((n=>O(n))),[a,d]=y.useState(!1);if(J(),y.useEffect((()=>{a||(d(!0),p(j(!1)))})),y.useEffect((()=>{l.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[l,o]),s==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?g.jsx(P,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):g.jsx(X,{navigate:e,approvalUpdateDataView:r,approvalRuleId:o,approverViewData:l,location:t},o??"new")}export{ne as R,se as i};
1
+ import{j as g}from"./liveblocks-DZUXZ-JO.js";import{a as y}from"./sentry-DfoGRlTp.js";import{h as U,u as x,g as C,i as V,j as R,l as k}from"./core-C4Vfz6Ll.js";import{_n as _,_5 as O,O6 as j,Oj as B,Oe as A,Of as E,_o as F,fE as K,Od as L}from"./zeni-epic-state-DmXGRK_Y.js";import{z as N,a6 as P,c3 as W,x as $,bV as G,c4 as H}from"./index-CJ_pjNEa.js";import{u as q}from"./mui-C0PYnbt1.js";import{u as J}from"./useEnsureVendorListLoaded-Bud-c91I.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]="98f36186-6368-4850-a7c1-cf21b7694019",e._sentryDebugIdIdentifier="sentry-dbid-98f36186-6368-4850-a7c1-cf21b7694019")}catch{}})();const M=k((function(e,o){const t=_(e),p=t.remiSetupApproverViewUpdateData?.type??"approval_create",s=p==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return o.approvalRuleId&&(i=t.allApprovalRules.findIndex((r=>r.approvalRuleId===o.approvalRuleId))===0),{localData:t,hideUpperBoundField:s,isLowerBoundDisabled:i,approvalUpdateActionType:p}}),(function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:s,approvalRuleId:i}=o,r=p.remiSetupApproverViewUpdateData?.type,l=$(o.location);return{onApprovalRuleDataUpdated:a=>{const d=v=>{const h=[];return v.forEach((u=>{const I=u.actors.selectedUsers.map((m=>({type:"user",subType:void 0,userId:m.userId,idType:"user",isImplicitActor:!1}))),b=u.actors.selectedNonUsers.map((m=>{const f=(S=m.value,F(S)==null);var S;return{type:f?"attribute":"role",subType:m.value,userId:void 0,idType:void 0,isImplicitActor:!f}})),c=I.concat(b);h.push({action:u.stepType.selectedOption,actors:c,operator:c.length>1?u.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),h},n={amount:{type:"amount",comparator:"range",min:{amount:a.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:a.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const v={criteria:n,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}else{const v={approvalRuleId:i,criteria:n,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(W);function Q(){const e=U(),o=x(),t=C(),{approvalRuleId:p}=V(),s=N.getSignedInUser(),i=q(),r=R((n=>_(n))),l=R((n=>O(n))),[a,d]=y.useState(!1);if(y.useEffect((()=>{a||(d(!0),o(j(!0)))})),y.useEffect((()=>{l.fetchState==="Not-Started"&&e(p!=null?"../../":"../")}),[l,p]),s==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?g.jsx(P,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):g.jsx(M,{navigate:e,approvalUpdateDataView:r,approvalRuleId:p,approverViewData:l,location:t})}function se(e){return F(e)==null}const X=k((function(e,o){const t=_(e),p=t.remiSetupApproverViewUpdateData?.type??"approval_create",s=[],i={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(s.push(r.id),i[r.id]=r.name);return{localData:t,approvalUpdateActionType:p,allVendorIds:s,vendorNamesById:i,editingRuleId:p==="approval_update"?o.approvalRuleId:void 0,allApprovalRulesWithUser:O(e).allApprovalRules}}),(function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:s,approvalRuleId:i}=o,r=p.remiSetupApproverViewUpdateData?.type,l=$(o.location);return{onApprovalRuleDataUpdated:a=>{const d=c=>{const m=[];return c.forEach((f=>{const S=f.actorKind?.selectedOption,z=f.selectedRole?.selectedNonUsers??[];let D=[];S==="role"?D=z.map((w=>({type:"attribute",subType:w.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):S==="specific_person"&&(D=(f.persons?.selectedUsers??[]).map((w=>({type:"user",subType:void 0,userId:w.userId,idType:"user",isImplicitActor:!1}))));const T=f.action??"require_approval";m.push({action:T,actors:D,operator:D.length>1?T==="require_approval"?"or":"and":"is"})})),m},n=a.amountCriteria,v=a.vendorCriteria,h=a.departmentCriteria,u={};if(n!=null&&n.comparator.selectedOption!=null){const c=n.comparator.selectedOption;u.amount={type:"amount",comparator:c,min:c==="less_than"?void 0:n.min,max:c==="greater_than"?void 0:n.max}}const I=v?.selection.selectedOptions??[];I.length>0&&(u.vendor={type:"vendor",operator:v?.operator.selectedOption??"is",vendorIds:I});const b=h?.selection.selectedOptions??[];if(b.length>0&&(u.department={type:"department",operator:h?.operator.selectedOption??"is",departmentIds:b}),r==="approval_create"){const c={name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:u,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}else{const c={approvalRuleId:i,name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:u,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):s.allApprovalRules.length===0&&s.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:a=>{e(L(a)),t(r==="approval_update"?`../../${a}/edit`:`../${a}/edit`)}}}))(H);function ne(){const e=R((t=>K(t))),{isApprovalRulesV3Enabled:o}=G(e?.tenantId);return o?g.jsx(Y,{}):g.jsx(Q,{})}function Y(){const e=U(),o=x(),t=C(),{approvalRuleId:p}=V(),s=N.getSignedInUser(),i=q(),r=R((n=>_(n))),l=R((n=>O(n))),[a,d]=y.useState(!1);if(J(),y.useEffect((()=>{a||(d(!0),o(j(!1)))})),y.useEffect((()=>{l.fetchState==="Not-Started"&&e(p!=null?"../../":"../")}),[l,p]),s==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?g.jsx(P,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):g.jsx(X,{navigate:e,approvalUpdateDataView:r,approvalRuleId:p,approverViewData:l,location:t},p??"new")}export{ne as R,se as i};
@@ -0,0 +1,68 @@
1
+ import{j as s}from"./liveblocks-DZUXZ-JO.js";import{u as ae,j as v,h as Q,g as Y,i as ie,N,l as ee,q as lt,n as mt,o as x}from"./core-C4Vfz6Ll.js";import{fE as H,Oa as ct,$S as ge,c6 as he,Ng as Fe,ma as dt,Nv as ce,Nu as de,$T as ut,bj as fe,gV as Le,$U as pt,XC as bt,l$ as $e,XD as ke,XE as gt,kN as ht,ZT as ft,l0 as St,N4 as It,CA as yt,kU as At,NR as Ne,$V as Pe,$W as Ce,$X as Rt,$Y as vt,$Z as kt,NB as Ee,l6 as Ct,_0 as Et,Nt as wt,Ne as xt,$_ as Bt,Nd as Tt,$$ as Dt,Nl as we,NF as jt,NE as Ut,NA as Ft,a00 as _e,S$ as Lt,bk as $t,No as Nt,O7 as Pt,a01 as _t,a02 as Mt,NN as Ot,NK as xe,Zn as Zt,Nb as zt,a03 as Me,OA as Be,OI as Gt,a04 as Vt,a05 as X,a06 as Ht,a07 as Oe,a08 as Wt,a09 as Ze,a0a as ze,NZ as ue,br as qt,bI as Se,cK as Ie,dZ as Ge,dY as Ve,a0b as Xt,gg as Kt,ZA as Yt,a0c as Jt,a0d as He,ZE as Qt,_n as en,a0e as tn,_M as nn,OF as Te,OE as an,a0f as sn,a0g as on,a0h as rn,a0i as ln,a0j as mn,_6 as cn,Ov as dn,Oz as un,bm as pn,bH as bn,cE as gn,cs as hn,bq as fn,U$ as Sn,d8 as In,db as yn,da as An,cD as Rn}from"./zeni-epic-state-DmXGRK_Y.js";import{bV as vn,g as We,a0 as qe,p as oe,c as F,z as L,cT as Xe,a7 as re,m as w,aR as De,K as j,ad as se,ae as kn,G as Ke,cU as Cn,n as K,ar as Ye,cV as En,V as le,cW as wn,ap as xn,aa as Bn,a6 as ye,S as Je,w as Tn,bD as Dn,au as jn,ah as Un,cX as Fn,j as Ln}from"./index-CJ_pjNEa.js";import{n as P,S as $n,u as Qe}from"./mui-C0PYnbt1.js";import pe from"./NotFoundScreen-CxVO6BUm.js";import{S as je}from"./SetupPagesScreen-DzLiX5R5.js";import{F as et}from"./FeaturePreviewScreen-Cnh2Fe6t.js";import{a as g}from"./sentry-DfoGRlTp.js";import{u as Ae}from"./useAskAiCfoHostNavButtonProps-k11tYjVi.js";import{u as tt}from"./useInitialThreadRequest-BVMcY486.js";import{D as Nn}from"./DrawerScreen-CmgVB1Zi.js";import{M as nt}from"./MobileAppDrawer-B4_Hh2uX.js";import{F as Pn}from"./ScreenRoutes-Cix6ynkH.js";import{R as _n}from"./ReimbursementApprovalRoutes-_wQ1m-SZ.js";import"./recharts-rN5v_P87.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./utils-CmKqkYr5.js";import"./BusinessVerificationPageScreen-8VbyEZWD.js";import"./routePaths-DYebh4Li.js";import"./analyticsHelper-CPHVprda.js";import"./InboxNotificationsProvider-CJt6vmnU.js";import"./useTaskManagerAccess-Cp8R2Cu9.js";import"./getLocaleForTenant-DJIJUZ-c.js";import"./useEnsureVendorListLoaded-Bud-c91I.js";import"./ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.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]="b0adaa4c-3674-4275-bbd7-fb8720a318a5",e._sentryDebugIdIdentifier="sentry-dbid-b0adaa4c-3674-4275-bbd7-fb8720a318a5")}catch{}})();const at=e=>`/${e}/reimbursements`,Mn=e=>g.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},g.createElement("path",{d:"M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{d:"M12.5 12.5L3.5 3.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),{common:q,spendManagement:{reimbursement:{reimbursementDetail:ne}}}=Ke.getLocalizedStrings(),On=ee((function(e,t){const n=t.currentTenant?.companyId,r=ut(e.plaidAccountViewState,"user_reimbursement_account"),m=L.getSignedInUser(),c=fe(m),d=r.plaidConnectionDetails,i=Le(e.companyState,n),a=e.tenantState.currentTenantId,o={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:a??""},l=ge(e,t.reimbursementId),p=pt(e,m?.userId??"");let I=`${m?.firstName} ${m?.lastName}`,u=!0;t.reimbursementId!=null&&(I=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`,u=m?.userId===l.createdBy?.userId);const T=e.entityAutoCompleteState?.autoCompleteText?.common,y=bt(e,"common");return{remiDetails:l,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,reimbursementId:t.reimbursementId,customerSearchAutoCompleteData:{autoCompleteText:T,entityAutoCompleteView:y},authParams:o,defaultCurrency:{currencySymbol:i?.company.companyLocaleInfo.currencySymbol??"$",currencyCode:i?.company.companyLocaleInfo.currencyCode??"USD"},companyMileageConfigInfo:i?.company.configInfo.mileageRateConfig,createdBy:I,isUserAdmin:he(t.currentTenant?.userRole??[]),isZeniUser:c,plaidConnectionDetails:d,bankNameByRouting:l.bankNameByRouting,bankAccountCreationState:p.bankAccountCreationState,bankAccounts:p.bankAccounts,analytics:w,bankAccountToCreate:l.bankAccountToCreate,fetchBankNameByRoutingStatus:l.fetchBankNameByRoutingStatus,isSignedInUserReimbursementCreator:u,disableInternalOverlay:t.disableInternalOverlay,showSkipAutoFill:t.showSkipAutoFill,setShowSkipAutoFill:t.setShowSkipAutoFill,isAccountingClassesEnabled:$e(e)}}),(function(e,t){const{reimbursementId:n,currentTenant:r,location:m,navigate:c,themeState:d}=t,{tenantEmailDomain:i}=r,a=L.getSignedInUser();return{onReceiptsUpload:(o,l,p)=>{o!=null&&e(de(o,l,p,n,a?.userId))},onExistingMerchantChange:(o,l)=>{e(we(!1,l,n,o,void 0))},fetchDuplicateReimbursement:()=>{a?.userId!=null&&e(Ft(a.userId,!0,n))},clearDuplicateReimbursementDetail:()=>{e(Ut())},clearRemiSaveStatus:()=>{e(jt("Not-Started",n))},onDuplicateLineClick:(o,l)=>window.open(`/${i}/reimbursement/${o}#L${l}`),onNewMerchantChange:(o,l)=>{e(we(!1,l,n,void 0,o))},removeFileFromLine:o=>{e(Dt({lineId:o,reimbursementId:n}))},onAmountChanged:(o,l)=>{e(Tt(l,o,n))},updateReimbursementType:(o,l,p)=>{e(Bt({reimbursementId:p,lineId:l,reimbursementType:o}))},onHomeCurrencyConversionUpdate:(o,l,p)=>{e(xt({reimbursementId:p,lineId:l,amountPayload:{amount:o.amount,currency_code:o.currencyCode,currency_symbol:o.currencySymbol}}))},onReimbursementDetailsChanged:o=>{e(wt({remiDetailLocalData:o,reimbursementId:n}))},saveRemiDetails:o=>{e(Ee(o,!1,n))},onUserBankDetailsUpdated:o=>{const{bankAccountSection:l}=o;e(Et({data:l}))},onFetchBankName:o=>{e(Ct(o))},submitRemiDetails:()=>{e(Ee("pending_approval",!0,n))},discardReimbursementDetailsFromLocalStore:o=>{e(Ce({reimbursementId:o}))},updateInvoiceUploadFetchState:o=>{e(ce({reimbursementId:n,fetchState:o}))},clearTentativeNameForLine:o=>{e(kt({reimbursementId:n,lineId:o}))},removeDuplicateReimbursementForLine:o=>{e(vt({lineId:o}))},onZeniLogoClick:()=>{d.toggle()},clearAddRemiAutoFields:o=>{e(Rt({reimbursementId:n,lineId:o}))},redirectToReimbursementListScreen:()=>{e(Pe()),e(Ce({}));const o=at(i),l=K(m.state?.pathnameStackToGoBack,m.pathname);c(o,{state:{pathnameStackToGoBack:l}})},redirectToReimbursementDetailScreen:()=>{t.navigate("../")},deleteReimbursement:()=>{n!=null&&(w.trackReimbursementDeleteReimbursement(n),e(Ne(n)))},onSaveBankAccount:()=>{a?.userId&&e(At(a?.userId,n))},onFetchLinkTokenClick:o=>{e(yt("user_reimbursement_account",o))},onEstablishConnectionClick:o=>{e(It(o,r.companyId,"user_reimbursement_account",void 0,"link_account_no_microdeposit"))},deleteBankAccount:o=>{e(St(o,a?.userId??""))},onBackClickFromBankAccountPage:()=>{e(ht({fetchState:"Not-Started"})),e(ft())},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(o,l)=>{o.trim().length>=2?e(gt({searchString:o,entityType:l,searchOrigin:"common"})):e(ke("common"))},onCancelAutoComplete:()=>{e(ke("common"))}}}}))(Cn);function Ue(){const e=Q(),t=ae(),n=Y(),{reimbursementId:r}=ie(),m=We(),c=qe(),d=g.useRef(!1),[i,a]=g.useState(r==null),[o,l]=g.useState(1),{useFeatureGate:p}=oe(),{isFeatureEnabled:I}=p(F.isLimitedCategoryForReimbursement),{isFeatureEnabled:u}=p(F.isShowDeletedReimbursementsFeatureEnabled),{isAiCfoAccessEnabled:T,onAskAiCfoClick:y}=Ae({mobileExploreReferrer:"Reimbursement Details"}),B=Y().pathname,D=B.includes("edit"),k=B.includes("reimbursement/new"),[C,A]=g.useState(!1),S=L.getSignedInUser(),E=v((b=>H(b))),h=v((b=>ge(b,r))),$=tt(E?.companyId,{clearParams:h.fetchState==="Completed"}),U=he(E?.userRole??[]);(function(){const b=ae(),M=v((J=>H(J))),O=M?.tenantId,{isApprovalRulesV3Enabled:Z,isLoading:W}=vn(O),z=v((J=>J.remiSetupApproverViewState.fetchState));g.useEffect((()=>{O==null||W||z==="Not-Started"&&b(ct(!0,!1,!1,Z))}),[O,W,Z,z,b])})(),g.useEffect((()=>{(k&&!C||D&&!C&&h.fetchState!="Completed"&&h.fetchState!="In-Progress")&&(A(!0),t(Fe(!1,I,u,r)))}));const R=v((b=>dt(b.accountState,b.accountListState,"reimbursementAccountList")));if(S==null)throw Error("Can't access address page without signing in...");const _={pathname:`../${r}`,search:n.search};return h.fetchState==="Completed"&&(d.current=!0),h.isDeleted===!0||h.billStage=="paid"||h.billStage=="scheduled"||d.current===!1&&h.fetchState==="Not-Started"||U&&h.billStatus==="rejected"||U===!1&&h.billStage==="pending_approval"&&h.billStatus!=="rejected"?s.jsx(N,{to:_}):d.current!==!1||h.deleteStatus.fetchState!=="In-Progress"&&h.fetchState==="Completed"?s.jsxs(Zn,{windowSize:c,children:[s.jsx(re,{analytics:w,onLoad:b=>(M=>{r!=null&&h.deleteStatus.fetchState!=="Completed"&&M.trackReimbursementEditReimbursement(r)})(b)}),i&&c!=="small"?s.jsx(zn,{}):null,i&&c!=="small"?s.jsx(Gn,{children:s.jsx(De,{showAutofill:i,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,authParams:{userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:E?.tenantId??""},onSkipAutofill:()=>a(!1),onInvoiceUpload:b=>{b!=null&&t(de(b,o,!0,r,S?.userId))},updateInvoiceUploadFetchState:b=>{t(ce({reimbursementId:r,fetchState:b}))},allowMultiFiles:i,showInfoText:!1,type:"reimbursement",style:{width:"100%",paddingTop:"78px",paddingRight:j.sp3,paddingBottom:"15px",paddingLeft:j.sp5},dropFilePlaceholder:{upload:q.upload,single:ne.dropReceipt.single,or:q.texts.or,multiple:ne.dropReceipt.multiple,receipts:q.texts.receipts2}})}):null,i&&c==="small"?s.jsxs(Vn,{children:[s.jsx(Hn,{onClick:()=>a(!1),children:s.jsx(Mn,{})}),s.jsx(De,{showAutofill:i,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,authParams:{userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:E?.tenantId??""},onSkipAutofill:()=>a(!1),onInvoiceUpload:b=>{b!=null&&t(de(b,o,!0,r,S?.userId))},updateInvoiceUploadFetchState:b=>{t(ce({reimbursementId:r,fetchState:b}))},allowMultiFiles:i,showInfoText:!1,type:"reimbursement",style:{width:"100%",paddingTop:j.sp5,paddingRight:j.sp3,paddingBottom:j.sp5,paddingLeft:j.sp3},dropFilePlaceholder:{upload:q.upload,single:ne.dropReceipt.single,or:q.texts.or,multiple:ne.dropReceipt.multiple,receipts:q.texts.receipts2}})]}):null,s.jsx(Wn,{windowSize:c,children:s.jsx(On,{initialOpenThreadRequest:$??void 0,location:n,navigate:e,currentTenant:E,reimbursementId:r,themeState:m,uncategorizedAccounts:R,disableInternalOverlay:!0,showSkipAutoFill:i,setShowSkipAutoFill:a,onCurrentLineIdForUploadChange:l,isAiCfoAccessEnabled:T,onAskAiCfoClick:y})})]}):s.jsx(Xe,{isNewReimbursement:r==null})}const Zn=P.div`
2
+ display: flex;
3
+ position: relative;
4
+ height: 100vh;
5
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
6
+ background-color: ${e=>e.theme.colors.grey4};
7
+ `,zn=P.div`
8
+ position: fixed;
9
+ top: 0;
10
+ left: 0;
11
+ right: 0;
12
+ bottom: 0;
13
+ background-color: ${kn.overlayBackgroundBlack};
14
+ z-index: 5;
15
+ `,Gn=P.div`
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+ width: 42%;
20
+ height: 100%;
21
+ z-index: 6;
22
+ display: flex;
23
+ background-color: transparent;
24
+ overflow: hidden;
25
+ `,Vn=P.div`
26
+ position: fixed;
27
+ top: 0;
28
+ left: 0;
29
+ right: 0;
30
+ bottom: 0;
31
+ z-index: 11;
32
+ display: flex;
33
+ flex-direction: column;
34
+ overflow-y: auto;
35
+ background-color: ${e=>e.theme.colors.grey4};
36
+ `,Hn=P.button`
37
+ align-self: flex-end;
38
+ background: none;
39
+ border: none;
40
+ cursor: pointer;
41
+ padding: ${j.sp2} ${j.sp3};
42
+ line-height: 1;
43
+ color: ${e=>e.theme.colors.hero};
44
+ &:hover {
45
+ color: ${e=>e.theme.colors.primary};
46
+ }
47
+ svg {
48
+ width: ${j.sp4};
49
+ height: ${j.sp4};
50
+ }
51
+ `,Wn=P.div`
52
+ display: flex;
53
+ flex-direction: column;
54
+ width: 100%;
55
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
56
+ `,qn=ee((function(e,t){const n=_e(e,t.reimbursementId),r=L.getSignedInUser(),m=fe(r),c=e.tenantState.currentTenantId,d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:c??""},i=`${n.createdBy?.firstName??"Zeni"} ${n.createdBy?.lastName??""}`;let a=!1;n?.remiActivities.length>0&&(a=_t(n.remiActivities,Mt(t.currentTenant),r));const o=he(t.currentTenant?.userRole??[]),l=r?.userId===n.createdBy?.userId;return{remiDetails:n,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,authParams:d,signedInUser:r,createdBy:i,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,isAdmin:o,showApproveRejectBtns:a,isZeniUser:m,isSignedInUserReimbursementCreator:l,isAccountingClassesEnabled:$e(e)}}),(function(e,t){const{reimbursementId:n,currentTenant:r,location:m,navigate:c,themeState:d}=t,{tenantEmailDomain:i}=r;return{onDuplicateLineClick:(a,o)=>window.open(`/${i}/reimbursement/${a}#L${o}`),redirectToReimbursementListScreen:()=>{e(Pe());const a=at(i),o=K(m.state?.pathnameStackToGoBack,m.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onSaveRealTimeApprovals:a=>{e(zt(n,"reimbursement",a))},updateEditRealTimeApproverClicked:a=>{e(Zt({isEdit:a,entityId:n,entityType:"reimbursement"}))},approveOrRejectRemi:a=>{a.type==="approved"?e(xe(n,a.type,"")):e(xe(n,a.type,a.description??""))},redirectToEditableReimbursementScreen:()=>{const a=K(m.state?.pathnameStackToGoBack,m.pathname);c("./edit",{state:{pathnameStackToGoBack:a}})},deleteReimbursement:()=>{w.trackReimbursementDeleteReimbursement(n),e(Ne(n))},cancelAndDeleteReport:a=>{a===!0?w.trackReimbursementCancelAndDeleteReimbursement(n):w.trackReimbursementCancelReimbursement(n),e(Ot(n,a))},handleZeniLogoClick:()=>{d.toggle()}}}))(En);function Xn(){const e=Q(),t=ae(),n=Y(),r=n.hash.substring(1),m=We(),{reimbursementId:c}=ie(),d=L.getSignedInUser(),i=v((R=>H(R))),a=v((R=>_e(R,c??""))),o=a.remiDetails?.reimbursementInfo.stage.code==="draft",l=tt(i?.companyId,{clearParams:a.fetchState==="Completed"&&!o}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:I}=Ae({mobileExploreReferrer:"Reimbursement Details"});Ye({isDataReady:a.fetchState==="Completed"});const{useFeatureGate:u}=oe(),{isFeatureEnabled:T}=u(F.isLimitedCategoryForReimbursement),[y,B]=g.useState(!1),[D,k]=g.useState(!1),[C,A]=g.useState(!1),{isFeatureEnabled:S}=u(F.isShowDeletedReimbursementsFeatureEnabled),E=v((R=>ge(R,c??""))),h=Lt(i),$=$t(i.userRole),U=a.fetchState;if(g.useEffect((()=>{y||c==null?y==1&&U==="Error"&&e("page-not-found",{replace:!0}):(B(!0),t(Nt(c,!1,S)))}),[y,c,t,U]),g.useEffect((()=>{S&&a.remiDetails?.isDeleted===!0||i.isZeni===!0&&d?.userEmailDomain==="zeni.ai"&&h===!1?A(!1):A(a.remiActivities[0]?.isRealTimeApprovalEnabled&&($||a.allApprovers.find((R=>R.user.userId===d?.userId))!=null||a.remiDetails?.lastUpdatedBy===d?.userId))}),[a.remiActivities[0]?.isRealTimeApprovalEnabled,a.allApprovers,a.remiDetails?.lastUpdatedBy,$,i.isZeni,h,d]),g.useEffect((()=>{D||a.fetchState!="Completed"||a.remiDetails?.reimbursementInfo.stage.code=="paid"||a.remiDetails?.reimbursementInfo.stage.code=="scheduled"||E.fetchState=="Completed"||E.fetchState=="In-Progress"||(k(!0),t(Fe(!1,T,S,c)),a.remiActivities[0]?.isRealTimeApprovalEnabled===!0&&t(Pt(!1,!0,!0,a.lastUpdatedByUserId)))}),[D,a,c,t]),d==null)throw Error("Can't access address page without signing in...");return a.remiDetails?.reimbursementInfo.stage.code=="draft"&&E.fetchState=="Completed"&&a.remiDetails.isDeleted===!1?s.jsx(N,{to:`./edit${n.search}`}):a.deleteStatus.fetchState==="In-Progress"||a.cancelAndDeleteStatus.fetchState==="In-Progress"||a.remiDetails?.reimbursementInfo.stage.code=="draft"&&E.fetchState!="Completed"||a.fetchState!="Completed"?s.jsx(Xe,{}):s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:w,onLoad:R=>(_=>{c!=null&&_.trackReimbursementReimbursementDetails(c)})(R)}),s.jsx(qn,{initialOpenThreadRequest:l??void 0,scrollId:r,isShowDeletedReimbursementEnabled:S,location:n,navigate:e,isRealTimeApprovalEnabled:C,currentTenant:i,reimbursementId:c??"",themeState:m,isAiCfoAccessEnabled:p,onAskAiCfoClick:I})]})}const Kn=ee((function(e,t){return{remisReviewView:Me(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/reimbursements`),e(X())},onCloseReviewItem:n=>{e(Vt(n))},onProceedForBulkActionClick:(n,r)=>{switch(n){case"send_for_approval":e(Gt());break;case"approve":e(Be("approved",r??""));break;case"reject":e(Be("rejected",r??""))}}}}))(wn);function Yn({tenantEmailDomain:e}){const t=Q(),n=v((d=>d.remisBulkActionViewState.bulkSubmissionFetchState.fetchState)),{remisForReview:r}=v((d=>Me(d))),m=le(),c=m?.loggedInUserRole?.includes("admin")===!0;return g.useEffect((()=>{n!=="Completed"&&r.length!==0||t(`/${e}/reimbursements`)}),[n,r.length,e]),s.jsx(Kn,{navigate:t,analytics:w,isAdmin:c,tenantEmailDomain:e})}const V=Qt(),st="bulk-operation-update",be="reimbursement-approval-rule-update",{spendManagement:Jn,common:me}=Ke.getLocalizedStrings(),Qn=Jn.reimbursement.bulkActions,ea=P.div`
57
+ display: flex;
58
+ min-height: 100%;
59
+ width: 100%;
60
+ flex: 1 1 auto;
61
+ flex-direction: column;
62
+ align-items: center;
63
+ background-color: ${e=>e.theme.colors.grey4};
64
+ `,ta=ee((function(e,t){const n=ze(e,V,t.isBulkActionEnabled);let r=n.allSubTabs;const m=L.getSignedInUser(),c=fe(m),d=e.tenantState.currentTenantId,i=H(e),a=i?.companyName??"",o={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:d??""},l=e.remiListState.downloadUIState.downloadState;t.isShowDeletedReimbursementEnabled===!1&&(r=r.filter((u=>u!=="deleted")));const p=n.fetchState,I=en(e);return{transactionList:t.isShowDeletedReimbursementEnabled?n.reimbursements:n.reimbursements.filter((u=>u.isDeleted===!1)),isAdmin:t.isAdmin,isZeniUser:c,allSubTabs:r,isEmployee:t.isEmployee,currentTab:n.currentTab,currentSubTab:n.currentSubTab,approvalCount:n.approvalCount,fetchState:p,botEmail:n.reimbursementBotEmail,analytics:w,uiState:n.uiState,searchText:n.searchText,filters:n.filters,downloadParams:{authParams:o,companyName:a,timePeriod:V,spendManagementEndPoint:`${jn}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:l,isBulkActionAllowed:n.remiListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:n.remiListBulkActionInfo?.remisSelectedForBulkAction,allowedBulkActions:n.remiListBulkActionInfo?.allowedBulkActions,remiApprovalRulesAffectedEntityIds:I.affectedEntityIds}}),(function(e,t){const{navigate:n,currentTenant:r,location:m,period:c}=t,{tenantEmailDomain:d}=r;return{updateTabToState:i=>{e(X()),e(Oe(i))},onSubtabChange:i=>{e(X()),e(Ze(i))},onTransactionClick:(i,a)=>{const o=sa(d,i,a),l=K(m.state?.pathnameStackToGoBack,m.pathname);n(o,{state:{pathnameStackToGoBack:l}})},onClickSetupIcon:()=>{const i=aa(d),a=K(m.state?.pathnameStackToGoBack,m.pathname);n(i,{state:{pathnameStackToGoBack:a}})},onAddTransactionClick:()=>{const{tenantEmailDomain:i}=t.currentTenant;w?.trackReimbursementNewReimbursement();const a=`/${i}/reimbursement/new`,o=K(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(a,{state:{pathnameStackToGoBack:o}})},onColumnSortConfigChanged:(i,a)=>{e(mn({uiState:{sortKey:i,sortOrder:a},period:t.period}))},onSearchTextChanged:i=>{e(ln(i))},onFiltersChange:i=>{e(rn({filters:i})),i.categories.every((a=>a.field!=null&&a.values?.length!==0))&&w.trackSpendManagmentFilterChange("reimbursement",i.categories.map((a=>`${a.field}-${JSON.stringify(a.values)}`)))},updateDownloadStateHandler:i=>{i==="In-Progress"&&w.trackSpendManagementDownloadClick("reimbursement"),e(on({uiState:{downloadState:i}}))},onReloadTransactions:()=>{e(ue(c,!0,t.isShowDeletedReimbursementEnabled,!1,!0))},onBackClick:()=>{n("../",{relative:"path"})},onNavigateToSettings:()=>{n("../reimbursements/setup")},updateBulkActionList:i=>{e(sn(i))},removeAllTransactionsFromBulkActionList:()=>{e(X())},onProceedForBulkActionClick:(i,a)=>{switch(i){case"delete":case"cancel":e(an(i,a??""));break;case"send_for_approval":e(Te("send_for_approval")),t.navigate("./bulk-review");break;case"review":e(Te("approve")),t.navigate("./bulk-review")}},onReimbursementApprovalRulesEventReceived:i=>{i.endsWith(be)&&e(nn(!1))},onEventReceived:i=>{i===st&&e(tn())}}}))(Tn(Dn));function na(){const e=Q(),t=ae(),n=Y(),r=n.state,m=qe(),[c,d]=g.useState(null),i=lt("/:tenantEmailDomain/reimbursements/bulk-review")!=null;g.useEffect((()=>{if(r?.tab!=null&&r?.subTab!=null){const f=Ht(r.tab.toString());f!=null?t(Oe(f)):console.log("Warning:Not a valid remiListTab");const G=Wt(r.subTab.toString());G!=null?t(Ze(G)):console.log("Warning:Not a valid remiListSubTab")}return()=>{t(X())}}),[]);const{useFeatureGate:a}=oe(),{isFeatureEnabled:o}=a(F.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:l}=a(F.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:p}=a(F.isReimbursementBulkActionEnabled),I=L.getSignedInUser(),u=v((f=>H(f))),[T,y]=g.useState(!1),[B,D]=g.useState(!1),k=le(),C=k?.loggedInUserRole?.includes("admin")===!0,A=v((f=>ze(f,V,p))),{areTenantIdsInSync:S}=xn(),E=A.fetchState,{isAiCfoAccessEnabled:h,onAskAiCfoClick:$}=Ae({mobileExploreReferrer:"Reimbursement List"});if(Ye({isDataReady:E==="Completed"}),g.useEffect((()=>{!B&&S&&(D(!0),t(ue(V,!0,l,!1,!0)))}),[B,V,t,S]),I==null)throw Error("Can't access address page without signing in...");const U=!!u?.userRole&&qt(u),R=Se(k?.loggedInUserRoleMap),_=Ie(k?.loggedInUserRoleMap),b=!!u.userReimbursementInfo?.isReimbursementTOSAccepted,M=!!u.companyReimbursementInfo?.info?.isReimbursementEnabled,O=!!u.companyReimbursementInfo?.info?.isReimbursementTOSAccepted,Z=v((f=>Le(f.companyState,u.companyId))),W=Z?.company.featuresActivationInfo.connectedAccountProvider,z=f=>{y(f)},{isFeatureEnabled:J}=a(F.isDebitCardFeatureEnabled),it=Ge(J,u),ot=Ve(u),{remisProcessed:te,remisProcessing:Re}=v((f=>Xt(f)));g.useEffect((()=>{te===Re&&c!=null&&(t(Kt({messageSection:"reimbursement_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_report_",variableValue:te>1?me.texts.reports2:Qn.report},{variableName:"_has_",variableValue:te>1?me.texts.have:me.texts.has},{variableName:"_action_",variableValue:Yt(c)}]})),t(Jt()),setTimeout((()=>{t(ue(V,!0,l,!1,!0,!0))}),3e3),d(null))}),[te,Re]);const rt={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${st}`,`private-encrypted-${u.companyId}.${be}`]:[],eventCallback:(f,G,ve)=>{f.endsWith(be)?ve.onReimbursementApprovalRulesEventReceived?.(f):G.entity_type==="reimbursement"&&(d(G.operation_type),ve.onEventReceived(f))}};return n.pathname.endsWith("/reimbursements/")||n.pathname.endsWith("/reimbursements")||n.pathname.endsWith("/reimbursements/bulk-review")?it===!0||ot===!0?s.jsx(et,{}):M&&(!U||R)||_&&b?s.jsxs(s.Fragment,{children:[E==="Completed"?s.jsx(re,{analytics:w,onLoad:f=>(G=>G.trackPageLoaded(Je.Event.reimbursementHome))(f)}):null,s.jsx(nt,{isAppContentDrawerOpen:T,handleDrawerToggle:z}),s.jsxs(ea,{windowSize:m,children:[s.jsx(Nn,{isOpen:i,drawerLeftMargin:new Bn(0,0,300,600),onClose:()=>{e(`/${u.tenantEmailDomain}/reimbursements`),t(X())},children:s.jsx(ia,{onClick:f=>f.stopPropagation(),children:s.jsx(Yn,{tenantEmailDomain:u.tenantEmailDomain})})}),s.jsx(ta,{isShowDeletedBillsEnabled:o,isShowDeletedReimbursementEnabled:l,location:n,navigate:e,currentTenant:u,period:V,isAdmin:C,isEmployee:U,entity:"reimbursement",onClickMenuIcon:()=>{z(!0)},createdByUserList:A.createdByUserList,createdByUserListFetchState:A.createdByUserListFetchState,isDownloadEnabled:A.isDownloadEnabled,connectedAccountProvider:W,isBulkActionEnabled:p,bulkSubmissionLimit:A.remiBulkSubmissionLimit,bulkSubmissionFetchState:A.remiListBulkActionInfo.bulkSubmissionFetchState,isAiCfoAccessEnabled:h,onAskAiCfoClick:$,...rt})]})]}):O&&R?s.jsx(N,{to:"../setup"}):k!=null&&He(u,k.loggedInUserRoleMap)?s.jsx(N,{to:"../promo"}):s.jsx(ye,{fetchState:"In-Progress"}):s.jsx(pe,{})}const aa=e=>`/${e}/reimbursements/setup`,sa=(e,t,n)=>{let r=`/${e}/reimbursement/${encodeURIComponent(t)}`;return n=="draft"&&(r+="/edit"),r},ia=P($n)`
65
+ display: flex;
66
+ min-height: 100%;
67
+ flex-direction: column;
68
+ `,oa=ee((function(e,t){const{companyId:n}=t;return{reimbursementSetupView:cn(e,n),analytics:w,videoUrl:"https://player.vimeo.com/video/814821498?h=e7fd11e13e&badge=0&autopause=0&player_id=0&app_id=122963"}}),(function(e,t){const{companyId:n,navigate:r}=t;return{onSetupButtonClick:()=>{e(un(n))},onCreateNewRemiButtonClick:()=>{e(dn(t.userRoleId))},onBackClick:()=>{r("../..",{relative:"path"})},onSetupReimbursementSuccess:()=>{t.isEmployee?r("../../reimbursement/new",{relative:"path"}):r("../reimbursements/setup",{relative:"path"})}}}))(Fn),ra=()=>{const e=Un(),t=Q(),n=Y(),{tenantEmailDomain:r}=ie(),m=Qe(),[c,d]=g.useState(!1),i=v((C=>H(C))),a=L.getSignedInUserTenant(r)?.companyId??i.companyId,o=L.getSignedInUser(),l=i.userRoleId,p=!!i.userRole?.includes("reimbursements_user"),I=le(),u=Se(I?.loggedInUserRoleMap),T=Ie(I?.loggedInUserRoleMap),y=!!i.userReimbursementInfo?.isReimbursementTOSAccepted,B=!!i.companyReimbursementInfo?.info?.isReimbursementEnabled,D=!!i.companyReimbursementInfo?.info?.isReimbursementTOSAccepted,k=C=>{d(C)};if(o==null)throw Error("Can't access reimbursement promo page without signing in...");return B&&T&&y?s.jsx(N,{to:"../../../reimbursements"}):D&&u?s.jsx(N,{to:"../../reimbursements/setup"}):i.companyReimbursementInfo&&!D||i.userReimbursementInfo&&T&&y===!1?s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:w,onLoad:C=>(A=>A.trackPageLoaded(Je.Event.reimbursementPromoPage))(C)}),s.jsx(nt,{isAppContentDrawerOpen:c,handleDrawerToggle:k}),s.jsx(oa,{companyId:a,navigate:t,meetingUrl:e("reimbursement_promo"),location:n,userReimbursementInfo:i.userReimbursementInfo,userRoleId:l,isEmployee:p,onClickMenuIcon:()=>{k(!0)}})]}):s.jsx(ye,{fetchState:"In-Progress",style:{backgroundColor:m.colors.grey5}})};function Ma(){const e=v((z=>H(z))),t=le(),n=!!e.company?.companyReimbursementInfo.isReimbursementEnabled,r=Qe(),m=!!e.company?.companyReimbursementInfo.isReimbursementTOSAccepted,c=!!e.userReimbursementInfo?.isReimbursementTOSAccepted,{useFeatureGate:d}=oe(),{isFeatureEnabled:i}=d(F.isChargeCardFeatureEnabled),{isFeatureEnabled:a}=d(F.isDebitCardFeatureEnabled),o=Ge(a,e),l=Ve(e),p=e?.userRole!=null&&pn(e?.userRole),I=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&bn(t?.loggedInUserRoleMap),u=gn(t?.loggedInUserRoleMap),T=e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p,y=Se(t?.loggedInUserRoleMap),B=T&&y,D=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,k=D&&hn(t?.loggedInUserRoleMap),C=Ln(e,i,a)&&!p,A=C&&fn(t?.loggedInUserRoleMap),S=Sn(t?.loggedInUserRoleMap),E=In(t?.loggedInUserRoleMap),h=yn(t?.loggedInUserRoleMap),$=D&&E,U=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&h,R=An(t?.loggedInUserRoleMap),_=Rn(t?.loggedInUserRoleMap),b=Ie(t?.loggedInUserRoleMap),M=C&&R,{tenantEmailDomain:O}=ie(),Z=Y(),W=n===!0&&(y||b&&c);return s.jsxs(mt,{children:[Z.pathname.includes("/reimbursements")?s.jsxs(s.Fragment,{children:[s.jsx(x,{path:"verification",element:s.jsx(je,{isBillPayAdminLevelAccess:I,isUserHasOnlyBillPayAccess:u,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:S,productType:"reimbursement",type:"verification"})}),s.jsx(x,{path:"setup",element:s.jsx(je,{isBillPayAdminLevelAccess:I,isUserHasOnlyBillPayAccess:u,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:S,productType:"reimbursement",type:"setup"})}),s.jsx(x,{path:"promo",element:s.jsx(ra,{})}),s.jsx(x,{path:"approval-rules/*",element:B?s.jsx(_n,{}):s.jsx(Pn,{showZeniAccountRoute:$,isUserHasBillPayAccess:_,isUserHasReimbursementAccess:b,showTreasuryRoute:U,isTenantBankingOnly:o,showChargeCardRoute:M,tenantEmailDomain:O??""})}),W&&s.jsx(x,{path:"*",element:s.jsx(na,{})}),(o===!0||l===!0)&&s.jsx(x,{path:"/*",element:s.jsx(et,{})}),t!=null&&He(e,t?.loggedInUserRoleMap)&&s.jsx(x,{path:"*",element:s.jsx(N,{to:"../promo"})}),m&&y&&s.jsx(x,{path:"*",element:s.jsx(N,{to:"../setup"})})]}):Z.pathname.includes("/reimbursement")?s.jsxs(s.Fragment,{children:[s.jsx(x,{path:"new",element:s.jsx(Ue,{})}),s.jsx(x,{path:":reimbursementId",element:s.jsx(Xn,{})}),s.jsx(x,{path:":reimbursementId/edit",element:s.jsx(Ue,{})}),s.jsx(x,{path:"*",element:s.jsx(pe,{})})]}):s.jsx(x,{path:"*",element:s.jsx(ye,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5,boxShadow:`0px 2px ${j.sp1} ${r.colors.dropShadowNormal}`}})}),s.jsx(x,{path:"*",element:s.jsx(pe,{})})]})}export{Ma as default};
@@ -1 +1 @@
1
- import{j as f}from"./liveblocks-BdMPZzDQ.js";import{g as te,h as ve,u as Ye,i as Ue,j as _,l as xe,n as We,o as oe}from"./core-o-ca34AJ.js";import{fI as Q,EH as S,VC as ze,m3 as ue,ul as he,va as Y,lK as j,lT as F,lL as V,kO as P,kF as A,kE as E,DK as U,vf as ye,bq as Ge,VD as He,bn as Ne,F3 as qe,VE as $e,VF as Ke,ck as I,DD as ne,VG as re,VH as Ze,VI as Je,VJ as Qe,VK as Xe,VL as ea,VM as aa,VN as sa,VO as ta,VP as oa,VQ as na,VR as ra,VS as la,VT as k,VU as x,VV as W,VW as z,VX as G,VY as H,VZ as N,V_ as q,V$ as $,W0 as K,ek as ca,EJ as ia,Ev as le,Ew as ce,EP as da,EA as ie,bG as O,W1 as de,di as pe,EB as _e,EV as pa,W2 as _a,W3 as fa,W4 as ba,W5 as ma,W6 as ua,W7 as ha,W8 as ya,W9 as Ca,Wa as wa,Wb as ga,e1 as Ia,e0 as Ra}from"./zeni-epic-state-MQ0qdl-Q.js";import{am as Sa,an as Ta,ao as ka,a as Oa,a0 as Da,p as Ce,c as Z,z as we,ap as ja,V as Fa,e as Va,aq as Pa,ar as Aa,a7 as Ea,m as J,S as Ma,D as La,n as ge,as as Ba,at as va,au as Ya}from"./index-Bx2gJO4r.js";import"./mui-cK5UWUvi.js";import Ua from"./NotFoundScreen-BXfz4Cwt.js";import{F as xa}from"./FeaturePreviewScreen-B5U7lEG-.js";import{a as u}from"./sentry-Buwow292.js";import{u as Wa}from"./useInitialThreadRequest-C3w5IRp7.js";import{t as fe,a as be,b as za}from"./routePaths-DBf4ybcn.js";import{t as me}from"./reportTimeframe-6FnDbaGY.js";import{M as Ga}from"./MobileAppDrawer-DVldqyUl.js";import"./recharts-DK1tbN_A.js";import"./analytics-C3OBHjEG.js";import"./plaid-C8bTkbCG.js";import"./dnd-sqKp8sUm.js";import"./stripe-cKAAJElX.js";import"./lottie-Dl8uwTmw.js";import"./lexical-CEO4_NFb.js";import"./pdf-BNJo5ucI.js";import"./utils-D4KfE2cr.js";import"./InboxNotificationsProvider-Cph6MP0g.js";import"./useTaskManagerAccess-By_NjZen.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]="ef104167-9f60-4417-85bc-fa83fd25ae63",e._sentryDebugIdIdentifier="sentry-dbid-ef104167-9f60-4417-85bc-fa83fd25ae63")}catch{}})();const Ha=["profit_loss","balance_sheet","cash_flow"],R=e=>e==="balance_sheet"||e==="balance_sheet_by_classes"||e==="balance_sheet_by_projects",h=e=>{e(K({resetLeftScroll:!0})),e($({resetLeftScroll:!0})),e(q({resetLeftScroll:!0})),e(N({resetLeftScroll:!0})),e(H({resetLeftScroll:!0})),e(G({resetLeftScroll:!0})),e(x({resetLeftScroll:!0})),e(z({resetLeftScroll:!0})),e(W({resetLeftScroll:!0}))},Na=e=>{e(fa()),e(ba()),e(ma()),e(ua()),e(ha()),e(ya()),e(Ca()),e(wa()),e(ga())},qa=xe((function(e){const o=we.getSignedInUser(),b=e.tenantState.currentTenantId,m=Q(e),a=m?.companyName??"",s={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:b??""},t=S(e),n=He(m);return{fetchState:t.fetchState,selectedTimeframe:t.filter.timeframe,selectedReport:t.selectedReportId,displayOrder:t.displayOrder,reportFormat:t.reportFormat,dataAvailable:t.dataAvailable,balancesInTimeframe:t.balancesInTimeframe,allTimeframeTicks:t.allTimeframeTicks,selectedCOABalancesRange:t.filter.balancesRange,isCompareMode:t.isCompareModeOn,profitAndLossReport:t.profitAndLossReport,profitAndLossClassesViewReport:t.profitAndLossByClassReport,profitAndLossProjectViewReport:t.profitAndLossByProjectReport,profitAndLossByClassHorizontalReport:t.profitAndLossByClassHorizontalReport,balanceSheetReport:t.balanceSheetReport,balanceSheetClassesViewReport:t.balanceSheetByClassReport,cashFlowClassesViewReport:t.cashFlowByClassReport,cashFlowProjectViewReport:t.cashFlowByProjectReport,balanceSheetProjectViewReport:t.balanceSheetByProjectReport,cashFlowReport:t.cashFlowReport,downloadState:t.downloadState,analytics:J,isZeniUser:Ne(o),showAccountGroups:n===!0,isAccountingClassesEnabled:ue(e),isAccountingProjectsEnabled:he(e),currentTenantCompanyName:a,statementEndPoint:`${Ya}/statement`,authParams:s,isZeniCOAUsed:n}}),(function(e,o){const{navigate:b,handleDrawerToggle:m}=o;return{onReloadReport:()=>{o.signedInUser!=null&&e(Y(o.signedInUser.userId,!0,!1))},updateDownloadStateHandler:a=>{e(_a(a))},onTimeframeSelectionChanged:(a,s,t)=>{if(e(pa(a)),s){const{isCompareModeOn:n,filter:r}=o,{additionalBalances:i,balancesRange:d}=r;let c=[...i];a==="year"&&(c=c.filter((p=>p!=="this_period_vs_same_period_last_year"&&p!=="this_period_vs_same_period_last_year_percent"&&p!=="same_period_last_year"))),e(le(o.firstMonthOfFY,n,d.numberOfPeriods<1?1:d.numberOfPeriods,c)),i.length>0&&e(ce(o.firstMonthOfFY,c.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",d.numberOfPeriods<1?1:d.numberOfPeriods,c))}t!==!0&&setTimeout((()=>h(e)),50)},onInitialDateRangeAvailable:(a,s)=>{const{filter:t}=o,n=me(t.timeframe),r=O(a),i=O(s),d=de(o.firstMonthOfFY,n,{startDate:r,endDate:i})??t.balancesRange.numberOfPeriods,{startOfTimeframeFY:c,endOfTimeframeFY:p}=pe(i,o.firstMonthOfFY,n);e(_e({numberOfPeriods:d,orderBy:t.balancesRange.orderBy,thisPeriod:{startDate:c,endDate:p}}))},onCustomDateRangeChanged:(a,s,t)=>{const{filter:n}=o,r=me(t??n.timeframe);switch(o.selectedReportID){case"profit_and_loss":case"profit_and_loss_by_classes":e(ye(r,void 0,!0,!1,a,s)),o.selectedReportID==="profit_and_loss_by_classes"&&o.isAccountingClassesEnabled&&e(ne());break;case"profit_and_loss_by_projects":o.isAccountingProjectsEnabled&&e(U());break;case"balance_sheet":e(E(r,!0,!1,a,s));break;case"balance_sheet_by_classes":e(E(r,!0,!1,a,s)),o.isAccountingClassesEnabled&&e(A());break;case"balance_sheet_by_projects":e(E(r,!0,!1,a,s)),o.isAccountingProjectsEnabled&&e(P());break;case"cash_flow":e(j(r,!0,a,s));break;case"cash_flow_by_classes":e(j(r,!0,a,s)),o.isAccountingClassesEnabled&&e(V());break;case"cash_flow_by_projects":e(j(r,!0,a,s)),o.isAccountingProjectsEnabled&&e(F())}const i=O(a),d=O(s),c=de(o.firstMonthOfFY,r,{startDate:i,endDate:d})??n.balancesRange.numberOfPeriods,{startOfTimeframeFY:p,endOfTimeframeFY:M}=pe(d,o.firstMonthOfFY,r);e(_e({numberOfPeriods:c,orderBy:n.balancesRange.orderBy,thisPeriod:{startDate:p,endDate:M}})),h(e)},onReportSelectionChanged:a=>{const s=o.selectedReportID;if(a===s)return;const t=o.classViewLayout;e(k(a)),(R(a)||I(a))&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(ie({numberOfPeriods:1,orderBy:"ascending_date"})),a!=="profit_and_loss"&&a!=="profit_and_loss_by_classes"&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(re({classViewLayout:"vertical"})),h(e)},onCOABalancesRangeChanged:(a,s)=>{e(ie(a,s)),h(e)},onThisPeriodChanged:(a,s,t)=>{e(da(o.firstMonthOfFY,a,s<1?1:s)),t!==!0&&h(e)},onAdditionalBalanceSelectionChanged:(a,s,t,n)=>{e(le(o.firstMonthOfFY,a,t<1?1:t,s)),s.length>0&&e(ce(o.firstMonthOfFY,s.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",t<1?1:t,s)),n!==!0&&o.isCompareModeOn===a||setTimeout((()=>h(e)),50)},onUpdateHighlightedNumberOfPeriods:(a,s,t,n)=>{e(ia({firstMonthOfFY:o.firstMonthOfFY,isCompareModeOn:s,additionalBalances:a,maxNumOfPeriodsToHighlight:t<1?1:t,coaBalances:n}))},onAccountBalanceClick:o.hasTransactionAccess!==!0?void 0:(a,s,t)=>{let n,r;if(s.balanceTimeFrame==="month"||s.balanceTimeFrame==="quarter"?(n=s.balanceTimeFrame,r=ca(s)):s.balanceTimeFrame==="year"?(n="quarter",r={startDate:s.endDate.startOf("quarter"),endDate:s.endDate}):console.error(`timeframe ${s.balanceTimeFrame} is not supported`),r!=null&&n!=null){const i=a.accountName===""?a.accountDescription:a.accountName,d=(()=>{if(o.selectedReportID==="profit_and_loss_by_classes"&&o.classViewLayout==="horizontal"&&a.accountType!=null){if(t?.isHorizontalClassTotalColumn===!0)return fe(o.tenantEmailDomain,a.accountId,a.accountType,i,n,r);if(t?.isHorizontalClassColumn===!0&&s.id!=null)return be(o.tenantEmailDomain,a.accountId,a.accountType,s.id,i,n,r)}return a.projectsViewParentId?.projectId!=null&&a.accountType!=null?za(o.tenantEmailDomain,a.accountId,a.accountType,a.projectsViewParentId.projectId,i,n,r):a.classesViewParentId!=null&&a.classesViewParentId.parentClassId!=null&&a.accountType!=null?be(o.tenantEmailDomain,a.accountId,a.accountType,a.classesViewParentId.parentClassId[0],i,n,r):a.accountType!=null?fe(o.tenantEmailDomain,a.accountId,a.accountType,i,n,r):void 0})();if(d!=null){const c=ge(o.location.state?.pathnameStackToGoBack,o.location.pathname);b(d,{state:{pathnameStackToGoBack:c,referrer:D(o.selectedReportID)}})}}},onTableScroll:(a,s)=>{switch(a){case"profit_and_loss":e(K({scrollPosition:s}));break;case"profit_and_loss_by_classes":e($({scrollPosition:s}));break;case"profit_and_loss_by_projects":e(q({scrollPosition:s}));break;case"balance_sheet":e(N({scrollPosition:s}));break;case"balance_sheet_by_classes":e(H({scrollPosition:s}));break;case"balance_sheet_by_projects":e(G({scrollPosition:s}));break;case"cash_flow_by_classes":e(z({scrollPosition:s}));break;case"cash_flow_by_projects":e(W({scrollPosition:s}));break;case"cash_flow":e(x({scrollPosition:s}));break;default:console.log(`Table Scroll state for ${a} is not handled`)}},onElementCollapseStateChanged:(a,s,t)=>{switch(a){case"profit_and_loss":e(K({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_classes":e($({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_projects":e(q({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet":e(N({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_classes":e(H({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_projects":e(G({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_classes":e(z({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_projects":e(W({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow":e(x({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;default:console.log(`Collapse state toggle for ${a} is not handled`)}},onBackClick:()=>{b("../../")},onUpdateAccountViewMode:(a,s)=>{const t=s??o.selectedReportID,n=R(t),r=I(t);r?(e(sa({viewMode:a})),e(ta({viewMode:a}))):n?(e(oa({viewMode:a})),e(na({viewMode:a}))):(e(ra({viewMode:a})),e(la({viewMode:a}))),a==="classes"?(o.analytics?.trackGroupBySwitch("Classes",D(t)),e(k(r?"cash_flow_by_classes":n?"balance_sheet_by_classes":"profit_and_loss_by_classes"))):a==="project"?(o.analytics?.trackGroupBySwitch("Projects",D(t)),e(k(r?"cash_flow_by_projects":n?"balance_sheet_by_projects":"profit_and_loss_by_projects"))):(o.analytics?.trackGroupBySwitch("Accounts",D(t)),e(k(r?"cash_flow":n?"balance_sheet":"profit_and_loss"))),h(e)},onUpdateClassesToFilterOut:a=>{I(o.selectedReportID)?e(Xe({classesToFilterOut:a})):R(o.selectedReportID)?e(ea({classesToFilterOut:a})):e(aa({classesToFilterOut:a}))},onUpdateProjectsToFilterOut:a=>{I(o.selectedReportID)?e(Ze({projectsToFilterOut:a})):R(o.selectedReportID)?e(Je({projectsToFilterOut:a})):e(Qe({projectsToFilterOut:a}))},onUpdateClassViewLayout:a=>{e(re({classViewLayout:a}))},onOpenAccountViewMode:()=>{const a=R(o.selectedReportID),s=I(o.selectedReportID);o.isAccountingClassesEnabled&&e(s?V():a?A():ne()),o.isAccountingProjectsEnabled&&e(s?F():a?P():U())},onUpdateDisplayOrder:a=>{e(Ke(a))},onUpdateReportFormat:a=>{Na(e),e($e(a))},onClickMenuIcon:()=>{m(!0)},onResyncReports:()=>{const a=o.selectedReportID;e(a!=="balance_sheet_by_classes"?a!=="balance_sheet_by_projects"?a!=="cash_flow_by_classes"?a!=="cash_flow_by_projects"?qe(a==="profit_and_loss_by_projects"?"profit_and_loss_by_projects":"profit_and_loss_by_classes"):F(!0):V(!0):P(!0):A(!0))}}}))(Ba);function $a(){const{isAiCfoOpen:e,setIsAiCfoOpen:o}=Oa(),b=Da(),m=va(b),a=ve(),s=Ye(),t=te(),{tenantEmailDomain:n}=Ue(),{useFeatureGate:r}=Ce(),{isFeatureEnabled:i}=r(Z.isReportsHorizontalClassLayoutSwitchEnabled),{isFeatureEnabled:d}=r(Z.isReportsCustomDateRangeEnabled),c=we.getSignedInUser(),[p,M]=u.useState(!1),[X,Ie]=u.useState(!1);if(c==null)throw Error("Can't access reports page without signing in...");const L=_((l=>Q(l))),Re=L.masterTOSInfo?.isMasterTOSAccepted??!1,Se=L.company?.companyInfo.firstMonthOfFY??1,Te=Wa(L?.companyId),w=_((l=>S(l).fetchState)),ke=_((l=>ze(l))),{areTenantIdsInSync:y}=ja(),B=_((l=>l.financeStatementState.selectedReportId)),T=_((l=>ue(l))),g=_((l=>he(l))),Oe=_((l=>S(l).isCompareModeOn)),C=_((l=>S(l).filter)),v=_((l=>S(l).selectedReportAndTimeframeFetchState)),De=_((l=>l.profitAndLossClassesViewState.uiState.classViewLayout));u.useEffect((()=>{!p&&y&&(M(!0),s(Y(c.userId,!0,!0,!1)))}),[p,c,s,y]),u.useEffect((()=>{p&&!X&&w==="Completed"&&y&&(s(Y(c.userId,!1,!0,!1)),Ie(!0))}),[p,X,w,y]),u.useEffect((()=>{if(p&&v.fetchState==="Not-Started"&&C.timeframe!=="free_range"&&C.timeframe!=="week"&&y)switch(B){case"profit_and_loss":case"profit_and_loss_by_classes":s(ye(C.timeframe));break;case"profit_and_loss_by_projects":g&&s(U());break;case"balance_sheet":s(E(C.timeframe));break;case"balance_sheet_by_classes":T&&s(A());break;case"balance_sheet_by_projects":g&&s(P());break;case"cash_flow_by_classes":T&&s(V());break;case"cash_flow_by_projects":g&&s(F());break;case"cash_flow":s(j(C.timeframe))}}),[p,B,v,y,T,g]);const ee=Fa(),je=ee?.loggedInUserRole!=null&&Ge(ee?.loggedInUserRole)!==!0,[Fe,Ve]=u.useState(!1),ae=l=>{Ve(l)},Pe=Va(),Ae=Pa();return(function(l){const{isDataReady:Ee}=l,{pathname:Me}=te(),se=Sa(Me??"")==="reports",Le=Ta(Ee),Be=u.useMemo((()=>se?Ha:void 0),[se]);ka({canFetchSuggestedQuestions:Le,pageContexts:Be})})({isDataReady:w==="Completed"}),Aa({isDataReady:w==="Completed"}),f.jsxs(f.Fragment,{children:[w==="Completed"?f.jsx(Ea,{analytics:J,onLoad:l=>l.trackPageLoaded(Ma.Event.reports)}):null,f.jsx(Ga,{isAppContentDrawerOpen:Fe,handleDrawerToggle:ae}),f.jsx(qa,{firstMonthOfFY:Se,tenantEmailDomain:n,location:t,navigate:a,windowSize:b,classViewLayout:De,selectedReportID:B,analytics:J,filter:C,isAccountingClassesEnabled:T,isAccountingProjectsEnabled:g,isCompareModeOn:Oe,hasTransactionAccess:je,signedInUser:c,selectedReportAndTimeframeFetchState:v,handleDrawerToggle:ae,reportsResyncFetchState:ke.reportsResyncFetchState,isAiCfoAccessEnabled:Ae&&Pe&&!e,onAskAiCfoClick:()=>{if(Re)if(m){const l=ge(t.state?.pathnameStackToGoBack,t.pathname);a(`/${n}/ai-cfo/explore`,{state:{pathnameStackToGoBack:l,referrer:"Reports"}})}else o(!0);else La({location:t,navigate:a,mergeState:{referrer:"Reports"}})},isHorizontalClassReportSwitchEnabled:i,isCustomDateRangeEnabled:d,initialOpenThreadRequest:Te})]})}const D=e=>{switch(e){case"profit_and_loss":case"profit_and_loss_by_classes":case"profit_and_loss_by_projects":return"Profit & Loss";case"balance_sheet":case"balance_sheet_by_classes":case"balance_sheet_by_projects":return"Balance Sheet";case"cash_flow":case"cash_flow_by_classes":case"cash_flow_by_projects":return"Cash Flow";default:return"Reports"}};function ys(){const e=_((s=>Q(s))),{useFeatureGate:o}=Ce(),{isFeatureEnabled:b}=o(Z.isDebitCardFeatureEnabled),m=Ia(b,e),a=Ra(e);return m===!0||a===!0?f.jsx(xa,{}):f.jsxs(We,{children:[f.jsx(oe,{path:"/",element:f.jsx($a,{})}),f.jsx(oe,{path:"*",element:f.jsx(Ua,{})})]})}export{ys as default};
1
+ import{j as f}from"./liveblocks-DZUXZ-JO.js";import{g as te,h as ve,u as Ye,i as Ue,j as _,l as xe,n as ze,o as oe}from"./core-C4Vfz6Ll.js";import{fE as J,ED as S,Vy as Ge,l$ as ue,uh as he,v6 as Y,lG as O,lP as F,lH as V,kK as P,kB as A,kA as E,DG as U,vb as ye,bm as He,Vz as We,bj as Ne,E$ as $e,VA as qe,VB as Ze,cg as R,Dz as ne,VC as re,VD as Ke,VE as Qe,VF as Je,VG as Xe,VH as ea,VI as aa,VJ as sa,VK as ta,VL as oa,VM as na,VN as ra,VO as la,VP as j,VQ as x,VR as z,VS as G,VT as H,VU as W,VV as N,VW as $,VX as q,VY as Z,eg as ca,EF as ia,Er as le,Es as ce,EL as da,Ew as ie,bC as k,VZ as de,de as pe,Ex as _e,ER as pa,V_ as _a,V$ as fa,W0 as ba,W1 as ma,W2 as ua,W3 as ha,W4 as ya,W5 as Ca,W6 as wa,W7 as ga,dZ as Ra,dY as Ia}from"./zeni-epic-state-DmXGRK_Y.js";import{am as Sa,an as Ta,ao as ja,a as ka,a0 as Da,p as Ce,c as K,z as we,ap as Oa,V as Fa,e as Va,aq as Pa,ar as Aa,a7 as Ea,m as Q,S as Ma,D as Ba,n as ge,as as La,at as va,au as Ya}from"./index-CJ_pjNEa.js";import"./mui-C0PYnbt1.js";import Ua from"./NotFoundScreen-CxVO6BUm.js";import{F as xa}from"./FeaturePreviewScreen-Cnh2Fe6t.js";import{a as u}from"./sentry-DfoGRlTp.js";import{u as za}from"./useInitialThreadRequest-BVMcY486.js";import{t as fe,a as be,b as Ga}from"./routePaths-DYebh4Li.js";import{t as me}from"./reportTimeframe-C5AD1AL2.js";import{M as Ha}from"./MobileAppDrawer-B4_Hh2uX.js";import"./recharts-rN5v_P87.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./utils-CmKqkYr5.js";import"./InboxNotificationsProvider-CJt6vmnU.js";import"./useTaskManagerAccess-Cp8R2Cu9.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]="9e2af523-c507-45a5-a656-2420cd620bc5",e._sentryDebugIdIdentifier="sentry-dbid-9e2af523-c507-45a5-a656-2420cd620bc5")}catch{}})();const Wa=["profit_loss","balance_sheet","cash_flow"],I=e=>e==="balance_sheet"||e==="balance_sheet_by_classes"||e==="balance_sheet_by_projects",h=e=>{e(Z({resetLeftScroll:!0})),e(q({resetLeftScroll:!0})),e($({resetLeftScroll:!0})),e(N({resetLeftScroll:!0})),e(W({resetLeftScroll:!0})),e(H({resetLeftScroll:!0})),e(x({resetLeftScroll:!0})),e(G({resetLeftScroll:!0})),e(z({resetLeftScroll:!0}))},Na=e=>{e(fa()),e(ba()),e(ma()),e(ua()),e(ha()),e(ya()),e(Ca()),e(wa()),e(ga())},$a=xe((function(e){const o=we.getSignedInUser(),b=e.tenantState.currentTenantId,m=J(e),a=m?.companyName??"",s={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:b??""},t=S(e),n=We(m);return{fetchState:t.fetchState,selectedTimeframe:t.filter.timeframe,selectedReport:t.selectedReportId,displayOrder:t.displayOrder,reportFormat:t.reportFormat,dataAvailable:t.dataAvailable,balancesInTimeframe:t.balancesInTimeframe,allTimeframeTicks:t.allTimeframeTicks,selectedCOABalancesRange:t.filter.balancesRange,isCompareMode:t.isCompareModeOn,profitAndLossReport:t.profitAndLossReport,profitAndLossClassesViewReport:t.profitAndLossByClassReport,profitAndLossProjectViewReport:t.profitAndLossByProjectReport,profitAndLossByClassHorizontalReport:t.profitAndLossByClassHorizontalReport,balanceSheetReport:t.balanceSheetReport,balanceSheetClassesViewReport:t.balanceSheetByClassReport,cashFlowClassesViewReport:t.cashFlowByClassReport,cashFlowProjectViewReport:t.cashFlowByProjectReport,balanceSheetProjectViewReport:t.balanceSheetByProjectReport,cashFlowReport:t.cashFlowReport,downloadState:t.downloadState,analytics:Q,isZeniUser:Ne(o),showAccountGroups:n===!0,isAccountingClassesEnabled:ue(e),isAccountingProjectsEnabled:he(e),currentTenantCompanyName:a,statementEndPoint:`${Ya}/statement`,authParams:s,isZeniCOAUsed:n}}),(function(e,o){const{navigate:b,handleDrawerToggle:m}=o;return{onReloadReport:()=>{o.signedInUser!=null&&e(Y(o.signedInUser.userId,!0,!1))},updateDownloadStateHandler:a=>{e(_a(a))},onTimeframeSelectionChanged:(a,s,t)=>{if(e(pa(a)),s){const{isCompareModeOn:n,filter:r}=o,{additionalBalances:i,balancesRange:d}=r;let c=[...i];a==="year"&&(c=c.filter((p=>p!=="this_period_vs_same_period_last_year"&&p!=="this_period_vs_same_period_last_year_percent"&&p!=="same_period_last_year"))),e(le(o.firstMonthOfFY,n,d.numberOfPeriods<1?1:d.numberOfPeriods,c)),i.length>0&&e(ce(o.firstMonthOfFY,c.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",d.numberOfPeriods<1?1:d.numberOfPeriods,c))}t!==!0&&setTimeout((()=>h(e)),50)},onInitialDateRangeAvailable:(a,s)=>{const{filter:t}=o,n=me(t.timeframe),r=k(a),i=k(s),d=de(o.firstMonthOfFY,n,{startDate:r,endDate:i})??t.balancesRange.numberOfPeriods,{startOfTimeframeFY:c,endOfTimeframeFY:p}=pe(i,o.firstMonthOfFY,n);e(_e({numberOfPeriods:d,orderBy:t.balancesRange.orderBy,thisPeriod:{startDate:c,endDate:p}}))},onCustomDateRangeChanged:(a,s,t)=>{const{filter:n}=o,r=me(t??n.timeframe);switch(o.selectedReportID){case"profit_and_loss":case"profit_and_loss_by_classes":e(ye(r,void 0,!0,!1,a,s)),o.selectedReportID==="profit_and_loss_by_classes"&&o.isAccountingClassesEnabled&&e(ne());break;case"profit_and_loss_by_projects":o.isAccountingProjectsEnabled&&e(U());break;case"balance_sheet":e(E(r,!0,!1,a,s));break;case"balance_sheet_by_classes":e(E(r,!0,!1,a,s)),o.isAccountingClassesEnabled&&e(A());break;case"balance_sheet_by_projects":e(E(r,!0,!1,a,s)),o.isAccountingProjectsEnabled&&e(P());break;case"cash_flow":e(O(r,!0,a,s));break;case"cash_flow_by_classes":e(O(r,!0,a,s)),o.isAccountingClassesEnabled&&e(V());break;case"cash_flow_by_projects":e(O(r,!0,a,s)),o.isAccountingProjectsEnabled&&e(F())}const i=k(a),d=k(s),c=de(o.firstMonthOfFY,r,{startDate:i,endDate:d})??n.balancesRange.numberOfPeriods,{startOfTimeframeFY:p,endOfTimeframeFY:M}=pe(d,o.firstMonthOfFY,r);e(_e({numberOfPeriods:c,orderBy:n.balancesRange.orderBy,thisPeriod:{startDate:p,endDate:M}})),h(e)},onReportSelectionChanged:a=>{const s=o.selectedReportID;if(a===s)return;const t=o.classViewLayout;e(j(a)),(I(a)||R(a))&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(ie({numberOfPeriods:1,orderBy:"ascending_date"})),a!=="profit_and_loss"&&a!=="profit_and_loss_by_classes"&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(re({classViewLayout:"vertical"})),h(e)},onCOABalancesRangeChanged:(a,s)=>{e(ie(a,s)),h(e)},onThisPeriodChanged:(a,s,t)=>{e(da(o.firstMonthOfFY,a,s<1?1:s)),t!==!0&&h(e)},onAdditionalBalanceSelectionChanged:(a,s,t,n)=>{e(le(o.firstMonthOfFY,a,t<1?1:t,s)),s.length>0&&e(ce(o.firstMonthOfFY,s.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",t<1?1:t,s)),n!==!0&&o.isCompareModeOn===a||setTimeout((()=>h(e)),50)},onUpdateHighlightedNumberOfPeriods:(a,s,t,n)=>{e(ia({firstMonthOfFY:o.firstMonthOfFY,isCompareModeOn:s,additionalBalances:a,maxNumOfPeriodsToHighlight:t<1?1:t,coaBalances:n}))},onAccountBalanceClick:o.hasTransactionAccess!==!0?void 0:(a,s,t)=>{let n,r;if(s.balanceTimeFrame==="month"||s.balanceTimeFrame==="quarter"?(n=s.balanceTimeFrame,r=ca(s)):s.balanceTimeFrame==="year"?(n="quarter",r={startDate:s.endDate.startOf("quarter"),endDate:s.endDate}):console.error(`timeframe ${s.balanceTimeFrame} is not supported`),r!=null&&n!=null){const i=a.accountName===""?a.accountDescription:a.accountName,d=(()=>{if(o.selectedReportID==="profit_and_loss_by_classes"&&o.classViewLayout==="horizontal"&&a.accountType!=null){if(t?.isHorizontalClassTotalColumn===!0)return fe(o.tenantEmailDomain,a.accountId,a.accountType,i,n,r);if(t?.isHorizontalClassColumn===!0&&s.id!=null)return be(o.tenantEmailDomain,a.accountId,a.accountType,s.id,i,n,r)}return a.projectsViewParentId?.projectId!=null&&a.accountType!=null?Ga(o.tenantEmailDomain,a.accountId,a.accountType,a.projectsViewParentId.projectId,i,n,r):a.classesViewParentId!=null&&a.classesViewParentId.parentClassId!=null&&a.accountType!=null?be(o.tenantEmailDomain,a.accountId,a.accountType,a.classesViewParentId.parentClassId[0],i,n,r):a.accountType!=null?fe(o.tenantEmailDomain,a.accountId,a.accountType,i,n,r):void 0})();if(d!=null){const c=ge(o.location.state?.pathnameStackToGoBack,o.location.pathname);b(d,{state:{pathnameStackToGoBack:c,referrer:D(o.selectedReportID)}})}}},onTableScroll:(a,s)=>{switch(a){case"profit_and_loss":e(Z({scrollPosition:s}));break;case"profit_and_loss_by_classes":e(q({scrollPosition:s}));break;case"profit_and_loss_by_projects":e($({scrollPosition:s}));break;case"balance_sheet":e(N({scrollPosition:s}));break;case"balance_sheet_by_classes":e(W({scrollPosition:s}));break;case"balance_sheet_by_projects":e(H({scrollPosition:s}));break;case"cash_flow_by_classes":e(G({scrollPosition:s}));break;case"cash_flow_by_projects":e(z({scrollPosition:s}));break;case"cash_flow":e(x({scrollPosition:s}));break;default:console.log(`Table Scroll state for ${a} is not handled`)}},onElementCollapseStateChanged:(a,s,t)=>{switch(a){case"profit_and_loss":e(Z({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_classes":e(q({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_projects":e($({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet":e(N({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_classes":e(W({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_projects":e(H({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_classes":e(G({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_projects":e(z({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow":e(x({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;default:console.log(`Collapse state toggle for ${a} is not handled`)}},onBackClick:()=>{b("../../")},onUpdateAccountViewMode:(a,s)=>{const t=s??o.selectedReportID,n=I(t),r=R(t);r?(e(sa({viewMode:a})),e(ta({viewMode:a}))):n?(e(oa({viewMode:a})),e(na({viewMode:a}))):(e(ra({viewMode:a})),e(la({viewMode:a}))),a==="classes"?(o.analytics?.trackGroupBySwitch("Classes",D(t)),e(j(r?"cash_flow_by_classes":n?"balance_sheet_by_classes":"profit_and_loss_by_classes"))):a==="project"?(o.analytics?.trackGroupBySwitch("Projects",D(t)),e(j(r?"cash_flow_by_projects":n?"balance_sheet_by_projects":"profit_and_loss_by_projects"))):(o.analytics?.trackGroupBySwitch("Accounts",D(t)),e(j(r?"cash_flow":n?"balance_sheet":"profit_and_loss"))),h(e)},onUpdateClassesToFilterOut:a=>{R(o.selectedReportID)?e(Xe({classesToFilterOut:a})):I(o.selectedReportID)?e(ea({classesToFilterOut:a})):e(aa({classesToFilterOut:a}))},onUpdateProjectsToFilterOut:a=>{R(o.selectedReportID)?e(Ke({projectsToFilterOut:a})):I(o.selectedReportID)?e(Qe({projectsToFilterOut:a})):e(Je({projectsToFilterOut:a}))},onUpdateClassViewLayout:a=>{e(re({classViewLayout:a}))},onOpenAccountViewMode:()=>{const a=I(o.selectedReportID),s=R(o.selectedReportID);o.isAccountingClassesEnabled&&e(s?V():a?A():ne()),o.isAccountingProjectsEnabled&&e(s?F():a?P():U())},onUpdateDisplayOrder:a=>{e(Ze(a))},onUpdateReportFormat:a=>{Na(e),e(qe(a))},onClickMenuIcon:()=>{m(!0)},onResyncReports:()=>{const a=o.selectedReportID;e(a!=="balance_sheet_by_classes"?a!=="balance_sheet_by_projects"?a!=="cash_flow_by_classes"?a!=="cash_flow_by_projects"?$e(a==="profit_and_loss_by_projects"?"profit_and_loss_by_projects":"profit_and_loss_by_classes"):F(!0):V(!0):P(!0):A(!0))}}}))(La);function qa(){const{isAiCfoOpen:e,setIsAiCfoOpen:o}=ka(),b=Da(),m=va(b),a=ve(),s=Ye(),t=te(),{tenantEmailDomain:n}=Ue(),{useFeatureGate:r}=Ce(),{isFeatureEnabled:i}=r(K.isReportsHorizontalClassLayoutSwitchEnabled),{isFeatureEnabled:d}=r(K.isReportsCustomDateRangeEnabled),c=we.getSignedInUser(),[p,M]=u.useState(!1),[X,Re]=u.useState(!1);if(c==null)throw Error("Can't access reports page without signing in...");const B=_((l=>J(l))),Ie=B.masterTOSInfo?.isMasterTOSAccepted??!1,Se=B.company?.companyInfo.firstMonthOfFY??1,Te=za(B?.companyId),w=_((l=>S(l).fetchState)),je=_((l=>Ge(l))),{areTenantIdsInSync:y}=Oa(),L=_((l=>l.financeStatementState.selectedReportId)),T=_((l=>ue(l))),g=_((l=>he(l))),ke=_((l=>S(l).isCompareModeOn)),C=_((l=>S(l).filter)),v=_((l=>S(l).selectedReportAndTimeframeFetchState)),De=_((l=>l.profitAndLossClassesViewState.uiState.classViewLayout));u.useEffect((()=>{!p&&y&&(M(!0),s(Y(c.userId,!0,!0,!1)))}),[p,c,s,y]),u.useEffect((()=>{p&&!X&&w==="Completed"&&y&&(s(Y(c.userId,!1,!0,!1)),Re(!0))}),[p,X,w,y]),u.useEffect((()=>{if(p&&v.fetchState==="Not-Started"&&C.timeframe!=="free_range"&&C.timeframe!=="week"&&y)switch(L){case"profit_and_loss":case"profit_and_loss_by_classes":s(ye(C.timeframe));break;case"profit_and_loss_by_projects":g&&s(U());break;case"balance_sheet":s(E(C.timeframe));break;case"balance_sheet_by_classes":T&&s(A());break;case"balance_sheet_by_projects":g&&s(P());break;case"cash_flow_by_classes":T&&s(V());break;case"cash_flow_by_projects":g&&s(F());break;case"cash_flow":s(O(C.timeframe))}}),[p,L,v,y,T,g]);const ee=Fa(),Oe=ee?.loggedInUserRole!=null&&He(ee?.loggedInUserRole)!==!0,[Fe,Ve]=u.useState(!1),ae=l=>{Ve(l)},Pe=Va(),Ae=Pa();return(function(l){const{isDataReady:Ee}=l,{pathname:Me}=te(),se=Sa(Me??"")==="reports",Be=Ta(Ee),Le=u.useMemo((()=>se?Wa:void 0),[se]);ja({canFetchSuggestedQuestions:Be,pageContexts:Le})})({isDataReady:w==="Completed"}),Aa({isDataReady:w==="Completed"}),f.jsxs(f.Fragment,{children:[w==="Completed"?f.jsx(Ea,{analytics:Q,onLoad:l=>l.trackPageLoaded(Ma.Event.reports)}):null,f.jsx(Ha,{isAppContentDrawerOpen:Fe,handleDrawerToggle:ae}),f.jsx($a,{firstMonthOfFY:Se,tenantEmailDomain:n,location:t,navigate:a,windowSize:b,classViewLayout:De,selectedReportID:L,analytics:Q,filter:C,isAccountingClassesEnabled:T,isAccountingProjectsEnabled:g,isCompareModeOn:ke,hasTransactionAccess:Oe,signedInUser:c,selectedReportAndTimeframeFetchState:v,handleDrawerToggle:ae,reportsResyncFetchState:je.reportsResyncFetchState,isAiCfoAccessEnabled:Ae&&Pe&&!e,onAskAiCfoClick:()=>{if(Ie)if(m){const l=ge(t.state?.pathnameStackToGoBack,t.pathname);a(`/${n}/ai-cfo/explore`,{state:{pathnameStackToGoBack:l,referrer:"Reports"}})}else o(!0);else Ba({location:t,navigate:a,mergeState:{referrer:"Reports"}})},isHorizontalClassReportSwitchEnabled:i,isCustomDateRangeEnabled:d,initialOpenThreadRequest:Te})]})}const D=e=>{switch(e){case"profit_and_loss":case"profit_and_loss_by_classes":case"profit_and_loss_by_projects":return"Profit & Loss";case"balance_sheet":case"balance_sheet_by_classes":case"balance_sheet_by_projects":return"Balance Sheet";case"cash_flow":case"cash_flow_by_classes":case"cash_flow_by_projects":return"Cash Flow";default:return"Reports"}};function ys(){const e=_((s=>J(s))),{useFeatureGate:o}=Ce(),{isFeatureEnabled:b}=o(K.isDebitCardFeatureEnabled),m=Ra(b,e),a=Ia(e);return m===!0||a===!0?f.jsx(xa,{}):f.jsxs(ze,{children:[f.jsx(oe,{path:"/",element:f.jsx(qa,{})}),f.jsx(oe,{path:"*",element:f.jsx(Ua,{})})]})}export{ys as default};
@@ -0,0 +1 @@
1
+ import{j as a}from"./liveblocks-DZUXZ-JO.js";import{z as b,a7 as v,m as p,S as N,e6 as k,p as C,c as I}from"./index-CJ_pjNEa.js";import"./mui-C0PYnbt1.js";import g from"./NotFoundScreen-CxVO6BUm.js";import{a as c}from"./sentry-DfoGRlTp.js";import{u as D,j as h,h as F,g as L,l as _,n as T,o as f,N as y}from"./core-C4Vfz6Ll.js";import{fE as U,a2_ as j,a2$ as d,Ei as P,q3 as V,a30 as q,Eg as z}from"./zeni-epic-state-DmXGRK_Y.js";import"./recharts-rN5v_P87.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./utils-CmKqkYr5.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]="f1ef5168-04b8-4cea-9102-187bac372833",e._sentryDebugIdIdentifier="sentry-dbid-f1ef5168-04b8-4cea-9102-187bac372833")}catch{}})();const G=_((function(e,t){const n=j(e);return{inviteFormView:n.localData,submitStatus:n.saveStatus,userName:t.userName,rewardsPlan:n.rewardsPlan,companyLegalName:t.companyName}}),(function(e,t){const{navigate:n}=t,i=b.getSignedInUser();return{onDismissClick:()=>{e(d()),n("/")},onSendClick:()=>{if(i!=null){const s=[],r=[];t.inviteFormCompayData.forEach((m=>{s.push(m.companyName),r.push(m.emailIds[0])})),p.trackInviteEmailClicked("send",s,r,s.length)}e(z())},onUpdateInviteFormLocalData:s=>{e(q({localData:s}))},onSubmitSuccess:()=>{e(d())},onCancelClick:()=>{i!=null&&p.trackInviteEmailClicked("cancel")}}}))(k),R=()=>{const e=D(),[t,n]=c.useState(!1),[i,s]=c.useState(!1),r=h((o=>U(o))),m=F(),w=L(),u=b.getSignedInUser();if(u==null)throw Error("Can't access invite referral screen without signing in...");const l=h((o=>j(o))),x=u?.firstName!=null?u.firstName:"User";c.useEffect((()=>{e(d()),r?.rewardsLastViewedTime==null&&i===!1&&(e(P()),s(!0))}),[]),c.useEffect((()=>{t||l.fetchState!=="Not-Started"||(n(!0),e(V(!0)))}),[l.fetchState,e]);const E=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[l.fetchState==="Completed"?a.jsx(v,{analytics:p,onLoad:o=>(S=>S.trackPageLoaded(N.Event.inviteEmailViewed))(o)}):null,a.jsx(G,{navigate:m,location:w,currentTenant:r,companyName:E,userName:x,inviteFormCompayData:l.localData})]})};function ne(){const{useFeatureGate:e}=C(),{isFeatureEnabled:t}=e(I.isReferralFeatureEnabled);return a.jsxs(T,{children:[a.jsx(f,{path:"/",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(f,{path:"how-it-works",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(f,{path:"refer/*",element:t?a.jsx(R,{}):a.jsx(g,{})}),a.jsx(f,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};
@@ -1,4 +1,4 @@
1
- import{j as E}from"./liveblocks-BdMPZzDQ.js";import{a as v}from"./sentry-Buwow292.js";import{i as M,u as H,h as Q,g as ee,j as r,l as te}from"./core-o-ca34AJ.js";import{XB as Fe,XC as Ge,m3 as ae,sF as Ve,sR as Me,t5 as Re,t3 as $e,t6 as Ke,t8 as Ue,XD as Ye,fI as K,WA as pe,XE as Se,h2 as ne,cD as le,cE as se,FN as ve,XF as Ce,FR as Xe,gS as ce,sI as qe,th as ze,dF as We,dE as Ze,TW as fe,FL as He,FF as Qe,XG as De,Fx as et,Fw as tt,Fr as at,FC as nt,FS as lt,XH as Y,XI as ge,Fy as st,WB as oe,G6 as Ae,F$ as Ie,XJ as xe,sL as Te,FV as Be,FT as Le,XK as Je,Gd as be,Ga as we,FW as je,Gc as Ne}from"./zeni-epic-state-MQ0qdl-Q.js";import{a3 as de,aX as ie,aY as ct,z as ot,l as dt,a6 as it,a7 as ue,m as _,au as ut,aZ as rt,n as G,G as ye,g as Ee,a_ as ht,a$ as mt,b0 as pt}from"./index-Bx2gJO4r.js";import{n as re}from"./mui-cK5UWUvi.js";import{p as St}from"./pathToGoBack-Bk8jMuE9.js";import{u as ft}from"./useActualMatchingMatchDetail-DBoUtV2d.js";import Z from"./NotFoundScreen-BXfz4Cwt.js";import{c as V}from"./routePaths-DBf4ybcn.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]="7f4593ab-559e-4044-b479-c1bcf86ca9c5",e._sentryDebugIdIdentifier="sentry-dbid-7f4593ab-559e-4044-b479-c1bcf86ca9c5")}catch{}})();function Ut({isRenderedInPanel:e=!1,accrualIdOverride:t,onPanelNavigateBack:c}={}){const{accrualId:l}=M(),s=t??l,n=H(),i=Q(),a=ee(),{accrual:d,actionFetchState:o,detailFetchState:h,localData:A}=r((u=>Fe(u,s??""))),m=r((u=>Ge(u))),C=r((u=>ae(u))),y=ft(),S=v.useCallback((()=>{const u=de(a.state?.pathnameStackToGoBack);i(u.poppedPathname??St(4),{state:{pathnameStackToGoBack:u.newStack}})}),[a.state,i]),I=v.useRef(!1);return v.useEffect((()=>{o.fetchState!=="In-Progress"&&I.current&&o.fetchState==="Completed"&&(I.current=!1,S())}),[o.fetchState,S]),v.useEffect((()=>{s!=null&&d==null&&h.fetchState==="Not-Started"&&n(Ve(s))}),[s,d,h.fetchState]),v.useEffect((()=>{n(Me({scheduleType:"prepaid_expenses",shouldResetEnteredData:!1}))}),[n]),s==null?E.jsx(Z,{}):d==null?h.fetchState==="Not-Started"||h.fetchState==="In-Progress"?E.jsx(ie,{}):E.jsx(Z,{}):E.jsx(Dt,{children:E.jsx(ct,{isRenderedInPanel:e,accrual:d,actionFetchState:o.fetchState,isAccountingClassesEnabled:C,localData:A,newAccrualAccountsView:m,onAccrualFormChange:(u,f)=>{n(Ye({accrualId:u,localData:f}))},onAccrualFormClear:u=>{n(Ue({accrualId:u}))},onApproveAndPost:u=>{n(Ke(s,u))},onNavigateBack:c??S,onOpenJournalEntry:y,onRevert:(u,f)=>{I.current=!0,n($e(s,u,f))},onSkip:(u,f)=>{n(Re(s,u,f))}})})}const Dt=re.div`
1
+ import{j as E}from"./liveblocks-DZUXZ-JO.js";import{a as v}from"./sentry-DfoGRlTp.js";import{i as M,u as W,h as Q,g as ee,j as r,l as te}from"./core-C4Vfz6Ll.js";import{Xx as Fe,Xy as Ge,l$ as ae,sB as Ve,sN as Me,t1 as $e,s$ as Re,t2 as Ke,t4 as Ue,Xz as Ye,fE as K,Ww as pe,XA as Se,g_ as ne,cz as le,cA as se,FJ as ve,XB as Ce,FN as Xe,gO as ce,sE as ze,td as qe,dB as Ze,dA as He,TS as fe,FH as We,FB as Qe,XC as De,Ft as et,Fs as tt,Fn as at,Fy as nt,FO as lt,XD as Y,XE as ge,Fu as st,Wx as oe,G2 as Ae,FX as Ie,XF as xe,sH as Te,FR as Be,FP as Le,XG as Je,G9 as we,G6 as be,FS as je,G8 as Ne}from"./zeni-epic-state-DmXGRK_Y.js";import{a3 as de,aX as ie,aY as ct,z as ot,l as dt,a6 as it,a7 as ue,m as _,au as ut,aZ as rt,n as G,G as ye,g as Ee,a_ as ht,a$ as mt,b0 as pt}from"./index-CJ_pjNEa.js";import{n as re}from"./mui-C0PYnbt1.js";import{p as St}from"./pathToGoBack-DF1y-0ht.js";import{u as ft}from"./useActualMatchingMatchDetail-DPtaMcdm.js";import H from"./NotFoundScreen-CxVO6BUm.js";import{c as V}from"./routePaths-DYebh4Li.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]="373f2410-e0b0-4d8c-9bc7-c027622e4126",e._sentryDebugIdIdentifier="sentry-dbid-373f2410-e0b0-4d8c-9bc7-c027622e4126")}catch{}})();function Ut({isRenderedInPanel:e=!1,accrualIdOverride:t,onPanelNavigateBack:c}={}){const{accrualId:l}=M(),s=t??l,n=W(),i=Q(),a=ee(),{accrual:d,actionFetchState:o,detailFetchState:h,localData:A}=r((u=>Fe(u,s??""))),m=r((u=>Ge(u))),C=r((u=>ae(u))),y=ft(),S=v.useCallback((()=>{const u=de(a.state?.pathnameStackToGoBack);i(u.poppedPathname??St(4),{state:{pathnameStackToGoBack:u.newStack}})}),[a.state,i]),I=v.useRef(!1);return v.useEffect((()=>{o.fetchState!=="In-Progress"&&I.current&&o.fetchState==="Completed"&&(I.current=!1,S())}),[o.fetchState,S]),v.useEffect((()=>{s!=null&&d==null&&h.fetchState==="Not-Started"&&n(Ve(s))}),[s,d,h.fetchState]),v.useEffect((()=>{n(Me({scheduleType:"prepaid_expenses",shouldResetEnteredData:!1}))}),[n]),s==null?E.jsx(H,{}):d==null?h.fetchState==="Not-Started"||h.fetchState==="In-Progress"?E.jsx(ie,{}):E.jsx(H,{}):E.jsx(Dt,{children:E.jsx(ct,{isRenderedInPanel:e,accrual:d,actionFetchState:o.fetchState,isAccountingClassesEnabled:C,localData:A,newAccrualAccountsView:m,onAccrualFormChange:(u,f)=>{n(Ye({accrualId:u,localData:f}))},onAccrualFormClear:u=>{n(Ue({accrualId:u}))},onApproveAndPost:u=>{n(Ke(s,u))},onNavigateBack:c??S,onOpenJournalEntry:y,onRevert:(u,f)=>{I.current=!0,n(Re(s,u,f))},onSkip:(u,f)=>{n($e(s,u,f))}})})}const Dt=re.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,7 +6,7 @@ import{j as E}from"./liveblocks-BdMPZzDQ.js";import{a as v}from"./sentry-Buwow29
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,gt=ye.getLocalizedStrings(),yt=te((function(e,t){const c=Se(e,t.scheduleTab),l=e.tenantState.currentTenantId;return{authParams:{userId:t.signedInUser.userId??"",sessionId:t.signedInUser.zeniSessionId??"",tenantId:l??""},linkBillExpenseView:c.linkBillExpenseView,transactions:c.linkBillExpenseView.transactions}}),(function(e,t){const{navigate:c,location:l}=t;return{onTransactionSelect(s){e(Ce({selectedTransaction:s}))},onBackClick:()=>{c("..",{relative:"path"})},onCancel(){e(Ce({selectedTransaction:void 0})),e(Xe()),c("..",{relative:"path"})},onTransactionClick:s=>{const n=`${V(s,t.tenantEmailDomain)}`,i=G(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:i}})},onLinkSave(){t.setShouldNavigateBack(!1),e(ve(t.scheduleTab,t.scheduleAccruedDetailsView.selectedJEAccruedSchedule?.jeScheduleId))}}}))(rt),Yt=({setShouldNavigateBack:e})=>{const t=Q(),c=ee(),{scheduleDetailId:l,tenantEmailDomain:s}=M(),{scheduleType:n}=M();if(s==null)throw Error("Can't access Link Bill Expense page without tenant Email Domain");const i=r((y=>K(y))),a=pe(n)??"accrued_expenses",d=ot.getSignedInUser();if(d==null)throw Error("Can't access Link Bill Expensedetail page without signing in...");if(l==null)throw Error("Invalid Schedule Detail Id");const o=r((y=>Se(y,a))),h=o.selectedJELinkRowIndex,A=r((y=>ne(y,i.companyId))),m=dt(o.updateStatus.fetchState);v.useEffect((()=>{m==="In-Progress"&&o.updateStatus.fetchState==="Completed"&&t("..",{relative:"path"})}),[m,o.updateStatus.fetchState]),v.useEffect((()=>{o.fetchState==="Not-Started"&&t("..",{relative:"path"})}),[]),v.useEffect((()=>{o.selectedJEAccruedSchedule!=null&&o.selectedJELinkRowIndex!=null||t("..",{relative:"path"})}),[o.selectedJEAccruedSchedule,o.selectedJELinkRowIndex]);const C=o.linkBillExpenseView.fetchState==="Completed";return E.jsx(E.Fragment,{children:o.linkBillExpenseView.fetchState==="In-Progress"?E.jsx(it,{fetchState:o.linkBillExpenseView.fetchState}):o.selectedJEAccruedSchedule!=null&&h!=null?E.jsxs(E.Fragment,{children:[C===!0?E.jsx(ue,{analytics:_,onLoad:()=>{Et(o,a,A)}}):null,E.jsx(yt,{signedInUser:d,attachmentEndPoint:`${ut}/vendor_attachments`,setShouldNavigateBack:e,scheduleVendorId:o.selectedJEAccruedSchedule.vendor.id??"",location:c,tenantEmailDomain:s,scheduleAccruedDetailsView:o,saveFetchState:o.updateStatus.fetchState,scheduleTab:a,navigate:t,analytics:_,controllerUserDetails:A,saveStatus:o.updateStatus.fetchState,jeAccruedSchedule:o.selectedJEAccruedSchedule,localData:o.scheduleAccruedDetailsLocalData.jeScheduleDetails[h]})]}):null})},_e=e=>{const t=gt.dateFormat.analytics.YYYYDashMMDashDDFormat;return{scheduleCreateDate:e.createTime.format(t)??null,scheduleMonthlyAmount:e.recurringAmount??null,startingBalance:e.otherAttributes.startingBalance??null,scheduleAccountCategory:e.jeCredit.account?.accountName??null,description:e.memo,runningBalance:e.balanceAsOfToday??null,currentBalance:e.balanceAsOfToday??null,currentStatus:e.status.label,period:e.period??null,startMonth:e.startDate?.format(t)??null,endMonth:e.endDate?.format(t)??null}},Et=(e,t,c)=>{const l=e.selectedJEAccruedSchedule,s=e.selectedJELinkRowIndex;let n;s!=null&&l!=null&&(n=l.scheduledJournalEntry[s]);const{transactions:i}=e.linkBillExpenseView,a=i.some((h=>h.isRecommendedTransaction===!0)),d=le(c.controllers),o=se(c.controllerUserIds);l!=null&&_.trackScheduleAccruedDetailsJournalEntryLinkedLoaded({scheduleType:t,schedule:{..._e(l)},scheduleExpenseCategoryAndClass:{expenseCategory:l.jeDebit.account?.accountName??null,expenseClass:l.jeDebit.accountingClass?.className??null},journalEntryDetails:{wasRecommendationAvailable:a,journalEntryPostingStatus:n?.status.label??""},vendorName:l.vendor.name??null,controllerEmails:d,controllerUserIds:o})};function ke({jeScheduleId:e,scheduleKey:t,scheduleType:c,onDecided:l}){const s=H(),{ignoreStatusById:n,revertStatusById:i}=r((A=>ce(A).jeSchedules)),a=v.useRef(void 0),d=t==null||a.current==null?void 0:a.current==="ignore"?n[t]?.fetchState:i[t]?.fetchState,o=v.useRef(!1),h=v.useRef(l);return h.current=l,v.useEffect((()=>{o.current&&d==="Completed"&&(o.current=!1,h.current())}),[d]),{onScheduleDecision:v.useCallback(((A,m,C)=>{if(t!=null){if(A==="ignore")return(function(y){return We.includes(y)})(m)?(o.current=!0,a.current="ignore",void s(qe(t,c,m,C))):void 0;e!=null&&(function(y){return Ze.includes(y)})(m)&&(o.current=!0,a.current="revert",s(ze(e,t,c,m,C)))}}),[s,e,t,c]),scheduleDecisionStatus:d}}const kt=re.div`
9
+ `,gt=ye.getLocalizedStrings(),yt=te((function(e,t){const c=Se(e,t.scheduleTab),l=e.tenantState.currentTenantId;return{authParams:{userId:t.signedInUser.userId??"",sessionId:t.signedInUser.zeniSessionId??"",tenantId:l??""},linkBillExpenseView:c.linkBillExpenseView,transactions:c.linkBillExpenseView.transactions}}),(function(e,t){const{navigate:c,location:l}=t;return{onTransactionSelect(s){e(Ce({selectedTransaction:s}))},onBackClick:()=>{c("..",{relative:"path"})},onCancel(){e(Ce({selectedTransaction:void 0})),e(Xe()),c("..",{relative:"path"})},onTransactionClick:s=>{const n=`${V(s,t.tenantEmailDomain)}`,i=G(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:i}})},onLinkSave(){t.setShouldNavigateBack(!1),e(ve(t.scheduleTab,t.scheduleAccruedDetailsView.selectedJEAccruedSchedule?.jeScheduleId))}}}))(rt),Yt=({setShouldNavigateBack:e})=>{const t=Q(),c=ee(),{scheduleDetailId:l,tenantEmailDomain:s}=M(),{scheduleType:n}=M();if(s==null)throw Error("Can't access Link Bill Expense page without tenant Email Domain");const i=r((y=>K(y))),a=pe(n)??"accrued_expenses",d=ot.getSignedInUser();if(d==null)throw Error("Can't access Link Bill Expensedetail page without signing in...");if(l==null)throw Error("Invalid Schedule Detail Id");const o=r((y=>Se(y,a))),h=o.selectedJELinkRowIndex,A=r((y=>ne(y,i.companyId))),m=dt(o.updateStatus.fetchState);v.useEffect((()=>{m==="In-Progress"&&o.updateStatus.fetchState==="Completed"&&t("..",{relative:"path"})}),[m,o.updateStatus.fetchState]),v.useEffect((()=>{o.fetchState==="Not-Started"&&t("..",{relative:"path"})}),[]),v.useEffect((()=>{o.selectedJEAccruedSchedule!=null&&o.selectedJELinkRowIndex!=null||t("..",{relative:"path"})}),[o.selectedJEAccruedSchedule,o.selectedJELinkRowIndex]);const C=o.linkBillExpenseView.fetchState==="Completed";return E.jsx(E.Fragment,{children:o.linkBillExpenseView.fetchState==="In-Progress"?E.jsx(it,{fetchState:o.linkBillExpenseView.fetchState}):o.selectedJEAccruedSchedule!=null&&h!=null?E.jsxs(E.Fragment,{children:[C===!0?E.jsx(ue,{analytics:_,onLoad:()=>{Et(o,a,A)}}):null,E.jsx(yt,{signedInUser:d,attachmentEndPoint:`${ut}/vendor_attachments`,setShouldNavigateBack:e,scheduleVendorId:o.selectedJEAccruedSchedule.vendor.id??"",location:c,tenantEmailDomain:s,scheduleAccruedDetailsView:o,saveFetchState:o.updateStatus.fetchState,scheduleTab:a,navigate:t,analytics:_,controllerUserDetails:A,saveStatus:o.updateStatus.fetchState,jeAccruedSchedule:o.selectedJEAccruedSchedule,localData:o.scheduleAccruedDetailsLocalData.jeScheduleDetails[h]})]}):null})},_e=e=>{const t=gt.dateFormat.analytics.YYYYDashMMDashDDFormat;return{scheduleCreateDate:e.createTime.format(t)??null,scheduleMonthlyAmount:e.recurringAmount??null,startingBalance:e.otherAttributes.startingBalance??null,scheduleAccountCategory:e.jeCredit.account?.accountName??null,description:e.memo,runningBalance:e.balanceAsOfToday??null,currentBalance:e.balanceAsOfToday??null,currentStatus:e.status.label,period:e.period??null,startMonth:e.startDate?.format(t)??null,endMonth:e.endDate?.format(t)??null}},Et=(e,t,c)=>{const l=e.selectedJEAccruedSchedule,s=e.selectedJELinkRowIndex;let n;s!=null&&l!=null&&(n=l.scheduledJournalEntry[s]);const{transactions:i}=e.linkBillExpenseView,a=i.some((h=>h.isRecommendedTransaction===!0)),d=le(c.controllers),o=se(c.controllerUserIds);l!=null&&_.trackScheduleAccruedDetailsJournalEntryLinkedLoaded({scheduleType:t,schedule:{..._e(l)},scheduleExpenseCategoryAndClass:{expenseCategory:l.jeDebit.account?.accountName??null,expenseClass:l.jeDebit.accountingClass?.className??null},journalEntryDetails:{wasRecommendationAvailable:a,journalEntryPostingStatus:n?.status.label??""},vendorName:l.vendor.name??null,controllerEmails:d,controllerUserIds:o})};function ke({jeScheduleId:e,scheduleKey:t,scheduleType:c,onDecided:l}){const s=W(),{ignoreStatusById:n,revertStatusById:i}=r((A=>ce(A).jeSchedules)),a=v.useRef(void 0),d=t==null||a.current==null?void 0:a.current==="ignore"?n[t]?.fetchState:i[t]?.fetchState,o=v.useRef(!1),h=v.useRef(l);return h.current=l,v.useEffect((()=>{o.current&&d==="Completed"&&(o.current=!1,h.current())}),[d]),{onScheduleDecision:v.useCallback(((A,m,C)=>{if(t!=null){if(A==="ignore")return(function(y){return Ze.includes(y)})(m)?(o.current=!0,a.current="ignore",void s(ze(t,c,m,C))):void 0;e!=null&&(function(y){return He.includes(y)})(m)&&(o.current=!0,a.current="revert",s(qe(e,t,c,m,C)))}}),[s,e,t,c]),scheduleDecisionStatus:d}}const kt=re.div`
10
10
  display: flex;
11
11
  min-height: 100%;
12
12
  width: 100%;
@@ -14,7 +14,7 @@ import{j as E}from"./liveblocks-BdMPZzDQ.js";import{a as v}from"./sentry-Buwow29
14
14
  flex-direction: column;
15
15
  align-items: center;
16
16
  background-color: ${e=>e.theme.colors.grey4};
17
- `,Ct=te((function(e){const t=K(e),c=e.entityAutoCompleteState.autoCompleteText.common,l=De(e,"common");return{tenantName:t.companyName,vendorSearchAutoCompleteData:{autoCompleteText:c,entityAutoCompleteView:l}}}),(function(e,t){const{navigate:c,location:l}=t,s="accrued_expenses";return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const n=de(l.state?.pathnameStackToGoBack);n.poppedPathname==null?c("../schedules/accrued_expenses"):c(n.poppedPathname,{state:{pathnameStackToGoBack:n.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:n=>{t.setShouldNavigateBack(!0),e(ve(s,n))},onDelete:n=>{e(st(s,n))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,i)=>{n.trim().length>=2?e(ge({searchString:n,entityType:i,searchOrigin:"common"})):n.trim().length===0&&e(Y("common"))},onCancelAutoComplete:()=>{e(Y("common"))}},onEditAmount:(n,i)=>{e(lt(s,n,i))},onJELinkClick:n=>{e(nt({selectedJELinkRowIndex:n})),c("./edit_link")},onCancelAccrual:(n,i,a)=>{e(at(n,i,a))},onTransactionClick:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onViewPostedJE:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onViewRecordedJE:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onViewBillExpense:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onDetailPageChange:(n,i,a)=>{const{scheduleDetailsAccruedExpensesSection:d}=n,{amount:o,memo:h,months:A,scheduleAccruedExpenseCategory:m,scheduleClass:C,scheduleExpenseCategory:y,startDate:S,vendor:I}=d,u=C.selectedOption!=null?t.classList.find((B=>B.classId===C.selectedOption)):void 0,f=y.selectedOption!=null?t.accountList.find((B=>B.qboId===y.selectedOption)):void 0,D=m.selectedOption!=null?t.accruedAccountList.find((B=>B.qboId===m.selectedOption)):void 0,J=A?.selectedOption;e(et({scheduleType:s,localData:i,selectedJeScheduleDetailId:t.scheduleDetailId})),a!==!1||t.scheduleDetailId!=null||f?.accountId==null||t.isAccountingClassesEnabled!==!1&&u?.classId==null||D==null||I.selectedOption==null||h==null||o==null&&o==0||S==null||J==null||e(tt({scheduleType:s}))}}}))(ht),Xt=({shouldNavigateBack:e,setShouldNavigateBack:t,isRenderedInPanel:c=!1,scheduleDetailIdOverride:l,onPanelCloseAfterDecision:s,onPanelNavigateBack:n}={})=>{const[i,a]=v.useState(!1),d=e??i,o=t??a,h=Q(),A=ee(),m=H(),C=Ee(),{tenantEmailDomain:y}=M(),[S,I]=v.useState(!1);if(y==null)throw new Error("Can't access this page without a tenantEmailDomain");const{scheduleDetailId:u}=M(),f=l??u;let D;f!=="new"&&(D=f);const J=vt(f),B=r((L=>L.scheduleAccruedDetailState.selectedJEAccruedScheduleKey)),b="accrued_expenses",k=r((L=>Se(L,"accrued_expenses"))),w=r((L=>fe(L))),j=r((L=>L.classListState.fetchState)),x=r((L=>ae(L))),N=w!=="Completed"||j!=="Completed";v.useEffect((()=>{S===!1&&N?(m(He(b,D)),I(!0)):N===!1&&S===!1&&f!=="new"&&(m(Qe(b,f)),I(!0))}),[S]);const P=r((L=>K(L))),T=r((L=>ne(L,P.companyId))),O=A.state?.message==="expenseAutomation",X=r((L=>ce(L).selectedPeriod)),U=c||O,{onScheduleDecision:q,scheduleDecisionStatus:z}=ke({jeScheduleId:k.selectedJEAccruedSchedule?.jeScheduleId,scheduleKey:k.selectedJEAccruedSchedule?.jeAccruedScheduleKey,scheduleType:b,onDecided:()=>{if(s==null)if(O!==!0)h("../schedules/accrued_expenses");else{const{month:L,year:Pe}=X;h(`../../month_end_close_checks/review/je_schedules/${L}-${Pe}`)}else s()}}),F=k.fetchState,R=k.allAccountList,W=k.allClassList,g=k.allAccruedAccountList,p=k.scheduleAccruedDetailsLocalData;if(J!==!0||k.fetchState==="Error")return E.jsx(Z,{});const $=F==="Completed"&&S===!0,Oe=k.selectedJEAccruedSchedule!=null;return F==="Completed"||F==="Not-Started"||c===!0&&Oe?E.jsxs(kt,{children:[$===!0?E.jsx(ue,{analytics:_,onLoad:()=>{At(k,b,T)}}):null,E.jsx(Ct,{onScheduleDecision:U?q:void 0,scheduleDecisionStatus:z,isRenderedInPanel:c,onPanelNavigateBack:n,setShouldNavigateBack:o,scheduleAccruedDetailsView:k,location:A,navigate:h,classList:W,accountList:R,shouldNavigateBack:d,accruedAccountList:g,scheduleLocalData:p,selectedJEScheduleKey:B,scheduleDetailId:D,selectedScheduledJournalEntries:k.selectedJEAccruedSchedule?.scheduledJournalEntry??[],themeState:C,tenantEmailDomain:y,analytics:_,controllerUserDetails:T,isAccountingClassesEnabled:x,status:k.selectedJEAccruedSchedule?.status.code})]}):E.jsx(ie,{})},vt=e=>e!=null,At=(e,t,c)=>{const l=e.selectedJEAccruedSchedule,s=le(c.controllers),n=se(c.controllerUserIds);l!=null&&_.trackScheduleAccruedDetailsLoaded({scheduleType:t,scheduleExpenseCategoryAndClass:{expenseCategory:l.jeDebit.account?.accountName??null,expenseClass:l.jeDebit.accountingClass?.className??null},schedule:{..._e(l)},vendorName:l.vendor.name??null,controllerEmails:s,controllerUserIds:n})},It=re.div`
17
+ `,Ct=te((function(e){const t=K(e),c=e.entityAutoCompleteState.autoCompleteText.common,l=De(e,"common");return{tenantName:t.companyName,vendorSearchAutoCompleteData:{autoCompleteText:c,entityAutoCompleteView:l}}}),(function(e,t){const{navigate:c,location:l}=t,s="accrued_expenses";return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const n=de(l.state?.pathnameStackToGoBack);n.poppedPathname==null?c("../schedules/accrued_expenses"):c(n.poppedPathname,{state:{pathnameStackToGoBack:n.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:n=>{t.setShouldNavigateBack(!0),e(ve(s,n))},onDelete:n=>{e(st(s,n))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,i)=>{n.trim().length>=2?e(ge({searchString:n,entityType:i,searchOrigin:"common"})):n.trim().length===0&&e(Y("common"))},onCancelAutoComplete:()=>{e(Y("common"))}},onEditAmount:(n,i)=>{e(lt(s,n,i))},onJELinkClick:n=>{e(nt({selectedJELinkRowIndex:n})),c("./edit_link")},onCancelAccrual:(n,i,a)=>{e(at(n,i,a))},onTransactionClick:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onViewPostedJE:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onViewRecordedJE:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onViewBillExpense:n=>{const i=`${V(n,t.tenantEmailDomain)}`,a=G(l.state?.pathnameStackToGoBack,l.pathname);c(i,{state:{pathnameStackToGoBack:a}})},onDetailPageChange:(n,i,a)=>{const{scheduleDetailsAccruedExpensesSection:d}=n,{amount:o,memo:h,months:A,scheduleAccruedExpenseCategory:m,scheduleClass:C,scheduleExpenseCategory:y,startDate:S,vendor:I}=d,u=C.selectedOption!=null?t.classList.find((B=>B.classId===C.selectedOption)):void 0,f=y.selectedOption!=null?t.accountList.find((B=>B.qboId===y.selectedOption)):void 0,D=m.selectedOption!=null?t.accruedAccountList.find((B=>B.qboId===m.selectedOption)):void 0,J=A?.selectedOption;e(et({scheduleType:s,localData:i,selectedJeScheduleDetailId:t.scheduleDetailId})),a!==!1||t.scheduleDetailId!=null||f?.accountId==null||t.isAccountingClassesEnabled!==!1&&u?.classId==null||D==null||I.selectedOption==null||h==null||o==null&&o==0||S==null||J==null||e(tt({scheduleType:s}))}}}))(ht),Xt=({shouldNavigateBack:e,setShouldNavigateBack:t,isRenderedInPanel:c=!1,scheduleDetailIdOverride:l,onPanelCloseAfterDecision:s,onPanelNavigateBack:n}={})=>{const[i,a]=v.useState(!1),d=e??i,o=t??a,h=Q(),A=ee(),m=W(),C=Ee(),{tenantEmailDomain:y}=M(),[S,I]=v.useState(!1);if(y==null)throw new Error("Can't access this page without a tenantEmailDomain");const{scheduleDetailId:u}=M(),f=l??u;let D;f!=="new"&&(D=f);const J=vt(f),B=r((L=>L.scheduleAccruedDetailState.selectedJEAccruedScheduleKey)),w="accrued_expenses",k=r((L=>Se(L,"accrued_expenses"))),b=r((L=>fe(L))),j=r((L=>L.classListState.fetchState)),x=r((L=>ae(L))),N=b!=="Completed"||j!=="Completed";v.useEffect((()=>{S===!1&&N?(m(We(w,D)),I(!0)):N===!1&&S===!1&&f!=="new"&&(m(Qe(w,f)),I(!0))}),[S]);const P=r((L=>K(L))),T=r((L=>ne(L,P.companyId))),O=A.state?.message==="expenseAutomation",X=r((L=>ce(L).selectedPeriod)),U=c||O,{onScheduleDecision:z,scheduleDecisionStatus:q}=ke({jeScheduleId:k.selectedJEAccruedSchedule?.jeScheduleId,scheduleKey:k.selectedJEAccruedSchedule?.jeAccruedScheduleKey,scheduleType:w,onDecided:()=>{if(s==null)if(O!==!0)h("../schedules/accrued_expenses");else{const{month:L,year:Pe}=X;h(`../../month_end_close_checks/review/je_schedules/${L}-${Pe}`)}else s()}}),F=k.fetchState,$=k.allAccountList,Z=k.allClassList,g=k.allAccruedAccountList,p=k.scheduleAccruedDetailsLocalData;if(J!==!0||k.fetchState==="Error")return E.jsx(H,{});const R=F==="Completed"&&S===!0,Oe=k.selectedJEAccruedSchedule!=null;return F==="Completed"||F==="Not-Started"||c===!0&&Oe?E.jsxs(kt,{children:[R===!0?E.jsx(ue,{analytics:_,onLoad:()=>{At(k,w,T)}}):null,E.jsx(Ct,{onScheduleDecision:U?z:void 0,scheduleDecisionStatus:q,isRenderedInPanel:c,onPanelNavigateBack:n,setShouldNavigateBack:o,scheduleAccruedDetailsView:k,location:A,navigate:h,classList:Z,accountList:$,shouldNavigateBack:d,accruedAccountList:g,scheduleLocalData:p,selectedJEScheduleKey:B,scheduleDetailId:D,selectedScheduledJournalEntries:k.selectedJEAccruedSchedule?.scheduledJournalEntry??[],themeState:C,tenantEmailDomain:y,analytics:_,controllerUserDetails:T,isAccountingClassesEnabled:x,status:k.selectedJEAccruedSchedule?.status.code})]}):E.jsx(ie,{})},vt=e=>e!=null,At=(e,t,c)=>{const l=e.selectedJEAccruedSchedule,s=le(c.controllers),n=se(c.controllerUserIds);l!=null&&_.trackScheduleAccruedDetailsLoaded({scheduleType:t,scheduleExpenseCategoryAndClass:{expenseCategory:l.jeDebit.account?.accountName??null,expenseClass:l.jeDebit.accountingClass?.className??null},schedule:{..._e(l)},vendorName:l.vendor.name??null,controllerEmails:s,controllerUserIds:n})},It=re.div`
18
18
  display: flex;
19
19
  min-height: 100%;
20
20
  width: 100%;
@@ -22,7 +22,7 @@ import{j as E}from"./liveblocks-BdMPZzDQ.js";import{a as v}from"./sentry-Buwow29
22
22
  flex-direction: column;
23
23
  align-items: center;
24
24
  background-color: ${e=>e.theme.colors.grey4};
25
- `,he=ye.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat,xt=te((function(e){const t=K(e),c=oe(e,"fixed_assets");return{tenantName:t.companyName,scheduleDetailsView:c}}),(function(e,t){const{navigate:c,location:l,vendorSearchAutoCompleteData:s,selectedScheduledJournalEntries:n}=t,i="fixed_assets",a=n.flatMap((d=>d.error)).filter((d=>!!d))??[];return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const d=de(t.location.state?.pathnameStackToGoBack);d.poppedPathname==null?c("../schedules/fixed_assets"):t.navigate(d.poppedPathname,{state:{pathnameStackToGoBack:d.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:d=>{e(Ne(i,d,a.length>0))},onDelete:d=>{e(je(i,d))},onMarkAsComplete:()=>{t.selectedJEScheduleKey!=null&&e(we(i,t.selectedJEScheduleKey))},onEditAmount:(d,o)=>{e(be(i,d,o))},onJELinkClick:d=>{e(Je({selectedJELinkRowIndex:d})),c("./edit_link")},onTransactionClick:d=>{const o=`${V(d,t.tenantEmailDomain)}`,h=G(l.state?.pathnameStackToGoBack,l.pathname);c(o,{state:{pathnameStackToGoBack:h,message:"comingFromScheduleDetailsFixedAssets"}})},onViewLinkedJE:d=>{const o=`${V(d,t.tenantEmailDomain)}`,h=G(l.state?.pathnameStackToGoBack,l.pathname);c(o,{state:{pathnameStackToGoBack:h}})},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(d,o)=>{d.trim().length>=2?e(ge({searchString:d,entityType:o,searchOrigin:"common"})):d.trim().length===0&&e(Y("common"))},onCancelAutoComplete:()=>{e(Y("common"))}},onDetailPageChange:(d,o)=>{const{scheduleDetailsFixedAssetsSection:h,scheduleDetailsListSection:A}=d,{scheduleClass:m,scheduleExpenseCategory:C,accumulatedDepreciationCategory:y,assetId:S,months:I,startDate:u,postingDate:f,vendor:D}=h,J=s.entityAutoCompleteView.vendor.length>0?s.entityAutoCompleteView.vendor.find((T=>T.id===D?.selectedOption)):void 0,B={id:J?.zeniId??D?.selectedOption??"",name:J?.name??D?.defaultOptions.find((T=>T.value===D?.selectedOption))?.label??"",logo:J?.logo},b=m.selectedOption!=null?t.classList.find((T=>T.classId===m.selectedOption)):void 0,k=C.selectedOption!=null?t.accountList.find((T=>T.qboId===C.selectedOption)):void 0,w=y.selectedOption!=null?t.depAccountList.find((T=>T.qboId===y.selectedOption)):void 0,j=I?.selectedOption,x=A.map(((T,O)=>({...t.scheduleLocalData.jeScheduleDetails[O],amount:{...t.scheduleLocalData.jeScheduleDetails[O].amount,amount:T.amount}}))),N=f.type==="day"?f.dayOfMonth?f.dayOfMonth:1:void 0,P=f.type==="lastDayOfMonth"||void 0;e(Be({scheduleType:i,localData:{selectedAccount:k?.accountId,selectedClass:b?.classId,selectedAccumulatedDepreciationCategory:w?.accountId,selectedDate:u,selectedMonths:j,assetId:S,jeScheduleDetails:x,lastDayOfMonth:P,selectedDayOfMonth:N,selectedVendor:B},selectedJeScheduleDetailId:t.scheduleDetailId})),o!==!1||w?.accountId==null||t.scheduleDetailId!=null&&t.status!=="draft"&&t.status!=="marked_as_completed"||k?.accountId==null||t.isAccountingClassesEnabled!==!1&&b?.classId==null||u==null||j==null||P!==!0&&N==null||e(Le({scheduleType:i}))}}}))(mt),qt=({isRenderedInPanel:e=!1,scheduleDetailIdOverride:t,onPanelCloseAfterDecision:c,onPanelNavigateBack:l}={})=>{const s=Q(),n=ee(),i=H(),a=Ee(),{tenantEmailDomain:d}=M(),[o,h]=v.useState(!1),{scheduleDetailId:A}=M(),m=t??A,C=n.state?.message==="expenseAutomation",y=Tt(m),S=r((g=>g.scheduleDetailState.selectedJEScheduleKey));v.useEffect((()=>{S!=null&&S.length!==0||m!=="new"||s("../schedules/fixed_assets")}),[S,m]);const I="fixed_assets",u=r((g=>oe(g,I))),f=r((g=>g.entityAutoCompleteState.autoCompleteText.common)),D=r((g=>De(g,"common"))),J=r((g=>fe(g))),B=r((g=>g.classListState.fetchState)),b=r((g=>ae(g))),k=r((g=>ce(g).selectedPeriod)),w=J!=="Completed"||B!=="Completed";v.useEffect((()=>{o===!1&&w?(i(Ae(I,F,!0)),h(!0)):w===!1&&o===!1&&(i(Ie(I,m==="new"?void 0:m,!0)),h(!0))}),[o]),v.useEffect((()=>{if(u.markAsCompleteStatus.fetchState==="Completed")if(i(xe()),C===!0){const{month:g,year:p}=k;s(`../../month_end_close_checks/review/je_schedules/${g}-${p}`)}else s("../schedules/fixed_assets")}),[u.markAsCompleteStatus.fetchState]);const j=r((g=>K(g))),x=r((g=>ne(g,j.companyId))),N=e||C,{onScheduleDecision:P,scheduleDecisionStatus:T}=ke({jeScheduleId:u.selectedJEScheduleTransaction?.jeScheduleId,scheduleKey:u.selectedJEScheduleTransaction?.jeScheduleTransactionKey,scheduleType:I,onDecided:()=>{if(c==null)if(C!==!0)s("../schedules/fixed_assets");else{const{month:g,year:p}=k;s(`../../month_end_close_checks/review/je_schedules/${g}-${p}`)}else c()}}),O=u.fetchState,X=u.allAccountList,U=u.allClassList,q=u.allDepreciationAccountList,z=u.scheduleDetailsLocalData.fixed_assets;let F;if(m!=="new"&&(F=m),y!==!0||u.fetchState==="Error")return E.jsx(Z,{});const R=O==="Completed"&&o===!0,W=u.selectedJEScheduleTransaction!=null;return O==="Completed"||e===!0&&W?E.jsxs(It,{children:[R===!0?E.jsx(ue,{analytics:_,onLoad:()=>{Lt(u,I,x)}}):null,E.jsx(xt,{onScheduleDecision:N?P:void 0,scheduleDecisionStatus:T,isRenderedInPanel:e,onPanelNavigateBack:l,location:n,navigate:s,classList:U,vendorSearchEntityAutoCompleteView:D,vendorSearchAutoCompleteData:{autoCompleteText:f,entityAutoCompleteView:D},expenseAutomationSelectedPeriod:k,usedInExpenseAutomation:C,removeJeScheduleTransactionKey:(g,p)=>{i(Te(g,p))},accountList:X,depAccountList:q,scheduleLocalData:z,selectedJEScheduleKey:S,scheduleDetailId:F,selectedScheduledJournalEntries:u.selectedJEScheduleTransaction?.scheduledJournalEntry??[],themeState:a,tenantEmailDomain:d,analytics:_,controllerUserDetails:x,isAccountingClassesEnabled:b,status:u.selectedJEScheduleTransaction?.status.code})]}):E.jsx(ie,{})},Tt=e=>e!=null,Bt=e=>({transactionDate:e.date.format(he),transactionAmount:e.amount,scheduleCategory:e.account.accountName,scheduleClass:e.classBase?.className??null,description:e.memo}),Lt=(e,t,c)=>{const l=e.selectedJEScheduleTransaction?.baseTransaction,s=e.selectedJEScheduleTransaction,n=le(c.controllers),i=se(c.controllerUserIds);var a;l!=null&&s!=null&&_.trackScheduleDetailsLoaded({scheduleType:t,transaction:{...Bt(l)},scheduleExpenseCategoryAndClass:{expenseCategory:s.jeDebit.account?.accountName??null,expenseClass:s.jeDebit.accountingClass?.className??null},scheduledTransaction:{...(a=s,{currentBalance:a.balanceAsOfToday??null,currentStatus:a.status.label,period:a.period??null,startMonth:a.startDate?.format(he)??null,endMonth:a.endDate?.format(he)??null})},vendorName:s.vendor.name??null,fixedAssetsDetails:{accumulatedDepreciationCategory:s.jeCredit.account?.accountName??null,assetId:s.otherAttributes.assetId??null},controllerEmails:n,controllerUserIds:i})},Jt=re.div`
25
+ `,he=ye.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat,xt=te((function(e){const t=K(e),c=oe(e,"fixed_assets");return{tenantName:t.companyName,scheduleDetailsView:c}}),(function(e,t){const{navigate:c,location:l,vendorSearchAutoCompleteData:s,selectedScheduledJournalEntries:n}=t,i="fixed_assets",a=n.flatMap((d=>d.error)).filter((d=>!!d))??[];return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const d=de(t.location.state?.pathnameStackToGoBack);d.poppedPathname==null?c("../schedules/fixed_assets"):t.navigate(d.poppedPathname,{state:{pathnameStackToGoBack:d.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:d=>{e(Ne(i,d,a.length>0))},onDelete:d=>{e(je(i,d))},onMarkAsComplete:()=>{t.selectedJEScheduleKey!=null&&e(be(i,t.selectedJEScheduleKey))},onEditAmount:(d,o)=>{e(we(i,d,o))},onJELinkClick:d=>{e(Je({selectedJELinkRowIndex:d})),c("./edit_link")},onTransactionClick:d=>{const o=`${V(d,t.tenantEmailDomain)}`,h=G(l.state?.pathnameStackToGoBack,l.pathname);c(o,{state:{pathnameStackToGoBack:h,message:"comingFromScheduleDetailsFixedAssets"}})},onViewLinkedJE:d=>{const o=`${V(d,t.tenantEmailDomain)}`,h=G(l.state?.pathnameStackToGoBack,l.pathname);c(o,{state:{pathnameStackToGoBack:h}})},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(d,o)=>{d.trim().length>=2?e(ge({searchString:d,entityType:o,searchOrigin:"common"})):d.trim().length===0&&e(Y("common"))},onCancelAutoComplete:()=>{e(Y("common"))}},onDetailPageChange:(d,o)=>{const{scheduleDetailsFixedAssetsSection:h,scheduleDetailsListSection:A}=d,{scheduleClass:m,scheduleExpenseCategory:C,accumulatedDepreciationCategory:y,assetId:S,months:I,startDate:u,postingDate:f,vendor:D}=h,J=s.entityAutoCompleteView.vendor.length>0?s.entityAutoCompleteView.vendor.find((T=>T.id===D?.selectedOption)):void 0,B={id:J?.zeniId??D?.selectedOption??"",name:J?.name??D?.defaultOptions.find((T=>T.value===D?.selectedOption))?.label??"",logo:J?.logo},w=m.selectedOption!=null?t.classList.find((T=>T.classId===m.selectedOption)):void 0,k=C.selectedOption!=null?t.accountList.find((T=>T.qboId===C.selectedOption)):void 0,b=y.selectedOption!=null?t.depAccountList.find((T=>T.qboId===y.selectedOption)):void 0,j=I?.selectedOption,x=A.map(((T,O)=>({...t.scheduleLocalData.jeScheduleDetails[O],amount:{...t.scheduleLocalData.jeScheduleDetails[O].amount,amount:T.amount}}))),N=f.type==="day"?f.dayOfMonth?f.dayOfMonth:1:void 0,P=f.type==="lastDayOfMonth"||void 0;e(Be({scheduleType:i,localData:{selectedAccount:k?.accountId,selectedClass:w?.classId,selectedAccumulatedDepreciationCategory:b?.accountId,selectedDate:u,selectedMonths:j,assetId:S,jeScheduleDetails:x,lastDayOfMonth:P,selectedDayOfMonth:N,selectedVendor:B},selectedJeScheduleDetailId:t.scheduleDetailId})),o!==!1||b?.accountId==null||t.scheduleDetailId!=null&&t.status!=="draft"&&t.status!=="marked_as_completed"||k?.accountId==null||t.isAccountingClassesEnabled!==!1&&w?.classId==null||u==null||j==null||P!==!0&&N==null||e(Le({scheduleType:i}))}}}))(mt),zt=({isRenderedInPanel:e=!1,scheduleDetailIdOverride:t,onPanelCloseAfterDecision:c,onPanelNavigateBack:l}={})=>{const s=Q(),n=ee(),i=W(),a=Ee(),{tenantEmailDomain:d}=M(),[o,h]=v.useState(!1),{scheduleDetailId:A}=M(),m=t??A,C=n.state?.message==="expenseAutomation",y=Tt(m),S=r((g=>g.scheduleDetailState.selectedJEScheduleKey));v.useEffect((()=>{S!=null&&S.length!==0||m!=="new"||s("../schedules/fixed_assets")}),[S,m]);const I="fixed_assets",u=r((g=>oe(g,I))),f=r((g=>g.entityAutoCompleteState.autoCompleteText.common)),D=r((g=>De(g,"common"))),J=r((g=>fe(g))),B=r((g=>g.classListState.fetchState)),w=r((g=>ae(g))),k=r((g=>ce(g).selectedPeriod)),b=J!=="Completed"||B!=="Completed";v.useEffect((()=>{o===!1&&b?(i(Ae(I,F,!0)),h(!0)):b===!1&&o===!1&&(i(Ie(I,m==="new"?void 0:m,!0)),h(!0))}),[o]),v.useEffect((()=>{if(u.markAsCompleteStatus.fetchState==="Completed")if(i(xe()),C===!0){const{month:g,year:p}=k;s(`../../month_end_close_checks/review/je_schedules/${g}-${p}`)}else s("../schedules/fixed_assets")}),[u.markAsCompleteStatus.fetchState]);const j=r((g=>K(g))),x=r((g=>ne(g,j.companyId))),N=e||C,{onScheduleDecision:P,scheduleDecisionStatus:T}=ke({jeScheduleId:u.selectedJEScheduleTransaction?.jeScheduleId,scheduleKey:u.selectedJEScheduleTransaction?.jeScheduleTransactionKey,scheduleType:I,onDecided:()=>{if(c==null)if(C!==!0)s("../schedules/fixed_assets");else{const{month:g,year:p}=k;s(`../../month_end_close_checks/review/je_schedules/${g}-${p}`)}else c()}}),O=u.fetchState,X=u.allAccountList,U=u.allClassList,z=u.allDepreciationAccountList,q=u.scheduleDetailsLocalData.fixed_assets;let F;if(m!=="new"&&(F=m),y!==!0||u.fetchState==="Error")return E.jsx(H,{});const $=O==="Completed"&&o===!0,Z=u.selectedJEScheduleTransaction!=null;return O==="Completed"||e===!0&&Z?E.jsxs(It,{children:[$===!0?E.jsx(ue,{analytics:_,onLoad:()=>{Lt(u,I,x)}}):null,E.jsx(xt,{onScheduleDecision:N?P:void 0,scheduleDecisionStatus:T,isRenderedInPanel:e,onPanelNavigateBack:l,location:n,navigate:s,classList:U,vendorSearchEntityAutoCompleteView:D,vendorSearchAutoCompleteData:{autoCompleteText:f,entityAutoCompleteView:D},expenseAutomationSelectedPeriod:k,usedInExpenseAutomation:C,removeJeScheduleTransactionKey:(g,p)=>{i(Te(g,p))},accountList:X,depAccountList:z,scheduleLocalData:q,selectedJEScheduleKey:S,scheduleDetailId:F,selectedScheduledJournalEntries:u.selectedJEScheduleTransaction?.scheduledJournalEntry??[],themeState:a,tenantEmailDomain:d,analytics:_,controllerUserDetails:x,isAccountingClassesEnabled:w,status:u.selectedJEScheduleTransaction?.status.code})]}):E.jsx(ie,{})},Tt=e=>e!=null,Bt=e=>({transactionDate:e.date.format(he),transactionAmount:e.amount,scheduleCategory:e.account.accountName,scheduleClass:e.classBase?.className??null,description:e.memo}),Lt=(e,t,c)=>{const l=e.selectedJEScheduleTransaction?.baseTransaction,s=e.selectedJEScheduleTransaction,n=le(c.controllers),i=se(c.controllerUserIds);var a;l!=null&&s!=null&&_.trackScheduleDetailsLoaded({scheduleType:t,transaction:{...Bt(l)},scheduleExpenseCategoryAndClass:{expenseCategory:s.jeDebit.account?.accountName??null,expenseClass:s.jeDebit.accountingClass?.className??null},scheduledTransaction:{...(a=s,{currentBalance:a.balanceAsOfToday??null,currentStatus:a.status.label,period:a.period??null,startMonth:a.startDate?.format(he)??null,endMonth:a.endDate?.format(he)??null})},vendorName:s.vendor.name??null,fixedAssetsDetails:{accumulatedDepreciationCategory:s.jeCredit.account?.accountName??null,assetId:s.otherAttributes.assetId??null},controllerEmails:n,controllerUserIds:i})},Jt=re.div`
26
26
  display: flex;
27
27
  min-height: 100%;
28
28
  width: 100%;
@@ -30,4 +30,4 @@ import{j as E}from"./liveblocks-BdMPZzDQ.js";import{a as v}from"./sentry-Buwow29
30
30
  flex-direction: column;
31
31
  align-items: center;
32
32
  background-color: ${e=>e.theme.colors.grey4};
33
- `,me=ye.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat,bt=te((function(e,t){const c=K(e),l=oe(e,t.scheduleTab);return{tenantName:c.companyName,scheduleDetailsView:l}}),(function(e,t){const{navigate:c,location:l,vendorSearchAutoCompleteData:s,selectedScheduledJournalEntries:n}=t,i=n.flatMap((a=>a.error)).filter((a=>!!a))??[];return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const a=de(t.location.state?.pathnameStackToGoBack);a.poppedPathname==null?c("../schedules/prepaid_expenses"):t.navigate(a.poppedPathname,{state:{pathnameStackToGoBack:a.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:a=>{e(Ne(t.scheduleTab,a,i.length>0))},onDelete:a=>{e(je(t.scheduleTab,a))},onMarkAsComplete:()=>{t.selectedJEScheduleKey!=null&&e(we(t.scheduleTab,t.selectedJEScheduleKey))},onEditAmount:(a,d)=>{e(be(t.scheduleTab,a,d))},onJELinkClick:a=>{e(Je({selectedJELinkRowIndex:a})),c("./edit_link")},onTransactionClick:a=>{const d=`${V(a,t.tenantEmailDomain)}`,o=G(l.state?.pathnameStackToGoBack,l.pathname);c(d,{state:{pathnameStackToGoBack:o,message:"comingFromScheduleDetails"}})},onViewLinkedJE:a=>{const d=`${V(a,t.tenantEmailDomain)}`,o=G(l.state?.pathnameStackToGoBack,l.pathname);c(d,{state:{pathnameStackToGoBack:o}})},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(a,d)=>{a.trim().length>=2?e(ge({searchString:a,entityType:d,searchOrigin:"common"})):a.trim().length===0&&e(Y("common"))},onCancelAutoComplete:()=>{e(Y("common"))}},onDetailPageChange:(a,d)=>{const{scheduleDetailsSection:o,scheduleDetailsListSection:h}=a,{scheduleClass:A,scheduleExpenseCategory:m,months:C,startDate:y,postingDate:S,vendor:I}=o,u=s.entityAutoCompleteView.vendor.length>0?s.entityAutoCompleteView.vendor.find((x=>x.id===I?.selectedOption)):void 0,f={id:u?.zeniId??I?.selectedOption??"",name:u?.name??I?.defaultOptions.find((x=>x.value===I?.selectedOption))?.label??"",logo:u?.logo},D=A.selectedOption!=null?t.classList.find((x=>x.classId===A.selectedOption)):void 0,J=m.selectedOption!=null?t.accountList.find((x=>x.qboId===m.selectedOption)):void 0,B=C?.selectedOption,b=h.map(((x,N)=>({...t.scheduleLocalData.jeScheduleDetails[N],amount:{...t.scheduleLocalData.jeScheduleDetails[N].amount,amount:x.amount}}))),k=S.type==="day"?S.dayOfMonth?S.dayOfMonth:1:void 0,w=S.type==="lastDayOfMonth"||void 0,j={selectedAccount:J?.accountId,selectedClass:D?.classId,selectedDate:y,selectedMonths:B,jeScheduleDetails:b,lastDayOfMonth:w,selectedVendor:f,selectedDayOfMonth:k};e(Be({scheduleType:t.scheduleTab,localData:j,selectedJeScheduleDetailId:t.scheduleDetailId})),d!==!1||t.scheduleDetailId!=null&&t.status!=="draft"&&t.status!=="marked_as_completed"||J?.accountId==null||t.isAccountingClassesEnabled!==!1&&D?.classId==null||y==null||B==null||w!==!0&&k==null||e(Le({scheduleType:t.scheduleTab}))}}}))(pt),zt=({isRenderedInPanel:e=!1,scheduleDetailIdOverride:t,scheduleTypeOverride:c,onPanelCloseAfterDecision:l,onPanelNavigateBack:s}={})=>{const n=Q(),i=ee(),a=H(),d=Ee(),{tenantEmailDomain:o}=M(),[h,A]=v.useState(!1),m=i.state?.message==="expenseAutomation",{scheduleType:C,scheduleDetailId:y}=M(),S=t??y,I=wt(c??C,S),u=r((p=>p.scheduleDetailState.selectedJEScheduleKey));v.useEffect((()=>{u!=null&&u.length!==0||S!=="new"||n("../schedules/prepaid_expenses")}),[u,S]);const f=c??pe(C)??"prepaid_expenses",D=r((p=>oe(p,f))),J=r((p=>p.entityAutoCompleteState.autoCompleteText.common)),B=r((p=>De(p,"common"))),b=r((p=>fe(p))),k=r((p=>p.classListState.fetchState)),w=r((p=>ae(p))),j=r((p=>ce(p).selectedPeriod)),x=b!=="Completed"||k!=="Completed";v.useEffect((()=>{h===!1&&x?(a(Ae(f,R,!0)),A(!0)):x===!1&&h===!1&&(a(Ie(f,S==="new"?void 0:S,!0)),A(!0))}),[h]),v.useEffect((()=>{if(D.markAsCompleteStatus.fetchState==="Completed")if(a(xe()),m===!0){const{month:p,year:$}=j;n(`../../month_end_close_checks/review/je_schedules/${p}-${$}`)}else n("../schedules/prepaid_expenses")}),[D.markAsCompleteStatus.fetchState]);const N=r((p=>K(p))),P=r((p=>ne(p,N.companyId))),T=e||m,{onScheduleDecision:O,scheduleDecisionStatus:X}=ke({jeScheduleId:D.selectedJEScheduleTransaction?.jeScheduleId,scheduleKey:D.selectedJEScheduleTransaction?.jeScheduleTransactionKey,scheduleType:f,onDecided:()=>{if(l==null)if(m!==!0)n("../schedules/prepaid_expenses");else{const{month:p,year:$}=j;n(`../../month_end_close_checks/review/je_schedules/${p}-${$}`)}else l()}}),U=D.fetchState,q=D.allAccountList,z=D.allClassList,F=D.scheduleDetailsLocalData;let R;if(S!=="new"&&(R=S),I!==!0||D.fetchState==="Error")return E.jsx(Z,{});const W=U==="Completed"&&h===!0,g=D.selectedJEScheduleTransaction!=null;return U==="Completed"||e===!0&&g?E.jsxs(Jt,{children:[W===!0?E.jsx(ue,{analytics:_,onLoad:()=>{Nt(D,f,P)}}):null,E.jsx(bt,{onScheduleDecision:T?O:void 0,scheduleDecisionStatus:X,isRenderedInPanel:e,onPanelNavigateBack:s,location:i,vendorSearchEntityAutoCompleteView:B,vendorSearchAutoCompleteData:{autoCompleteText:J,entityAutoCompleteView:B},usedInExpenseAutomation:m,removeJeScheduleTransactionKey:(p,$)=>{a(Te(p,$))},expenseAutomationSelectedPeriod:j,navigate:n,classList:z,accountList:q,scheduleLocalData:F[f],selectedJEScheduleKey:u,scheduleDetailId:R,selectedScheduledJournalEntries:D.selectedJEScheduleTransaction?.scheduledJournalEntry??[],themeState:d,tenantEmailDomain:o,scheduleTab:f,analytics:_,controllerUserDetails:P,isAccountingClassesEnabled:w,status:D.selectedJEScheduleTransaction?.status.code})]}):E.jsx(ie,{})},wt=(e,t)=>pe(e)!=null&&t!=null,jt=e=>({transactionDate:e.date.format(me),transactionAmount:e.amount,scheduleCategory:e.account.accountName,scheduleClass:e.classBase?.className??null,description:e.memo}),Nt=(e,t,c)=>{const l=e.selectedJEScheduleTransaction?.baseTransaction,s=e.selectedJEScheduleTransaction,n=le(c.controllers),i=se(c.controllerUserIds);var a;l!=null&&s!=null&&_.trackScheduleDetailsLoaded({scheduleType:t,transaction:{...jt(l)},scheduleExpenseCategoryAndClass:{expenseCategory:s.jeDebit.account?.accountName??null,expenseClass:s.jeDebit.accountingClass?.className??null},scheduledTransaction:{...(a=s,{currentBalance:a.balanceAsOfToday??null,currentStatus:a.status.label,period:a.period??null,startMonth:a.startDate?.format(me)??null,endMonth:a.endDate?.format(me)??null})},vendorName:s.vendor.name??null,controllerEmails:n,controllerUserIds:i})};export{Ut as J,qt as S,Xt as a,zt as b,Yt as c};
33
+ `,me=ye.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat,wt=te((function(e,t){const c=K(e),l=oe(e,t.scheduleTab);return{tenantName:c.companyName,scheduleDetailsView:l}}),(function(e,t){const{navigate:c,location:l,vendorSearchAutoCompleteData:s,selectedScheduledJournalEntries:n}=t,i=n.flatMap((a=>a.error)).filter((a=>!!a))??[];return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const a=de(t.location.state?.pathnameStackToGoBack);a.poppedPathname==null?c("../schedules/prepaid_expenses"):t.navigate(a.poppedPathname,{state:{pathnameStackToGoBack:a.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:a=>{e(Ne(t.scheduleTab,a,i.length>0))},onDelete:a=>{e(je(t.scheduleTab,a))},onMarkAsComplete:()=>{t.selectedJEScheduleKey!=null&&e(be(t.scheduleTab,t.selectedJEScheduleKey))},onEditAmount:(a,d)=>{e(we(t.scheduleTab,a,d))},onJELinkClick:a=>{e(Je({selectedJELinkRowIndex:a})),c("./edit_link")},onTransactionClick:a=>{const d=`${V(a,t.tenantEmailDomain)}`,o=G(l.state?.pathnameStackToGoBack,l.pathname);c(d,{state:{pathnameStackToGoBack:o,message:"comingFromScheduleDetails"}})},onViewLinkedJE:a=>{const d=`${V(a,t.tenantEmailDomain)}`,o=G(l.state?.pathnameStackToGoBack,l.pathname);c(d,{state:{pathnameStackToGoBack:o}})},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(a,d)=>{a.trim().length>=2?e(ge({searchString:a,entityType:d,searchOrigin:"common"})):a.trim().length===0&&e(Y("common"))},onCancelAutoComplete:()=>{e(Y("common"))}},onDetailPageChange:(a,d)=>{const{scheduleDetailsSection:o,scheduleDetailsListSection:h}=a,{scheduleClass:A,scheduleExpenseCategory:m,months:C,startDate:y,postingDate:S,vendor:I}=o,u=s.entityAutoCompleteView.vendor.length>0?s.entityAutoCompleteView.vendor.find((x=>x.id===I?.selectedOption)):void 0,f={id:u?.zeniId??I?.selectedOption??"",name:u?.name??I?.defaultOptions.find((x=>x.value===I?.selectedOption))?.label??"",logo:u?.logo},D=A.selectedOption!=null?t.classList.find((x=>x.classId===A.selectedOption)):void 0,J=m.selectedOption!=null?t.accountList.find((x=>x.qboId===m.selectedOption)):void 0,B=C?.selectedOption,w=h.map(((x,N)=>({...t.scheduleLocalData.jeScheduleDetails[N],amount:{...t.scheduleLocalData.jeScheduleDetails[N].amount,amount:x.amount}}))),k=S.type==="day"?S.dayOfMonth?S.dayOfMonth:1:void 0,b=S.type==="lastDayOfMonth"||void 0,j={selectedAccount:J?.accountId,selectedClass:D?.classId,selectedDate:y,selectedMonths:B,jeScheduleDetails:w,lastDayOfMonth:b,selectedVendor:f,selectedDayOfMonth:k};e(Be({scheduleType:t.scheduleTab,localData:j,selectedJeScheduleDetailId:t.scheduleDetailId})),d!==!1||t.scheduleDetailId!=null&&t.status!=="draft"&&t.status!=="marked_as_completed"||J?.accountId==null||t.isAccountingClassesEnabled!==!1&&D?.classId==null||y==null||B==null||b!==!0&&k==null||e(Le({scheduleType:t.scheduleTab}))}}}))(pt),qt=({isRenderedInPanel:e=!1,scheduleDetailIdOverride:t,scheduleTypeOverride:c,onPanelCloseAfterDecision:l,onPanelNavigateBack:s}={})=>{const n=Q(),i=ee(),a=W(),d=Ee(),{tenantEmailDomain:o}=M(),[h,A]=v.useState(!1),m=i.state?.message==="expenseAutomation",{scheduleType:C,scheduleDetailId:y}=M(),S=t??y,I=bt(c??C,S),u=r((p=>p.scheduleDetailState.selectedJEScheduleKey));v.useEffect((()=>{u!=null&&u.length!==0||S!=="new"||n("../schedules/prepaid_expenses")}),[u,S]);const f=c??pe(C)??"prepaid_expenses",D=r((p=>oe(p,f))),J=r((p=>p.entityAutoCompleteState.autoCompleteText.common)),B=r((p=>De(p,"common"))),w=r((p=>fe(p))),k=r((p=>p.classListState.fetchState)),b=r((p=>ae(p))),j=r((p=>ce(p).selectedPeriod)),x=w!=="Completed"||k!=="Completed";v.useEffect((()=>{h===!1&&x?(a(Ae(f,$,!0)),A(!0)):x===!1&&h===!1&&(a(Ie(f,S==="new"?void 0:S,!0)),A(!0))}),[h]),v.useEffect((()=>{if(D.markAsCompleteStatus.fetchState==="Completed")if(a(xe()),m===!0){const{month:p,year:R}=j;n(`../../month_end_close_checks/review/je_schedules/${p}-${R}`)}else n("../schedules/prepaid_expenses")}),[D.markAsCompleteStatus.fetchState]);const N=r((p=>K(p))),P=r((p=>ne(p,N.companyId))),T=e||m,{onScheduleDecision:O,scheduleDecisionStatus:X}=ke({jeScheduleId:D.selectedJEScheduleTransaction?.jeScheduleId,scheduleKey:D.selectedJEScheduleTransaction?.jeScheduleTransactionKey,scheduleType:f,onDecided:()=>{if(l==null)if(m!==!0)n("../schedules/prepaid_expenses");else{const{month:p,year:R}=j;n(`../../month_end_close_checks/review/je_schedules/${p}-${R}`)}else l()}}),U=D.fetchState,z=D.allAccountList,q=D.allClassList,F=D.scheduleDetailsLocalData;let $;if(S!=="new"&&($=S),I!==!0||D.fetchState==="Error")return E.jsx(H,{});const Z=U==="Completed"&&h===!0,g=D.selectedJEScheduleTransaction!=null;return U==="Completed"||e===!0&&g?E.jsxs(Jt,{children:[Z===!0?E.jsx(ue,{analytics:_,onLoad:()=>{Nt(D,f,P)}}):null,E.jsx(wt,{onScheduleDecision:T?O:void 0,scheduleDecisionStatus:X,isRenderedInPanel:e,onPanelNavigateBack:s,location:i,vendorSearchEntityAutoCompleteView:B,vendorSearchAutoCompleteData:{autoCompleteText:J,entityAutoCompleteView:B},usedInExpenseAutomation:m,removeJeScheduleTransactionKey:(p,R)=>{a(Te(p,R))},expenseAutomationSelectedPeriod:j,navigate:n,classList:q,accountList:z,scheduleLocalData:F[f],selectedJEScheduleKey:u,scheduleDetailId:$,selectedScheduledJournalEntries:D.selectedJEScheduleTransaction?.scheduledJournalEntry??[],themeState:d,tenantEmailDomain:o,scheduleTab:f,analytics:_,controllerUserDetails:P,isAccountingClassesEnabled:b,status:D.selectedJEScheduleTransaction?.status.code})]}):E.jsx(ie,{})},bt=(e,t)=>pe(e)!=null&&t!=null,jt=e=>({transactionDate:e.date.format(me),transactionAmount:e.amount,scheduleCategory:e.account.accountName,scheduleClass:e.classBase?.className??null,description:e.memo}),Nt=(e,t,c)=>{const l=e.selectedJEScheduleTransaction?.baseTransaction,s=e.selectedJEScheduleTransaction,n=le(c.controllers),i=se(c.controllerUserIds);var a;l!=null&&s!=null&&_.trackScheduleDetailsLoaded({scheduleType:t,transaction:{...jt(l)},scheduleExpenseCategoryAndClass:{expenseCategory:s.jeDebit.account?.accountName??null,expenseClass:s.jeDebit.accountingClass?.className??null},scheduledTransaction:{...(a=s,{currentBalance:a.balanceAsOfToday??null,currentStatus:a.status.label,period:a.period??null,startMonth:a.startDate?.format(me)??null,endMonth:a.endDate?.format(me)??null})},vendorName:s.vendor.name??null,controllerEmails:n,controllerUserIds:i})};export{Ut as J,zt as S,Xt as a,qt as b,Yt as c};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotFoundScreen-CxVO6BUm.js","assets/sentry-DfoGRlTp.js","assets/core-C4Vfz6Ll.js","assets/zeni-epic-state-DmXGRK_Y.js","assets/index-CJ_pjNEa.js","assets/mui-C0PYnbt1.js","assets/analytics-C4ICDJLl.js","assets/utils-CmKqkYr5.js","assets/index-BQ3cXEYt.css","assets/DashboardRoutes-X31R7cQf.js","assets/withTransactionSidePanel-btBdqPWA.js","assets/useAskAiCfoHostNavButtonProps-k11tYjVi.js","assets/TransactionDetailScreen-BsGN3Yd5.js","assets/decodeURIComponentSafe-CYsmEPcV.js","assets/useInitialThreadRequest-BVMcY486.js","assets/routePaths-DYebh4Li.js","assets/expenseAutomationHelper-hmRJBbGd.js","assets/stripSplatSuffix-Db8ayksN.js","assets/reportTimeframe-C5AD1AL2.js","assets/analyticsHelper-CPHVprda.js","assets/CompanyPassportScreen-L6OY8AwA.js","assets/MobileAppDrawer-B4_Hh2uX.js","assets/InboxNotificationsProvider-CJt6vmnU.js","assets/useTaskManagerAccess-Cp8R2Cu9.js","assets/useAiCfoDashboardSuggestedQuestionsChips-D2InIpSO.js","assets/FeaturePreviewScreen-Cnh2Fe6t.js","assets/BillPayRoutes-7abJ7Y81.js","assets/AddressScreen-BbgME8aO.js","assets/DomesticWireDetailScreen-BZbvzqXc.js","assets/BusinessVerificationPageScreen-8VbyEZWD.js","assets/DrawerScreen-CmgVB1Zi.js","assets/SetupPagesScreen-DzLiX5R5.js","assets/BillPayApprovalRoutes-GN_PKZBM.js","assets/useEnsureVendorListLoaded-Bud-c91I.js","assets/ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.js","assets/getLocaleForTenant-DJIJUZ-c.js","assets/ReimbursementRoutes-mHGAbMEo.js","assets/ReimbursementApprovalRoutes-_wQ1m-SZ.js","assets/TransactionListRoutes-_bc9UoMG.js","assets/ZeniAccountStatementScreen-BHlw6cTG.js","assets/SettingsRoutes-CXzUd0P6.js","assets/AccountMappingScreen-CMj3JkGt.js","assets/QBOConnectionScreen-BD6w4pxT.js","assets/url-BtS-4pap.js","assets/empty-uRyODf4S.js","assets/index-BTd7WWV0.js","assets/index-E3novWwq.js","assets/accountMappingHelper-BbISzw1n.js","assets/useEmailConnectResultRefresh-BCLtP2Ad.js","assets/ReportsRoutes-DNdr9gVu.js","assets/ChargeCardRoutes-BR5_qY8y.js","assets/useChargeCardPusherEvents-Bf7Vv0PE.js","assets/PeopleRoutes-B5eZw1Xs.js","assets/ExpenseAutomationRoutes-DH5uN2wQ.js","assets/useActualMatchingMatchDetail-DPtaMcdm.js","assets/ScheduleDetailsPrepaidExpensesScreen-Bgrqk-Br.js","assets/pathToGoBack-DF1y-0ht.js","assets/TreasuryRoutes-C7ABXX2A.js","assets/VendorsRoutes-BlorNbi4.js","assets/ZeniAccountRoutes-QObrERl4.js","assets/AddressRoutes-7FdlQcLM.js","assets/PandLWithForecastRoutes-CiaozOzI.js","assets/CustomerOnboardingRoutes-3OH4ZWPk.js","assets/TransactionDetailRoutes-C0gGgGik.js","assets/EntityDetailRoutes-5IMi-E-b.js","assets/InvoicingRoutes-Q-6aUqgu.js","assets/NotificationRoutes-CDa5TISi.js","assets/PerformanceRoutes-B5KqyHoS.js","assets/ActualMatchingMatchDetailScreen-Dd_vJSSr.js","assets/RewardsRoutes-CRQaDmuu.js","assets/TaskRoutes-aDI7RZCK.js","assets/TaskListScreen-Dv5TjArL.js","assets/useTaskManagerPusherEvents-p1TIydvw.js","assets/AiCfoScreen-CU1e2Oi8.js","assets/CardsAiCfoScreen-BcEHiZtA.js"])))=>i.map(i=>d[i]);
2
+ import{_ as s,bj as hs,fE as Es,dZ as ps,dY as xs,Bo as js,dg as gs,c6 as Rs,gI as Is,g8 as As,dd as xe,cE as Ts,gm as bs,cw as fs,bC as Ds,bn as ys,UX as Cs,v as vs,U_ as ws,bm as Os,U$ as Ps,bI as Us,bH as ks,bq as Fs,cs as Ls,V0 as Vs,V1 as Hs,d8 as Ss,db as Bs,da as Ns,cD as Zs,cK as Ms,pW as je,gh as ge,gY as $s,gj as Re,gK as Ie,gL as Ae,gk as zs}from"./zeni-epic-state-DmXGRK_Y.js";import{j as e}from"./liveblocks-DZUXZ-JO.js";import{a as U}from"./sentry-DfoGRlTp.js";import{N as d,u as Gs,h as Ys,i as qs,g as Ws,j as z,q as Te,n as Ks,o as a}from"./core-C4Vfz6Ll.js";import{N as l,u as Xs,z as C,p as Qs,e as Js,f as en,c as Z,j as sn,O as nn,V as tn,L as F,G as be,t as _,P as an,m as ae,Q as on,Z as rn}from"./index-CJ_pjNEa.js";import{u as ln}from"./mui-C0PYnbt1.js";import{f as fe}from"./analyticsHelper-CPHVprda.js";import{t as dn}from"./getLocaleForTenant-DJIJUZ-c.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new t.Error().stack;p&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[p]="4cc4e28b-24b5-4a57-b82a-b3fae305843e",t._sentryDebugIdIdentifier="sentry-dbid-4cc4e28b-24b5-4a57-b82a-b3fae305843e")}catch{}})();const cn=l((()=>s((()=>import("./NotFoundScreen-CxVO6BUm.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),un=({tenantEmailDomain:t})=>e.jsx(d,{to:`/${t}/reimbursements`}),mn=({tenantEmailDomain:t})=>e.jsx(d,{to:`/${t}/bills`}),De=({tenantEmailDomain:t})=>e.jsx(d,{to:`/${t}/treasury`}),ye=({tenantEmailDomain:t})=>e.jsx(d,{to:`/${t}/checking`}),Ce=({tenantEmailDomain:t})=>e.jsx(d,{to:`/${t}/cards`}),v=({showZeniAccountRoute:t,isUserHasBillPayAccess:p,isUserHasReimbursementAccess:L,showTreasuryRoute:i,isTenantBankingOnly:H,showChargeCardRoute:O,tenantEmailDomain:w})=>{if(H===!0){if(t)return e.jsx(ye,{tenantEmailDomain:w});if(i)return e.jsx(De,{tenantEmailDomain:w});if(O)return e.jsx(Ce,{tenantEmailDomain:w})}return t?e.jsx(ye,{tenantEmailDomain:w}):i?e.jsx(De,{tenantEmailDomain:w}):O?e.jsx(Ce,{tenantEmailDomain:w}):p?e.jsx(mn,{tenantEmailDomain:w}):L?e.jsx(un,{tenantEmailDomain:w}):e.jsx(cn,{})},_n={dashboard:()=>s((()=>import("./DashboardRoutes-X31R7cQf.js")),__vite__mapDeps([9,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,0,18,19,20,21,22,23,24,25,8])),bills:()=>s((()=>import("./BillPayRoutes-7abJ7Y81.js")),__vite__mapDeps([26,1,2,3,4,5,6,7,27,0,28,11,14,29,15,21,22,23,30,25,31,19,32,33,34,35,8])),reimbursement:()=>s((()=>import("./ReimbursementRoutes-mHGAbMEo.js")),__vite__mapDeps([36,1,2,3,4,5,6,7,0,31,29,15,21,22,23,19,25,11,14,30,37,33,34,35,8])),transactions:()=>s((()=>import("./TransactionListRoutes-_bc9UoMG.js")),__vite__mapDeps([38,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,39,8])),settings:()=>s((()=>import("./SettingsRoutes-CXzUd0P6.js")),__vite__mapDeps([40,1,2,3,4,5,6,7,23,41,21,22,42,43,44,45,46,13,47,27,0,19,29,15,20,48,32,33,34,37,8])),reports:()=>s((()=>import("./ReportsRoutes-DNdr9gVu.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,25,14,15,18,21,22,23,8])),chargeCards:()=>s((()=>import("./ChargeCardRoutes-BR5_qY8y.js")),__vite__mapDeps([50,1,2,3,4,5,6,7,11,21,22,23,31,29,15,0,19,14,51,27,8])),people:()=>s((()=>import("./PeopleRoutes-B5eZw1Xs.js")),__vite__mapDeps([52,1,2,3,4,5,6,7,0,11,21,22,23,8])),expenseAutomation:()=>s((()=>import("./ExpenseAutomationRoutes-DH5uN2wQ.js")),__vite__mapDeps([53,1,2,3,0,4,5,6,7,11,12,13,14,15,16,54,17,10,55,56,47,30,8])),treasury:()=>s((()=>import("./TreasuryRoutes-C7ABXX2A.js")),__vite__mapDeps([57,1,2,3,4,5,6,7,0,31,29,15,21,22,23,19,11,14,25,8])),vendors:()=>s((()=>import("./VendorsRoutes-BlorNbi4.js")),__vite__mapDeps([58,1,2,3,4,5,6,7,27,0,25,55,56,54,17,13,15,11,21,22,23,30,47,8])),zeniAccounts:()=>s((()=>import("./ZeniAccountRoutes-QObrERl4.js")),__vite__mapDeps([59,1,2,3,4,5,6,7,0,31,29,15,21,22,23,19,25,28,27,11,39,8]))},hn=["bills","transactions","settings","reimbursement","reports","chargeCards","people"],oe=t=>{"requestIdleCallback"in window?requestIdleCallback(t):setTimeout(t,100)},En=l((()=>s((()=>import("./ReportsRoutes-DNdr9gVu.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,25,14,15,18,21,22,23,8])))),pn=l((()=>s((()=>import("./AddressRoutes-7FdlQcLM.js")),__vite__mapDeps([60,1,2,3,27,4,5,6,7,0,8])))),xn=l((()=>s((()=>import("./PeopleRoutes-B5eZw1Xs.js")),__vite__mapDeps([52,1,2,3,4,5,6,7,0,11,21,22,23,8])))),jn=l((()=>s((()=>import("./PandLWithForecastRoutes-CiaozOzI.js")),__vite__mapDeps([61,1,2,3,4,5,6,7,0,25,11,14,15,21,22,23,8])))),gn=l((()=>s((()=>import("./CustomerOnboardingRoutes-3OH4ZWPk.js")),__vite__mapDeps([62,1,2,3,27,4,5,6,7,0,42,43,44,45,46,13,48,51,8])))),Rn=l((()=>s((()=>import("./VendorsRoutes-BlorNbi4.js")),__vite__mapDeps([58,1,2,3,4,5,6,7,27,0,25,55,56,54,17,13,15,11,21,22,23,30,47,8])))),In=l((()=>s((()=>import("./TransactionDetailRoutes-C0gGgGik.js")),__vite__mapDeps([63,1,2,3,0,4,5,6,7,13,33,12,11,14,15,16,8])))),ve=l((()=>s((()=>import("./EntityDetailRoutes-5IMi-E-b.js")),__vite__mapDeps([64,1,2,3,4,5,6,7,13,10,11,12,14,15,16,17,8])))),An=l((()=>s((()=>import("./DashboardRoutes-X31R7cQf.js")),__vite__mapDeps([9,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,0,18,19,20,21,22,23,24,25,8])))),we=l((()=>s((()=>import("./BillPayRoutes-7abJ7Y81.js")),__vite__mapDeps([26,1,2,3,4,5,6,7,27,0,28,11,14,29,15,21,22,23,30,25,31,19,32,33,34,35,8])))),Tn=l((()=>s((()=>import("./SettingsRoutes-CXzUd0P6.js")),__vite__mapDeps([40,1,2,3,4,5,6,7,23,41,21,22,42,43,44,45,46,13,47,27,0,19,29,15,20,48,32,33,34,37,8])))),bn=l((()=>s((()=>import("./InvoicingRoutes-Q-6aUqgu.js")),__vite__mapDeps([65,1,2,3,4,5,6,7,27,0,21,22,23,42,43,44,45,46,13,8])))),Oe=l((()=>s((()=>import("./ReimbursementRoutes-mHGAbMEo.js")),__vite__mapDeps([36,1,2,3,4,5,6,7,0,31,29,15,21,22,23,19,25,11,14,30,37,33,34,35,8])))),fn=l((()=>s((()=>import("./ZeniAccountRoutes-QObrERl4.js")),__vite__mapDeps([59,1,2,3,4,5,6,7,0,31,29,15,21,22,23,19,25,28,27,11,39,8])))),Dn=l((()=>s((()=>import("./TreasuryRoutes-C7ABXX2A.js")),__vite__mapDeps([57,1,2,3,4,5,6,7,0,31,29,15,21,22,23,19,11,14,25,8])))),yn=l((()=>s((()=>import("./TransactionListRoutes-_bc9UoMG.js")),__vite__mapDeps([38,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,39,8])))),Cn=l((()=>s((()=>import("./ChargeCardRoutes-BR5_qY8y.js")),__vite__mapDeps([50,1,2,3,4,5,6,7,11,21,22,23,31,29,15,0,19,14,51,27,8])))),vn=l((()=>s((()=>import("./NotificationRoutes-CDa5TISi.js")),__vite__mapDeps([66,1,2,3,0,4,5,6,7,11,23,8])))),wn=l((()=>s((()=>import("./PerformanceRoutes-B5KqyHoS.js")),__vite__mapDeps([67,1,2,3,0,4,5,6,7,11,21,22,23,8])))),On=l((()=>s((()=>import("./ExpenseAutomationRoutes-DH5uN2wQ.js")),__vite__mapDeps([53,1,2,3,0,4,5,6,7,11,12,13,14,15,16,54,17,10,55,56,47,30,8])))),Pn=l((()=>s((()=>import("./ActualMatchingMatchDetailScreen-Dd_vJSSr.js")),__vite__mapDeps([68,1,2,3,4,5,6,7,54,17,13,15,0,8])))),Un=l((()=>s((()=>import("./RewardsRoutes-CRQaDmuu.js")),__vite__mapDeps([69,1,2,3,4,5,6,7,0,8])))),kn=l((()=>s((()=>import("./TaskRoutes-aDI7RZCK.js")),__vite__mapDeps([70,1,2,3,0,4,5,6,7,14,21,22,23,71,11,72,8])))),Fn=l((()=>s((()=>import("./AiCfoScreen-CU1e2Oi8.js")),__vite__mapDeps([73,1,2,3,4,5,6,7,24,56,15,72,8])))),Pe=l((()=>s((()=>import("./CardsAiCfoScreen-BcEHiZtA.js")),__vite__mapDeps([74,1,2,3,4,5,6,7,8])))),D=l((()=>s((()=>import("./NotFoundScreen-CxVO6BUm.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),Ln=l((()=>s((()=>import("./TaskListScreen-Dv5TjArL.js").then((t=>t.f))),__vite__mapDeps([71,1,2,3,4,5,6,7,11,21,22,23,72,8])))),Vn=({isDashboardAccess:t,showZeniAccountRoute:p,isUserHasBillPayAccess:L,isUserHasReimbursementAccess:i,showTreasuryRoute:H,isTenantBankingOnly:O,isTenantCardsOnly:w,showChargeCardRoute:S})=>{if(O===!0){if(p)return e.jsx(d,{to:"checking"});if(H)return e.jsx(d,{to:"treasury"});if(S)return e.jsx(d,{to:"cards"})}return w===!0&&S?e.jsx(d,{to:"cards"}):t?e.jsx(d,{to:"dashboard"}):p?e.jsx(d,{to:"checking"}):H?e.jsx(d,{to:"treasury"}):S?e.jsx(d,{to:"cards"}):L?e.jsx(d,{to:"bills"}):i?e.jsx(d,{to:"reimbursements"}):e.jsx(d,{to:"dashboard"})},A=({children:t,fallback:p,isAllowed:L})=>{const i=on();return L?t:i?e.jsx(rn,{fetchState:"In-Progress"}):p},Ue=({tenantEmailDomain:t})=>e.jsx(d,{to:`/${t}/dashboard`}),Gn=Object.freeze(Object.defineProperty({__proto__:null,default:function({setTenantEmailDomain:t}){const p=Gs(),L=Ys(),{tenantEmailDomain:i}=qs(),H=ln().mode,{setLoading:O,clearAllLoading:w,clearLoading:S}=Xs(),y=C.getSignedInUserTenant(i)?.tenantId,T=C.getSignedInUser(),X=hs(T),G=Ws(),[V,ke]=U.useState(!1),r=z((o=>Es(o))),{useFeatureGate:B}=Qs(),M=Js(),Q=en(),Fe=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,Le=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",{isFeatureEnabled:Ve}=B(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:ie}=B(Z.isDebitCardFeatureEnabled),b=z((o=>o.tenantState.fetchState)),x=z((o=>o.tenantState.activeTenantFetchState.fetchState)),h=x==="Completed"||b==="Completed"?ps(ie,r):void 0,J=x==="Completed"||b==="Completed"?xs(r):void 0,re=x==="Completed"||b==="Completed"?js(r)&&!gs(r):void 0,He=sn(r,Ve,ie),{isCardsHidden:Se}=nn(r?.tenantId),Be=!He||!!Se,{isFeatureEnabled:Ne}=B(Z.isSettingsFeatureEnabled),{isFeatureEnabled:ee}=B(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:Ze}=B(Z.isInvoicingFeatureEnabled??"is_invoicing_feature_enabled"),Me=r?.userRole!=null&&Rs(r.userRole),Y=z((o=>Is(o)));if(i!=null){const o=C.getSignedInUserTenant(i);T!=null&&o!=null&&fe(T,r,H)}const $={tenantId:y,userId:T?.userId,sessionId:T?.zeniSessionId},le=As(),E=tn(),$e=r.company==null||E?.loggedInUserRoleMap!=null&&xe(E.loggedInUserRole),ze=Ts(E?.loggedInUserRoleMap),se=Te("/:tenantEmailDomain/onboarding/*")!==null,Ge=Te("/:tenantEmailDomain/month_end_close_checks/review/:selectedTab/:selectedPeriod/*"),ne=Ge?.params.selectedPeriod,Ye=z((o=>$.tenantId!=null?bs(o,$.tenantId):void 0));U.useEffect((()=>{O(F.TENANT_FETCHING),t(i)}),[i]),U.useEffect((()=>{if(ne!=null&&y!=null){const o=ne.split("-");if(o.length===2){const f=fs(Number(o[0])),u=Number(o[1]),n=Ds(`01-${f<10?`0${f}`:f}-${u}`,be.getLocalizedStrings().dateFormat.analytics.DDDashMMDashYYYY),c=ys();n.isAfter(c,"month")===!1?p(Cs(y,{month:f,year:u})):L(`/${i}/month_end_close_checks/review`)}}}),[ne,i,y]),U.useEffect((()=>{V||(ke(!0),O(F.TENANT_FETCHING))}),[V,$,le,T,p,C]),U.useLayoutEffect((()=>{!vs(le,$)&&C.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,f,u,n){if(ge(f?.userId,f?.zeniSessionId,o.tenantId),u($s(!0)),u(Re(o.tenantId)),o.tenantId!=null&&_.clearTenant(o.tenantId),o.tenantId!=null){const c=C.getSignedInUserTenantWithId(o.tenantId);n&&be.updateAppLocaleID(dn(n)),c?.tenantEmailDomain!=null&&C.saveActiveTenantDomainForUser(c?.tenantEmailDomain)}o.userId!=null?ae.identify(o.userId,{tenant_id:o.tenantId}):ae.resetUserIdentity()})($,T,p,Ye))}),[y]),U.useEffect((()=>{C.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,f,u,n,c,q,N){if(u==null&&n==null)return void console.warn("There is no current tenant selected!!");const W=n!=null&&c?.zeniSessionId!=null,us=u==null||u.tenantId!==n,ms=u!=null&&u.excludedResources==null,_s=u!=null&&u.externalConnections==null;if(W&&us){N(Re(n));const K=C.getSignedInUserTenantWithId(n);K?.tenantEmailDomain!=null&&C.saveActiveTenantDomainForUser(K?.tenantEmailDomain),ge(c?.userId,c?.zeniSessionId,n),_.shouldFetchExcludedResources(n)&&(_.markExcludedResourcesFetchStarted(n),N(Ie(c.userId,n))),_.shouldFetchConnections(n)&&(_.markConnectionsFetchStarted(n),N(Ae(c.userId,n)))}else W&&ms&&_.shouldFetchExcludedResources(n)&&(_.markExcludedResourcesFetchStarted(n),N(Ie(c.userId,n))),W&&_s&&_.shouldFetchConnections(n)&&(_.markConnectionsFetchStarted(n),N(Ae(c.userId,n)));if(W){ae.identify(c.userId,{tenant_id:n});const K=n==null||n!=null&&(f==="Completed"||f==="Error");o==="Completed"||f!=="Not-Started"&&f!=="Error"||n==null||!_.shouldFetchActiveTenant(n)||(_.markActiveTenantFetchStarted(n),q(F.TENANT_FETCHING),N(zs(c.userId,n,c.zeniSessionId))),K&&(o==="Not-Started"||o==="Error")&&_.shouldFetchAllTenants()&&(_.markAllTenantsFetchStarted(),N(je(c.userId,c.zeniSessionId)))}})(b,x,r,y,T,O,p))}),[y,x]),U.useEffect((()=>{C.isSignedIn()&&b==="Completed"&&Y.tenantsBaseInOrder.length>0&&(S(F.TENANT_FETCHING),C.saveSignedInUserTenants(ws(Y.tenantsBaseInOrder)),T!=null&&fe(T,r,H,void 0,Y.tenantsBaseInOrder))}),[Y,b,r,T]),U.useEffect((()=>{x==="In-Progress"&&O(F.TENANT_FETCHING),x!=="Completed"&&x!=="Error"||(x==="Completed"&&y!=null?(w(),_.markActiveTenantFetchCompleted(y)):x==="Error"&&y!=null&&(_.markActiveTenantFetchFailed(y),S(F.TENANT_FETCHING),S(F.TENANT_SWITCHING))),b!=="Completed"&&b!=="Error"||(b==="Completed"?_.markAllTenantsFetchCompleted():b==="Error"&&_.markAllTenantsFetchFailed())}),[x,b,y,V]);const de=U.useRef(!1);U.useEffect((()=>{!de.current&&x==="Completed"&&V&&(de.current=!0,(function(o=hn,f=3e3){setTimeout((()=>{const u=n=>{if(n>=o.length)return;const c=o[n],q=_n[c];q!=null?q().then((()=>oe((()=>u(n+1))))).catch((()=>oe((()=>u(n+1))))):u(n+1)};oe((()=>u(0)))}),f)})())}),[x,V]);const P=r?.userRole!=null&&Os(r?.userRole),{isFeatureEnabled:qe}=B(Z.isReferralFeatureEnabled),{isFeatureEnabled:We}=B(Z.isAccrualEnabled),Ke=r?.userRole!=null&&r.userRole.includes("charge_card_user"),Xe=r?.userRole!=null&&r.userRole.includes("charge_card_admin"),k=r?.userRole!=null&&xe(r.userRole),ce=r?.company==null||r.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!P,ue=!Be&&!P,Qe=Ps(E?.loggedInUserRoleMap),Je=r.externalConnections?.accounting[0]?.isValid,es=r.externalConnections?.fetchState==="Completed",te=r.company?.companyOnboardingInfo.isOnboardingCompleted,me=r?.company==null||r.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!P,_e=me&&Us(E?.loggedInUserRoleMap),he=Fe&&!P,ss=Le&&!P,ns=ce&&ks(E?.loggedInUserRoleMap),ts=ue&&Fs(E?.loggedInUserRoleMap),as=he&&Ls(E?.loggedInUserRoleMap),os=Vs(E?.loggedInUserRoleMap),is=Hs(E?.loggedInUserRoleMap),rs=Ss(E?.loggedInUserRoleMap),ls=Bs(E?.loggedInUserRoleMap),ds=Ns(E?.loggedInUserRoleMap),j=Zs(E?.loggedInUserRoleMap),g=Ms(E?.loggedInUserRoleMap),Ee=ce&&j,pe=me&&g,R=he&&rs,I=ss&&ls,m=ue&&ds,cs=r.excludedResources?.resources?.find((o=>o.resource==="/invites"))!=null||ze===!0||Qe===!0||os===!0||is===!0;return C.isSignedIn()?y==null?b==="Completed"?e.jsx(d,{to:"/",replace:!0,state:{...G.state,message:"...",origin:G.pathname}}):(T!=null&&b!=="In-Progress"&&p(je(T.userId,T.zeniSessionId)),null):x!=="In-Progress"&&x!=="Not-Started"||b==="Completed"?(te===!0||X&&!se)&&es&&Je!==!0&&h===!1&&J===!1&&re===!1?(t(void 0),e.jsx(d,{to:"/connection/auth",replace:!0})):!V||re!==!0||te!==!0||se||X?!V||te!==!1||se||X?V&&r?.userRole&&h!=null&&J!=null&&i!=null&&Object.keys(E.loggedInUserRoleMap).length>0?e.jsx(Ks,{children:e.jsxs(a,{element:e.jsx(an,{}),children:[e.jsx(a,{path:"/",element:e.jsx(Vn,{isDashboardAccess:k,showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,isTenantCardsOnly:J,showChargeCardRoute:m})}),e.jsx(a,{path:"dashboard/*",element:k?e.jsx(An,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"reports/*",element:k?e.jsx(En,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"people/*",element:cs||k?e.jsx(xn,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"forecast/*",element:k?e.jsx(jn,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"onboarding/*",element:e.jsx(gn,{})}),e.jsx(a,{path:"transaction/*",element:k&&P===!1||Ke||Xe?e.jsx(In,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"transactions/*",element:k&&P===!1?e.jsx(yn,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"customer/*",element:k&&P===!1?e.jsx(ve,{entityType:"customer"}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,isTenantBankingOnly:h,showTreasuryRoute:I,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"vendor/*",element:k&&P===!1?e.jsx(ve,{entityType:"vendor"}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"tasks",element:e.jsx(Ln,{})}),e.jsx(a,{path:"tasks/*",element:e.jsx(kn,{})}),e.jsx(a,{path:"address/*",element:ns||_e||as||ts?e.jsx(pn,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"checking/*",element:e.jsx(A,{isAllowed:R,fallback:e.jsx(D,{}),children:e.jsx(fn,{})})}),e.jsx(a,{path:"treasury/*",element:e.jsx(A,{isAllowed:I,fallback:e.jsx(D,{}),children:e.jsx(Dn,{})})}),e.jsx(a,{path:"performance",element:e.jsx(A,{isAllowed:Q,fallback:e.jsx(Ue,{tenantEmailDomain:i}),children:e.jsx(wn,{})})}),e.jsx(a,{path:"month_end_close_checks/review/*",element:e.jsx(A,{isAllowed:Q&&!P,fallback:e.jsx(Ue,{tenantEmailDomain:i}),children:e.jsx(On,{})})}),e.jsx(a,{path:"expense-automation/actual-matching/:matchId",element:e.jsx(A,{isAllowed:Q&&!P&&We,fallback:e.jsx(D,{}),children:e.jsx(Pn,{})})}),e.jsx(a,{path:"notifications/*",element:e.jsx(vn,{})}),e.jsx(a,{path:"vendors/*",element:e.jsx(A,{isAllowed:$e,fallback:e.jsx(D,{}),children:e.jsx(Rn,{})})}),e.jsx(a,{path:"bill/*",element:Ee?e.jsx(we,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"bills/*",element:Ee?e.jsx(we,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"reimbursement/*",element:pe?e.jsx(Oe,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"reimbursements/*",element:pe?e.jsx(Oe,{}):e.jsx(v,{showZeniAccountRoute:R,isUserHasBillPayAccess:j,isUserHasReimbursementAccess:g,showTreasuryRoute:I,isTenantBankingOnly:h,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(a,{path:"settings/*",element:e.jsx(A,{isAllowed:Ne,fallback:e.jsx(D,{}),children:e.jsx(Tn,{hasAdminLevelAccess:_e})})}),e.jsx(a,{path:"invoicing/*",element:e.jsx(A,{isAllowed:Ze&&Me,fallback:e.jsx(D,{}),children:e.jsx(bn,{})})}),e.jsx(a,{path:"cards/ask",element:e.jsx(A,{isAllowed:m&&M,fallback:e.jsx(D,{}),children:e.jsx(Pe,{isFileUploadEnabled:ee})})}),e.jsx(a,{path:"cards/ask/:session_id",element:e.jsx(A,{isAllowed:m&&M,fallback:e.jsx(D,{}),children:e.jsx(Pe,{isFileUploadEnabled:ee})})}),e.jsx(a,{path:"cards/*",element:e.jsx(A,{isAllowed:m,fallback:e.jsx(D,{}),children:e.jsx(Cn,{})})}),e.jsx(a,{path:"rewards/*",element:e.jsx(A,{isAllowed:qe,fallback:e.jsx(D,{}),children:e.jsx(Un,{})})}),e.jsx(a,{path:"/ai-cfo",element:e.jsx(A,{isAllowed:M,fallback:e.jsx(D,{}),children:e.jsx(d,{to:"explore"})})}),e.jsx(a,{path:"/ai-cfo/",element:e.jsx(A,{isAllowed:M,fallback:e.jsx(D,{}),children:e.jsx(d,{to:"explore"})})}),e.jsx(a,{path:"/ai-cfo/:session_id",element:e.jsx(A,{isAllowed:M,fallback:e.jsx(D,{}),children:e.jsx(Fn,{isFileUploadEnabled:ee})})}),e.jsx(a,{path:"*",element:e.jsx(D,{})})]})}):null:(t(void 0),e.jsx(d,{to:`/${i}/onboarding`,replace:!0})):(t(void 0),e.jsx(d,{to:`/${i}/onboarding/thankyou`,replace:!0})):null:(console.warn("User logged out!!"),t(void 0),e.jsx(d,{to:"/signin/auth",replace:!0,state:{...G.state,message:"...",origin:G.pathname}}))}},Symbol.toStringTag,{value:"Module"}));export{v as F,Gn as S};