@zeniai/web-app-ui 5.4.17-dev → 5.4.18-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 (122) hide show
  1. package/dist/assets/{AccountMappingScreen-DIZ1qWql.js → AccountMappingScreen-4Zeu95kU.js} +1 -1
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-C6MMW6xe.js → ActualMatchingMatchDetailScreen-B6pl-MVl.js} +1 -1
  3. package/dist/assets/AddressRoutes-zjWkB0xf.js +1 -0
  4. package/dist/assets/{AddressScreen-CxRV-hrD.js → AddressScreen-Czlolp2X.js} +1 -1
  5. package/dist/assets/{AiCfoScreen-Ct8ctLoM.js → AiCfoScreen-BhfmD__h.js} +1 -1
  6. package/dist/assets/{AppDrawer-DDlKiLbC.js → AppDrawer-B7GEeTxi.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-WPV-16X0.js → BillPayApprovalRoutes-B4dh4WxY.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-PQbxiOB3.js → BillPayRoutes-DZx-x_-P.js} +1 -1
  9. package/dist/assets/{BusinessVerificationPageScreen-DaAqJAwC.js → BusinessVerificationPageScreen-je1np7-9.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-CVenT1_U.js → CardsAiCfoScreen-abedaxWu.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-uCAqAWIA.js → ChargeCardRoutes-Db9V9An_.js} +1 -1
  12. package/dist/assets/{CompanyPassportScreen-DtXzsb3x.js → CompanyPassportScreen-Db20J8Yl.js} +1 -1
  13. package/dist/assets/{ConnectionAuthScreen-BC1VQ6tg.js → ConnectionAuthScreen-BmJpUHtJ.js} +1 -1
  14. package/dist/assets/CustomerOnboardingAuthScreen-Deo-LVYJ.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-B6np-cNh.js → CustomerOnboardingRoutes-De4sHn4O.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-9dawbCei.js → DashboardRoutes-CCGs4e1_.js} +3 -3
  17. package/dist/assets/{DefaultTenantHome-BgSSAKid.js → DefaultTenantHome-BN__AQ5l.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-u2HKaCWA.js → DomesticWireDetailScreen-6W-Er5_q.js} +3 -3
  19. package/dist/assets/{DrawerScreen-BmZb1i83.js → DrawerScreen-DUhkZI2Z.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-DV-gNWAZ.js → EntityDetailRoutes-BrJAd36h.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-DJyIDCG4.js → ExpenseAutomationRoutes-DcjeaHHd.js} +1 -1
  22. package/dist/assets/{FallBackRoute--cXyuVDR.js → FallBackRoute-orqRsHMl.js} +2 -2
  23. package/dist/assets/{FeaturePreviewScreen-DjPPDYKv.js → FeaturePreviewScreen-Dcu53_tf.js} +1 -1
  24. package/dist/assets/{HubSpotOAuthCallbackScreen-DL6_G6pe.js → HubSpotOAuthCallbackScreen-ClZsPGpZ.js} +1 -1
  25. package/dist/assets/{InboxNotificationsProvider-Daf1RQwd.js → InboxNotificationsProvider-DiTDJFwP.js} +1 -1
  26. package/dist/assets/{InvoicingRoutes-DKlu_pXq.js → InvoicingRoutes-BTvzZ8JV.js} +2 -2
  27. package/dist/assets/{MagicLinkRoutes-BkZcOPcj.js → MagicLinkRoutes-V1DxaNiW.js} +5 -5
  28. package/dist/assets/{MagicLinkSignInScreen-CmIZfa-U.js → MagicLinkSignInScreen-DnCx8Y6G.js} +1 -1
  29. package/dist/assets/{MobileAppDrawer-DTqKEh3f.js → MobileAppDrawer-Bql3K6nh.js} +1 -1
  30. package/dist/assets/NotFoundScreen-CTik05r2.js +1 -0
  31. package/dist/assets/{NotificationRoutes-BwTXq37O.js → NotificationRoutes-wSm6mA8N.js} +1 -1
  32. package/dist/assets/{OAuthConsentScreen-NPetpQky.js → OAuthConsentScreen-BELrcqAy.js} +1 -1
  33. package/dist/assets/{PandLWithForecastRoutes-eI5sgFXq.js → PandLWithForecastRoutes-Dpao8SIb.js} +1 -1
  34. package/dist/assets/{PaymentLinkScreen-C3fxjzB1.js → PaymentLinkScreen-vbM_NtP3.js} +1 -1
  35. package/dist/assets/{PeopleRoutes-B4kdNKMm.js → PeopleRoutes-CJeBX2Ca.js} +1 -1
  36. package/dist/assets/PerformanceRoutes-W4NxEUmH.js +1 -0
  37. package/dist/assets/{Preview-Cr2n9zp9.js → Preview-Db0nRlxD.js} +1 -1
  38. package/dist/assets/{QBOConnectionScreen-BLLJy6Ug.js → QBOConnectionScreen-BEn_CddB.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRoutes-DX03V50m.js → ReimbursementApprovalRoutes-CSZJghRB.js} +1 -1
  40. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-y6N7Iuxh.js → ReimbursementApprovalRuleDetailScreen-kqCAU4nf.js} +1 -1
  41. package/dist/assets/{ReimbursementRoutes-50C6Ebhr.js → ReimbursementRoutes-BUZKWvJ7.js} +1 -1
  42. package/dist/assets/{ReportsRoutes-CPbwIPP-.js → ReportsRoutes-BUZ4r7hx.js} +1 -1
  43. package/dist/assets/{RewardsRoutes-cADkol8X.js → RewardsRoutes-DuYZ4TXP.js} +1 -1
  44. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-Bb90T06-.js → ScheduleDetailsPrepaidExpensesScreen-DN2DZsFw.js} +4 -4
  45. package/dist/assets/{ScreenRoutes-BOM6GDiC.js → ScreenRoutes-CxP9HSCe.js} +2 -2
  46. package/dist/assets/{SettingsRoutes-Dd8PYfpt.js → SettingsRoutes-CCWla9X1.js} +6 -6
  47. package/dist/assets/{SetupPagesScreen-BY0N32JD.js → SetupPagesScreen-C5PRNruc.js} +1 -1
  48. package/dist/assets/{SignInScreen-DGgeSRO8.js → SignInScreen-BScZ138a.js} +1 -1
  49. package/dist/assets/{SignOutScreen-DPsA_-Qd.js → SignOutScreen-Bk-Y8Sbv.js} +1 -1
  50. package/dist/assets/{TaskListScreen-yze1VNuP.js → TaskListScreen-C7smUYFP.js} +2 -2
  51. package/dist/assets/{TaskRoutes-B5s7sZXk.js → TaskRoutes-DPcu4NRR.js} +2 -2
  52. package/dist/assets/{TransactionDetailRoutes-D5llvRhv.js → TransactionDetailRoutes-yEwix446.js} +1 -1
  53. package/dist/assets/{TransactionDetailScreen-CebcYk9B.js → TransactionDetailScreen-CHzsnTr9.js} +1 -1
  54. package/dist/assets/{TransactionListRoutes-PnEvh6qc.js → TransactionListRoutes-ChJOrV96.js} +1 -1
  55. package/dist/assets/{TreasuryRoutes-DbBm2doo.js → TreasuryRoutes-C24SAGLB.js} +1 -1
  56. package/dist/assets/{VendorsRoutes-CQjAHjxC.js → VendorsRoutes-CVu8jS5h.js} +1 -1
  57. package/dist/assets/{WiseConfirmationScreen-d0_FJyyD.js → WiseConfirmationScreen-Dt6hB5m-.js} +1 -1
  58. package/dist/assets/{ZeniAccountRoutes-CrROItmj.js → ZeniAccountRoutes-D3ONSR9y.js} +7 -7
  59. package/dist/assets/{ZeniAccountStatementScreen-DiwM8zAQ.js → ZeniAccountStatementScreen-CmfHt6Wr.js} +1 -1
  60. package/dist/assets/{accountMappingHelper-DHkHknqJ.js → accountMappingHelper-CHQgwqfy.js} +1 -1
  61. package/dist/assets/{analytics-CabaUa1L.js → analytics-D051O7ML.js} +1 -1
  62. package/dist/assets/{analyticsHelper-BOs1nNPv.js → analyticsHelper-DkNc3mKz.js} +1 -1
  63. package/dist/assets/{core-BQ6YlWys.js → core-BBlQ3ArL.js} +1 -1
  64. package/dist/assets/{decodeURIComponentSafe-D_MvDEMm.js → decodeURIComponentSafe-YbpxzvKa.js} +1 -1
  65. package/dist/assets/{dnd-DL41lZFs.js → dnd-CU3yeazS.js} +1 -1
  66. package/dist/assets/{empty-CmBSqEpE.js → empty-B3C-udVF.js} +1 -1
  67. package/dist/assets/{empty-mwfdcHvm.js → empty-BiAWzWBi.js} +1 -1
  68. package/dist/assets/{emptyVideoElement-BIOkPHF6.js → emptyVideoElement-CRPwTqUS.js} +1 -1
  69. package/dist/assets/{epic-PdviWWJR.js → epic-DwBfFPJQ.js} +1 -1
  70. package/dist/assets/{expenseAutomationHelper-Bn2j121J.js → expenseAutomationHelper-SA0jUIyg.js} +1 -1
  71. package/dist/assets/{getLocaleForTenant-jg4r2V28.js → getLocaleForTenant-DTPcYF0O.js} +1 -1
  72. package/dist/assets/{index-Bfsx1pdD.js → index--CQENyaz.js} +1 -1
  73. package/dist/assets/{index-BNuLRh9K.js → index-CaztP9tz.js} +1 -1
  74. package/dist/assets/{index-DZBfE5XI.js → index-ClwW47Zs.js} +899 -904
  75. package/dist/assets/{index-Du1SP9oT.js → index-MRZKoeCT.js} +2 -2
  76. package/dist/assets/{index-B7zYAj-7.js → index-ae04Qn4V.js} +1 -1
  77. package/dist/assets/{index-CamOdFyi.js → index-fVadamkP.js} +1 -1
  78. package/dist/assets/{index-Deo5Hnb2.js → index-jomr_c-N.js} +1 -1
  79. package/dist/assets/{index-BiyVMPcR.js → index-s4pcd-16.js} +1 -1
  80. package/dist/assets/{lexical-BmxGnuDE.js → lexical-DVH-xgq1.js} +1 -1
  81. package/dist/assets/{liveblocks-UAxYbctH.js → liveblocks-CuUK5O_2.js} +1 -1
  82. package/dist/assets/{lottie-BPF4ysWw.js → lottie-Du4lbH8J.js} +1 -1
  83. package/dist/assets/{mui-DYo6Z7Si.js → mui--aGBnNu2.js} +1 -1
  84. package/dist/assets/{pathToGoBack-CxX9ql3A.js → pathToGoBack-DOePc_e5.js} +1 -1
  85. package/dist/assets/{pdf-CHT1_0Mk.js → pdf-CrvsvvW3.js} +3 -3
  86. package/dist/assets/{pdf-lib-BMce44-8.js → pdf-lib-Cvsvldn7.js} +1 -1
  87. package/dist/assets/{plaid-BNcFec4W.js → plaid-7P9b69CP.js} +1 -1
  88. package/dist/assets/{pusher-C1AzfTgV.js → pusher-DdvpIMG0.js} +1 -1
  89. package/dist/assets/{react-DZjZzXEf.js → react-B8GJK4jq.js} +1 -1
  90. package/dist/assets/{react-CT8AAIAI.js → react-Bz6aBujY.js} +1 -1
  91. package/dist/assets/{react-BnffftLd.js → react-CUlf2ISA.js} +1 -1
  92. package/dist/assets/{react-CSOME4pA.js → react-CjVSd3S9.js} +1 -1
  93. package/dist/assets/{react-B13-Yejj.js → react-D-JjM7p6.js} +1 -1
  94. package/dist/assets/{react-CjoLUzLz.js → react-DoYRVAKa.js} +1 -1
  95. package/dist/assets/{recharts-VJtr9O-6.js → recharts-CkREU3LH.js} +1 -1
  96. package/dist/assets/{reportTimeframe-D2vFkQK6.js → reportTimeframe-ChAOzqo_.js} +1 -1
  97. package/dist/assets/{routePaths-CaZTJQOM.js → routePaths-D0jOibXk.js} +1 -1
  98. package/dist/assets/{sentry-CQfqw6mU.js → sentry-D0lP5-8e.js} +1 -1
  99. package/dist/assets/{stripSplatSuffix-TzoGXcwz.js → stripSplatSuffix-CFosfir7.js} +1 -1
  100. package/dist/assets/{url-dVvWrnA9.js → url-GwD82u5j.js} +1 -1
  101. package/dist/assets/{url-OL55dppf.js → url-nN4BnP9N.js} +1 -1
  102. package/dist/assets/useActualMatchingMatchDetail-nJ3hpXEY.js +1 -0
  103. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-B4OxQoVy.js → useAiCfoDashboardSuggestedQuestionsChips-usJW6KKQ.js} +1 -1
  104. package/dist/assets/useAskAiCfoHostNavButtonProps-CWWQxV2L.js +1 -0
  105. package/dist/assets/{useChargeCardPusherEvents-Gp7Qmy_v.js → useChargeCardPusherEvents-DPfHk-vM.js} +1 -1
  106. package/dist/assets/{useDeviceId-B6KB8W5T.js → useDeviceId-pp3Grc-z.js} +1 -1
  107. package/dist/assets/{useEmailConnectResultRefresh-DJgvOf06.js → useEmailConnectResultRefresh-B6j7j1rG.js} +1 -1
  108. package/dist/assets/{useEnsureVendorListLoaded-BbjOUcqm.js → useEnsureVendorListLoaded-COBYTL2U.js} +1 -1
  109. package/dist/assets/{useInitialThreadRequest-BpNcTGLt.js → useInitialThreadRequest-DmfmyzKI.js} +1 -1
  110. package/dist/assets/{useTaskManagerAccess-CP331xWN.js → useTaskManagerAccess-DrmpkeUw.js} +1 -1
  111. package/dist/assets/{useTaskManagerPusherEvents-BmjCwNse.js → useTaskManagerPusherEvents-CHhZ2DRZ.js} +1 -1
  112. package/dist/assets/{utils-BpLD-La5.js → utils-Ctp9Zfhk.js} +1 -1
  113. package/dist/assets/{withTransactionSidePanel-7NlWHlVm.js → withTransactionSidePanel-CKC1_4cy.js} +1 -1
  114. package/dist/assets/{zeni-epic-state-j9Po26Lg.js → zeni-epic-state-aUBx6G2Q.js} +3 -3
  115. package/dist/index.html +1 -1
  116. package/package.json +2 -2
  117. package/dist/assets/AddressRoutes-DneYortX.js +0 -1
  118. package/dist/assets/CustomerOnboardingAuthScreen-DGFpytn-.js +0 -1
  119. package/dist/assets/NotFoundScreen-CY-XFa3a.js +0 -1
  120. package/dist/assets/PerformanceRoutes-CT8b6LEZ.js +0 -1
  121. package/dist/assets/useActualMatchingMatchDetail-DglThU_y.js +0 -1
  122. package/dist/assets/useAskAiCfoHostNavButtonProps-DV6iNvbF.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as U}from"./liveblocks-UAxYbctH.js";import{a as i}from"./sentry-CQfqw6mU.js";import{h as Z,g as H,u as K,j as A,s as W,l as X}from"./core-BQ6YlWys.js";import{az as ee,p as te,N as B,z as ne,C as $,be as ae,d as ce,U as oe}from"./index-DZBfE5XI.js";import{bm as se,fI as ie,gZ as ue,oQ as q,Yy as re,ik as G,gk as le,oD as de,Yz as pe,YA as ge,YB as me,ur as Ae,ma as be,oB as Ie,ox as ye,oM as fe,oI as Se,im as he,YC as Ee,YD as ve}from"./zeni-epic-state-j9Po26Lg.js";import{n as we}from"./mui-DYo6Z7Si.js";import{M as Ce}from"./MobileAppDrawer-DTqKEh3f.js";import{q as Q}from"./QBOConnectionScreen-BLLJy6Ug.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-DHkHknqJ.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="f86e2317-4dbb-40f9-8644-24956d9c0c1b",n._sentryDebugIdIdentifier="sentry-dbid-f86e2317-4dbb-40f9-8644-24956d9c0c1b")}catch{}})();const r="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},xe=we.div`
1
+ import{j as U}from"./liveblocks-CuUK5O_2.js";import{a as i}from"./sentry-D0lP5-8e.js";import{h as Z,g as H,u as K,j as A,s as W,l as X}from"./core-BBlQ3ArL.js";import{az as ee,p as te,N as B,z as ne,C as $,be as ae,d as ce,U as oe}from"./index-ClwW47Zs.js";import{bm as se,fI as ie,gZ as ue,oQ as q,Yy as re,ik as G,gk as le,oD as de,Yz as pe,YA as ge,YB as me,ur as Ae,ma as be,oB as Ie,ox as ye,oM as fe,oI as Se,im as he,YC as Ee,YD as ve}from"./zeni-epic-state-aUBx6G2Q.js";import{n as we}from"./mui--aGBnNu2.js";import{M as Ce}from"./MobileAppDrawer-Bql3K6nh.js";import{q as Q}from"./QBOConnectionScreen-BEn_CddB.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-CHQgwqfy.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="f86e2317-4dbb-40f9-8644-24956d9c0c1b",n._sentryDebugIdIdentifier="sentry-dbid-f86e2317-4dbb-40f9-8644-24956d9c0c1b")}catch{}})();const r="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},xe=we.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-UAxYbctH.js";import{a as y}from"./sentry-CQfqw6mU.js";import{a5 as A,c1 as R}from"./index-DZBfE5XI.js";import"./mui-DYo6Z7Si.js";import{u as F}from"./useActualMatchingMatchDetail-DglThU_y.js";import b from"./NotFoundScreen-CY-XFa3a.js";import{i as P,h as U,g as w}from"./core-BQ6YlWys.js";import"./zeni-epic-state-j9Po26Lg.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";import"./stripSplatSuffix-TzoGXcwz.js";import"./decodeURIComponentSafe-D_MvDEMm.js";import"./routePaths-CaZTJQOM.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="5d1e58e7-9d32-481b-a5a9-fbb96cf6d066",t._sentryDebugIdIdentifier="sentry-dbid-5d1e58e7-9d32-481b-a5a9-fbb96cf6d066")}catch{}})();function V(){const{matchId:t,tenantEmailDomain:e}=P(),o=U(),n=w(),k=F(t??""),r=y.useCallback((()=>{const v=A(n.state?.pathnameStackToGoBack);o(v.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:v.newStack}})}),[n.state,o,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:a,handleOpenBill:l,handleRefresh:h,handleUndoReversal:d,handleApproveAndReverse:c,handleIgnoreMatchSuggestion:f,lastMatchResults:p,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?a.fetchState==="Not-Started"||a.fetchState==="In-Progress"?s.jsx(R,{detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:f,onRefresh:h,onUndoReversal:d,lastMatchResults:p,lastUndoResults:g}):s.jsx(b,{}):s.jsx(R,{match:i,detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:f,onRefresh:h,onUndoReversal:d,lastMatchResults:p,lastUndoResults:g})}export{V as default};
1
+ import{j as s}from"./liveblocks-CuUK5O_2.js";import{a as y}from"./sentry-D0lP5-8e.js";import{a5 as A,c1 as R}from"./index-ClwW47Zs.js";import"./mui--aGBnNu2.js";import{u as F}from"./useActualMatchingMatchDetail-nJ3hpXEY.js";import b from"./NotFoundScreen-CTik05r2.js";import{i as P,h as U,g as w}from"./core-BBlQ3ArL.js";import"./zeni-epic-state-aUBx6G2Q.js";import"./recharts-CkREU3LH.js";import"./analytics-D051O7ML.js";import"./plaid-7P9b69CP.js";import"./dnd-CU3yeazS.js";import"./stripe-cKAAJElX.js";import"./lottie-Du4lbH8J.js";import"./lexical-DVH-xgq1.js";import"./pdf-CrvsvvW3.js";import"./utils-Ctp9Zfhk.js";import"./stripSplatSuffix-CFosfir7.js";import"./decodeURIComponentSafe-YbpxzvKa.js";import"./routePaths-D0jOibXk.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="5d1e58e7-9d32-481b-a5a9-fbb96cf6d066",t._sentryDebugIdIdentifier="sentry-dbid-5d1e58e7-9d32-481b-a5a9-fbb96cf6d066")}catch{}})();function V(){const{matchId:t,tenantEmailDomain:e}=P(),o=U(),n=w(),k=F(t??""),r=y.useCallback((()=>{const v=A(n.state?.pathnameStackToGoBack);o(v.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:v.newStack}})}),[n.state,o,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:a,handleOpenBill:l,handleRefresh:h,handleUndoReversal:d,handleApproveAndReverse:c,handleIgnoreMatchSuggestion:f,lastMatchResults:p,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?a.fetchState==="Not-Started"||a.fetchState==="In-Progress"?s.jsx(R,{detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:f,onRefresh:h,onUndoReversal:d,lastMatchResults:p,lastUndoResults:g}):s.jsx(b,{}):s.jsx(R,{match:i,detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:f,onRefresh:h,onUndoReversal:d,lastMatchResults:p,lastUndoResults:g})}export{V as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-CuUK5O_2.js";import{A as i}from"./AddressScreen-Czlolp2X.js";import s from"./NotFoundScreen-CTik05r2.js";import"./sentry-D0lP5-8e.js";import{n as d,o as r}from"./core-BBlQ3ArL.js";import"./zeni-epic-state-aUBx6G2Q.js";import"./recharts-CkREU3LH.js";import"./index-ClwW47Zs.js";import"./mui--aGBnNu2.js";import"./analytics-D051O7ML.js";import"./plaid-7P9b69CP.js";import"./dnd-CU3yeazS.js";import"./stripe-cKAAJElX.js";import"./lottie-Du4lbH8J.js";import"./lexical-DVH-xgq1.js";import"./pdf-CrvsvvW3.js";import"./utils-Ctp9Zfhk.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="759b3caa-23db-47f6-8a7f-f9beb9346558",t._sentryDebugIdIdentifier="sentry-dbid-759b3caa-23db-47f6-8a7f-f9beb9346558")}catch{}})();function _(){return e.jsxs(d,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(i,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(i,{})}),e.jsx(r,{path:"*",element:e.jsx(s,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-UAxYbctH.js";import{a as h}from"./sentry-CQfqw6mU.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-BQ6YlWys.js";import{a2 as $,z as D,V as L,a8 as K,a9 as U,d as _,U as S,a4 as z,_ as b,a5 as F}from"./index-DZBfE5XI.js";import{a1z as C,iA as N,fI as R,a1a as V,c7 as G,_g as O,mS as q}from"./zeni-epic-state-j9Po26Lg.js";import{u as H,n as J}from"./mui-DYo6Z7Si.js";import Q from"./NotFoundScreen-CY-XFa3a.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]="015a9a03-0b45-48e2-9035-8c1685e147e8",e._sentryDebugIdIdentifier="sentry-dbid-015a9a03-0b45-48e2-9035-8c1685e147e8")}catch{}})();const W=J.div`
1
+ import{j as r}from"./liveblocks-CuUK5O_2.js";import{a as h}from"./sentry-D0lP5-8e.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-BBlQ3ArL.js";import{a2 as $,z as D,V as L,a8 as K,a9 as U,d as _,U as S,a4 as z,_ as b,a5 as F}from"./index-ClwW47Zs.js";import{a1z as C,iA as N,fI as R,a1a as V,c7 as G,_g as O,mS as q}from"./zeni-epic-state-aUBx6G2Q.js";import{u as H,n as J}from"./mui--aGBnNu2.js";import Q from"./NotFoundScreen-CTik05r2.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]="015a9a03-0b45-48e2-9035-8c1685e147e8",e._sentryDebugIdIdentifier="sentry-dbid-015a9a03-0b45-48e2-9035-8c1685e147e8")}catch{}})();const W=J.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-UAxYbctH.js";import{a as n}from"./sentry-CQfqw6mU.js";import{u as Qt,h as Lt,i as Bt,g as Mt,j as v,l as Ft}from"./core-BQ6YlWys.js";import{ec as Vt,h as $t,n as Nt,ed as Gt,z as Ht,a2 as qt,ee as zt,ef as Wt,eg as Jt,aE as Be,eh as We,ei as Xt,aD as Je,a5 as ge,a9 as ce,d as V,ej as me,ek as Yt,el as Zt,ax as Kt,U as es,w as ts,em as ss,en as ns,aj as as,eo as os,ep as is,eq as rs,er as ls,s as us,aw as Me,es as ds}from"./index-DZBfE5XI.js";import{fH as F,gw as R,UZ as cs,a3l as ms,a3m as Ss,jX as hs,a3n as ps,jU as fs,a3o as Se,jA as X,k1 as Y,jG as Ie,jn as he,jl as gs,k3 as Is,jP as Xe,V5 as Fe,gy as $,gN as Cs,V4 as ks,US as Ve,fI as bs,je as vs,a3p as Es,gb as Ps,jw as ws,js as ys,fJ as pe,gi as xs,a3q as Rs,a3r as Ts,a3s as Os,gx as As,gr as $e,kf as Ne,gt as Ge,gz as js,a3t as He,k4 as Ds,jp as _s,jJ as Us,j$ as qe,jM as Qs,gA as Ls,gB as Bs,gC as Ms,gD as Fs}from"./zeni-epic-state-j9Po26Lg.js";import{D as Vs,n as N,S as $s,v as Ns}from"./mui-DYo6Z7Si.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-B4OxQoVy.js";import{p as Hs}from"./pathToGoBack-CxX9ql3A.js";import{k as qs}from"./routePaths-CaZTJQOM.js";import{u as zs}from"./useTaskManagerPusherEvents-BmjCwNse.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="1c2461bf-12bf-4136-aa23-bcd5bf905573",t._sentryDebugIdIdentifier="sentry-dbid-1c2461bf-12bf-4136-aa23-bcd5bf905573")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ye="chat-response-generated";function Js(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Xs=Ft((function(t,r){const h=F(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=ns(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=Os(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${as}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Js(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:Y(t).detail,skillDetailError:Y(t).fetchState==="Error",skillDetailLoading:Y(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,O=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:A,currentQuestionAnswer:G,currentQuestionAnswerSummary:j}=Je(g,E);O!=="answer"?V.trackAICFOChatResponseGenerated(O,G?.question.questionText??"",c.text,E,ds(j,A),c.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Ms({chatSessionId:c.metadata.chat_session_id,responseType:O,fetchState:{fetchState:"Completed",error:void 0}})),t(Fs({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(a,o,c,O,E)=>{a&&Me(t,a,o,i,g,d,O,c,void 0,E)},onFetchSkills:()=>{t(Xe())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Qs({macroId:a}))},onSaveSkill:(a,o)=>{t(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(qe({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Us({macroId:a,version:o}))},onDeleteSkill:a=>{t(_s({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(Ds({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t($()),t($e()),Me(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(He())},updateCurrentInput:a=>{t(Ge(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??Hs(1);l(o,{state:{...h.state,pathnameStackToGoBack:a.newStack}}),t(Ge(""))},togglePageView:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t($()),i!=null&&t($e());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(As({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Vt(),{setIsAiCfoOpen:h}=$t(),s=Qt(),d=Lt(),{session_id:l}=Bt(),i=Mt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>F(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),a=v((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),O=v((e=>Ss(e))),[E,A]=n.useState(void 0),[G,j]=n.useState(!1),[Ze,Ce]=n.useState(void 0),Ke=n.useCallback((()=>{Ce(void 0),A(void 0),j(!0)}),[]),et=n.useCallback((e=>{A(e),j(!0)}),[]),tt=n.useCallback((()=>{A(void 0),j(!1)}),[]),st=n.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),A(void 0),j(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),nt=n.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{s(P!=null?X({scheduleId:P}):Se())}),[s,P]);const M=ke?.macroId,at=v((e=>Y(e))),be=M!=null&&M!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&M!=null&&s(Ie({macroId:M}))}),[s,be,M]);const ot=v((e=>F(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Nt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(X({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(X({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=n.useCallback((e=>{Ce(e),A(void 0),j(!0)}),[]),lt=n.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=n.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{a&&s(he())}),[s,a]);const Pe=v((e=>R(e).skills)),Z=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=n.useCallback((e=>{s(Ie({macroId:e}))}),[s]),K=n.useCallback((()=>{s(Xe()),s(Fe())}),[s]),ct=n.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();n.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>F(e))),y=Ht.getSignedInUser();n.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ve()),void s(Fe())):(T==null&&s(Se()),s(Ve()),void s($()))),[s,T,g,l]);const ft=qt(),D=Kt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,Q=w!=null&&w!=="",ee=n.useCallback((e=>{Q&&d(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[Q,d,w]),te=n.useCallback((()=>{Q&&d(`/${w}/ai-cfo/routines`)}),[Q,d,w]),se=n.useCallback(((e,m)=>{const _=e.sessionId??C.sessionId;_!=null&&Q&&d(`/${w}/ai-cfo/${_}?routine=${encodeURIComponent(m)}`)}),[Q,d,C.sessionId,w]),gt=n.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:zt(k),skillName:k.isAdHoc===!0?void 0:Z.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:K,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[K,te,ee,se,ve,k,C.fetchState,C.runs,Z]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ne=Jt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:K}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,q=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[q,we,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);const z=I.uiState.lastContextMessage;n.useEffect((()=>{z!=null&&z!==""&&u!=null&&(ae(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:Oe}=Xt(u),W=I.fetchState,J=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Ae=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",je=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),De=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Je(De,u),Tt=Rt.length===0;n.useEffect((()=>{x||D||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,D,d,i.state]);const Ot=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),_e=n.useRef(void 0),Ue=n.useRef(void 0);n.useEffect((()=>{const e=l!==_e.current,m=u!==Ue.current;_e.current=l,Ue.current=u,l!==u&&(!e||l==null||qs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const At=n.useMemo((()=>({events:Oe.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,m,_)=>_.onEventReceived(e,m)})),[Oe]);n.useEffect((()=>{W!=="In-Progress"&&J&&s(ws())}),[W,J,s]),n.useEffect((()=>{u!=null&&Ae!=="In-Progress"&&je&&y!=null&&(l===u||W==="Completed"&&!J)&&s(ys(u,y.userId))}),[Ae,W,je,J,u,y,l,s]);const ue=y?.userId,jt=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),Qe=n.useCallback((e=>{const m=e!=null&&(e===P||e===T);(a||m)&&s(he()),m&&s(X({scheduleId:e}))}),[s,a,T,P]);zs({events:jt,onSubscribed:()=>Qe(P??T),onEvent:(e,m)=>{const _=(de=>{if(de==null||typeof de!="object")return null;const U=de;return fe(U.schedule_id)&&fe(U.run_id)?{scheduleId:U.schedule_id,runId:U.run_id,status:Ws.find((Ut=>Ut===U.status))??null,finishedAt:fe(U.finished_at)?U.finished_at:null}:null})(m);_!=null&&Qe(_.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const Dt=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&D)return S.jsxs(Zs,{children:[S.jsx(ce,{analytics:V,onLoad:Le}),ne.drawerElement,S.jsx(Ks,{children:S.jsx(ze,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:Ot,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const _t=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:V,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ys,{children:[S.jsx(ce,{analytics:V,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),D&&ne.drawerElement,S.jsx(Xs,{answerExportEndPoint:r,...At,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:De,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Dt,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:D?ne.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:a,routineCanCreate:O,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:Z,routines:o.routines,onRoutineCreate:Ke,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:nt,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ze,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:w}),p&&D?S.jsx(Vs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!D?S.jsx(Yt,{open:p,onClose:()=>f(!1),children:S.jsx(Zt,{children:_t})}):null]})},ze=N($s)`
1
+ import{j as S}from"./liveblocks-CuUK5O_2.js";import{a as n}from"./sentry-D0lP5-8e.js";import{u as Qt,h as Lt,i as Bt,g as Mt,j as v,l as Ft}from"./core-BBlQ3ArL.js";import{ec as Vt,g as $t,o as Nt,ed as Gt,z as qt,a2 as Ht,ee as zt,ef as Wt,eg as Jt,aE as Be,eh as We,ei as Xt,aD as Je,a5 as ge,a9 as ce,d as V,ej as me,ek as Yt,el as Zt,ax as Kt,U as es,w as ts,em as ss,en as ns,aj as as,eo as os,ep as is,eq as rs,er as ls,q as ds,aw as Me,es as us}from"./index-ClwW47Zs.js";import{fH as F,gw as R,UZ as cs,a3l as ms,a3m as Ss,jX as hs,a3n as ps,jU as fs,a3o as Se,jA as X,k1 as Y,jG as Ie,jn as he,jl as gs,k3 as Is,jP as Xe,V5 as Fe,gy as $,gN as Cs,V4 as ks,US as Ve,fI as bs,je as vs,a3p as Es,gb as Ps,jw as ws,js as ys,fJ as pe,gi as xs,a3q as Rs,a3r as Ts,a3s as Os,gx as As,gr as $e,kf as Ne,gt as Ge,gz as js,a3t as qe,k4 as Ds,jp as _s,jJ as Us,j$ as He,jM as Qs,gA as Ls,gB as Bs,gC as Ms,gD as Fs}from"./zeni-epic-state-aUBx6G2Q.js";import{D as Vs,n as N,S as $s,v as Ns}from"./mui--aGBnNu2.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-usJW6KKQ.js";import{p as qs}from"./pathToGoBack-DOePc_e5.js";import{k as Hs}from"./routePaths-D0jOibXk.js";import{u as zs}from"./useTaskManagerPusherEvents-CHhZ2DRZ.js";import"./recharts-CkREU3LH.js";import"./analytics-D051O7ML.js";import"./plaid-7P9b69CP.js";import"./dnd-CU3yeazS.js";import"./stripe-cKAAJElX.js";import"./lottie-Du4lbH8J.js";import"./lexical-DVH-xgq1.js";import"./pdf-CrvsvvW3.js";import"./utils-Ctp9Zfhk.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="843481d6-ade4-4440-876a-61065c4cd721",t._sentryDebugIdIdentifier="sentry-dbid-843481d6-ade4-4440-876a-61065c4cd721")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ye="chat-response-generated";function Js(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Xs=Ft((function(t,r){const h=F(t),s=r.isSubmitting,u=h.uiState?.currentChatSessionId,l=u!=null?xs(t.aiCfoState,u):[],i=ns(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=Os(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${as}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Js(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:Y(t).detail,skillDetailError:Y(t).fetchState==="Error",skillDetailLoading:Y(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:u,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,O=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:A,currentQuestionAnswer:G,currentQuestionAnswerSummary:j}=Je(g,E);O!=="answer"?V.trackAICFOChatResponseGenerated(O,G?.question.questionText??"",c.text,E,us(j,A),c.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Ms({chatSessionId:c.metadata.chat_session_id,responseType:O,fetchState:{fetchState:"Completed",error:void 0}})),t(Fs({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:u}))}},onSubmit:(a,o,c,O,E)=>{a&&Me(t,a,o,i,g,u,O,c,void 0,E)},onFetchSkills:()=>{t(Xe())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Qs({macroId:a}))},onSaveSkill:(a,o)=>{t(He({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(He({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Us({macroId:a,version:o}))},onDeleteSkill:a=>{t(_s({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(Ds({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(qe())},onRunSkill:(a,o)=>{t($()),t($e()),Me(t,o,"user_input",void 0,g,u,void 0,void 0,void 0,a),t(qe())},updateCurrentInput:a=>{t(Ge(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??qs(1);l(o,{state:{...h.state,pathnameStackToGoBack:a.newStack}}),t(Ge(""))},togglePageView:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t($()),i!=null&&t($e());const a=ds(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(As({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Vt(),{setIsAiCfoOpen:h}=$t(),s=Qt(),u=Lt(),{session_id:l}=Bt(),i=Mt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>F(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),a=v((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),O=v((e=>Ss(e))),[E,A]=n.useState(void 0),[G,j]=n.useState(!1),[Ze,Ce]=n.useState(void 0),Ke=n.useCallback((()=>{Ce(void 0),A(void 0),j(!0)}),[]),et=n.useCallback((e=>{A(e),j(!0)}),[]),tt=n.useCallback((()=>{A(void 0),j(!1)}),[]),st=n.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),A(void 0),j(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),nt=n.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{s(P!=null?X({scheduleId:P}):Se())}),[s,P]);const M=ke?.macroId,at=v((e=>Y(e))),be=M!=null&&M!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&M!=null&&s(Ie({macroId:M}))}),[s,be,M]);const ot=v((e=>F(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Nt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(X({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(X({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=n.useCallback((e=>{Ce(e),A(void 0),j(!0)}),[]),lt=n.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),dt=n.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{a&&s(he())}),[s,a]);const Pe=v((e=>R(e).skills)),Z=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=n.useCallback((e=>{s(Ie({macroId:e}))}),[s]),K=n.useCallback((()=>{s(Xe()),s(Fe())}),[s]),ct=n.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();n.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>F(e))),y=qt.getSignedInUser();n.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ve()),void s(Fe())):(T==null&&s(Se()),s(Ve()),void s($()))),[s,T,g,l]);const ft=Ht(),D=Kt(ft),b=v((e=>bs(e))),d=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,Q=w!=null&&w!=="",ee=n.useCallback((e=>{Q&&u(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[Q,u,w]),te=n.useCallback((()=>{Q&&u(`/${w}/ai-cfo/routines`)}),[Q,u,w]),se=n.useCallback(((e,m)=>{const _=e.sessionId??C.sessionId;_!=null&&Q&&u(`/${w}/ai-cfo/${_}?routine=${encodeURIComponent(m)}`)}),[Q,u,C.sessionId,w]),gt=n.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:zt(k),skillName:k.isAdHoc===!0?void 0:Z.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:K,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[K,te,ee,se,ve,k,C.fetchState,C.runs,Z]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ne=Jt({currentTenant:b,currentChatSessionId:d,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:K}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),q=i.state,H=q?.aiCfoInitialQuestion,we=!!q?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],u(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,u]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&H!=null&&H!==""){const e=i.state;ae(H),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[H,we,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),u(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,u]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??q?.aiCfoRef,le=xe.get("emailRefId")??q?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||d!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,d,s,y]);const z=I.uiState.lastContextMessage;n.useEffect((()=>{z!=null&&z!==""&&d!=null&&(ae(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,d,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:Oe}=Xt(d),W=I.fetchState,J=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Ae=d!=null?I.fetchChatSessionHistoryByChatSessionId?.[d]?.fetchState??"Not-Started":"Not-Started",je=d==null||(I.uiState.chatHistoryNextPageToken[d]?.hasMore??!0),De=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Je(De,d),Tt=Rt.length===0;n.useEffect((()=>{x||D||u("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,D,u,i.state]);const Ot=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;u(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,u]),_e=n.useRef(void 0),Ue=n.useRef(void 0);n.useEffect((()=>{const e=l!==_e.current,m=d!==Ue.current;_e.current=l,Ue.current=d,l!==d&&(!e||l==null||Hs(l)?m&&d!=null&&u(`../ai-cfo/${d}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[d,l]);const At=n.useMemo((()=>({events:Oe.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,m,_)=>_.onEventReceived(e,m)})),[Oe]);n.useEffect((()=>{W!=="In-Progress"&&J&&s(ws())}),[W,J,s]),n.useEffect((()=>{d!=null&&Ae!=="In-Progress"&&je&&y!=null&&(l===d||W==="Completed"&&!J)&&s(ys(d,y.userId))}),[Ae,W,je,J,d,y,l,s]);const de=y?.userId,jt=n.useMemo((()=>{return de==null?[]:[(e=de,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[de]),Qe=n.useCallback((e=>{const m=e!=null&&(e===P||e===T);(a||m)&&s(he()),m&&s(X({scheduleId:e}))}),[s,a,T,P]);zs({events:jt,onSubscribed:()=>Qe(P??T),onEvent:(e,m)=>{const _=(ue=>{if(ue==null||typeof ue!="object")return null;const U=ue;return fe(U.schedule_id)&&fe(U.run_id)?{scheduleId:U.schedule_id,runId:U.run_id,status:Ws.find((Ut=>Ut===U.status))??null,finishedAt:fe(U.finished_at)?U.finished_at:null}:null})(m);_!=null&&Qe(_.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const Dt=d!=null&&I.responseStateByChatSessionId?.[d]?.answer?.fetchState==="In-Progress";if(!x&&D)return S.jsxs(Zs,{children:[S.jsx(ce,{analytics:V,onLoad:Le}),ne.drawerElement,S.jsx(Ks,{children:S.jsx(ze,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:Ot,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const _t=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:V,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ys,{children:[S.jsx(ce,{analytics:V,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),D&&ne.drawerElement,S.jsx(Xs,{answerExportEndPoint:r,...At,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:De,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:u,sessionFromUrl:l,location:i,isSubmitting:Dt,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:D?ne.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:a,routineCanCreate:O,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:Z,routines:o.routines,onRoutineCreate:Ke,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:nt,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ze,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:ut,onRoutineSave:st,onRoutineSetEnabled:dt,isCreateSkillEnabled:B,promoDismissalScope:w}),p&&D?S.jsx(Vs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!D?S.jsx(Yt,{open:p,onClose:()=>f(!1),children:S.jsx(Zt,{children:_t})}):null]})},ze=N($s)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-UAxYbctH.js";import{a as o,R as Ta}from"./sentry-CQfqw6mU.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-BQ6YlWys.js";import{fI as Re,UQ as xa,UR as Ze,gc as Aa,gy as X,US as ee,jP as ye,jn as Te,UT as _a,UU as Da,gS as Ma,qd as Va,UV as Fa,UW as $e,gp as Ra,UX as x,fH as Za,gw as Ga,UY as Ua,UZ as Ha,U_ as Pa,U$ as Be,V0 as ja,V1 as xe,V2 as Na,EM as La,gq as Oa,h5 as qa,cM as za,V3 as Ya,h8 as Qa,qQ as Wa,gb as Ja,jh as Ka,V4 as Xa,V5 as et,wV as at,gr as tt}from"./zeni-epic-state-j9Po26Lg.js";import{w as nt,g as ot,h as st,j as rt,p as it,N as m,k as lt,u as dt,a as ct,f as ut,m as mt,i as Ct,o as pt,n as ht,q as ft,z as gt,d as P,s as h,v as Ae,x as bt,y as St,A as _e,C as kt,D as De,E as Et,F as wt,H as te,I as ae,J as It,K as vt,M as yt,b as Tt,O as $t,Q as Bt,R as xt,S as At}from"./index-DZBfE5XI.js";import{u as _t,q as Dt,r as Mt,I as Vt,p as Me,t as Ft,D as Ve,s as ne}from"./mui-DYo6Z7Si.js";import{u as Rt}from"./InboxNotificationsProvider-Daf1RQwd.js";import{u as Zt}from"./useTaskManagerAccess-CP331xWN.js";import{u as Gt}from"./expenseAutomationHelper-Bn2j121J.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="13c05bdf-3146-4390-b877-9f7d47057b20",a._sentryDebugIdIdentifier="sentry-dbid-13c05bdf-3146-4390-b877-9f7d47057b20")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ut=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[j,_]=Ta.useState(!1),[k,Ge]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[Ue,He]=o.useState(!1),N=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(X()),n(ee()))}),[n,re]),o.useEffect((()=>{n(X()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Re(e))),L=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:je}=Zt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const K=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(K)}const G=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(G)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[O,Ne]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:V}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Qe=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Gt();o.useEffect((()=>{M&&I&&V&&!b&&q.fetchState==="Not-Started"&&n(Va(!0))}),[M,I,V,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const We=Qe||b,z=r((e=>e.tenantState)),Je=r((e=>z.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Za(e))),la=r((e=>Ga(e).skillsEnabled)),da=r((e=>Ua(e))),Ce=r((e=>Ha(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Pa),[y,Q]=o.useState(void 0),W=Y.uiState.currentChatSessionId,R=y!=null?Y.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(R),{inboxNotifications:J,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Rt(),Z=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&R==="Completed"?(n(Be({chatSessionId:y})),Q(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(R==="Error"&&(n(Be({chatSessionId:y})),Q(void 0)))}),[n,t.state,s,R,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&J!=null){const e=`dashboard_${i.companyId}`;Ne(J.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,J]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(ja("task_manager","dashboard"))}),[I,D,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:O},"comments")))}}),[O,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Ke===!1&&T.push("accounts_payable_aging"),Xe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),V===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Na(e,T).fetchState)),ke=r((e=>La(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Qa(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Wa({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Je:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:V,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Le,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=je?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{Pe(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&P.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return L?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return L?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(X()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",W??null,null),!L)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const U=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:U,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,G=At(B)&&B!=="command_center";if(B!=="command_center"&&!G||f[i.tenantId]==null||P.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),G&&f[i.tenantId]!=null){const U=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${U.month}-${U.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const K=vt(e.type);yt(e.type)?(W!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${K}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ka(e)),W===e&&Q(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Ge,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ja({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Ue?`1px solid ${N.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Vt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Pt,{})}),d.jsx(jt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ut,{className:c.root,children:[d.jsx(Ft,{}),We===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ve,{container:window.document.body,variant:"temporary",open:j,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ve,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Re(_))),j={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...j})},Pt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
1
+ import{j as d}from"./liveblocks-CuUK5O_2.js";import{a as o,R as Ta}from"./sentry-D0lP5-8e.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-BBlQ3ArL.js";import{fI as Re,UQ as xa,UR as Ze,gc as Aa,gy as X,US as ee,jP as ye,jn as Te,UT as _a,UU as Da,gS as Ma,qd as Va,UV as Fa,UW as $e,gp as Ra,UX as x,fH as Za,gw as Ga,UY as Ua,UZ as Ha,U_ as Pa,U$ as Be,V0 as ja,V1 as xe,V2 as Na,EM as La,gq as Oa,h5 as qa,cM as za,V3 as Ya,h8 as Qa,qQ as Wa,gb as Ja,jh as Ka,V4 as Xa,V5 as et,wV as at,gr as tt}from"./zeni-epic-state-aUBx6G2Q.js";import{w as nt,f as ot,g as st,h as rt,p as it,N as m,j as lt,u as dt,a as ct,x as ut,k as mt,i as Ct,n as pt,o as ht,m as ft,z as gt,d as P,q as h,s as Ae,v as bt,y as St,A as _e,C as kt,D as De,E as Et,F as wt,H as te,I as ae,J as It,K as vt,M as yt,b as Tt,O as $t,Q as Bt,R as xt,S as At}from"./index-ClwW47Zs.js";import{u as _t,q as Dt,r as Mt,I as Vt,p as Me,t as Ft,D as Ve,s as ne}from"./mui--aGBnNu2.js";import{u as Rt}from"./InboxNotificationsProvider-DiTDJFwP.js";import{u as Zt}from"./useTaskManagerAccess-DrmpkeUw.js";import{u as Gt}from"./expenseAutomationHelper-SA0jUIyg.js";import"./recharts-CkREU3LH.js";import"./analytics-D051O7ML.js";import"./plaid-7P9b69CP.js";import"./dnd-CU3yeazS.js";import"./stripe-cKAAJElX.js";import"./lottie-Du4lbH8J.js";import"./lexical-DVH-xgq1.js";import"./pdf-CrvsvvW3.js";import"./utils-Ctp9Zfhk.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="9c35c8b1-82cb-43b8-8b0b-9f842999cab0",a._sentryDebugIdIdentifier="sentry-dbid-9c35c8b1-82cb-43b8-8b0b-9f842999cab0")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ut=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[j,_]=Ta.useState(!1),[k,Ge]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[Ue,He]=o.useState(!1),N=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(X()),n(ee()))}),[n,re]),o.useEffect((()=>{n(X()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Re(e))),L=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:je}=Zt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const K=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(K)}const G=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(G)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[O,Ne]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:V}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Qe=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Gt();o.useEffect((()=>{M&&I&&V&&!b&&q.fetchState==="Not-Started"&&n(Va(!0))}),[M,I,V,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const We=Qe||b,z=r((e=>e.tenantState)),Je=r((e=>z.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Za(e))),la=r((e=>Ga(e).skillsEnabled)),da=r((e=>Ua(e))),Ce=r((e=>Ha(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Pa),[y,Q]=o.useState(void 0),W=Y.uiState.currentChatSessionId,R=y!=null?Y.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(R),{inboxNotifications:J,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Rt(),Z=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&R==="Completed"?(n(Be({chatSessionId:y})),Q(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(R==="Error"&&(n(Be({chatSessionId:y})),Q(void 0)))}),[n,t.state,s,R,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&J!=null){const e=`dashboard_${i.companyId}`;Ne(J.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,J]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(ja("task_manager","dashboard"))}),[I,D,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:O},"comments")))}}),[O,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Ke===!1&&T.push("accounts_payable_aging"),Xe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),V===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Na(e,T).fetchState)),ke=r((e=>La(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Qa(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Wa({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Je:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:V,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Le,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=je?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{Pe(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&P.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return L?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return L?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(X()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",W??null,null),!L)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const U=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:U,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,G=At(B)&&B!=="command_center";if(B!=="command_center"&&!G||f[i.tenantId]==null||P.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),G&&f[i.tenantId]!=null){const U=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${U.month}-${U.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const K=vt(e.type);yt(e.type)?(W!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${K}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ka(e)),W===e&&Q(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Ge,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ja({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Ue?`1px solid ${N.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Vt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Pt,{})}),d.jsx(jt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ut,{className:c.root,children:[d.jsx(Ft,{}),We===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ve,{container:window.document.body,variant:"temporary",open:j,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ve,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Re(_))),j={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...j})},Pt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
2
2
  height: 20px;
3
3
  width: 20px;
4
4
  color: ${a=>a.theme.colors.primary};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-UAxYbctH.js";import{a as d}from"./sentry-CQfqw6mU.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as q,n as te,o as x}from"./core-BQ6YlWys.js";import{fI as P,Xi as w,W$ as R,Il as E,If as K,Ij as A,I8 as X,X1 as z,Ic as ae,In as oe,Ib as G,Iq as H,Im as C}from"./zeni-epic-state-j9Po26Lg.js";import{z as k,w as J,bh as pe,C as O,b0 as M,bi as le,a8 as Q,bj as se,bk as ne}from"./index-DZBfE5XI.js";import{u as Y}from"./mui-DYo6Z7Si.js";import{u as Z}from"./useEnsureVendorListLoaded-BbjOUcqm.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-y6N7Iuxh.js";import ie from"./NotFoundScreen-CY-XFa3a.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="a82beaef-8e31-44b6-825b-f23337b0fff1",e._sentryDebugIdIdentifier="sentry-dbid-a82beaef-8e31-44b6-825b-f23337b0fff1")}catch{}})();const _="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),m=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{m?.updateStatus.fetchState==="Completed"&&o(E())}),[m]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(K(!0,!0,!1)))}),[a,p,e,o]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const S={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${_}`]:[],eventCallback:(r,h,I)=>{r.endsWith(_)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...S})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=M(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),m=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),S=y((i=>P(i)));Z();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(K(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||m!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,m,e,o]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:S.companyId!=null?[`private-encrypted-${S.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return S?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:S,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=m=>{const S=[];return m.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);S.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const m={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=k.getSignedInUser(),n=Y(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(G(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const Se=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,m=p.vendorCriteria,S=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=m?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:m?.operator.selectedOption??"is",vendorIds:h});const I=S?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=M(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(me,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=k.getSignedInUser(),n=Y(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Z(),d.useEffect((()=>{p||(f(!0),l(G(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(Se,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function Ce(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{Ce as B};
1
+ import{j as u}from"./liveblocks-CuUK5O_2.js";import{a as d}from"./sentry-D0lP5-8e.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as q,n as te,o as x}from"./core-BBlQ3ArL.js";import{fI as P,Xi as w,W$ as R,Il as E,If as K,Ij as A,I8 as X,X1 as z,Ic as ae,In as oe,Ib as G,Iq as H,Im as C}from"./zeni-epic-state-aUBx6G2Q.js";import{z as k,w as J,bh as pe,C as O,b0 as M,bi as le,a8 as Q,bj as se,bk as ne}from"./index-ClwW47Zs.js";import{u as Y}from"./mui--aGBnNu2.js";import{u as Z}from"./useEnsureVendorListLoaded-COBYTL2U.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-kqCAU4nf.js";import ie from"./NotFoundScreen-CTik05r2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="a82beaef-8e31-44b6-825b-f23337b0fff1",e._sentryDebugIdIdentifier="sentry-dbid-a82beaef-8e31-44b6-825b-f23337b0fff1")}catch{}})();const _="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),m=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{m?.updateStatus.fetchState==="Completed"&&o(E())}),[m]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(K(!0,!0,!1)))}),[a,p,e,o]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const S={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${_}`]:[],eventCallback:(r,h,I)=>{r.endsWith(_)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...S})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=M(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),m=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),S=y((i=>P(i)));Z();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(K(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||m!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,m,e,o]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:S.companyId!=null?[`private-encrypted-${S.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return S?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:S,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=m=>{const S=[];return m.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);S.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const m={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=k.getSignedInUser(),n=Y(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(G(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const Se=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,m=p.vendorCriteria,S=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=m?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:m?.operator.selectedOption??"is",vendorIds:h});const I=S?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=M(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(me,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=k.getSignedInUser(),n=Y(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Z(),d.useEffect((()=>{p||(f(!0),l(G(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(Se,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function Ce(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{Ce as B};
@@ -1,4 +1,4 @@
1
- import{j as t}from"./liveblocks-UAxYbctH.js";import{h as q,u as le,g as K,i as ee,j as v,N as Q,l as Y,q as tt,n as nt,o as y}from"./core-BQ6YlWys.js";import{fI as X,WB as _e,bp as Ia,T8 as it,bn as va,bJ as de,WC as ka,HB as wa,I_ as Re,Ic as ot,bm as Ce,WD as lt,WE as st,c7 as rt,WF as ct,ma as xa,WG as Ba,WH as Ca,Js as Ue,HU as xe,WI as dt,Hp as ea,WJ as ut,Nk as pt,Ht as mt,Hz as Aa,WK as Se,WL as Ge,I$ as Me,HR as Da,WM as bt,WN as ht,J2 as Ne,WO as gt,J8 as St,WP as Ea,ID as aa,II as yt,WQ as ft,WR as ce,WS as Ta,WT as ja,WU as Pa,gZ as It,HZ as Ve,cx as Fa,WV as vt,gk as kt,WW as wt,WX as xt,eq as Ra,ep as Va,WY as Oe,WZ as Bt,W_ as Ct,VH as We,W$ as At,VJ as ie,VI as ze,X0 as Dt,X1 as Et,X2 as Tt,IK as ta,IH as jt,X3 as Pt,X4 as Ft,X5 as Rt,It as Vt,X6 as $t,X7 as Lt,cl as $a,eb as La,ml as _t,bO as Ut,bv as _a,bP as Ua,GF as Gt,X8 as Mt,N7 as Nt,Nd as Ot,CJ as Wt,J0 as zt,Jz as Ht,my as ge,X9 as Zt,Xa as Ga,n0 as Xt,ms as Ma,mN as Na,mM as na,bE as pe,bN as Jt,Xb as qt,Xc as ye,kY as Kt,Xd as ia,Xe as Yt,l0 as Qt,ll as en,JN as an,Xf as tn,mV as nn,JD as on,Xg as oa,JH as ln,JM as sn,JK as rn,JB as cn,Xh as Oa,HK as dn,Xi as un,Xj as pn,gJ as mn,gI as bn,gH as hn,mB as gn,mT as la,n2 as Sn,vc as yn,mK as fn,JF as In,l6 as vn,n7 as kn,Xk as wn,k_ as xn,v3 as Bn,Xl as Cn,Iz as An,bK as Dn,br as En,ha as Tn,ee as jn,ed as Pn,cw as Fn,cD as Rn}from"./zeni-epic-state-j9Po26Lg.js";import{z as V,V as fe,al as He,p as oe,N as f,au as Ze,a8 as se,R as A,a9 as Ae,d as E,aH as Vn,a5 as Z,aj as Xe,s as D,a2 as Ie,aI as sa,aJ as ra,aK as $n,aL as Ln,ag as _n,aM as Un,ac as Wa,G as De,ah as Je,aN as Gn,af as za,aO as Mn,aC as Nn,U as Ha,w as On,aP as Wn,aQ as zn,aR as Hn,aS as Zn,aT as Xn,aU as Jn,aV as qn,aW as Kn,aX as Yn,j as Qn,aY as ei,aZ as ai,a_ as ti,az as ni,a$ as ii,i as oi}from"./index-DZBfE5XI.js";import{u as ue,n as _,S as li}from"./mui-DYo6Z7Si.js";import{A as ca}from"./AddressScreen-CxRV-hrD.js";import{g as ne,a as Ee,i as Za,V as qe,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-u2HKaCWA.js";import{a as g}from"./sentry-CQfqw6mU.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-DV6iNvbF.js";import{u as Xa}from"./useInitialThreadRequest-BpNcTGLt.js";import{u as di}from"./BusinessVerificationPageScreen-DaAqJAwC.js";import Be from"./NotFoundScreen-CY-XFa3a.js";import{D as ui}from"./DrawerScreen-BmZb1i83.js";import{M as Ja}from"./MobileAppDrawer-DTqKEh3f.js";import{F as qa}from"./FeaturePreviewScreen-DjPPDYKv.js";import{S as Te}from"./SetupPagesScreen-BY0N32JD.js";import{B as pi}from"./BillPayApprovalRoutes-WPV-16X0.js";import{F as mi}from"./FallBackRoute--cXyuVDR.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";import"./routePaths-CaZTJQOM.js";import"./InboxNotificationsProvider-Daf1RQwd.js";import"./useTaskManagerAccess-CP331xWN.js";import"./analyticsHelper-BOs1nNPv.js";import"./useEnsureVendorListLoaded-BbjOUcqm.js";import"./ReimbursementApprovalRuleDetailScreen-y6N7Iuxh.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="8a0a4b05-f2f6-47c3-916e-6d86cb569dfc",e._sentryDebugIdIdentifier="sentry-dbid-8a0a4b05-f2f6-47c3-916e-6d86cb569dfc")}catch{}})();const bi=Y((function(e,a){const l=_e(e,a.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(a.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=lt(l.billActivities,st(a.currentTenant),n);i=S,d=h}const p=rt(a.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ct(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xa(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Xe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:a.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:a.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,a){const{billId:l,currentTenant:n,location:c,navigate:r}=a,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(Aa(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(mt(l,s))},onSaveRealTimeApprovals:o=>{e(pt(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ut({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(ea(l,o.type,"")):e(ea(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(a.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(dt({billId:a.billId}))},onRefundPaymentClick:()=>{e(xe(a.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ca({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Ba({billId:l}))}}}))(Vn);function hi(){const e=q(),a=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>X(U))),s=v((U=>_e(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Xa(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&Ia(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:W}=$(Ze.zeniAssistConfig),z=it(o),w=va(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=W.user_ids!=null&&r?.userId!=null&&W.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,M,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&a(ka(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),a(wa(n??"",O,L,!1)))}),[b,s,n,a]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),a(Re(!1,O,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&a(ot()))}),[I,s,n,a,O,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?t.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?t.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[t.jsx(Ae,{analytics:E,onLoad:U=>(N=>{n!=null&&N.trackBillPayBillDetails(n,s.isRecurring)})(U)}),t.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,da=De.getLocalizedStrings().common,gi={containerWidth:new Wa(100,58)},ua=Y((function(e,a){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=a.showActionButtons,u=r&&a.file==null;return{uploadInvoiceEndPoint:`${za.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:a.billId,file:a.file,showAutofill:a.showAutofill,analytics:E,entityId:a.billId,showTitlebarIcon:r,showTitlebar:r&&a?.file!=null,uploadStatus:a.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...a.showAutofill?{}:{backgroundColor:a.backgroundColor,paddingBottom:"128px"}}}}),(function(e,a){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(a.file!=null||a.billId!=null||a.isInitialEdit?(a.setPayload(n),a.setShowConfirmationPopup(!0)):e(Ne(n,a.isVendorRecommendationEnabled,a.billId)))},updateInvoiceUploadFetchState:n=>{e(St({fetchState:{fetchState:n,error:void 0},billId:a.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(gt({billId:a.billId})),E?.trackInvoiceActionClick(a.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const a=le(),l=q(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(Ze.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>X(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[O,G]=g.useState(!1),[W,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let M=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(M=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&a(Me(!0))}),[n,a]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),a(wa(n,S,I,!1)),a(Da(n)),k||($(!0),a(Re(!1,S,I,b,n)))),u&&!k&&($(!0),a(Re(!1,S,I,b,n)))}),[B,k,u,n,a,S,I,b]);const N={onOkClick:()=>{if(G(!1),!W)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),a(ht({replaceBillData:!0,billId:n})),a(Ne(W,m,n))},onCancelClick:()=>{if(G(!1),!W)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),a(bt({file:W,billId:n}))}},ae=g.useCallback((()=>{const P=Z(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);a(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,a,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||J.fetchState==="Error")return t.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?t.jsx(sa,{fallback:ae,children:t.jsxs(je,{windowSize:o,children:[t.jsx(ma,{}),t.jsx(Pe,{}),t.jsx(ua,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),t.jsx(Fe,{windowSize:o,children:t.jsx(ra,{isNewBill:!0})})]})}):t.jsxs(je,{windowSize:o,children:[o==="small"||H?null:t.jsx(pa,{children:t.jsx(Ka,{onClick:ae,"data-testid":"nav-bar-back-click"})}),o!=="small"?t.jsx(Pe,{}):null,t.jsx($n,{}),t.jsx(Fe,{windowSize:o,children:t.jsx(ra,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return t.jsx(sa,{fallback:ae,children:t.jsxs(je,{windowSize:o,children:[H&&o!=="small"?t.jsx(ma,{}):null,O?t.jsx(Ln,{titleComponent:t.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:t.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:da.yes,secondaryButtonText:da.no,action:N,isEditPopup:!0}):null,o==="small"||H?null:t.jsx(pa,{children:t.jsx(Si,{})}),o!=="small"?t.jsx(Pe,{}):null,t.jsx(ua,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),t.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return t.jsx(Ka,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,a,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=a.transactionDetails?.recurringBillInstance,c=a.recurringBillConfigDetail?.totalPaymentCycles),a?.isRecurring===!0?t.jsxs(Ii,{children:[t.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
1
+ import{j as t}from"./liveblocks-CuUK5O_2.js";import{h as q,u as le,g as K,i as ee,j as v,N as Q,l as Y,q as tt,n as nt,o as y}from"./core-BBlQ3ArL.js";import{fI as X,WB as _e,bp as Ia,T8 as it,bn as va,bJ as de,WC as ka,HB as wa,I_ as Re,Ic as ot,bm as Ce,WD as lt,WE as st,c7 as rt,WF as ct,ma as xa,WG as Ba,WH as Ca,Js as Ue,HU as xe,WI as dt,Hp as ea,WJ as ut,Nk as pt,Ht as mt,Hz as Aa,WK as Se,WL as Ge,I$ as Me,HR as Da,WM as bt,WN as ht,J2 as Ne,WO as gt,J8 as St,WP as Ea,ID as aa,II as yt,WQ as ft,WR as ce,WS as Ta,WT as ja,WU as Pa,gZ as It,HZ as Ve,cx as Fa,WV as vt,gk as kt,WW as wt,WX as xt,eq as Ra,ep as Va,WY as Oe,WZ as Bt,W_ as Ct,VH as We,W$ as At,VJ as ie,VI as ze,X0 as Dt,X1 as Et,X2 as Tt,IK as ta,IH as jt,X3 as Pt,X4 as Ft,X5 as Rt,It as Vt,X6 as $t,X7 as Lt,cl as $a,eb as La,ml as _t,bO as Ut,bv as _a,bP as Ua,GF as Gt,X8 as Mt,N7 as Nt,Nd as Ot,CJ as Wt,J0 as zt,Jz as Ht,my as ge,X9 as Zt,Xa as Ga,n0 as Xt,ms as Ma,mN as Na,mM as na,bE as pe,bN as Jt,Xb as qt,Xc as ye,kY as Kt,Xd as ia,Xe as Yt,l0 as Qt,ll as en,JN as an,Xf as tn,mV as nn,JD as on,Xg as oa,JH as ln,JM as sn,JK as rn,JB as cn,Xh as Oa,HK as dn,Xi as un,Xj as pn,gJ as mn,gI as bn,gH as hn,mB as gn,mT as la,n2 as Sn,vc as yn,mK as fn,JF as In,l6 as vn,n7 as kn,Xk as wn,k_ as xn,v3 as Bn,Xl as Cn,Iz as An,bK as Dn,br as En,ha as Tn,ee as jn,ed as Pn,cw as Fn,cD as Rn}from"./zeni-epic-state-aUBx6G2Q.js";import{z as V,V as fe,al as He,p as oe,N as f,au as Ze,a8 as se,R as A,a9 as Ae,d as E,aH as Vn,a5 as Z,aj as Xe,q as D,a2 as Ie,aI as sa,aJ as ra,aK as $n,aL as Ln,ag as _n,aM as Un,ac as Wa,G as De,ah as Je,aN as Gn,af as za,aO as Mn,aC as Nn,U as Ha,w as On,aP as Wn,aQ as zn,aR as Hn,aS as Zn,aT as Xn,aU as Jn,aV as qn,aW as Kn,aX as Yn,h as Qn,aY as ei,aZ as ai,a_ as ti,az as ni,a$ as ii,i as oi}from"./index-ClwW47Zs.js";import{u as ue,n as _,S as li}from"./mui--aGBnNu2.js";import{A as ca}from"./AddressScreen-Czlolp2X.js";import{g as ne,a as Ee,i as Za,V as qe,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-6W-Er5_q.js";import{a as g}from"./sentry-D0lP5-8e.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-CWWQxV2L.js";import{u as Xa}from"./useInitialThreadRequest-DmfmyzKI.js";import{u as di}from"./BusinessVerificationPageScreen-je1np7-9.js";import Be from"./NotFoundScreen-CTik05r2.js";import{D as ui}from"./DrawerScreen-DUhkZI2Z.js";import{M as Ja}from"./MobileAppDrawer-Bql3K6nh.js";import{F as qa}from"./FeaturePreviewScreen-Dcu53_tf.js";import{S as Te}from"./SetupPagesScreen-C5PRNruc.js";import{B as pi}from"./BillPayApprovalRoutes-B4dh4WxY.js";import{F as mi}from"./FallBackRoute-orqRsHMl.js";import"./recharts-CkREU3LH.js";import"./analytics-D051O7ML.js";import"./plaid-7P9b69CP.js";import"./dnd-CU3yeazS.js";import"./stripe-cKAAJElX.js";import"./lottie-Du4lbH8J.js";import"./lexical-DVH-xgq1.js";import"./pdf-CrvsvvW3.js";import"./utils-Ctp9Zfhk.js";import"./routePaths-D0jOibXk.js";import"./InboxNotificationsProvider-DiTDJFwP.js";import"./useTaskManagerAccess-DrmpkeUw.js";import"./analyticsHelper-DkNc3mKz.js";import"./useEnsureVendorListLoaded-COBYTL2U.js";import"./ReimbursementApprovalRuleDetailScreen-kqCAU4nf.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="c71977b5-e079-4a33-acf0-0da9e15082ec",e._sentryDebugIdIdentifier="sentry-dbid-c71977b5-e079-4a33-acf0-0da9e15082ec")}catch{}})();const bi=Y((function(e,a){const l=_e(e,a.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(a.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=lt(l.billActivities,st(a.currentTenant),n);i=S,d=h}const p=rt(a.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ct(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xa(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Xe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:a.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:a.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,a){const{billId:l,currentTenant:n,location:c,navigate:r}=a,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(Aa(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(mt(l,s))},onSaveRealTimeApprovals:o=>{e(pt(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ut({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(ea(l,o.type,"")):e(ea(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(a.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(dt({billId:a.billId}))},onRefundPaymentClick:()=>{e(xe(a.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ca({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Ba({billId:l}))}}}))(Vn);function hi(){const e=q(),a=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>X(U))),s=v((U=>_e(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Xa(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&Ia(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:W}=$(Ze.zeniAssistConfig),z=it(o),w=va(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=W.user_ids!=null&&r?.userId!=null&&W.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,M,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&a(ka(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),a(wa(n??"",O,L,!1)))}),[b,s,n,a]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),a(Re(!1,O,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&a(ot()))}),[I,s,n,a,O,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?t.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?t.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[t.jsx(Ae,{analytics:E,onLoad:U=>(N=>{n!=null&&N.trackBillPayBillDetails(n,s.isRecurring)})(U)}),t.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,da=De.getLocalizedStrings().common,gi={containerWidth:new Wa(100,58)},ua=Y((function(e,a){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=a.showActionButtons,u=r&&a.file==null;return{uploadInvoiceEndPoint:`${za.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:a.billId,file:a.file,showAutofill:a.showAutofill,analytics:E,entityId:a.billId,showTitlebarIcon:r,showTitlebar:r&&a?.file!=null,uploadStatus:a.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...a.showAutofill?{}:{backgroundColor:a.backgroundColor,paddingBottom:"128px"}}}}),(function(e,a){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(a.file!=null||a.billId!=null||a.isInitialEdit?(a.setPayload(n),a.setShowConfirmationPopup(!0)):e(Ne(n,a.isVendorRecommendationEnabled,a.billId)))},updateInvoiceUploadFetchState:n=>{e(St({fetchState:{fetchState:n,error:void 0},billId:a.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(gt({billId:a.billId})),E?.trackInvoiceActionClick(a.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const a=le(),l=q(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(Ze.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>X(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[O,G]=g.useState(!1),[W,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let M=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(M=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&a(Me(!0))}),[n,a]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),a(wa(n,S,I,!1)),a(Da(n)),k||($(!0),a(Re(!1,S,I,b,n)))),u&&!k&&($(!0),a(Re(!1,S,I,b,n)))}),[B,k,u,n,a,S,I,b]);const N={onOkClick:()=>{if(G(!1),!W)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),a(ht({replaceBillData:!0,billId:n})),a(Ne(W,m,n))},onCancelClick:()=>{if(G(!1),!W)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),a(bt({file:W,billId:n}))}},ae=g.useCallback((()=>{const P=Z(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);a(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,a,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||J.fetchState==="Error")return t.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?t.jsx(sa,{fallback:ae,children:t.jsxs(je,{windowSize:o,children:[t.jsx(ma,{}),t.jsx(Pe,{}),t.jsx(ua,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),t.jsx(Fe,{windowSize:o,children:t.jsx(ra,{isNewBill:!0})})]})}):t.jsxs(je,{windowSize:o,children:[o==="small"||H?null:t.jsx(pa,{children:t.jsx(Ka,{onClick:ae,"data-testid":"nav-bar-back-click"})}),o!=="small"?t.jsx(Pe,{}):null,t.jsx($n,{}),t.jsx(Fe,{windowSize:o,children:t.jsx(ra,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return t.jsx(sa,{fallback:ae,children:t.jsxs(je,{windowSize:o,children:[H&&o!=="small"?t.jsx(ma,{}):null,O?t.jsx(Ln,{titleComponent:t.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:t.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:da.yes,secondaryButtonText:da.no,action:N,isEditPopup:!0}):null,o==="small"||H?null:t.jsx(pa,{children:t.jsx(Si,{})}),o!=="small"?t.jsx(Pe,{}):null,t.jsx(ua,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),t.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return t.jsx(Ka,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,a,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=a.transactionDetails?.recurringBillInstance,c=a.recurringBillConfigDetail?.totalPaymentCycles),a?.isRecurring===!0?t.jsxs(Ii,{children:[t.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),t.jsx(ki,{})]}):void 0}function fi(e,a){const l=a.billActivities?.[0],n=a.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(a.billStage==="draft"||n)}const pa=_.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{a as O}from"./sentry-CQfqw6mU.js";import{u as q,j as h,h as se,g as oe,i as ie,N as ce,l as re}from"./core-BQ6YlWys.js";import{fI as z,If as ue,It as de,LF as le,Ov as pe,P9 as me,P_ as fe,a0T as ye,C8 as Se,Tc as ge,a14 as Ie,a15 as he,a16 as be,a17 as Te,a18 as Ce,a19 as De,a1a as Oe,YE as ke,a1b as Ve,MR as Ae,MJ as we,a1c as ve,MN as Ne,mS as Fe,gJ as _e,gI as Ee,gH as xe,vc as Re,v3 as ze,v0 as Pe,mK as Be,Ch as Me,Cf as P,bE as B,Ct as M,cv as Ue}from"./zeni-epic-state-j9Po26Lg.js";import{b0 as Le,V as je,p as Ge,au as Ke,z as R,a9 as qe,d as U,C as E,U as x,d0 as Je,af as Ze,s as L,bg as j}from"./index-DZBfE5XI.js";import{n as $e}from"./mui-DYo6Z7Si.js";import{j as A}from"./liveblocks-UAxYbctH.js";import{d as G}from"./routePaths-CaZTJQOM.js";import{M as He}from"./MobileAppDrawer-DTqKEh3f.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},c=new e.Error().stack;c&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[c]="e28fec6c-6166-4a5b-a91b-e9731a15f09d",e._sentryDebugIdIdentifier="sentry-dbid-e28fec6c-6166-4a5b-a91b-e9731a15f09d")}catch{}})();function it(){const e=q(),c=h((u=>z(u))),a=c?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:l}=Le(a),p=h((u=>u.billPaySetupApproverViewState.fetchState));O.useEffect((()=>{a==null||l||p==="Not-Started"&&e(ue(!0,!0,s))}),[a,l,s,p,e])}function K(e,c,a,s=!1){switch(c){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(pe(a,!0,s));break;case"charge_cards":e(le(a,!0,s));break;default:e(de(a,!0,s))}}const We=$e.div`
1
+ import{a as O}from"./sentry-D0lP5-8e.js";import{u as q,j as h,h as se,g as oe,i as ie,N as re,l as ce}from"./core-BBlQ3ArL.js";import{fI as z,If as ue,It as de,LF as le,Ov as pe,P9 as me,P_ as fe,a0T as ye,C8 as Se,Tc as ge,a14 as Ie,a15 as he,a16 as Te,a17 as be,a18 as Ce,a19 as De,a1a as Oe,YE as ke,a1b as Ve,MR as Ae,MJ as we,a1c as ve,MN as Ne,mS as Fe,gJ as _e,gI as Ee,gH as xe,vc as Re,v3 as ze,v0 as Pe,mK as Be,Ch as Me,Cf as P,bE as B,Ct as M,cv as Ue}from"./zeni-epic-state-aUBx6G2Q.js";import{b0 as Le,V as je,p as Ge,au as Ke,z as R,a9 as qe,d as U,C as E,U as x,d0 as Je,af as Ze,q as L,bg as j}from"./index-ClwW47Zs.js";import{n as $e}from"./mui--aGBnNu2.js";import{j as A}from"./liveblocks-CuUK5O_2.js";import{d as G}from"./routePaths-D0jOibXk.js";import{M as He}from"./MobileAppDrawer-Bql3K6nh.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="8fea104a-8eec-4d12-98d5-e26da4260560",e._sentryDebugIdIdentifier="sentry-dbid-8fea104a-8eec-4d12-98d5-e26da4260560")}catch{}})();function it(){const e=q(),r=h((u=>z(u))),a=r?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:l}=Le(a),p=h((u=>u.billPaySetupApproverViewState.fetchState));O.useEffect((()=>{a==null||l||p==="Not-Started"&&e(ue(!0,!0,s))}),[a,l,s,p,e])}function K(e,r,a,s=!1){switch(r){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(pe(a,!0,s));break;case"charge_cards":e(le(a,!0,s));break;default:e(de(a,!0,s))}}const We=$e.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{a as O}from"./sentry-CQfqw6mU.js";import{u as q,j as h,h as se,g as oe,i
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,Ye=re((function(e,c){const{businessVerificationDetails:a}=c,s=z(e),l=R.getSignedInUser(),p=s.tenantId,u={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:p??""},b=Oe(c.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=ke(e.companyConfigState),o=Ve(e.userRoleConfigState);return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${Ze.fileMicroServiceBaseUrl}`,authParams:u,isDisabled:b,allIndustries:t.companyIndustries??[],companyTitles:o.companyTitles}}),(function(e,c){const{companyId:a,productType:s,currentTenant:l,navigate:p,location:u}=c,{tenantEmailDomain:b}=l;return{onCompanyDetailsChanged:t=>{const{companyDescription:o,companyIndustry:m,companyIndustryType:k,companyLegalName:V,companyTaxId:y,companyWebsite:f,companyPhone:S,primaryContactEmail:d,primaryContactName:i,primaryContactUserId:T,primaryContactSyncToken:C,syncToken:r,fileIds:D,incDate:n,typeOfIncorporation:g,stateOfIncorporation:w,sourceOfFunds:v,companySubIndustry:N,countriesOfOperations:I,companySourceOfFunds:J,companySourceOfFundsDescription:Z,transactionVolume:$,transactionVolumeDescription:H,purposeOfAccount:W,purposeOfAccountDescription:Y,regulatedStatus:Q,regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te}=t,F=k?.selectedOption,ae={companyId:a,companyDescription:o,companyIndustry:m.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:V,taxIdOrEIN:y,website:f!=""&&f!=null?Ue(f):void 0,phone:S,syncToken:r,fileIds:D,incDate:n!=null?B(n?.toString()):n,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:v?.selectedOption??"",companySubIndustry:N?.selectedOption??"",countriesOfOperations:I?.selectedOptions.map((_=>_.length===2?_:j(_)))??[],companySourceOfFunds:J?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:$?.selectedOption??"",transactionVolumeDescription:H,purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:Y,regulatedStatus:Q??"",regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te?.selectedOptions??[]},ne={userId:T,firstName:i.firstName,lastName:i.lastName,email:d,syncToken:C};e(M({companyDetails:ae,primaryContactDetails:ne}))},onCompanyOfficerUpdated:t=>{const o=t.map((m=>{const{officerType:k,userId:V,name:y,email:f,nationalityCountryCode:S,ssn:d,dob:i,phone:T,syncToken:C,selectDocument:r,role:D,ownership:n,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:v,fileIds:N}=m;let I;return r.selectDocumentType==="driverLicense"?I="driving_license":r.selectDocumentType==="passport"?I="passport":r.selectDocumentType==="stateId"?I="id_document":r.selectDocumentType==="ssnCard"&&(I="social_security_card"),{officerType:k,userId:V,firstName:y.firstName,lastName:y.lastName,email:f,ssn:d,nationalityCountryCode:S?.selectedOption!=null?j(S.selectedOption):void 0,phone:T,birthday:i!=null?B(i?.toString()):i,syncToken:C,titleAtCompany:D.selectedOption,ownershipInCompany:n,documentTypeSelectedForVerification:I,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:v,fileIds:N,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(M({officers:o}))},onSaveDetailsClick:t=>{e(P(a,t,s))},onSendForVerificationClick:t=>{e(P(a,t,s,!0))},onAddressClick:t=>{const o=G(b,t),m=L(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:t=>{const o=G(b,t),m=L(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{e(Me({companyId:a})),p("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(Pe(t))},onDeleteFileList:t=>{e(ze(t))},onEditFileName:(t,o)=>{e(Re(t,o.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Ee(t,"SpendManagementSetup"))},onVerifyOtp:(t,o)=>{e(_e(t,o,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,o)=>{e(Fe({addressType:t,addressToCreate:o}))},onIdentityDocumentUploadedForAutofill:t=>{if(a==null)return;const o=ve(t.documentType);o!=null&&e(Ne({target:"setup",companyId:a,officerType:t.officerType,fileId:t.fileId,documentType:o}))},onCompanyDocumentUploadedForAutofill:t=>{a!=null&&e(we({target:"setup",companyId:a,fileId:t.fileId,documentType:t.documentType}))},onResetKycKybClick:()=>{e(Ae())}}}))(Je),ct=({productType:e})=>{const c=se(),a=oe(),s=q(),[l,p]=O.useState(!1),[u,b]=O.useState(!1),{tenantEmailDomain:t}=ie(),o=je(),{useDynamicConfig:m}=Ge(),{configValue:k}=m(Ke.zeniAccountsConfig),V=ye(k),y=h((n=>{switch(e){case"zeni_accounts":return n.zeniAccountSetupViewState.fetchState;case"reimbursement":return n.remiSetupViewState.fetchState;case"charge_cards":return n.chargeCardSetupViewState.fetchState;case"zeni_treasury":return n.treasurySetupViewState.fetchState;default:return n.billPaySetupViewState.fetchState}})),f=h((n=>n.companyConfigState.fetchState)),S=h((n=>n.userRoleConfigState.fetchState)),d=h((n=>z(n))),i=d.companyId??R.getSignedInUserTenant(t)?.companyId;O.useEffect((()=>{f==="Not-Started"&&s(Se()),S==="Not-Started"&&s(ge(!0))}),[f,S,s]),O.useEffect((()=>{l||y!=="Not-Started"||i==null||(p(!0),K(s,e,i))}),[l,y,i,s]);const T=h((n=>{switch(e){case"zeni_accounts":return Ce(n,i);case"zeni_treasury":return Te(n,i);case"charge_cards":return be(n,i);case"reimbursement":return he(n,i);default:return Ie(n,i)}})),C=T.kycKybResetStatus.fetchState;if(O.useEffect((()=>{C==="Completed"&&i!=null&&(K(s,e,i,!0),s(De()))}),[C,i,e,s]),R.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let r;switch(e){case"zeni_accounts":r=d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":r=d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":r=d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":r=d.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:r=d.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=n=>{b(n)};return r===!1?A.jsx(ce,{to:"../promo"}):A.jsxs(We,{children:[A.jsx(qe,{analytics:U,onLoad:n=>(g=>{switch(e){case"zeni_accounts":return g.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return g.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return g.trackPageLoaded(x.Event.billPayBusinessVerification,E(a)?"Settings":void 0)}})(n)}),E(a)?A.jsx(He,{isAppContentDrawerOpen:u,handleDrawerToggle:D}):null,A.jsx(Ye,{businessVerificationDetails:T,navigate:c,location:a,companyId:i,analytics:U,currentTenant:d,productType:e,isSettings:E(a),roleMap:o?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:V.maxInsuredAmount})]})};export{ct as B,K as d,it as u};
9
+ `,Ye=ce((function(e,r){const{businessVerificationDetails:a}=r,s=z(e),l=R.getSignedInUser(),p=s.tenantId,u={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:p??""},T=Oe(r.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=ke(e.companyConfigState),o=Ve(e.userRoleConfigState);return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${Ze.fileMicroServiceBaseUrl}`,authParams:u,isDisabled:T,allIndustries:t.companyIndustries??[],companyTitles:o.companyTitles}}),(function(e,r){const{companyId:a,productType:s,currentTenant:l,navigate:p,location:u}=r,{tenantEmailDomain:T}=l;return{onCompanyDetailsChanged:t=>{const{companyDescription:o,companyIndustry:m,companyIndustryType:k,companyLegalName:V,companyTaxId:y,companyWebsite:f,companyPhone:S,primaryContactEmail:d,primaryContactName:i,primaryContactUserId:b,primaryContactSyncToken:C,syncToken:c,fileIds:D,incDate:n,typeOfIncorporation:g,stateOfIncorporation:w,sourceOfFunds:v,companySubIndustry:N,countriesOfOperations:I,companySourceOfFunds:J,companySourceOfFundsDescription:Z,transactionVolume:$,transactionVolumeDescription:H,purposeOfAccount:W,purposeOfAccountDescription:Y,regulatedStatus:Q,regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te}=t,F=k?.selectedOption,ae={companyId:a,companyDescription:o,companyIndustry:m.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:V,taxIdOrEIN:y,website:f!=""&&f!=null?Ue(f):void 0,phone:S,syncToken:c,fileIds:D,incDate:n!=null?B(n?.toString()):n,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:v?.selectedOption??"",companySubIndustry:N?.selectedOption??"",countriesOfOperations:I?.selectedOptions.map((_=>_.length===2?_:j(_)))??[],companySourceOfFunds:J?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:$?.selectedOption??"",transactionVolumeDescription:H,purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:Y,regulatedStatus:Q??"",regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te?.selectedOptions??[]},ne={userId:b,firstName:i.firstName,lastName:i.lastName,email:d,syncToken:C};e(M({companyDetails:ae,primaryContactDetails:ne}))},onCompanyOfficerUpdated:t=>{const o=t.map((m=>{const{officerType:k,userId:V,name:y,email:f,nationalityCountryCode:S,ssn:d,dob:i,phone:b,syncToken:C,selectDocument:c,role:D,ownership:n,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:v,fileIds:N}=m;let I;return c.selectDocumentType==="driverLicense"?I="driving_license":c.selectDocumentType==="passport"?I="passport":c.selectDocumentType==="stateId"?I="id_document":c.selectDocumentType==="ssnCard"&&(I="social_security_card"),{officerType:k,userId:V,firstName:y.firstName,lastName:y.lastName,email:f,ssn:d,nationalityCountryCode:S?.selectedOption!=null?j(S.selectedOption):void 0,phone:b,birthday:i!=null?B(i?.toString()):i,syncToken:C,titleAtCompany:D.selectedOption,ownershipInCompany:n,documentTypeSelectedForVerification:I,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:v,fileIds:N,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(M({officers:o}))},onSaveDetailsClick:t=>{e(P(a,t,s))},onSendForVerificationClick:t=>{e(P(a,t,s,!0))},onAddressClick:t=>{const o=G(T,t),m=L(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:t=>{const o=G(T,t),m=L(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{e(Me({companyId:a})),p("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(Pe(t))},onDeleteFileList:t=>{e(ze(t))},onEditFileName:(t,o)=>{e(Re(t,o.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Ee(t,"SpendManagementSetup"))},onVerifyOtp:(t,o)=>{e(_e(t,o,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,o)=>{e(Fe({addressType:t,addressToCreate:o}))},onIdentityDocumentUploadedForAutofill:t=>{if(a==null)return;const o=ve(t.documentType);o!=null&&e(Ne({target:"setup",companyId:a,officerType:t.officerType,fileId:t.fileId,documentType:o}))},onCompanyDocumentUploadedForAutofill:t=>{a!=null&&e(we({target:"setup",companyId:a,fileId:t.fileId,documentType:t.documentType}))},onResetKycKybClick:()=>{e(Ae())}}}))(Je),rt=({productType:e})=>{const r=se(),a=oe(),s=q(),[l,p]=O.useState(!1),[u,T]=O.useState(!1),{tenantEmailDomain:t}=ie(),o=je(),{useDynamicConfig:m}=Ge(),{configValue:k}=m(Ke.zeniAccountsConfig),V=ye(k),y=h((n=>{switch(e){case"zeni_accounts":return n.zeniAccountSetupViewState.fetchState;case"reimbursement":return n.remiSetupViewState.fetchState;case"charge_cards":return n.chargeCardSetupViewState.fetchState;case"zeni_treasury":return n.treasurySetupViewState.fetchState;default:return n.billPaySetupViewState.fetchState}})),f=h((n=>n.companyConfigState.fetchState)),S=h((n=>n.userRoleConfigState.fetchState)),d=h((n=>z(n))),i=d.companyId??R.getSignedInUserTenant(t)?.companyId;O.useEffect((()=>{f==="Not-Started"&&s(Se()),S==="Not-Started"&&s(ge(!0))}),[f,S,s]),O.useEffect((()=>{l||y!=="Not-Started"||i==null||(p(!0),K(s,e,i))}),[l,y,i,s]);const b=h((n=>{switch(e){case"zeni_accounts":return Ce(n,i);case"zeni_treasury":return be(n,i);case"charge_cards":return Te(n,i);case"reimbursement":return he(n,i);default:return Ie(n,i)}})),C=b.kycKybResetStatus.fetchState;if(O.useEffect((()=>{C==="Completed"&&i!=null&&(K(s,e,i,!0),s(De()))}),[C,i,e,s]),R.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(e){case"zeni_accounts":c=d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=d.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=d.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=n=>{T(n)};return c===!1?A.jsx(re,{to:"../promo"}):A.jsxs(We,{children:[A.jsx(qe,{analytics:U,onLoad:n=>(g=>{switch(e){case"zeni_accounts":return g.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return g.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return g.trackPageLoaded(x.Event.billPayBusinessVerification,E(a)?"Settings":void 0)}})(n)}),E(a)?A.jsx(He,{isAppContentDrawerOpen:u,handleDrawerToggle:D}):null,A.jsx(Ye,{businessVerificationDetails:b,navigate:r,location:a,companyId:i,analytics:U,currentTenant:d,productType:e,isSettings:E(a),roleMap:o?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:V.maxInsuredAmount})]})};export{rt as B,K as d,it as u};
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-UAxYbctH.js";import{a as r}from"./sentry-CQfqw6mU.js";import{u as he,h as Ce,g as fe,j as H,i as Se,l as ge}from"./core-BQ6YlWys.js";import{ec as be,h as Pe,ed as ye,z as we,ef as Ie,eh as W,ei as Ee,aD as G,a9 as xe,d as F,ej as M,et as Ae,G as Te,U as ke,w as Ue,em as Oe,en as _e,aj as ve,eq as Qe,er as je,aw as De,es as Fe}from"./index-DZBfE5XI.js";import{gN as $e,fH as J,fI as Le,gb as Ve,jw as qe,js as Re,fJ as N,gx as Be,gr as He,gt as z,gz as Me,gA as Ne,gB as ze,gC as We,gD as Ge}from"./zeni-epic-state-j9Po26Lg.js";import{D as Je,n as L,v as Ye,S as Ke}from"./mui-DYo6Z7Si.js";import"./recharts-VJtr9O-6.js";import"./analytics-CabaUa1L.js";import"./plaid-BNcFec4W.js";import"./dnd-DL41lZFs.js";import"./stripe-cKAAJElX.js";import"./lottie-BPF4ysWw.js";import"./lexical-BmxGnuDE.js";import"./pdf-CHT1_0Mk.js";import"./utils-BpLD-La5.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="308b423a-fb39-4992-a576-71c6a200f175",t._sentryDebugIdIdentifier="sentry-dbid-308b423a-fb39-4992-a576-71c6a200f175")}catch{}})();const Y="chat-response-generated",K="cards/ask",X="card_policy_hero";function $(t){return`/${t}/cards`}function Z(t){return`/${t}/cards/policy`}const Xe=ge((function(t,s){const d=J(t),l=s.isSubmitting,u=_e(t,{allUsers:s.allUsers,onCardPolicyVendorSearchTextChange:s.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:s.sessionFromUrl==="new_chat"&&d.uiState.currentChatSessionId==null,aiCfoView:d,isSubmitting:l,isNewChatSession:s.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${ve}/tableDownload`,exportDownloadEndPoint:Qe(),emailLinkQuestion:s.emailLinkQuestion,autoSubmitEmailLinkQuestion:s.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:s.onEmailLinkQuestionProcessed,isFileUploadEnabled:s.isFileUploadEnabled,isUploadPromoVisible:s.isUploadPromoVisible,onUploadPromoClose:s.onUploadPromoClose,...u}}),(function(t,s){const{location:d,currentTenant:l,userId:u,navigate:o,currentChatSessionId:P,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,cardPolicyPageContext:k}=s,f=l.tenantEmailDomain,c=d.state?.referrer,h=c===X?Z(f):$(f);return{onEventReceived:(a,n)=>{if(a===Y&&typeof n.text=="string"&&typeof n.metadata=="object"){const e=n,m=Ne(e.type),y=e.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:b,currentQuestionAnswerSummary:p}=G(C,y);m!=="answer"?F.trackAICFOChatResponseGenerated(m,b?.question.questionText??"",e.text,y,Fe(p,U),e.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(e.text,b?.question.questionText??"",(e.follow_up_questions?.length??0)>0,!!e.assumptions,!!e.insights,e.visualization!=null,ze(e.visualization?.type??"")??null,y,e.summarized_title,e.metadata.message_id??null),t(We({chatSessionId:e.metadata.chat_session_id,responseType:m,fetchState:{fetchState:"Completed",error:void 0}})),t(Ge({chatSessionId:e.metadata.chat_session_id,answerPayload:e,userId:u}))}},onSubmit:(a,n,e,m)=>{a&&De(t,a,n,P,C,u,m,e,k)},updateCurrentInput:a=>{t(z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(Me(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{o(-1)},onCloseClick:()=>{o(h,{state:{...d.state}}),t(z(""))},togglePageView:()=>{o(h,{state:W(d.state)}),s.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{o(-1)},onNewChatClick:()=>{P!=null&&t(He()),o((function(a){return`/${a}/${K}`})(f),{state:{...d.state}})},onToggleCotCollapsed:(a,n)=>{t(Be({questionAnswerId:a,isCollapsed:n}))},...je(t,{isAiCardCreationEnabled:A,isCardPolicyEnabled:T,currentChatSessionId:P,onAfterCardsCreationSubmit:()=>{s.setIsAiCfoOpen(!0),o($(f),{state:{...d.state}})},onAfterCardPolicySubmit:()=>{s.setIsAiCfoOpen(!0),o(`/${f}/cards/policy`,{state:{...d.state}})}})}}))(Ue(Oe)),{spendManagement:{chargeCard:{cardsAiCfoHero:ee,cardPolicyAiCfoHero:te}}}=Te.getLocalizedStrings(),x=ee.pageTitle,Ze=te.pageTitle,et=ee.chatHeaderSubtitle,tt=te.chatHeaderSubtitle,Pt=({isFileUploadEnabled:t})=>{const s=be(),{setIsAiCfoOpen:d}=Pe(),l=he(),u=Ce(),o=fe(),[P,C]=r.useState(!1),{allUsers:A,isAiCardCreationEnabled:T,isCardPolicyEnabled:k,onCardPolicyVendorSearchTextChange:f}=ye();r.useEffect((()=>{l($e())}),[l]);const c=H((i=>J(i))),h=we.getSignedInUser(),{session_id:a}=Se(),n=H((i=>Le(i))),e=c.uiState.currentChatSessionId,m=n.tenantEmailDomain,{handleUploadPromoClose:y,isUploadPromoVisible:U}=Ie({isFileUploadEnabled:t,tenantEmailDomain:m}),b=o.state,p=b?.aiCfoInitialQuestion??null,O=!!b?.aiCfoShouldSubmit,w=b?.referrer===X,se=w?"card_policy":void 0,ae=r.useMemo((()=>({title:w?Ze:x,subtitle:w?tt:et})),[w]),[oe,_]=r.useState(null),[ne,v]=r.useState(!1),Q=r.useRef(!1);r.useEffect((()=>{Q.current||p==null||p===""||(_(p),v(O),Q.current=!0)}),[p,O]);const ie=r.useCallback((()=>{_(null),v(!1),u(o.pathname,{replace:!0,state:W(o.state)})}),[o.pathname,o.state,u]),re=n.masterTOSInfo,S=re?.isMasterTOSAccepted??!1,E=r.useRef(null);r.useEffect((()=>{if(S&&E.current!=null){const{question:i,shouldSubmit:I}=E.current;E.current=null,_(i),v(I),Q.current=!1}}),[S]);const{visitedSessions:V}=Ee(e),j=c.fetchState,D=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,q=e!=null?c.fetchChatSessionHistoryByChatSessionId?.[e]?.fetchState??"Not-Started":"Not-Started",R=e==null||(c.uiState.chatHistoryNextPageToken[e]?.hasMore??!0),B=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:le}=G(B,e),de=le.length===0;r.useEffect((()=>{e!=null&&a!==e&&u((function(i,I){return`/${i}/${K}/${I}`})(m,e),{state:{...o.state},replace:!0})}),[e,a,m,u,o.state]),r.useEffect((()=>{a!=null&&e==null&&a!=="new_chat"&&l(Ve({sessionId:a,agentId:"controller"}))}),[]);const ce=r.useMemo((()=>({events:V.map((i=>`private-encrypted-chat-${i}.${Y}`)),eventCallback:(i,I,pe)=>pe.onEventReceived(i,I)})),[V]);if(r.useEffect((()=>{j!=="In-Progress"&&D&&l(qe())}),[j,D,l]),r.useEffect((()=>{e!=null&&q!=="In-Progress"&&R&&h!=null&&j==="Completed"&&!D&&l(Re(e,h.userId))}),[q,R,e,h,l]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ue=a??"new_chat",me=e!=null&&c.responseStateByChatSessionId?.[e]?.answer?.fetchState==="In-Progress";return g.jsxs(at,{children:[g.jsx(xe,{analytics:F,onLoad:i=>i.trackPageLoaded(ke.Event.aiCFOPage)}),S?g.jsx(Xe,{answerExportEndPoint:s,...ce,currentChatSessionId:e,allSessionsWithOrderedQuestionAnswers:B,allUsers:A,isAiCardCreationEnabled:T,isCardPolicyEnabled:k,openOnboardingPage:()=>C(!0),userId:h.userId,setIsAiCfoOpen:d,navigate:u,sessionFromUrl:ue,location:o,isSubmitting:me,isEmptyChatWithSession:de,customPageTitle:x,chatHeader:ae,currentTenant:n,emailLinkQuestion:oe??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:ie,isFileUploadEnabled:t,isUploadPromoVisible:U,onUploadPromoClose:y,onCardPolicyVendorSearchTextChange:f,cardPolicyPageContext:se}):g.jsx(M,{isTOSAccepted:S,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:x,onCloseClick:()=>{u(w?Z(m):$(m),{state:{...o.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(p!=null&&p!==""&&(E.current={question:p,shouldSubmit:O}),l(N(n.userRoleId)))}}),g.jsx(Je,{anchor:"right",open:P,transitionDuration:250,PaperProps:{component:ot,style:{width:`${Ae}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>C(!1),children:g.jsx(st,{onClick:i=>i.stopPropagation(),children:g.jsx(M,{isTOSAccepted:S,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:x,onCloseClick:()=>C(!1),onCompleteClick:()=>{S||n.userRoleId==null||l(N(n.userRoleId)),C(!1)}})})})]})},st=L(Ke)`
1
+ import{j as S}from"./liveblocks-CuUK5O_2.js";import{a as r}from"./sentry-D0lP5-8e.js";import{u as he,h as Ce,g as fe,j as H,i as ge,l as Se}from"./core-BBlQ3ArL.js";import{ec as be,g as Pe,ed as ye,z as we,ef as Ie,eh as W,ei as Ee,aD as G,a9 as xe,d as F,ej as M,et as Ae,G as Te,U as ke,w as Ue,em as Oe,en as _e,aj as ve,eq as Qe,er as je,aw as De,es as Fe}from"./index-ClwW47Zs.js";import{gN as $e,fH as J,fI as Le,gb as Ve,jw as qe,js as Re,fJ as N,gx as Be,gr as He,gt as z,gz as Me,gA as Ne,gB as ze,gC as We,gD as Ge}from"./zeni-epic-state-aUBx6G2Q.js";import{D as Je,n as L,v as Ye,S as Ke}from"./mui--aGBnNu2.js";import"./recharts-CkREU3LH.js";import"./analytics-D051O7ML.js";import"./plaid-7P9b69CP.js";import"./dnd-CU3yeazS.js";import"./stripe-cKAAJElX.js";import"./lottie-Du4lbH8J.js";import"./lexical-DVH-xgq1.js";import"./pdf-CrvsvvW3.js";import"./utils-Ctp9Zfhk.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="516fe87d-cc87-44b8-8667-2e83d434e364",t._sentryDebugIdIdentifier="sentry-dbid-516fe87d-cc87-44b8-8667-2e83d434e364")}catch{}})();const Y="chat-response-generated",K="cards/ask",X="card_policy_hero";function $(t){return`/${t}/cards`}function Z(t){return`/${t}/cards/policy`}const Xe=Se((function(t,s){const d=J(t),l=s.isSubmitting,u=_e(t,{allUsers:s.allUsers,onCardPolicyVendorSearchTextChange:s.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:s.sessionFromUrl==="new_chat"&&d.uiState.currentChatSessionId==null,aiCfoView:d,isSubmitting:l,isNewChatSession:s.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${ve}/tableDownload`,exportDownloadEndPoint:Qe(),emailLinkQuestion:s.emailLinkQuestion,autoSubmitEmailLinkQuestion:s.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:s.onEmailLinkQuestionProcessed,isFileUploadEnabled:s.isFileUploadEnabled,isUploadPromoVisible:s.isUploadPromoVisible,onUploadPromoClose:s.onUploadPromoClose,...u}}),(function(t,s){const{location:d,currentTenant:l,userId:u,navigate:o,currentChatSessionId:P,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,cardPolicyPageContext:k}=s,f=l.tenantEmailDomain,c=d.state?.referrer,h=c===X?Z(f):$(f);return{onEventReceived:(a,n)=>{if(a===Y&&typeof n.text=="string"&&typeof n.metadata=="object"){const e=n,m=Ne(e.type),y=e.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:b,currentQuestionAnswerSummary:p}=G(C,y);m!=="answer"?F.trackAICFOChatResponseGenerated(m,b?.question.questionText??"",e.text,y,Fe(p,U),e.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(e.text,b?.question.questionText??"",(e.follow_up_questions?.length??0)>0,!!e.assumptions,!!e.insights,e.visualization!=null,ze(e.visualization?.type??"")??null,y,e.summarized_title,e.metadata.message_id??null),t(We({chatSessionId:e.metadata.chat_session_id,responseType:m,fetchState:{fetchState:"Completed",error:void 0}})),t(Ge({chatSessionId:e.metadata.chat_session_id,answerPayload:e,userId:u}))}},onSubmit:(a,n,e,m)=>{a&&De(t,a,n,P,C,u,m,e,k)},updateCurrentInput:a=>{t(z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(Me(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{o(-1)},onCloseClick:()=>{o(h,{state:{...d.state}}),t(z(""))},togglePageView:()=>{o(h,{state:W(d.state)}),s.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{o(-1)},onNewChatClick:()=>{P!=null&&t(He()),o((function(a){return`/${a}/${K}`})(f),{state:{...d.state}})},onToggleCotCollapsed:(a,n)=>{t(Be({questionAnswerId:a,isCollapsed:n}))},...je(t,{isAiCardCreationEnabled:A,isCardPolicyEnabled:T,currentChatSessionId:P,onAfterCardsCreationSubmit:()=>{s.setIsAiCfoOpen(!0),o($(f),{state:{...d.state}})},onAfterCardPolicySubmit:()=>{s.setIsAiCfoOpen(!0),o(`/${f}/cards/policy`,{state:{...d.state}})}})}}))(Ue(Oe)),{spendManagement:{chargeCard:{cardsAiCfoHero:ee,cardPolicyAiCfoHero:te}}}=Te.getLocalizedStrings(),x=ee.pageTitle,Ze=te.pageTitle,et=ee.chatHeaderSubtitle,tt=te.chatHeaderSubtitle,Pt=({isFileUploadEnabled:t})=>{const s=be(),{setIsAiCfoOpen:d}=Pe(),l=he(),u=Ce(),o=fe(),[P,C]=r.useState(!1),{allUsers:A,isAiCardCreationEnabled:T,isCardPolicyEnabled:k,onCardPolicyVendorSearchTextChange:f}=ye();r.useEffect((()=>{l($e())}),[l]);const c=H((i=>J(i))),h=we.getSignedInUser(),{session_id:a}=ge(),n=H((i=>Le(i))),e=c.uiState.currentChatSessionId,m=n.tenantEmailDomain,{handleUploadPromoClose:y,isUploadPromoVisible:U}=Ie({isFileUploadEnabled:t,tenantEmailDomain:m}),b=o.state,p=b?.aiCfoInitialQuestion??null,O=!!b?.aiCfoShouldSubmit,w=b?.referrer===X,se=w?"card_policy":void 0,ae=r.useMemo((()=>({title:w?Ze:x,subtitle:w?tt:et})),[w]),[oe,_]=r.useState(null),[ne,v]=r.useState(!1),Q=r.useRef(!1);r.useEffect((()=>{Q.current||p==null||p===""||(_(p),v(O),Q.current=!0)}),[p,O]);const ie=r.useCallback((()=>{_(null),v(!1),u(o.pathname,{replace:!0,state:W(o.state)})}),[o.pathname,o.state,u]),re=n.masterTOSInfo,g=re?.isMasterTOSAccepted??!1,E=r.useRef(null);r.useEffect((()=>{if(g&&E.current!=null){const{question:i,shouldSubmit:I}=E.current;E.current=null,_(i),v(I),Q.current=!1}}),[g]);const{visitedSessions:V}=Ee(e),j=c.fetchState,D=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,q=e!=null?c.fetchChatSessionHistoryByChatSessionId?.[e]?.fetchState??"Not-Started":"Not-Started",R=e==null||(c.uiState.chatHistoryNextPageToken[e]?.hasMore??!0),B=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:le}=G(B,e),de=le.length===0;r.useEffect((()=>{e!=null&&a!==e&&u((function(i,I){return`/${i}/${K}/${I}`})(m,e),{state:{...o.state},replace:!0})}),[e,a,m,u,o.state]),r.useEffect((()=>{a!=null&&e==null&&a!=="new_chat"&&l(Ve({sessionId:a,agentId:"controller"}))}),[]);const ce=r.useMemo((()=>({events:V.map((i=>`private-encrypted-chat-${i}.${Y}`)),eventCallback:(i,I,pe)=>pe.onEventReceived(i,I)})),[V]);if(r.useEffect((()=>{j!=="In-Progress"&&D&&l(qe())}),[j,D,l]),r.useEffect((()=>{e!=null&&q!=="In-Progress"&&R&&h!=null&&j==="Completed"&&!D&&l(Re(e,h.userId))}),[q,R,e,h,l]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ue=a??"new_chat",me=e!=null&&c.responseStateByChatSessionId?.[e]?.answer?.fetchState==="In-Progress";return S.jsxs(at,{children:[S.jsx(xe,{analytics:F,onLoad:i=>i.trackPageLoaded(ke.Event.aiCFOPage)}),g?S.jsx(Xe,{answerExportEndPoint:s,...ce,currentChatSessionId:e,allSessionsWithOrderedQuestionAnswers:B,allUsers:A,isAiCardCreationEnabled:T,isCardPolicyEnabled:k,openOnboardingPage:()=>C(!0),userId:h.userId,setIsAiCfoOpen:d,navigate:u,sessionFromUrl:ue,location:o,isSubmitting:me,isEmptyChatWithSession:de,customPageTitle:x,chatHeader:ae,currentTenant:n,emailLinkQuestion:oe??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:ie,isFileUploadEnabled:t,isUploadPromoVisible:U,onUploadPromoClose:y,onCardPolicyVendorSearchTextChange:f,cardPolicyPageContext:se}):S.jsx(M,{isTOSAccepted:g,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:x,onCloseClick:()=>{u(w?Z(m):$(m),{state:{...o.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(p!=null&&p!==""&&(E.current={question:p,shouldSubmit:O}),l(N(n.userRoleId)))}}),S.jsx(Je,{anchor:"right",open:P,transitionDuration:250,PaperProps:{component:ot,style:{width:`${Ae}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>C(!1),children:S.jsx(st,{onClick:i=>i.stopPropagation(),children:S.jsx(M,{isTOSAccepted:g,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:x,onCloseClick:()=>C(!1),onCompleteClick:()=>{g||n.userRoleId==null||l(N(n.userRoleId)),C(!1)}})})})]})},st=L(Ke)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;