@zeniai/web-app-ui 5.3.32-dev → 5.3.32-qa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/assets/{AccountMappingScreen-Dst-9gUw.js → AccountMappingScreen-Cv_JISNl.js} +1 -1
  2. package/dist/assets/AddressRoutes-D1wfXuM-.js +1 -0
  3. package/dist/assets/{AddressScreen-LFBV9KsX.js → AddressScreen-DKIOTZOx.js} +1 -1
  4. package/dist/assets/{AiCfoScreen-N1tWqaxl.js → AiCfoScreen-BbhOSIw9.js} +1 -1
  5. package/dist/assets/{AppDrawer-DmTC2F7R.js → AppDrawer-DyJQZA6-.js} +1 -1
  6. package/dist/assets/{BillPayApprovalRoutes-sbvXc3_Z.js → BillPayApprovalRoutes-B-dRM1ET.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-Cf4T_cOn.js → BillPayRoutes-Bw7Zsd_q.js} +1 -1
  8. package/dist/assets/{BusinessVerificationPageScreen--LjYD0BK.js → BusinessVerificationPageScreen-BpB36lD4.js} +1 -1
  9. package/dist/assets/{CardsAiCfoScreen-p_ZDfSVk.js → CardsAiCfoScreen-ZXvSY5tv.js} +1 -1
  10. package/dist/assets/{ChargeCardRoutes-DWtJK7tn.js → ChargeCardRoutes-BN5gmMDY.js} +1 -1
  11. package/dist/assets/{CompanyPassportScreen-Cr55ZhHa.js → CompanyPassportScreen-BgOKbeIV.js} +1 -1
  12. package/dist/assets/{ConnectionAuthScreen-D-vDZGov.js → ConnectionAuthScreen-DXPq3qhF.js} +1 -1
  13. package/dist/assets/CustomerOnboardingAuthScreen-C1BQROr2.js +1 -0
  14. package/dist/assets/{CustomerOnboardingRoutes-deFe2P-n.js → CustomerOnboardingRoutes-BbMnpjPH.js} +1 -1
  15. package/dist/assets/{DashboardRoutes-DmGJojZS.js → DashboardRoutes-C--0vzwA.js} +1 -1
  16. package/dist/assets/{DefaultTenantHome-CWi1XNJj.js → DefaultTenantHome-gR6Y3pYc.js} +1 -1
  17. package/dist/assets/{DomesticWireDetailScreen-D5RLzOT3.js → DomesticWireDetailScreen-B6SysKxJ.js} +1 -1
  18. package/dist/assets/{DrawerScreen-DVJ1nhu5.js → DrawerScreen-BUtXmCMv.js} +1 -1
  19. package/dist/assets/{EntityDetailRoutes-DJgrP2Nz.js → EntityDetailRoutes-BJRFJx06.js} +1 -1
  20. package/dist/assets/{ExpenseAutomationRoutes-OyBtxM5J.js → ExpenseAutomationRoutes-8h-9Hyes.js} +1 -1
  21. package/dist/assets/{FeaturePreviewScreen-BhrA_knX.js → FeaturePreviewScreen-07vQ7ieK.js} +1 -1
  22. package/dist/assets/{HubSpotOAuthCallbackScreen-Dm5LF-fb.js → HubSpotOAuthCallbackScreen-B6PLbaf4.js} +1 -1
  23. package/dist/assets/{InboxNotificationsProvider-DBc6Mphu.js → InboxNotificationsProvider-BH2D62uC.js} +1 -1
  24. package/dist/assets/{InvoicingRoutes-B1FBFxmX.js → InvoicingRoutes-C2RjAxZA.js} +1 -1
  25. package/dist/assets/{MagicLinkRoutes-70CKQAmw.js → MagicLinkRoutes-B3OI8_Y8.js} +1 -1
  26. package/dist/assets/{MagicLinkSignInScreen-CC7wdqci.js → MagicLinkSignInScreen-Y0R0oylb.js} +1 -1
  27. package/dist/assets/{MobileAppDrawer-BtnNKdri.js → MobileAppDrawer-CjyikhYJ.js} +1 -1
  28. package/dist/assets/NotFoundScreen-C2tiSpQ7.js +1 -0
  29. package/dist/assets/{NotificationRoutes-Jy_Q0gUN.js → NotificationRoutes-CFog6J5Q.js} +1 -1
  30. package/dist/assets/{OAuthConsentScreen-DB2EvPsq.js → OAuthConsentScreen-g72Ugnk9.js} +1 -1
  31. package/dist/assets/{PandLWithForecastRoutes-DHCQWgYM.js → PandLWithForecastRoutes-CMaqNXj1.js} +1 -1
  32. package/dist/assets/{PaymentLinkScreen-nMdnk521.js → PaymentLinkScreen-oiuP5YE8.js} +1 -1
  33. package/dist/assets/{PeopleRoutes-rPdm-Ydn.js → PeopleRoutes-sgSiMpSO.js} +1 -1
  34. package/dist/assets/{PerformanceRoutes-CF0jBH_I.js → PerformanceRoutes-CjfeH4u4.js} +1 -1
  35. package/dist/assets/{Preview-C_55fm97.js → Preview-C7FOgz3Q.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-Dlky0ESM.js → QBOConnectionScreen-CiKgrKX6.js} +1 -1
  37. package/dist/assets/{ReimbursementApprovalRoutes-Bf9cBzdf.js → ReimbursementApprovalRoutes-LWePNTvC.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-XQSOHGYn.js → ReimbursementApprovalRuleDetailScreen-D7_1V-ZV.js} +1 -1
  39. package/dist/assets/{ReimbursementRoutes-CgvBDllF.js → ReimbursementRoutes-CfqcRhl_.js} +1 -1
  40. package/dist/assets/{ReportsRoutes-BMuQOI7M.js → ReportsRoutes-uMoEApCu.js} +1 -1
  41. package/dist/assets/{RewardsRoutes-CF7hyIJJ.js → RewardsRoutes-CCLIDX41.js} +1 -1
  42. package/dist/assets/{ScreenRoutes-vV1s5761.js → ScreenRoutes-T2NqNjGF.js} +2 -2
  43. package/dist/assets/{SettingsRoutes-6XcFcNwI.js → SettingsRoutes-C_BHKgxc.js} +1 -1
  44. package/dist/assets/{SetupPagesScreen-BxDIT7Xu.js → SetupPagesScreen-CZfthydR.js} +1 -1
  45. package/dist/assets/{SignInScreen-UcqpfzAX.js → SignInScreen-Ch6DTnK6.js} +1 -1
  46. package/dist/assets/{SignOutScreen-14vW04Vy.js → SignOutScreen-CfAh7qk3.js} +1 -1
  47. package/dist/assets/{TaskListScreen-CwNgkHwd.js → TaskListScreen-vihEMCMo.js} +1 -1
  48. package/dist/assets/{TaskRoutes-uBt2S29g.js → TaskRoutes-DO-tMTQu.js} +1 -1
  49. package/dist/assets/TransactionDetailRoutes-zmryAi6y.js +1 -0
  50. package/dist/assets/{TransactionDetailScreen-2kUyCbFm.js → TransactionDetailScreen-dG3SEGK8.js} +1 -1
  51. package/dist/assets/{TransactionListRoutes-Dm5jOGqp.js → TransactionListRoutes-D_3U5FSp.js} +1 -1
  52. package/dist/assets/{TreasuryRoutes-C3nO4w9n.js → TreasuryRoutes-XotmNx9W.js} +1 -1
  53. package/dist/assets/{VendorsRoutes-zeljYW53.js → VendorsRoutes-DCuo1D8L.js} +1 -1
  54. package/dist/assets/{WiseConfirmationScreen-BBqG7Bw5.js → WiseConfirmationScreen-D3ybpk8W.js} +1 -1
  55. package/dist/assets/{ZeniAccountRoutes-Dl9FUScI.js → ZeniAccountRoutes-C9gyx-Lb.js} +1 -1
  56. package/dist/assets/{ZeniAccountStatementScreen-BjcRzB88.js → ZeniAccountStatementScreen-4u5gSdu6.js} +1 -1
  57. package/dist/assets/{accountMappingHelper-ZLBxLrOl.js → accountMappingHelper-DOs7iAIL.js} +1 -1
  58. package/dist/assets/{analytics-DHBkdK00.js → analytics-DZ6cwnOO.js} +1 -1
  59. package/dist/assets/{analyticsHelper-C8sM1z8L.js → analyticsHelper-D6TeBlJQ.js} +1 -1
  60. package/dist/assets/{core-DuNHGHBC.js → core-BL7rYGUF.js} +1 -1
  61. package/dist/assets/{decodeURIComponentSafe-CcNRl55W.js → decodeURIComponentSafe-B4a7LpJx.js} +1 -1
  62. package/dist/assets/{dnd-DKR3QBLX.js → dnd-BsiKGZTJ.js} +1 -1
  63. package/dist/assets/{empty-DRiI770H.js → empty-SbPe4M90.js} +1 -1
  64. package/dist/assets/{empty-BA0WbUFe.js → empty-qvcbLK7S.js} +1 -1
  65. package/dist/assets/{emptyVideoElement-h3Sv0Oh_.js → emptyVideoElement-BMPAb-cr.js} +1 -1
  66. package/dist/assets/{epic-leJAVePQ.js → epic-Bt3rVBX8.js} +1 -1
  67. package/dist/assets/{expenseAutomationHelper-DGi7tuOw.js → expenseAutomationHelper-DfYMglD1.js} +1 -1
  68. package/dist/assets/{getLocaleForTenant-D1jcEP43.js → getLocaleForTenant-akYNGA2f.js} +1 -1
  69. package/dist/assets/{index-B21g9_qj.js → index-BRAI-aTk.js} +1 -1
  70. package/dist/assets/{index-bPK7WXlx.js → index-B_AHleOS.js} +2 -2
  71. package/dist/assets/{index-DgXVMYGv.js → index-BtCYCCEX.js} +1 -1
  72. package/dist/assets/{index-y1KlwLzp.js → index-C4WC13bA.js} +1 -1
  73. package/dist/assets/{index-CFb8siio.js → index-CPdgrrgU.js} +1 -1
  74. package/dist/assets/{index-DRythsNE.js → index-DLTi5gVy.js} +1 -1
  75. package/dist/assets/{index-CxkwDRG8.js → index-E1NwyJIP.js} +8 -8
  76. package/dist/assets/{index-DplrRYRh.js → index-te7nCILo.js} +1 -1
  77. package/dist/assets/{lexical-CcqvVKiN.js → lexical-BSRawlvX.js} +1 -1
  78. package/dist/assets/{liveblocks-BkTNzfNi.js → liveblocks-BeSMR7a1.js} +1 -1
  79. package/dist/assets/{lottie-DACJJNY9.js → lottie-joMwFamf.js} +1 -1
  80. package/dist/assets/{mui-DaLeH41l.js → mui-CPSuUssr.js} +1 -1
  81. package/dist/assets/{pathToGoBack-CmznLvKE.js → pathToGoBack-rem3sHLx.js} +1 -1
  82. package/dist/assets/{pdf-BjtwR-dW.js → pdf-CcTg_U5O.js} +3 -3
  83. package/dist/assets/{pdf-lib-oygBYinp.js → pdf-lib-Cu5wZc2A.js} +1 -1
  84. package/dist/assets/{plaid-BVNoSR_u.js → plaid-DMXel13h.js} +1 -1
  85. package/dist/assets/{pusher-Db4sFIYV.js → pusher-IEbMI61m.js} +1 -1
  86. package/dist/assets/{react-1oTTb5wo.js → react-34F3zNgD.js} +1 -1
  87. package/dist/assets/{react-CYKQo_kF.js → react-B6LrhCL-.js} +1 -1
  88. package/dist/assets/{react-CMoOPPDa.js → react-BtgwZRYq.js} +1 -1
  89. package/dist/assets/{react-CEkBTHgm.js → react-Cyo5bdBF.js} +1 -1
  90. package/dist/assets/{react-eY-XTCmQ.js → react-D5rCBPHe.js} +1 -1
  91. package/dist/assets/{react-CNf8hG5M.js → react-p4SZ9iHE.js} +1 -1
  92. package/dist/assets/{recharts-CkuQpH_L.js → recharts-BP8J0UHA.js} +1 -1
  93. package/dist/assets/{routePaths-CKTfFzY9.js → routePaths-Cf2E-_nR.js} +1 -1
  94. package/dist/assets/{sentry-CNLjKkQW.js → sentry-Uj7AWjah.js} +1 -1
  95. package/dist/assets/{url-C3nvEZls.js → url-Cc0feVFM.js} +1 -1
  96. package/dist/assets/{url-CaYHIgYK.js → url-CnKkchc3.js} +1 -1
  97. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BnMQqj78.js → useAiCfoDashboardSuggestedQuestionsChips-DABf-MX6.js} +1 -1
  98. package/dist/assets/{useAskAiCfoHostNavButtonProps-D-XiURTy.js → useAskAiCfoHostNavButtonProps-CC7G-KyB.js} +1 -1
  99. package/dist/assets/{useChargeCardPusherEvents-B74EcXIV.js → useChargeCardPusherEvents-DJOucGr5.js} +1 -1
  100. package/dist/assets/{useDeviceId-J3kskmrp.js → useDeviceId-CR3YwHzW.js} +1 -1
  101. package/dist/assets/{useEmailConnectResultRefresh-F2D_LM69.js → useEmailConnectResultRefresh-DDRUKxe2.js} +1 -1
  102. package/dist/assets/{useInitialThreadRequest-DANB6KeB.js → useInitialThreadRequest-DifgMaO6.js} +1 -1
  103. package/dist/assets/{useTaskManagerAccess-CgZlooKP.js → useTaskManagerAccess-BVyRgvZH.js} +1 -1
  104. package/dist/assets/{utils-BN2UhEgk.js → utils-Dn95OB7n.js} +1 -1
  105. package/dist/assets/{withTransactionSidePanel-CbsHNOl9.js → withTransactionSidePanel-CPfQcd4u.js} +1 -1
  106. package/dist/assets/{zeni-epic-state-IKQP0lNP.js → zeni-epic-state-CxdZGPla.js} +3 -3
  107. package/dist/index.html +1 -1
  108. package/package.json +1 -1
  109. package/dist/assets/AddressRoutes-O-cTW9EV.js +0 -1
  110. package/dist/assets/CustomerOnboardingAuthScreen-Cs_F35vo.js +0 -1
  111. package/dist/assets/NotFoundScreen-DjDyDYWZ.js +0 -1
  112. package/dist/assets/TransactionDetailRoutes-Burs226A.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as U}from"./liveblocks-BkTNzfNi.js";import{a as o}from"./sentry-CNLjKkQW.js";import{h as W,g as H,u as K,j as m,s as R,l as Y}from"./core-DuNHGHBC.js";import{ag as Z,O as ee,y as q,z as te,l as G,ah as ne,h as ae,N as ce}from"./index-CxkwDRG8.js";import{bn as se,fB as oe,gS as ie,ox as X,TT as le,i5 as J,gd as re,oo as ue,TU as de,TV as pe,tx as ge,lX as me,om as be,oi as Ae,ot as fe,i7 as ye,TW as Ie,TX as Se}from"./zeni-epic-state-IKQP0lNP.js";import{n as he}from"./mui-DaLeH41l.js";import{M as Ee}from"./MobileAppDrawer-BtnNKdri.js";import{q as $}from"./QBOConnectionScreen-Dlky0ESM.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-ZLBxLrOl.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="7d8da5d4-feb0-47ba-a525-9b6c02ef6be0",a._sentryDebugIdIdentifier="sentry-dbid-7d8da5d4-feb0-47ba-a525-9b6c02ef6be0")}catch{}})();const r="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},xe=he.div`
1
+ import{j as U}from"./liveblocks-BeSMR7a1.js";import{a as o}from"./sentry-Uj7AWjah.js";import{h as W,g as H,u as K,j as m,s as R,l as Y}from"./core-BL7rYGUF.js";import{ag as Z,O as ee,y as q,z as te,l as G,ah as ne,h as ae,N as ce}from"./index-E1NwyJIP.js";import{bn as se,fB as oe,gS as ie,ox as X,TT as le,i5 as J,gd as re,oo as ue,TU as de,TV as pe,tx as ge,lX as me,om as be,oi as Ae,ot as fe,i7 as ye,TW as Ie,TX as Se}from"./zeni-epic-state-CxdZGPla.js";import{n as he}from"./mui-CPSuUssr.js";import{M as Ee}from"./MobileAppDrawer-CjyikhYJ.js";import{q as $}from"./QBOConnectionScreen-CiKgrKX6.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-DOs7iAIL.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="7d8da5d4-feb0-47ba-a525-9b6c02ef6be0",a._sentryDebugIdIdentifier="sentry-dbid-7d8da5d4-feb0-47ba-a525-9b6c02ef6be0")}catch{}})();const r="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},xe=he.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-BeSMR7a1.js";import{A as o}from"./AddressScreen-DKIOTZOx.js";import i from"./NotFoundScreen-C2tiSpQ7.js";import"./sentry-Uj7AWjah.js";import{n as s,o as r}from"./core-BL7rYGUF.js";import"./zeni-epic-state-CxdZGPla.js";import"./recharts-BP8J0UHA.js";import"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="31d0e0e8-dcf1-419d-b2be-6dc359df28c9",t._sentryDebugIdIdentifier="sentry-dbid-31d0e0e8-dcf1-419d-b2be-6dc359df28c9")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(o,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(o,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as n}from"./liveblocks-BkTNzfNi.js";import{a as h}from"./sentry-CNLjKkQW.js";import{h as T,u as P,g as j,i as E,j as B,l as D}from"./core-DuNHGHBC.js";import{$,E as M,z as U,V as L,a5 as K,a6 as z,h as C,N as S,a1 as N,T as b,a2 as R}from"./index-CxkwDRG8.js";import{Uy as _,il as V,fB as F,Uz as G,c7 as O,UA as q,mD as H}from"./zeni-epic-state-IKQP0lNP.js";import{n as J}from"./mui-DaLeH41l.js";import Q from"./NotFoundScreen-DjDyDYWZ.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]="3fa510e1-d7dc-49b2-9370-b1d1333fc69d",e._sentryDebugIdIdentifier="sentry-dbid-3fa510e1-d7dc-49b2-9370-b1d1333fc69d")}catch{}})();const W=J.div`
1
+ import{j as n}from"./liveblocks-BeSMR7a1.js";import{a as h}from"./sentry-Uj7AWjah.js";import{h as T,u as P,g as j,i as E,j as B,l as D}from"./core-BL7rYGUF.js";import{$,E as M,z as U,V as L,a5 as K,a6 as z,h as C,N as S,a1 as N,T as b,a2 as R}from"./index-E1NwyJIP.js";import{Uy as _,il as V,fB as F,Uz as G,c7 as O,UA as q,mD as H}from"./zeni-epic-state-CxdZGPla.js";import{n as J}from"./mui-CPSuUssr.js";import Q from"./NotFoundScreen-C2tiSpQ7.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]="3fa510e1-d7dc-49b2-9370-b1d1333fc69d",e._sentryDebugIdIdentifier="sentry-dbid-3fa510e1-d7dc-49b2-9370-b1d1333fc69d")}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 m}from"./liveblocks-BkTNzfNi.js";import{a as l}from"./sentry-CNLjKkQW.js";import{u as Ue,h as Le,g as Fe,j as _,i as Be,l as Re}from"./core-DuNHGHBC.js";import{a as Ve,e2 as Me,z as $e,$ as Ne,e3 as qe,e4 as Ge,bm as le,e5 as he,e6 as He,bl as ge,a2 as H,a6 as $,h as x,e7 as N,e8 as ze,e9 as We,as as Je,N as Ke,w as Xe,ea as Ye,eb as Ze,at as et,ec as tt,ed as st,ee as at,ef as ot,p as nt,bi as re,eg as it}from"./index-CxkwDRG8.js";import{fA as z,gp as E,gx as W,Tq as lt,gr as J,gH as rt,fB as dt,j0 as ct,a1k as ut,g4 as mt,je as pt,ja as St,fC as q,gb as ht,a1l as gt,a1m as ft,a1n as Ct,jP as G,gq as kt,gk as de,k0 as ce,gm as ue,gs as It,a1o as me,jR as bt,j7 as vt,jl as Et,jN as pe,ji as Pt,jo as wt,gt as xt,gu as yt,gv as Tt,gw as At}from"./zeni-epic-state-IKQP0lNP.js";import{D as Qt,n as y,S as jt,P as Ot}from"./mui-DaLeH41l.js";import{u as _t}from"./useAiCfoDashboardSuggestedQuestionsChips-BnMQqj78.js";import{p as Dt}from"./pathToGoBack-CmznLvKE.js";import"./recharts-CkuQpH_L.js";import"./analytics-DHBkdK00.js";import"./plaid-BVNoSR_u.js";import"./dnd-DKR3QBLX.js";import"./stripe-cKAAJElX.js";import"./lottie-DACJJNY9.js";import"./lexical-CcqvVKiN.js";import"./pdf-BjtwR-dW.js";import"./utils-BN2UhEgk.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="8eb2a734-cd67-46b6-b69a-5418237b214d",e._sentryDebugIdIdentifier="sentry-dbid-8eb2a734-cd67-46b6-b69a-5418237b214d")}catch{}})();const fe="chat-response-generated";function Ut(e,o){if(o.kind!=="save")return;if(o.fetchState==="In-Progress")return{status:"saving"};if(o.fetchState==="Error")return{status:"failed"};if(o.fetchState!=="Completed")return;const s=E(e).skills.find((p=>p.macroId===o.savedMacroId));return s==null?void 0:{status:"saved",command:s.name}}const Lt=Re((function(e,o){const s=z(e),p=o.isSubmitting,n=s.uiState?.currentChatSessionId,S=n!=null?ht(e.aiCfoState,n):[],c=Ze(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange}),C=gt(e),g=ft(e),P=Ct(e);return{showSampleQuestions:o.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:p,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${et}/tableDownload`,exportDownloadEndPoint:at(),emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,skills:E(e).skills,skillSaveState:Ut(e,P),skillsEnabled:E(e).skillsEnabled,skillsList:E(e).skills,skillsListError:E(e).fetchState==="Error",skillsListLoading:E(e).fetchState==="In-Progress",skillsCanPublish:E(e).canPublish,skillSaving:P.fetchState==="In-Progress",skillSaveError:P.fetchState==="Error",skillVersionHistory:C.macroId!=null?{macroId:C.macroId,versions:C.versions,error:C.fetchState==="Error",loading:C.fetchState==="In-Progress"}:void 0,skillRestoreBody:g.macroId!=null&&g.version!=null?{macroId:g.macroId,version:g.version,instructions:g.instructions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillDetail:G(e).detail,skillDetailError:G(e).fetchState==="Error",skillDetailLoading:G(e).fetchState==="In-Progress",syntheticAnswers:S,resolveSyntheticAnswerCardTile:st(e),resolveSyntheticAnswerPolicyTile:tt(e),...c}}),(function(e,o){const{location:s,currentTenant:p,userId:n,navigate:S,currentChatSessionId:c,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:g,isCardPolicyEnabled:P,setIsAiCfoOpen:w}=o,T=p.tenantEmailDomain;return{onEventReceived:(t,a)=>{if(t===fe&&typeof a.text=="string"&&typeof a.metadata=="object"){const d=a,u=xt(d.type),h=d.metadata.chat_session_id??null,{currentChatSession:k,currentQuestionAnswer:A,currentQuestionAnswerSummary:b}=ge(C,h);u!=="answer"?x.trackAICFOChatResponseGenerated(u,A?.question.questionText??"",d.text,h,it(b,k),d.metadata.message_id??null):x.trackAICFOChatAnswerGenerated(d.text,A?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,yt(d.visualization?.type??"")??null,h,d.summarized_title,d.metadata.message_id??null),e(Tt({chatSessionId:d.metadata.chat_session_id,responseType:u,fetchState:{fetchState:"Completed",error:void 0}})),e(At({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:n}))}},onSubmit:(t,a,d,u,h)=>{t&&re(e,t,a,c,C,n,u,d,void 0,h)},onFetchSkills:()=>{e(W())},onOpenSkill:t=>{e(Pt({macroId:t})),e(wt({macroId:t}))},onSaveSkill:(t,a)=>{e(pe({draft:t,macroId:a}))},onSaveSkillDraft:t=>{const a=t.displayName?.trim()??"",d=t.name?.trim()??"";e(pe({draft:{name:a.length>0?a:d,description:t.description?.trim()??null,instructions:t.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(t,a)=>{e(Et({macroId:t,version:a}))},onDeleteSkill:t=>{e(vt({macroId:t}))},onSetSkillVisibility:(t,a)=>{e(bt({macroId:t,visibility:a}))},onCloseSkillDetail:()=>{e(me())},onRunSkill:(t,a)=>{e(J()),e(de()),re(e,a,"user_input",void 0,C,n,void 0,void 0,void 0,t),e(me())},updateCurrentInput:t=>{e(ue(t))},onStopSubmit:()=>{},onUpdateScrollYOffset:t=>{e(It(t))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const t=H(s.state?.pathnameStackToGoBack),a=t.poppedPathname??Dt(1);S(a,{state:{...s.state,pathnameStackToGoBack:t.newStack}}),e(ue(""))},togglePageView:()=>{const t=H(s.state?.pathnameStackToGoBack),a=t.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(a,{state:{...he(s.state),pathnameStackToGoBack:t.newStack,message:"open_ai_cfo_drawer"}}),w(!0)},onCopy:()=>{},onThumbsUp:(t,a)=>{c!=null&&a?.messageId!=null&&e(ce(c,a.messageId,"positive",a.questionText,a.answerText))},onThumbsDown:(t,a)=>{c!=null&&a?.messageId!=null&&e(ce(c,a.messageId,"negative",a.questionText,a.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{e(J()),c!=null&&e(de());const t=nt(s.state?.pathnameStackToGoBack,s.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:t.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(t,a)=>{e(kt({questionAnswerId:t,isCollapsed:a}))},onMenuClick:o.onMenuClick,...ot(e,{isAiCardCreationEnabled:g,isCardPolicyEnabled:P,currentChatSessionId:c,onAfterCardsCreationSubmit:()=>{w(!0),S(`/${T}/cards`,{state:{...s.state}})},onAfterCardPolicySubmit:()=>{w(!0),S(`/${T}/cards/policy`,{state:{...s.state}})}})}}))(Xe(Ye)),os=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Ve(),s=Ue(),p=Le(),n=Fe(),[S,c]=l.useState(!1),C=_((i=>z(i).uiState.isSkillsBrowserOpen===!0)),g=_((i=>E(i).skillsEnabled)),P=l.useCallback((()=>{s(W()),s(lt())}),[s]),w=l.useCallback((()=>{s(J())}),[s]);l.useEffect((()=>{s(W())}),[s]);const{allUsers:T,isAiCardCreationEnabled:t,isCardPolicyEnabled:a,onCardPolicyVendorSearchTextChange:d}=Me();l.useEffect((()=>{s(rt())}),[s]);const u=_((i=>z(i))),h=$e.getSignedInUser(),{session_id:k}=Be(),A=Ne(),b=Je(A),f=_((i=>dt(i))),r=u.uiState.currentChatSessionId,K=f.tenantEmailDomain,{handleUploadPromoClose:Ce,isUploadPromoVisible:ke}=qe({isFileUploadEnabled:e,tenantEmailDomain:K}),D=Ge({currentTenant:f,currentChatSessionId:r,aiCfoView:u,skillsEnabled:g,onCloseSkills:w,onOpenSkills:P}),{isSuggestedQuestionsLoading:Ie,suggestedPromptQuestions:be}=_t(),Q=n.state,j=Q?.aiCfoInitialQuestion,X=!!Q?.aiCfoShouldSubmit;l.useEffect((()=>{const i=n.state;if(i?.[le]!==!0)return;c(!0);const I={...i};delete I[le],p(n,{replace:!0,state:I})}),[n.pathname,n.search,n.state,p]);const[ve,U]=l.useState(null),[Ee,L]=l.useState(!1),[Pe,F]=l.useState(void 0),[we,B]=l.useState(void 0),Y=l.useRef(!1);l.useEffect((()=>{if(!Y.current&&j!=null&&j!==""){const i=n.state;U(j),L(X),F(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const I=i?.aiCfoSuggestionIndex;B(typeof I=="number"?I:void 0),Y.current=!0}}),[j,X,n.state]);const xe=l.useCallback((()=>{U(null),L(!1),F(void 0),B(void 0),p(n.pathname,{replace:!0,state:he(n.state)})}),[n.pathname,n.state,p]),Z=l.useMemo((()=>new URLSearchParams(n.search)),[n.search]),ee=Z.get("ref")??Q?.aiCfoRef,R=Z.get("emailRefId")??Q?.aiCfoEmailRefId,te=l.useRef(!1);l.useEffect((()=>{te.current||ee!=="month-end-email"||R==null||r!=null||h==null||(s(ct("controller",h.userId,R,"MONTH_END_EMAIL")),te.current=!0)}),[ee,R,r,s,h]);const O=u.uiState.lastContextMessage;l.useEffect((()=>{O!=null&&O!==""&&r!=null&&(U(O),L(!0),F(void 0),B(void 0),s(ut()))}),[O,r,s]);const ye=f.masterTOSInfo,v=ye?.isMasterTOSAccepted??!1,{visitedSessions:se}=He(r),V=u.fetchState,M=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,ae=r!=null?u.fetchChatSessionHistoryByChatSessionId?.[r]?.fetchState??"Not-Started":"Not-Started",oe=r==null||(u.uiState.chatHistoryNextPageToken[r]?.hasMore??!0),ne=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Te}=ge(ne,r),Ae=Te.length===0;l.useEffect((()=>{v||b||p("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})}),[v,b,p,n.state]);const Qe=l.useCallback((()=>{const i=H(n.state?.pathnameStackToGoBack),I=f.tenantEmailDomain;p(i.poppedPathname??(I!=null?`/${I}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})}),[f.tenantEmailDomain,n.state,p]);l.useEffect((()=>{r!=null&&k!==r&&p(`../ai-cfo/${r}`,{state:{...n.state}})}),[r,k]),l.useEffect((()=>{k!=null&&r==null&&k!=="new_chat"&&k!=="explore"&&s(mt({sessionId:k,agentId:"controller"}))}),[]);const je=l.useMemo((()=>({events:se.map((i=>`private-encrypted-chat-${i}.${fe}`)),eventCallback:(i,I,De)=>De.onEventReceived(i,I)})),[se]);l.useEffect((()=>{V!=="In-Progress"&&M&&s(pt())}),[V,M,s]),l.useEffect((()=>{r!=null&&ae!=="In-Progress"&&oe&&h!=null&&V==="Completed"&&!M&&s(St(r,h.userId))}),[ae,oe,r,h,s]);const ie=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(h==null||k==null)throw Error("Can't access AI Controller page without signing in...");const Oe=r!=null&&u.responseStateByChatSessionId?.[r]?.answer?.fetchState==="In-Progress";if(!v&&b)return m.jsxs(Bt,{children:[m.jsx($,{analytics:x,onLoad:ie}),D.drawerElement,m.jsx(Rt,{children:m.jsx(Se,{children:m.jsx(N,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:Qe,onCompleteClick:()=>{f.userRoleId!=null&&s(q(f.userRoleId))}})})})]});const _e=m.jsxs(m.Fragment,{children:[S&&!v?m.jsx($,{analytics:x,onLoad:ie}):null,m.jsx(N,{isTOSAccepted:v,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:v?()=>c(!1):void 0,onCloseClick:()=>c(!1),onCompleteClick:()=>{v||f.userRoleId==null||s(q(f.userRoleId)),c(!1)}})]});return m.jsxs(m.Fragment,{children:[m.jsxs(Ft,{children:[m.jsx($,{analytics:x,onLoad:i=>i.trackPageLoaded(Ke.Event.aiCFOPage)}),b&&D.drawerElement,m.jsx(Lt,{...je,currentChatSessionId:r,allSessionsWithOrderedQuestionAnswers:ne,allUsers:T,isAiCardCreationEnabled:t,isCardPolicyEnabled:a,openOnboardingPage:()=>c(!0),userId:h.userId,setIsAiCfoOpen:o,navigate:p,sessionFromUrl:k,location:n,isSubmitting:Oe,isEmptyChatWithSession:Ae,currentTenant:f,emailLinkQuestion:ve??void 0,autoSubmitEmailLinkQuestion:Ee,onEmailLinkQuestionProcessed:xe,routedInitialQuestionSource:Pe,routedInitialQuestionSuggestionIndex:we,onCardPolicyVendorSearchTextChange:d,onMenuClick:b?D.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ke,onUploadPromoClose:Ce,exploreSuggestedPromptQuestions:be,exploreSuggestedPromptQuestionsLoading:Ie,isSkillsOpen:C,isCreateSkillEnabled:g,promoDismissalScope:K}),S&&b?m.jsx(Qt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:Vt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>c(!1),children:m.jsx(Se,{onClick:i=>i.stopPropagation(),children:m.jsx(N,{isTOSAccepted:v,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>c(!1),onCompleteClick:()=>{v||f.userRoleId==null||s(q(f.userRoleId)),c(!1)}})})}):null]}),S&&!b?m.jsx(ze,{open:S,onClose:()=>c(!1),children:m.jsx(We,{children:_e})}):null]})},Se=y(jt)`
1
+ import{j as m}from"./liveblocks-BeSMR7a1.js";import{a as l}from"./sentry-Uj7AWjah.js";import{u as Ue,h as Le,g as Fe,j as _,i as Be,l as Re}from"./core-BL7rYGUF.js";import{a as Ve,e2 as Me,z as $e,$ as Ne,e3 as qe,e4 as Ge,bm as le,e5 as he,e6 as He,bl as ge,a2 as H,a6 as $,h as x,e7 as N,e8 as ze,e9 as We,as as Je,N as Ke,w as Xe,ea as Ye,eb as Ze,at as et,ec as tt,ed as st,ee as at,ef as ot,p as nt,bi as re,eg as it}from"./index-E1NwyJIP.js";import{fA as z,gp as E,gx as W,Tq as lt,gr as J,gH as rt,fB as dt,j0 as ct,a1k as ut,g4 as mt,je as pt,ja as St,fC as q,gb as ht,a1l as gt,a1m as ft,a1n as Ct,jP as G,gq as kt,gk as de,k0 as ce,gm as ue,gs as It,a1o as me,jR as bt,j7 as vt,jl as Et,jN as pe,ji as Pt,jo as wt,gt as xt,gu as yt,gv as Tt,gw as At}from"./zeni-epic-state-CxdZGPla.js";import{D as Qt,n as y,S as jt,P as Ot}from"./mui-CPSuUssr.js";import{u as _t}from"./useAiCfoDashboardSuggestedQuestionsChips-DABf-MX6.js";import{p as Dt}from"./pathToGoBack-rem3sHLx.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="8eb2a734-cd67-46b6-b69a-5418237b214d",e._sentryDebugIdIdentifier="sentry-dbid-8eb2a734-cd67-46b6-b69a-5418237b214d")}catch{}})();const fe="chat-response-generated";function Ut(e,o){if(o.kind!=="save")return;if(o.fetchState==="In-Progress")return{status:"saving"};if(o.fetchState==="Error")return{status:"failed"};if(o.fetchState!=="Completed")return;const s=E(e).skills.find((p=>p.macroId===o.savedMacroId));return s==null?void 0:{status:"saved",command:s.name}}const Lt=Re((function(e,o){const s=z(e),p=o.isSubmitting,n=s.uiState?.currentChatSessionId,S=n!=null?ht(e.aiCfoState,n):[],c=Ze(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange}),C=gt(e),g=ft(e),P=Ct(e);return{showSampleQuestions:o.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:p,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${et}/tableDownload`,exportDownloadEndPoint:at(),emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,skills:E(e).skills,skillSaveState:Ut(e,P),skillsEnabled:E(e).skillsEnabled,skillsList:E(e).skills,skillsListError:E(e).fetchState==="Error",skillsListLoading:E(e).fetchState==="In-Progress",skillsCanPublish:E(e).canPublish,skillSaving:P.fetchState==="In-Progress",skillSaveError:P.fetchState==="Error",skillVersionHistory:C.macroId!=null?{macroId:C.macroId,versions:C.versions,error:C.fetchState==="Error",loading:C.fetchState==="In-Progress"}:void 0,skillRestoreBody:g.macroId!=null&&g.version!=null?{macroId:g.macroId,version:g.version,instructions:g.instructions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillDetail:G(e).detail,skillDetailError:G(e).fetchState==="Error",skillDetailLoading:G(e).fetchState==="In-Progress",syntheticAnswers:S,resolveSyntheticAnswerCardTile:st(e),resolveSyntheticAnswerPolicyTile:tt(e),...c}}),(function(e,o){const{location:s,currentTenant:p,userId:n,navigate:S,currentChatSessionId:c,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:g,isCardPolicyEnabled:P,setIsAiCfoOpen:w}=o,T=p.tenantEmailDomain;return{onEventReceived:(t,a)=>{if(t===fe&&typeof a.text=="string"&&typeof a.metadata=="object"){const d=a,u=xt(d.type),h=d.metadata.chat_session_id??null,{currentChatSession:k,currentQuestionAnswer:A,currentQuestionAnswerSummary:b}=ge(C,h);u!=="answer"?x.trackAICFOChatResponseGenerated(u,A?.question.questionText??"",d.text,h,it(b,k),d.metadata.message_id??null):x.trackAICFOChatAnswerGenerated(d.text,A?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,yt(d.visualization?.type??"")??null,h,d.summarized_title,d.metadata.message_id??null),e(Tt({chatSessionId:d.metadata.chat_session_id,responseType:u,fetchState:{fetchState:"Completed",error:void 0}})),e(At({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:n}))}},onSubmit:(t,a,d,u,h)=>{t&&re(e,t,a,c,C,n,u,d,void 0,h)},onFetchSkills:()=>{e(W())},onOpenSkill:t=>{e(Pt({macroId:t})),e(wt({macroId:t}))},onSaveSkill:(t,a)=>{e(pe({draft:t,macroId:a}))},onSaveSkillDraft:t=>{const a=t.displayName?.trim()??"",d=t.name?.trim()??"";e(pe({draft:{name:a.length>0?a:d,description:t.description?.trim()??null,instructions:t.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(t,a)=>{e(Et({macroId:t,version:a}))},onDeleteSkill:t=>{e(vt({macroId:t}))},onSetSkillVisibility:(t,a)=>{e(bt({macroId:t,visibility:a}))},onCloseSkillDetail:()=>{e(me())},onRunSkill:(t,a)=>{e(J()),e(de()),re(e,a,"user_input",void 0,C,n,void 0,void 0,void 0,t),e(me())},updateCurrentInput:t=>{e(ue(t))},onStopSubmit:()=>{},onUpdateScrollYOffset:t=>{e(It(t))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const t=H(s.state?.pathnameStackToGoBack),a=t.poppedPathname??Dt(1);S(a,{state:{...s.state,pathnameStackToGoBack:t.newStack}}),e(ue(""))},togglePageView:()=>{const t=H(s.state?.pathnameStackToGoBack),a=t.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(a,{state:{...he(s.state),pathnameStackToGoBack:t.newStack,message:"open_ai_cfo_drawer"}}),w(!0)},onCopy:()=>{},onThumbsUp:(t,a)=>{c!=null&&a?.messageId!=null&&e(ce(c,a.messageId,"positive",a.questionText,a.answerText))},onThumbsDown:(t,a)=>{c!=null&&a?.messageId!=null&&e(ce(c,a.messageId,"negative",a.questionText,a.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{e(J()),c!=null&&e(de());const t=nt(s.state?.pathnameStackToGoBack,s.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:t.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(t,a)=>{e(kt({questionAnswerId:t,isCollapsed:a}))},onMenuClick:o.onMenuClick,...ot(e,{isAiCardCreationEnabled:g,isCardPolicyEnabled:P,currentChatSessionId:c,onAfterCardsCreationSubmit:()=>{w(!0),S(`/${T}/cards`,{state:{...s.state}})},onAfterCardPolicySubmit:()=>{w(!0),S(`/${T}/cards/policy`,{state:{...s.state}})}})}}))(Xe(Ye)),os=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Ve(),s=Ue(),p=Le(),n=Fe(),[S,c]=l.useState(!1),C=_((i=>z(i).uiState.isSkillsBrowserOpen===!0)),g=_((i=>E(i).skillsEnabled)),P=l.useCallback((()=>{s(W()),s(lt())}),[s]),w=l.useCallback((()=>{s(J())}),[s]);l.useEffect((()=>{s(W())}),[s]);const{allUsers:T,isAiCardCreationEnabled:t,isCardPolicyEnabled:a,onCardPolicyVendorSearchTextChange:d}=Me();l.useEffect((()=>{s(rt())}),[s]);const u=_((i=>z(i))),h=$e.getSignedInUser(),{session_id:k}=Be(),A=Ne(),b=Je(A),f=_((i=>dt(i))),r=u.uiState.currentChatSessionId,K=f.tenantEmailDomain,{handleUploadPromoClose:Ce,isUploadPromoVisible:ke}=qe({isFileUploadEnabled:e,tenantEmailDomain:K}),D=Ge({currentTenant:f,currentChatSessionId:r,aiCfoView:u,skillsEnabled:g,onCloseSkills:w,onOpenSkills:P}),{isSuggestedQuestionsLoading:Ie,suggestedPromptQuestions:be}=_t(),Q=n.state,j=Q?.aiCfoInitialQuestion,X=!!Q?.aiCfoShouldSubmit;l.useEffect((()=>{const i=n.state;if(i?.[le]!==!0)return;c(!0);const I={...i};delete I[le],p(n,{replace:!0,state:I})}),[n.pathname,n.search,n.state,p]);const[ve,U]=l.useState(null),[Ee,L]=l.useState(!1),[Pe,F]=l.useState(void 0),[we,B]=l.useState(void 0),Y=l.useRef(!1);l.useEffect((()=>{if(!Y.current&&j!=null&&j!==""){const i=n.state;U(j),L(X),F(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const I=i?.aiCfoSuggestionIndex;B(typeof I=="number"?I:void 0),Y.current=!0}}),[j,X,n.state]);const xe=l.useCallback((()=>{U(null),L(!1),F(void 0),B(void 0),p(n.pathname,{replace:!0,state:he(n.state)})}),[n.pathname,n.state,p]),Z=l.useMemo((()=>new URLSearchParams(n.search)),[n.search]),ee=Z.get("ref")??Q?.aiCfoRef,R=Z.get("emailRefId")??Q?.aiCfoEmailRefId,te=l.useRef(!1);l.useEffect((()=>{te.current||ee!=="month-end-email"||R==null||r!=null||h==null||(s(ct("controller",h.userId,R,"MONTH_END_EMAIL")),te.current=!0)}),[ee,R,r,s,h]);const O=u.uiState.lastContextMessage;l.useEffect((()=>{O!=null&&O!==""&&r!=null&&(U(O),L(!0),F(void 0),B(void 0),s(ut()))}),[O,r,s]);const ye=f.masterTOSInfo,v=ye?.isMasterTOSAccepted??!1,{visitedSessions:se}=He(r),V=u.fetchState,M=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,ae=r!=null?u.fetchChatSessionHistoryByChatSessionId?.[r]?.fetchState??"Not-Started":"Not-Started",oe=r==null||(u.uiState.chatHistoryNextPageToken[r]?.hasMore??!0),ne=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Te}=ge(ne,r),Ae=Te.length===0;l.useEffect((()=>{v||b||p("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})}),[v,b,p,n.state]);const Qe=l.useCallback((()=>{const i=H(n.state?.pathnameStackToGoBack),I=f.tenantEmailDomain;p(i.poppedPathname??(I!=null?`/${I}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})}),[f.tenantEmailDomain,n.state,p]);l.useEffect((()=>{r!=null&&k!==r&&p(`../ai-cfo/${r}`,{state:{...n.state}})}),[r,k]),l.useEffect((()=>{k!=null&&r==null&&k!=="new_chat"&&k!=="explore"&&s(mt({sessionId:k,agentId:"controller"}))}),[]);const je=l.useMemo((()=>({events:se.map((i=>`private-encrypted-chat-${i}.${fe}`)),eventCallback:(i,I,De)=>De.onEventReceived(i,I)})),[se]);l.useEffect((()=>{V!=="In-Progress"&&M&&s(pt())}),[V,M,s]),l.useEffect((()=>{r!=null&&ae!=="In-Progress"&&oe&&h!=null&&V==="Completed"&&!M&&s(St(r,h.userId))}),[ae,oe,r,h,s]);const ie=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(h==null||k==null)throw Error("Can't access AI Controller page without signing in...");const Oe=r!=null&&u.responseStateByChatSessionId?.[r]?.answer?.fetchState==="In-Progress";if(!v&&b)return m.jsxs(Bt,{children:[m.jsx($,{analytics:x,onLoad:ie}),D.drawerElement,m.jsx(Rt,{children:m.jsx(Se,{children:m.jsx(N,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:Qe,onCompleteClick:()=>{f.userRoleId!=null&&s(q(f.userRoleId))}})})})]});const _e=m.jsxs(m.Fragment,{children:[S&&!v?m.jsx($,{analytics:x,onLoad:ie}):null,m.jsx(N,{isTOSAccepted:v,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:v?()=>c(!1):void 0,onCloseClick:()=>c(!1),onCompleteClick:()=>{v||f.userRoleId==null||s(q(f.userRoleId)),c(!1)}})]});return m.jsxs(m.Fragment,{children:[m.jsxs(Ft,{children:[m.jsx($,{analytics:x,onLoad:i=>i.trackPageLoaded(Ke.Event.aiCFOPage)}),b&&D.drawerElement,m.jsx(Lt,{...je,currentChatSessionId:r,allSessionsWithOrderedQuestionAnswers:ne,allUsers:T,isAiCardCreationEnabled:t,isCardPolicyEnabled:a,openOnboardingPage:()=>c(!0),userId:h.userId,setIsAiCfoOpen:o,navigate:p,sessionFromUrl:k,location:n,isSubmitting:Oe,isEmptyChatWithSession:Ae,currentTenant:f,emailLinkQuestion:ve??void 0,autoSubmitEmailLinkQuestion:Ee,onEmailLinkQuestionProcessed:xe,routedInitialQuestionSource:Pe,routedInitialQuestionSuggestionIndex:we,onCardPolicyVendorSearchTextChange:d,onMenuClick:b?D.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ke,onUploadPromoClose:Ce,exploreSuggestedPromptQuestions:be,exploreSuggestedPromptQuestionsLoading:Ie,isSkillsOpen:C,isCreateSkillEnabled:g,promoDismissalScope:K}),S&&b?m.jsx(Qt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:Vt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>c(!1),children:m.jsx(Se,{onClick:i=>i.stopPropagation(),children:m.jsx(N,{isTOSAccepted:v,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>c(!1),onCompleteClick:()=>{v||f.userRoleId==null||s(q(f.userRoleId)),c(!1)}})})}):null]}),S&&!b?m.jsx(ze,{open:S,onClose:()=>c(!1),children:m.jsx(We,{children:_e})}):null]})},Se=y(jt)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as l}from"./liveblocks-BkTNzfNi.js";import{a as n,R as ba}from"./sentry-CNLjKkQW.js";import{u as Ae,j as r,g as Sa,h as ka,q as j}from"./core-DuNHGHBC.js";import{fB as _e,Tc as Ea,Td as De,g5 as wa,gr as K,gx as ke,Te as Ta,Tf as ya,gL as va,pX as Ia,Tg as Ba,Th as Ee,gi as $a,Ti as I,fA as xa,gp as Aa,Tj as _a,Tk as we,Tl as Da,Tm as Te,Tn as Fa,Dr as Ma,gj as Za,g_ as Ga,cS as ja,To as Ha,Tp as La,qy as Va,g4 as Na,j3 as Pa,Tq as Ra,vR as Oa,gk as Ua}from"./zeni-epic-state-IKQP0lNP.js";import{w as za,i as qa,a as Ya,U as Ka,E as Wa,O as Xa,y as C,c as Ja,u as Qa,d as et,n as at,e as tt,f as nt,g as ot,z as st,h as H,p as g,m as ye,j as rt,K as it,k as ve,l as lt,Y as Ie,o as dt,q as ct,r as W,s as Be,v as ut,x as Ct,A as mt,L as pt,B as ht,C as ft,D as X,F as gt,Z as bt}from"./index-CxkwDRG8.js";import{A as St,b as kt,I as Et,a as $e,d as wt,D as xe}from"./mui-DaLeH41l.js";import{u as Tt}from"./InboxNotificationsProvider-DBc6Mphu.js";import{u as yt}from"./useTaskManagerAccess-CgZlooKP.js";import{u as vt}from"./expenseAutomationHelper-DGi7tuOw.js";import"./recharts-CkuQpH_L.js";import"./analytics-DHBkdK00.js";import"./plaid-BVNoSR_u.js";import"./dnd-DKR3QBLX.js";import"./stripe-cKAAJElX.js";import"./lottie-DACJJNY9.js";import"./lexical-CcqvVKiN.js";import"./pdf-BjtwR-dW.js";import"./utils-BN2UhEgk.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},m=new a.Error().stack;m&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[m]="3cb892f2-d034-4a79-aa0f-2e795650f2d7",a._sentryDebugIdIdentifier="sentry-dbid-3cb892f2-d034-4a79-aa0f-2e795650f2d7")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},It=X("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:W,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"}}))),Bt=za((function({tenantEmailDomain:a}){const{isAiCfoOpen:m,setIsAiCfoOpen:b}=Ya(),[L,A]=ba.useState(!1),[S,Fe]=n.useState(!1),t=Sa(),i=ka(),J=wa(),Q=Ka(),o=Ae(),[Me,Ze]=n.useState(!1),V=Wa(),ee=t.pathname.includes("/ai-cfo/");n.useEffect((()=>{ee||o(K())}),[o,ee]),n.useEffect((()=>{o(K())}),[o,a]);const{useFeatureGate:u}=Xa(),{isFeatureEnabled:ae}=u(C.isDebitCardFeatureEnabled),k=Ja(),s=r((e=>_e(e))),te=s.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ge}=Qa(),$=et(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=yt(k),ne=at(),E=tt();n.useEffect((()=>{E&&$&&o(ke())}),[o,E,s.tenantId,$]);const[N,He]=n.useState(void 0),Le=!!s.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ve}=u(C.isChargeCardFeatureEnabled),Ne=nt(s,Ve,ae),{isFeatureEnabled:Pe}=u(C.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(C.isReferralFeatureEnabled),Re=s.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",oe=r((e=>Ta(e)));n.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>ya(e))),p=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),h=r((e=>va(e))),{monthEndCloseChecksView:w}=h,Oe=j("/signout")!==null,F=j("/:tenantEmailDomain/dashboard")!==null,se=j("/:tenantEmailDomain/reports")!==null,f=j("/:tenantEmailDomain/onboarding/*")!==null,re=vt();n.useEffect((()=>{E&&D&&!f&&P.fetchState==="Not-Started"&&o(Ia(!0))}),[E,D,P.fetchState,f]),n.useEffect((()=>{if(re){const e=t.state?.origin;if(e!=null){const d=Ba(e);d!=null&&o(Ee(d))}}}),[re,t.state]);const Ue=Oe||f,R=r((e=>e.tenantState)),ze=r((e=>R.fetchState==="Completed"?$a(e):[])),{isFeatureEnabled:qe}=u(C.isApAgingFeatureEnabled),{isFeatureEnabled:Ye}=u(C.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=u(C.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:We}=u(C.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Xe}=u(C.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Je}=u(C.isDashboardSidebarNewYearAnimationEnabled),Qe=r((e=>I(e).totalUnreadCount)),ea=r((e=>I(e).notificationDetailsByTab.tasks.uiState.unreadCount)),aa=r((e=>I(e).notificationDetailsByTab.comments.uiState.unreadCount)),ta=r((e=>I(e).reducedFetchCountState)),ie=r((e=>I(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>xa(e))),na=r((e=>Aa(e).skillsEnabled)),{status:le}=r(_a),[T,U]=n.useState(void 0),z=O.uiState.currentChatSessionId,M=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,de=ot(M),{inboxNotifications:q,isLoading:ce,isFetchingMore:ue,hasFetchedAll:Ce,fetchMore:oa}=Tt(),Z=r((e=>I(e).notificationDetailsByTab.comments.fetchCountState));n.useEffect((()=>{const e=setTimeout((()=>oa?.()),0);return()=>clearTimeout(e)})),n.useEffect((()=>{if(T!=null)return de==="In-Progress"&&M==="Completed"?(o(we({chatSessionId:T})),U(void 0),void i(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(M==="Error"&&(o(we({chatSessionId:T})),U(void 0)))}),[o,t.state,i,M,T,de,a]),n.useEffect((()=>{if(ce===!1&&ue===!1&&Ce===!0&&s?.companyId!=null&&q!=null){const e=`dashboard_${s.companyId}`;He(q.filter((d=>d.roomId===e&&d.readAt==null)).length)}}),[ce,ue,Ce,s?.companyId,q]),n.useEffect((()=>{E&&_&&!f&&ie.fetchState==="Not-Started"&&J.tenantId!=null&&o(Da("task_manager","dashboard"))}),[E,_,f,ie.fetchState,J.tenantId,o]),n.useEffect((()=>{f||Z.fetchState!=="Not-Started"||o(Te({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,Z.fetchState,o]),n.useEffect((()=>{if(N!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&o(Te({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(De({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const sa={fetchStatus:ta,count:Qe},y=[];qe===!1&&y.push("accounts_payable_aging"),Ye===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),ne===!1&&y.push("expense_automation_card");const me=r((e=>Fa(e,y).fetchState)),pe=r((e=>Ma(e).fetchState)),he=a!=null?st.getSignedInUserTenant(a):null,fe=r((e=>he?.tenantId!=null?Za(e,he.tenantId):void 0)),ra=F&&(me==="Completed"||me==="Error")||se&&(pe==="Completed"||pe==="Error")||!F&&!se?void 0:"disabled",ia=n.useMemo((()=>Ga(s.userRole)),[s.userRole]),la=ja(ia),v=e=>{A(e)},da=Re,ca=s?.rewardsLastViewedTime==null,ua=k?.userEmail!=null&&oe.fetchState==="Completed"&&Ha(oe.notificationSettings,k.userEmail,ae,s,_),Ca=n.useCallback((e=>{const d=t.state?.referrer;if(w.monthEndCloseChecks?.auditSummary!=null&&H.trackMonthCloseAuditPage(e.month,e.year,w.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",w.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null),o(La(s.tenantId,e)),p[s.tenantId]!=null){const x=g(t.state?.pathnameStackToGoBack,t.pathname);i(`/${a}/month_end_close_checks/review/${h.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:h.currentSelectedView}})}o(Ee(h.currentSelectedView)),h.reconciliation.selectedAccountId!=null&&o(Va({selectedAccountId:void 0}))}),[h.reconciliation.selectedAccountId,h.currentSelectedView,s.tenantId,w.monthEndCloseChecks?.auditSummary,w.monthEndCloseChecks?.reportEmailSentDate,p,a,t.state,t.pathname]),ma=n.useMemo((()=>({zIndex:S?12:ye[2]})),[S]),pa=$&&rt(t),ge=l.jsx(it,{signedInUser:k,currentTenantId:R.currentTenantId??"",tenants:R.fetchState==="Completed"?ze:fe!=null?[fe]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ca,rewardsPlan:P.rewardsPlan},selectedMenu:m===!0?Ie("ai_cfo"):ve(t)&&le!=="completed"?Ie("invoicing"):dt(t),isTenantDropdownDisabled:ra,isSettings:lt(t),isInvoicing:ve(t)&&le==="completed",isSettingsFeatureEnabled:Pe,currentTenant:s,isVendorsTabVisible:la,isZeniAccountEnabled:Le,isChargeCardEnabled:Ne,isTreasuryEnabled:da,isNotificationsTabVisible:ua,notificationCountDetails:sa,isExpenseAutomationEnabledForUser:ne,isAiCfoAccessEnabled:$,skillsEnabled:na&&$,onNotificationIconClick:()=>{v(!1);const e=je?ea===0&&aa>0?"notifications/comments":"notifications/tasks":"notifications/comments",d=g(t.state?.pathnameStackToGoBack,t.pathname);i(`${a}/${e}`,{state:{pathnameStackToGoBack:d}})},onZeniLogoClick:()=>{Q.toggle()},handleTenantSelect:e=>{Ge(pt.TENANT_SWITCHING),v(!1),ht({dispatch:o,navigate:i,pathToNavigate:ft(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,d)=>{if(k!=null&&H.trackSidePanelClicked(e.type,e.group),v(!1),a==null)return;if(e.type==="skills")return te?(o(ke()),o(Ra()),void i(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:g(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Be({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});if(o(K()),e.type==="invoicing")return m&&b(!1),o(Oa({cacheOverride:!1})),void i(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:g(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(m&&ut(e.type)&&b(!1),e.type==="ai_cfo"){if(H.trackAICFOChatScreenStateChanged("viewed","left_menu",z??null,null),!te)return void Be({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});const G=g(t.state?.pathnameStackToGoBack,t.pathname);return void i(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=g(t.state?.pathnameStackToGoBack,t.pathname),Y=e.type,Se=bt(Y)&&Y!=="command_center";if(Y!=="command_center"&&!Se||p[s.tenantId]==null||H.trackMonthEndCloseClicked(p[s.tenantId].month,p[s.tenantId].year,"Sidebar"),Se&&p[s.tenantId]!=null){const G=p[s.tenantId];return void i(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:d,referrer:"Sidebar"}})}const ga=Ct(e.type);mt(e.type)?(z!=null&&o(Ua()),i(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:d,referrer:"Sidebar"}})):i(`../${a}/${ga}`,{state:{pathnameStackToGoBack:x,message:d,referrer:"Sidebar"}})},onDeleteChatSession:e=>{o(Pa(e)),z===e&&U(e)},handleLogOutClick:()=>{v(!1);const e=g(t.state?.pathnameStackToGoBack,t.pathname);i("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{i(`${a}/settings/my_profile`)},handleReferralsClick:()=>{i(`${a}/rewards/refer`)},handleBackClick:()=>{i(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:w,onPeriodChange:Ca,onCalendarOpen:Fe,aiCfoView:O,isAiCfo:pa,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{o(Na({sessionId:e,agentId:"controller"})),i(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Ke,thanksGivingAnimationEnabled:We,christmasAnimationEnabled:Xe,newYearAnimationEnabled:Je}),ha=l.jsx(St,{position:"fixed",className:c.appBar,style:{borderBottom:Me?`1px solid ${V.colors.grey2}`:""},children:l.jsxs(kt,{style:{minHeight:ct},children:[l.jsx(Et,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>v(!0),className:c.menuButton,size:"large",children:l.jsx($t,{})}),l.jsx(xt,{className:c.appBarZenilogo,onClick:()=>{Q.toggle()}})]})}),be=$e((e=>e.breakpoints.up("md"))),fa=$e((e=>e.breakpoints.down("md")));return a==null?null:l.jsxs(It,{className:c.root,children:[l.jsx(wt,{}),Ue===!1?l.jsxs(l.Fragment,{children:[be||!F?null:ha,l.jsxs("nav",{className:c.drawer,children:[be?null:l.jsx(xe,{container:window.document.body,variant:"temporary",open:L,onClose:()=>v(!1),PaperProps:{sx:{width:W,zIndex:ye[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ge}),fa?null:l.jsx(xe,{PaperProps:{sx:{width:W,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ma}},variant:"permanent",open:!0,children:ge})]})]}):null]})})),Yt=({tenantEmailDomain:a})=>{const m=Ae(),b=r((A=>_e(A))),L={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{qa(S)&&Ea(S.mode)==="dashboard"&&m(De({unreadCount:S.data.unread},"tasks"))}};return l.jsx(Bt,{tenantEmailDomain:a,...L})},$t=X((a=>n.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},n.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 l}from"./liveblocks-BeSMR7a1.js";import{a as n,R as ba}from"./sentry-Uj7AWjah.js";import{u as Ae,j as r,g as Sa,h as ka,q as j}from"./core-BL7rYGUF.js";import{fB as _e,Tc as Ea,Td as De,g5 as wa,gr as K,gx as ke,Te as Ta,Tf as ya,gL as va,pX as Ia,Tg as Ba,Th as Ee,gi as $a,Ti as I,fA as xa,gp as Aa,Tj as _a,Tk as we,Tl as Da,Tm as Te,Tn as Fa,Dr as Ma,gj as Za,g_ as Ga,cS as ja,To as Ha,Tp as La,qy as Va,g4 as Na,j3 as Pa,Tq as Ra,vR as Oa,gk as Ua}from"./zeni-epic-state-CxdZGPla.js";import{w as za,i as qa,a as Ya,U as Ka,E as Wa,O as Xa,y as C,c as Ja,u as Qa,d as et,n as at,e as tt,f as nt,g as ot,z as st,h as H,p as g,m as ye,j as rt,K as it,k as ve,l as lt,Y as Ie,o as dt,q as ct,r as W,s as Be,v as ut,x as Ct,A as mt,L as pt,B as ht,C as ft,D as X,F as gt,Z as bt}from"./index-E1NwyJIP.js";import{A as St,b as kt,I as Et,a as $e,d as wt,D as xe}from"./mui-CPSuUssr.js";import{u as Tt}from"./InboxNotificationsProvider-BH2D62uC.js";import{u as yt}from"./useTaskManagerAccess-BVyRgvZH.js";import{u as vt}from"./expenseAutomationHelper-DfYMglD1.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},m=new a.Error().stack;m&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[m]="3cb892f2-d034-4a79-aa0f-2e795650f2d7",a._sentryDebugIdIdentifier="sentry-dbid-3cb892f2-d034-4a79-aa0f-2e795650f2d7")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},It=X("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:W,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"}}))),Bt=za((function({tenantEmailDomain:a}){const{isAiCfoOpen:m,setIsAiCfoOpen:b}=Ya(),[L,A]=ba.useState(!1),[S,Fe]=n.useState(!1),t=Sa(),i=ka(),J=wa(),Q=Ka(),o=Ae(),[Me,Ze]=n.useState(!1),V=Wa(),ee=t.pathname.includes("/ai-cfo/");n.useEffect((()=>{ee||o(K())}),[o,ee]),n.useEffect((()=>{o(K())}),[o,a]);const{useFeatureGate:u}=Xa(),{isFeatureEnabled:ae}=u(C.isDebitCardFeatureEnabled),k=Ja(),s=r((e=>_e(e))),te=s.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ge}=Qa(),$=et(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=yt(k),ne=at(),E=tt();n.useEffect((()=>{E&&$&&o(ke())}),[o,E,s.tenantId,$]);const[N,He]=n.useState(void 0),Le=!!s.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ve}=u(C.isChargeCardFeatureEnabled),Ne=nt(s,Ve,ae),{isFeatureEnabled:Pe}=u(C.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(C.isReferralFeatureEnabled),Re=s.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",oe=r((e=>Ta(e)));n.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>ya(e))),p=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),h=r((e=>va(e))),{monthEndCloseChecksView:w}=h,Oe=j("/signout")!==null,F=j("/:tenantEmailDomain/dashboard")!==null,se=j("/:tenantEmailDomain/reports")!==null,f=j("/:tenantEmailDomain/onboarding/*")!==null,re=vt();n.useEffect((()=>{E&&D&&!f&&P.fetchState==="Not-Started"&&o(Ia(!0))}),[E,D,P.fetchState,f]),n.useEffect((()=>{if(re){const e=t.state?.origin;if(e!=null){const d=Ba(e);d!=null&&o(Ee(d))}}}),[re,t.state]);const Ue=Oe||f,R=r((e=>e.tenantState)),ze=r((e=>R.fetchState==="Completed"?$a(e):[])),{isFeatureEnabled:qe}=u(C.isApAgingFeatureEnabled),{isFeatureEnabled:Ye}=u(C.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=u(C.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:We}=u(C.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Xe}=u(C.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Je}=u(C.isDashboardSidebarNewYearAnimationEnabled),Qe=r((e=>I(e).totalUnreadCount)),ea=r((e=>I(e).notificationDetailsByTab.tasks.uiState.unreadCount)),aa=r((e=>I(e).notificationDetailsByTab.comments.uiState.unreadCount)),ta=r((e=>I(e).reducedFetchCountState)),ie=r((e=>I(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>xa(e))),na=r((e=>Aa(e).skillsEnabled)),{status:le}=r(_a),[T,U]=n.useState(void 0),z=O.uiState.currentChatSessionId,M=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,de=ot(M),{inboxNotifications:q,isLoading:ce,isFetchingMore:ue,hasFetchedAll:Ce,fetchMore:oa}=Tt(),Z=r((e=>I(e).notificationDetailsByTab.comments.fetchCountState));n.useEffect((()=>{const e=setTimeout((()=>oa?.()),0);return()=>clearTimeout(e)})),n.useEffect((()=>{if(T!=null)return de==="In-Progress"&&M==="Completed"?(o(we({chatSessionId:T})),U(void 0),void i(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(M==="Error"&&(o(we({chatSessionId:T})),U(void 0)))}),[o,t.state,i,M,T,de,a]),n.useEffect((()=>{if(ce===!1&&ue===!1&&Ce===!0&&s?.companyId!=null&&q!=null){const e=`dashboard_${s.companyId}`;He(q.filter((d=>d.roomId===e&&d.readAt==null)).length)}}),[ce,ue,Ce,s?.companyId,q]),n.useEffect((()=>{E&&_&&!f&&ie.fetchState==="Not-Started"&&J.tenantId!=null&&o(Da("task_manager","dashboard"))}),[E,_,f,ie.fetchState,J.tenantId,o]),n.useEffect((()=>{f||Z.fetchState!=="Not-Started"||o(Te({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,Z.fetchState,o]),n.useEffect((()=>{if(N!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&o(Te({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(De({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const sa={fetchStatus:ta,count:Qe},y=[];qe===!1&&y.push("accounts_payable_aging"),Ye===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),ne===!1&&y.push("expense_automation_card");const me=r((e=>Fa(e,y).fetchState)),pe=r((e=>Ma(e).fetchState)),he=a!=null?st.getSignedInUserTenant(a):null,fe=r((e=>he?.tenantId!=null?Za(e,he.tenantId):void 0)),ra=F&&(me==="Completed"||me==="Error")||se&&(pe==="Completed"||pe==="Error")||!F&&!se?void 0:"disabled",ia=n.useMemo((()=>Ga(s.userRole)),[s.userRole]),la=ja(ia),v=e=>{A(e)},da=Re,ca=s?.rewardsLastViewedTime==null,ua=k?.userEmail!=null&&oe.fetchState==="Completed"&&Ha(oe.notificationSettings,k.userEmail,ae,s,_),Ca=n.useCallback((e=>{const d=t.state?.referrer;if(w.monthEndCloseChecks?.auditSummary!=null&&H.trackMonthCloseAuditPage(e.month,e.year,w.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",w.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null),o(La(s.tenantId,e)),p[s.tenantId]!=null){const x=g(t.state?.pathnameStackToGoBack,t.pathname);i(`/${a}/month_end_close_checks/review/${h.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:h.currentSelectedView}})}o(Ee(h.currentSelectedView)),h.reconciliation.selectedAccountId!=null&&o(Va({selectedAccountId:void 0}))}),[h.reconciliation.selectedAccountId,h.currentSelectedView,s.tenantId,w.monthEndCloseChecks?.auditSummary,w.monthEndCloseChecks?.reportEmailSentDate,p,a,t.state,t.pathname]),ma=n.useMemo((()=>({zIndex:S?12:ye[2]})),[S]),pa=$&&rt(t),ge=l.jsx(it,{signedInUser:k,currentTenantId:R.currentTenantId??"",tenants:R.fetchState==="Completed"?ze:fe!=null?[fe]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ca,rewardsPlan:P.rewardsPlan},selectedMenu:m===!0?Ie("ai_cfo"):ve(t)&&le!=="completed"?Ie("invoicing"):dt(t),isTenantDropdownDisabled:ra,isSettings:lt(t),isInvoicing:ve(t)&&le==="completed",isSettingsFeatureEnabled:Pe,currentTenant:s,isVendorsTabVisible:la,isZeniAccountEnabled:Le,isChargeCardEnabled:Ne,isTreasuryEnabled:da,isNotificationsTabVisible:ua,notificationCountDetails:sa,isExpenseAutomationEnabledForUser:ne,isAiCfoAccessEnabled:$,skillsEnabled:na&&$,onNotificationIconClick:()=>{v(!1);const e=je?ea===0&&aa>0?"notifications/comments":"notifications/tasks":"notifications/comments",d=g(t.state?.pathnameStackToGoBack,t.pathname);i(`${a}/${e}`,{state:{pathnameStackToGoBack:d}})},onZeniLogoClick:()=>{Q.toggle()},handleTenantSelect:e=>{Ge(pt.TENANT_SWITCHING),v(!1),ht({dispatch:o,navigate:i,pathToNavigate:ft(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,d)=>{if(k!=null&&H.trackSidePanelClicked(e.type,e.group),v(!1),a==null)return;if(e.type==="skills")return te?(o(ke()),o(Ra()),void i(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:g(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Be({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});if(o(K()),e.type==="invoicing")return m&&b(!1),o(Oa({cacheOverride:!1})),void i(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:g(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(m&&ut(e.type)&&b(!1),e.type==="ai_cfo"){if(H.trackAICFOChatScreenStateChanged("viewed","left_menu",z??null,null),!te)return void Be({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});const G=g(t.state?.pathnameStackToGoBack,t.pathname);return void i(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=g(t.state?.pathnameStackToGoBack,t.pathname),Y=e.type,Se=bt(Y)&&Y!=="command_center";if(Y!=="command_center"&&!Se||p[s.tenantId]==null||H.trackMonthEndCloseClicked(p[s.tenantId].month,p[s.tenantId].year,"Sidebar"),Se&&p[s.tenantId]!=null){const G=p[s.tenantId];return void i(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:d,referrer:"Sidebar"}})}const ga=Ct(e.type);mt(e.type)?(z!=null&&o(Ua()),i(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:d,referrer:"Sidebar"}})):i(`../${a}/${ga}`,{state:{pathnameStackToGoBack:x,message:d,referrer:"Sidebar"}})},onDeleteChatSession:e=>{o(Pa(e)),z===e&&U(e)},handleLogOutClick:()=>{v(!1);const e=g(t.state?.pathnameStackToGoBack,t.pathname);i("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{i(`${a}/settings/my_profile`)},handleReferralsClick:()=>{i(`${a}/rewards/refer`)},handleBackClick:()=>{i(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:w,onPeriodChange:Ca,onCalendarOpen:Fe,aiCfoView:O,isAiCfo:pa,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{o(Na({sessionId:e,agentId:"controller"})),i(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Ke,thanksGivingAnimationEnabled:We,christmasAnimationEnabled:Xe,newYearAnimationEnabled:Je}),ha=l.jsx(St,{position:"fixed",className:c.appBar,style:{borderBottom:Me?`1px solid ${V.colors.grey2}`:""},children:l.jsxs(kt,{style:{minHeight:ct},children:[l.jsx(Et,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>v(!0),className:c.menuButton,size:"large",children:l.jsx($t,{})}),l.jsx(xt,{className:c.appBarZenilogo,onClick:()=>{Q.toggle()}})]})}),be=$e((e=>e.breakpoints.up("md"))),fa=$e((e=>e.breakpoints.down("md")));return a==null?null:l.jsxs(It,{className:c.root,children:[l.jsx(wt,{}),Ue===!1?l.jsxs(l.Fragment,{children:[be||!F?null:ha,l.jsxs("nav",{className:c.drawer,children:[be?null:l.jsx(xe,{container:window.document.body,variant:"temporary",open:L,onClose:()=>v(!1),PaperProps:{sx:{width:W,zIndex:ye[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ge}),fa?null:l.jsx(xe,{PaperProps:{sx:{width:W,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ma}},variant:"permanent",open:!0,children:ge})]})]}):null]})})),Yt=({tenantEmailDomain:a})=>{const m=Ae(),b=r((A=>_e(A))),L={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{qa(S)&&Ea(S.mode)==="dashboard"&&m(De({unreadCount:S.data.unread},"tasks"))}};return l.jsx(Bt,{tenantEmailDomain:a,...L})},$t=X((a=>n.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},n.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-BkTNzfNi.js";import{a as d}from"./sentry-CNLjKkQW.js";import{h as U,g as B,u as j,j as y,N as G,l as V,i as W,n as te,o as x}from"./core-DuNHGHBC.js";import{fB as P,Y8 as w,XR as R,G_ as E,GS as q,GW as A,GL as X,XT as H,GP as ae,H0 as oe,GO as K,H3 as Y,G$ as C}from"./zeni-epic-state-IKQP0lNP.js";import{z as O,w as z,bW as pe,l as T,bQ as Q,bX as le,E as Z,a5 as J,bY as se,bZ as ne}from"./index-CxkwDRG8.js";import"./mui-DaLeH41l.js";import{u as M,i as re}from"./ReimbursementApprovalRuleDetailScreen-XQSOHGYn.js";import ie from"./NotFoundScreen-DjDyDYWZ.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]="697c1fdc-974f-4812-8911-843842443d1d",e._sentryDebugIdIdentifier="sentry-dbid-697c1fdc-974f-4812-8911-843842443d1d")}catch{}})();const k="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(k)&&e(H(!1))},onBackClick:()=>{T(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"))}}}))(z(pe)),ue=({isLoading:e})=>{const l=U(),t=B(),o=j(),[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))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),O.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 g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},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(H(!1))},onBackClick:()=>{T(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))}}}))(z(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));M();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(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.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:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(de,{currentTenant:g,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=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},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 S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},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(Y(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(K(!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(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=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=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=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=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.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(Y(!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}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(M(),d.useEffect((()=>{p||(f(!0),l(K(!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(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){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{xe as B};
1
+ import{j as u}from"./liveblocks-BeSMR7a1.js";import{a as d}from"./sentry-Uj7AWjah.js";import{h as U,g as B,u as j,j as y,N as G,l as V,i as W,n as te,o as x}from"./core-BL7rYGUF.js";import{fB as P,Y8 as w,XR as R,G_ as E,GS as q,GW as A,GL as X,XT as H,GP as ae,H0 as oe,GO as K,H3 as Y,G$ as C}from"./zeni-epic-state-CxdZGPla.js";import{z as O,w as z,bW as pe,l as T,bQ as Q,bX as le,E as Z,a5 as J,bY as se,bZ as ne}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import{u as M,i as re}from"./ReimbursementApprovalRuleDetailScreen-D7_1V-ZV.js";import ie from"./NotFoundScreen-C2tiSpQ7.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]="697c1fdc-974f-4812-8911-843842443d1d",e._sentryDebugIdIdentifier="sentry-dbid-697c1fdc-974f-4812-8911-843842443d1d")}catch{}})();const k="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(k)&&e(H(!1))},onBackClick:()=>{T(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"))}}}))(z(pe)),ue=({isLoading:e})=>{const l=U(),t=B(),o=j(),[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))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),O.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 g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},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(H(!1))},onBackClick:()=>{T(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))}}}))(z(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));M();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(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.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:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(de,{currentTenant:g,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=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},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 S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},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(Y(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(K(!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(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=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=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=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=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.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(Y(!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}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(M(),d.useEffect((()=>{p||(f(!0),l(K(!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(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){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{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-BkTNzfNi.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Q,q as na,n as ia,o as y}from"./core-DuNHGHBC.js";import{fB as Z,Xr as Ue,bq as kt,Rx as oa,bo as wt,bJ as de,Xs as Bt,Gg as xt,Hv as Ve,GP as la,bn as Ae,Xt as sa,Xu as ra,c7 as ca,Xv as da,lX as Ct,Xw as At,Xx as Et,I4 as _e,Gv as xe,Xy as ua,G4 as at,Xz as pa,LV as ma,G8 as ba,Ge as Dt,XA as Se,XB as Me,Hw as Oe,XC as ha,XD as ga,Hz as Ne,XE as Sa,HM as ya,XF as Tt,Hg as nt,Hl as fa,XG as Ia,XH as ce,XI as jt,XJ as Pt,XK as Ft,gS as va,GA as $e,cF as Rt,XL as ka,gd as wa,XM as Ba,XN as xa,dV as Vt,dU as $t,XO as ze,XP as Ca,XQ as Aa,V0 as Xe,XR as Ea,V1 as ie,V2 as He,XS as Da,XT as Ta,XU as ja,Hn as it,Hk as Pa,XV as Fa,XW as Ra,XX as Va,H6 as $a,XY as La,XZ as Ga,ct as Lt,d6 as Gt,m6 as Ua,bO as _a,br as Ut,bP as _t,Fj as Ma,X_ as Oa,LI as Na,LO as za,Bv as Xa,Hx as Ha,Ib as Za,mj as ge,X$ as Wa,Y0 as Mt,mN as qa,md as Ot,my as Nt,mx as ot,bE as pe,bN as Ya,Y1 as Ja,Y2 as ye,kJ as Ka,Y3 as lt,Y4 as Qa,kN as en,l6 as tn,Ip as an,Y5 as nn,mG as on,If as ln,Y6 as st,Ij as sn,Io as rn,Im as cn,Id as dn,Y7 as zt,Gp as un,Y8 as pn,Y9 as mn,gD as bn,gC as hn,gB as gn,mm as Sn,mE as rt,mP as yn,ui as fn,mv as In,Ih as vn,kT as kn,mU as wn,Ya as Bn,kL as xn,u9 as Cn,Yb as An,Hc as En,bK as Dn,bt as Tn,Ts as jn,d9 as Pn,d8 as Fn,cE as Rn,cL as Vn}from"./zeni-epic-state-IKQP0lNP.js";import{E as ue,z as L,V as fe,aq as Ze,O as oe,y as g,bg as We,a5 as se,F as A,a6 as Ee,h as j,bs as $n,a2 as H,at as qe,p as T,$ as Ie,bt as ct,bu as dt,bv as Ln,ax as Gn,ad as Un,aW as _n,a9 as Xt,G as De,ae as Ye,bw as Mn,ac as Ht,bx as On,ao as Nn,N as Zt,w as zn,by as Xn,bz as Hn,bA as Zn,bB as Wn,bC as qn,bD as Yn,bE as Jn,bF as Kn,bG as Qn,U as ei,bH as ti,bp as ai,bI as ni,ag as ii,bJ as oi,f as li}from"./index-CxkwDRG8.js";import{n as U,S as si}from"./mui-DaLeH41l.js";import{A as ut}from"./AddressScreen-LFBV9KsX.js";import{g as ne,a as Te,i as Wt,V as Je,b as Ke,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-D5RLzOT3.js";import{a as f}from"./sentry-CNLjKkQW.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-D-XiURTy.js";import{u as qt}from"./useInitialThreadRequest-DANB6KeB.js";import{u as ui}from"./BusinessVerificationPageScreen--LjYD0BK.js";import Ce from"./NotFoundScreen-DjDyDYWZ.js";import{D as pi}from"./DrawerScreen-DVJ1nhu5.js";import{M as Yt}from"./MobileAppDrawer-BtnNKdri.js";import{F as Jt}from"./FeaturePreviewScreen-BhrA_knX.js";import{S as je}from"./SetupPagesScreen-BxDIT7Xu.js";import{B as mi}from"./BillPayApprovalRoutes-sbvXc3_Z.js";import{F as bi}from"./ScreenRoutes-vV1s5761.js";import"./recharts-CkuQpH_L.js";import"./analytics-DHBkdK00.js";import"./plaid-BVNoSR_u.js";import"./dnd-DKR3QBLX.js";import"./stripe-cKAAJElX.js";import"./lottie-DACJJNY9.js";import"./lexical-CcqvVKiN.js";import"./pdf-BjtwR-dW.js";import"./utils-BN2UhEgk.js";import"./routePaths-CKTfFzY9.js";import"./InboxNotificationsProvider-DBc6Mphu.js";import"./useTaskManagerAccess-CgZlooKP.js";import"./analyticsHelper-C8sM1z8L.js";import"./ReimbursementApprovalRuleDetailScreen-XQSOHGYn.js";import"./getLocaleForTenant-D1jcEP43.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0e39003a-5e0a-48fa-8b34-a4abbde9472f",e._sentryDebugIdIdentifier="sentry-dbid-0e39003a-5e0a-48fa-8b34-a4abbde9472f")}catch{}})();const hi=Q((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(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=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=K(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((X=>Z(X))),s=k((X=>Ue(X,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,x]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),z=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(z||M||s.allApprovers.find((X=>X.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,z,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(xt(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(x(!0),t(Ve(!1,O,$,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,Y]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:X=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(X)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new Xt(100,58)},mt=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),x=k((F=>Z(F)));ui();const[C,_]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let z=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(z=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const Y=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{z==="Not-Started"&&(u&&D?B(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(xt(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[C,D,u,n,t,S,E,b]);const X={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(x.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,x.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(z==="Error"||q.fetchState==="Error")return a.jsx(Ce,{});if(z!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:Y}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Kt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:X,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-BeSMR7a1.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Q,q as na,n as ia,o as y}from"./core-BL7rYGUF.js";import{fB as Z,Xr as Ue,bq as kt,Rx as oa,bo as wt,bJ as de,Xs as Bt,Gg as xt,Hv as Ve,GP as la,bn as Ae,Xt as sa,Xu as ra,c7 as ca,Xv as da,lX as Ct,Xw as At,Xx as Et,I4 as _e,Gv as xe,Xy as ua,G4 as at,Xz as pa,LV as ma,G8 as ba,Ge as Dt,XA as Se,XB as Me,Hw as Oe,XC as ha,XD as ga,Hz as Ne,XE as Sa,HM as ya,XF as Tt,Hg as nt,Hl as fa,XG as Ia,XH as ce,XI as jt,XJ as Pt,XK as Ft,gS as va,GA as $e,cF as Rt,XL as ka,gd as wa,XM as Ba,XN as xa,dV as Vt,dU as $t,XO as ze,XP as Ca,XQ as Aa,V0 as Xe,XR as Ea,V1 as ie,V2 as He,XS as Da,XT as Ta,XU as ja,Hn as it,Hk as Pa,XV as Fa,XW as Ra,XX as Va,H6 as $a,XY as La,XZ as Ga,ct as Lt,d6 as Gt,m6 as Ua,bO as _a,br as Ut,bP as _t,Fj as Ma,X_ as Oa,LI as Na,LO as za,Bv as Xa,Hx as Ha,Ib as Za,mj as ge,X$ as Wa,Y0 as Mt,mN as qa,md as Ot,my as Nt,mx as ot,bE as pe,bN as Ya,Y1 as Ja,Y2 as ye,kJ as Ka,Y3 as lt,Y4 as Qa,kN as en,l6 as tn,Ip as an,Y5 as nn,mG as on,If as ln,Y6 as st,Ij as sn,Io as rn,Im as cn,Id as dn,Y7 as zt,Gp as un,Y8 as pn,Y9 as mn,gD as bn,gC as hn,gB as gn,mm as Sn,mE as rt,mP as yn,ui as fn,mv as In,Ih as vn,kT as kn,mU as wn,Ya as Bn,kL as xn,u9 as Cn,Yb as An,Hc as En,bK as Dn,bt as Tn,Ts as jn,d9 as Pn,d8 as Fn,cE as Rn,cL as Vn}from"./zeni-epic-state-CxdZGPla.js";import{E as ue,z as L,V as fe,aq as Ze,O as oe,y as g,bg as We,a5 as se,F as A,a6 as Ee,h as j,bs as $n,a2 as H,at as qe,p as T,$ as Ie,bt as ct,bu as dt,bv as Ln,ax as Gn,ad as Un,aW as _n,a9 as Xt,G as De,ae as Ye,bw as Mn,ac as Ht,bx as On,ao as Nn,N as Zt,w as zn,by as Xn,bz as Hn,bA as Zn,bB as Wn,bC as qn,bD as Yn,bE as Jn,bF as Kn,bG as Qn,U as ei,bH as ti,bp as ai,bI as ni,ag as ii,bJ as oi,f as li}from"./index-E1NwyJIP.js";import{n as U,S as si}from"./mui-CPSuUssr.js";import{A as ut}from"./AddressScreen-DKIOTZOx.js";import{g as ne,a as Te,i as Wt,V as Je,b as Ke,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-B6SysKxJ.js";import{a as f}from"./sentry-Uj7AWjah.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{u as qt}from"./useInitialThreadRequest-DifgMaO6.js";import{u as ui}from"./BusinessVerificationPageScreen-BpB36lD4.js";import Ce from"./NotFoundScreen-C2tiSpQ7.js";import{D as pi}from"./DrawerScreen-BUtXmCMv.js";import{M as Yt}from"./MobileAppDrawer-CjyikhYJ.js";import{F as Jt}from"./FeaturePreviewScreen-07vQ7ieK.js";import{S as je}from"./SetupPagesScreen-CZfthydR.js";import{B as mi}from"./BillPayApprovalRoutes-B-dRM1ET.js";import{F as bi}from"./ScreenRoutes-T2NqNjGF.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./routePaths-Cf2E-_nR.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";import"./analyticsHelper-D6TeBlJQ.js";import"./ReimbursementApprovalRuleDetailScreen-D7_1V-ZV.js";import"./getLocaleForTenant-akYNGA2f.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0e39003a-5e0a-48fa-8b34-a4abbde9472f",e._sentryDebugIdIdentifier="sentry-dbid-0e39003a-5e0a-48fa-8b34-a4abbde9472f")}catch{}})();const hi=Q((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(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=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=K(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((X=>Z(X))),s=k((X=>Ue(X,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,x]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),z=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(z||M||s.allApprovers.find((X=>X.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,z,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(xt(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(x(!0),t(Ve(!1,O,$,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,Y]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:X=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(X)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new Xt(100,58)},mt=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),x=k((F=>Z(F)));ui();const[C,_]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let z=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(z=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const Y=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{z==="Not-Started"&&(u&&D?B(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(xt(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[C,D,u,n,t,S,E,b]);const X={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(x.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,x.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(z==="Error"||q.fetchState==="Error")return a.jsx(Ce,{});if(z!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:Y}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Kt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:X,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const bt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{a as V}from"./sentry-CNLjKkQW.js";import{u as Y,j as b,h as ne,g as se,i as oe,N as ie,l as re}from"./core-DuNHGHBC.js";import{fB as z,GS as ce,Yj as ue,AW as de,RA as pe,H6 as le,Kh as me,N4 as fe,NK as ye,Oz as Se,Yk as ge,Yl as Ie,Ym as he,Yn as be,Yo as Te,Uz as De,Xp as Oe,UO as Ce,Ll as ke,UP as Ve,Lp as Ae,mD as Ne,gD as we,gC as ve,gB as Fe,ui as _e,u9 as Be,u6 as xe,mv as Ee,B3 as ze,B1 as U,bE as P,Bf as R,cD as Ue}from"./zeni-epic-state-IKQP0lNP.js";import{bQ as Pe,V as Re,O as Le,bg as je,z as E,a6 as Me,h as L,l as B,N as x,bS as Ge,ac as Ye,p as j,aE as M}from"./index-CxkwDRG8.js";import{n as qe}from"./mui-DaLeH41l.js";import{j as k}from"./liveblocks-BkTNzfNi.js";import{d as G}from"./routePaths-CKTfFzY9.js";import{M as Ke}from"./MobileAppDrawer-BtnNKdri.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="866575fd-7c0f-44cd-aec6-bb52355ae099",t._sentryDebugIdIdentifier="sentry-dbid-866575fd-7c0f-44cd-aec6-bb52355ae099")}catch{}})();function nt(){const t=Y(),u=b((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Pe(n),p=b((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const We=qe.div`
1
+ import{a as V}from"./sentry-Uj7AWjah.js";import{u as Y,j as b,h as ne,g as se,i as oe,N as ie,l as re}from"./core-BL7rYGUF.js";import{fB as z,GS as ce,Yj as ue,AW as de,RA as pe,H6 as le,Kh as me,N4 as fe,NK as ye,Oz as Se,Yk as ge,Yl as Ie,Ym as he,Yn as be,Yo as Te,Uz as De,Xp as Oe,UO as Ce,Ll as ke,UP as Ve,Lp as Ae,mD as Ne,gD as we,gC as ve,gB as Fe,ui as _e,u9 as Be,u6 as xe,mv as Ee,B3 as ze,B1 as U,bE as P,Bf as R,cD as Ue}from"./zeni-epic-state-CxdZGPla.js";import{bQ as Pe,V as Re,O as Le,bg as je,z as E,a6 as Me,h as L,l as B,N as x,bS as Ge,ac as Ye,p as j,aE as M}from"./index-E1NwyJIP.js";import{n as qe}from"./mui-CPSuUssr.js";import{j as k}from"./liveblocks-BeSMR7a1.js";import{d as G}from"./routePaths-Cf2E-_nR.js";import{M as Ke}from"./MobileAppDrawer-CjyikhYJ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="866575fd-7c0f-44cd-aec6-bb52355ae099",t._sentryDebugIdIdentifier="sentry-dbid-866575fd-7c0f-44cd-aec6-bb52355ae099")}catch{}})();function nt(){const t=Y(),u=b((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Pe(n),p=b((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const We=qe.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-BkTNzfNi.js";import{a as l}from"./sentry-CNLjKkQW.js";import{u as pe,h as he,g as Ce,j as B,i as fe,l as ge}from"./core-DuNHGHBC.js";import{a as Se,e2 as be,z as ye,e3 as Pe,e5 as z,e6 as Ie,bl as W,a6 as we,h as $,e7 as H,eh as Ee,G as ke,N as Ae,w as Te,ea as xe,eb as Ue,at as _e,ee as Oe,ef as ve,bi as Qe,eg as Fe}from"./index-CxkwDRG8.js";import{gH as $e,fA as G,fB as je,g4 as De,je as Le,ja as Ve,fC as M,gq as qe,gk as Re,gm as N,gs as Be,gt as He,gu as Me,gv as Ne,gw as ze}from"./zeni-epic-state-IKQP0lNP.js";import{D as We,n as D,P as Ge,S as Ye}from"./mui-DaLeH41l.js";import"./recharts-CkuQpH_L.js";import"./analytics-DHBkdK00.js";import"./plaid-BVNoSR_u.js";import"./dnd-DKR3QBLX.js";import"./stripe-cKAAJElX.js";import"./lottie-DACJJNY9.js";import"./lexical-CcqvVKiN.js";import"./pdf-BjtwR-dW.js";import"./utils-BN2UhEgk.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]="b522840b-d5a2-45f2-930c-66d6d023f74d",e._sentryDebugIdIdentifier="sentry-dbid-b522840b-d5a2-45f2-930c-66d6d023f74d")}catch{}})();const Y="chat-response-generated",J="cards/ask",K="card_policy_hero";function j(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Je=ge((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:Oe(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===K?X(i):j(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Fe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Me(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Ne({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(ze({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Be(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${J}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(qe({questionAnswerId:n,isCollapsed:t}))},...ve(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(j(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=Z.pageTitle,Ke=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=Se(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o($e())}),[o]);const i=B((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=B((r=>je(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:A,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,g=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(g&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[g]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${J}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[V,q,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return S.jsxs(tt,{children:[S.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),g?S.jsx(Je,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?X(s):j(s),{state:{...d.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(n.userRoleId)))}}),S.jsx(We,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:S.jsx(et,{onClick:r=>r.stopPropagation(),children:S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{g||n.userRoleId==null||o(M(n.userRoleId)),h(!1)}})})})]})},et=D(Ye)`
1
+ import{j as S}from"./liveblocks-BeSMR7a1.js";import{a as l}from"./sentry-Uj7AWjah.js";import{u as pe,h as he,g as Ce,j as B,i as fe,l as ge}from"./core-BL7rYGUF.js";import{a as Se,e2 as be,z as ye,e3 as Pe,e5 as z,e6 as Ie,bl as W,a6 as we,h as $,e7 as H,eh as Ee,G as ke,N as Ae,w as Te,ea as xe,eb as Ue,at as _e,ee as Oe,ef as ve,bi as Qe,eg as Fe}from"./index-E1NwyJIP.js";import{gH as $e,fA as G,fB as je,g4 as De,je as Le,ja as Ve,fC as M,gq as qe,gk as Re,gm as N,gs as Be,gt as He,gu as Me,gv as Ne,gw as ze}from"./zeni-epic-state-CxdZGPla.js";import{D as We,n as D,P as Ge,S as Ye}from"./mui-CPSuUssr.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.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]="b522840b-d5a2-45f2-930c-66d6d023f74d",e._sentryDebugIdIdentifier="sentry-dbid-b522840b-d5a2-45f2-930c-66d6d023f74d")}catch{}})();const Y="chat-response-generated",J="cards/ask",K="card_policy_hero";function j(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Je=ge((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:Oe(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===K?X(i):j(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Fe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Me(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Ne({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(ze({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Be(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${J}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(qe({questionAnswerId:n,isCollapsed:t}))},...ve(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(j(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=Z.pageTitle,Ke=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=Se(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o($e())}),[o]);const i=B((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=B((r=>je(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:A,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,g=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(g&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[g]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${J}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[V,q,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return S.jsxs(tt,{children:[S.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),g?S.jsx(Je,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?X(s):j(s),{state:{...d.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(n.userRoleId)))}}),S.jsx(We,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:S.jsx(et,{onClick:r=>r.stopPropagation(),children:S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{g||n.userRoleId==null||o(M(n.userRoleId)),h(!1)}})})})]})},et=D(Ye)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as o}from"./liveblocks-BkTNzfNi.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-DuNHGHBC.js";import{fO as Pt,$5 as is,f_ as wt,bt as ve,$6 as ds,$7 as ls,fD as fn,$8 as Pn,fM as wn,$9 as Tn,$a as vn,$b as Fn,$c as xn,fN as Bn,fZ as Ln,$d as Rn,$e as us,fT as ms,fS as Cs,$f as ps,Jm as On,g0 as ia,$g as hs,$h as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$i as Ss,fW as ys,IU as Is,IT as ks,IX as Es,IZ as As,g6 as Ds,fA as $n,$j as _s,$k as Ps,gb as Mn,$l as ws,gc as yt,J3 as Ts,J0 as vs,fB as fe,$m as qa,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$n as ua,$o as Tt,Cf as Ga,m3 as Ka,$p as za,JC as ka,g1 as qe,JE as vt,lV as Nn,$q as ma,Jq as _a,$r as Fs,$s as xs,Jt as Ja,$t as Bs,Yg as Qa,fY as Vn,Jz as ba,im as Ls,$u as Hn,fP as Ca,br as Rs,$v as Os,gD as Xa,gC as et,K6 as Us,gB as at,$w as Gn,ct as Kn,d6 as js,Yf as wa,KH as zn,$x as gn,Kh as Pa,$y as Yn,KI as $s,YF as Ms,KJ as Ns,LO as Vs,Bv as Hs,LI as Gs,$z as Ks,JD as oa,$A as zs,$B as Ys,$C as Ws,$D as Zs,$E as qs,$F as Ft,$G as Js,JT as Wn,JM as Qs,$H as Xs,gZ as eo,$I as Zn,K0 as qn,K4 as Jn,gY as ao,$J as to,Kt as Qn,$K as no,$L as ro,$M as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$N as rr,$O as co,g8 as io,g9 as lo,ga as uo,$P as tt,g2 as sr,d8 as xt,$Q as mo,$R as Co,$S as po,$T as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$U as or,KG as Ha,Rx as ko,$V as Eo,$W as Ao,$X as Do,$Y as cr,$Z as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,$_ as To,$$ as vo,Jn as Fo,a00 as dr,fX as lr,a01 as xo,Jp as Bo,Jo as bn,a02 as Lo,a03 as Ro,a04 as Oo,UA as Uo,a05 as Bt,a06 as jo,Fm as ur,mD as $o,ib as Mo,L6 as No,a07 as mr,fJ as Vo,fK as Ho,a08 as Go,dJ as Ko,f$ as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cF as qo,bK as Jo,Ts as Qo}from"./zeni-epic-state-IKQP0lNP.js";import{V as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Xo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,d as gr,ap as br,p as ke,O as le,y as W,g as ya,dh as Sr,di as tc,dj as nc,z as te,a5 as Ta,d0 as nt,dk as rc,dl as sc,dm as oc,$ as va,bg as Qe,bC as Rt,dn as cc,a9 as Fa,T as rt,E as Ot,h as ae,w as st,dp as ic,bO as Sa,dq as kt,dr as dc,a6 as Ut,ds as lc,ac as yr,at as Et,dt as uc,ao as Ir,I as kr,N as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,F as Ya,dB as Sc,dC as yc,m as ht,U as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,f as wc}from"./index-CxkwDRG8.js";import{n as Ne,D as Ar,S as Tc}from"./mui-DaLeH41l.js";import{a as r}from"./sentry-CNLjKkQW.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-D-XiURTy.js";import{M as Ee}from"./MobileAppDrawer-BtnNKdri.js";import{d as jt}from"./recharts-CkuQpH_L.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-BxDIT7Xu.js";import{u as Tr}from"./useInitialThreadRequest-DANB6KeB.js";import ot from"./NotFoundScreen-DjDyDYWZ.js";import{u as Nt}from"./useChargeCardPusherEvents-B74EcXIV.js";import{n as yn}from"./utils-BN2UhEgk.js";import{t as Lc}from"./AddressScreen-LFBV9KsX.js";import"./analytics-DHBkdK00.js";import"./plaid-BVNoSR_u.js";import"./dnd-DKR3QBLX.js";import"./stripe-cKAAJElX.js";import"./lottie-DACJJNY9.js";import"./lexical-CcqvVKiN.js";import"./pdf-BjtwR-dW.js";import"./InboxNotificationsProvider-DBc6Mphu.js";import"./useTaskManagerAccess-CgZlooKP.js";import"./BusinessVerificationPageScreen--LjYD0BK.js";import"./routePaths-CKTfFzY9.js";import"./analyticsHelper-C8sM1z8L.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]="b4b93283-5558-4471-a603-845e32572659",e._sentryDebugIdIdentifier="sentry-dbid-b4b93283-5558-4471-a603-845e32572659")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
1
+ import{j as o}from"./liveblocks-BeSMR7a1.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-BL7rYGUF.js";import{fO as Pt,$5 as is,f_ as wt,bt as ve,$6 as ds,$7 as ls,fD as fn,$8 as Pn,fM as wn,$9 as Tn,$a as vn,$b as Fn,$c as xn,fN as Bn,fZ as Ln,$d as Rn,$e as us,fT as ms,fS as Cs,$f as ps,Jm as On,g0 as ia,$g as hs,$h as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$i as Ss,fW as ys,IU as Is,IT as ks,IX as Es,IZ as As,g6 as Ds,fA as $n,$j as _s,$k as Ps,gb as Mn,$l as ws,gc as yt,J3 as Ts,J0 as vs,fB as fe,$m as qa,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$n as ua,$o as Tt,Cf as Ga,m3 as Ka,$p as za,JC as ka,g1 as qe,JE as vt,lV as Nn,$q as ma,Jq as _a,$r as Fs,$s as xs,Jt as Ja,$t as Bs,Yg as Qa,fY as Vn,Jz as ba,im as Ls,$u as Hn,fP as Ca,br as Rs,$v as Os,gD as Xa,gC as et,K6 as Us,gB as at,$w as Gn,ct as Kn,d6 as js,Yf as wa,KH as zn,$x as gn,Kh as Pa,$y as Yn,KI as $s,YF as Ms,KJ as Ns,LO as Vs,Bv as Hs,LI as Gs,$z as Ks,JD as oa,$A as zs,$B as Ys,$C as Ws,$D as Zs,$E as qs,$F as Ft,$G as Js,JT as Wn,JM as Qs,$H as Xs,gZ as eo,$I as Zn,K0 as qn,K4 as Jn,gY as ao,$J as to,Kt as Qn,$K as no,$L as ro,$M as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$N as rr,$O as co,g8 as io,g9 as lo,ga as uo,$P as tt,g2 as sr,d8 as xt,$Q as mo,$R as Co,$S as po,$T as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$U as or,KG as Ha,Rx as ko,$V as Eo,$W as Ao,$X as Do,$Y as cr,$Z as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,$_ as To,$$ as vo,Jn as Fo,a00 as dr,fX as lr,a01 as xo,Jp as Bo,Jo as bn,a02 as Lo,a03 as Ro,a04 as Oo,UA as Uo,a05 as Bt,a06 as jo,Fm as ur,mD as $o,ib as Mo,L6 as No,a07 as mr,fJ as Vo,fK as Ho,a08 as Go,dJ as Ko,f$ as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cF as qo,bK as Jo,Ts as Qo}from"./zeni-epic-state-CxdZGPla.js";import{V as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Xo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,d as gr,ap as br,p as ke,O as le,y as W,g as ya,dh as Sr,di as tc,dj as nc,z as te,a5 as Ta,d0 as nt,dk as rc,dl as sc,dm as oc,$ as va,bg as Qe,bC as Rt,dn as cc,a9 as Fa,T as rt,E as Ot,h as ae,w as st,dp as ic,bO as Sa,dq as kt,dr as dc,a6 as Ut,ds as lc,ac as yr,at as Et,dt as uc,ao as Ir,I as kr,N as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,F as Ya,dB as Sc,dC as yc,m as ht,U as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,f as wc}from"./index-E1NwyJIP.js";import{n as Ne,D as Ar,S as Tc}from"./mui-CPSuUssr.js";import{a as r}from"./sentry-Uj7AWjah.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{M as Ee}from"./MobileAppDrawer-CjyikhYJ.js";import{d as jt}from"./recharts-BP8J0UHA.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-CZfthydR.js";import{u as Tr}from"./useInitialThreadRequest-DifgMaO6.js";import ot from"./NotFoundScreen-C2tiSpQ7.js";import{u as Nt}from"./useChargeCardPusherEvents-DJOucGr5.js";import{n as yn}from"./utils-Dn95OB7n.js";import{t as Lc}from"./AddressScreen-DKIOTZOx.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";import"./BusinessVerificationPageScreen-BpB36lD4.js";import"./routePaths-Cf2E-_nR.js";import"./analyticsHelper-D6TeBlJQ.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]="b4b93283-5558-4471-a603-845e32572659",e._sentryDebugIdIdentifier="sentry-dbid-b4b93283-5558-4471-a603-845e32572659")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-BkTNzfNi.js";import{a as g}from"./sentry-CNLjKkQW.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-DuNHGHBC.js";import{z as N,bp as F,a6 as P,h as A,N as V,l as b,bq as j,ac as L,aE as U,p as B}from"./index-CxkwDRG8.js";import{fB as D,gF as M,AW as _,gA as R,c7 as z,Xp as G,bn as q,ui as X,u6 as Y,mv as H,o4 as S,Xq as W,bE as Z,cD as C,of as $,op as J}from"./zeni-epic-state-IKQP0lNP.js";import"./mui-DaLeH41l.js";import{d as K}from"./routePaths-CKTfFzY9.js";import{M as Q}from"./MobileAppDrawer-BtnNKdri.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="d9ed6a0e-cc8e-4be6-9d29-7922cd7debfb",t._sentryDebugIdIdentifier="sentry-dbid-d9ed6a0e-cc8e-4be6-9d29-7922cd7debfb")}catch{}})();const ee=E((function(t){const a=R(t),i=N.getSignedInUser(),p=D(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}}),(function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(W(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(H({files:e}))},onDeleteFile:e=>{t(Y(e))},onEditFileName:(e,n)=>{t(X(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(_())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(Q,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-BeSMR7a1.js";import{a as g}from"./sentry-Uj7AWjah.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-BL7rYGUF.js";import{z as N,bp as F,a6 as P,h as A,N as V,l as b,bq as j,ac as L,aE as U,p as B}from"./index-E1NwyJIP.js";import{fB as D,gF as M,AW as _,gA as R,c7 as z,Xp as G,bn as q,ui as X,u6 as Y,mv as H,o4 as S,Xq as W,bE as Z,cD as C,of as $,op as J}from"./zeni-epic-state-CxdZGPla.js";import"./mui-CPSuUssr.js";import{d as K}from"./routePaths-Cf2E-_nR.js";import{M as Q}from"./MobileAppDrawer-CjyikhYJ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="d9ed6a0e-cc8e-4be6-9d29-7922cd7debfb",t._sentryDebugIdIdentifier="sentry-dbid-d9ed6a0e-cc8e-4be6-9d29-7922cd7debfb")}catch{}})();const ee=E((function(t){const a=R(t),i=N.getSignedInUser(),p=D(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}}),(function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(W(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(H({files:e}))},onDeleteFile:e=>{t(Y(e))},onEditFileName:(e,n)=>{t(X(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(_())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(Q,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as I}from"./liveblocks-BkTNzfNi.js";import{a as o}from"./sentry-CNLjKkQW.js";import{u as R,h as k,g as H,j as C,N as w}from"./core-DuNHGHBC.js";import{T9 as q,fB as z,gh as G,pO as B,gJ as O,gg as J,ge as Q,Tv as V,gd as A}from"./zeni-epic-state-IKQP0lNP.js";import{u as K,z as E,L as v,G as M,F as W}from"./index-CxkwDRG8.js";import{n as X}from"./mui-DaLeH41l.js";import{P as h,a as D}from"./AccountMappingScreen-Dst-9gUw.js";import{t as Y}from"./getLocaleForTenant-D1jcEP43.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-Dlky0ESM.js";import"./recharts-CkuQpH_L.js";import"./analytics-DHBkdK00.js";import"./plaid-BVNoSR_u.js";import"./dnd-DKR3QBLX.js";import"./stripe-cKAAJElX.js";import"./lottie-DACJJNY9.js";import"./lexical-CcqvVKiN.js";import"./pdf-BjtwR-dW.js";import"./utils-BN2UhEgk.js";import"./MobileAppDrawer-BtnNKdri.js";import"./InboxNotificationsProvider-DBc6Mphu.js";import"./useTaskManagerAccess-CgZlooKP.js";import"./accountMappingHelper-ZLBxLrOl.js";import"./empty-BA0WbUFe.js";import"./pdf-lib-oygBYinp.js";import"./index-DplrRYRh.js";import"./url-CaYHIgYK.js";import"./index-DgXVMYGv.js";import"./decodeURIComponentSafe-CcNRl55W.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="0e6f07f7-cda6-4aff-8d67-bc131e2a1225",t._sentryDebugIdIdentifier="sentry-dbid-0e6f07f7-cda6-4aff-8d67-bc131e2a1225")}catch{}})();const te=X.div`
1
+ import{j as I}from"./liveblocks-BeSMR7a1.js";import{a as o}from"./sentry-Uj7AWjah.js";import{u as R,h as k,g as H,j as C,N as w}from"./core-BL7rYGUF.js";import{T9 as q,fB as z,gh as G,pO as B,gJ as O,gg as J,ge as Q,Tv as V,gd as A}from"./zeni-epic-state-CxdZGPla.js";import{u as K,z as E,L as v,G as M,F as W}from"./index-E1NwyJIP.js";import{n as X}from"./mui-CPSuUssr.js";import{P as h,a as D}from"./AccountMappingScreen-Cv_JISNl.js";import{t as Y}from"./getLocaleForTenant-akYNGA2f.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-CiKgrKX6.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./MobileAppDrawer-CjyikhYJ.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";import"./accountMappingHelper-DOs7iAIL.js";import"./empty-qvcbLK7S.js";import"./pdf-lib-Cu5wZc2A.js";import"./index-te7nCILo.js";import"./url-CnKkchc3.js";import"./index-BtCYCCEX.js";import"./decodeURIComponentSafe-B4a7LpJx.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="0e6f07f7-cda6-4aff-8d67-bc131e2a1225",t._sentryDebugIdIdentifier="sentry-dbid-0e6f07f7-cda6-4aff-8d67-bc131e2a1225")}catch{}})();const te=X.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-BeSMR7a1.js";import{z as a}from"./index-E1NwyJIP.js";import{g as n}from"./QBOConnectionScreen-CiKgrKX6.js";import"./sentry-Uj7AWjah.js";import{g as p,N as s}from"./core-BL7rYGUF.js";import"./zeni-epic-state-CxdZGPla.js";import"./recharts-BP8J0UHA.js";import"./mui-CPSuUssr.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./empty-qvcbLK7S.js";import"./pdf-lib-Cu5wZc2A.js";import"./index-te7nCILo.js";import"./url-CnKkchc3.js";import"./index-BtCYCCEX.js";import"./decodeURIComponentSafe-B4a7LpJx.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]="c18cd95e-770d-4ff7-92bf-3374948ea538",t._sentryDebugIdIdentifier="sentry-dbid-c18cd95e-770d-4ff7-92bf-3374948ea538")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),d=a.getSignedInUser()?.userId??"";if(f(o,r,e,d)===!0){const m=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:m})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};