@zeniai/web-app-ui 5.3.32-next → 5.3.32-prod

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-DA6vMX8n.js → AccountMappingScreen-BXftSVn-.js} +1 -1
  2. package/dist/assets/AddressRoutes-Dx1aQN-n.js +1 -0
  3. package/dist/assets/{AddressScreen-2iFQsQhr.js → AddressScreen-TLZdvXNy.js} +1 -1
  4. package/dist/assets/{AiCfoScreen-C9m6odEm.js → AiCfoScreen-DmLnUFml.js} +1 -1
  5. package/dist/assets/{AppDrawer-AR3pdgjI.js → AppDrawer-BnHpD6dG.js} +1 -1
  6. package/dist/assets/{BillPayApprovalRoutes-D6CaIPVl.js → BillPayApprovalRoutes-DPALyyf2.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-BQGUM9hu.js → BillPayRoutes-qAhjjusa.js} +1 -1
  8. package/dist/assets/{BusinessVerificationPageScreen-bzYA6ugA.js → BusinessVerificationPageScreen-BYV8fDWH.js} +1 -1
  9. package/dist/assets/{CardsAiCfoScreen-DzZaAiTB.js → CardsAiCfoScreen-Cd63K_-0.js} +1 -1
  10. package/dist/assets/{ChargeCardRoutes-DUgnqPWj.js → ChargeCardRoutes-BH9evnp_.js} +1 -1
  11. package/dist/assets/{CompanyPassportScreen-DDPsmPkS.js → CompanyPassportScreen-D0g6Nmxq.js} +1 -1
  12. package/dist/assets/{ConnectionAuthScreen-D0DWsoRm.js → ConnectionAuthScreen-CpG3pE-i.js} +1 -1
  13. package/dist/assets/CustomerOnboardingAuthScreen-CXLOaLgp.js +1 -0
  14. package/dist/assets/{CustomerOnboardingRoutes-BZn_LcyK.js → CustomerOnboardingRoutes-CI_z4poM.js} +1 -1
  15. package/dist/assets/{DashboardRoutes-CY1SDvUL.js → DashboardRoutes-C_4oAXQg.js} +1 -1
  16. package/dist/assets/{DefaultTenantHome-C00MLtaA.js → DefaultTenantHome-D3eb-jo9.js} +1 -1
  17. package/dist/assets/{DomesticWireDetailScreen-5wKaAYNZ.js → DomesticWireDetailScreen-i7JC-m7w.js} +1 -1
  18. package/dist/assets/{DrawerScreen-DXivMtkW.js → DrawerScreen-DUO1Z5ow.js} +1 -1
  19. package/dist/assets/{EntityDetailRoutes-D4JppFuK.js → EntityDetailRoutes-B2ai8pR3.js} +1 -1
  20. package/dist/assets/{ExpenseAutomationRoutes-Dmnf2gk3.js → ExpenseAutomationRoutes-DQA6yQ4O.js} +1 -1
  21. package/dist/assets/{FeaturePreviewScreen-C4egsTmn.js → FeaturePreviewScreen-CjFoHQHk.js} +1 -1
  22. package/dist/assets/{HubSpotOAuthCallbackScreen-BPYlggFo.js → HubSpotOAuthCallbackScreen-qemWA0jI.js} +1 -1
  23. package/dist/assets/{InboxNotificationsProvider-DLtCSJ1e.js → InboxNotificationsProvider-7eYmgI1F.js} +1 -1
  24. package/dist/assets/{InvoicingRoutes-C6KEoVXP.js → InvoicingRoutes-DOUUybBE.js} +1 -1
  25. package/dist/assets/{MagicLinkRoutes-BUBt7N4B.js → MagicLinkRoutes-CTs6OYkH.js} +1 -1
  26. package/dist/assets/{MagicLinkSignInScreen-DthxXwoL.js → MagicLinkSignInScreen-CDEl_Ic_.js} +1 -1
  27. package/dist/assets/{MobileAppDrawer-AMYN8Gjf.js → MobileAppDrawer-BMvh-RAa.js} +1 -1
  28. package/dist/assets/NotFoundScreen-Wkt8x0Ja.js +1 -0
  29. package/dist/assets/{NotificationRoutes-C5bjkJ9x.js → NotificationRoutes-BF1aTPUh.js} +1 -1
  30. package/dist/assets/{OAuthConsentScreen-GS4LIEZY.js → OAuthConsentScreen-8oM_ijmg.js} +1 -1
  31. package/dist/assets/{PandLWithForecastRoutes-1JEKWI4D.js → PandLWithForecastRoutes-DvwOSp2G.js} +1 -1
  32. package/dist/assets/{PaymentLinkScreen-klZ4RFzW.js → PaymentLinkScreen-D0VzMTpF.js} +1 -1
  33. package/dist/assets/{PeopleRoutes-D-8614Cf.js → PeopleRoutes-CMx_k0hr.js} +1 -1
  34. package/dist/assets/{PerformanceRoutes-CkfRYNq2.js → PerformanceRoutes-OuxZJbf_.js} +1 -1
  35. package/dist/assets/{Preview-C2GPv-G6.js → Preview-Dkzm36JB.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-CgDmO8dD.js → QBOConnectionScreen-Cxvr0UGn.js} +1 -1
  37. package/dist/assets/{ReimbursementApprovalRoutes-DMPKN0xJ.js → ReimbursementApprovalRoutes-ChPdj5ky.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-YsjpcW9c.js → ReimbursementApprovalRuleDetailScreen-kIivYyt0.js} +1 -1
  39. package/dist/assets/{ReimbursementRoutes-DXo4NvYM.js → ReimbursementRoutes-DlTMcw_k.js} +1 -1
  40. package/dist/assets/{ReportsRoutes-C5btuAgR.js → ReportsRoutes-DUvTlB32.js} +1 -1
  41. package/dist/assets/{RewardsRoutes-6WcZW5R0.js → RewardsRoutes-CANJzBfw.js} +1 -1
  42. package/dist/assets/{ScreenRoutes-u4rkodoe.js → ScreenRoutes-B2jpCRd2.js} +2 -2
  43. package/dist/assets/{SettingsRoutes-DNaJE00d.js → SettingsRoutes-D405mYiE.js} +1 -1
  44. package/dist/assets/{SetupPagesScreen-BSF8vuHb.js → SetupPagesScreen-o-PhLBXH.js} +1 -1
  45. package/dist/assets/{SignInScreen-C0k1UkVX.js → SignInScreen-CsdAWM0a.js} +1 -1
  46. package/dist/assets/{SignOutScreen-Ciim2wTk.js → SignOutScreen-DjO_hTaY.js} +1 -1
  47. package/dist/assets/{TaskListScreen-t-HxAdY-.js → TaskListScreen-D5rs0HLr.js} +1 -1
  48. package/dist/assets/{TaskRoutes-B3g-TdsM.js → TaskRoutes-IWzYaX-F.js} +1 -1
  49. package/dist/assets/TransactionDetailRoutes-DExFe-03.js +1 -0
  50. package/dist/assets/{TransactionDetailScreen-CfA-Ugfo.js → TransactionDetailScreen-7v-3l9dA.js} +1 -1
  51. package/dist/assets/{TransactionListRoutes-B_3YnN8q.js → TransactionListRoutes-hxVuwPcb.js} +1 -1
  52. package/dist/assets/{TreasuryRoutes-CjNKU5ec.js → TreasuryRoutes-C4GA1Tde.js} +1 -1
  53. package/dist/assets/{VendorsRoutes-DGaauSBm.js → VendorsRoutes-DLC5o9yJ.js} +1 -1
  54. package/dist/assets/{WiseConfirmationScreen-rPMoKWiH.js → WiseConfirmationScreen-BJNaaQrG.js} +1 -1
  55. package/dist/assets/{ZeniAccountRoutes-CEMKZQ-X.js → ZeniAccountRoutes-CPdfqL23.js} +1 -1
  56. package/dist/assets/{ZeniAccountStatementScreen-BhiffvFR.js → ZeniAccountStatementScreen-Butd8DWu.js} +1 -1
  57. package/dist/assets/{accountMappingHelper-ChrGBc2n.js → accountMappingHelper-DsN6SM7a.js} +1 -1
  58. package/dist/assets/{analytics-WNjEvDwJ.js → analytics-NBT5BH2R.js} +1 -1
  59. package/dist/assets/{analyticsHelper-BMvVz4OD.js → analyticsHelper-Bw6Cjeqd.js} +1 -1
  60. package/dist/assets/{core-BaXck2Yj.js → core-Dlma5MIa.js} +1 -1
  61. package/dist/assets/{decodeURIComponentSafe-B0jtUms3.js → decodeURIComponentSafe-MgEJs-XP.js} +1 -1
  62. package/dist/assets/{dnd-Cyb1SC5Y.js → dnd-BgBEAfSC.js} +1 -1
  63. package/dist/assets/{empty-H7TtSYmV.js → empty-BRn9rxGR.js} +1 -1
  64. package/dist/assets/{empty-M_3v5JZA.js → empty-DpC6uPKD.js} +1 -1
  65. package/dist/assets/{emptyVideoElement-BEqLDot8.js → emptyVideoElement-BpruyOrt.js} +1 -1
  66. package/dist/assets/{epic-sIgFMFjP.js → epic-TdjWG3DC.js} +1 -1
  67. package/dist/assets/{expenseAutomationHelper-DlEi6coP.js → expenseAutomationHelper-BpaM_jjL.js} +1 -1
  68. package/dist/assets/{getLocaleForTenant-DEaI00lX.js → getLocaleForTenant-B0nO-Z7L.js} +1 -1
  69. package/dist/assets/{index-BmT_wdak.js → index-Blw4A66-.js} +8 -8
  70. package/dist/assets/{index-VZMRwvc1.js → index-BtQ2P-s4.js} +1 -1
  71. package/dist/assets/{index-DTuBENEN.js → index-CYHgs6V3.js} +1 -1
  72. package/dist/assets/{index-CS4lDeLL.js → index-CexFEAIL.js} +1 -1
  73. package/dist/assets/{index-DGxDcX9G.js → index-Cr8P80rT.js} +1 -1
  74. package/dist/assets/{index-V57vyw7U.js → index-DHUOQOTf.js} +1 -1
  75. package/dist/assets/{index-DtPBjgXd.js → index-YntXYqu4.js} +2 -2
  76. package/dist/assets/{index-Dx3kI9l2.js → index-ui_UfE_7.js} +1 -1
  77. package/dist/assets/{lexical-VH6dL15l.js → lexical-Cc-23sPJ.js} +1 -1
  78. package/dist/assets/{liveblocks-CM7ZQqxd.js → liveblocks-BD1fi6wA.js} +1 -1
  79. package/dist/assets/{lottie-DYRVCvl4.js → lottie-Dd5kLrRz.js} +1 -1
  80. package/dist/assets/{mui-CeNVlxCm.js → mui-DPmPgDDD.js} +1 -1
  81. package/dist/assets/{pathToGoBack-DfpWL1zC.js → pathToGoBack-C5NlBrdk.js} +1 -1
  82. package/dist/assets/{pdf-Dhhhum3V.js → pdf-BCsxh4ki.js} +3 -3
  83. package/dist/assets/{pdf-lib-BXvJUWv4.js → pdf-lib-BSghpPvP.js} +1 -1
  84. package/dist/assets/{plaid-D9ECXCuG.js → plaid-w5kSeMkL.js} +1 -1
  85. package/dist/assets/{pusher-uue_Yphj.js → pusher-D_NnYp1B.js} +1 -1
  86. package/dist/assets/{react-cHKJDlzC.js → react-BRcmo_so.js} +1 -1
  87. package/dist/assets/{react-CW6xsUDz.js → react-BYFmdCmG.js} +1 -1
  88. package/dist/assets/{react-MyBVZkJi.js → react-BiCIC8nJ.js} +1 -1
  89. package/dist/assets/{react-BX9WMcs9.js → react-CKnkKWiv.js} +1 -1
  90. package/dist/assets/{react-BquQQNXI.js → react-Co4WxHXe.js} +1 -1
  91. package/dist/assets/{react-Bsy3W-uL.js → react-wEOgqpw3.js} +1 -1
  92. package/dist/assets/{recharts-BKC_cH7h.js → recharts-WuCIKI4c.js} +1 -1
  93. package/dist/assets/{routePaths-jc2bzNg2.js → routePaths-1GgW-roh.js} +1 -1
  94. package/dist/assets/{sentry-Dh9UB4O6.js → sentry-C6D8WJ15.js} +1 -1
  95. package/dist/assets/{url-Cpedw1H4.js → url-7hMA9KrE.js} +1 -1
  96. package/dist/assets/{url-CV8DVrqd.js → url-BVCS53n5.js} +1 -1
  97. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Ck3TknRq.js → useAiCfoDashboardSuggestedQuestionsChips-Cox0FTmj.js} +1 -1
  98. package/dist/assets/{useAskAiCfoHostNavButtonProps-fsQB3AjS.js → useAskAiCfoHostNavButtonProps-5qRN6gKs.js} +1 -1
  99. package/dist/assets/{useChargeCardPusherEvents-CioB6dpi.js → useChargeCardPusherEvents-Cu201ke6.js} +1 -1
  100. package/dist/assets/{useDeviceId-CilYhYRW.js → useDeviceId-p2IpPhWq.js} +1 -1
  101. package/dist/assets/{useEmailConnectResultRefresh-DfelAgkd.js → useEmailConnectResultRefresh-pFVkjSX_.js} +1 -1
  102. package/dist/assets/{useInitialThreadRequest-DOTaljn2.js → useInitialThreadRequest-Ddm4sao-.js} +1 -1
  103. package/dist/assets/{useTaskManagerAccess-LntCDDBS.js → useTaskManagerAccess-BKVtGCGL.js} +1 -1
  104. package/dist/assets/{utils-X6jrk5Hl.js → utils-Bv9LDtmr.js} +1 -1
  105. package/dist/assets/{withTransactionSidePanel-CSTE6dRA.js → withTransactionSidePanel-QyMR1bIP.js} +1 -1
  106. package/dist/assets/{zeni-epic-state-Bo1fQFWK.js → zeni-epic-state-2zvjmkUL.js} +3 -3
  107. package/dist/index.html +1 -1
  108. package/package.json +1 -1
  109. package/dist/assets/AddressRoutes-WhSb9kOA.js +0 -1
  110. package/dist/assets/CustomerOnboardingAuthScreen-WKQ_F3V-.js +0 -1
  111. package/dist/assets/NotFoundScreen-CbKfgA9a.js +0 -1
  112. package/dist/assets/TransactionDetailRoutes-ds3JOU2Z.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as B}from"./liveblocks-CM7ZQqxd.js";import{a as o}from"./sentry-Dh9UB4O6.js";import{h as K,g as W,u as X,j as m,s as q,l as Y}from"./core-BaXck2Yj.js";import{ag as Z,I as ee,d as G,z as te,r as $,ah as ne,l as ae,S as ce}from"./index-BmT_wdak.js";import{bn as se,fB as oe,gS as ie,of as H,TD as re,i5 as J,gd as le,o6 as ue,TE as de,TF as pe,tg as ge,lF as me,o4 as Ae,o0 as be,ob as Ie,i7 as fe,TG as ye,TH as Se}from"./zeni-epic-state-Bo1fQFWK.js";import{n as he}from"./mui-CeNVlxCm.js";import{M as Ee}from"./MobileAppDrawer-AMYN8Gjf.js";import{q as R}from"./QBOConnectionScreen-CgDmO8dD.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-ChrGBc2n.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]="18c3b971-2f3c-4932-a933-53d8e4728346",a._sentryDebugIdIdentifier="sentry-dbid-18c3b971-2f3c-4932-a933-53d8e4728346")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
1
+ import{j as B}from"./liveblocks-BD1fi6wA.js";import{a as o}from"./sentry-C6D8WJ15.js";import{h as K,g as W,u as X,j as m,s as q,l as Y}from"./core-Dlma5MIa.js";import{ag as Z,I as ee,d as G,z as te,r as $,ah as ne,l as ae,S as ce}from"./index-Blw4A66-.js";import{bn as se,fB as oe,gS as ie,of as H,TD as re,i5 as J,gd as le,o6 as ue,TE as de,TF as pe,tg as ge,lF as me,o4 as Ae,o0 as be,ob as Ie,i7 as fe,TG as ye,TH as Se}from"./zeni-epic-state-2zvjmkUL.js";import{n as he}from"./mui-DPmPgDDD.js";import{M as Ee}from"./MobileAppDrawer-BMvh-RAa.js";import{q as R}from"./QBOConnectionScreen-Cxvr0UGn.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-DsN6SM7a.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]="18c3b971-2f3c-4932-a933-53d8e4728346",a._sentryDebugIdIdentifier="sentry-dbid-18c3b971-2f3c-4932-a933-53d8e4728346")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-BD1fi6wA.js";import{A as o}from"./AddressScreen-TLZdvXNy.js";import i from"./NotFoundScreen-Wkt8x0Ja.js";import"./sentry-C6D8WJ15.js";import{n as s,o as r}from"./core-Dlma5MIa.js";import"./zeni-epic-state-2zvjmkUL.js";import"./recharts-WuCIKI4c.js";import"./index-Blw4A66-.js";import"./mui-DPmPgDDD.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.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-CM7ZQqxd.js";import{a as h}from"./sentry-Dh9UB4O6.js";import{h as T,u as P,g as j,i as E,j as B,l as U}from"./core-BaXck2Yj.js";import{$,E as M,z as D,U as L,a5 as K,a6 as z,l as C,S,a1 as F,X as b,a2 as N}from"./index-BmT_wdak.js";import{Ui as _,il as R,fB as G,Uj as O,c7 as V,Uk as q,ml as H}from"./zeni-epic-state-Bo1fQFWK.js";import{n as X}from"./mui-CeNVlxCm.js";import J from"./NotFoundScreen-CbKfgA9a.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]="d17107cf-56a8-4213-9430-d7cbcb40551f",e._sentryDebugIdIdentifier="sentry-dbid-d17107cf-56a8-4213-9430-d7cbcb40551f")}catch{}})();const Q=X.div`
1
+ import{j as n}from"./liveblocks-BD1fi6wA.js";import{a as h}from"./sentry-C6D8WJ15.js";import{h as T,u as P,g as j,i as E,j as B,l as U}from"./core-Dlma5MIa.js";import{$,E as M,z as D,U as L,a5 as K,a6 as z,l as C,S,a1 as F,X as b,a2 as N}from"./index-Blw4A66-.js";import{Ui as _,il as R,fB as G,Uj as O,c7 as V,Uk as q,ml as H}from"./zeni-epic-state-2zvjmkUL.js";import{n as X}from"./mui-DPmPgDDD.js";import J from"./NotFoundScreen-Wkt8x0Ja.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]="d17107cf-56a8-4213-9430-d7cbcb40551f",e._sentryDebugIdIdentifier="sentry-dbid-d17107cf-56a8-4213-9430-d7cbcb40551f")}catch{}})();const Q=X.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as m}from"./liveblocks-CM7ZQqxd.js";import{a as l}from"./sentry-Dh9UB4O6.js";import{u as Ue,h as Le,g as Fe,j as _,i as Be,l as Re}from"./core-BaXck2Yj.js";import{a as Ve,e2 as Me,z as $e,$ as Ge,e3 as qe,e4 as Ne,bm as le,e5 as he,e6 as He,bl as ge,a2 as H,a6 as $,l as w,e7 as G,e8 as ze,e9 as We,as as Ye,S as Je,w as Ke,ea as Xe,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-BmT_wdak.js";import{fA as z,gp as E,gx as W,Ta as lt,gr as Y,gH as rt,fB as dt,j0 as ct,a14 as ut,g4 as mt,je as pt,ja as St,fC as q,gb as ht,a15 as gt,a16 as ft,a17 as Ct,jx as N,gq as kt,gk as de,jK as ce,gm as ue,gs as It,a18 as me,jz as bt,j7 as vt,jl as Et,jv as pe,ji as Pt,jo as xt,gt as wt,gu as yt,gv as Tt,gw as At}from"./zeni-epic-state-Bo1fQFWK.js";import{D as Qt,n as y,S as jt,P as Ot}from"./mui-CeNVlxCm.js";import{u as _t}from"./useAiCfoDashboardSuggestedQuestionsChips-Ck3TknRq.js";import{p as Dt}from"./pathToGoBack-DfpWL1zC.js";import"./recharts-BKC_cH7h.js";import"./analytics-WNjEvDwJ.js";import"./plaid-D9ECXCuG.js";import"./dnd-Cyb1SC5Y.js";import"./stripe-cKAAJElX.js";import"./lottie-DYRVCvl4.js";import"./lexical-VH6dL15l.js";import"./pdf-Dhhhum3V.js";import"./utils-X6jrk5Hl.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]="af2ca7a3-7226-4165-81e6-b5278750ab27",e._sentryDebugIdIdentifier="sentry-dbid-af2ca7a3-7226-4165-81e6-b5278750ab27")}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:N(e).detail,skillDetailError:N(e).fetchState==="Error",skillDetailLoading:N(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:x}=o,T=p.tenantEmailDomain;return{onEventReceived:(t,a)=>{if(t===fe&&typeof a.text=="string"&&typeof a.metadata=="object"){const d=a,u=wt(d.type),h=d.metadata.chat_session_id??null,{currentChatSession:k,currentQuestionAnswer:A,currentQuestionAnswerSummary:b}=ge(C,h);u!=="answer"?w.trackAICFOChatResponseGenerated(u,A?.question.questionText??"",d.text,h,it(b,k),d.metadata.message_id??null):w.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(xt({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(Y()),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"}}),x(!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(Y()),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:()=>{x(!0),S(`/${T}/cards`,{state:{...s.state}})},onAfterCardPolicySubmit:()=>{x(!0),S(`/${T}/cards/policy`,{state:{...s.state}})}})}}))(Ke(Xe)),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]),x=l.useCallback((()=>{s(Y())}),[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=Ge(),b=Ye(A),f=_((i=>dt(i))),r=u.uiState.currentChatSessionId,J=f.tenantEmailDomain,{handleUploadPromoClose:Ce,isUploadPromoVisible:ke}=qe({isFileUploadEnabled:e,tenantEmailDomain:J}),D=Ne({currentTenant:f,currentChatSessionId:r,aiCfoView:u,skillsEnabled:g,onCloseSkills:x,onOpenSkills:P}),{isSuggestedQuestionsLoading:Ie,suggestedPromptQuestions:be}=_t(),Q=n.state,j=Q?.aiCfoInitialQuestion,K=!!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),[xe,B]=l.useState(void 0),X=l.useRef(!1);l.useEffect((()=>{if(!X.current&&j!=null&&j!==""){const i=n.state;U(j),L(K),F(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const I=i?.aiCfoSuggestionIndex;B(typeof I=="number"?I:void 0),X.current=!0}}),[j,K,n.state]);const we=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:w,onLoad:ie}),D.drawerElement,m.jsx(Rt,{children:m.jsx(Se,{children:m.jsx(G,{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:w,onLoad:ie}):null,m.jsx(G,{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:w,onLoad:i=>i.trackPageLoaded(Je.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:we,routedInitialQuestionSource:Pe,routedInitialQuestionSuggestionIndex:xe,onCardPolicyVendorSearchTextChange:d,onMenuClick:b?D.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ke,onUploadPromoClose:Ce,exploreSuggestedPromptQuestions:be,exploreSuggestedPromptQuestionsLoading:Ie,isSkillsOpen:C,isCreateSkillEnabled:g,promoDismissalScope:J}),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(G,{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-BD1fi6wA.js";import{a as l}from"./sentry-C6D8WJ15.js";import{u as Ue,h as Le,g as Fe,j as _,i as Be,l as Re}from"./core-Dlma5MIa.js";import{a as Ve,e2 as Me,z as $e,$ as Ge,e3 as qe,e4 as Ne,bm as le,e5 as he,e6 as He,bl as ge,a2 as H,a6 as $,l as w,e7 as G,e8 as ze,e9 as We,as as Ye,S as Je,w as Ke,ea as Xe,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-Blw4A66-.js";import{fA as z,gp as E,gx as W,Ta as lt,gr as Y,gH as rt,fB as dt,j0 as ct,a14 as ut,g4 as mt,je as pt,ja as St,fC as q,gb as ht,a15 as gt,a16 as ft,a17 as Ct,jx as N,gq as kt,gk as de,jK as ce,gm as ue,gs as It,a18 as me,jz as bt,j7 as vt,jl as Et,jv as pe,ji as Pt,jo as xt,gt as wt,gu as yt,gv as Tt,gw as At}from"./zeni-epic-state-2zvjmkUL.js";import{D as Qt,n as y,S as jt,P as Ot}from"./mui-DPmPgDDD.js";import{u as _t}from"./useAiCfoDashboardSuggestedQuestionsChips-Cox0FTmj.js";import{p as Dt}from"./pathToGoBack-C5NlBrdk.js";import"./recharts-WuCIKI4c.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.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]="af2ca7a3-7226-4165-81e6-b5278750ab27",e._sentryDebugIdIdentifier="sentry-dbid-af2ca7a3-7226-4165-81e6-b5278750ab27")}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:N(e).detail,skillDetailError:N(e).fetchState==="Error",skillDetailLoading:N(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:x}=o,T=p.tenantEmailDomain;return{onEventReceived:(t,a)=>{if(t===fe&&typeof a.text=="string"&&typeof a.metadata=="object"){const d=a,u=wt(d.type),h=d.metadata.chat_session_id??null,{currentChatSession:k,currentQuestionAnswer:A,currentQuestionAnswerSummary:b}=ge(C,h);u!=="answer"?w.trackAICFOChatResponseGenerated(u,A?.question.questionText??"",d.text,h,it(b,k),d.metadata.message_id??null):w.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(xt({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(Y()),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"}}),x(!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(Y()),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:()=>{x(!0),S(`/${T}/cards`,{state:{...s.state}})},onAfterCardPolicySubmit:()=>{x(!0),S(`/${T}/cards/policy`,{state:{...s.state}})}})}}))(Ke(Xe)),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]),x=l.useCallback((()=>{s(Y())}),[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=Ge(),b=Ye(A),f=_((i=>dt(i))),r=u.uiState.currentChatSessionId,J=f.tenantEmailDomain,{handleUploadPromoClose:Ce,isUploadPromoVisible:ke}=qe({isFileUploadEnabled:e,tenantEmailDomain:J}),D=Ne({currentTenant:f,currentChatSessionId:r,aiCfoView:u,skillsEnabled:g,onCloseSkills:x,onOpenSkills:P}),{isSuggestedQuestionsLoading:Ie,suggestedPromptQuestions:be}=_t(),Q=n.state,j=Q?.aiCfoInitialQuestion,K=!!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),[xe,B]=l.useState(void 0),X=l.useRef(!1);l.useEffect((()=>{if(!X.current&&j!=null&&j!==""){const i=n.state;U(j),L(K),F(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const I=i?.aiCfoSuggestionIndex;B(typeof I=="number"?I:void 0),X.current=!0}}),[j,K,n.state]);const we=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:w,onLoad:ie}),D.drawerElement,m.jsx(Rt,{children:m.jsx(Se,{children:m.jsx(G,{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:w,onLoad:ie}):null,m.jsx(G,{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:w,onLoad:i=>i.trackPageLoaded(Je.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:we,routedInitialQuestionSource:Pe,routedInitialQuestionSuggestionIndex:xe,onCardPolicyVendorSearchTextChange:d,onMenuClick:b?D.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ke,onUploadPromoClose:Ce,exploreSuggestedPromptQuestions:be,exploreSuggestedPromptQuestionsLoading:Ie,isSkillsOpen:C,isCreateSkillEnabled:g,promoDismissalScope:J}),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(G,{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-CM7ZQqxd.js";import{a as n,R as ba}from"./sentry-Dh9UB4O6.js";import{u as Ae,j as r,g as Sa,h as ka,q as H}from"./core-BaXck2Yj.js";import{fB as _e,SY as Ea,SZ as De,g5 as wa,gr as J,gx as ke,S_ as ya,S$ as Ia,gL as Ta,pF as va,T0 as $a,T1 as Ee,gi as Ba,T2 as v,fA as xa,gp as Aa,T3 as _a,T4 as we,T5 as Da,T6 as ye,T7 as Fa,Db as Ma,gj as Za,g_ as Ga,cS as Ha,T8 as ja,T9 as La,qh as Va,g4 as Na,j3 as Pa,Ta as Ra,vA as Oa,gk as Ua}from"./zeni-epic-state-Bo1fQFWK.js";import{w as za,i as Ya,a as qa,c as Ja,E as Ka,I as Wa,d as C,e as Qa,u as Xa,f as et,g as at,h as tt,j as nt,k as ot,z as st,l as j,p as g,m as Ie,n as rt,o as it,q as Te,r as lt,s as ve,v as dt,x as ct,y as K,A as $e,B as ut,C as Ct,D as mt,L as pt,F as ht,H as ft,J as W,K as gt,M as bt}from"./index-BmT_wdak.js";import{A as St,b as kt,I as Et,a as Be,d as wt,D as xe}from"./mui-CeNVlxCm.js";import{u as yt}from"./InboxNotificationsProvider-DLtCSJ1e.js";import{u as It}from"./useTaskManagerAccess-LntCDDBS.js";import{u as Tt}from"./expenseAutomationHelper-DlEi6coP.js";import"./recharts-BKC_cH7h.js";import"./analytics-WNjEvDwJ.js";import"./plaid-D9ECXCuG.js";import"./dnd-Cyb1SC5Y.js";import"./stripe-cKAAJElX.js";import"./lottie-DYRVCvl4.js";import"./lexical-VH6dL15l.js";import"./pdf-Dhhhum3V.js";import"./utils-X6jrk5Hl.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]="7a074ee7-2f69-4027-8fb3-69604af5ee6e",a._sentryDebugIdIdentifier="sentry-dbid-7a074ee7-2f69-4027-8fb3-69604af5ee6e")}catch{}})();const $="AppDrawer",c={root:`${$}-root`,drawer:`${$}-drawer`,appBar:`${$}-appBar`,menuButton:`${$}-menuButton`,appBarZenilogo:`${$}-appBarZenilogo`,drawerZenilogo:`${$}-drawerZenilogo`},vt=W("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:K,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"}}))),$t=za((function({tenantEmailDomain:a}){const{isAiCfoOpen:m,setIsAiCfoOpen:b}=qa(),[L,A]=ba.useState(!1),[S,Fe]=n.useState(!1),t=Sa(),i=ka(),Q=wa(),X=Ja(),o=Ae(),[Me,Ze]=n.useState(!1),V=Ka(),ee=t.pathname.includes("/ai-cfo/");n.useEffect((()=>{ee||o(J())}),[o,ee]),n.useEffect((()=>{o(J())}),[o,a]);const{useFeatureGate:u}=Wa(),{isFeatureEnabled:ae}=u(C.isDebitCardFeatureEnabled),k=Qa(),s=r((e=>_e(e))),te=s.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ge}=Xa(),B=et(),{isTaskManagerAccessEnabled:_,isZeniUser:He}=It(k),ne=at(),E=tt();n.useEffect((()=>{E&&B&&o(ke())}),[o,E,s.tenantId,B]);const[N,je]=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=>ya(e)));n.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>Ia(e))),p=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),h=r((e=>Ta(e))),{monthEndCloseChecksView:w}=h,Oe=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,se=H("/:tenantEmailDomain/reports")!==null,f=H("/:tenantEmailDomain/onboarding/*")!==null,re=Tt();n.useEffect((()=>{E&&D&&!f&&P.fetchState==="Not-Started"&&o(va(!0))}),[E,D,P.fetchState,f]),n.useEffect((()=>{if(re){const e=t.state?.origin;if(e!=null){const d=$a(e);d!=null&&o(Ee(d))}}}),[re,t.state]);const Ue=Oe||f,R=r((e=>e.tenantState)),ze=r((e=>R.fetchState==="Completed"?Ba(e):[])),{isFeatureEnabled:Ye}=u(C.isApAgingFeatureEnabled),{isFeatureEnabled:qe}=u(C.isArAgingFeatureEnabled),{isFeatureEnabled:Je}=u(C.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Ke}=u(C.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:We}=u(C.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Qe}=u(C.isDashboardSidebarNewYearAnimationEnabled),Xe=r((e=>v(e).totalUnreadCount)),ea=r((e=>v(e).notificationDetailsByTab.tasks.uiState.unreadCount)),aa=r((e=>v(e).notificationDetailsByTab.comments.uiState.unreadCount)),ta=r((e=>v(e).reducedFetchCountState)),ie=r((e=>v(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>xa(e))),na=r((e=>Aa(e).skillsEnabled)),{status:le}=r(_a),[y,U]=n.useState(void 0),z=O.uiState.currentChatSessionId,M=y!=null?O.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,de=ot(M),{inboxNotifications:Y,isLoading:ce,isFetchingMore:ue,hasFetchedAll:Ce,fetchMore:oa}=yt(),Z=r((e=>v(e).notificationDetailsByTab.comments.fetchCountState));n.useEffect((()=>{const e=setTimeout((()=>oa?.()),0);return()=>clearTimeout(e)})),n.useEffect((()=>{if(y!=null)return de==="In-Progress"&&M==="Completed"?(o(we({chatSessionId:y})),U(void 0),void i(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(M==="Error"&&(o(we({chatSessionId:y})),U(void 0)))}),[o,t.state,i,M,y,de,a]),n.useEffect((()=>{if(ce===!1&&ue===!1&&Ce===!0&&s?.companyId!=null&&Y!=null){const e=`dashboard_${s.companyId}`;je(Y.filter((d=>d.roomId===e&&d.readAt==null)).length)}}),[ce,ue,Ce,s?.companyId,Y]),n.useEffect((()=>{E&&_&&!f&&ie.fetchState==="Not-Started"&&Q.tenantId!=null&&o(Da("task_manager","dashboard"))}),[E,_,f,ie.fetchState,Q.tenantId,o]),n.useEffect((()=>{f||Z.fetchState!=="Not-Started"||o(ye({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(ye({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(De({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const sa={fetchStatus:ta,count:Xe},I=[];Ye===!1&&I.push("accounts_payable_aging"),qe===!1&&I.push("accounts_receivable_aging"),I.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&I.push("rewards_card"),ne===!1&&I.push("expense_automation_card");const me=r((e=>Fa(e,I).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=Ha(ia),T=e=>{A(e)},da=Re,ca=s?.rewardsLastViewedTime==null,ua=k?.userEmail!=null&&oe.fetchState==="Completed"&&ja(oe.notificationSettings,k.userEmail,ae,s,_),Ca=n.useCallback((e=>{const d=t.state?.referrer;if(w.monthEndCloseChecks?.auditSummary!=null&&j.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:Ie[2]})),[S]),pa=B&&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?ve("ai_cfo"):Te(t)&&le!=="completed"?ve("invoicing"):dt(t),isTenantDropdownDisabled:ra,isSettings:lt(t),isInvoicing:Te(t)&&le==="completed",isSettingsFeatureEnabled:Pe,currentTenant:s,isVendorsTabVisible:la,isZeniAccountEnabled:Le,isChargeCardEnabled:Ne,isTreasuryEnabled:da,isNotificationsTabVisible:ua,notificationCountDetails:sa,isExpenseAutomationEnabledForUser:ne,isAiCfoAccessEnabled:B,skillsEnabled:na&&B,onNotificationIconClick:()=>{T(!1);const e=He?ea===0&&aa>0?"notifications/comments":"notifications/tasks":"notifications/comments",d=g(t.state?.pathnameStackToGoBack,t.pathname);i(`${a}/${e}`,{state:{pathnameStackToGoBack:d}})},onZeniLogoClick:()=>{X.toggle()},handleTenantSelect:e=>{Ge(pt.TENANT_SWITCHING),T(!1),ht({dispatch:o,navigate:i,pathToNavigate:ft(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,d)=>{if(k!=null&&j.trackSidePanelClicked(e.type,e.group),T(!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 $e({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});if(o(J()),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(j.trackAICFOChatScreenStateChanged("viewed","left_menu",z??null,null),!te)return void $e({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),q=e.type,Se=bt(q)&&q!=="command_center";if(q!=="command_center"&&!Se||p[s.tenantId]==null||j.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:()=>{T(!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:Je,thanksGivingAnimationEnabled:Ke,christmasAnimationEnabled:We,newYearAnimationEnabled:Qe}),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:()=>T(!0),className:c.menuButton,size:"large",children:l.jsx(Bt,{})}),l.jsx(xt,{className:c.appBarZenilogo,onClick:()=>{X.toggle()}})]})}),be=Be((e=>e.breakpoints.up("md"))),fa=Be((e=>e.breakpoints.down("md")));return a==null?null:l.jsxs(vt,{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:()=>T(!1),PaperProps:{sx:{width:K,zIndex:Ie[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ge}),fa?null:l.jsx(xe,{PaperProps:{sx:{width:K,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ma}},variant:"permanent",open:!0,children:ge})]})]}):null]})})),qt=({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)=>{Ya(S)&&Ea(S.mode)==="dashboard"&&m(De({unreadCount:S.data.unread},"tasks"))}};return l.jsx($t,{tenantEmailDomain:a,...L})},Bt=W((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-BD1fi6wA.js";import{a as n,R as ba}from"./sentry-C6D8WJ15.js";import{u as Ae,j as r,g as Sa,h as ka,q as H}from"./core-Dlma5MIa.js";import{fB as _e,SY as Ea,SZ as De,g5 as wa,gr as J,gx as ke,S_ as ya,S$ as Ia,gL as Ta,pF as va,T0 as $a,T1 as Ee,gi as Ba,T2 as v,fA as xa,gp as Aa,T3 as _a,T4 as we,T5 as Da,T6 as ye,T7 as Fa,Db as Ma,gj as Za,g_ as Ga,cS as Ha,T8 as ja,T9 as La,qh as Va,g4 as Na,j3 as Pa,Ta as Ra,vA as Oa,gk as Ua}from"./zeni-epic-state-2zvjmkUL.js";import{w as za,i as Ya,a as qa,c as Ja,E as Ka,I as Wa,d as C,e as Qa,u as Xa,f as et,g as at,h as tt,j as nt,k as ot,z as st,l as j,p as g,m as Ie,n as rt,o as it,q as Te,r as lt,s as ve,v as dt,x as ct,y as K,A as $e,B as ut,C as Ct,D as mt,L as pt,F as ht,H as ft,J as W,K as gt,M as bt}from"./index-Blw4A66-.js";import{A as St,b as kt,I as Et,a as Be,d as wt,D as xe}from"./mui-DPmPgDDD.js";import{u as yt}from"./InboxNotificationsProvider-7eYmgI1F.js";import{u as It}from"./useTaskManagerAccess-BKVtGCGL.js";import{u as Tt}from"./expenseAutomationHelper-BpaM_jjL.js";import"./recharts-WuCIKI4c.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.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]="7a074ee7-2f69-4027-8fb3-69604af5ee6e",a._sentryDebugIdIdentifier="sentry-dbid-7a074ee7-2f69-4027-8fb3-69604af5ee6e")}catch{}})();const $="AppDrawer",c={root:`${$}-root`,drawer:`${$}-drawer`,appBar:`${$}-appBar`,menuButton:`${$}-menuButton`,appBarZenilogo:`${$}-appBarZenilogo`,drawerZenilogo:`${$}-drawerZenilogo`},vt=W("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:K,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"}}))),$t=za((function({tenantEmailDomain:a}){const{isAiCfoOpen:m,setIsAiCfoOpen:b}=qa(),[L,A]=ba.useState(!1),[S,Fe]=n.useState(!1),t=Sa(),i=ka(),Q=wa(),X=Ja(),o=Ae(),[Me,Ze]=n.useState(!1),V=Ka(),ee=t.pathname.includes("/ai-cfo/");n.useEffect((()=>{ee||o(J())}),[o,ee]),n.useEffect((()=>{o(J())}),[o,a]);const{useFeatureGate:u}=Wa(),{isFeatureEnabled:ae}=u(C.isDebitCardFeatureEnabled),k=Qa(),s=r((e=>_e(e))),te=s.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ge}=Xa(),B=et(),{isTaskManagerAccessEnabled:_,isZeniUser:He}=It(k),ne=at(),E=tt();n.useEffect((()=>{E&&B&&o(ke())}),[o,E,s.tenantId,B]);const[N,je]=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=>ya(e)));n.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>Ia(e))),p=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),h=r((e=>Ta(e))),{monthEndCloseChecksView:w}=h,Oe=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,se=H("/:tenantEmailDomain/reports")!==null,f=H("/:tenantEmailDomain/onboarding/*")!==null,re=Tt();n.useEffect((()=>{E&&D&&!f&&P.fetchState==="Not-Started"&&o(va(!0))}),[E,D,P.fetchState,f]),n.useEffect((()=>{if(re){const e=t.state?.origin;if(e!=null){const d=$a(e);d!=null&&o(Ee(d))}}}),[re,t.state]);const Ue=Oe||f,R=r((e=>e.tenantState)),ze=r((e=>R.fetchState==="Completed"?Ba(e):[])),{isFeatureEnabled:Ye}=u(C.isApAgingFeatureEnabled),{isFeatureEnabled:qe}=u(C.isArAgingFeatureEnabled),{isFeatureEnabled:Je}=u(C.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Ke}=u(C.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:We}=u(C.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Qe}=u(C.isDashboardSidebarNewYearAnimationEnabled),Xe=r((e=>v(e).totalUnreadCount)),ea=r((e=>v(e).notificationDetailsByTab.tasks.uiState.unreadCount)),aa=r((e=>v(e).notificationDetailsByTab.comments.uiState.unreadCount)),ta=r((e=>v(e).reducedFetchCountState)),ie=r((e=>v(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>xa(e))),na=r((e=>Aa(e).skillsEnabled)),{status:le}=r(_a),[y,U]=n.useState(void 0),z=O.uiState.currentChatSessionId,M=y!=null?O.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,de=ot(M),{inboxNotifications:Y,isLoading:ce,isFetchingMore:ue,hasFetchedAll:Ce,fetchMore:oa}=yt(),Z=r((e=>v(e).notificationDetailsByTab.comments.fetchCountState));n.useEffect((()=>{const e=setTimeout((()=>oa?.()),0);return()=>clearTimeout(e)})),n.useEffect((()=>{if(y!=null)return de==="In-Progress"&&M==="Completed"?(o(we({chatSessionId:y})),U(void 0),void i(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(M==="Error"&&(o(we({chatSessionId:y})),U(void 0)))}),[o,t.state,i,M,y,de,a]),n.useEffect((()=>{if(ce===!1&&ue===!1&&Ce===!0&&s?.companyId!=null&&Y!=null){const e=`dashboard_${s.companyId}`;je(Y.filter((d=>d.roomId===e&&d.readAt==null)).length)}}),[ce,ue,Ce,s?.companyId,Y]),n.useEffect((()=>{E&&_&&!f&&ie.fetchState==="Not-Started"&&Q.tenantId!=null&&o(Da("task_manager","dashboard"))}),[E,_,f,ie.fetchState,Q.tenantId,o]),n.useEffect((()=>{f||Z.fetchState!=="Not-Started"||o(ye({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(ye({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(De({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const sa={fetchStatus:ta,count:Xe},I=[];Ye===!1&&I.push("accounts_payable_aging"),qe===!1&&I.push("accounts_receivable_aging"),I.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&I.push("rewards_card"),ne===!1&&I.push("expense_automation_card");const me=r((e=>Fa(e,I).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=Ha(ia),T=e=>{A(e)},da=Re,ca=s?.rewardsLastViewedTime==null,ua=k?.userEmail!=null&&oe.fetchState==="Completed"&&ja(oe.notificationSettings,k.userEmail,ae,s,_),Ca=n.useCallback((e=>{const d=t.state?.referrer;if(w.monthEndCloseChecks?.auditSummary!=null&&j.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:Ie[2]})),[S]),pa=B&&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?ve("ai_cfo"):Te(t)&&le!=="completed"?ve("invoicing"):dt(t),isTenantDropdownDisabled:ra,isSettings:lt(t),isInvoicing:Te(t)&&le==="completed",isSettingsFeatureEnabled:Pe,currentTenant:s,isVendorsTabVisible:la,isZeniAccountEnabled:Le,isChargeCardEnabled:Ne,isTreasuryEnabled:da,isNotificationsTabVisible:ua,notificationCountDetails:sa,isExpenseAutomationEnabledForUser:ne,isAiCfoAccessEnabled:B,skillsEnabled:na&&B,onNotificationIconClick:()=>{T(!1);const e=He?ea===0&&aa>0?"notifications/comments":"notifications/tasks":"notifications/comments",d=g(t.state?.pathnameStackToGoBack,t.pathname);i(`${a}/${e}`,{state:{pathnameStackToGoBack:d}})},onZeniLogoClick:()=>{X.toggle()},handleTenantSelect:e=>{Ge(pt.TENANT_SWITCHING),T(!1),ht({dispatch:o,navigate:i,pathToNavigate:ft(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,d)=>{if(k!=null&&j.trackSidePanelClicked(e.type,e.group),T(!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 $e({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});if(o(J()),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(j.trackAICFOChatScreenStateChanged("viewed","left_menu",z??null,null),!te)return void $e({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),q=e.type,Se=bt(q)&&q!=="command_center";if(q!=="command_center"&&!Se||p[s.tenantId]==null||j.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:()=>{T(!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:Je,thanksGivingAnimationEnabled:Ke,christmasAnimationEnabled:We,newYearAnimationEnabled:Qe}),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:()=>T(!0),className:c.menuButton,size:"large",children:l.jsx(Bt,{})}),l.jsx(xt,{className:c.appBarZenilogo,onClick:()=>{X.toggle()}})]})}),be=Be((e=>e.breakpoints.up("md"))),fa=Be((e=>e.breakpoints.down("md")));return a==null?null:l.jsxs(vt,{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:()=>T(!1),PaperProps:{sx:{width:K,zIndex:Ie[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ge}),fa?null:l.jsx(xe,{PaperProps:{sx:{width:K,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ma}},variant:"permanent",open:!0,children:ge})]})]}):null]})})),qt=({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)=>{Ya(S)&&Ea(S.mode)==="dashboard"&&m(De({unreadCount:S.data.unread},"tasks"))}};return l.jsx($t,{tenantEmailDomain:a,...L})},Bt=W((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-CM7ZQqxd.js";import{a as d}from"./sentry-Dh9UB4O6.js";import{h as U,g as B,u as j,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-BaXck2Yj.js";import{fB as P,XU as w,XB as R,GK as E,GC as X,GG as A,Gv as q,XD as K,Gz as ae,GM as oe,Gy as z,GP as M,GL as C}from"./zeni-epic-state-Bo1fQFWK.js";import{z as O,w as Q,bW as pe,r as T,bQ as Y,bX as le,E as Z,a5 as H,bY as se,bZ as ne}from"./index-BmT_wdak.js";import"./mui-CeNVlxCm.js";import{u as J,i as re}from"./ReimbursementApprovalRuleDetailScreen-YsjpcW9c.js";import ie from"./NotFoundScreen-CbKfgA9a.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]="99feed3c-5ccf-44f6-b701-2e81d682b5ef",e._sentryDebugIdIdentifier="sentry-dbid-99feed3c-5ccf-44f6-b701-2e81d682b5ef")}catch{}})();const _="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(Q(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(X(!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}.${_}`]:[],eventCallback:(r,h,b)=>{r.endsWith(_)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{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(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(Q(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Y(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)));J();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(X(!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 b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,I,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},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((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);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(M(!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(z(!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(H,{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 I=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((k=>({type:"attribute",subType:k.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((k=>({type:"user",userId:k.userId,isImplicitActor:!1}))));const G=m.action??"require_approval";I.push({action:G,actors:D,operator:D.length>1?G==="require_approval"?"or":"and":"is"})})),I},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 b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),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(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function $(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Y(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(J(),d.useEffect((()=>{p||(f(!0),l(z(!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(H,{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($,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx($,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
1
+ import{j as u}from"./liveblocks-BD1fi6wA.js";import{a as d}from"./sentry-C6D8WJ15.js";import{h as U,g as B,u as j,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-Dlma5MIa.js";import{fB as P,XU as w,XB as R,GK as E,GC as X,GG as A,Gv as q,XD as K,Gz as ae,GM as oe,Gy as z,GP as M,GL as C}from"./zeni-epic-state-2zvjmkUL.js";import{z as O,w as Q,bW as pe,r as T,bQ as Y,bX as le,E as Z,a5 as H,bY as se,bZ as ne}from"./index-Blw4A66-.js";import"./mui-DPmPgDDD.js";import{u as J,i as re}from"./ReimbursementApprovalRuleDetailScreen-kIivYyt0.js";import ie from"./NotFoundScreen-Wkt8x0Ja.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]="99feed3c-5ccf-44f6-b701-2e81d682b5ef",e._sentryDebugIdIdentifier="sentry-dbid-99feed3c-5ccf-44f6-b701-2e81d682b5ef")}catch{}})();const _="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(Q(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(X(!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}.${_}`]:[],eventCallback:(r,h,b)=>{r.endsWith(_)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{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(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(Q(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Y(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)));J();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(X(!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 b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,I,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},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((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);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(M(!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(z(!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(H,{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 I=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((k=>({type:"attribute",subType:k.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((k=>({type:"user",userId:k.userId,isImplicitActor:!1}))));const G=m.action??"require_approval";I.push({action:G,actors:D,operator:D.length>1?G==="require_approval"?"or":"and":"is"})})),I},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 b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),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(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function $(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Y(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(J(),d.useEffect((()=>{p||(f(!0),l(z(!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(H,{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($,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx($,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-CM7ZQqxd.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Y,q as na,n as ia,o as y}from"./core-BaXck2Yj.js";import{fB as Z,Xb as Ge,bq as kt,Rh as oa,bo as wt,bJ as de,Xc as Bt,G0 as xt,Hf as Ve,Gz as la,bn as Ae,Xd as sa,Xe as ra,c7 as ca,Xf as da,lF as Ct,Xg as At,Xh as Et,HQ as _e,Gf as xe,Xi as ua,FQ as at,Xj as pa,LF as ma,FU as ba,F_ as Dt,Xk as Se,Xl as Me,Hg as Oe,Xm as ha,Xn as ga,Hj as Ne,Xo as Sa,Hw as ya,Xp as Tt,H0 as nt,H5 as fa,Xq as Ia,Xr as ce,Xs as jt,Xt as Pt,Xu as Ft,gS as va,Gk as $e,cF as Rt,Xv as ka,gd as wa,Xw as Ba,Xx as xa,dV as Vt,dU as $t,Xy as Xe,Xz as Ca,XA as Aa,UM as ze,XB as Ea,UN as ie,UO as He,XC as Da,XD as Ta,XE as ja,H7 as it,H4 as Pa,XF as Fa,XG as Ra,XH as Va,GS as $a,XI as La,XJ as Ua,ct as Lt,d6 as Ut,lQ as Ga,bO as _a,br as Gt,bP as _t,F3 as Ma,XK as Oa,Ls as Na,Ly as Xa,Bf as za,Hh as Ha,HX as Za,m1 as ge,XL as Wa,XM as Mt,mv as qa,lX as Ot,mg as Nt,mf as ot,bE as pe,bN as Qa,XN as Ja,XO as ye,kr as Ka,XP as lt,XQ as Ya,kv as en,kQ as tn,I9 as an,XR as nn,mo as on,H$ as ln,XS as st,I3 as sn,I8 as rn,I6 as cn,HZ as dn,XT as Xt,G9 as un,XU as pn,XV as mn,gD as bn,gC as hn,gB as gn,m4 as Sn,mm as rt,mx as yn,u1 as fn,md as In,I1 as vn,kB as kn,mC as wn,XW as Bn,kt as xn,tU as Cn,XX as An,GY as En,bK as Dn,bt as Tn,Tc as jn,d9 as Pn,d8 as Fn,cE as Rn,cL as Vn}from"./zeni-epic-state-Bo1fQFWK.js";import{E as ue,z as L,U as fe,aq as Ze,I as oe,d as g,bg as We,a5 as se,K as A,a6 as Ee,l 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 Un,ad as Gn,aW as _n,a9 as zt,G as De,ae as Qe,bw as Mn,ac as Ht,bx as On,ao as Nn,S as Zt,w as Xn,by as zn,bz as Hn,bA as Zn,bB as Wn,bC as qn,bD as Qn,bE as Jn,bF as Kn,bG as Yn,c as ei,bH as ti,bp as ai,bI as ni,ag as ii,bJ as oi,j as li}from"./index-BmT_wdak.js";import{n as G,S as si}from"./mui-CeNVlxCm.js";import{A as ut}from"./AddressScreen-2iFQsQhr.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-5wKaAYNZ.js";import{a as f}from"./sentry-Dh9UB4O6.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-fsQB3AjS.js";import{u as qt}from"./useInitialThreadRequest-DOTaljn2.js";import{u as ui}from"./BusinessVerificationPageScreen-bzYA6ugA.js";import Ce from"./NotFoundScreen-CbKfgA9a.js";import{D as pi}from"./DrawerScreen-DXivMtkW.js";import{M as Qt}from"./MobileAppDrawer-AMYN8Gjf.js";import{F as Jt}from"./FeaturePreviewScreen-C4egsTmn.js";import{S as je}from"./SetupPagesScreen-BSF8vuHb.js";import{B as mi}from"./BillPayApprovalRoutes-D6CaIPVl.js";import{F as bi}from"./ScreenRoutes-u4rkodoe.js";import"./recharts-BKC_cH7h.js";import"./analytics-WNjEvDwJ.js";import"./plaid-D9ECXCuG.js";import"./dnd-Cyb1SC5Y.js";import"./stripe-cKAAJElX.js";import"./lottie-DYRVCvl4.js";import"./lexical-VH6dL15l.js";import"./pdf-Dhhhum3V.js";import"./utils-X6jrk5Hl.js";import"./routePaths-jc2bzNg2.js";import"./InboxNotificationsProvider-DLtCSJ1e.js";import"./useTaskManagerAccess-LntCDDBS.js";import"./analyticsHelper-BMvVz4OD.js";import"./ReimbursementApprovalRuleDetailScreen-YsjpcW9c.js";import"./getLocaleForTenant-DEaI00lX.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]="6ba9f984-3946-4fb7-8aa8-9b6d654084a0",e._sentryDebugIdIdentifier="sentry-dbid-6ba9f984-3946-4fb7-8aa8-9b6d654084a0")}catch{}})();const hi=Y((function(e,t){const l=Ge(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((z=>Z(z))),s=k((z=>Ge(z,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}=Ye({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),X=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:Q}=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&&(X||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,X,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,$,Q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,Q]),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:z=>(U=>{n!=null&&U.trackBillPayBillDetails(n,s.isRecurring)})(z)}),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 zt(100,58)},mt=Y((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 X=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ge(F,n??"")));u===!1&&(X=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const Q=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((()=>{X==="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 z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Q??"",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(Q??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},U=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(X==="Error"||q.fetchState==="Error")return a.jsx(Ce,{});if(X!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:U,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:Q}),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:U,"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:U,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Un,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,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-BD1fi6wA.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Y,q as na,n as ia,o as y}from"./core-Dlma5MIa.js";import{fB as Z,Xb as Ge,bq as kt,Rh as oa,bo as wt,bJ as de,Xc as Bt,G0 as xt,Hf as Ve,Gz as la,bn as Ae,Xd as sa,Xe as ra,c7 as ca,Xf as da,lF as Ct,Xg as At,Xh as Et,HQ as _e,Gf as xe,Xi as ua,FQ as at,Xj as pa,LF as ma,FU as ba,F_ as Dt,Xk as Se,Xl as Me,Hg as Oe,Xm as ha,Xn as ga,Hj as Ne,Xo as Sa,Hw as ya,Xp as Tt,H0 as nt,H5 as fa,Xq as Ia,Xr as ce,Xs as jt,Xt as Pt,Xu as Ft,gS as va,Gk as $e,cF as Rt,Xv as ka,gd as wa,Xw as Ba,Xx as xa,dV as Vt,dU as $t,Xy as Xe,Xz as Ca,XA as Aa,UM as ze,XB as Ea,UN as ie,UO as He,XC as Da,XD as Ta,XE as ja,H7 as it,H4 as Pa,XF as Fa,XG as Ra,XH as Va,GS as $a,XI as La,XJ as Ua,ct as Lt,d6 as Ut,lQ as Ga,bO as _a,br as Gt,bP as _t,F3 as Ma,XK as Oa,Ls as Na,Ly as Xa,Bf as za,Hh as Ha,HX as Za,m1 as ge,XL as Wa,XM as Mt,mv as qa,lX as Ot,mg as Nt,mf as ot,bE as pe,bN as Qa,XN as Ja,XO as ye,kr as Ka,XP as lt,XQ as Ya,kv as en,kQ as tn,I9 as an,XR as nn,mo as on,H$ as ln,XS as st,I3 as sn,I8 as rn,I6 as cn,HZ as dn,XT as Xt,G9 as un,XU as pn,XV as mn,gD as bn,gC as hn,gB as gn,m4 as Sn,mm as rt,mx as yn,u1 as fn,md as In,I1 as vn,kB as kn,mC as wn,XW as Bn,kt as xn,tU as Cn,XX as An,GY as En,bK as Dn,bt as Tn,Tc as jn,d9 as Pn,d8 as Fn,cE as Rn,cL as Vn}from"./zeni-epic-state-2zvjmkUL.js";import{E as ue,z as L,U as fe,aq as Ze,I as oe,d as g,bg as We,a5 as se,K as A,a6 as Ee,l 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 Un,ad as Gn,aW as _n,a9 as zt,G as De,ae as Qe,bw as Mn,ac as Ht,bx as On,ao as Nn,S as Zt,w as Xn,by as zn,bz as Hn,bA as Zn,bB as Wn,bC as qn,bD as Qn,bE as Jn,bF as Kn,bG as Yn,c as ei,bH as ti,bp as ai,bI as ni,ag as ii,bJ as oi,j as li}from"./index-Blw4A66-.js";import{n as G,S as si}from"./mui-DPmPgDDD.js";import{A as ut}from"./AddressScreen-TLZdvXNy.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-i7JC-m7w.js";import{a as f}from"./sentry-C6D8WJ15.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-5qRN6gKs.js";import{u as qt}from"./useInitialThreadRequest-Ddm4sao-.js";import{u as ui}from"./BusinessVerificationPageScreen-BYV8fDWH.js";import Ce from"./NotFoundScreen-Wkt8x0Ja.js";import{D as pi}from"./DrawerScreen-DUO1Z5ow.js";import{M as Qt}from"./MobileAppDrawer-BMvh-RAa.js";import{F as Jt}from"./FeaturePreviewScreen-CjFoHQHk.js";import{S as je}from"./SetupPagesScreen-o-PhLBXH.js";import{B as mi}from"./BillPayApprovalRoutes-DPALyyf2.js";import{F as bi}from"./ScreenRoutes-B2jpCRd2.js";import"./recharts-WuCIKI4c.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.js";import"./routePaths-1GgW-roh.js";import"./InboxNotificationsProvider-7eYmgI1F.js";import"./useTaskManagerAccess-BKVtGCGL.js";import"./analyticsHelper-Bw6Cjeqd.js";import"./ReimbursementApprovalRuleDetailScreen-kIivYyt0.js";import"./getLocaleForTenant-B0nO-Z7L.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]="6ba9f984-3946-4fb7-8aa8-9b6d654084a0",e._sentryDebugIdIdentifier="sentry-dbid-6ba9f984-3946-4fb7-8aa8-9b6d654084a0")}catch{}})();const hi=Y((function(e,t){const l=Ge(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((z=>Z(z))),s=k((z=>Ge(z,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}=Ye({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),X=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:Q}=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&&(X||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,X,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,$,Q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,Q]),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:z=>(U=>{n!=null&&U.trackBillPayBillDetails(n,s.isRecurring)})(z)}),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 zt(100,58)},mt=Y((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 X=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ge(F,n??"")));u===!1&&(X=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const Q=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((()=>{X==="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 z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Q??"",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(Q??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},U=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(X==="Error"||q.fetchState==="Error")return a.jsx(Ce,{});if(X!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:U,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:Q}),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:U,"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:U,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Un,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,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=G.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{a as V}from"./sentry-Dh9UB4O6.js";import{u as Y,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-BaXck2Yj.js";import{fB as U,GC as ce,Y3 as ue,AG as de,Rk as pe,GS as le,K1 as me,MQ as fe,Nu as ye,Oj as Se,Y4 as ge,Y5 as Ie,Y6 as be,Y7 as he,Y8 as Te,Uj as De,X9 as Oe,Uy as Ce,L5 as ke,Uz as Ve,L9 as Ae,ml as we,gD as Ne,gC as Fe,gB as _e,u1 as ve,tU as xe,tR as Ee,md as Be,AP as Ue,AN as z,bE as R,A$ as P,cD as ze}from"./zeni-epic-state-Bo1fQFWK.js";import{bQ as Re,U as Pe,I as Le,bg as je,z as B,a6 as Me,l as L,r as x,S as E,bS as Ge,ac as Ye,p as j,aE as M}from"./index-BmT_wdak.js";import{n as $e}from"./mui-CeNVlxCm.js";import{j as k}from"./liveblocks-CM7ZQqxd.js";import{d as G}from"./routePaths-jc2bzNg2.js";import{M as qe}from"./MobileAppDrawer-AMYN8Gjf.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]="0d46b44f-d204-48db-be13-fc87baa2e321",t._sentryDebugIdIdentifier="sentry-dbid-0d46b44f-d204-48db-be13-fc87baa2e321")}catch{}})();function nt(){const t=Y(),u=h((r=>U(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Re(n),p=h((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const Qe=$e.div`
1
+ import{a as V}from"./sentry-C6D8WJ15.js";import{u as Y,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-Dlma5MIa.js";import{fB as U,GC as ce,Y3 as ue,AG as de,Rk as pe,GS as le,K1 as me,MQ as fe,Nu as ye,Oj as Se,Y4 as ge,Y5 as Ie,Y6 as be,Y7 as he,Y8 as Te,Uj as De,X9 as Oe,Uy as Ce,L5 as ke,Uz as Ve,L9 as Ae,ml as we,gD as Ne,gC as Fe,gB as _e,u1 as ve,tU as xe,tR as Ee,md as Be,AP as Ue,AN as z,bE as R,A$ as P,cD as ze}from"./zeni-epic-state-2zvjmkUL.js";import{bQ as Re,U as Pe,I as Le,bg as je,z as B,a6 as Me,l as L,r as x,S as E,bS as Ge,ac as Ye,p as j,aE as M}from"./index-Blw4A66-.js";import{n as $e}from"./mui-DPmPgDDD.js";import{j as k}from"./liveblocks-BD1fi6wA.js";import{d as G}from"./routePaths-1GgW-roh.js";import{M as qe}from"./MobileAppDrawer-BMvh-RAa.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]="0d46b44f-d204-48db-be13-fc87baa2e321",t._sentryDebugIdIdentifier="sentry-dbid-0d46b44f-d204-48db-be13-fc87baa2e321")}catch{}})();function nt(){const t=Y(),u=h((r=>U(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Re(n),p=h((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const Qe=$e.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-CM7ZQqxd.js";import{a as l}from"./sentry-Dh9UB4O6.js";import{u as pe,h as he,g as Ce,j as B,i as fe,l as Se}from"./core-BaXck2Yj.js";import{a as ge,e2 as be,z as ye,e3 as Pe,e5 as z,e6 as Ie,bl as W,a6 as we,l as $,e7 as H,eh as Ee,G as ke,S 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-BmT_wdak.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-Bo1fQFWK.js";import{D as We,n as D,P as Ge,S as Ye}from"./mui-CeNVlxCm.js";import"./recharts-BKC_cH7h.js";import"./analytics-WNjEvDwJ.js";import"./plaid-D9ECXCuG.js";import"./dnd-Cyb1SC5Y.js";import"./stripe-cKAAJElX.js";import"./lottie-DYRVCvl4.js";import"./lexical-VH6dL15l.js";import"./pdf-Dhhhum3V.js";import"./utils-X6jrk5Hl.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]="b9c80339-3ec4-4d3d-aeae-14ded7c0695a",e._sentryDebugIdIdentifier="sentry-dbid-b9c80339-3ec4-4d3d-aeae-14ded7c0695a")}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=Se((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,gt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),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,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[S]);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 g.jsxs(tt,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.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}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?X(s):j(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(n.userRoleId)))}}),g.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:g.jsx(et,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(M(n.userRoleId)),h(!1)}})})})]})},et=D(Ye)`
1
+ import{j as g}from"./liveblocks-BD1fi6wA.js";import{a as l}from"./sentry-C6D8WJ15.js";import{u as pe,h as he,g as Ce,j as B,i as fe,l as Se}from"./core-Dlma5MIa.js";import{a as ge,e2 as be,z as ye,e3 as Pe,e5 as z,e6 as Ie,bl as W,a6 as we,l as $,e7 as H,eh as Ee,G as ke,S 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-Blw4A66-.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-2zvjmkUL.js";import{D as We,n as D,P as Ge,S as Ye}from"./mui-DPmPgDDD.js";import"./recharts-WuCIKI4c.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.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]="b9c80339-3ec4-4d3d-aeae-14ded7c0695a",e._sentryDebugIdIdentifier="sentry-dbid-b9c80339-3ec4-4d3d-aeae-14ded7c0695a")}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=Se((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,gt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),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,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[S]);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 g.jsxs(tt,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.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}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?X(s):j(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(n.userRoleId)))}}),g.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:g.jsx(et,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||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-CM7ZQqxd.js";import{u as me,j as d,h as de,g as he,i as Me,N as qe,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-BaXck2Yj.js";import{fO as Pt,_R as is,f_ as wt,bt as ve,_S as ds,_T as ls,fD as fn,_U as Pn,fM as wn,_V as Tn,_W as vn,_X as Fn,_Y as xn,fN as Bn,fZ as Ln,_Z as Rn,__ as us,fT as ms,fS as Cs,_$ as ps,J6 as On,g0 as ia,$0 as hs,$1 as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$2 as Ss,fW as ys,IE as Is,ID as ks,IH as Es,IJ as As,g6 as Ds,fA as $n,$3 as _s,$4 as Ps,gb as Mn,$5 as ws,gc as yt,IP as Ts,IM as vs,fB as fe,$6 as Za,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$7 as ua,$8 as Tt,B$ as Ga,lN as Ka,$9 as za,Jm as ka,g1 as Ze,Jo as vt,lD as Nn,$a as ma,Ja as _a,$b as Fs,$c as xs,Jd as qa,$d as Bs,Y0 as Xa,fY as Vn,Jj as ba,im as Ls,$e as Hn,fP as Ca,br as Rs,$f as Os,gD as Qa,gC as et,JS as Us,gB as at,$g as Gn,ct as Kn,d6 as js,X$ as wa,Kr as zn,$h as gn,K1 as Pa,$i as Yn,Ks as $s,Yp as Ms,Kt as Ns,Ly as Vs,Bf as Hs,Ls as Gs,$j as Ks,Jn as oa,$k as zs,$l as Ys,$m as Ws,$n as Js,$o as Zs,$p as Ft,$q as qs,JD as Wn,Jw as Xs,$r as Qs,gZ as eo,$s as Jn,JM as Zn,JQ as qn,gY as ao,$t as to,Kd as Xn,$u as no,$v as ro,$w as so,JO as Qn,Jz as er,Jg as ar,JI as tr,JG as nr,JK as oo,$x as rr,$y as co,g8 as io,g9 as lo,ga as uo,$z as tt,g2 as sr,d8 as xt,$A as mo,$B as Co,$C as po,$D as ho,JY as It,Kk as fo,Kg as go,JU as bo,Ki as So,K8 as yo,Ka as Io,$E as or,Kq as Ha,Rh as ko,$F as Eo,$G as Ao,$H as Do,$I as cr,$J as _o,KN as Po,K0 as ir,JX as $e,J$ as wo,$K as To,$L as vo,J7 as Fo,$M as dr,fX as lr,$N as xo,J9 as Bo,J8 as bn,$O as Lo,$P as Ro,$Q as Oo,Uk as Uo,$R as Bt,$S as jo,F6 as ur,ml as $o,ib as Mo,KS as No,$T as mr,fJ as Vo,fK as Ho,$U as Go,dJ as Ko,f$ as zo,KI as Yo,KC as Je,bq as Wo,bJ as Jo,cF as Zo,bK as qo,Tc as Xo}from"./zeni-epic-state-Bo1fQFWK.js";import{U as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Qo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,f as gr,ap as br,p as ke,I as le,d as W,k 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 Xe,bC as Rt,dn as cc,a9 as Fa,X as rt,E as Ot,l 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,O as kr,S as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,K as Ya,dB as Sc,dC as yc,m as ht,c as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,j as wc}from"./index-BmT_wdak.js";import{n as Ne,D as Ar,S as Tc}from"./mui-CeNVlxCm.js";import{a as r}from"./sentry-Dh9UB4O6.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-fsQB3AjS.js";import{M as Ee}from"./MobileAppDrawer-AMYN8Gjf.js";import{d as jt}from"./recharts-BKC_cH7h.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Qe,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-BSF8vuHb.js";import{u as Tr}from"./useInitialThreadRequest-DOTaljn2.js";import ot from"./NotFoundScreen-CbKfgA9a.js";import{u as Nt}from"./useChargeCardPusherEvents-CioB6dpi.js";import{n as yn}from"./utils-X6jrk5Hl.js";import{t as Lc}from"./AddressScreen-2iFQsQhr.js";import"./analytics-WNjEvDwJ.js";import"./plaid-D9ECXCuG.js";import"./dnd-Cyb1SC5Y.js";import"./stripe-cKAAJElX.js";import"./lottie-DYRVCvl4.js";import"./lexical-VH6dL15l.js";import"./pdf-Dhhhum3V.js";import"./InboxNotificationsProvider-DLtCSJ1e.js";import"./useTaskManagerAccess-LntCDDBS.js";import"./BusinessVerificationPageScreen-bzYA6ugA.js";import"./routePaths-jc2bzNg2.js";import"./analyticsHelper-BMvVz4OD.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]="fde0bd98-94a8-43ad-af01-646f33149592",e._sentryDebugIdIdentifier="sentry-dbid-fde0bd98-94a8-43ad-af01-646f33149592")}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),Z=O.poppedPathname??T;e(Z,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),J=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const Z=pr(O);t(gs({templates:[Z]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),X=r.useRef(V);r.useEffect((()=>{const O=X.current;X.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(Qo,{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:J,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(qe,{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`:"..",J=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 X=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(qe,{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:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:J,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:J,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:J}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:c}=fr(),O=gr(),Z=br(),se=d((q=>$n(q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:Q,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(Q,Ve,3)),[Q,Ve]),[ge,re]=r.useState(""),be=Z&&O&&N!=null&&!X,ue=r.useCallback((q=>{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:q,aiCfoShouldSubmit:q!=null&&q.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((q=>{q.trim().length!==0&&(re(""),ue(q))}),[ue]),Se=r.useCallback((()=>{const q=ge.trim();q.length!==0&&(re(""),ue(q))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((q=>{re(q)}),[]),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:J,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,J,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((Q=>fe(Q))),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((Q=>Za(Q).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((Q=>da(Q,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((Q=>ua(Q))),R=d((Q=>Q.classListState.fetchState)),i=!F&&k&&p,f=d((Q=>Tt(Q,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((Q=>x!=null?Ga(Q.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((Q=>V!=null?Ka(Q.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((Q=>P!=null?Ga(Q.userRoleState,P):void 0)),J=K?.accountingClassIDs[0],I=d((Q=>J!=null?Ka(Q.classState,{classId:J,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 Q=_e(s.tenantEmailDomain,a,t,U,m);e(Q)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(Ze()),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 X=()=>{if(t!=null&&a!=null){n(za());const Q=_e(s.tenantEmailDomain,a,t);e(Q)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Qe(k,B,_,p),Z=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:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:Z,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",Jc="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}`)),Zc=[Ra,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Xc(){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??Qc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,Zc),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(qc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Qc=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(Xe.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(qa()),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(Xa()),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 J=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:J}),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:()=>{J(!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(Qa(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-BD1fi6wA.js";import{u as me,j as d,h as de,g as he,i as Me,N as qe,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-Dlma5MIa.js";import{fO as Pt,_R as is,f_ as wt,bt as ve,_S as ds,_T as ls,fD as fn,_U as Pn,fM as wn,_V as Tn,_W as vn,_X as Fn,_Y as xn,fN as Bn,fZ as Ln,_Z as Rn,__ as us,fT as ms,fS as Cs,_$ as ps,J6 as On,g0 as ia,$0 as hs,$1 as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$2 as Ss,fW as ys,IE as Is,ID as ks,IH as Es,IJ as As,g6 as Ds,fA as $n,$3 as _s,$4 as Ps,gb as Mn,$5 as ws,gc as yt,IP as Ts,IM as vs,fB as fe,$6 as Za,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$7 as ua,$8 as Tt,B$ as Ga,lN as Ka,$9 as za,Jm as ka,g1 as Ze,Jo as vt,lD as Nn,$a as ma,Ja as _a,$b as Fs,$c as xs,Jd as qa,$d as Bs,Y0 as Xa,fY as Vn,Jj as ba,im as Ls,$e as Hn,fP as Ca,br as Rs,$f as Os,gD as Qa,gC as et,JS as Us,gB as at,$g as Gn,ct as Kn,d6 as js,X$ as wa,Kr as zn,$h as gn,K1 as Pa,$i as Yn,Ks as $s,Yp as Ms,Kt as Ns,Ly as Vs,Bf as Hs,Ls as Gs,$j as Ks,Jn as oa,$k as zs,$l as Ys,$m as Ws,$n as Js,$o as Zs,$p as Ft,$q as qs,JD as Wn,Jw as Xs,$r as Qs,gZ as eo,$s as Jn,JM as Zn,JQ as qn,gY as ao,$t as to,Kd as Xn,$u as no,$v as ro,$w as so,JO as Qn,Jz as er,Jg as ar,JI as tr,JG as nr,JK as oo,$x as rr,$y as co,g8 as io,g9 as lo,ga as uo,$z as tt,g2 as sr,d8 as xt,$A as mo,$B as Co,$C as po,$D as ho,JY as It,Kk as fo,Kg as go,JU as bo,Ki as So,K8 as yo,Ka as Io,$E as or,Kq as Ha,Rh as ko,$F as Eo,$G as Ao,$H as Do,$I as cr,$J as _o,KN as Po,K0 as ir,JX as $e,J$ as wo,$K as To,$L as vo,J7 as Fo,$M as dr,fX as lr,$N as xo,J9 as Bo,J8 as bn,$O as Lo,$P as Ro,$Q as Oo,Uk as Uo,$R as Bt,$S as jo,F6 as ur,ml as $o,ib as Mo,KS as No,$T as mr,fJ as Vo,fK as Ho,$U as Go,dJ as Ko,f$ as zo,KI as Yo,KC as Je,bq as Wo,bJ as Jo,cF as Zo,bK as qo,Tc as Xo}from"./zeni-epic-state-2zvjmkUL.js";import{U as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Qo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,f as gr,ap as br,p as ke,I as le,d as W,k 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 Xe,bC as Rt,dn as cc,a9 as Fa,X as rt,E as Ot,l 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,O as kr,S as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,K as Ya,dB as Sc,dC as yc,m as ht,c as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,j as wc}from"./index-Blw4A66-.js";import{n as Ne,D as Ar,S as Tc}from"./mui-DPmPgDDD.js";import{a as r}from"./sentry-C6D8WJ15.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-5qRN6gKs.js";import{M as Ee}from"./MobileAppDrawer-BMvh-RAa.js";import{d as jt}from"./recharts-WuCIKI4c.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Qe,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-o-PhLBXH.js";import{u as Tr}from"./useInitialThreadRequest-Ddm4sao-.js";import ot from"./NotFoundScreen-Wkt8x0Ja.js";import{u as Nt}from"./useChargeCardPusherEvents-Cu201ke6.js";import{n as yn}from"./utils-Bv9LDtmr.js";import{t as Lc}from"./AddressScreen-TLZdvXNy.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./InboxNotificationsProvider-7eYmgI1F.js";import"./useTaskManagerAccess-BKVtGCGL.js";import"./BusinessVerificationPageScreen-BYV8fDWH.js";import"./routePaths-1GgW-roh.js";import"./analyticsHelper-Bw6Cjeqd.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]="fde0bd98-94a8-43ad-af01-646f33149592",e._sentryDebugIdIdentifier="sentry-dbid-fde0bd98-94a8-43ad-af01-646f33149592")}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),Z=O.poppedPathname??T;e(Z,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),J=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const Z=pr(O);t(gs({templates:[Z]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),X=r.useRef(V);r.useEffect((()=>{const O=X.current;X.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(Qo,{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:J,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(qe,{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`:"..",J=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 X=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(qe,{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:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:J,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:J,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:J}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:c}=fr(),O=gr(),Z=br(),se=d((q=>$n(q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:Q,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(Q,Ve,3)),[Q,Ve]),[ge,re]=r.useState(""),be=Z&&O&&N!=null&&!X,ue=r.useCallback((q=>{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:q,aiCfoShouldSubmit:q!=null&&q.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((q=>{q.trim().length!==0&&(re(""),ue(q))}),[ue]),Se=r.useCallback((()=>{const q=ge.trim();q.length!==0&&(re(""),ue(q))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((q=>{re(q)}),[]),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:J,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,J,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((Q=>fe(Q))),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((Q=>Za(Q).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((Q=>da(Q,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((Q=>ua(Q))),R=d((Q=>Q.classListState.fetchState)),i=!F&&k&&p,f=d((Q=>Tt(Q,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((Q=>x!=null?Ga(Q.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((Q=>V!=null?Ka(Q.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((Q=>P!=null?Ga(Q.userRoleState,P):void 0)),J=K?.accountingClassIDs[0],I=d((Q=>J!=null?Ka(Q.classState,{classId:J,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 Q=_e(s.tenantEmailDomain,a,t,U,m);e(Q)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(Ze()),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 X=()=>{if(t!=null&&a!=null){n(za());const Q=_e(s.tenantEmailDomain,a,t);e(Q)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Qe(k,B,_,p),Z=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:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:Z,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",Jc="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}`)),Zc=[Ra,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Xc(){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??Qc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,Zc),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(qc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Qc=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(Xe.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(qa()),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(Xa()),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 J=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:J}),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:()=>{J(!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(Qa(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-CM7ZQqxd.js";import{a as g}from"./sentry-Dh9UB4O6.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-BaXck2Yj.js";import{z as C,bp as F,a6 as P,l as A,S as V,r as b,bq as j,ac as L,aE as U,p as B}from"./index-BmT_wdak.js";import{fB as N,gF as M,AG as R,gA as _,c7 as G,X9 as z,bn as X,u1 as Y,tR as Z,md as q,nO as S,Xa as H,bE as $,cD as D,nZ as J,o7 as K}from"./zeni-epic-state-Bo1fQFWK.js";import"./mui-CeNVlxCm.js";import{d as Q}from"./routePaths-jc2bzNg2.js";import{M as W}from"./MobileAppDrawer-AMYN8Gjf.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]="38958817-42c7-4c88-b550-0b5dcba73072",t._sentryDebugIdIdentifier="sentry-dbid-38958817-42c7-4c88-b550-0b5dcba73072")}catch{}})();const ee=E((function(t){const a=_(t),i=C.getSignedInUser(),p=N(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=G(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(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:X(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(K())},onAddressClick:e=>{const n=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({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?D(u):void 0,meetingLink:y!=""&&y!=null?D(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?$(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(H(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(q({files:e}))},onDeleteFile:e=>{t(Z(e))},onEditFileName:(e,n)=>{t(Y(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=>N(s))),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(R())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{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-BD1fi6wA.js";import{a as g}from"./sentry-C6D8WJ15.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-Dlma5MIa.js";import{z as C,bp as F,a6 as P,l as A,S as V,r as b,bq as j,ac as L,aE as U,p as B}from"./index-Blw4A66-.js";import{fB as N,gF as M,AG as R,gA as _,c7 as G,X9 as z,bn as X,u1 as Y,tR as Z,md as q,nO as S,Xa as H,bE as $,cD as D,nZ as J,o7 as K}from"./zeni-epic-state-2zvjmkUL.js";import"./mui-DPmPgDDD.js";import{d as Q}from"./routePaths-1GgW-roh.js";import{M as W}from"./MobileAppDrawer-BMvh-RAa.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]="38958817-42c7-4c88-b550-0b5dcba73072",t._sentryDebugIdIdentifier="sentry-dbid-38958817-42c7-4c88-b550-0b5dcba73072")}catch{}})();const ee=E((function(t){const a=_(t),i=C.getSignedInUser(),p=N(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=G(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(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:X(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(K())},onAddressClick:e=>{const n=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({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?D(u):void 0,meetingLink:y!=""&&y!=null?D(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?$(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(H(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(q({files:e}))},onDeleteFile:e=>{t(Z(e))},onEditFileName:(e,n)=>{t(Y(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=>N(s))),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(R())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{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-CM7ZQqxd.js";import{a as o}from"./sentry-Dh9UB4O6.js";import{u as R,h as k,g as H,j as C,N as j}from"./core-BaXck2Yj.js";import{SV as q,fB as z,gh as G,pw as V,gJ as A,gg as B,ge as J,Tf as K,gd as O}from"./zeni-epic-state-Bo1fQFWK.js";import{u as Q,z as E,L as D,G as M,K as W}from"./index-BmT_wdak.js";import{n as X}from"./mui-CeNVlxCm.js";import{P as h,a as _}from"./AccountMappingScreen-DA6vMX8n.js";import{t as Y}from"./getLocaleForTenant-DEaI00lX.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-CgDmO8dD.js";import"./recharts-BKC_cH7h.js";import"./analytics-WNjEvDwJ.js";import"./plaid-D9ECXCuG.js";import"./dnd-Cyb1SC5Y.js";import"./stripe-cKAAJElX.js";import"./lottie-DYRVCvl4.js";import"./lexical-VH6dL15l.js";import"./pdf-Dhhhum3V.js";import"./utils-X6jrk5Hl.js";import"./MobileAppDrawer-AMYN8Gjf.js";import"./InboxNotificationsProvider-DLtCSJ1e.js";import"./useTaskManagerAccess-LntCDDBS.js";import"./accountMappingHelper-ChrGBc2n.js";import"./empty-M_3v5JZA.js";import"./pdf-lib-BXvJUWv4.js";import"./index-DGxDcX9G.js";import"./url-CV8DVrqd.js";import"./index-DTuBENEN.js";import"./decodeURIComponentSafe-B0jtUms3.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]="2090b9db-1f32-4376-a169-e6361ec22e6f",t._sentryDebugIdIdentifier="sentry-dbid-2090b9db-1f32-4376-a169-e6361ec22e6f")}catch{}})();const te=X.div`
1
+ import{j as I}from"./liveblocks-BD1fi6wA.js";import{a as o}from"./sentry-C6D8WJ15.js";import{u as R,h as k,g as H,j as C,N as j}from"./core-Dlma5MIa.js";import{SV as q,fB as z,gh as G,pw as V,gJ as A,gg as B,ge as J,Tf as K,gd as O}from"./zeni-epic-state-2zvjmkUL.js";import{u as Q,z as E,L as D,G as M,K as W}from"./index-Blw4A66-.js";import{n as X}from"./mui-DPmPgDDD.js";import{P as h,a as _}from"./AccountMappingScreen-BXftSVn-.js";import{t as Y}from"./getLocaleForTenant-B0nO-Z7L.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-Cxvr0UGn.js";import"./recharts-WuCIKI4c.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.js";import"./MobileAppDrawer-BMvh-RAa.js";import"./InboxNotificationsProvider-7eYmgI1F.js";import"./useTaskManagerAccess-BKVtGCGL.js";import"./accountMappingHelper-DsN6SM7a.js";import"./empty-DpC6uPKD.js";import"./pdf-lib-BSghpPvP.js";import"./index-Cr8P80rT.js";import"./url-BVCS53n5.js";import"./index-CYHgs6V3.js";import"./decodeURIComponentSafe-MgEJs-XP.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]="2090b9db-1f32-4376-a169-e6361ec22e6f",t._sentryDebugIdIdentifier="sentry-dbid-2090b9db-1f32-4376-a169-e6361ec22e6f")}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-BD1fi6wA.js";import{z as a}from"./index-Blw4A66-.js";import{g as n}from"./QBOConnectionScreen-Cxvr0UGn.js";import"./sentry-C6D8WJ15.js";import{g as p,N as s}from"./core-Dlma5MIa.js";import"./zeni-epic-state-2zvjmkUL.js";import"./recharts-WuCIKI4c.js";import"./mui-DPmPgDDD.js";import"./analytics-NBT5BH2R.js";import"./plaid-w5kSeMkL.js";import"./dnd-BgBEAfSC.js";import"./stripe-cKAAJElX.js";import"./lottie-Dd5kLrRz.js";import"./lexical-Cc-23sPJ.js";import"./pdf-BCsxh4ki.js";import"./utils-Bv9LDtmr.js";import"./empty-DpC6uPKD.js";import"./pdf-lib-BSghpPvP.js";import"./index-Cr8P80rT.js";import"./url-BVCS53n5.js";import"./index-CYHgs6V3.js";import"./decodeURIComponentSafe-MgEJs-XP.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};